FreeRDP
pcap.h
1 
20 #ifndef FREERDP_UTILS_PCAP_H
21 #define FREERDP_UTILS_PCAP_H
22 
23 #include <freerdp/api.h>
24 #include <freerdp/types.h>
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
31  typedef struct
32  {
33  UINT32 magic_number; /* magic number */
34  UINT16 version_major; /* major version number */
35  UINT16 version_minor; /* minor version number */
36  INT32 thiszone; /* GMT to local correction */
37  UINT32 sigfigs; /* accuracy of timestamps */
38  UINT32 snaplen; /* max length of captured packets, in octets */
39  UINT32 network; /* data link type */
40  } pcap_header;
41 
42  typedef struct
43  {
44  UINT32 ts_sec; /* timestamp seconds */
45  UINT32 ts_usec; /* timestamp microseconds */
46  UINT32 incl_len; /* number of octets of packet saved in file */
47  UINT32 orig_len; /* actual length of packet */
49 
50  typedef struct s_pcap_record pcap_record;
51 
53  {
54  pcap_record_header header;
55  union
56  {
57  void* data;
58  const void* cdata;
59  };
60  UINT32 length;
61  pcap_record* next;
62  };
63 
64  typedef struct rdp_pcap rdpPcap;
65 
66  FREERDP_API rdpPcap* pcap_open(const char* name, BOOL write);
67  FREERDP_API void pcap_close(rdpPcap* pcap);
68 
69  FREERDP_API BOOL pcap_add_record(rdpPcap* pcap, const void* data, size_t length);
70  FREERDP_API BOOL pcap_has_next_record(const rdpPcap* pcap);
71  FREERDP_API BOOL pcap_get_next_record(rdpPcap* pcap, pcap_record* record);
72  FREERDP_API BOOL pcap_get_next_record_header(rdpPcap* pcap, pcap_record* record);
73  FREERDP_API BOOL pcap_get_next_record_content(rdpPcap* pcap, pcap_record* record);
74  FREERDP_API void pcap_flush(rdpPcap* pcap);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
80 #endif /* FREERDP_UTILS_PCAP_H */