#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 <nt.h>
#include "capfileconvert_example.h"
Go to the source code of this file.
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[]) |
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) ) |
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 |
Function Documentation
|
static |
Definition at line 229 of file capfileconvert_example.c.
Referenced by main().
|
static |
Definition at line 240 of file capfileconvert_example.c.
Referenced by main().
|
static |
Definition at line 248 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 254 of file capfileconvert_example.c.
Referenced by main().
int main | ( | int | argc, |
const char * | argv[] | ||
) |
Definition at line 1008 of file capfileconvert_example.c.
Macro Definition Documentation
#define _GNU_SOURCE |
Definition at line 52 of file capfileconvert_example.c.
#define PKTBUF_SIZE (16*1024) |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 74 of file capfileconvert_example.c.
Referenced by _Convert().
#define CAPFILE_MAX_SIZE ((size_t)-1) |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 75 of file capfileconvert_example.c.
Referenced by _Convert().
#define NT_2GD_SEGMENT_DUMP_MAGIC 0xFEDEABBA |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 130 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_MAGIC 0xa1b2c3d4 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 169 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_SWAPPED_MAGIC 0xd4c3b2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 170 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_MODIFIED_MAGIC 0xa1b2cd34 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 171 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_SWAPPED_MODIFIED_MAGIC 0x34cdb2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 172 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_NSEC_MAGIC 0xa1b23c4d |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 173 of file capfileconvert_example.c.
Referenced by _Convert().
#define PCAP_SWAPPED_NSEC_MAGIC 0x4d3cb2a1 |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 174 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 176 of file capfileconvert_example.c.
#define SWAPSHORT | ( | y | ) | ( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) ) |
Definition at line 178 of file capfileconvert_example.c.
Enumeration Type Documentation
enum InputFormat_e |
enum OutputFormat_e |
enum InputPCAPFormat_e |
Variable Documentation
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Referenced by _Convert().
|
static |
Definition at line 91 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 92 of file capfileconvert_example.c.
Referenced by _Convert(), and StopApplication().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 93 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 94 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 96 of file capfileconvert_example.c.
Referenced by _Convert(), and main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 97 of file capfileconvert_example.c.
Referenced by _Convert(), and main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 98 of file capfileconvert_example.c.
Referenced by main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 99 of file capfileconvert_example.c.
Referenced by main().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 100 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 120 of file capfileconvert_example.c.
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 143 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
- Examples:
- net/capfileconvert/capfileconvert_example.c.
Definition at line 156 of file capfileconvert_example.c.
Referenced by _Convert().
|
static |
Definition at line 195 of file capfileconvert_example.c.
|
static |
Definition at line 206 of file capfileconvert_example.c.