// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Idicmpclient.pas' rev: 10.00

#ifndef IdicmpclientHPP
#define IdicmpclientHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Idglobal.hpp>	// Pascal unit
#include <Idobjs.hpp>	// Pascal unit
#include <Idrawbase.hpp>	// Pascal unit
#include <Idrawclient.hpp>	// Pascal unit
#include <Idstackconsts.hpp>	// Pascal unit
#include <Idbasecomponent.hpp>	// Pascal unit
#include <Idsys.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Idcomponent.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Idicmpclient
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TReplyStatusTypes { rsEcho, rsError, rsTimeOut, rsErrorUnreachable, rsErrorTTLExceeded, rsErrorPacketTooBig, rsErrorParameter, rsErrorDatagramConversion, rsErrorSecurityFailure, rsSourceQuench, rsRedirect, rsTimeStamp, rsInfoRequest, rsAddressMaskRequest, rsTraceRoute, rsMobileHostReg, rsMobileHostRedir, rsIPv6WhereAreYou, rsIPv6IAmHere, rsSKIP };
#pragma option pop

class DELPHICLASS TReplyStatus;
class PASCALIMPLEMENTATION TReplyStatus : public System::TObject 
{
	typedef System::TObject inherited;
	
protected:
	int FBytesReceived;
	AnsiString FFromIpAddress;
	AnsiString FToIpAddress;
	Byte FMsgType;
	Byte FMsgCode;
	Word FSequenceId;
	unsigned FMsRoundTripTime;
	Byte FTimeToLive;
	TReplyStatusTypes FReplyStatusType;
	int FPacketNumber;
	AnsiString FHostName;
	AnsiString FMsg;
	AnsiString FRedirectTo;
	
public:
	__property AnsiString RedirectTo = {read=FRedirectTo, write=FRedirectTo};
	__property AnsiString Msg = {read=FMsg, write=FMsg};
	__property int BytesReceived = {read=FBytesReceived, write=FBytesReceived, nodefault};
	__property AnsiString FromIpAddress = {read=FFromIpAddress, write=FFromIpAddress};
	__property AnsiString ToIpAddress = {read=FToIpAddress, write=FToIpAddress};
	__property Byte MsgType = {read=FMsgType, write=FMsgType, nodefault};
	__property Byte MsgCode = {read=FMsgCode, write=FMsgCode, nodefault};
	__property Word SequenceId = {read=FSequenceId, write=FSequenceId, nodefault};
	__property unsigned MsRoundTripTime = {read=FMsRoundTripTime, write=FMsRoundTripTime, nodefault};
	__property Byte TimeToLive = {read=FTimeToLive, write=FTimeToLive, nodefault};
	__property TReplyStatusTypes ReplyStatusType = {read=FReplyStatusType, write=FReplyStatusType, nodefault};
	__property AnsiString HostName = {read=FHostName, write=FHostName};
	__property int PacketNumber = {read=FPacketNumber, write=FPacketNumber, nodefault};
public:
	#pragma option push -w-inl
	/* TObject.Create */ inline __fastcall TReplyStatus(void) : System::TObject() { }
	#pragma option pop
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~TReplyStatus(void) { }
	#pragma option pop
	
};


typedef void __fastcall (__closure *TOnReplyEvent)(Classes::TComponent* ASender, const TReplyStatus* AReplyStatus);

class DELPHICLASS TIdCustomIcmpClient;
class PASCALIMPLEMENTATION TIdCustomIcmpClient : public Idrawclient::TIdRawClient 
{
	typedef Idrawclient::TIdRawClient inherited;
	
protected:
	unsigned FStartTime;
	int FPacketSize;
	DynamicArray<Byte >  FbufReceive;
	DynamicArray<Byte >  FbufIcmp;
	Word wSeqNo;
	int iDataSize;
	TReplyStatus* FReplyStatus;
	TOnReplyEvent FOnReply;
	AnsiString FReplydata;
	bool __fastcall DecodeIPv6Packet(unsigned BytesRead, TReplyStatus* &AReplyStatus);
	bool __fastcall DecodeIPv4Packet(unsigned BytesRead, TReplyStatus* &AReplyStatus);
	bool __fastcall DecodeResponse(unsigned BytesRead, TReplyStatus* &AReplyStatus);
	virtual void __fastcall DoReply(const TReplyStatus* AReplyStatus);
	void __fastcall GetEchoReply(void);
	virtual void __fastcall InitComponent(void);
	void __fastcall PrepareEchoRequestIPv6(AnsiString Buffer);
	void __fastcall PrepareEchoRequestIPv4(AnsiString Buffer = "");
	void __fastcall PrepareEchoRequest(AnsiString Buffer = "");
	void __fastcall SendEchoRequest(void)/* overload */;
	void __fastcall SendEchoRequest(const AnsiString AIP)/* overload */;
	int __fastcall GetPacketSize(void);
	void __fastcall SetPacketSize(const int AValue);
	void __fastcall InternalPing(const AnsiString AIP, const AnsiString ABuffer = "", Word SequenceID = (Word)(0x0))/* overload */;
	__property TReplyStatus* ReplyStatus = {read=FReplyStatus};
	__property AnsiString ReplyData = {read=FReplydata};
	__property int PacketSize = {read=GetPacketSize, write=SetPacketSize, nodefault};
	
public:
	__fastcall virtual ~TIdCustomIcmpClient(void);
	virtual void __fastcall Send(const AnsiString AHost, const int APort, const Idglobal::TBytes ABuffer)/* overload */;
	virtual void __fastcall Send(const Idglobal::TBytes ABuffer)/* overload */;
	TReplyStatus* __fastcall Receive(int ATimeOut);
public:
	#pragma option push -w-inl
	/* TIdBaseComponent.Create */ inline __fastcall TIdCustomIcmpClient(Classes::TComponent* AOwner)/* overload */ : Idrawclient::TIdRawClient(AOwner) { }
	#pragma option pop
	
	
/* Hoisted overloads: */
	
public:
	inline void __fastcall  Send(const AnsiString AData){ TIdRawBase::Send(AData); }
	inline void __fastcall  Send(const AnsiString AHost, const int APort, const AnsiString AData){ TIdRawBase::Send(AHost, APort, AData); }
	
};


class DELPHICLASS TIdIcmpClient;
class PASCALIMPLEMENTATION TIdIcmpClient : public TIdCustomIcmpClient 
{
	typedef TIdCustomIcmpClient inherited;
	
public:
	void __fastcall Ping(const AnsiString ABuffer = "", Word SequenceID = (Word)(0x0));
	
__published:
	__property IPVersion ;
	__property PacketSize ;
	__property ReceiveTimeout  = {default=5000};
	__property Host ;
	__property TOnReplyEvent OnReply = {read=FOnReply, write=FOnReply};
public:
	#pragma option push -w-inl
	/* TIdCustomIcmpClient.Destroy */ inline __fastcall virtual ~TIdIcmpClient(void) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TIdBaseComponent.Create */ inline __fastcall TIdIcmpClient(Classes::TComponent* AOwner)/* overload */ : TIdCustomIcmpClient(AOwner) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
static const Shortint DEF_PACKET_SIZE = 0x20;
static const Word MAX_PACKET_SIZE = 0x400;
static const Byte iDEFAULTPACKETSIZE = 0x80;
static const Word iDEFAULTREPLYBUFSIZE = 0x400;
static const Word Id_TIDICMP_ReceiveTimeout = 0x1388;

}	/* namespace Idicmpclient */
using namespace Idicmpclient;
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// Idicmpclient
