forked from osmocom/wireshark
Pass struct aspinfo "private data" into subdissectors instead of using pinfo->private_data.
svn path=/trunk/; revision=52728
This commit is contained in:
parent
87c65ffc5b
commit
77837d2c9e
|
@ -4814,10 +4814,10 @@ dissect_reply_afp_spotlight(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
|
||||
|
||||
/* ************************** */
|
||||
static void
|
||||
dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
||||
{
|
||||
struct aspinfo *aspinfo = (struct aspinfo*)pinfo->private_data;
|
||||
struct aspinfo *aspinfo = (struct aspinfo*)data;
|
||||
proto_tree *afp_tree = NULL;
|
||||
proto_item *ti;
|
||||
conversation_t *conversation;
|
||||
|
@ -4863,7 +4863,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if (!request_val) { /* missing request */
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "[Reply without query?]");
|
||||
return;
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
afp_command = request_val->command;
|
||||
|
@ -4896,7 +4896,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
col_set_str(pinfo->cinfo, COL_INFO,
|
||||
"[Error!IP port reused, you need to split the capture file]");
|
||||
expert_add_info(pinfo, ti, &ei_afp_ip_port_reused);
|
||||
return;
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5103,7 +5103,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
case AFP_SPOTLIGHTRPC:
|
||||
offset = dissect_query_afp_spotlight(tvb, pinfo, afp_tree, offset, request_val);
|
||||
if (offset == -1)
|
||||
return; /* bogus spotlight RPC */
|
||||
return tvb_length(tvb); /* bogus spotlight RPC */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5140,7 +5140,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
if (!len) {
|
||||
/* for some calls if the reply is an error there's no data
|
||||
*/
|
||||
return;
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
switch(afp_command) {
|
||||
|
@ -5234,7 +5234,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
case AFP_SPOTLIGHTRPC:
|
||||
offset = dissect_reply_afp_spotlight(tvb, pinfo, afp_tree, offset, request_val);
|
||||
if (offset == -1)
|
||||
return; /* bogus */
|
||||
return tvb_length(tvb); /* bogus */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5242,6 +5242,8 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset),
|
||||
pinfo, afp_tree);
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
static void afp_reinit( void)
|
||||
|
@ -6812,7 +6814,7 @@ proto_register_afp(void)
|
|||
|
||||
register_init_routine(afp_reinit);
|
||||
|
||||
register_dissector("afp", dissect_afp, proto_afp);
|
||||
new_register_dissector("afp", dissect_afp, proto_afp);
|
||||
|
||||
afp_tap = register_tap("afp");
|
||||
}
|
||||
|
|
|
@ -910,12 +910,9 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
}
|
||||
|
||||
if (new_tvb) {
|
||||
void* pd_save;
|
||||
pd_save = pinfo->private_data;
|
||||
pinfo->private_data = &aspinfo;
|
||||
/* if port == 6 it's not an ASP packet but a ZIP packet */
|
||||
if (pinfo->srcport == 6 || pinfo->destport == 6 )
|
||||
call_dissector(zip_atp_handle, new_tvb, pinfo, tree);
|
||||
call_dissector_with_data(zip_atp_handle, new_tvb, pinfo, tree, &aspinfo);
|
||||
else {
|
||||
/* XXX need a conversation_get_dissector function ? */
|
||||
if (!aspinfo.reply && !conversation->dissector_handle) {
|
||||
|
@ -935,7 +932,7 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
else {
|
||||
sub = asp_handle;
|
||||
}
|
||||
call_dissector(sub, new_tvb, pinfo, tree);
|
||||
call_dissector_with_data(sub, new_tvb, pinfo, tree, &aspinfo);
|
||||
conversation_set_dissector(conversation, sub);
|
||||
}
|
||||
else if (!try_conversation_dissector(&pinfo->src, &pinfo->dst, pinfo->ptype,
|
||||
|
@ -944,7 +941,6 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
|
||||
}
|
||||
}
|
||||
pinfo->private_data = pd_save;
|
||||
}
|
||||
else {
|
||||
/* Just show this as a fragment. */
|
||||
|
@ -1269,9 +1265,8 @@ dissect_pap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
ASP protocol cf. inside appletalk chap. 11
|
||||
*/
|
||||
static struct aspinfo *
|
||||
get_transaction(tvbuff_t *tvb, packet_info *pinfo)
|
||||
get_transaction(tvbuff_t *tvb, packet_info *pinfo, struct aspinfo *aspinfo)
|
||||
{
|
||||
struct aspinfo *aspinfo = (struct aspinfo *)pinfo->private_data;
|
||||
conversation_t *conversation;
|
||||
asp_request_key request_key, *new_request_key;
|
||||
asp_request_val *request_val;
|
||||
|
@ -1311,7 +1306,7 @@ get_transaction(tvbuff_t *tvb, packet_info *pinfo)
|
|||
|
||||
|
||||
static int
|
||||
dissect_asp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
||||
dissect_asp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
||||
{
|
||||
struct aspinfo *aspinfo;
|
||||
int offset = 0;
|
||||
|
@ -1323,7 +1318,7 @@ dissect_asp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASP");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
aspinfo = get_transaction(tvb, pinfo);
|
||||
aspinfo = get_transaction(tvb, pinfo, (struct aspinfo *)data);
|
||||
if (!aspinfo)
|
||||
return 0;
|
||||
|
||||
|
@ -1453,8 +1448,8 @@ dissect_asp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
/* -----------------------------
|
||||
ZIP protocol cf. inside appletalk chap. 8
|
||||
*/
|
||||
static void
|
||||
dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
struct aspinfo *aspinfo;
|
||||
int offset = 0;
|
||||
|
@ -1468,9 +1463,9 @@ dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZIP");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
aspinfo = get_transaction(tvb, pinfo);
|
||||
aspinfo = get_transaction(tvb, pinfo, (struct aspinfo *)data);
|
||||
if (!aspinfo)
|
||||
return;
|
||||
return tvb_length(tvb);
|
||||
|
||||
fn = (guint8) aspinfo->command;
|
||||
|
||||
|
@ -1481,7 +1476,7 @@ dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
val_to_str(fn, zip_atp_function_vals, "Unknown (0x%01x)"), aspinfo->seq);
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
return tvb_length(tvb);
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_zip, tvb, offset, -1, ENC_NA);
|
||||
zip_tree = proto_item_add_subtree(ti, ett_zip);
|
||||
|
@ -1524,6 +1519,8 @@ dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2467,7 +2464,7 @@ proto_reg_handoff_atalk(void)
|
|||
zip_ddp_handle = create_dissector_handle(dissect_ddp_zip, proto_zip);
|
||||
dissector_add_uint("ddp.type", DDP_ZIP, zip_ddp_handle);
|
||||
|
||||
zip_atp_handle = create_dissector_handle(dissect_atp_zip, proto_zip);
|
||||
zip_atp_handle = new_create_dissector_handle(dissect_atp_zip, proto_zip);
|
||||
|
||||
llap_handle = create_dissector_handle(dissect_llap, proto_llap);
|
||||
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOCALTALK, llap_handle);
|
||||
|
|
|
@ -531,10 +531,10 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
"Unknown function (0x%02x)"),
|
||||
dsi_requestid);
|
||||
|
||||
if (tree) {
|
||||
ti = proto_tree_add_item(tree, proto_dsi, tvb, 0, -1, ENC_NA);
|
||||
dsi_tree = proto_item_add_subtree(ti, ett_dsi);
|
||||
ti = proto_tree_add_item(tree, proto_dsi, tvb, 0, -1, ENC_NA);
|
||||
dsi_tree = proto_item_add_subtree(ti, ett_dsi);
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_uint(dsi_tree, hf_dsi_flags, tvb,
|
||||
0, 1, dsi_flags);
|
||||
proto_tree_add_uint(dsi_tree, hf_dsi_command, tvb,
|
||||
|
@ -559,8 +559,7 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree_add_uint(dsi_tree, hf_dsi_reserved, tvb,
|
||||
12, 4, dsi_reserved);
|
||||
}
|
||||
else
|
||||
dsi_tree = tree;
|
||||
|
||||
switch (dsi_command) {
|
||||
case DSIFUNC_OPEN:
|
||||
if (tree) {
|
||||
|
@ -581,28 +580,22 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
case DSIFUNC_WRITE:
|
||||
{
|
||||
tvbuff_t *new_tvb;
|
||||
void* pd_save;
|
||||
int len = tvb_reported_length_remaining(tvb,DSI_BLOCKSIZ);
|
||||
|
||||
aspinfo.reply = (dsi_flags == DSIFL_REPLY);
|
||||
aspinfo.command = dsi_command;
|
||||
aspinfo.seq = dsi_requestid;
|
||||
aspinfo.code = dsi_code;
|
||||
pd_save = pinfo->private_data;
|
||||
pinfo->private_data = &aspinfo;
|
||||
proto_item_set_len(dsi_tree, DSI_BLOCKSIZ);
|
||||
proto_item_set_len(dsi_tree, DSI_BLOCKSIZ);
|
||||
|
||||
new_tvb = tvb_new_subset(tvb, DSI_BLOCKSIZ,-1,len);
|
||||
call_dissector(afp_handle, new_tvb, pinfo, tree);
|
||||
pinfo->private_data = pd_save;
|
||||
call_dissector_with_data(afp_handle, new_tvb, pinfo, tree, &aspinfo);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (tree) {
|
||||
call_dissector(data_handle,
|
||||
tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ),
|
||||
pinfo, dsi_tree);
|
||||
}
|
||||
call_dissector(data_handle,
|
||||
tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ),
|
||||
pinfo, dsi_tree);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue