XBinder  Version 2.9.x
rtxPcapFile.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2022 Objective Systems, Inc.
3  *
4  * This software is furnished under a license and may be used and copied
5  * only in accordance with the terms of such license and with the
6  * inclusion of the above copyright notice. This software or any other
7  * copies thereof may not be provided or otherwise made available to any
8  * other person. No title to and ownership of the software is hereby
9  * transferred.
10  *
11  * The information in this software is subject to change without notice
12  * and should not be construed as a commitment by Objective Systems, Inc.
13  *
14  * PROPRIETARY NOTICE
15  *
16  * This software is an unpublished work subject to a confidentiality agreement
17  * and is protected by copyright and trade secret law. Unauthorized copying,
18  * redistribution or other use of this work is prohibited.
19  *
20  * The above notice of copyright on this source code product does not indicate
21  * any actual or intended publication of such source code.
22  *
23  *****************************************************************************/
28 #ifndef _RTXPCAPFILE_H_
29 #define _RTXPCAPFILE_H_
30 
31 #include "rtxsrc/rtxContext.h"
32 
33 typedef struct pcap_hdr_s {
34  OSOCTET magic_number[4]; /* magic number */
35  OSUINT16 version_major; /* major version number */
36  OSUINT16 version_minor; /* minor version number */
37  OSINT32 thiszone; /* GMT to local correction */
38  OSUINT32 sigfigs; /* accuracy of timestamps */
39  OSUINT32 snaplen; /* max length of captured packets, in octets */
40  OSUINT32 network; /* data link type */
41 } pcap_hdr_t;
42 
43 typedef struct pcaprec_hdr_s {
44  OSUINT32 ts_sec; /* timestamp seconds */
45  OSUINT32 ts_usec; /* timestamp microseconds */
46  OSUINT32 incl_len; /* number of octets of packet saved in file */
47  OSUINT32 orig_len; /* actual length of packet */
48 } pcaprec_hdr_t;
49 
50 typedef struct ether_header_s {
51  OSUINT8 ether_dhost[6]; /* destination host MAC address */
52  OSUINT8 ether_shost[6]; /* source host MAC address */
53  OSUINT16 ether_type;
54 } ether_header_t;
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
70 EXTERNRT int rtxDecPcapHdr
71 (OSCTXT* pctxt, pcap_hdr_t* pPcapHdr, OSBOOL* pswapped);
72 
83 EXTERNRT int rtxDecPcapRecHdr
84 (OSCTXT* pctxt, pcaprec_hdr_t* pPcapRecHdr, OSBOOL swapped);
85 
96 EXTERNRT int rtxDecEtherHdr
97 (OSCTXT* pctxt, ether_header_t* pEtherHdr, OSBOOL swapped);
98 
105 EXTERNRT void rtxPrintPcapHdr(const pcap_hdr_t* pPcapHdr);
106 
113 EXTERNRT void rtxPrintPcapRecHdr(const pcaprec_hdr_t* pPcapRecHdr);
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif
EXTERNRT int rtxDecEtherHdr(OSCTXT *pctxt, ether_header_t *pEtherHdr, OSBOOL swapped)
This function decodes an Ethernet header structure.
Common run-time context definitions.
EXTERNRT void rtxPrintPcapRecHdr(const pcaprec_hdr_t *pPcapRecHdr)
This function prints the contents of a PCAP record header structure to stdout.
EXTERNRT void rtxPrintPcapHdr(const pcap_hdr_t *pPcapHdr)
This function prints the contents of a PCAP global header structure to stdout.
EXTERNRT int rtxDecPcapHdr(OSCTXT *pctxt, pcap_hdr_t *pPcapHdr, OSBOOL *pswapped)
This function decodes a PCAP global header structure.
Run-time context structure.
Definition: rtxContext.h:198
EXTERNRT int rtxDecPcapRecHdr(OSCTXT *pctxt, pcaprec_hdr_t *pPcapRecHdr, OSBOOL swapped)
This function decodes a PCAP record header structure.