PTLib  Version 2.18.8
 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 
30 #ifndef PTLIB_IPDATAGRAMSOCKET_H
31 #define PTLIB_IPDATAGRAMSOCKET_H
32 
33 #ifdef P_USE_PRAGMA
34 #pragma interface
35 #endif
36 
37 #include <ptlib/ipsock.h>
38 
42 {
43  PCLASSINFO(PIPDatagramSocket, PIPSocket);
44  protected:
49 
50 
51  public:
52  // New functions for class
57  virtual PBoolean ReadFrom(
58  void * buf,
59  PINDEX len,
60  Address & addr,
61  WORD & port
62  );
63  virtual PBoolean ReadFrom(
64  void * buf,
65  PINDEX len,
66  PIPSocketAddressAndPort & ipAndPort
67  );
68 
69  virtual PBoolean ReadFrom(
70  Slice * slices,
71  size_t sliceCount,
72  Address & addr,
73  WORD & port
74  );
75  virtual PBoolean ReadFrom(
76  Slice * slices,
77  size_t sliceCount,
78  PIPSocketAddressAndPort & ipAndPort
79  );
80 
85  virtual PBoolean WriteTo(
86  const void * buf,
87  PINDEX len,
88  const Address & addr,
89  WORD port
90  );
91  virtual PBoolean WriteTo(
92  const void * buf,
93  PINDEX len,
94  const PIPSocketAddressAndPort & ipAndPort
95  );
96 
97  virtual PBoolean WriteTo(
98  const Slice * slices,
99  size_t sliceCount,
100  const Address & addr,
101  WORD port
102  );
103  virtual PBoolean WriteTo(
104  const Slice * slices,
105  size_t sliceCount,
106  const PIPSocketAddressAndPort & ipAndPort
107  );
108 
109 
110 // Include platform dependent part of class
111 #ifdef _WIN32
112 #include "msos/ptlib/ipdsock.h"
113 #else
114 #include "unix/ptlib/ipdsock.h"
115 #endif
116 
117  public:
118 
119  // Normally, one would expect these to be protected, but they are just so darn
120  // useful that it's just easier if they are public
121  virtual bool InternalReadFrom(
122  Slice * slices,
123  size_t sliceCount,
124  PIPSocketAddressAndPort & ipAndPort
125  );
126 
127  virtual bool InternalWriteTo(
128  const Slice * slices,
129  size_t sliceCount,
130  const PIPSocketAddressAndPort & ipAndPort
131  );
132 };
133 
134 
135 #endif // PTLIB_IPDATAGRAMSOCKET_H
136 
137 
138 // End Of File ///////////////////////////////////////////////////////////////
virtual bool InternalReadFrom(Slice *slices, size_t sliceCount, PIPSocketAddressAndPort &ipAndPort)
virtual PBoolean WriteTo(const void *buf, PINDEX len, const Address &addr, WORD port)
Write a datagram to a remote computer.
virtual bool InternalWriteTo(const Slice *slices, size_t sliceCount, const PIPSocketAddressAndPort &ipAndPort)
This class describes a type of socket that will communicate using the Internet Protocol.
Definition: ipsock.h:47
A class describing an IP address and port number combination.
Definition: ipsock.h:278
Structure that defines a &quot;slice&quot; of memory to be written to.
Definition: socket.h:434
bool PBoolean
Definition: object.h:174
PIPDatagramSocket()
Create a TCP/IP protocol socket channel.
A class describing an IP address.
Definition: ipsock.h:59
virtual PBoolean ReadFrom(void *buf, PINDEX len, Address &addr, WORD &port)
Read a datagram from a remote computer.
Internet Protocol Datagram Socket class.
Definition: ipdsock.h:41