diff options
Diffstat (limited to 'epan/dissectors/packet-ipx.c')
-rw-r--r-- | epan/dissectors/packet-ipx.c | 204 |
1 files changed, 104 insertions, 100 deletions
diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c index a2e67f72c7..ddbb8e3816 100644 --- a/epan/dissectors/packet-ipx.c +++ b/epan/dissectors/packet-ipx.c @@ -32,7 +32,7 @@ void proto_register_ipx(void); void proto_reg_handoff_ipx(void); -static int ipx_tap = -1; +static int ipx_tap; /* The information in this module (IPX, SPX, NCP) comes from: NetWare LAN Analysis, Second Edition @@ -45,88 +45,92 @@ static int ipx_tap = -1; */ -static int proto_ipx = -1; -static int hf_ipx_checksum = -1; -static int hf_ipx_len = -1; -static int hf_ipx_src = -1; -static int hf_ipx_dst = -1; -static int hf_ipx_addr = -1; -static int hf_ipx_hops = -1; -static int hf_ipx_packet_type = -1; -static int hf_ipx_dnet = -1; -static int hf_ipx_dnode = -1; -static int hf_ipx_dsocket = -1; -static int hf_ipx_snet = -1; -static int hf_ipx_snode = -1; -static int hf_ipx_ssocket = -1; -static int hf_ipx_net = -1; -static int hf_ipx_node = -1; -static int hf_ipx_socket = -1; - -static gint ett_ipx = -1; +static int proto_ipx; +static int hf_ipx_checksum; +static int hf_ipx_len; +static int hf_ipx_src; +static int hf_ipx_dst; +static int hf_ipx_addr; +static int hf_ipx_hops; +static int hf_ipx_packet_type; +static int hf_ipx_dnet; +static int hf_ipx_dnode; +static int hf_ipx_dsocket; +static int hf_ipx_snet; +static int hf_ipx_snode; +static int hf_ipx_ssocket; +static int hf_ipx_net; +static int hf_ipx_node; +static int hf_ipx_socket; + +static gint ett_ipx; static dissector_table_t ipx_type_dissector_table; static dissector_table_t ipx_socket_dissector_table; static dissector_table_t spx_socket_dissector_table; static dissector_handle_t ipx_handle; static dissector_handle_t ipxsap_handle; - -static int proto_spx = -1; -static int hf_spx_connection_control = -1; -static int hf_spx_connection_control_sys = -1; -static int hf_spx_connection_control_send_ack = -1; -static int hf_spx_connection_control_attn = -1; -static int hf_spx_connection_control_eom = -1; -static int hf_spx_connection_control_v2 = -1; -static int hf_spx_connection_control_neg_size = -1; -static int hf_spx_connection_control_reserved = -1; -static int hf_spx_connection_control_ext_header = -1; -static int hf_spx_datastream_type = -1; -static int hf_spx_src_id = -1; -static int hf_spx_dst_id = -1; -static int hf_spx_seq_nr = -1; -static int hf_spx_ack_nr = -1; -static int hf_spx_all_nr = -1; -static int hf_spx_neg_size = -1; -static int hf_spx_rexmt_frame = -1; -static int hf_spx_rexmt_data = -1; - -static gint ett_spx = -1; -static gint ett_spx_connctrl = -1; - -static int proto_ipxrip = -1; -static int hf_ipxrip_request = -1; -static int hf_ipxrip_response = -1; -static int hf_ipxrip_packet_type = -1; -static int hf_ipxrip_route_vector = -1; -static int hf_ipxrip_hops = -1; -static int hf_ipxrip_ticks = -1; - -static gint ett_ipxrip = -1; - -static int proto_serialization = -1; -static int hf_serial_number = -1; -static gint ett_serialization = -1; - -static int proto_sap = -1; -static int hf_sap_request = -1; -static int hf_sap_response = -1; -static int hf_sap_packet_type = -1; -static int hf_sap_server = -1; -static int hf_sap_server_type = -1; -static int hf_sap_server_name = -1; -static int hf_sap_server_network = -1; -static int hf_sap_server_node = -1; -static int hf_sap_server_socket = -1; -static int hf_sap_server_intermediate_networks = -1; - -static gint ett_ipxsap = -1; -static gint ett_ipxsap_server = -1; - -static gint ett_ipxmsg = -1; -static int proto_ipxmsg = -1; -static int hf_msg_conn = -1; -static int hf_msg_sigchar = -1; +static dissector_handle_t spx_handle; +static dissector_handle_t ipxrip_handle; +static dissector_handle_t serialization_handle; +static dissector_handle_t ipxmsg_handle; + +static int proto_spx; +static int hf_spx_connection_control; +static int hf_spx_connection_control_sys; +static int hf_spx_connection_control_send_ack; +static int hf_spx_connection_control_attn; +static int hf_spx_connection_control_eom; +static int hf_spx_connection_control_v2; +static int hf_spx_connection_control_neg_size; +static int hf_spx_connection_control_reserved; +static int hf_spx_connection_control_ext_header; +static int hf_spx_datastream_type; +static int hf_spx_src_id; +static int hf_spx_dst_id; +static int hf_spx_seq_nr; +static int hf_spx_ack_nr; +static int hf_spx_all_nr; +static int hf_spx_neg_size; +static int hf_spx_rexmt_frame; +static int hf_spx_rexmt_data; + +static gint ett_spx; +static gint ett_spx_connctrl; + +static int proto_ipxrip; +static int hf_ipxrip_request; +static int hf_ipxrip_response; +static int hf_ipxrip_packet_type; +static int hf_ipxrip_route_vector; +static int hf_ipxrip_hops; +static int hf_ipxrip_ticks; + +static gint ett_ipxrip; + +static int proto_serialization; +static int hf_serial_number; +static gint ett_serialization; + +static int proto_sap; +static int hf_sap_request; +static int hf_sap_response; +static int hf_sap_packet_type; +static int hf_sap_server; +static int hf_sap_server_type; +static int hf_sap_server_name; +static int hf_sap_server_network; +static int hf_sap_server_node; +static int hf_sap_server_socket; +static int hf_sap_server_intermediate_networks; + +static gint ett_ipxsap; +static gint ett_ipxsap_server; + +static gint ett_ipxmsg; +static int proto_ipxmsg; +static int hf_msg_conn; +static int hf_msg_sigchar; #define UDP_PORT_IPX 213 /* RFC 1234 */ @@ -149,37 +153,41 @@ static const char* ipx_conv_get_filter_type(conv_item_t* conv, conv_filter_type_ static ct_dissector_info_t ipx_ct_dissector_info = {&ipx_conv_get_filter_type}; static tap_packet_status -ipx_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) +ipx_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip, tap_flags_t flags) { conv_hash_t *hash = (conv_hash_t*) pct; + hash->flags = flags; + const ipxhdr_t *ipxh=(const ipxhdr_t *)vip; - add_conversation_table_data(hash, &ipxh->ipx_src, &ipxh->ipx_dst, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->abs_ts, &ipx_ct_dissector_info, ENDPOINT_NONE); + add_conversation_table_data(hash, &ipxh->ipx_src, &ipxh->ipx_dst, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->abs_ts, &ipx_ct_dissector_info, CONVERSATION_NONE); return TAP_PACKET_REDRAW; } -static const char* ipx_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter) +static const char* ipx_endpoint_get_filter_type(endpoint_item_t* endpoint, conv_filter_type_e filter) { - if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_IPX)) + if ((filter == CONV_FT_ANY_ADDRESS) && (endpoint->myaddress.type == AT_IPX)) return "ipx.addr"; return CONV_FILTER_INVALID; } -static hostlist_dissector_info_t ipx_host_dissector_info = {&ipx_host_get_filter_type}; +static et_dissector_info_t ipx_endpoint_dissector_info = {&ipx_endpoint_get_filter_type}; static tap_packet_status -ipx_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) +ipx_endpoint_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip, tap_flags_t flags) { conv_hash_t *hash = (conv_hash_t*) pit; + hash->flags = flags; + const ipxhdr_t *ipxh=(const ipxhdr_t *)vip; /* Take two "add" passes per packet, adding for each direction, ensures that all packets are counted properly (even if address is sending to itself) - XXX - this could probably be done more efficiently inside hostlist_table */ - add_hostlist_table_data(hash, &ipxh->ipx_src, 0, TRUE, 1, pinfo->fd->pkt_len, &ipx_host_dissector_info, ENDPOINT_NONE); - add_hostlist_table_data(hash, &ipxh->ipx_dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ipx_host_dissector_info, ENDPOINT_NONE); + XXX - this could probably be done more efficiently inside endpoint_table */ + add_endpoint_table_data(hash, &ipxh->ipx_src, 0, TRUE, 1, pinfo->fd->pkt_len, &ipx_endpoint_dissector_info, ENDPOINT_NONE); + add_endpoint_table_data(hash, &ipxh->ipx_dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ipx_endpoint_dissector_info, ENDPOINT_NONE); return TAP_PACKET_REDRAW; } @@ -669,7 +677,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) * SPX session using that source port; can that happen? If so, * we should probably use the direction, as well as the conversation, * as part of the hash key; if we do that, we can probably just - * use ENDPOINT_IPX as the port type, and possibly get rid of ENDPOINT_NCP. + * use CONVERSATION_IPX as the port type, and possibly get rid of CONVERSATION_NCP. * * According to * @@ -694,7 +702,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) */ if (!pinfo->fd->visited) { conversation = find_conversation(pinfo->num, &pinfo->src, - &pinfo->dst, ENDPOINT_NCP, pinfo->srcport, + &pinfo->dst, CONVERSATION_NCP, pinfo->srcport, pinfo->srcport, 0); if (conversation == NULL) { /* @@ -702,7 +710,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) * a new one. */ conversation = conversation_new(pinfo->num, &pinfo->src, - &pinfo->dst, ENDPOINT_NCP, pinfo->srcport, + &pinfo->dst, CONVERSATION_NCP, pinfo->srcport, pinfo->srcport, 0); } @@ -1337,7 +1345,7 @@ proto_register_ipx(void) static hf_register_info hf_spx[] = { { &hf_spx_connection_control, { "Connection Control", "spx.ctl", - FT_UINT8, BASE_HEX, VALS(conn_vals), 0xF0, + FT_UINT8, BASE_HEX, VALS(conn_vals), 0x0, NULL, HFILL }}, { &hf_spx_connection_control_sys, @@ -1543,24 +1551,28 @@ proto_register_ipx(void) proto_ipx = proto_register_protocol("Internetwork Packet eXchange", "IPX", "ipx"); proto_register_field_array(proto_ipx, hf_ipx, array_length(hf_ipx)); - ipx_handle = register_dissector("ipx", dissect_ipx, proto_ipx); proto_spx = proto_register_protocol("Sequenced Packet eXchange", "SPX", "spx"); proto_register_field_array(proto_spx, hf_spx, array_length(hf_spx)); + spx_handle = register_dissector("spx", dissect_spx, proto_spx); proto_ipxrip = proto_register_protocol("IPX Routing Information Protocol", "IPX RIP", "ipxrip"); proto_register_field_array(proto_ipxrip, hf_ipxrip, array_length(hf_ipxrip)); + ipxrip_handle = register_dissector("ipxrip", dissect_ipxrip, proto_ipxrip); proto_serialization = proto_register_protocol("NetWare Serialization Protocol", "NW_SERIAL", "nw_serial"); proto_register_field_array(proto_serialization, hf_serial, array_length(hf_serial)); + serialization_handle = register_dissector("nw_serial", dissect_serialization, + proto_serialization); proto_ipxmsg = proto_register_protocol("IPX Message", "IPX MSG", "ipxmsg"); proto_register_field_array(proto_ipxmsg, hf_ipxmsg, array_length(hf_ipxmsg)); + ipxmsg_handle = register_dissector("ipxmsg", dissect_ipxmsg, proto_ipxmsg); proto_sap = proto_register_protocol("Service Advertisement Protocol", "IPX SAP", "ipxsap"); @@ -1580,7 +1592,7 @@ proto_register_ipx(void) spx_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), spx_hash_func, spx_equal); ipx_tap=register_tap("ipx"); - register_conversation_table(proto_ipx, TRUE, ipx_conversation_packet, ipx_hostlist_packet); + register_conversation_table(proto_ipx, TRUE, ipx_conversation_packet, ipx_endpoint_packet); register_capture_dissector("ipx", capture_ipx, proto_ipx); } @@ -1588,9 +1600,6 @@ proto_register_ipx(void) void proto_reg_handoff_ipx(void) { - dissector_handle_t spx_handle; - dissector_handle_t ipxrip_handle; - dissector_handle_t serialization_handle, ipxmsg_handle; capture_dissector_handle_t ipx_cap_handle; dissector_add_uint_with_preference("udp.port", UDP_PORT_IPX, ipx_handle); @@ -1605,20 +1614,15 @@ proto_reg_handoff_ipx(void) dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_IPX, ipx_handle); dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_NOVELL_EC, ipx_handle); - spx_handle = create_dissector_handle(dissect_spx, proto_spx); dissector_add_uint("ipx.packet_type", IPX_PACKET_TYPE_SPX, spx_handle); dissector_add_uint("ipx.socket", IPX_SOCKET_SAP, ipxsap_handle); - ipxrip_handle = create_dissector_handle(dissect_ipxrip, proto_ipxrip); dissector_add_uint("ipx.socket", IPX_SOCKET_IPXRIP, ipxrip_handle); - serialization_handle = create_dissector_handle(dissect_serialization, - proto_serialization); dissector_add_uint("ipx.socket", IPX_SOCKET_SERIALIZATION, serialization_handle); - ipxmsg_handle = create_dissector_handle(dissect_ipxmsg, proto_ipxmsg); dissector_add_uint("ipx.socket", IPX_SOCKET_IPX_MESSAGE, ipxmsg_handle); dissector_add_uint("ipx.socket", IPX_SOCKET_IPX_MESSAGE1, ipxmsg_handle); |