summaryrefslogtreecommitdiff
path: root/ace/Asynch_IO_Impl.h
blob: c1ad52825b6e0cf0d1fba8e049c3d4ed6d7753c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Asynch_IO_Impl.h
 *
 *  $Id$
 *
 *
 *  This class contains asbtract base classes for all the concrete
 *  implementation classes for the various asynchronous operations
 *  that are used with the Praoctor.
 *
 *
 *  @author Irfan Pyarali (irfan@cs.wustl.edu)
 *  @author Tim Harrison (harrison@cs.wustl.edu)
 *  @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
 *  @author Roger Tragin <r.tragin@computer.org>
 *  @author Alexander Libman <alibman@ihug.com.au>
 */
//=============================================================================

#ifndef ACE_ASYNCH_IO_IMPL_H
#define ACE_ASYNCH_IO_IMPL_H
#include /**/ "ace/pre.h"

#include "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))
// This only works on Win32 platforms and on Unix platforms supporting
// aio calls.

#include "ace/Asynch_IO.h"

// Forward declaration.
class ACE_Proactor_Impl;

/**
 * @class ACE_Asynch_Result_Impl
 *
 * @brief Abstract base class for the all the classes that provide
 * concrete implementations for ACE_Asynch_Result.
 *
 */
class ACE_Export ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Result_Impl (void);

  /// Number of bytes transferred by the operation.
  virtual size_t bytes_transferred (void) const = 0;

  /// ACT associated with the operation.
  virtual const void *act (void) const = 0;

  /// Did the operation succeed?
  virtual int success (void) const = 0;

  /// This ACT is not the same as the ACT associated with the
  /// asynchronous operation.
  virtual const void *completion_key (void) const = 0;

  /// Error value if the operation fail.
  virtual u_long error (void) const = 0;

  /// Event associated with the OVERLAPPED structure.
  virtual ACE_HANDLE event (void) const = 0;

  /// This really make sense only when doing file I/O.
  virtual u_long offset (void) const = 0;
  virtual u_long offset_high (void) const = 0;

  /// Priority of the operation.
  virtual int priority (void) const = 0;

  /**
   * POSIX4 real-time signal number to be used for the
   * operation. <signal_number> ranges from SIGRTMIN to SIGRTMAX. By
   * default, SIGRTMIN is used to issue <aio_> calls. This is a no-op
   * on non-POSIX4 systems and returns 0.
   */
  virtual int signal_number (void) const = 0;

  // protected:
  //
  // These two should really be protected.  But sometimes it
  // simplifies code to be able to "fake" a result.  Use carefully.
  /// This is called when the asynchronous operation completes.
  virtual void complete (size_t bytes_transferred,
                         int success,
                         const void *completion_key,
                         u_long error = 0) = 0;

  /// Post <this> to the Proactor's completion port.
  virtual int post_completion (ACE_Proactor_Impl *proactor) = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Result_Impl (void);
};

/**
 * @class ACE_Asynch_Operation_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Operation.
 */
class ACE_Export ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Operation_Impl (void);

  /**
   * Initializes the factory with information which will be used with
   * each asynchronous call.  If (<handle> == ACE_INVALID_HANDLE),
   * <ACE_Handler::handle> will be called on the <handler> to get the
   * correct handle.
   */
  virtual int open (ACE_Handler &handler,
                    ACE_HANDLE handle,
                    const void *completion_key,
                    ACE_Proactor *proactor) = 0;

  /**
   * This cancels all pending accepts operations that were issued by
   * the calling thread.  The function does not cancel asynchronous
   * operations issued by other threads.
   */
  virtual int cancel (void) = 0;

  // = Access methods.

  /// Return the underlying proactor.
  virtual ACE_Proactor* proactor (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Operation_Impl (void);
};

/**
 * @class ACE_Asynch_Read_Stream_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Read_Stream
 *
 */
class ACE_Export ACE_Asynch_Read_Stream_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Read_Stream_Impl (void);

  /// This starts off an asynchronous read. Upto <bytes_to_read> will
  /// be read and stored in the <message_block>.
  virtual int read (ACE_Message_Block &message_block,
                    size_t bytes_to_read,
                    const void *act,
                    int priority,
                    int signal_number) = 0;

