Handle XNS IDP socket numbers.

Handle SMB-over-SPP.

svn path=/trunk/; revision=13635
This commit is contained in:
Guy Harris 2005-03-06 20:13:58 +00:00
parent e27279e14d
commit e41c4740c9
6 changed files with 48 additions and 7 deletions

View File

@ -113,7 +113,8 @@ typedef enum {
PT_NCP, /* NCP connection */
PT_EXCHG, /* Fibre Channel exchange */
PT_DDP, /* DDP AppleTalk connection */
PT_SBCCS /* FICON */
PT_SBCCS, /* FICON */
PT_IDP /* XNS IDP sockets */
} port_type;
/* Types of circuit IDs Ethereal knows about. */

View File

@ -719,6 +719,17 @@ col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
case PT_IDP:
/* XXX - resolve IDP socket numbers */
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
if (is_src)
strcpy(pinfo->cinfo->col_expr[col], "idp.src.socket");
else
strcpy(pinfo->cinfo->col_expr[col], "idp.dst.socket");
snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
default:
break;
}

View File

@ -109,15 +109,21 @@ dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
type = tvb_get_guint8(tvb, 5);
proto_tree_add_uint(idp_tree, hf_idp_packet_type, tvb, 5, 1, type);
pinfo->ptype = PT_IDP;
/* Destination */
proto_tree_add_item(idp_tree, hf_idp_dnet, tvb, 6, 4, FALSE);
proto_tree_add_item(idp_tree, hf_idp_dnode, tvb, 10, 6, FALSE);
proto_tree_add_item(idp_tree, hf_idp_dsocket, tvb, 16, 2, FALSE);
pinfo->destport = tvb_get_ntohs(tvb, 16);
proto_tree_add_uint(idp_tree, hf_idp_dsocket, tvb, 16, 2,
pinfo->destport);
/* Source */
proto_tree_add_item(idp_tree, hf_idp_snet, tvb, 18, 4, FALSE);
proto_tree_add_item(idp_tree, hf_idp_snode, tvb, 22, 6, FALSE);
proto_tree_add_item(idp_tree, hf_idp_ssocket, tvb, 28, 2, FALSE);
pinfo->srcport = tvb_get_ntohs(tvb, 28);
proto_tree_add_uint(idp_tree, hf_idp_ssocket, tvb, 28, 2,
pinfo->srcport);
/* Make the next tvbuff */
next_tvb = tvb_new_subset(tvb, IDP_HEADER_LEN, -1, -1);

View File

@ -44,6 +44,7 @@
#include <epan/reassemble.h>
#include <epan/tap.h>
#include "packet-ipx.h"
#include "packet-idp.h"
#include "packet-windows-common.h"
#include "packet-smb-common.h"
@ -17306,4 +17307,5 @@ proto_reg_handoff_smb(void)
dissector_add("ipx.socket", IPX_SOCKET_NWLINK_SMB_REDIR, smb_handle);
dissector_add("ipx.socket", IPX_SOCKET_NWLINK_SMB_MESSENGER,
smb_handle);
dissector_add("spp.socket", IDP_SOCKET_SMB, smb_handle);
}

View File

@ -1,6 +1,6 @@
/* packet-spp.c
* Routines for XNS SPP
* Based on the Netware SPP dissector by Gilbert Ramirez <gram@alumni.rice.edu>
* Based on the Netware SPX dissector by Gilbert Ramirez <gram@alumni.rice.edu>
*
* $Id$
*
@ -50,6 +50,8 @@ static gint ett_spp_connctrl = -1;
static dissector_handle_t data_handle;
static dissector_table_t spp_socket_dissector_table;
/*
* See
*
@ -123,6 +125,7 @@ dissect_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
const char *datastream_type_string;
guint16 spp_seq;
const char *spp_msg_string;
guint16 low_socket, high_socket;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPP");
@ -185,7 +188,21 @@ dissect_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (tvb_reported_length_remaining(tvb, SPP_HEADER_LEN) > 0) {
if (pinfo->srcport > pinfo->destport) {
low_socket = pinfo->destport;
high_socket = pinfo->srcport;
} else {
low_socket = pinfo->srcport;
high_socket = pinfo->destport;
}
next_tvb = tvb_new_subset(tvb, SPP_HEADER_LEN, -1, -1);
if (dissector_try_port(spp_socket_dissector_table, low_socket,
next_tvb, pinfo, tree))
return;
if (dissector_try_port(spp_socket_dissector_table, high_socket,
next_tvb, pinfo, tree))
return;
call_dissector(data_handle, next_tvb, pinfo, tree);
}
}
@ -265,6 +282,9 @@ proto_register_spp(void)
"SPP", "spp");
proto_register_field_array(proto_spp, hf_spp, array_length(hf_spp));
proto_register_subtree_array(ett, array_length(ett));
spp_socket_dissector_table = register_dissector_table("spp.socket",
"SPP socket", FT_UINT16, BASE_HEX);
}
void

View File

@ -39,9 +39,10 @@ static const gchar* port_type_to_str (port_type type) {
case PT_UDP: return "UDP";
case PT_IPX: return "IPX";
case PT_NCP: return "NCP";
case PT_EXCHG: return "FC EXCHG";
case PT_DDP: return "DDP";
case PT_SBCCS: return "FICON SBCCS";
case PT_EXCHG: return "FC EXCHG";
case PT_DDP: return "DDP";
case PT_SBCCS: return "FICON SBCCS";
case PT_IDp: return "IDP";
}
g_assert_not_reached();