SnifferRawSocket/rawsocket.h

43 lines
1.0 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _RAWSOCKET_H_
#define _RAWSOCKET_H_
/*
注意:
头文件.h只声明变量和函数不要在头文件里定义变量或函数要不然#ifndef .. #define ...#endif 没有用哦^_^
*/
#include <stdio.h>
#include <WinSock2.h>
#include <ws2tcpip.h>
#include <mstcpip.h>
#include "PacketStruct.h"
#pragma comment(lib, "ws2_32.lib")
#include <stdarg.h> // 不定参数函数需要的头文件
typedef struct _HOSTIP
{
int iLen;
char szIPArray[10][50];
}HOSTIP;
extern SOCKET g_RawSocket;
extern HOSTIP g_HostIp;
extern BOOL g_bStopRecv;
void ShowError(char *lpszText);
BOOL InitRawSocket();
BOOL ReceivePacket();
BOOL ReceivePacket_Print();
BOOL ExitRawSocket();
void AnalyseRecvPacket(BYTE *lpBuf);
void AnalyseRecvPacket_All(BYTE *lpBuf);
void AnalyseRecvPacket_UDP(BYTE *lpBuf);
void AnalyseRecvPacket_TCP(BYTE *lpBuf);
void PrintData(BYTE *lpBuf, int iLen, int iPrintType);
void MyPrintf(const char * _Format, ...); // 不定长参数函数
void SaveToFile(char *lpszFileName, char *lpBuf);
#endif