#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
  /**
  * Same as above but with scatter support, through chaining of composite
  * message blocks using the continuation field.
  */
  virtual int readv (ACE_Message_Block &message_block,
                     size_t bytes_to_read,
                     const void *act,
                     int priority,
                     int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Read_Stream_Impl (void);
};

/**
 * @class ACE_Asynch_Read_Stream_Result_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Read_Stream::Result class.
 *
 */
class ACE_Export ACE_Asynch_Read_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Read_Stream_Result_Impl (void);

  /// The number of bytes which were requested at the start of the
  /// asynchronous read.
  virtual size_t bytes_to_read (void) const = 0;

  /// Message block which contains the read data.
  virtual ACE_Message_Block &message_block (void) const = 0;

  /// I/O handle used for reading.
  virtual ACE_HANDLE handle (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Read_Stream_Result_Impl (void);
};

/**
 * @class ACE_Asynch_Write_Stream_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Write_Stream class.
 *
 */
class ACE_Export ACE_Asynch_Write_Stream_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Write_Stream_Impl (void);

  /// This starts off an asynchronous write.  Upto <bytes_to_write>
  /// will be written from the <message_block>.
  virtual int write (ACE_Message_Block &message_block,
                     size_t bytes_to_write,
                     const void *act,
                     int priority,
                     int signal_number) = 0;

#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
  /**
  * Same as above but with gather support, through chaining of composite
  * message blocks using the continuation field.
  */
  virtual int writev (ACE_Message_Block &message_block,
                      size_t bytes_to_write,
                      const void *act,
                      int priority,
                      int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Write_Stream_Impl (void);
};

/**
 * @class ACE_Asynch_Write_Stream_Result_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Write_Stream::Result.
 *
 */
class ACE_Export ACE_Asynch_Write_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Write_Stream_Result_Impl (void);

  /// The number of bytes which were requested at the start of the
  /// asynchronous write.
  virtual size_t bytes_to_write (void) const = 0;

  /// Message block that contains the data to be written.
  virtual ACE_Message_Block &message_block (void) const = 0;

  /// I/O handle used for writing.
  virtual ACE_HANDLE handle (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Write_Stream_Result_Impl (void);
};

/**
 * @class ACE_Asynch_Read_File_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Read_File::Result.
 *
 */
class ACE_Export ACE_Asynch_Read_File_Impl : public virtual ACE_Asynch_Read_Stream_Impl
{
public:
  virtual ~ACE_Asynch_Read_File_Impl (void);

