Don't define value_string arrays in a .h file (included in multiple places).

Also:
 - don't use val_to_str_const() with a "format" default string;
 - rename 'opt_len_type' enumeration  identifiers to be less generic.

svn path=/trunk/; revision=43210
This commit is contained in:
Bill Meier 2012-06-11 18:47:42 +00:00
parent afab63c34c
commit 70cc6362fe
6 changed files with 228 additions and 235 deletions

View File

@ -1437,7 +1437,33 @@ dissect_ipopt_sdb(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
proto_tree_add_item(field_tree, hf_ip_opt_padding, tvb, offset, optlen, ENC_NA);
}
static value_string_ext qs_rate_vals_ext = VALUE_STRING_EXT_INIT(qs_rate_vals);
const value_string qs_func_vals[] = {
{QS_RATE_REQUEST, "Rate request"},
{QS_RATE_REPORT, "Rate report"},
{0, NULL}
};
static const value_string qs_rate_vals[] = {
{ 0, "0 bit/s"},
{ 1, "80 Kbit/s"},
{ 2, "160 Kbit/s"},
{ 3, "320 Kbit/s"},
{ 4, "640 Kbit/s"},
{ 5, "1.28 Mbit/s"},
{ 6, "2.56 Mbit/s"},
{ 7, "5.12 Mbit/s"},
{ 8, "10.24 Mbit/s"},
{ 9, "20.48 Mbit/s"},
{10, "40.96 Mbit/s"},
{11, "81.92 Mbit/s"},
{12, "163.84 Mbit/s"},
{13, "327.68 Mbit/s"},
{14, "655.36 Mbit/s"},
{15, "1.31072 Gbit/s"},
{0, NULL}
};
value_string_ext qs_rate_vals_ext = VALUE_STRING_EXT_INIT(qs_rate_vals);
static void
dissect_ipopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
guint optlen, packet_info *pinfo, proto_tree *opt_tree)
@ -1472,14 +1498,14 @@ dissect_ipopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
"%u", ttl_diff);
PROTO_ITEM_SET_GENERATED(ti);
proto_item_append_text(tf, ", %s, QS TTL %u, QS TTL diff %u",
val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown"),
val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown (%u)"),
tvb_get_guint8(tvb, offset + 3), ttl_diff);
proto_tree_add_item(field_tree, hf_ip_opt_qs_nonce, tvb, offset + 4, 4, ENC_NA);
proto_tree_add_item(field_tree, hf_ip_opt_qs_reserved, tvb, offset + 4, 4, ENC_NA);
} else if (function == QS_RATE_REPORT) {
proto_tree_add_item(field_tree, hf_ip_opt_qs_rate, tvb, offset + 2, 1, ENC_NA);
proto_item_append_text(tf, ", %s",
val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown (%u)"));
val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown (%u)"));
proto_tree_add_item(field_tree, hf_ip_opt_qs_unused, tvb, offset + 3, 1, ENC_NA);
proto_tree_add_item(field_tree, hf_ip_opt_qs_nonce, tvb, offset + 4, 4, ENC_NA);
proto_tree_add_item(field_tree, hf_ip_opt_qs_reserved, tvb, offset + 4, 4, ENC_NA);
@ -1488,68 +1514,68 @@ dissect_ipopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
static const ip_tcp_opt ipopts[] = {
{IPOPT_EOOL, "End of Options List (EOL)", &ett_ip_option_eool,
NO_LENGTH, 0, dissect_ipopt_eool},
OPT_LEN_NO_LENGTH, 0, dissect_ipopt_eool},
{IPOPT_NOP, "No Operation (NOP)", &ett_ip_option_nop,
NO_LENGTH, 0, dissect_ipopt_nop},
OPT_LEN_NO_LENGTH, 0, dissect_ipopt_nop},
{IPOPT_SEC, "Security", &ett_ip_option_sec,
VARIABLE_LENGTH, IPOLEN_SEC_MIN, dissect_ipopt_security},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_SEC_MIN, dissect_ipopt_security},
{IPOPT_LSR, "Loose Source Route", &ett_ip_option_route,
VARIABLE_LENGTH, IPOLEN_LSR_MIN, dissect_ipopt_route},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_LSR_MIN, dissect_ipopt_route},
{IPOPT_TS, "Time Stamp", &ett_ip_option_timestamp,
VARIABLE_LENGTH, IPOLEN_TS_MIN, dissect_ipopt_timestamp},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_TS_MIN, dissect_ipopt_timestamp},
{IPOPT_ESEC, "Extended Security", &ett_ip_option_ext_security,
VARIABLE_LENGTH, IPOLEN_ESEC_MIN, dissect_ipopt_ext_security},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_ESEC_MIN, dissect_ipopt_ext_security},
{IPOPT_CIPSO, "Commercial Security", &ett_ip_option_cipso,
VARIABLE_LENGTH, IPOLEN_CIPSO_MIN, dissect_ipopt_cipso},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_CIPSO_MIN, dissect_ipopt_cipso},
{IPOPT_RR, "Record Route", &ett_ip_option_route,
VARIABLE_LENGTH, IPOLEN_RR_MIN, dissect_ipopt_record_route},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_RR_MIN, dissect_ipopt_record_route},
{IPOPT_SID, "Stream ID", &ett_ip_option_sid,
FIXED_LENGTH, IPOLEN_SID, dissect_ipopt_sid},
OPT_LEN_FIXED_LENGTH, IPOLEN_SID, dissect_ipopt_sid},
{IPOPT_SSR, "Strict Source Route", &ett_ip_option_route,
VARIABLE_LENGTH, IPOLEN_SSR_MIN, dissect_ipopt_route},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_SSR_MIN, dissect_ipopt_route},
#if 0 /* TODO */
{IPOPT_ZSU, "Experimental Measurement", &ett_ip_option_zsu,
VARIABLE_LENGTH /* ? */, IPOLEN_ZSU_MIN, dissect_ipopt_zsu},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_ZSU_MIN, dissect_ipopt_zsu},
#endif
{IPOPT_MTUP, "MTU Probe", &ett_ip_option_mtu,
FIXED_LENGTH, IPOLEN_MTU, dissect_ipopt_mtu},
OPT_LEN_FIXED_LENGTH, IPOLEN_MTU, dissect_ipopt_mtu},
{IPOPT_MTUR, "MTU Reply", &ett_ip_option_mtu,
FIXED_LENGTH, IPOLEN_MTU, dissect_ipopt_mtu},
OPT_LEN_FIXED_LENGTH, IPOLEN_MTU, dissect_ipopt_mtu},
#if 0 /* TODO */
{IPOPT_FINN, "Experimental Flow Control", &ett_ip_option_finn,
VARIABLE_LENGTH /* ? */, IPOLEN_FINN_MIN, dissect_ipopt_finn},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_FINN_MIN, dissect_ipopt_finn},
{IPOPT_VISA, "Experimental Access Control", &ett_ip_option_visa,
VARIABLE_LENGTH /* ? */, IPOLEN_VISA_MIN, dissect_ipopt_visa},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_VISA_MIN, dissect_ipopt_visa},
{IPOPT_ENCODE, "???", &ett_ip_option_encode,
VARIABLE_LENGTH /* ? */, IPOLEN_ENCODE_MIN, dissect_ipopt_encode},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_ENCODE_MIN, dissect_ipopt_encode},
{IPOPT_IMITD, "IMI Traffic Descriptor", &ett_ip_option_imitd,
VARIABLE_LENGTH /* ? */, IPOLEN_IMITD_MIN, dissect_ipopt_imitd},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_IMITD_MIN, dissect_ipopt_imitd},
{IPOPT_EIP, "Extended Internet Protocol", &ett_ip_option_eip,
VARIABLE_LENGTH /* ? */, IPOLEN_EIP_MIN, dissect_ipopt_eip},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_EIP_MIN, dissect_ipopt_eip},
#endif
{IPOPT_TR, "Traceroute", &ett_ip_option_tr,
FIXED_LENGTH, IPOLEN_TR, dissect_ipopt_tr},
OPT_LEN_FIXED_LENGTH, IPOLEN_TR, dissect_ipopt_tr},
#if 0 /* TODO */
{IPOPT_ADDEXT, "Address Extension", &ett_ip_option_addext,
VARIABLE_LENGTH /* ? */, IPOLEN_ADDEXT_MIN, dissect_ipopt_addext},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_ADDEXT_MIN, dissect_ipopt_addext},
#endif
{IPOPT_RTRALT, "Router Alert", &ett_ip_option_ra,
FIXED_LENGTH, IPOLEN_RA, dissect_ipopt_ra},
OPT_LEN_FIXED_LENGTH, IPOLEN_RA, dissect_ipopt_ra},
{IPOPT_SDB, "Selective Directed Broadcast", &ett_ip_option_sdb,
VARIABLE_LENGTH, IPOLEN_SDB_MIN, dissect_ipopt_sdb},
OPT_LEN_VARIABLE_LENGTH, IPOLEN_SDB_MIN, dissect_ipopt_sdb},
#if 0 /* TODO */
{IPOPT_UN, "Unassigned", &ett_ip_option_un,
VARIABLE_LENGTH /* ? */, IPOLEN_UN_MIN, dissect_ipopt_un},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_UN_MIN, dissect_ipopt_un},
{IPOPT_DPS, "Dynamic Packet State", &ett_ip_option_dps,
VARIABLE_LENGTH /* ? */, IPOLEN_DPS_MIN, dissect_ipopt_dps},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_DPS_MIN, dissect_ipopt_dps},
{IPOPT_UMP, "Upstream Multicast Pkt.", &ett_ip_option_ump,
VARIABLE_LENGTH /* ? */, IPOLEN_UMP_MIN, dissect_ipopt_ump},
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_UMP_MIN, dissect_ipopt_ump},
#endif
{IPOPT_QS, "Quick-Start", &ett_ip_option_qs,
FIXED_LENGTH, IPOLEN_QS, dissect_ipopt_qs}
OPT_LEN_FIXED_LENGTH, IPOLEN_QS, dissect_ipopt_qs}
#if 0 /* TODO */
{IPOPT_EXP, "RFC3692-style Experiment", &ett_ip_option_exp,
VARIABLE_LENGTH /* ? */, IPOLEN_EXP_MIN, dissect_ipopt_exp}
OPT_LEN_VARIABLE_LENGTH /* ? */, IPOLEN_EXP_MIN, dissect_ipopt_exp}
#endif
};
@ -1579,12 +1605,12 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
break;
}
if (optp == &opttab[nopts]) {
/* We assume that the only NO_LENGTH options are EOL and NOP options,
so that we can treat unknown options as VARIABLE_LENGTH with a
/* We assume that the only OPT_LEN_NO_LENGTH options are EOL and NOP options,
so that we can treat unknown options as OPT_LEN_VARIABLE_LENGTH with a
minimum of 2, and at least be able to move on to the next option
by using the length in the option. */
optp = NULL; /* indicate that we don't know this option */
len_type = VARIABLE_LENGTH;
len_type = OPT_LEN_VARIABLE_LENGTH;
optlen = 2;
name = ep_strdup_printf("Unknown (0x%02x)", opt);
dissect = NULL;
@ -1594,7 +1620,7 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
optlen = optp->optlen;
name = optp->name;
dissect = optp->dissect;
if (opt_item && len_type == NO_LENGTH && optlen == 0 && opt == 1 &&
if (opt_item && len_type == OPT_LEN_NO_LENGTH && optlen == 0 && opt == 1 &&
(nop_count == 0 || offset % 4)) { /* opt 1 = NOP in both IP and TCP */
/* Count number of NOP in a row within a uint32 */
nop_count++;
@ -1603,7 +1629,7 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
}
}
--length; /* account for type byte */
if (len_type != NO_LENGTH) {
if (len_type != OPT_LEN_NO_LENGTH) {
/* Option has a length. Is it in the packet? */
if (length == 0) {
/* Bogus - packet must at least include option code byte and
@ -1628,14 +1654,14 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
"past end of options)",
name, len, plurality(len, "", "s"));
return;
} else if (len_type == FIXED_LENGTH && len != optlen) {
} else if (len_type == OPT_LEN_FIXED_LENGTH && len != optlen) {
/* Bogus - option length isn't what it's supposed to be for this
option. */
proto_tree_add_text(opt_tree, tvb, offset, len,
"%s (with option length = %u byte%s; should be %u)",
name, len, plurality(len, "", "s"), optlen);
return;
} else if (len_type == VARIABLE_LENGTH && len < optlen) {
} else if (len_type == OPT_LEN_VARIABLE_LENGTH && len < optlen) {
/* Bogus - option length is less than what it's supposed to be for
this option. */
proto_tree_add_text(opt_tree, tvb, offset, len,
@ -1726,14 +1752,14 @@ get_dst_offset(tvbuff_t *tvb, int offset, guint length,
minimum of 2, and at least be able to move on to the next option
by using the length in the option. */
optp = NULL; /* indicate that we don't know this option */
len_type = VARIABLE_LENGTH;
len_type = OPT_LEN_VARIABLE_LENGTH;
optlen = 2;
} else {
len_type = optp->len_type;
optlen = optp->optlen;
}
--length; /* account for type byte */
if (len_type != NO_LENGTH) {
if (len_type != OPT_LEN_NO_LENGTH) {
/* Option has a length. Is it in the packet? */
if (length == 0) {
/* Bogus - packet must at least include option code byte and
@ -1749,11 +1775,11 @@ get_dst_offset(tvbuff_t *tvb, int offset, guint length,
} else if (len - 2 > length) {
/* Bogus - option goes past the end of the header. */
return 0;
} else if (len_type == FIXED_LENGTH && len != optlen) {
} else if (len_type == OPT_LEN_FIXED_LENGTH && len != optlen) {
/* Bogus - option length isn't what it's supposed to be for this
option. */
return 0;
} else if (len_type == VARIABLE_LENGTH && len < optlen) {
} else if (len_type == OPT_LEN_VARIABLE_LENGTH && len < optlen) {
/* Bogus - option length is less than what it's supposed to be for
this option. */
return 0;

View File

@ -868,8 +868,6 @@ dissect_unknown_option(tvbuff_t *tvb, int offset, proto_tree *tree)
return len;
}
static value_string_ext qs_rate_vals_ext = VALUE_STRING_EXT_INIT(qs_rate_vals);
static int
dissect_opts(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo, const int hf_option_item)
{
@ -1019,7 +1017,7 @@ dissect_opts(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo, c
"%u", ttl_diff);
PROTO_ITEM_SET_GENERATED(ti);
proto_item_append_text(ti_opt, ", %s, QS TTL %u, QS TTL diff %u",
val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown"),
val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown (%u)"),
tvb_get_guint8(tvb, offset), ttl_diff);
offset += 1;
proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_nonce, tvb, offset, 4, ENC_NA);
@ -1029,7 +1027,7 @@ dissect_opts(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo, c
proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_rate, tvb, offset, 1, ENC_NA);
offset += 1;
proto_item_append_text(ti_opt, ", %s",
val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown (%u)"));
val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown (%u)"));
proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_unused, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_nonce, tvb, offset, 4, ENC_NA);
@ -2112,7 +2110,7 @@ proto_register_ipv6(void)
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_ipv6_nxt,
{ "Next header", "ipv6.nxt",
FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ipproto_val_ext, 0x0, NULL, HFILL }},
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0x0, NULL, HFILL }},
{ &hf_ipv6_hlim,
{ "Hop limit", "ipv6.hlim",
FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
@ -2383,7 +2381,7 @@ proto_register_ipv6(void)
NULL, HFILL }},
{ &hf_ipv6_opt_qs_rate,
{ "Rate", "ipv6.opt.qs_rate",
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &(qs_rate_vals_ext), QS_RATE_MASK,
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &qs_rate_vals_ext, QS_RATE_MASK,
NULL, HFILL }},
{ &hf_ipv6_opt_qs_ttl,
{ "QS TTL", "ipv6.opt.qs_ttl",

View File

@ -1681,7 +1681,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_PAD1, /* 0 Pad1 [RFC3775] */
"Pad1",
NULL,
NO_LENGTH,
OPT_LEN_NO_LENGTH,
0,
NULL,
},
@ -1689,7 +1689,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_PADN, /* 1 PadN [RFC3775] */
"PadN",
&ett_mip6_opt_padn,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
0,
dissect_mip6_opt_padn
},
@ -1697,7 +1697,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_BRA, /* 2 Binding Refresh Advice */
"Binding Refresh Advice",
&ett_mip6_opt_bra,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_BRA_LEN,
dissect_mip6_opt_bra
},
@ -1705,7 +1705,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_ACOA, /*3 Alternate Care-of Address */
"Alternate Care-of Address",
&ett_mip6_opt_acoa,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_ACOA_LEN,
dissect_mip6_opt_acoa
},
@ -1713,7 +1713,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_NI, /* 4 Nonce Indices */
"Nonce Indices",
&ett_mip6_opt_ni,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_NI_LEN,
dissect_mip6_opt_ni
},
@ -1721,7 +1721,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_AUTD, /* 5 Authorization Data */
"Authorization Data",
&ett_mip6_opt_bad,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
0,
dissect_mip6_opt_bad
},
@ -1729,7 +1729,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_MNP, /* 6 Mobile Network Prefix Option */
"Mobile Network Prefix",
&ett_mip6_nemo_opt_mnp,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_NEMO_MNP_LEN,
dissect_mip6_nemo_opt_mnp
},
@ -1737,7 +1737,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_MHLLA, /* 7 Mobility Header Link-Layer Address option [RFC5568] */
"Mobility Header Link-Layer Address option",
&ett_fmip6_opt_lla,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
FMIP6_LLA_MINLEN,
dissect_fmip6_opt_lla
},
@ -1745,7 +1745,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_MNID, /* 8 MN-ID-OPTION-TYPE */
"Mobile Node Identifier",
&ett_mip6_opt_mnid,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
MIP6_MNID_MINLEN,
dissect_mip6_opt_mnid
},
@ -1753,7 +1753,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_VSM, /* 19 Vendor Specific Mobility Option [RFC5094] */
"Vendor Specific Mobility",
&ett_mip6_opt_vsm,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
MIP6_VSM_MINLEN,
dissect_mip6_opt_vsm
},
@ -1761,7 +1761,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_SSM, /* 20 Service Selection Mobility Option [RFC5149] */
"Service Selection Mobility",
&ett_mip6_opt_ssm,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
MIP6_SSM_MINLEN,
dissect_mip6_opt_ssm
},
@ -1769,7 +1769,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_HNP, /* 22 Home Network Prefix Option [RFC5213] */
"Home Network Prefix",
&ett_pmip6_opt_hnp,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_NEMO_MNP_LEN,
dissect_mip6_nemo_opt_mnp
},
@ -1777,7 +1777,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_MOHI, /* 23 Handoff Indicator Option [RFC5213] */
"Handoff Indicator Option",
&ett_pmip6_opt_hi,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
PMIP6_HI_LEN,
dissect_pmip6_opt_hi
},
@ -1785,7 +1785,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_ATT, /* 24 Access Technology Type Option [RFC5213] */
"Access Technology Type Option",
&ett_pmip6_opt_att,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
PMIP6_ATT_LEN,
dissect_pmip6_opt_att
},
@ -1793,7 +1793,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_LLA, /* 26 Link-local Address Option [RFC5213 */
"Link-local Address",
&ett_pmip6_opt_lla,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
PMIP6_LLA_LEN,
dissect_pmip6_opt_lla
},
@ -1802,7 +1802,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_TS, /* 27 Timestamp */
"Timestamp",
&ett_pmip6_opt_ts,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
PMIP6_TS_LEN,
dissect_pmip6_opt_ts
},
@ -1810,7 +1810,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_RC, /* 28 Restart Counter [RFC5847] */
"Restart Counter",
&ett_pmip6_opt_rc,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
PMIP6_RC_LEN,
dissect_pmip6_opt_rc
},
@ -1818,7 +1818,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_IPV4HA, /* 29 IPv4 Home Address [RFC5555] */
"IPv4 Home Address",
&ett_mip6_opt_ipv4ha,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_IPV4HA_LEN,
dissect_pmip6_opt_ipv4ha
},
@ -1826,7 +1826,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_IPV4AA, /* 30 IPv4 Address Acknowledgement [RFC5555] */
"IPv4 Address Acknowledgement",
&ett_mip6_opt_ipv4aa,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_IPV4AA_LEN,
dissect_pmip6_opt_ipv4aa
},
@ -1834,7 +1834,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_GREK, /* 33 GRE Key Option [RFC5845] */
"GRE Key",
&ett_pmip6_opt_grek,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
PMIP6_GREK_LEN,
dissect_pmip6_opt_grek
},
@ -1842,7 +1842,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_IPV4HAREQ, /* 36 IPv4 Home Address Request [RFC5844] */
"IPv4 Home Address Request",
&ett_mip6_opt_ipv4hareq,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_IPV4HAREQ_LEN,
dissect_pmip6_opt_ipv4hareq
},
@ -1850,7 +1850,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_IPV4HAREP, /* 37 IPv4 Home Address Reply [RFC5844] */
"IPv4 Home Address Reply",
&ett_mip6_opt_ipv4harep,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_IPV4HAREP_LEN,
dissect_pmip6_opt_ipv4harep
},
@ -1858,7 +1858,7 @@ static const ip_tcp_opt mip6_opts[] = {
MIP6_IPV4DRA, /* 38 IPv4 Default-Router Address [RFC5844] */
"IPv4 Default-Router Address",
&ett_mip6_opt_ipv4dra,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
MIP6_IPV4DRA_LEN,
dissect_pmip6_opt_ipv4dra
},
@ -1894,13 +1894,13 @@ dissect_mipv6_options(tvbuff_t *tvb, int offset, guint length,
break;
}
if (optp == &opttab[nopts]) {
/* We assume that the only NO_LENGTH options are Pad1 options,
* so that we can treat unknown options as VARIABLE_LENGTH with a
/* We assume that the only OPT_LEN_NO_LENGTH options are Pad1 options,
* so that we can treat unknown options as OPT_LEN_VARIABLE_LENGTH with a
* minimum of 0, and at least be able to move on to the next option
* by using the length in the option.
*/
optp = NULL; /* indicate that we don't know this option */
len_type = VARIABLE_LENGTH;
len_type = OPT_LEN_VARIABLE_LENGTH;
optlen = 0;
g_snprintf(name_str, sizeof name_str, "Unknown (0x%02x)", opt);
name = name_str;
@ -1912,7 +1912,7 @@ dissect_mipv6_options(tvbuff_t *tvb, int offset, guint length,
dissect = optp->dissect;
}
--length; /* account for type byte */
if (len_type != NO_LENGTH) {
if (len_type != OPT_LEN_NO_LENGTH) {
/* Option has a length. Is it in the packet? */
if (length == 0) {
/* Bogus - packet must at least include
@ -1930,14 +1930,14 @@ dissect_mipv6_options(tvbuff_t *tvb, int offset, guint length,
"%s (option length = %u byte%s says option goes past end of options)",
name, len, plurality(len, "", "s"));
return;
} else if (len_type == FIXED_LENGTH && len != optlen) {
} else if (len_type == OPT_LEN_FIXED_LENGTH && len != optlen) {
/* Bogus - option length isn't what it's supposed to be for this
option. */
proto_tree_add_text(opt_tree, tvb, offset, len + 2,
"%s (with option length = %u byte%s; should be %u)", name,
len, plurality(len, "", "s"), optlen);
return;
} else if (len_type == VARIABLE_LENGTH && len < optlen) {
} else if (len_type == OPT_LEN_VARIABLE_LENGTH && len < optlen) {
/* Bogus - option length is less than what it's supposed to be for
this option. */
proto_tree_add_text(opt_tree, tvb, offset, len + 2,

View File

@ -943,67 +943,62 @@ static void dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static const ip_tcp_opt lcp_opts[] = {
{CI_VENDORSPECIFIC, "Vendor Specific", &ett_lcp_vendor_opt,
VARIABLE_LENGTH, 6, dissect_lcp_vendor_opt},
OPT_LEN_VARIABLE_LENGTH, 6, dissect_lcp_vendor_opt},
{CI_MRU, "Maximum Receive Unit", &ett_lcp_mru_opt,
FIXED_LENGTH, 4, dissect_lcp_mru_opt},
OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_mru_opt},
{CI_ASYNCMAP, "Async Control Character Map", &ett_lcp_asyncmap_opt,
FIXED_LENGTH, 6, dissect_lcp_async_map_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_lcp_async_map_opt},
{CI_AUTHPROT, "Authentication Protocol", &ett_lcp_authprot_opt,
VARIABLE_LENGTH, 4, dissect_lcp_authprot_opt},
OPT_LEN_VARIABLE_LENGTH, 4, dissect_lcp_authprot_opt},
{CI_QUALITY, "Quality Protocol", &ett_lcp_qualprot_opt,
VARIABLE_LENGTH, 4, dissect_lcp_qualprot_opt},
OPT_LEN_VARIABLE_LENGTH, 4, dissect_lcp_qualprot_opt},
{CI_MAGICNUMBER, "Magic Number", &ett_lcp_magicnumber_opt,
FIXED_LENGTH, 6, dissect_lcp_magicnumber_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_lcp_magicnumber_opt},
{CI_LINKQUALMON, "Link Quality Monitoring", &ett_lcp_linkqualmon_opt,
FIXED_LENGTH, 6, dissect_lcp_linkqualmon_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_lcp_linkqualmon_opt},
{CI_PCOMPRESSION, "Protocol Field Compression", &ett_lcp_pcomp_opt,
FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_ACCOMPRESSION, "Address and Control Field Compression",
&ett_lcp_acccomp_opt, FIXED_LENGTH, 2, dissect_lcp_simple_opt},
OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_ACCOMPRESSION, "Address and Control Field Compression", &ett_lcp_acccomp_opt,
OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_FCS_ALTERNATIVES, "FCS Alternatives", &ett_lcp_fcs_alternatives_opt,
FIXED_LENGTH, 3, dissect_lcp_fcs_alternatives_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_fcs_alternatives_opt},
{CI_SELF_DESCRIBING_PAD, "Self Describing Pad", &ett_lcp_self_desc_pad_opt,
FIXED_LENGTH, 3, dissect_lcp_self_describing_pad_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_self_describing_pad_opt},
{CI_NUMBERED_MODE, "Numbered Mode", &ett_lcp_numbered_mode_opt,
VARIABLE_LENGTH, 4, dissect_lcp_numbered_mode_opt},
OPT_LEN_VARIABLE_LENGTH, 4, dissect_lcp_numbered_mode_opt},
/* TODO? CI_MULTILINK_PROC */
{CI_CALLBACK, "Callback", &ett_lcp_callback_opt,
VARIABLE_LENGTH, 3, dissect_lcp_callback_opt},
OPT_LEN_VARIABLE_LENGTH, 3, dissect_lcp_callback_opt},
/* TODO? CI_CONNECTTIME */
{CI_COMPOUND_FRAMES, "Compound Frames (Deprecated)",
&ett_lcp_compound_frames_opt, FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_NOMDATAENCAP, "Nominal Data Encapsulation (Deprecated)",
&ett_lcp_nomdataencap_opt, FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_COMPOUND_FRAMES, "Compound Frames (Deprecated)", &ett_lcp_compound_frames_opt,
OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_NOMDATAENCAP, "Nominal Data Encapsulation (Deprecated)", &ett_lcp_nomdataencap_opt,
OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_MULTILINK_MRRU, "Multilink MRRU", &ett_lcp_multilink_mrru_opt,
FIXED_LENGTH, 4, dissect_lcp_multilink_mrru_opt},
{CI_MULTILINK_SSNH, "Multilink Short Sequence Number Header",
&ett_lcp_multilink_ssnh_opt, FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_MULTILINK_EP_DISC, "Multilink Endpoint Discriminator",
&ett_lcp_multilink_ep_disc_opt, VARIABLE_LENGTH, 3,
dissect_lcp_multilink_ep_disc_opt},
OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_multilink_mrru_opt},
{CI_MULTILINK_SSNH, "Multilink Short Sequence Number Header", &ett_lcp_multilink_ssnh_opt,
OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
{CI_MULTILINK_EP_DISC, "Multilink Endpoint Discriminator", &ett_lcp_multilink_ep_disc_opt,
OPT_LEN_VARIABLE_LENGTH, 3, dissect_lcp_multilink_ep_disc_opt},
/* TODO? CI_PROP_KEN: ken@funk.com: www.funk.com => www.juniper.net */
{CI_DCE_IDENTIFIER, "DCE Identifier", &ett_lcp_dce_identifier_opt,
FIXED_LENGTH, 3, dissect_lcp_dce_identifier_opt},
{CI_MULTILINK_PLUS_PROC, "Multi Link Plus Procedure",
&ett_lcp_multilink_pp_opt, FIXED_LENGTH, 4,
dissect_lcp_multilink_pp_opt},
{CI_LINK_DISC_FOR_BACP, "Link Discriminator for BACP",
&ett_lcp_bacp_link_discrim_opt, FIXED_LENGTH, 4,
dissect_lcp_bacp_link_discriminator_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_dce_identifier_opt},
{CI_MULTILINK_PLUS_PROC, "Multi Link Plus Procedure", &ett_lcp_multilink_pp_opt,
OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_multilink_pp_opt},
{CI_LINK_DISC_FOR_BACP, "Link Discriminator for BACP", &ett_lcp_bacp_link_discrim_opt,
OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_bacp_link_discriminator_opt},
{CI_LCP_AUTHENTICATION, "LCP Authentication Option", &ett_lcp_auth_opt,
VARIABLE_LENGTH, 3, dissect_lcp_auth_opt},
OPT_LEN_VARIABLE_LENGTH, 3, dissect_lcp_auth_opt},
{CI_COBS, "Consistent Overhead Byte Stuffing (COBS)", &ett_lcp_cobs_opt,
FIXED_LENGTH, 3, dissect_lcp_cobs_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_cobs_opt},
{CI_PREFIX_ELISION, "Prefix Elision", &ett_lcp_prefix_elision_opt,
VARIABLE_LENGTH, 2, dissect_lcp_prefix_elision_opt},
{CI_MULTILINK_HDR_FMT, "Multilink header format",
&ett_multilink_hdr_fmt_opt, FIXED_LENGTH, 4,
dissect_lcp_multilink_hdr_fmt_opt},
{CI_INTERNATIONALIZATION, "Internationalization",
&ett_lcp_internationalization_opt, VARIABLE_LENGTH, 7,
dissect_lcp_internationalization_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_lcp_prefix_elision_opt},
{CI_MULTILINK_HDR_FMT, "Multilink header format", &ett_multilink_hdr_fmt_opt,
OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_multilink_hdr_fmt_opt},
{CI_INTERNATIONALIZATION, "Internationalization", &ett_lcp_internationalization_opt,
OPT_LEN_VARIABLE_LENGTH, 7, dissect_lcp_internationalization_opt},
{CI_SDL_ON_SONET_SDH, "Simple Data Link on SONET/SDH", &ett_lcp_simple_opt,
FIXED_LENGTH, 2, dissect_lcp_simple_opt}
OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt}
/* TODO? CI_UNASSIGNED */
};
@ -1045,25 +1040,25 @@ static void dissect_vsncp_addressalloc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb
static const ip_tcp_opt vsncp_opts[] = {
{CI_PDN_IDENTIFIER, "PDN Identifier", NULL,
FIXED_LENGTH, 3, dissect_vsncp_pdnid_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_pdnid_opt},
{CI_ACCESS_POINT_NM, "Access Point Name", NULL,
VARIABLE_LENGTH, 2, dissect_vsncp_apname_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_vsncp_apname_opt},
{CI_PDN_TYPE, "PDN Type", NULL,
FIXED_LENGTH, 3, dissect_vsncp_pdntype_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_pdntype_opt},
{CI_PDN_ADDRESS, "PDN Address", NULL,
VARIABLE_LENGTH, 3, dissect_vsncp_pdnaddress_opt},
OPT_LEN_VARIABLE_LENGTH, 3, dissect_vsncp_pdnaddress_opt},
{CI_PROTOCOL_CONFIG, "Protocol Configuration Options", NULL,
VARIABLE_LENGTH, 3, dissect_vsncp_pco_opt},
OPT_LEN_VARIABLE_LENGTH, 3, dissect_vsncp_pco_opt},
{CI_ERROR_CODE, "Error Code", NULL,
FIXED_LENGTH, 3, dissect_vsncp_errorcode_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_errorcode_opt},
{CI_ATTACH_TYPE, "Attach Type", NULL,
FIXED_LENGTH, 3, dissect_vsncp_attachtype_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_attachtype_opt},
{CI_IPv4DEFAULT_ROUTER, "IPv4 Default Router Address", NULL,
FIXED_LENGTH, 6, dissect_vsncp_ipv4address_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_vsncp_ipv4address_opt},
{CI_ADDRESS_ALLOC, "Address Allocation Cause", NULL,
FIXED_LENGTH, 3, dissect_vsncp_addressalloc_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_addressalloc_opt},
{CI_APN_AMBR, "APN-AMBR", NULL,
VARIABLE_LENGTH, 4, NULL}
OPT_LEN_VARIABLE_LENGTH, 4, NULL}
};
#define N_VSNCP_OPTS (sizeof vsncp_opts / sizeof vsncp_opts[0])
@ -1162,21 +1157,21 @@ static void dissect_ipcp_sec_nbns_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static const ip_tcp_opt ipcp_opts[] = {
{CI_ADDRS, "IP Addresses (deprecated)", &ett_ipcp_ipaddrs_opt,
FIXED_LENGTH, 10, dissect_ipcp_addrs_opt},
OPT_LEN_FIXED_LENGTH, 10, dissect_ipcp_addrs_opt},
{CI_COMPRESS_PROTO, "IP Compression Protocol", &ett_ipcp_compress_opt,
VARIABLE_LENGTH, 4, dissect_ipcp_compress_opt},
OPT_LEN_VARIABLE_LENGTH, 4, dissect_ipcp_compress_opt},
{CI_ADDR, "IP address", &ett_ipcp_ipaddr_opt,
FIXED_LENGTH, 6, dissect_ipcp_addr_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_ipcp_addr_opt},
{CI_MOBILE_IPv4, "Mobile Node's Home IP Address", &ett_ipcp_mobileipv4_opt,
FIXED_LENGTH, 6, dissect_ipcp_mobileipv4_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_ipcp_mobileipv4_opt},
{CI_PRI_DNS, "Primary DNS Server IP Address", &ett_ipcp_pridns_opt,
FIXED_LENGTH, 6, dissect_ipcp_pri_dns_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_ipcp_pri_dns_opt},
{CI_PRI_NBNS, "Primary NBNS Server IP Address", &ett_ipcp_prinbns_opt,
FIXED_LENGTH, 6, dissect_ipcp_pri_nbns_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_ipcp_pri_nbns_opt},
{CI_SEC_DNS, "Secondary DNS Server IP Address", &ett_ipcp_secdns_opt,
FIXED_LENGTH, 6, dissect_ipcp_sec_dns_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_ipcp_sec_dns_opt},
{CI_SEC_NBNS, "Secondary NBNS Server IP Address", &ett_ipcp_secnbns_opt,
FIXED_LENGTH, 6, dissect_ipcp_sec_nbns_opt}
OPT_LEN_FIXED_LENGTH, 6, dissect_ipcp_sec_nbns_opt}
};
#define N_IPCP_OPTS (sizeof ipcp_opts / sizeof ipcp_opts[0])
@ -1211,13 +1206,13 @@ static const value_string ipcp_iphc_parameter_vals[] = {
static const ip_tcp_opt ipcp_iphc_subopts[] = {
{IPCP_IPHC_CRTP, "RTP compression (RFC2508)",
&ett_ipcp_iphc_rtp_compress_opt, FIXED_LENGTH, 2,
&ett_ipcp_iphc_rtp_compress_opt, OPT_LEN_FIXED_LENGTH, 2,
dissect_ipcp_iphc_simple_opt},
{IPCP_IPHC_ECRTP, "Enhanced RTP compression (RFC3545)",
&ett_ipcp_iphc_enhanced_rtp_compress_opt, FIXED_LENGTH, 2,
&ett_ipcp_iphc_enhanced_rtp_compress_opt, OPT_LEN_FIXED_LENGTH, 2,
dissect_ipcp_iphc_simple_opt},
{IPCP_IPHC_NEGHC, "Negotiating header compression (RFC3545)",
&ett_ipcp_iphc_neghdrcomp_opt, FIXED_LENGTH, 3,
&ett_ipcp_iphc_neghdrcomp_opt, OPT_LEN_FIXED_LENGTH, 3,
dissect_ipcp_iphc_neghdrcomp_opt}
};
@ -1237,7 +1232,7 @@ static const value_string ipcp_rohc_profile_vals[] = {
static const ip_tcp_opt ipcp_rohc_subopts[] = {
{IPCP_ROHC_PROFILES, "Profiles (RFC3241)", &ett_ipcp_rohc_profiles_opt,
VARIABLE_LENGTH, 2, dissect_ipcp_rohc_profiles_opt}
OPT_LEN_VARIABLE_LENGTH, 2, dissect_ipcp_rohc_profiles_opt}
};
#define N_IPCP_ROHC_SUBOPTS (sizeof ipcp_rohc_subopts / sizeof ipcp_rohc_subopts[0])
@ -1257,7 +1252,7 @@ static void dissect_osinlcp_align_npdu_opt(const ip_tcp_opt *optp,
static const ip_tcp_opt osinlcp_opts[] = {
{CI_OSINLCP_ALIGN_NPDU, "Align-NPDU", &ett_osinlcp_align_npdu_opt,
FIXED_LENGTH, 3, dissect_osinlcp_align_npdu_opt}
OPT_LEN_FIXED_LENGTH, 3, dissect_osinlcp_align_npdu_opt}
};
#define N_OSINLCP_OPTS (sizeof osinlcp_opts / sizeof osinlcp_opts[0])
@ -1349,39 +1344,40 @@ static void dissect_ccp_v44lzjh_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static const ip_tcp_opt ccp_opts[] = {
{CI_CCP_OUI, "OUI", &ett_ccp_oui_opt,
VARIABLE_LENGTH, 6, dissect_ccp_oui_opt},
OPT_LEN_VARIABLE_LENGTH, 6, dissect_ccp_oui_opt},
{CI_CCP_PREDICT1, "Predictor type 1", &ett_ccp_predict1_opt,
VARIABLE_LENGTH, 2, dissect_ccp_predict1_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_ccp_predict1_opt},
{CI_CCP_PREDICT2, "Predictor type 2", &ett_ccp_predict2_opt,
VARIABLE_LENGTH, 2, dissect_ccp_predict2_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_ccp_predict2_opt},
{CI_CCP_PUDDLE, "Puddle Jumper", &ett_ccp_puddle_opt,
VARIABLE_LENGTH, 2, dissect_ccp_puddle_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_ccp_puddle_opt},
{CI_CCP_HPPPC, "Hewlett-Packard PPC", &ett_ccp_hpppc_opt,
VARIABLE_LENGTH, 2, dissect_ccp_hpppc_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_ccp_hpppc_opt},
{CI_CCP_STAC, "Stac Electronics LZS", &ett_ccp_stac_opt,
/* In RFC 1974, this is a fixed-length field of size 5, but in
* Ascend Proprietary STAC compression this field is 6 octets. */
VARIABLE_LENGTH, 5, dissect_ccp_stac_opt},
OPT_LEN_VARIABLE_LENGTH, 5, dissect_ccp_stac_opt},
{CI_CCP_MPPE, "Microsoft PPE/PPC", &ett_ccp_mppe_opt,
FIXED_LENGTH, 6, dissect_ccp_mppe_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_ccp_mppe_opt},
{CI_CCP_GFZA, "Gandalf FZA", &ett_ccp_gfza_opt,
VARIABLE_LENGTH, 3, dissect_ccp_gfza_opt},
OPT_LEN_VARIABLE_LENGTH, 3, dissect_ccp_gfza_opt},
{CI_CCP_V42BIS, "V.42bis compression", &ett_ccp_v42bis_opt,
VARIABLE_LENGTH, 2, dissect_ccp_v42bis_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_ccp_v42bis_opt},
{CI_CCP_BSDLZW, "BSD LZW Compress", &ett_ccp_bsdcomp_opt,
FIXED_LENGTH, 3, dissect_ccp_bsdcomp_opt},
OPT_LEN_FIXED_LENGTH, 3, dissect_ccp_bsdcomp_opt},
{CI_CCP_LZSDCP, "LZS-DCP", &ett_ccp_lzsdcp_opt,
FIXED_LENGTH, 6, dissect_ccp_lzsdcp_opt},
OPT_LEN_FIXED_LENGTH, 6, dissect_ccp_lzsdcp_opt},
{CI_CCP_MVRCA, "MVRCA (Magnalink)", &ett_ccp_mvrca_opt,
FIXED_LENGTH, 4, dissect_ccp_mvrca_opt},
OPT_LEN_FIXED_LENGTH, 4, dissect_ccp_mvrca_opt},
{CI_CCP_DCE,
"PPP for Data Compression in Data Circuit-Terminating Equipment (DCE)",
&ett_ccp_dce_opt, FIXED_LENGTH, 3, dissect_ccp_dce_opt},
&ett_ccp_dce_opt,
OPT_LEN_FIXED_LENGTH, 3, dissect_ccp_dce_opt},
{CI_CCP_DEFLATE, "Deflate", &ett_ccp_deflate_opt,
/* RFC1979 says the length is 3 but it's actually 4. */
FIXED_LENGTH, 4, dissect_ccp_deflate_opt},
OPT_LEN_FIXED_LENGTH, 4, dissect_ccp_deflate_opt},
{CI_CCP_V44LZJH, "V.44/LZJH compression", &ett_ccp_v44lzjh_opt,
VARIABLE_LENGTH, 4, dissect_ccp_v44lzjh_opt}
OPT_LEN_VARIABLE_LENGTH, 4, dissect_ccp_v44lzjh_opt}
};
#define N_CCP_OPTS (sizeof ccp_opts / sizeof ccp_opts[0])
@ -1403,14 +1399,13 @@ static void dissect_cbcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static const ip_tcp_opt cbcp_opts[] = {
{CI_CBCP_NO_CALLBACK, "No callback", NULL,
FIXED_LENGTH, 2, dissect_cbcp_no_callback_opt},
{CI_CBCP_CB_USER, "Callback to a user-specified number",
&ett_cbcp_callback_opt, VARIABLE_LENGTH, 4,
dissect_cbcp_callback_opt},
{CI_CBCP_CB_PRE, "Callback to a pre-specified or admin-specified number",
&ett_cbcp_callback_opt, FIXED_LENGTH, 3, dissect_cbcp_callback_opt},
{CI_CBCP_CB_ANY, "Callback to any of a list of numbers",
&ett_cbcp_callback_opt, VARIABLE_LENGTH, 4, dissect_cbcp_callback_opt}
OPT_LEN_FIXED_LENGTH, 2, dissect_cbcp_no_callback_opt},
{CI_CBCP_CB_USER, "Callback to a user-specified number", &ett_cbcp_callback_opt,
OPT_LEN_VARIABLE_LENGTH, 4, dissect_cbcp_callback_opt},
{CI_CBCP_CB_PRE, "Callback to a pre-specified or admin-specified number", &ett_cbcp_callback_opt,
OPT_LEN_FIXED_LENGTH, 3, dissect_cbcp_callback_opt},
{CI_CBCP_CB_ANY, "Callback to any of a list of numbers", &ett_cbcp_callback_opt,
OPT_LEN_VARIABLE_LENGTH, 4, dissect_cbcp_callback_opt}
};
#define N_CBCP_OPTS (sizeof cbcp_opts / sizeof cbcp_opts[0])
@ -1426,7 +1421,7 @@ static void dissect_bacp_favored_peer_opt(const ip_tcp_opt *optp,
static const ip_tcp_opt bacp_opts[] = {
{CI_BACP_FAVORED_PEER, "Favored-Peer", &ett_bacp_favored_peer_opt,
FIXED_LENGTH, 6, dissect_bacp_favored_peer_opt}
OPT_LEN_FIXED_LENGTH, 6, dissect_bacp_favored_peer_opt}
};
#define N_BACP_OPTS (sizeof bacp_opts / sizeof bacp_opts[0])
@ -1454,17 +1449,17 @@ static void dissect_bap_call_status_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static const ip_tcp_opt bap_opts[] = {
{CI_BAP_LINK_TYPE, "Link Type", &ett_bap_link_type_opt,
FIXED_LENGTH, 5, dissect_bap_link_type_opt},
OPT_LEN_FIXED_LENGTH, 5, dissect_bap_link_type_opt},
{CI_BAP_PHONE_DELTA, "Phone Delta", &ett_bap_phone_delta_opt,
VARIABLE_LENGTH, 4, dissect_bap_phone_delta_opt},
OPT_LEN_VARIABLE_LENGTH, 4, dissect_bap_phone_delta_opt},
{CI_BAP_NO_PHONE_NUM_NEEDED, "No Phone Number Needed", NULL,
FIXED_LENGTH, 2, NULL},
OPT_LEN_FIXED_LENGTH, 2, NULL},
{CI_BAP_REASON, "Reason", NULL,
VARIABLE_LENGTH, 2, dissect_bap_reason_opt},
OPT_LEN_VARIABLE_LENGTH, 2, dissect_bap_reason_opt},
{CI_BAP_LINK_DISC, "Link Discriminator", NULL,
FIXED_LENGTH, 4, dissect_bap_link_disc_opt},
OPT_LEN_FIXED_LENGTH, 4, dissect_bap_link_disc_opt},
{CI_BAP_CALL_STATUS, "Call Status", &ett_bap_call_status_opt,
FIXED_LENGTH, 4, dissect_bap_call_status_opt}
OPT_LEN_FIXED_LENGTH, 4, dissect_bap_call_status_opt}
};
#define N_BAP_OPTS (sizeof bap_opts / sizeof bap_opts[0])
@ -1513,7 +1508,7 @@ static void dissect_pppmuxcp_def_pid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static const ip_tcp_opt pppmuxcp_opts[] = {
{CI_DEFAULT_PID, "Default Protocol ID", NULL,
FIXED_LENGTH, 4, dissect_pppmuxcp_def_pid_opt}
OPT_LEN_FIXED_LENGTH, 4, dissect_pppmuxcp_def_pid_opt}
};
#define N_PPPMUXCP_OPTS (sizeof pppmuxcp_opts / sizeof pppmuxcp_opts[0])
@ -1529,9 +1524,9 @@ static void dissect_ipv6cp_if_id_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
static const ip_tcp_opt ipv6cp_opts[] = {
{CI_IPV6CP_IF_ID, "Interface Identifier", &ett_ipv6cp_if_id_opt,
FIXED_LENGTH, 10, dissect_ipv6cp_if_id_opt},
OPT_LEN_FIXED_LENGTH, 10, dissect_ipv6cp_if_id_opt},
{CI_COMPRESS_PROTO, "IPv6 compression", &ett_ipv6cp_compress_opt,
VARIABLE_LENGTH, 4, dissect_ipcp_compress_opt}
OPT_LEN_VARIABLE_LENGTH, 4, dissect_ipcp_compress_opt}
};
#define N_IPV6CP_OPTS (sizeof ipv6cp_opts / sizeof ipv6cp_opts[0])

