mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 10:04:05 +08:00
make more array declarations static/const
This commit is contained in:
parent
8354e31273
commit
d8b3af528a
@ -252,7 +252,7 @@ cdp_print_addr(const u_char * p, int l)
|
||||
int pt, pl, al, num;
|
||||
const u_char *endp = p + l;
|
||||
#ifdef INET6
|
||||
static u_char prot_ipv6[] = {
|
||||
static const u_char prot_ipv6[] = {
|
||||
0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x86, 0xdd
|
||||
};
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ static const char rcsid[] _U_ =
|
||||
|
||||
#define RFC1483LLC_LEN 8
|
||||
|
||||
static unsigned char rfcllc[] = {
|
||||
static const unsigned char rfcllc[] = {
|
||||
0xaa, /* DSAP: non-ISO */
|
||||
0xaa, /* SSAP: non-ISO */
|
||||
0x03, /* Ctrl: Unnumbered Information Command PDU */
|
||||
|
10
print-egp.c
10
print-egp.c
@ -94,7 +94,7 @@ struct egp_packet {
|
||||
#define egp_sourcenet egp_pands.egpu_sourcenet
|
||||
};
|
||||
|
||||
const char *egp_acquire_codes[] = {
|
||||
static const char *egp_acquire_codes[] = {
|
||||
"request",
|
||||
"confirm",
|
||||
"refuse",
|
||||
@ -102,7 +102,7 @@ const char *egp_acquire_codes[] = {
|
||||
"cease_ack"
|
||||
};
|
||||
|
||||
const char *egp_acquire_status[] = {
|
||||
static const char *egp_acquire_status[] = {
|
||||
"unspecified",
|
||||
"active_mode",
|
||||
"passive_mode",
|
||||
@ -113,18 +113,18 @@ const char *egp_acquire_status[] = {
|
||||
"protocol_violation"
|
||||
};
|
||||
|
||||
const char *egp_reach_codes[] = {
|
||||
static const char *egp_reach_codes[] = {
|
||||
"hello",
|
||||
"i-h-u"
|
||||
};
|
||||
|
||||
const char *egp_status_updown[] = {
|
||||
static const char *egp_status_updown[] = {
|
||||
"indeterminate",
|
||||
"up",
|
||||
"down"
|
||||
};
|
||||
|
||||
const char *egp_reasons[] = {
|
||||
static const char *egp_reasons[] = {
|
||||
"unspecified",
|
||||
"bad_EGP_header_format",
|
||||
"bad_EGP_data_field_format",
|
||||
|
@ -80,7 +80,7 @@ int fddi_bitswap = 1;
|
||||
* - vj
|
||||
*/
|
||||
|
||||
static u_char fddi_bit_swap[] = {
|
||||
static const u_char fddi_bit_swap[] = {
|
||||
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
|
||||
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
|
||||
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
|
||||
|
@ -704,7 +704,7 @@ typedef int (*codeset_pr_func_t)(const struct ie_tlv_header_t *ie_p,
|
||||
const u_char *p);
|
||||
|
||||
/* array of 16 codepages - currently we only support codepage 1,5 */
|
||||
static codeset_pr_func_t fr_q933_print_ie_codeset[] = {
|
||||
static const codeset_pr_func_t fr_q933_print_ie_codeset[] = {
|
||||
NULL,
|
||||
fr_q933_print_ie_codeset5,
|
||||
NULL,
|
||||
|
@ -691,7 +691,7 @@ static const char *ipcomp_p_map[] = {
|
||||
NULL, "oui", "deflate", "lzs",
|
||||
};
|
||||
|
||||
const struct attrmap ipsec_t_map[] = {
|
||||
static const struct attrmap ipsec_t_map[] = {
|
||||
{ NULL, 0, { NULL } },
|
||||
{ "lifetype", 3, { NULL, "sec", "kb", }, },
|
||||
{ "life", 0, { NULL } },
|
||||
@ -718,7 +718,7 @@ const struct attrmap ipsec_t_map[] = {
|
||||
{ "privalg", 0, { NULL } },
|
||||
};
|
||||
|
||||
const struct attrmap encr_t_map[] = {
|
||||
static const struct attrmap encr_t_map[] = {
|
||||
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 0, 1 */
|
||||
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 2, 3 */
|
||||
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 4, 5 */
|
||||
@ -729,7 +729,7 @@ const struct attrmap encr_t_map[] = {
|
||||
{ "keylen", 14, { NULL }},
|
||||
};
|
||||
|
||||
const struct attrmap oakley_t_map[] = {
|
||||
static const struct attrmap oakley_t_map[] = {
|
||||
{ NULL, 0, { NULL } },
|
||||
{ "enc", 8, { NULL, "1des", "idea", "blowfish", "rc5",
|
||||
"3des", "cast", "aes", }, },
|
||||
|
@ -371,7 +371,7 @@ struct juniper_cookie_table_t {
|
||||
const char *s; /* pic name */
|
||||
};
|
||||
|
||||
static struct juniper_cookie_table_t juniper_cookie_table[] = {
|
||||
static const struct juniper_cookie_table_t juniper_cookie_table[] = {
|
||||
#ifdef DLT_JUNIPER_ATM1
|
||||
{ DLT_JUNIPER_ATM1, 4, "ATM1"},
|
||||
#endif
|
||||
@ -1133,7 +1133,7 @@ juniper_read_tlv_value(const u_char *p, u_int tlv_type, u_int tlv_len) {
|
||||
static int
|
||||
juniper_parse_header (const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info) {
|
||||
|
||||
struct juniper_cookie_table_t *lp = juniper_cookie_table;
|
||||
const struct juniper_cookie_table_t *lp = juniper_cookie_table;
|
||||
u_int idx, jnx_ext_len, jnx_header_len = 0;
|
||||
u_int8_t tlv_type,tlv_len;
|
||||
u_int32_t control_word;
|
||||
|
@ -265,7 +265,7 @@ static int mp_fast_close_print(const u_char *opt, u_int opt_len, u_char flags _U
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct {
|
||||
static const struct {
|
||||
const char *name;
|
||||
int (*print)(const u_char *, u_int, u_char);
|
||||
} mptcp_options[] = {
|
||||
|
@ -68,7 +68,7 @@ static const struct tok rx_types[] = {
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
static struct double_tok {
|
||||
static const struct double_tok {
|
||||
int flag; /* Rx flag */
|
||||
int packetType; /* Packet type */
|
||||
const char *s; /* Flag string */
|
||||
|
16
print-smb.c
16
print-smb.c
@ -65,8 +65,8 @@ struct smbfnsint
|
||||
|
||||
#define FLG_CHAIN (1 << 0)
|
||||
|
||||
static struct smbfns *
|
||||
smbfind(int id, struct smbfns *list)
|
||||
static const struct smbfns *
|
||||
smbfind(int id, const struct smbfns *list)
|
||||
{
|
||||
int sindex;
|
||||
|
||||
@ -77,8 +77,8 @@ smbfind(int id, struct smbfns *list)
|
||||
return(&list[0]);
|
||||
}
|
||||
|
||||
static struct smbfnsint *
|
||||
smbfindint(int id, struct smbfnsint *list)
|
||||
static const struct smbfnsint *
|
||||
smbfindint(int id, const struct smbfnsint *list)
|
||||
{
|
||||
int sindex;
|
||||
|
||||
@ -144,7 +144,7 @@ trunc:
|
||||
return;
|
||||
}
|
||||
|
||||
struct smbfnsint trans2_fns[] = {
|
||||
static const struct smbfnsint trans2_fns[] = {
|
||||
{ 0, "TRANSACT2_OPEN", 0,
|
||||
{ "Flags2=[w]\nMode=[w]\nSearchAttrib=[A]\nAttrib=[A]\nTime=[T2]\nOFun=[w]\nSize=[D]\nRes=([w, w, w, w, w])\nPath=[S]",
|
||||
NULL,
|
||||
@ -173,7 +173,7 @@ static void
|
||||
print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_char *maxbuf)
|
||||
{
|
||||
u_int bcc;
|
||||
static struct smbfnsint *fn = &trans2_fns[0];
|
||||
static const struct smbfnsint *fn = &trans2_fns[0];
|
||||
const u_char *data, *param;
|
||||
const u_char *w = words + 1;
|
||||
const char *f1 = NULL, *f2 = NULL;
|
||||
@ -520,7 +520,7 @@ trunc:
|
||||
}
|
||||
|
||||
|
||||
static struct smbfns smb_fns[] = {
|
||||
static const struct smbfns smb_fns[] = {
|
||||
{ -1, "SMBunknown", 0, DEFDESCRIPT },
|
||||
|
||||
{ SMBtcon, "SMBtcon", 0,
|
||||
@ -799,7 +799,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
|
||||
int command;
|
||||
u_int32_t nterror;
|
||||
const u_char *words, *maxwords, *data;
|
||||
struct smbfns *fn;
|
||||
const struct smbfns *fn;
|
||||
const char *fmt_smbheader =
|
||||
"[P4]SMB Command = [B]\nError class = [BP1]\nError code = [d]\nFlags1 = [B]\nFlags2 = [B][P13]\nTree ID = [d]\nProc ID = [d]\nUID = [d]\nMID = [d]\nWord Count = [b]\n";
|
||||
int smboffset;
|
||||
|
26
print-snmp.c
26
print-snmp.c
@ -83,7 +83,7 @@ static const char rcsid[] _U_ =
|
||||
* Universal ASN.1 types
|
||||
* (we only care about the tag values for those allowed in the Internet SMI)
|
||||
*/
|
||||
const char *Universal[] = {
|
||||
static const char *Universal[] = {
|
||||
"U-0",
|
||||
"Boolean",
|
||||
"Integer",
|
||||
@ -106,7 +106,7 @@ const char *Universal[] = {
|
||||
/*
|
||||
* Application-wide ASN.1 types from the Internet SMI and their tags
|
||||
*/
|
||||
const char *Application[] = {
|
||||
static const char *Application[] = {
|
||||
"IpAddress",
|
||||
#define IPADDR 0
|
||||
"Counter",
|
||||
@ -125,7 +125,7 @@ const char *Application[] = {
|
||||
/*
|
||||
* Context-specific ASN.1 types for the SNMP PDUs and their tags
|
||||
*/
|
||||
const char *Context[] = {
|
||||
static const char *Context[] = {
|
||||
"GetRequest",
|
||||
#define GETREQ 0
|
||||
"GetNextRequest",
|
||||
@ -155,7 +155,7 @@ const char *Context[] = {
|
||||
/*
|
||||
* Context-specific ASN.1 types for the SNMP Exceptions and their tags
|
||||
*/
|
||||
const char *Exceptions[] = {
|
||||
static const char *Exceptions[] = {
|
||||
"noSuchObject",
|
||||
#define NOSUCHOBJECT 0
|
||||
"noSuchInstance",
|
||||
@ -168,14 +168,14 @@ const char *Exceptions[] = {
|
||||
* Private ASN.1 types
|
||||
* The Internet SMI does not specify any
|
||||
*/
|
||||
const char *Private[] = {
|
||||
static const char *Private[] = {
|
||||
"P-0"
|
||||
};
|
||||
|
||||
/*
|
||||
* error-status values for any SNMP PDU
|
||||
*/
|
||||
const char *ErrorStatus[] = {
|
||||
static const char *ErrorStatus[] = {
|
||||
"noError",
|
||||
"tooBig",
|
||||
"noSuchName",
|
||||
@ -204,7 +204,7 @@ const char *ErrorStatus[] = {
|
||||
/*
|
||||
* generic-trap values in the SNMP Trap-PDU
|
||||
*/
|
||||
const char *GenericTrap[] = {
|
||||
static const char *GenericTrap[] = {
|
||||
"coldStart",
|
||||
"warmStart",
|
||||
"linkDown",
|
||||
@ -225,7 +225,7 @@ const char *GenericTrap[] = {
|
||||
* type definitions.
|
||||
*/
|
||||
#define defineCLASS(x) { "x", x, sizeof(x)/sizeof(x[0]) } /* not ANSI-C */
|
||||
struct {
|
||||
static const struct {
|
||||
const char *name;
|
||||
const char **Id;
|
||||
int numIDs;
|
||||
@ -245,7 +245,7 @@ struct {
|
||||
/*
|
||||
* defined forms for ASN.1 types
|
||||
*/
|
||||
const char *Form[] = {
|
||||
static const char *Form[] = {
|
||||
"Primitive",
|
||||
#define PRIMITIVE 0
|
||||
"Constructed",
|
||||
@ -278,7 +278,7 @@ struct obj {
|
||||
* Currently, this includes the prefixes for the Internet MIB, the
|
||||
* private enterprises tree, and the experimental tree.
|
||||
*/
|
||||
struct obj_abrev {
|
||||
static const struct obj_abrev {
|
||||
const char *prefix; /* prefix for this abrev */
|
||||
struct obj *node; /* pointer into object table */
|
||||
const char *oid; /* ASN.1 encoded OID */
|
||||
@ -360,7 +360,7 @@ struct be {
|
||||
/*
|
||||
* SNMP versions recognized by this module
|
||||
*/
|
||||
const char *SnmpVersion[] = {
|
||||
static const char *SnmpVersion[] = {
|
||||
"SNMPv1",
|
||||
#define SNMP_VERSION_1 0
|
||||
"SNMPv2c",
|
||||
@ -684,7 +684,7 @@ asn1_print(struct be *elem)
|
||||
int o = 0, first = -1, i = asnlen;
|
||||
|
||||
if (!sflag && !nflag && asnlen > 2) {
|
||||
struct obj_abrev *a = &obj_abrev_list[0];
|
||||
const struct obj_abrev *a = &obj_abrev_list[0];
|
||||
size_t a_len = strlen(a->oid);
|
||||
for (; a->node; a++) {
|
||||
TCHECK2(*p, a_len);
|
||||
@ -879,7 +879,7 @@ struct smi2be {
|
||||
int be;
|
||||
};
|
||||
|
||||
static struct smi2be smi2betab[] = {
|
||||
static const struct smi2be smi2betab[] = {
|
||||
{ SMI_BASETYPE_INTEGER32, BE_INT },
|
||||
{ SMI_BASETYPE_OCTETSTRING, BE_STR },
|
||||
{ SMI_BASETYPE_OCTETSTRING, BE_INETADDR },
|
||||
|
@ -288,7 +288,7 @@ wb_prep(const struct pkt_prep *prep, u_int len)
|
||||
}
|
||||
|
||||
|
||||
const char *dopstr[] = {
|
||||
static const char *dopstr[] = {
|
||||
"dop-0!",
|
||||
"dop-1!",
|
||||
"RECT",
|
||||
|
@ -167,7 +167,7 @@ struct ndo_printer {
|
||||
};
|
||||
|
||||
|
||||
static struct printer printers[] = {
|
||||
static const struct printer printers[] = {
|
||||
{ arcnet_if_print, DLT_ARCNET },
|
||||
#ifdef DLT_ARCNET_LINUX
|
||||
{ arcnet_linux_if_print, DLT_ARCNET_LINUX },
|
||||
@ -322,7 +322,7 @@ static struct printer printers[] = {
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
static struct ndo_printer ndo_printers[] = {
|
||||
static const struct ndo_printer ndo_printers[] = {
|
||||
{ ether_if_print, DLT_EN10MB },
|
||||
#ifdef DLT_IPNET
|
||||
{ ipnet_if_print, DLT_IPNET },
|
||||
@ -351,7 +351,7 @@ static struct ndo_printer ndo_printers[] = {
|
||||
if_printer
|
||||
lookup_printer(int type)
|
||||
{
|
||||
struct printer *p;
|
||||
const struct printer *p;
|
||||
|
||||
for (p = printers; p->f; ++p)
|
||||
if (type == p->type)
|
||||
@ -364,7 +364,7 @@ lookup_printer(int type)
|
||||
if_ndo_printer
|
||||
lookup_ndo_printer(int type)
|
||||
{
|
||||
struct ndo_printer *p;
|
||||
const struct ndo_printer *p;
|
||||
|
||||
for (p = ndo_printers; p->f; ++p)
|
||||
if (type == p->type)
|
||||
|
Loading…
Reference in New Issue
Block a user