  /**
   * This starts off an asynchronous read.  Upto <bytes_to_read> will
   * be read and stored in the <message_block>.  The read will start
   * at <offset> from the beginning of the file.
   */
  virtual int read (ACE_Message_Block &message_block,
                    size_t bytes_to_read,
                    u_long offset,
                    u_long offset_high,
                    const void *act,
                    int priority,
                    int signal_number) = 0;

#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
  /**
  * Same as above but with scatter support, through chaining of composite
  * message blocks using the continuation field.
  * NOTE: In win32 Each data block payload must be at least the size of a system
  * memory page and must be aligned on a system memory page size boundary
  */
  virtual int readv (ACE_Message_Block &message_block,
                     size_t bytes_to_read,
                     u_long offset,
                     u_long offset_high,
                     const void *act,
                     int priority,
                     int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */

  // We don;t need to redefine the following function again because it
  // has already been defined in ACE_Asynch_Read_Stream_Impl.  But we
  // still need it here to supress a overwriting pure virtual function
  // warning in KAI compiler.
  /// This starts off an asynchronous read. Upto <bytes_to_read> will
  /// be read and stored in the <message_block>.
  virtual int read (ACE_Message_Block &message_block,
                    size_t bytes_to_read,
                    const void *act,
                    int priority,
                    int signal_number) = 0;

#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
  /**
  * Same as above but with scatter support, through chaining of composite
  * message blocks using the continuation field.
  */
  virtual int readv (ACE_Message_Block &message_block,
                     size_t bytes_to_read,
                     const void *act,
                     int priority,
                     int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Read_File_Impl (void);
};

/**
 * @class ACE_Asynch_Read_File_Result_Impl
 *
 * @brief This is the abstract base class for all the concrete
 * implementation classes for ACE_Asynch_Read_File::Result.
 *
 */
class ACE_Export ACE_Asynch_Read_File_Result_Impl : public virtual ACE_Asynch_Read_Stream_Result_Impl
{
public:
  /// Destructor.
  virtual ~ACE_Asynch_Read_File_Result_Impl (void);

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Read_File_Result_Impl (void);
};

/**
 * @class ACE_Asynch_Write_File_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Write_File.
 *
 */
class ACE_Export ACE_Asynch_Write_File_Impl : public virtual ACE_Asynch_Write_Stream_Impl
{
public:
  virtual ~ACE_Asynch_Write_File_Impl (void);

  /**
   * This starts off an asynchronous write.  Upto <bytes_to_write>
   * will be write and stored in the <message_block>.  The write will
   * start at <offset> from the beginning of the file.
   */
  virtual int write (ACE_Message_Block &message_block,
                     size_t bytes_to_write,
                     u_long offset,
                     u_long offset_high,
                     const void *act,
                     int priority,
                     int signal_number) = 0;

#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
  /**
  * Same as above but with gather support, through chaining of composite
  * message blocks using the continuation field.
  * NOTE: In win32 Each data block payload must be at least the size of a system
  * memory page and must be aligned on a system memory page size boundary
  */
  virtual int writev (ACE_Message_Block &message_block,
                      size_t bytes_to_write,
                      u_long offset,
                      u_long offset_high,
                      const void *act,
                      int priority,
                      int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */


  // We don;t need to redefine the following function again because it
  // has already been defined in ACE_Asynch_Write_Stream_Impl.  But we
  // still need it here to supress a overwriting pure virtual function
  // warning in KAI compiler.
  /// This starts off an asynchronous write.  Upto <bytes_to_write>
  /// will be written from the <message_block>.
  virtual int write (ACE_Message_Block &message_block,
                     size_t bytes_to_write,
                     const void *act,
                     int priority,
                     int signal_number) = 0;

#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
  /**
  * Same as above but with gather support, through chaining of composite
  * message blocks using the continuation field.
  */
  virtual int writev (ACE_Message_Block &message_block,
                      size_t bytes_to_write,
                      const void *act,
                      int priority,
                      int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Write_File_Impl (void);
};

/**
 * @class ACE_Asynch_Write_File_Result_Impl
 *
 * @brief This is the abstract base class for all the concrete
 * implementation classes that provide different implementations
 * for the ACE_Asynch_Write_File::Result.
 *
 */
class ACE_Export ACE_Asynch_Write_File_Result_Impl : public virtual ACE_Asynch_Write_Stream_Result_Impl
{
public:
  virtual ~ACE_Asynch_Write_File_Result_Impl (void);

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Write_File_Result_Impl (void);
};

/**
 * @class ACE_Asynch_Accept_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Accept.
 *
 */
class ACE_Export ACE_Asynch_Accept_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Accept_Impl (void);

  /**
   * This starts off an asynchronous accept.  The asynchronous accept
   * call also allows any initial data to be returned to the
   * <handler>.  Upto <bytes_to_read> will be read and stored in the
   * <message_block>.  The <accept_handle> will be used for the
   * <accept> call.  If (<accept_handle> == INVALID_HANDLE), a new
   * handle will be created.
   *
   * <message_block> must be specified. This is because the address of
   * the new connection is placed at the end of this buffer.
   */
  virtual int accept (ACE_Message_Block &message_block,
                      size_t bytes_to_read,
                      ACE_HANDLE accept_handle,
                      const void *act,
                      int priority,
                    int signal_number) = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Accept_Impl (void);
};

/**
 * @class ACE_Asynch_Accept_Result_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Accept.
 *
 */
class ACE_Export ACE_Asynch_Accept_Result_Impl : public virtual ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Accept_Result_Impl (void);

  /// The number of bytes which were requested at the start of the
  /// asynchronous accept.
  virtual size_t bytes_to_read (void) const = 0;

  /// Message block which contains the read data.
  virtual ACE_Message_Block &message_block (void) const = 0;

  /// I/O handle used for accepting new connections.
  virtual ACE_HANDLE listen_handle (void) const = 0;

  /// I/O handle for the new connection.
  virtual ACE_HANDLE accept_handle (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Accept_Result_Impl (void);
};


/**
 * @class ACE_Asynch_Connect_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Connect.
 *
 */
class ACE_Export ACE_Asynch_Connect_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Connect_Impl (void);

  /**
   * This starts off an asynchronous connect
   */
  virtual int connect (ACE_HANDLE connect_handle,
                       const ACE_Addr & remote_sap,
                       const ACE_Addr & local_sap,
                       int   reuse_addr,
                       const void *act,
                       int   priority,
                       int   signal_number) = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Connect_Impl (void);
};

/**
 * @class ACE_Asynch_Connect_Result_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Connect.
 *
 */
class ACE_Export ACE_Asynch_Connect_Result_Impl : public virtual ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Connect_Result_Impl (void);

  /// I/O handle for the connection.
  virtual ACE_HANDLE connect_handle (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Connect_Result_Impl (void);
};


/**
 * @class ACE_Asynch_Transmit_File_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Transmit_File.
 *
 */
class ACE_Asynch_Transmit_File_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Transmit_File_Impl (void);

  /// This starts off an asynchronous transmit file.
  virtual int transmit_file (ACE_HANDLE file,
                             ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
                             size_t bytes_to_write,
                             u_long offset,
                             u_long offset_high,
                             size_t bytes_per_send,
                             u_long flags,
                             const void *act,
                             int priority,
                             int signal_number) = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Transmit_File_Impl (void);
};

/**
 * @class ACE_Asynch_Transmit_File_Result_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Transmit_File::Result.
 *
 */
class ACE_Export ACE_Asynch_Transmit_File_Result_Impl : public virtual ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Transmit_File_Result_Impl (void);