View File

@ -2833,8 +2833,6 @@ dissect_tcpopt_cc(const ip_tcp_opt *optp, tvbuff_t *tvb,
tcp_info_append_uint(pinfo, "CC", cc);
}
static value_string_ext qs_rate_vals_ext = VALUE_STRING_EXT_INIT(qs_rate_vals);
static void
dissect_tcpopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb,
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
@ -2856,9 +2854,9 @@ dissect_tcpopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb,
PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: Rate response, %s, TTL diff %u ", optp->name,
val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown"),
val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown"),
tvb_get_guint8(tvb, offset + 3));
col_append_fstr(pinfo->cinfo, COL_INFO, " QSresp=%s", val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown"));
col_append_fstr(pinfo->cinfo, COL_INFO, " QSresp=%s", val_to_str_ext_const(rate, &qs_rate_vals_ext, "Unknown"));
}
@ -3576,7 +3574,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_EOL,
"End of Option List (EOL)",
NULL,
NO_LENGTH,
OPT_LEN_NO_LENGTH,
0,
NULL,
},
@ -3584,7 +3582,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_NOP,
"No-Operation (NOP)",
NULL,
NO_LENGTH,
OPT_LEN_NO_LENGTH,
0,
NULL,
},
@ -3592,7 +3590,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_MSS,
"Maximum segment size",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_MSS,
dissect_tcpopt_mss
},
@ -3600,7 +3598,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_WINDOW,
"Window scale",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_WINDOW,
dissect_tcpopt_wscale
},
@ -3608,7 +3606,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_SACK_PERM,
"SACK permitted",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_SACK_PERM,
dissect_tcpopt_sack_perm,
},
@ -3616,7 +3614,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_SACK,
"SACK",
&ett_tcp_option_sack,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
TCPOLEN_SACK_MIN,
dissect_tcpopt_sack
},
@ -3624,7 +3622,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_ECHO,
"Echo",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_ECHO,
dissect_tcpopt_echo
},
@ -3632,7 +3630,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_ECHOREPLY,
"Echo reply",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_ECHOREPLY,
dissect_tcpopt_echo
},
@ -3640,7 +3638,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_TIMESTAMP,
"Timestamps",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_TIMESTAMP,
dissect_tcpopt_timestamp
},
@ -3648,7 +3646,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_MPTCP,
"Multipath TCP",
NULL,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
TCPOLEN_MPTCP_MIN,
dissect_tcpopt_mptcp
},
@ -3656,7 +3654,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_CC,
"CC",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_CC,
dissect_tcpopt_cc
},
@ -3664,7 +3662,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_CCNEW,
"CC.NEW",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_CCNEW,
dissect_tcpopt_cc
},
@ -3672,7 +3670,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_CCECHO,
"CC.ECHO",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_CCECHO,
dissect_tcpopt_cc
},
@ -3680,7 +3678,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_MD5,
"TCP MD5 signature",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_MD5,
NULL
},
@ -3688,7 +3686,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_SCPS,
"SCPS capabilities",
&ett_tcp_option_scps,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
TCPOLEN_SCPS,
dissect_tcpopt_scps
},
@ -3696,7 +3694,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_SNACK,
"Selective Negative Acknowledgment",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_SNACK,
dissect_tcpopt_snack
},
@ -3704,7 +3702,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_RECBOUND,
"SCPS record boundary",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_RECBOUND,
NULL
},
@ -3712,7 +3710,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_CORREXP,
"SCPS corruption experienced",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_CORREXP,
NULL
},
@ -3720,7 +3718,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_QS,
"Quick-Start",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_QS,
dissect_tcpopt_qs
},
@ -3728,7 +3726,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_USER_TO,
"User Timeout",
&ett_tcp_option_user_to,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_USER_TO,
dissect_tcpopt_user_to
},
@ -3736,7 +3734,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_RVBD_PROBE,
"Riverbed Probe",
NULL,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
TCPOLEN_RVBD_PROBE_MIN,
dissect_tcpopt_rvbd_probe
},
@ -3744,7 +3742,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_RVBD_TRPY,
"Riverbed Transparency",
NULL,
FIXED_LENGTH,
OPT_LEN_FIXED_LENGTH,
TCPOLEN_RVBD_TRPY_MIN,
dissect_tcpopt_rvbd_trpy
},
@ -3752,7 +3750,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_EXP_FD,
"Experimental",
NULL,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
TCPOLEN_EXP_MIN,
dissect_tcpopt_exp
},
@ -3760,7 +3758,7 @@ static const ip_tcp_opt tcpopts[] = {
TCPOPT_EXP_FE,
"Experimental",
NULL,
VARIABLE_LENGTH,
OPT_LEN_VARIABLE_LENGTH,
TCPOLEN_EXP_MIN,
dissect_tcpopt_exp
}

