FreeRDP
PacketMessage.h
1 
20 #ifndef WINPR_WLOG_PACKET_MESSAGE_PRIVATE_H
21 #define WINPR_WLOG_PACKET_MESSAGE_PRIVATE_H
22 
23 #include "wlog.h"
24 
25 #define PCAP_MAGIC_NUMBER 0xA1B2C3D4
26 
27 typedef struct
28 {
29  UINT32 magic_number; /* magic number */
30  UINT16 version_major; /* major version number */
31  UINT16 version_minor; /* minor version number */
32  INT32 thiszone; /* GMT to local correction */
33  UINT32 sigfigs; /* accuracy of timestamps */
34  UINT32 snaplen; /* max length of captured packets, in octets */
35  UINT32 network; /* data link type */
36 } wPcapHeader;
37 
38 typedef struct
39 {
40  UINT32 ts_sec; /* timestamp seconds */
41  UINT32 ts_usec; /* timestamp microseconds */
42  UINT32 incl_len; /* number of octets of packet saved in file */
43  UINT32 orig_len; /* actual length of packet */
45 
46 typedef struct s_wPcapRecort
47 {
48  wPcapRecordHeader header;
49  void* data;
50  size_t length;
51  struct s_wPcapRecort* next;
52 } wPcapRecord;
53 
54 typedef struct
55 {
56  FILE* fp;
57  char* name;
58  BOOL write;
59  SSIZE_T file_size;
60  size_t record_count;
61  wPcapHeader header;
62  wPcapRecord* head;
63  wPcapRecord* tail;
64  wPcapRecord* record;
65 } wPcap;
66 
67 wPcap* Pcap_Open(char* name, BOOL write);
68 void Pcap_Close(wPcap* pcap);
69 
70 void Pcap_Flush(wPcap* pcap);
71 
72 typedef struct
73 {
74  BYTE Destination[6];
75  BYTE Source[6];
76  UINT16 Type;
78 
79 typedef struct
80 {
81  BYTE Version;
82  BYTE InternetHeaderLength;
83  BYTE TypeOfService;
84  UINT16 TotalLength;
85  UINT16 Identification;
86  BYTE InternetProtocolFlags;
87  UINT16 FragmentOffset;
88  BYTE TimeToLive;
89  BYTE Protocol;
90  UINT16 HeaderChecksum;
91  UINT32 SourceAddress;
92  UINT32 DestinationAddress;
93 } wIPv4Header;
94 
95 typedef struct
96 {
97  UINT16 SourcePort;
98  UINT16 DestinationPort;
99  UINT32 SequenceNumber;
100  UINT32 AcknowledgementNumber;
101  BYTE Offset;
102  BYTE Reserved;
103  BYTE TcpFlags;
104  UINT16 Window;
105  UINT16 Checksum;
106  UINT16 UrgentPointer;
107 } wTcpHeader;
108 
109 BOOL WLog_PacketMessage_Write(wPcap* pcap, void* data, size_t length, DWORD flags);
110 
111 #endif /* WINPR_WLOG_PACKET_MESSAGE_PRIVATE_H */