  /// Socket used for transmitting the file.
  virtual ACE_HANDLE socket (void) const = 0;

  /// File from which the data is read.
  virtual ACE_HANDLE file (void) const = 0;

  /// Header and trailer data associated with this transmit file.
  virtual ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const = 0;

  /// The number of bytes which were requested at the start of the
  /// asynchronous transmit file.
  virtual size_t bytes_to_write (void) const = 0;

  /// Number of bytes per send requested at the start of the transmit
  /// file.
  virtual size_t bytes_per_send (void) const = 0;

  /// Flags which were passed into transmit file.
  virtual u_long flags (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Transmit_File_Result_Impl (void);
};


/**
 * @class ACE_Asynch_Read_Dgram_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Read_Dgram
 *
 */
class ACE_Export ACE_Asynch_Read_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Read_Dgram_Impl (void);

  /** This starts off an asynchronous read.  Upto
   * <message_block->total_size()> will be read and stored in the
   * <message_block>.  <message_block>'s <wr_ptr> will be updated to reflect
   * the added bytes if the read operation is successful completed.
   * Return code of 1 means immediate success and <number_of_bytes_recvd>
   * will contain number of bytes read.  The <ACE_Handler::handle_read_dgram>
   * method will still be called.  Return code of 0 means the IO will
   * complete proactively.  Return code of -1 means there was an error, use
   * errno to get the error code.
   *
   * Scatter/gather is supported on WIN32 by using the <message_block->cont()>
   * method.  Up to ACE_IOV_MAX <message_block>'s are supported.  Upto
   * <message_block->size()> bytes will be read into each <message block> for
   * a total of <message_block->total_size()> bytes.  All <message_block>'s
   * <wr_ptr>'s will be updated to reflect the added bytes for each
   * <message_block>
   *
   * Priority of the operation is specified by <priority>. On POSIX4-Unix,
   * this is supported. Works like <nice> in Unix. Negative values are not
   * allowed. 0 means priority of the operation same as the process
   * priority. 1 means priority of the operation is one less than
   * process. And so forth. On Win32, <priority> is a no-op.
   * <signal_number> is the POSIX4 real-time signal number to be used
   * for the operation. <signal_number> ranges from ACE_SIGRTMIN to
   * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems.
   */
  virtual ssize_t recv (ACE_Message_Block *message_block,
                        size_t &number_of_bytes_recvd,
                        int flags,
                        int protocol_family,
                        const void *act,
                        int priority,
                        int signal_number) = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Read_Dgram_Impl (void);
};

