From Joerg Mayer: add some missing static declarations.
svn path=/trunk/; revision=5806
This commit is contained in:
parent
b10bc01cad
commit
ac444e6b9d
12
editcap.c
12
editcap.c
|
@ -1,7 +1,7 @@
|
||||||
/* Edit capture files. We can delete records, adjust timestamps, or
|
/* Edit capture files. We can delete records, adjust timestamps, or
|
||||||
* simply convert from one format to another format.
|
* simply convert from one format to another format.
|
||||||
*
|
*
|
||||||
* $Id: editcap.c,v 1.23 2002/06/23 10:32:13 guy Exp $
|
* $Id: editcap.c,v 1.24 2002/06/30 20:28:54 guy Exp $
|
||||||
*
|
*
|
||||||
* Originally written by Richard Sharpe.
|
* Originally written by Richard Sharpe.
|
||||||
* Improved by Guy Harris.
|
* Improved by Guy Harris.
|
||||||
|
@ -53,8 +53,8 @@ struct time_adjustment {
|
||||||
int is_negative;
|
int is_negative;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct select_item selectfrm[100];
|
static struct select_item selectfrm[100];
|
||||||
int max_selected = -1;
|
static int max_selected = -1;
|
||||||
static int count = 1;
|
static int count = 1;
|
||||||
static int keep_em = 0;
|
static int keep_em = 0;
|
||||||
static int out_file_type = WTAP_FILE_PCAP; /* default to "libpcap" */
|
static int out_file_type = WTAP_FILE_PCAP; /* default to "libpcap" */
|
||||||
|
@ -65,7 +65,7 @@ static struct time_adjustment time_adj = {{0, 0}, 0}; /* no adjustment */
|
||||||
|
|
||||||
/* Add a selection item, a simple parser for now */
|
/* Add a selection item, a simple parser for now */
|
||||||
|
|
||||||
void add_selection(char *sel)
|
static void add_selection(char *sel)
|
||||||
{
|
{
|
||||||
char *locn;
|
char *locn;
|
||||||
char *next;
|
char *next;
|
||||||
|
@ -105,7 +105,7 @@ void add_selection(char *sel)
|
||||||
|
|
||||||
/* Was the record selected? */
|
/* Was the record selected? */
|
||||||
|
|
||||||
int selected(int recno)
|
static int selected(int recno)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ set_time_adjustment(char *optarg)
|
||||||
time_adj.tv.tv_usec = val;
|
time_adj.tv.tv_usec = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
static void usage()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *string;
|
const char *string;
|
||||||
|
|
82
text2pcap.c
82
text2pcap.c
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
|
* (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
|
||||||
*
|
*
|
||||||
* $Id: text2pcap.c,v 1.17 2002/06/23 10:32:18 guy Exp $
|
* $Id: text2pcap.c,v 1.18 2002/06/30 20:28:54 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -128,45 +128,45 @@
|
||||||
/*--- Options --------------------------------------------------------------------*/
|
/*--- Options --------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Debug level */
|
/* Debug level */
|
||||||
int debug = 0;
|
static int debug = 0;
|
||||||
/* Be quiet */
|
/* Be quiet */
|
||||||
int quiet = FALSE;
|
static int quiet = FALSE;
|
||||||
|
|
||||||
/* Dummy Ethernet header */
|
/* Dummy Ethernet header */
|
||||||
int hdr_ethernet = FALSE;
|
static int hdr_ethernet = FALSE;
|
||||||
unsigned long hdr_ethernet_proto = 0;
|
static unsigned long hdr_ethernet_proto = 0;
|
||||||
|
|
||||||
/* Dummy IP header */
|
/* Dummy IP header */
|
||||||
int hdr_ip = FALSE;
|
static int hdr_ip = FALSE;
|
||||||
unsigned long hdr_ip_proto = 0;
|
static unsigned long hdr_ip_proto = 0;
|
||||||
|
|
||||||
/* Dummy UDP header */
|
/* Dummy UDP header */
|
||||||
int hdr_udp = FALSE;
|
static int hdr_udp = FALSE;
|
||||||
unsigned long hdr_udp_dest = 0;
|
static unsigned long hdr_udp_dest = 0;
|
||||||
unsigned long hdr_udp_src = 0;
|
static unsigned long hdr_udp_src = 0;
|
||||||
|
|
||||||
/* Dummy SCTP header */
|
/* Dummy SCTP header */
|
||||||
int hdr_sctp = FALSE;
|
static int hdr_sctp = FALSE;
|
||||||
unsigned long hdr_sctp_src = 0;
|
static unsigned long hdr_sctp_src = 0;
|
||||||
unsigned long hdr_sctp_dest = 0;
|
static unsigned long hdr_sctp_dest = 0;
|
||||||
unsigned long hdr_sctp_tag = 0;
|
static unsigned long hdr_sctp_tag = 0;
|
||||||
|
|
||||||
/* Dummy DATA chunk header */
|
/* Dummy DATA chunk header */
|
||||||
int hdr_data_chunk = FALSE;
|
static int hdr_data_chunk = FALSE;
|
||||||
unsigned char hdr_data_chunk_type = 0;
|
static unsigned char hdr_data_chunk_type = 0;
|
||||||
unsigned char hdr_data_chunk_bits = 3;
|
static unsigned char hdr_data_chunk_bits = 3;
|
||||||
unsigned long hdr_data_chunk_tsn = 0;
|
static unsigned long hdr_data_chunk_tsn = 0;
|
||||||
unsigned short hdr_data_chunk_sid = 0;
|
static unsigned short hdr_data_chunk_sid = 0;
|
||||||
unsigned short hdr_data_chunk_ssn = 0;
|
static unsigned short hdr_data_chunk_ssn = 0;
|
||||||
unsigned long hdr_data_chunk_ppid = 0;
|
static unsigned long hdr_data_chunk_ppid = 0;
|
||||||
|
|
||||||
|
|
||||||
/*--- Local date -----------------------------------------------------------------*/
|
/*--- Local date -----------------------------------------------------------------*/
|
||||||
|
|
||||||
/* This is where we store the packet currently being built */
|
/* This is where we store the packet currently being built */
|
||||||
#define MAX_PACKET 64000
|
#define MAX_PACKET 64000
|
||||||
unsigned char packet_buf[MAX_PACKET];
|
static unsigned char packet_buf[MAX_PACKET];
|
||||||
unsigned long curr_offset = 0;
|
static unsigned long curr_offset = 0;
|
||||||
|
|
||||||
/* This buffer contains strings present before the packet offset 0 */
|
/* This buffer contains strings present before the packet offset 0 */
|
||||||
#define PACKET_PREAMBLE_MAX_LEN 2048
|
#define PACKET_PREAMBLE_MAX_LEN 2048
|
||||||
|
@ -174,8 +174,8 @@ static unsigned char packet_preamble[PACKET_PREAMBLE_MAX_LEN+1];
|
||||||
static int packet_preamble_len = 0;
|
static int packet_preamble_len = 0;
|
||||||
|
|
||||||
/* Number of packets read and written */
|
/* Number of packets read and written */
|
||||||
unsigned long num_packets_read = 0;
|
static unsigned long num_packets_read = 0;
|
||||||
unsigned long num_packets_written = 0;
|
static unsigned long num_packets_written = 0;
|
||||||
|
|
||||||
/* Time code of packet, derived from packet_preamble */
|
/* Time code of packet, derived from packet_preamble */
|
||||||
static unsigned long ts_sec = 0;
|
static unsigned long ts_sec = 0;
|
||||||
|
@ -183,16 +183,16 @@ static unsigned long ts_usec = 0;
|
||||||
static char *ts_fmt = NULL;
|
static char *ts_fmt = NULL;
|
||||||
|
|
||||||
/* Input file */
|
/* Input file */
|
||||||
char *input_filename;
|
static char *input_filename;
|
||||||
FILE *input_file = NULL;
|
static FILE *input_file = NULL;
|
||||||
/* Output file */
|
/* Output file */
|
||||||
char *output_filename;
|
static char *output_filename;
|
||||||
FILE *output_file = NULL;
|
static FILE *output_file = NULL;
|
||||||
|
|
||||||
/* Offset base to parse */
|
/* Offset base to parse */
|
||||||
unsigned long offset_base = 16;
|
static unsigned long offset_base = 16;
|
||||||
|
|
||||||
FILE *yyin;
|
static FILE *yyin;
|
||||||
|
|
||||||
/* ----- State machine -----------------------------------------------------------*/
|
/* ----- State machine -----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -204,16 +204,16 @@ typedef enum {
|
||||||
READ_BYTE, /* Just read a byte */
|
READ_BYTE, /* Just read a byte */
|
||||||
READ_TEXT, /* Just read text - ignore until EOL */
|
READ_TEXT, /* Just read text - ignore until EOL */
|
||||||
} parser_state_t;
|
} parser_state_t;
|
||||||
parser_state_t state = INIT;
|
static parser_state_t state = INIT;
|
||||||
|
|
||||||
const char *state_str[] = {"Init",
|
static const char *state_str[] = {"Init",
|
||||||
"Start-of-line",
|
"Start-of-line",
|
||||||
"Offset",
|
"Offset",
|
||||||
"Byte",
|
"Byte",
|
||||||
"Text"
|
"Text"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *token_str[] = {"",
|
static const char *token_str[] = {"",
|
||||||
"Byte",
|
"Byte",
|
||||||
"Offset",
|
"Offset",
|
||||||
"Directive",
|
"Directive",
|
||||||
|
@ -229,7 +229,7 @@ typedef struct {
|
||||||
unsigned short l3pid;
|
unsigned short l3pid;
|
||||||
} hdr_ethernet_t;
|
} hdr_ethernet_t;
|
||||||
|
|
||||||
hdr_ethernet_t HDR_ETHERNET = {
|
static hdr_ethernet_t HDR_ETHERNET = {
|
||||||
{0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
|
{0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
|
||||||
{0x02, 0x02, 0x02, 0x02, 0x02, 0x02},
|
{0x02, 0x02, 0x02, 0x02, 0x02, 0x02},
|
||||||
0};
|
0};
|
||||||
|
@ -248,7 +248,7 @@ typedef struct {
|
||||||
unsigned long dest_addr;
|
unsigned long dest_addr;
|
||||||
} hdr_ip_t;
|
} hdr_ip_t;
|
||||||
|
|
||||||
hdr_ip_t HDR_IP = {0x45, 0, 0, 0x3412, 0, 0, 0xff, 0, 0, 0x01010101, 0x02020202};
|
static hdr_ip_t HDR_IP = {0x45, 0, 0, 0x3412, 0, 0, 0xff, 0, 0, 0x01010101, 0x02020202};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned short source_port;
|
unsigned short source_port;
|
||||||
|
@ -257,7 +257,7 @@ typedef struct {
|
||||||
unsigned short checksum;
|
unsigned short checksum;
|
||||||
} hdr_udp_t;
|
} hdr_udp_t;
|
||||||
|
|
||||||
hdr_udp_t HDR_UDP = {0, 0, 0, 0};
|
static hdr_udp_t HDR_UDP = {0, 0, 0, 0};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned short src_port;
|
unsigned short src_port;
|
||||||
|
@ -266,7 +266,7 @@ typedef struct {
|
||||||
unsigned long checksum;
|
unsigned long checksum;
|
||||||
} hdr_sctp_t;
|
} hdr_sctp_t;
|
||||||
|
|
||||||
hdr_sctp_t HDR_SCTP = {0, 0, 0, 0};
|
static hdr_sctp_t HDR_SCTP = {0, 0, 0, 0};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
|
@ -278,9 +278,9 @@ typedef struct {
|
||||||
unsigned long ppid;
|
unsigned long ppid;
|
||||||
} hdr_data_chunk_t;
|
} hdr_data_chunk_t;
|
||||||
|
|
||||||
hdr_data_chunk_t HDR_DATA_CHUNK = {0, 0, 0, 0, 0, 0, 0};
|
static hdr_data_chunk_t HDR_DATA_CHUNK = {0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
char tempbuf[64];
|
static char tempbuf[64];
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
* Stuff for writing a PCap file
|
* Stuff for writing a PCap file
|
||||||
|
@ -307,7 +307,7 @@ struct pcaprec_hdr {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Link-layer type; see net/bpf.h for details */
|
/* Link-layer type; see net/bpf.h for details */
|
||||||
unsigned long pcap_link_type = 1; /* Default is DLT-EN10MB */
|
static unsigned long pcap_link_type = 1; /* Default is DLT-EN10MB */
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
* Parse a single hex number
|
* Parse a single hex number
|
||||||
|
|
Loading…
Reference in New Issue