PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
icmpsock.h
Go to the documentation of this file.
1 /*
2 * icmpsock.h
3 *
4 * Internet Control Message 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: 27818 $
30 * $Author: rjongbloed $
31 * $Date: 2012-06-13 13:29:24 +1000 (Wed, 13 Jun 2012) $
32 */
33
34 #ifndef PTLIB_ICMPSOCKET_H
35 #define PTLIB_ICMPSOCKET_H
36
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40
41 #include <ptlib/pprocess.h>
42
46 class PICMPSocket : public PIPDatagramSocket
47 {
48 PCLASSINFO(PICMPSocket, PIPDatagramSocket);
49
50 public:
56 PICMPSocket();
58
61
62 enum PingStatus {
63 PingSuccess, // don't use Success - X11 defines this!
64 NetworkUnreachable,
65 HostUnreachable,
66 PacketTooBig,
67 RequestTimedOut,
68 BadRoute,
69 TtlExpiredTransmit,
70 TtlExpiredReassembly,
71 SourceQuench,
72 MtuChange,
73 GeneralError,
74 NumStatuses
75 };
76
78 class PingInfo {
79 public:
81 PingInfo(WORD id = (WORD)PProcess::GetCurrentProcessID());
82
85
86 WORD identifier;
88 WORD sequenceNum;
90 BYTE ttl;
92 const BYTE * buffer;
94 PINDEX bufferSize;
96
99
100 PTimeInterval delay;
102 Address remoteAddr;
104 Address localAddr;
106 PingStatus status;
108 };
110
119 PBoolean Ping(
120 const PString & host
121 );
128 PBoolean Ping(
129 const PString & host,
130 PingInfo & info
131 );
133
134 protected:
135 const char * GetProtocolName() const;
136 virtual PBoolean OpenSocket();
137 virtual PBoolean OpenSocket(int ipAdressFamily);
138
139
140 // Include platform dependent part of class
141 #ifdef _WIN32
142 #include "msos/ptlib/icmpsock.h"
143 #else
144 #include "unix/ptlib/icmpsock.h"
145 #endif
146 };
147
148
149 #endif // PTLIB_ICMPSOCKET_H
150
151
152 // End Of File ///////////////////////////////////////////////////////////////