/**
 * @class ACE_Asynch_Read_Dgram_Result_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Read_Dgram::Result class.
 *
 */
class ACE_Export ACE_Asynch_Read_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Read_Dgram_Result_Impl (void);

  /// Message block which contains the read data
  virtual ACE_Message_Block *message_block (void) const = 0;

  /// The number of bytes which were requested at the start of the
  /// asynchronous read.
  virtual size_t bytes_to_read (void) const = 0;

  /// The address of where the packet came from
  virtual int remote_address (ACE_Addr& addr) const = 0;

  /// The flags used in the read
  virtual int flags (void) const = 0;

  /// I/O handle used for reading.
  virtual ACE_HANDLE handle (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Read_Dgram_Result_Impl (void);
};

/**
 * @class ACE_Asynch_Write_Dgram_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Write_Dgram class.
 *
 */
class ACE_Export ACE_Asynch_Write_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
  virtual ~ACE_Asynch_Write_Dgram_Impl (void);

  /** This starts off an asynchronous send.  Upto
   * <message_block->total_length()> will be sent.  <message_block>'s
   * <rd_ptr> will be updated to reflect the sent bytes if the send operation
   * is successful completed.
   * Return code of 1 means immediate success and <number_of_bytes_sent>
   * is updated to number of bytes sent.  The <ACE_Handler::handle_write_dgram>
   * method will still be called.  Return code of 0 means the IO will
   * complete proactively.  Return code of -1 means there was an error, use
   * errno to get the error code.
   *
   * Scatter/gather is supported on WIN32 by using the <message_block->cont()>
   * method.  Up to ACE_IOV_MAX <message_block>'s are supported.  Upto
   * <message_block->length()> bytes will be sent from each <message block>
   * for a total of <message_block->total_length()> bytes.  All
   * <message_block>'s <rd_ptr>'s will be updated to reflect the bytes sent
   * from each <message_block>.
   *
   * Priority of the operation is specified by <priority>. On POSIX4-Unix,
   * this is supported. Works like <nice> in Unix. Negative values are not
   * allowed. 0 means priority of the operation same as the process
   * priority. 1 means priority of the operation is one less than
   * process. And so forth. On Win32, this argument is a no-op.
   * <signal_number> is the POSIX4 real-time signal number to be used
   * for the operation. <signal_number> ranges from ACE_SIGRTMIN to
   * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems.
   */
  virtual ssize_t send (ACE_Message_Block *message_block,
                        size_t &number_of_bytes_sent,
                        int flags,
                        const ACE_Addr &addr,
                        const void *act,
                        int priority,
                        int signal_number) = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Write_Dgram_Impl (void);
};

/**
 * @class ACE_Asynch_Write_Dgram_Result_Impl
 *
 * @brief Abstract base class for all the concrete implementation
 * classes that provide different implementations for the
 * ACE_Asynch_Write_Dgram::Result class.
 *
 */
class ACE_Export ACE_Asynch_Write_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl
{
public:
  virtual ~ACE_Asynch_Write_Dgram_Result_Impl (void);

  /// The number of bytes which were requested at the start of the
  /// asynchronous write.
  virtual size_t bytes_to_write (void) const = 0;

  /// Message block which contains the sent data
  virtual ACE_Message_Block *message_block (void) const = 0;

  /// The flags using in the write
  virtual int flags (void) const = 0;

  /// I/O handle used for writing.
  virtual ACE_HANDLE handle (void) const = 0;

protected:
  /// Do-nothing constructor.
  ACE_Asynch_Write_Dgram_Result_Impl (void);
};

#if defined (__ACE_INLINE__)
#include "ace/Asynch_IO_Impl.inl"
#endif /* __ACE_INLINE__ */

#endif /* ACE_HAS_AIO_CALLS  || !ACE_HAS_WINCE && ACE_WIN32 */
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_IO_IMPL_H */