View File

@ -30,18 +30,18 @@
*/
typedef enum {
NO_LENGTH, /**< option has no data, hence no length */
FIXED_LENGTH, /**< option always has the same length */
VARIABLE_LENGTH /**< option is variable-length - optlen is minimum */
OPT_LEN_NO_LENGTH, /**< option has no data, hence no length */
OPT_LEN_FIXED_LENGTH, /**< option always has the same length */
OPT_LEN_VARIABLE_LENGTH /**< option is variable-length - optlen is minimum */
} opt_len_type;
/** Member of table of IP or TCP options. */
typedef struct ip_tcp_opt {
int optcode; /**< code for option */
const char *name; /**< name of option */
int *subtree_index; /**< pointer to subtree index for option */
opt_len_type len_type; /**< type of option length field */
int optlen; /**< value length should be (minimum if VARIABLE) */
int optcode; /**< code for option */
const char *name; /**< name of option */
int *subtree_index; /**< pointer to subtree index for option */
opt_len_type len_type; /**< type of option length field */
int optlen; /**< value length should be (minimum if VARIABLE) */
void (*dissect)(const struct ip_tcp_opt *,
tvbuff_t *,
int,
@ -63,31 +63,7 @@ extern void dissect_ip_tcp_options(tvbuff_t *, int, guint,
#define QS_RATE_REQUEST 0
#define QS_RATE_REPORT 8
static const value_string qs_func_vals[] = {
{QS_RATE_REQUEST, "Rate request"},
{QS_RATE_REPORT, "Rate report"},
{0, NULL}
};
static const value_string qs_rate_vals[] = {
{ 0, "0 bit/s"},
{ 1, "80 Kbit/s"},
{ 2, "160 Kbit/s"},
{ 3, "320 Kbit/s"},
{ 4, "640 Kbit/s"},
{ 5, "1.28 Mbit/s"},
{ 6, "2.56 Mbit/s"},
{ 7, "5.12 Mbit/s"},
{ 8, "10.24 Mbit/s"},
{ 9, "20.48 Mbit/s"},
{10, "40.96 Mbit/s"},
{11, "81.92 Mbit/s"},
{12, "163.84 Mbit/s"},
{13, "327.68 Mbit/s"},
{14, "655.36 Mbit/s"},
{15, "1.31072 Gbit/s"},
{0, NULL}
};
WS_VAR_IMPORT const value_string qs_func_vals[];
WS_VAR_IMPORT value_string_ext qs_rate_vals_ext;
#endif