icmpsock.h
Go to the documentation of this file.
/*
* icmpsock.h
*
* Internet Control Message 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: 27817 $
* $Author: rjongbloed $
* $Date: 2012-06-12 21:52:14 -0500 (Tue, 12 Jun 2012) $
*/
#ifndef PTLIB_ICMPSOCKET_H
#define PTLIB_ICMPSOCKET_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptlib/pprocess.h>
class PICMPSocket : public PIPDatagramSocket
{
PCLASSINFO(PICMPSocket, PIPDatagramSocket);
public:
PICMPSocket();
enum PingStatus {
PingSuccess, // don't use Success - X11 defines this!
NetworkUnreachable,
HostUnreachable,
PacketTooBig,
RequestTimedOut,
BadRoute,
TtlExpiredTransmit,
TtlExpiredReassembly,
SourceQuench,
MtuChange,
GeneralError,
NumStatuses
};
class PingInfo {
public:
PingInfo(WORD id = (WORD)PProcess::GetCurrentProcessID());
WORD identifier;
WORD sequenceNum;
BYTE ttl;
const BYTE * buffer;
PINDEX bufferSize;
PTimeInterval delay;
Address remoteAddr;
Address localAddr;
PingStatus status;
};
PBoolean Ping(
const PString & host
);
PBoolean Ping(
const PString & host,
PingInfo & info
);
protected:
const char * GetProtocolName() const;
virtual PBoolean OpenSocket();
virtual PBoolean OpenSocket(int ipAdressFamily);
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/icmpsock.h"
#else
#include "unix/ptlib/icmpsock.h"
#endif
};
#endif // PTLIB_ICMPSOCKET_H
// End Of File ///////////////////////////////////////////////////////////////
PICMPSocket::NetworkUnreachable
Definition: icmpsock.h:64
PICMPSocket::MtuChange
Definition: icmpsock.h:72
PICMPSocket
Create a socket channel that uses allows ICMP commands in the Internal Protocol.
Definition: icmpsock.h:46
PTimeInterval
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:55
PICMPSocket::GetProtocolName
const char * GetProtocolName() const
This function returns the protocol name for the socket type.
PICMPSocket::PingInfo::bufferSize
PINDEX bufferSize
Size of buffer (< 64k).
Definition: icmpsock.h:94
PICMPSocket::GeneralError
Definition: icmpsock.h:73
PICMPSocket::OpenSocket
virtual PBoolean OpenSocket()
PICMPSocket::PICMPSocket
PICMPSocket()
Create a TCP/IP protocol socket channel.
PICMPSocket::TtlExpiredTransmit
Definition: icmpsock.h:69
pprocess.h
PICMPSocket::PingInfo
Information used by and obtained by the ping operation.
Definition: icmpsock.h:78
PICMPSocket::PacketTooBig
Definition: icmpsock.h:66
PBoolean
BOOL PBoolean
Definition: object.h:102
PICMPSocket::RequestTimedOut
Definition: icmpsock.h:67
PICMPSocket::NumStatuses
Definition: icmpsock.h:74
PICMPSocket::PingInfo::buffer
const BYTE * buffer
Send buffer (if NULL, defaults to 32 bytes).
Definition: icmpsock.h:92
PICMPSocket::PingStatus
PingStatus
Results of ICMP operation.
Definition: icmpsock.h:62
PICMPSocket::PingInfo::status
PingStatus status
Status of the last ping operation.
Definition: icmpsock.h:106
PString
The character string class.
Definition: pstring.h:108
PICMPSocket::Ping
PBoolean Ping(const PString &host)
Send an ECHO_REPLY message to the specified host and wait for a reply to be sent back.
PICMPSocket::BadRoute
Definition: icmpsock.h:68
PICMPSocket::SourceQuench
Definition: icmpsock.h:71
PIPSocket::Address
A class describing an IP address.
Definition: ipsock.h:75
PICMPSocket::PingInfo::ttl
BYTE ttl
Time To Live for packet.
Definition: icmpsock.h:90
PIPDatagramSocket
Internet Protocol Datagram Socket class.
Definition: ipdsock.h:45
PProcess::GetCurrentProcessID
static PProcessIdentifier GetCurrentProcessID()
Get the platform dependent process identifier for the currentprocess.
PICMPSocket::PingInfo::delay
PTimeInterval delay
Time for packet to make trip.
Definition: icmpsock.h:100
PICMPSocket::PingSuccess
Definition: icmpsock.h:63
PICMPSocket::PingInfo::PingInfo
PingInfo(WORD id=(WORD) PProcess::GetCurrentProcessID())
Create Ping information structure.
PICMPSocket::TtlExpiredReassembly
Definition: icmpsock.h:70
PICMPSocket::PingInfo::localAddr
Address localAddr
Destination address of reply packet.
Definition: icmpsock.h:104
PICMPSocket::PingInfo::sequenceNum
WORD sequenceNum
Sequence number for ping packet.
Definition: icmpsock.h:88
PICMPSocket::PingInfo::remoteAddr
Address remoteAddr
Source address of reply packet.
Definition: icmpsock.h:102
PICMPSocket::PingInfo::identifier
WORD identifier
Arbitrary identifier for the ping.
Definition: icmpsock.h:86
PICMPSocket::HostUnreachable
Definition: icmpsock.h:65