diff options
Diffstat (limited to 'epan/dissectors/packet-rpcap.c')
-rw-r--r-- | epan/dissectors/packet-rpcap.c | 432 |
1 files changed, 216 insertions, 216 deletions
diff --git a/epan/dissectors/packet-rpcap.c b/epan/dissectors/packet-rpcap.c index 1c86babc..250868b9 100644 --- a/epan/dissectors/packet-rpcap.c +++ b/epan/dissectors/packet-rpcap.c @@ -85,143 +85,143 @@ void proto_register_rpcap (void); void proto_reg_handoff_rpcap (void); -static int proto_rpcap = -1; - -static int hf_version = -1; -static int hf_type = -1; -static int hf_value = -1; -static int hf_plen = -1; - -static int hf_error = -1; -static int hf_error_value = -1; - -static int hf_packet = -1; -static int hf_timestamp = -1; -static int hf_caplen = -1; -static int hf_len = -1; -static int hf_npkt = -1; - -static int hf_auth_request = -1; -static int hf_auth_type = -1; -static int hf_auth_slen1 = -1; -static int hf_auth_slen2 = -1; -static int hf_auth_username = -1; -static int hf_auth_password = -1; - -static int hf_auth_reply = -1; -static int hf_auth_minvers = -1; -static int hf_auth_maxvers = -1; - -static int hf_open_request = -1; - -static int hf_open_reply = -1; -static int hf_linktype = -1; -static int hf_tzoff = -1; - -static int hf_startcap_request = -1; -static int hf_snaplen = -1; -static int hf_read_timeout = -1; -static int hf_flags = -1; -static int hf_flags_promisc = -1; -static int hf_flags_dgram = -1; -static int hf_flags_serveropen = -1; -static int hf_flags_inbound = -1; -static int hf_flags_outbound = -1; -static int hf_client_port = -1; -static int hf_startcap_reply = -1; -static int hf_bufsize = -1; -static int hf_server_port = -1; -static int hf_dummy = -1; - -static int hf_filter = -1; -static int hf_filtertype = -1; -static int hf_nitems = -1; - -static int hf_filterbpf_insn = -1; -static int hf_code = -1; -static int hf_code_class = -1; -static int hf_code_fields = -1; -static int hf_code_ld_size = -1; -static int hf_code_ld_mode = -1; -static int hf_code_alu_op = -1; -static int hf_code_jmp_op = -1; -static int hf_code_src = -1; -static int hf_code_rval = -1; -static int hf_code_misc_op = -1; -static int hf_jt = -1; -static int hf_jf = -1; -static int hf_instr_value = -1; - -static int hf_stats_reply = -1; -static int hf_ifrecv = -1; -static int hf_ifdrop = -1; -static int hf_krnldrop = -1; -static int hf_srvcapt = -1; - -static int hf_findalldevs_reply = -1; -static int hf_findalldevs_if = -1; -static int hf_namelen = -1; -static int hf_desclen = -1; -static int hf_if_flags = -1; -static int hf_naddr = -1; -static int hf_if_name = -1; -static int hf_if_desc = -1; - -static int hf_findalldevs_ifaddr = -1; -static int hf_if_addr = -1; -static int hf_if_netmask = -1; -static int hf_if_broadaddr = -1; -static int hf_if_dstaddr = -1; -static int hf_if_af = -1; -static int hf_if_port = -1; -static int hf_if_ipv4 = -1; -static int hf_if_flowinfo = -1; -static int hf_if_ipv6 = -1; -static int hf_if_scopeid = -1; -static int hf_if_padding = -1; -static int hf_if_unknown = -1; - -static int hf_sampling_request = -1; -static int hf_sampling_method = -1; -static int hf_sampling_dummy1 = -1; -static int hf_sampling_dummy2 = -1; -static int hf_sampling_value = -1; - -static gint ett_rpcap = -1; -static gint ett_error = -1; -static gint ett_packet = -1; -static gint ett_auth_request = -1; -static gint ett_auth_reply = -1; -static gint ett_open_reply = -1; -static gint ett_startcap_request = -1; -static gint ett_startcap_reply = -1; -static gint ett_startcap_flags = -1; -static gint ett_filter = -1; -static gint ett_filterbpf_insn = -1; -static gint ett_filterbpf_insn_code = -1; -static gint ett_stats_reply = -1; -static gint ett_findalldevs_reply = -1; -static gint ett_findalldevs_if = -1; -static gint ett_findalldevs_ifaddr = -1; -static gint ett_ifaddr = -1; -static gint ett_sampling_request = -1; - -static expert_field ei_error = EI_INIT; -static expert_field ei_if_unknown = EI_INIT; -static expert_field ei_no_more_data = EI_INIT; -static expert_field ei_caplen_too_big = EI_INIT; +static int proto_rpcap; + +static int hf_version; +static int hf_type; +static int hf_value; +static int hf_plen; + +static int hf_error; +static int hf_error_value; + +static int hf_packet; +static int hf_timestamp; +static int hf_caplen; +static int hf_len; +static int hf_npkt; + +static int hf_auth_request; +static int hf_auth_type; +static int hf_auth_slen1; +static int hf_auth_slen2; +static int hf_auth_username; +static int hf_auth_password; + +static int hf_auth_reply; +static int hf_auth_minvers; +static int hf_auth_maxvers; + +static int hf_open_request; + +static int hf_open_reply; +static int hf_linktype; +static int hf_tzoff; + +static int hf_startcap_request; +static int hf_snaplen; +static int hf_read_timeout; +static int hf_flags; +static int hf_flags_promisc; +static int hf_flags_dgram; +static int hf_flags_serveropen; +static int hf_flags_inbound; +static int hf_flags_outbound; +static int hf_client_port; +static int hf_startcap_reply; +static int hf_bufsize; +static int hf_server_port; +static int hf_dummy; + +static int hf_filter; +static int hf_filtertype; +static int hf_nitems; + +static int hf_filterbpf_insn; +static int hf_code; +static int hf_code_class; +static int hf_code_fields; +static int hf_code_ld_size; +static int hf_code_ld_mode; +static int hf_code_alu_op; +static int hf_code_jmp_op; +static int hf_code_src; +static int hf_code_rval; +static int hf_code_misc_op; +static int hf_jt; +static int hf_jf; +static int hf_instr_value; + +static int hf_stats_reply; +static int hf_ifrecv; +static int hf_ifdrop; +static int hf_krnldrop; +static int hf_srvcapt; + +static int hf_findalldevs_reply; +static int hf_findalldevs_if; +static int hf_namelen; +static int hf_desclen; +static int hf_if_flags; +static int hf_naddr; +static int hf_if_name; +static int hf_if_desc; + +static int hf_findalldevs_ifaddr; +static int hf_if_addr; +static int hf_if_netmask; +static int hf_if_broadaddr; +static int hf_if_dstaddr; +static int hf_if_af; +static int hf_if_port; +static int hf_if_ipv4; +static int hf_if_flowinfo; +static int hf_if_ipv6; +static int hf_if_scopeid; +static int hf_if_padding; +static int hf_if_unknown; + +static int hf_sampling_request; +static int hf_sampling_method; +static int hf_sampling_dummy1; +static int hf_sampling_dummy2; +static int hf_sampling_value; + +static int ett_rpcap; +static int ett_error; +static int ett_packet; +static int ett_auth_request; +static int ett_auth_reply; +static int ett_open_reply; +static int ett_startcap_request; +static int ett_startcap_reply; +static int ett_startcap_flags; +static int ett_filter; +static int ett_filterbpf_insn; +static int ett_filterbpf_insn_code; +static int ett_stats_reply; +static int ett_findalldevs_reply; +static int ett_findalldevs_if; +static int ett_findalldevs_ifaddr; +static int ett_ifaddr; +static int ett_sampling_request; + +static expert_field ei_error; +static expert_field ei_if_unknown; +static expert_field ei_no_more_data; +static expert_field ei_caplen_too_big; static dissector_handle_t pcap_pktdata_handle; static dissector_handle_t rpcap_tcp_handle; /* User definable values */ -static gboolean rpcap_desegment = TRUE; -static gboolean decode_content = TRUE; +static bool rpcap_desegment = true; +static bool decode_content = true; static int global_linktype = -1; /* Global variables */ static int linktype = -1; -static gboolean info_added = FALSE; +static bool info_added; static const value_string message_type[] = { { RPCAP_MSG_ERROR, "Error" }, @@ -353,16 +353,16 @@ static const value_string bpf_misc_op[] = { static void rpcap_frame_end (void) { - info_added = FALSE; + info_added = false; } static void dissect_rpcap_error (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_item *ti; - gint len; + int len; char *str; len = tvb_reported_length_remaining (tvb, offset); @@ -471,17 +471,17 @@ static const value_string address_family[] = { { 0, NULL } }; -static gint +static int dissect_rpcap_ifaddr (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, gint offset, int hf_id, + proto_tree *parent_tree, int offset, int hf_id, proto_item *parent_item) { proto_tree *tree; proto_item *ti; - guint16 af; - guint32 ipv4; + uint16_t af; + ws_in4_addr ipv4; ws_in6_addr ipv6; - gchar ipaddr[MAX_ADDR_STR_LEN]; + char ipaddr[MAX_ADDR_STR_LEN]; ti = proto_tree_add_item (parent_tree, hf_id, tvb, offset, 128, ENC_BIG_ENDIAN); tree = proto_item_add_subtree (ti, ett_ifaddr); @@ -499,7 +499,7 @@ dissect_rpcap_ifaddr (tvbuff_t *tvb, packet_info *pinfo, offset += 2; ipv4 = tvb_get_ipv4 (tvb, offset); - ip_to_str_buf((guint8 *)&ipv4, ipaddr, MAX_ADDR_STR_LEN); + ip_addr_to_str_buf(&ipv4, ipaddr, MAX_ADDR_STR_LEN); proto_item_append_text (ti, ": %s", ipaddr); if (parent_item) { proto_item_append_text (parent_item, ": %s", ipaddr); @@ -556,13 +556,13 @@ dissect_rpcap_ifaddr (tvbuff_t *tvb, packet_info *pinfo, } -static gint +static int dissect_rpcap_findalldevs_ifaddr (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; - gint boffset = offset; + int boffset = offset; ti = proto_tree_add_item (parent_tree, hf_findalldevs_ifaddr, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_findalldevs_ifaddr); @@ -578,14 +578,14 @@ dissect_rpcap_findalldevs_ifaddr (tvbuff_t *tvb, packet_info *pinfo _U_, } -static gint +static int dissect_rpcap_findalldevs_if (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; - guint16 namelen, desclen, naddr, i; - gint boffset = offset; + uint16_t namelen, desclen, naddr, i; + int boffset = offset; ti = proto_tree_add_item (parent_tree, hf_findalldevs_if, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_findalldevs_if); @@ -609,7 +609,7 @@ dissect_rpcap_findalldevs_if (tvbuff_t *tvb, packet_info *pinfo _U_, offset += 2; if (namelen) { - const guint8* name; + const uint8_t* name; proto_tree_add_item_ret_string(tree, hf_if_name, tvb, offset, namelen, ENC_ASCII|ENC_NA, pinfo->pool, &name); proto_item_append_text (ti, ": %s", name); offset += namelen; @@ -637,11 +637,11 @@ dissect_rpcap_findalldevs_if (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_findalldevs_reply (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset, guint16 no_devs) + proto_tree *parent_tree, int offset, uint16_t no_devs) { proto_tree *tree; proto_item *ti; - guint16 i; + uint16_t i; ti = proto_tree_add_item (parent_tree, hf_findalldevs_reply, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_findalldevs_reply); @@ -659,13 +659,13 @@ dissect_rpcap_findalldevs_reply (tvbuff_t *tvb, packet_info *pinfo _U_, } -static gint +static int dissect_rpcap_filterbpf_insn (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree, *code_tree; proto_item *ti, *code_ti; - guint8 inst_class; + uint8_t inst_class; ti = proto_tree_add_item (parent_tree, hf_filterbpf_insn, tvb, offset, 8, ENC_NA); tree = proto_item_add_subtree (ti, ett_filterbpf_insn); @@ -673,7 +673,7 @@ dissect_rpcap_filterbpf_insn (tvbuff_t *tvb, packet_info *pinfo _U_, code_ti = proto_tree_add_item (tree, hf_code, tvb, offset, 2, ENC_BIG_ENDIAN); code_tree = proto_item_add_subtree (code_ti, ett_filterbpf_insn_code); proto_tree_add_item (code_tree, hf_code_class, tvb, offset, 2, ENC_BIG_ENDIAN); - inst_class = tvb_get_guint8 (tvb, offset + 1) & 0x07; + inst_class = tvb_get_uint8 (tvb, offset + 1) & 0x07; proto_item_append_text (ti, ": %s", val_to_str_const (inst_class, bpf_class, "")); switch (inst_class) { case 0x00: /* ld */ @@ -716,11 +716,11 @@ dissect_rpcap_filterbpf_insn (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_filter (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; - guint32 nitems, i; + uint32_t nitems, i; ti = proto_tree_add_item (parent_tree, hf_filter, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_filter); @@ -748,11 +748,11 @@ dissect_rpcap_filter (tvbuff_t *tvb, packet_info *pinfo, static int dissect_rpcap_auth_request (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; - guint16 type, slen1, slen2; + uint16_t type, slen1, slen2; ti = proto_tree_add_item (parent_tree, hf_auth_request, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_auth_request); @@ -775,7 +775,7 @@ dissect_rpcap_auth_request (tvbuff_t *tvb, packet_info *pinfo _U_, if (type == RPCAP_RMTAUTH_NULL) { proto_item_append_text (ti, " (none)"); } else if (type == RPCAP_RMTAUTH_PWD) { - const guint8 *username, *password; + const uint8_t *username, *password; proto_tree_add_item_ret_string(tree, hf_auth_username, tvb, offset, slen1, ENC_ASCII|ENC_NA, pinfo->pool, &username); offset += slen1; @@ -791,11 +791,11 @@ dissect_rpcap_auth_request (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_auth_reply (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; - guint32 minvers, maxvers; + uint32_t minvers, maxvers; /* * Authentication replies from older servers have no payload. @@ -818,9 +818,9 @@ dissect_rpcap_auth_reply (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_open_request (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { - gint len; + int len; len = tvb_reported_length_remaining (tvb, offset); proto_tree_add_item (parent_tree, hf_open_request, tvb, offset, len, ENC_ASCII); @@ -829,7 +829,7 @@ dissect_rpcap_open_request (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_open_reply (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; @@ -847,11 +847,11 @@ dissect_rpcap_open_reply (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_startcap_request (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree, *field_tree; proto_item *ti, *field_ti; - guint16 flags; + uint16_t flags; ti = proto_tree_add_item (parent_tree, hf_startcap_request, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_startcap_request); @@ -872,7 +872,7 @@ dissect_rpcap_startcap_request (tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item (field_tree, hf_flags_outbound, tvb, offset, 2, ENC_BIG_ENDIAN); if (flags & 0x1F) { - gchar *flagstr = wmem_strdup_printf (pinfo->pool, "%s%s%s%s%s", + char *flagstr = wmem_strdup_printf (pinfo->pool, "%s%s%s%s%s", (flags & FLAG_PROMISC) ? ", Promiscuous" : "", (flags & FLAG_DGRAM) ? ", Datagram" : "", (flags & FLAG_SERVEROPEN) ? ", ServerOpen" : "", @@ -893,7 +893,7 @@ dissect_rpcap_startcap_request (tvbuff_t *tvb, packet_info *pinfo, static void dissect_rpcap_startcap_reply (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; @@ -913,7 +913,7 @@ dissect_rpcap_startcap_reply (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_stats_reply (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; @@ -936,17 +936,17 @@ dissect_rpcap_stats_reply (tvbuff_t *tvb, packet_info *pinfo _U_, static int dissect_rpcap_sampling_request (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *parent_tree, gint offset) + proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *ti; - guint32 value; - guint8 method; + uint32_t value; + uint8_t method; ti = proto_tree_add_item (parent_tree, hf_sampling_request, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_sampling_request); - method = tvb_get_guint8 (tvb, offset); + method = tvb_get_uint8 (tvb, offset); proto_tree_add_item (tree, hf_sampling_method, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -979,13 +979,13 @@ dissect_rpcap_sampling_request (tvbuff_t *tvb, packet_info *pinfo _U_, static void dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, - proto_tree *parent_tree, gint offset, proto_item *top_item) + proto_tree *parent_tree, int offset, proto_item *top_item) { proto_tree *tree; proto_item *ti; tvbuff_t *new_tvb; - guint caplen, len, frame_no; - gint reported_length_remaining; + unsigned caplen, len, frame_no; + int reported_length_remaining; ti = proto_tree_add_item (parent_tree, hf_packet, tvb, offset, 20, ENC_NA); tree = proto_item_add_subtree (ti, ett_packet); @@ -1013,7 +1013,7 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, * most right past the end of the available data in the packet. */ reported_length_remaining = tvb_reported_length_remaining (tvb, offset); - if (caplen > (guint)reported_length_remaining) { + if (caplen > (unsigned)reported_length_remaining) { expert_add_info(pinfo, ti, &ei_caplen_too_big); return; } @@ -1035,7 +1035,7 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, /* Indicate RPCAP in the info column */ col_prepend_fence_fstr (pinfo->cinfo, COL_INFO, "Remote | "); - info_added = TRUE; + info_added = true; register_frame_end_routine(pinfo, rpcap_frame_end); } } else { @@ -1053,9 +1053,9 @@ dissect_rpcap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, void* da proto_tree *tree; proto_item *ti; tvbuff_t *new_tvb; - gint len, offset = 0; - guint8 msg_type; - guint16 msg_value; + int len, offset = 0; + uint8_t msg_type; + uint16_t msg_value; col_set_str (pinfo->cinfo, COL_PROTOCOL, PSNAME); @@ -1067,7 +1067,7 @@ dissect_rpcap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, void* da proto_tree_add_item (tree, hf_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - msg_type = tvb_get_guint8 (tvb, offset); + msg_type = tvb_get_uint8 (tvb, offset); proto_tree_add_item (tree, hf_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -1141,32 +1141,32 @@ dissect_rpcap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, void* da } -static gboolean -check_rpcap_heur (tvbuff_t *tvb, gboolean tcp) +static bool +check_rpcap_heur (tvbuff_t *tvb, bool tcp) { - gint offset = 0; - guint8 version, msg_type; - guint16 msg_value; - guint32 plen, len, caplen; + int offset = 0; + uint8_t version, msg_type; + uint16_t msg_value; + uint32_t plen, len, caplen; if (tvb_captured_length (tvb) < 8) /* Too short */ - return FALSE; + return false; - version = tvb_get_guint8 (tvb, offset); + version = tvb_get_uint8 (tvb, offset); if (version != 0) /* Incorrect version */ - return FALSE; + return false; offset++; - msg_type = tvb_get_guint8 (tvb, offset); + msg_type = tvb_get_uint8 (tvb, offset); if (!tcp && msg_type != 7) { /* UDP is only used for packets */ - return FALSE; + return false; } if (try_val_to_str(msg_type, message_type) == NULL) /* Unknown message type */ - return FALSE; + return false; offset++; msg_value = tvb_get_ntohs (tvb, offset); @@ -1174,16 +1174,16 @@ check_rpcap_heur (tvbuff_t *tvb, gboolean tcp) if (msg_type == RPCAP_MSG_ERROR) { /* Must have a valid error code */ if (try_val_to_str(msg_value, error_codes) == NULL) - return FALSE; + return false; } else if (msg_type != RPCAP_MSG_FINDALLIF_REPLY) { - return FALSE; + return false; } } offset += 2; plen = tvb_get_ntohl (tvb, offset); offset += 4; - len = (guint32) tvb_reported_length_remaining (tvb, offset); + len = (uint32_t) tvb_reported_length_remaining (tvb, offset); switch (msg_type) { @@ -1196,7 +1196,7 @@ check_rpcap_heur (tvbuff_t *tvb, gboolean tcp) case RPCAP_MSG_ENDCAP_REPLY: /* Empty payload */ if (plen != 0 || len != 0) - return FALSE; + return false; break; case RPCAP_MSG_OPEN_REPLY: @@ -1204,25 +1204,25 @@ check_rpcap_heur (tvbuff_t *tvb, gboolean tcp) case RPCAP_MSG_SETSAMPLING_REQ: /* Always 8 bytes */ if (plen != 8 || len != 8) - return FALSE; + return false; break; case RPCAP_MSG_STATS_REPLY: /* Always 16 bytes */ if (plen != 16 || len != 16) - return FALSE; + return false; break; case RPCAP_MSG_PACKET: /* Must have the frame header */ if (plen < 20) - return FALSE; + return false; /* Check if capture length is valid */ caplen = tvb_get_ntohl (tvb, offset+8); /* Always 20 bytes less than packet length */ if (caplen != (plen - 20) || caplen > 65535) - return FALSE; + return false; break; case RPCAP_MSG_FINDALLIF_REPLY: @@ -1234,18 +1234,18 @@ check_rpcap_heur (tvbuff_t *tvb, gboolean tcp) case RPCAP_MSG_AUTH_REPLY: /* Variable length */ if (plen != len) - return FALSE; + return false; break; default: /* Unknown message type */ - return FALSE; + return false; } - return TRUE; + return true; } -static guint +static unsigned get_rpcap_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) { return tvb_get_ntohl (tvb, offset + 4) + 8; @@ -1260,10 +1260,10 @@ dissect_rpcap_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da return tvb_captured_length (tvb); } -static gboolean +static bool dissect_rpcap_heur_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (check_rpcap_heur (tvb, TRUE)) { + if (check_rpcap_heur (tvb, true)) { /* * This is probably a rpcap TCP packet. * Make the dissector for this conversation the non-heuristic @@ -1278,24 +1278,24 @@ dissect_rpcap_heur_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi tcp_dissect_pdus (tvb, pinfo, tree, rpcap_desegment, 8, get_rpcap_pdu_len, dissect_rpcap, data); - return TRUE; + return true; } - return FALSE; + return false; } -static gboolean +static bool dissect_rpcap_heur_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (check_rpcap_heur (tvb, FALSE)) { + if (check_rpcap_heur (tvb, false)) { /* This is probably a rpcap udp package */ dissect_rpcap (tvb, pinfo, tree, data); - return TRUE; + return true; } - return FALSE; + return false; } @@ -1504,7 +1504,7 @@ proto_register_rpcap (void) NULL, 0x0, "Statistics reply data", HFILL } }, { &hf_ifrecv, { "Received by kernel filter", "rpcap.ifrecv", FT_UINT32, BASE_DEC, - NULL, 0x0, "Received by kernel", HFILL } }, + NULL, 0x0, NULL, HFILL } }, { &hf_ifdrop, { "Dropped by network interface", "rpcap.ifdrop", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, @@ -1600,7 +1600,7 @@ proto_register_rpcap (void) NULL, 0x0, NULL, HFILL } }, }; - static gint *ett[] = { + static int *ett[] = { &ett_rpcap, &ett_error, &ett_packet, @@ -1665,17 +1665,17 @@ proto_register_rpcap (void) void proto_reg_handoff_rpcap (void) { - static gboolean rpcap_prefs_initialized = FALSE; + static bool rpcap_prefs_initialized = false; if (!rpcap_prefs_initialized) { pcap_pktdata_handle = find_dissector_add_dependency("pcap_pktdata", proto_rpcap); - rpcap_prefs_initialized = TRUE; + rpcap_prefs_initialized = true; heur_dissector_add ("tcp", dissect_rpcap_heur_tcp, "RPCAP over TCP", "rpcap_tcp", proto_rpcap, HEURISTIC_ENABLE); heur_dissector_add ("udp", dissect_rpcap_heur_udp, "RPCAP over UDP", "rpcap_udp", proto_rpcap, HEURISTIC_ENABLE); } - info_added = FALSE; + info_added = false; linktype = global_linktype; } |