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_UDPSOCKET_H__B6FDDD18_19E2_4E61_A04E_CC6DD8583966__INCLUDED_)
00037 #define AFX_UDPSOCKET_H__B6FDDD18_19E2_4E61_A04E_CC6DD8583966__INCLUDED_
00038
00039 #if _MSC_VER > 1000
00040 #pragma once
00041 #endif // _MSC_VER > 1000
00042
00043 #include "SpoofSocket.h"
00044
00045 KOMODIA_NAMESPACE_START
00046
00047 typedef struct _UDPHeader
00048 {
00049 unsigned short usSourcePort;
00050 unsigned short usDestinationPort;
00051 unsigned short usLength;
00052 unsigned short usChecksum;
00053 } UDPHeader;
00054
00055 typedef UDPHeader FAR * LPUDPHeader;
00056
00057 #define UDPHeaderLength sizeof(UDPHeader)
00058
00059 class CUDPSocket : public CSpoofSocket
00060 {
00061 public:
00062
00063 virtual BOOL Create();
00064
00065
00066
00067
00068
00069
00070 virtual int Receive(char* pBuffer,
00071 unsigned long ulBufferLength);
00072
00073
00074
00075
00076
00077
00078 virtual int Receive(char* pBuffer,
00079 unsigned long ulBufferLength,
00080 IP& rIP,
00081 unsigned short& rSourcePort);
00082
00083
00084
00085
00086
00087 virtual BOOL Send(IP aDestinationAddress,
00088 unsigned short usDestinationPort,
00089 const char* pBuffer,
00090 unsigned short usBufferLength);
00091 virtual BOOL Send(const std::string& rDestinationAddress,
00092 unsigned short usDestinationPort,
00093 const char* pBuffer,
00094 unsigned short usBufferLength);
00095
00096
00097
00098
00099
00100
00101 virtual BOOL Send(unsigned short usSourcePort,
00102 IP aDestinationAddress,
00103 unsigned short usDestinationPort,
00104 const char* pBuffer,
00105 unsigned short usBufferLength);
00106 virtual BOOL Send(unsigned short usSourcePort,
00107 const std::string& rDestinationAddress,
00108 unsigned short usDestinationPort,
00109 const char* pBuffer,
00110 unsigned short usBufferLength);
00111
00112
00113 CUDPSocket(BOOL bRawSocket);
00114 virtual ~CUDPSocket();
00115 protected:
00116
00117 virtual void FinalUDPHeader(LPUDPHeader lpHeader)const;
00118 private:
00119
00120 CUDPSocket(const CUDPSocket& rSocket);
00121
00122
00123 CUDPSocket& operator=(const CUDPSocket& rSocket);
00124 };
00125
00126 KOMODIA_NAMESPACE_END
00127
00128 #endif // !defined(AFX_UDPSOCKET_H__B6FDDD18_19E2_4E61_A04E_CC6DD8583966__INCLUDED_)