PTLib
Version 2.10.10
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
udpsock.h
Go to the documentation of this file.
1
/*
2
* udpsock.h
3
*
4
* User Datagram Protocol 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: 26309 $
30
* $Author: ededu $
31
* $Date: 2011-08-14 18:01:01 -0500 (Sun, 14 Aug 2011) $
32
*/
33
34
#ifndef PTLIB_UDPSOCKET_H
35
#define PTLIB_UDPSOCKET_H
36
37
#ifdef P_USE_PRAGMA
38
#pragma interface
39
#endif
40
41
#include <
ptlib/ipdsock.h
>
42
#include <
ptlib/qos.h
>
43
47
class
PUDPSocket
:
public
PIPDatagramSocket
48
{
49
PCLASSINFO(
PUDPSocket
,
PIPDatagramSocket
);
50
51
public
:
57
PUDPSocket
(
58
WORD
port
= 0,
59
int
iAddressFamily = AF_INET
60
);
61
PUDPSocket
(
62
PQoS
* qos,
63
WORD
port
= 0,
64
int
iAddressFamily = AF_INET
65
);
66
PUDPSocket
(
67
const
PString
& service,
68
PQoS
* qos = NULL,
69
int
iAddressFamily = AF_INET
70
);
71
PUDPSocket
(
72
const
PString
& address,
73
WORD
port
74
);
75
PUDPSocket
(
76
const
PString
& address,
77
const
PString
& service
78
);
80
85
PBoolean
Read
(
86
void
* buf,
87
PINDEX len
88
);
89
92
PBoolean
Write
(
93
const
void
* buf,
94
PINDEX len
95
);
96
99
PBoolean
Connect
(
100
const
PString
& address
101
);
103
108
void
SetSendAddress
(
109
const
Address
& address,
110
WORD port
111
);
112
115
void
GetSendAddress
(
116
Address
& address,
117
WORD & port
118
)
const
;
119
PString
GetSendAddress
()
const
;
120
125
void
GetLastReceiveAddress
(
126
Address
& address,
127
WORD & port
128
)
const
;
129
PString
GetLastReceiveAddress
()
const
;
130
135
virtual
PBoolean
IsAlternateAddress
(
136
const
Address
& address,
137
WORD port
138
);
139
146
virtual
PBoolean
DoPseudoRead
(
int
& selectStatus);
147
150
virtual
PBoolean
ModifyQoSSpec
(
151
PQoS
* qos
152
);
153
154
#if P_QOS
155
157
virtual
PQoS
&
GetQoSSpec
();
158
#endif
159
162
static
PBoolean
SupportQoS
(
const
PIPSocket::Address
& address);
163
166
static
void
EnableGQoS
();
168
169
protected
:
170
// Open an IPv4 socket (for backward compatibility)
171
virtual
PBoolean
OpenSocket
();
172
173
// Open an IPv4 or IPv6 socket
174
virtual
PBoolean
OpenSocket
(
175
int
ipAdressFamily
176
);
177
178
// Create a QOS-enabled socket
179
virtual
PBoolean
OpenSocketGQOS
(
int
af,
int
type,
int
proto);
180
181
// Modify the QOS settings
182
virtual
PBoolean
ApplyQoS
();
183
184
virtual
const
char
*
GetProtocolName
()
const
;
185
186
Address
sendAddress
;
187
WORD
sendPort
;
188
189
Address
lastReceiveAddress
;
190
WORD
lastReceivePort
;
191
192
PQoS
qosSpec
;
193
194
// Include platform dependent part of class
195
#ifdef _WIN32
196
#include "msos/ptlib/udpsock.h"
197
#else
198
#include "unix/ptlib/udpsock.h"
199
#endif
200
};
201
202
#if P_QOS
203
204
#ifdef _WIN32
205
#include <winbase.h>
206
#include <winreg.h>
207
208
class
PWinQoS :
public
PObject
209
{
210
PCLASSINFO
(PWinQoS,
PObject
);
211
212
public
:
213
PWinQoS(
PQoS
& pqos,
struct
sockaddr * to,
char
* inBuf, DWORD & bufLen);
214
~PWinQoS();
215
216
//QOS qos;
217
//QOS_DESTADDR qosdestaddr;
218
protected
:
219
sockaddr * sa;
220
};
221
222
#endif // _WIN32
223
#endif // P_QOS
224
225
226
#endif // PTLIB_UDPSOCKET_H
227
228
229
// End Of File ///////////////////////////////////////////////////////////////
include
ptlib
udpsock.h
Generated on Tue May 7 2013 17:25:46 for PTLib by
1.8.3.1