#include <nt.h>#include <stdio.h>#include <stdarg.h>#include <string.h>#include <stdlib.h>#include <signal.h>#include <unistd.h>#include <sys/types.h>#include <sys/mman.h>#include <sys/stat.h>#include <fcntl.h>#include <netinet/in.h>#include <argparse.h>#include "capfileconvert_example.h"Go to the source code of this file.
Data Structures | |
| struct | Nt2GSegmentDumpHeader_s |
| struct | pcap_hdr_s |
| struct | nttimeval |
| struct | ntpcap |
Macros | |
| #define | _GNU_SOURCE |
| #define | PKTBUF_SIZE (16*1024) |
| #define | CAPFILE_MAX_SIZE ((size_t)-1) |
| #define | NT_2GD_SEGMENT_DUMP_MAGIC 0xFEDEABBA |
| #define | PCAP_MAGIC 0xa1b2c3d4 |
| #define | PCAP_SWAPPED_MAGIC 0xd4c3b2a1 |
| #define | PCAP_MODIFIED_MAGIC 0xa1b2cd34 |
| #define | PCAP_SWAPPED_MODIFIED_MAGIC 0x34cdb2a1 |
| #define | PCAP_NSEC_MAGIC 0xa1b23c4d |
| #define | PCAP_SWAPPED_NSEC_MAGIC 0x4d3cb2a1 |
| #define | SWAPLONG(y) ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff)) |
| #define | SWAPSHORT(y) ( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) ) |
Functions | |
| static void | DisplayProgramHeader (void) |
| static void | DisplayProgramFooter (void) |
| static void | StopApplication (int sig) |
| static int | _Convert (void) |
| int | main (int argc, const char *argv[]) |
Variables | |
| static atomic_int | appRunning = 1 |
| static enum InputFormat_e | input_format = 0 |
| static const char * | progname = "capfileconvert" |
| static unsigned long long | pktNum |
| static unsigned long long | pktSkipNum |
| static char * | opt_input_file = NULL |
| static char * | opt_output_file = NULL |
| static char * | opt_output_format = NULL |
| static char * | opt_input_format = NULL |
| static int | opt_verbose = 0 |
| static enum OutputFormat_e | opt_outputformat = 0 |
| static enum InputPCAPFormat_e | opt_inputformat = 0 |
| struct argparse_option | arg_options [] |
| static struct NtFileHeader0_s | nt3gdFileHeader |
| static struct NtFileHeader0_s | nt3gdNsFileHeader |
| static struct pcap_hdr_s | pcapGlobalHdr |
| static struct pcap_hdr_s | pcapGlobalHdrNano |
Macro Definition Documentation
| #define _GNU_SOURCE |
Definition at line 54 of file capfileconvert_example.c.
| #define PKTBUF_SIZE (16*1024) |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 83 of file capfileconvert_example.c.
Referenced by _Convert().
| #define CAPFILE_MAX_SIZE ((size_t)-1) |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 84 of file capfileconvert_example.c.
Referenced by _Convert().
| #define NT_2GD_SEGMENT_DUMP_MAGIC 0xFEDEABBA |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 138 of file capfileconvert_example.c.
Referenced by _Convert().
| #define PCAP_MAGIC 0xa1b2c3d4 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 177 of file capfileconvert_example.c.
Referenced by _Convert().
| #define PCAP_SWAPPED_MAGIC 0xd4c3b2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 178 of file capfileconvert_example.c.
Referenced by _Convert().
| #define PCAP_MODIFIED_MAGIC 0xa1b2cd34 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 179 of file capfileconvert_example.c.
Referenced by _Convert().
| #define PCAP_SWAPPED_MODIFIED_MAGIC 0x34cdb2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 180 of file capfileconvert_example.c.
Referenced by _Convert().
| #define PCAP_NSEC_MAGIC 0xa1b23c4d |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 181 of file capfileconvert_example.c.
Referenced by _Convert().
| #define PCAP_SWAPPED_NSEC_MAGIC 0x4d3cb2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 182 of file capfileconvert_example.c.
Referenced by _Convert().
| #define SWAPLONG | ( | y | ) | ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff)) |
Definition at line 184 of file capfileconvert_example.c.
| #define SWAPSHORT | ( | y | ) | ( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) ) |
Definition at line 186 of file capfileconvert_example.c.
Enumeration Type Documentation
| enum InputFormat_e |
| Enumerator | |
|---|---|
| INPUT_FORMAT_UNKNOWN | |
| INPUT_FORMAT_3GD | |
| INPUT_FORMAT_PCAP | |
| INPUT_FORMAT_PCAPNANO | |
| INPUT_FORMAT_2GD | |
| INPUT_FORMAT_3GDNANO | |
Definition at line 90 of file capfileconvert_example.c.
| enum OutputFormat_e |
| Enumerator | |
|---|---|
| OUTPUT_FORMAT_UNKNOWN | |
| OUTPUT_FORMAT_PCAP | |
| OUTPUT_FORMAT_PCAPNANO | |
| OUTPUT_FORMAT_NT3GD | |
| OUTPUT_FORMAT_NT3GDNANO | |
Definition at line 110 of file capfileconvert_example.c.
| enum InputPCAPFormat_e |
| Enumerator | |
|---|---|
| INPUT_PCAPFORMAT_UNKNOWN | |
| INPUT_PCAPFORMAT_LIBPCAP | |
| INPUT_PCAPFORMAT_NAPATECH | |
Definition at line 118 of file capfileconvert_example.c.
Function Documentation
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 237 of file capfileconvert_example.c.
Referenced by main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 248 of file capfileconvert_example.c.
Referenced by main().
|
static |
Definition at line 264 of file capfileconvert_example.c.
Referenced by DisplayProgramFooter(), and main().
|
static |
Try to detect input file format
PCAP has not been detected, assume legacy 2GD Capture but perform some sanity checks first though.
The input file has been detected at this point. Do the convertion.
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 271 of file capfileconvert_example.c.
Referenced by main().
| int main | ( | int | argc, |
| const char * | argv[] | ||
| ) |
Definition at line 1025 of file capfileconvert_example.c.
Variable Documentation
|
static |
Definition at line 80 of file capfileconvert_example.c.
Referenced by _Convert(), DisplayProgramFooter(), and StopApplication().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 100 of file capfileconvert_example.c.
Referenced by DisplayProgramHeader().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 101 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 102 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 104 of file capfileconvert_example.c.
Referenced by _Convert(), and main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 105 of file capfileconvert_example.c.
Referenced by _Convert(), and main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 106 of file capfileconvert_example.c.
Referenced by main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 107 of file capfileconvert_example.c.
Referenced by main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 108 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Referenced by _Convert(), and main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Referenced by _Convert(), and main().
| struct argparse_option arg_options[] |
Table of valid options. Mainly used for the getopt_long_only function. For further info see the manpage.
Definition at line 128 of file capfileconvert_example.c.
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 151 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 164 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
Definition at line 203 of file capfileconvert_example.c.
|
static |
Definition at line 214 of file capfileconvert_example.c.