PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ipdsock.h
Go to the documentation of this file.
1 /*
2  * ipdsock.h
3  *
4  * IP Datagram socket I/O channel class.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 25756 $
30  * $Author: csoutheren $
31  * $Date: 2011-05-12 16:07:24 +1000 (Thu, 12 May 2011) $
32  */
33 
34 #ifndef PTLIB_IPDATAGRAMSOCKET_H
35 #define PTLIB_IPDATAGRAMSOCKET_H
36 
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40 
41 #include <ptlib/ipsock.h>
42 
46 {
47  PCLASSINFO(PIPDatagramSocket, PIPSocket);
48  protected:
53 
54 
55  public:
56  // New functions for class
61  virtual PBoolean ReadFrom(
62  void * buf,
63  PINDEX len,
64  Address & addr,
65  WORD & port
66  );
67  virtual PBoolean ReadFrom(
68  void * buf,
69  PINDEX len,
70  PIPSocketAddressAndPort & ipAndPort
71  );
72 
73  virtual PBoolean ReadFrom(
74  Slice * slices,
75  size_t sliceCount,
76  Address & addr,
77  WORD & port
78  );
79  virtual PBoolean ReadFrom(
80  Slice * slices,
81  size_t sliceCount,
82  PIPSocketAddressAndPort & ipAndPort
83  );
84 
89  virtual PBoolean WriteTo(
90  const void * buf,
91  PINDEX len,
92  const Address & addr,
93  WORD port
94  );
95  virtual PBoolean WriteTo(
96  const void * buf,
97  PINDEX len,
98  const PIPSocketAddressAndPort & ipAndPort
99  );
100 
101  virtual PBoolean WriteTo(
102  const Slice * slices,
103  size_t sliceCount,
104  const Address & addr,
105  WORD port
106  );
107  virtual PBoolean WriteTo(
108  const Slice * slices,
109  size_t sliceCount,
110  const PIPSocketAddressAndPort & ipAndPort
111  );
112 
113 
114 // Include platform dependent part of class
115 #ifdef _WIN32
116 #include "msos/ptlib/ipdsock.h"
117 #else
118 #include "unix/ptlib/ipdsock.h"
119 #endif
120 
121  public:
122 
123  // Normally, one would expect these to be protected, but they are just so darn
124  // useful that it's just easier if they are public
125  virtual bool InternalReadFrom(
126  Slice * slices,
127  size_t sliceCount,
128  PIPSocketAddressAndPort & ipAndPort
129  );
130 
131  virtual bool InternalWriteTo(
132  const Slice * slices,
133  size_t sliceCount,
134  const PIPSocketAddressAndPort & ipAndPort
135  );
136 };
137 
138 
139 #endif // PTLIB_IPDATAGRAMSOCKET_H
140 
141 
142 // End Of File ///////////////////////////////////////////////////////////////