PTLib  Version 2.18.8
 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 
30 #ifndef PTLIB_ICMPSOCKET_H
31 #define PTLIB_ICMPSOCKET_H
32 
33 #ifdef P_USE_PRAGMA
34 #pragma interface
35 #endif
36 
37 #include <ptlib/pprocess.h>
38 
43 {
44  PCLASSINFO(PICMPSocket, PIPDatagramSocket);
45 
46  public:
52  PICMPSocket();
54 
57  enum PingStatus {
59  PingSuccess, // don't use Success - X11 defines this!
71  };
72 
74  class PingInfo {
75  public:
77  PingInfo(WORD id = (WORD)PProcess::GetCurrentProcessID());
78 
81  WORD identifier;
84  WORD sequenceNum;
86  BYTE ttl;
88  const BYTE * buffer;
90  PINDEX bufferSize;
92 
104  };
106 
115  PBoolean Ping(
116  const PString & host
117  );
124  PBoolean Ping(
125  const PString & host,
126  PingInfo & info
127  );
129 
130  protected:
131  const char * GetProtocolName() const;
132  virtual PBoolean OpenSocket();
133  virtual PBoolean OpenSocket(int ipAdressFamily);
134 
135 
136 // Include platform dependent part of class
137 #ifdef _WIN32
138 #include "msos/ptlib/icmpsock.h"
139 #else
140 #include "unix/ptlib/icmpsock.h"
141 #endif
142 };
143 
144 
145 #endif // PTLIB_ICMPSOCKET_H
146 
147 
148 // End Of File ///////////////////////////////////////////////////////////////
Definition: icmpsock.h:60
Definition: icmpsock.h:68
Create a socket channel that uses allows ICMP commands in the Internal Protocol.
Definition: icmpsock.h:42
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:51
const char * GetProtocolName() const
This function returns the protocol name for the socket type.
PINDEX bufferSize
Size of buffer (&lt; 64k).
Definition: icmpsock.h:90
Definition: icmpsock.h:69
virtual PBoolean OpenSocket()
PICMPSocket()
Create a TCP/IP protocol socket channel.
Definition: icmpsock.h:65
Information used by and obtained by the ping operation.
Definition: icmpsock.h:74
Definition: icmpsock.h:62
Definition: icmpsock.h:63
Definition: icmpsock.h:70
const BYTE * buffer
Send buffer (if NULL, defaults to 32 bytes).
Definition: icmpsock.h:88
PingStatus
Results of ICMP operation.
Definition: icmpsock.h:58
bool PBoolean
Definition: object.h:174
PingStatus status
Status of the last ping operation.
Definition: icmpsock.h:102
The character string class.
Definition: pstring.h:108
PBoolean Ping(const PString &host)
Send an ECHO_REPLY message to the specified host and wait for a reply to be sent back.
Definition: icmpsock.h:64
Definition: icmpsock.h:67
A class describing an IP address.
Definition: ipsock.h:59
BYTE ttl
Time To Live for packet.
Definition: icmpsock.h:86
Internet Protocol Datagram Socket class.
Definition: ipdsock.h:41
static PProcessIdentifier GetCurrentProcessID()
Get the platform dependent process identifier for the currentprocess.
PTimeInterval delay
Time for packet to make trip.
Definition: icmpsock.h:96
Definition: icmpsock.h:59
PingInfo(WORD id=(WORD) PProcess::GetCurrentProcessID())
Create Ping information structure.
Definition: icmpsock.h:66
Address localAddr
Destination address of reply packet.
Definition: icmpsock.h:100
WORD sequenceNum
Sequence number for ping packet.
Definition: icmpsock.h:84
Address remoteAddr
Source address of reply packet.
Definition: icmpsock.h:98
WORD identifier
Arbitrary identifier for the ping.
Definition: icmpsock.h:82
Definition: icmpsock.h:61