2 * FreeRDP: A Remote Desktop Protocol Client
3 * pcap File Format Utils
5 * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #ifndef __UTILS_PCAP_H
21 #define __UTILS_PCAP_H
23 #include <freerdp/api.h>
24 #include <freerdp/types.h>
28 uint32 magic_number; /* magic number */
29 uint16 version_major; /* major version number */
30 uint16 version_minor; /* minor version number */
31 sint32 thiszone; /* GMT to local correction */
32 uint32 sigfigs; /* accuracy of timestamps */
33 uint32 snaplen; /* max length of captured packets, in octets */
34 uint32 network; /* data link type */
36 typedef struct _pcap_header pcap_header;
38 struct _pcap_record_header
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 typedef struct _pcap_record_header pcap_record_header;
47 typedef struct _pcap_record pcap_record;
51 pcap_record_header header;
69 typedef struct rdp_pcap rdpPcap;
71 FREERDP_API rdpPcap* pcap_open(char* name, boolean write);
72 FREERDP_API void pcap_close(rdpPcap* pcap);
74 FREERDP_API void pcap_add_record(rdpPcap* pcap, void* data, uint32 length);
75 FREERDP_API boolean pcap_has_next_record(rdpPcap* pcap);
76 FREERDP_API boolean pcap_get_next_record(rdpPcap* pcap, pcap_record* record);
77 FREERDP_API boolean pcap_get_next_record_header(rdpPcap* pcap, pcap_record* record);
78 FREERDP_API boolean pcap_get_next_record_content(rdpPcap* pcap, pcap_record* record);
79 FREERDP_API void pcap_flush(rdpPcap* pcap);
81 #endif /* __UTILS_PCAP_H */