#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 enum InputFormat_e | input_format = 0 |
static const char * | progname = "capfileconvert" |
static int | appRunning = 1 |
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 55 of file capfileconvert_example.c.
#define PKTBUF_SIZE (16*1024) |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 77 of file capfileconvert_example.c.
Referenced by _Convert().
#define CAPFILE_MAX_SIZE ((size_t)-1) |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 78 of file capfileconvert_example.c.
Referenced by _Convert().
#define NT_2GD_SEGMENT_DUMP_MAGIC 0xFEDEABBA |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 133 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_MAGIC 0xa1b2c3d4 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 172 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_SWAPPED_MAGIC 0xd4c3b2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 173 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_MODIFIED_MAGIC 0xa1b2cd34 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 174 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_SWAPPED_MODIFIED_MAGIC 0x34cdb2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 175 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_NSEC_MAGIC 0xa1b23c4d |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 176 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_SWAPPED_NSEC_MAGIC 0x4d3cb2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 177 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 179 of file capfileconvert_example.c.
#define SWAPSHORT | ( | y | ) | ( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) ) |
Definition at line 181 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 84 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 105 of file capfileconvert_example.c.
enum InputPCAPFormat_e |
Enumerator | |
---|---|
INPUT_PCAPFORMAT_UNKNOWN | |
INPUT_PCAPFORMAT_LIBPCAP | |
INPUT_PCAPFORMAT_NAPATECH |
Definition at line 113 of file capfileconvert_example.c.
Function Documentation
|
static |
Definition at line 232 of file capfileconvert_example.c.
Referenced by main().
|
static |
Definition at line 243 of file capfileconvert_example.c.
Referenced by main().
|
static |
Definition at line 251 of file capfileconvert_example.c.
Referenced by 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 257 of file capfileconvert_example.c.
Referenced by main().
int main | ( | int | argc, |
const char * | argv[] | ||
) |
Definition at line 1011 of file capfileconvert_example.c.
Variable Documentation
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Referenced by _Convert().
|
static |
Definition at line 94 of file capfileconvert_example.c.
Referenced by DisplayProgramHeader().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c, net/replayGS/replayGS_example.c, net/transmit_multifunction/transmit_multifunction_example.c, and statUsage/statUsage_example.c.
Definition at line 95 of file capfileconvert_example.c.
Referenced by _Convert(), and StopApplication().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 96 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 97 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 99 of file capfileconvert_example.c.
Referenced by _Convert(), and main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 100 of file capfileconvert_example.c.
Referenced by _Convert(), and main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 101 of file capfileconvert_example.c.
Referenced by main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 102 of file capfileconvert_example.c.
Referenced by main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 103 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 123 of file capfileconvert_example.c.
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 146 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 159 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
Definition at line 198 of file capfileconvert_example.c.
|
static |
Definition at line 209 of file capfileconvert_example.c.