00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #if !defined(AFX_ICMPCRAFTER_H__8BB8FDD9_9799_4359_90C5_B1FE2A83D847__INCLUDED_)
00037 #define AFX_ICMPCRAFTER_H__8BB8FDD9_9799_4359_90C5_B1FE2A83D847__INCLUDED_
00038
00039 #if _MSC_VER > 1000
00040 #pragma once
00041 #endif // _MSC_VER > 1000
00042
00043 #include "IPCrafter.h"
00044 #include "ICMPSocket.h"
00045
00046 KOMODIA_NAMESPACE_START
00047
00048 class CICMPCrafter : public CIPCrafter,
00049 public CICMPSocket
00050 {
00051 public:
00052
00053 char* GetInformation(BOOL bReply,
00054 unsigned short usIdentifier,
00055 unsigned short usSequence,
00056 unsigned short& usTotalSize)const;
00057
00058 char* GetTimestamp(BOOL bReply,
00059 unsigned short usIdentifier,
00060 unsigned short usSequence,
00061 unsigned long ulOriginateTimestamp,
00062 unsigned long ulReceiveTimestamp,
00063 unsigned long ulTransmitTimestamp,
00064 unsigned short& usTotalSize)const;
00065
00066 char* GetEcho(BOOL bReply,
00067 unsigned short usIdentifier,
00068 unsigned short usSequence,
00069 unsigned long ulData,
00070 unsigned short& usTotalSize)const;
00071
00072 char* GetRedirect(unsigned char cType,
00073 IP aGatewayAddress,
00074 unsigned short& usTotalSize)const;
00075
00076 char* GetQuench(unsigned short& usTotalSize)const;
00077
00078 char* GetParameter(unsigned char cError,
00079 unsigned short& usTotalSize)const;
00080
00081 char* GetTime(unsigned char cType,
00082 unsigned short& usTotalSize)const;
00083
00084 char* GetUnreachable(unsigned char cType,
00085 unsigned short& usTotalSize)const;
00086
00087
00088 void SetDestinationAddress(IP aDestinationAddress);
00089 void SetDestinationAddress(const std::string& rDestinationAddress);
00090
00091
00092 void SetICMPUseDefaultChecksum(BOOL bDefault);
00093
00094
00095 void SetICMPChecksum(unsigned short usChecksum);
00096
00097
00098 CICMPCrafter();
00099 virtual ~CICMPCrafter();
00100 protected:
00101
00102 virtual void FinalICMPHeader(LPICMPHeader lpHead)const;
00103
00104
00105 virtual LPIpHeader ConstructIPHeader (unsigned char ucProtocol,
00106 unsigned short usFragmentationFlags,
00107 unsigned char ucTTL,
00108 unsigned short usIdentification,
00109 unsigned char ucHeaderLength)const;
00110
00111
00112 virtual void FinalIPHeader(LPIpHeader lpHead)const;
00113 private:
00114
00115 CICMPCrafter(const CICMPCrafter& rCrafter);
00116
00117
00118 CICMPCrafter& operator=(const CICMPCrafter& rCrafter);
00119
00120
00121 char* CreateFinal(unsigned char cICMP,
00122 unsigned char cType,
00123 unsigned short& usTotalSize)const;
00124
00125
00126 char* CreateFinal(const LPICMPHeader pHeader,
00127 unsigned short& usTotalSize)const;
00128
00129
00130 BOOL m_bDefaultChecksum;
00131
00132
00133 unsigned short m_usChecksum;
00134
00135
00136 IP m_aDestinationAddress;
00137 };
00138
00139 KOMODIA_NAMESPACE_END
00140
00141 #endif // !defined(AFX_ICMPCRAFTER_H__8BB8FDD9_9799_4359_90C5_B1FE2A83D847__INCLUDED_)