/usr/include/ptlib/udpsock.h is in libpt-dev 2.10.2~dfsg-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*
* udpsock.h
*
* User Datagram Protocol socket I/O channel class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 26309 $
* $Author: ededu $
* $Date: 2011-08-14 18:01:01 -0500 (Sun, 14 Aug 2011) $
*/
#ifndef PTLIB_UDPSOCKET_H
#define PTLIB_UDPSOCKET_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptlib/ipdsock.h>
#include <ptlib/qos.h>
/**
A socket channel that uses the UDP transport on the Internet Protocol.
*/
class PUDPSocket : public PIPDatagramSocket
{
PCLASSINFO(PUDPSocket, PIPDatagramSocket);
public:
/**@name Construction */
//@{
/** Create a UDP socket. If a remote machine address or
a "listening" socket is specified then the channel is also opened.
*/
PUDPSocket(
WORD port = 0, ///< Port number to use for the connection.
int iAddressFamily = AF_INET ///< Family
);
PUDPSocket(
PQoS * qos, ///< Pointer to a QOS structure for the connection
WORD port = 0, ///< Port number to use for the connection.
int iAddressFamily = AF_INET ///< Family
);
PUDPSocket(
const PString & service, ///< Service name to use for the connection.
PQoS * qos = NULL, ///< Pointer to a QOS structure for the connection
int iAddressFamily = AF_INET ///< Family
);
PUDPSocket(
const PString & address, ///< Address of remote machine to connect to.
WORD port ///< Port number to use for the connection.
);
PUDPSocket(
const PString & address, ///< Address of remote machine to connect to.
const PString & service ///< Service name to use for the connection.
);
//@}
/**@name Overrides from class PSocket */
//@{
/** Override of PChannel functions to allow connectionless reads
*/
PBoolean Read(
void * buf, ///< Pointer to a block of memory to read.
PINDEX len ///< Number of bytes to read.
);
/** Override of PChannel functions to allow connectionless writes
*/
PBoolean Write(
const void * buf, ///< Pointer to a block of memory to write.
PINDEX len ///< Number of bytes to write.
);
/** Override of PSocket functions to allow connectionless writes
*/
PBoolean Connect(
const PString & address ///< Address of remote machine to connect to.
);
//@}
/**@name New functions for class */
//@{
/** Set the address to use for connectionless Write() or Windows QoS
*/
void SetSendAddress(
const Address & address, ///< IP address to send packets.
WORD port ///< Port to send packets.
);
/** Get the address to use for connectionless Write().
*/
void GetSendAddress(
Address & address, ///< IP address to send packets.
WORD & port ///< Port to send packets.
) const;
PString GetSendAddress() const;
/** Get the address of the sender in the last connectionless Read().
Note that thsi only applies to the Read() and not the ReadFrom()
function.
*/
void GetLastReceiveAddress(
Address & address, ///< IP address to send packets.
WORD & port ///< Port to send packets.
) const;
PString GetLastReceiveAddress() const;
/** CallBack to check if the detected address of the connectionless Read()
is an alternate address. Use this to switch the target to send and
receive the connectionless read/write.
*/
virtual PBoolean IsAlternateAddress(
const Address & address, ///< Detected IP Address.
WORD port ///< Detected Port.
);
/** PseudoRead
This indicates to the upper system that reading on this socket
will be a pseudo read when means there is data available that
did not orginate from the physical socket but was programmically
injected.
*/
virtual PBoolean DoPseudoRead(int & selectStatus);
/** Change the QOS spec for the socket and try to apply the changes
*/
virtual PBoolean ModifyQoSSpec(
PQoS * qos ///< QoS specification to use
);
#if P_QOS
/** Get the QOS object for the socket.
*/
virtual PQoS & GetQoSSpec();
#endif
/** Check to See if the socket will support QoS on the given local Address
*/
static PBoolean SupportQoS(const PIPSocket::Address & address);
/** Manually Enable GQoS Support
*/
static void EnableGQoS();
//@}
protected:
// Open an IPv4 socket (for backward compatibility)
virtual PBoolean OpenSocket();
// Open an IPv4 or IPv6 socket
virtual PBoolean OpenSocket(
int ipAdressFamily
);
// Create a QOS-enabled socket
virtual PBoolean OpenSocketGQOS(int af, int type, int proto);
// Modify the QOS settings
virtual PBoolean ApplyQoS();
virtual const char * GetProtocolName() const;
Address sendAddress;
WORD sendPort;
Address lastReceiveAddress;
WORD lastReceivePort;
PQoS qosSpec;
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/udpsock.h"
#else
#include "unix/ptlib/udpsock.h"
#endif
};
#if P_QOS
#ifdef _WIN32
#include <winbase.h>
#include <winreg.h>
class PWinQoS : public PObject
{
PCLASSINFO(PWinQoS,PObject);
public:
PWinQoS(PQoS & pqos, struct sockaddr * to, char * inBuf, DWORD & bufLen);
~PWinQoS();
//QOS qos;
//QOS_DESTADDR qosdestaddr;
protected:
sockaddr * sa;
};
#endif // _WIN32
#endif // P_QOS
#endif // PTLIB_UDPSOCKET_H
// End Of File ///////////////////////////////////////////////////////////////
|