IrDA: Register a link-layer IrLAP address type".
Was using AT_NONE as "unknown address type" instead of "no address". Ping-Bug: 12205 Change-Id: Ic1d7022f8eaa3dfab9bb7b607eed264cc527c87c Reviewed-on: https://code.wireshark.org/review/14242 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
c73cf3cd00
commit
68dede24d1
|
@ -30,6 +30,8 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/address_types.h>
|
||||
#include <epan/to_str.h>
|
||||
#include <epan/conversation.h>
|
||||
#include <epan/xdlc.h>
|
||||
#include <wiretap/wtap.h>
|
||||
|
@ -239,6 +241,8 @@ static gint ett_param[MAX_PARAMETERS];
|
|||
|
||||
static gint ett_iap_entry[MAX_IAP_ENTRIES];
|
||||
|
||||
static int irda_address_type = -1;
|
||||
|
||||
static const xdlc_cf_items irlap_cf_items = {
|
||||
&hf_lap_c_nr,
|
||||
&hf_lap_c_ns,
|
||||
|
@ -529,9 +533,9 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r
|
|||
|
||||
/* create conversation entry */
|
||||
src = circuit_id ^ CMD_FRAME;
|
||||
set_address(&srcaddr, AT_NONE, 1, &src);
|
||||
set_address(&srcaddr, irda_address_type, 1, &src);
|
||||
|
||||
set_address(&destaddr, AT_NONE, 1, &circuit_id);
|
||||
set_address(&destaddr, irda_address_type, 1, &circuit_id);
|
||||
|
||||
conv = find_conversation(pinfo->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0);
|
||||
if (conv)
|
||||
|
@ -678,9 +682,9 @@ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro
|
|||
retcode = tvb_get_guint8(tvb, offset + 1);
|
||||
|
||||
src = circuit_id ^ CMD_FRAME;
|
||||
set_address(&srcaddr, AT_NONE, 1, &src);
|
||||
set_address(&srcaddr, irda_address_type, 1, &src);
|
||||
|
||||
set_address(&destaddr, AT_NONE, 1, &circuit_id);
|
||||
set_address(&destaddr, irda_address_type, 1, &circuit_id);
|
||||
|
||||
/* Find result value dissector */
|
||||
conv = find_conversation(pinfo->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0);
|
||||
|
@ -959,9 +963,9 @@ static void dissect_appl_proto(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro
|
|||
|
||||
|
||||
src = circuit_id ^ CMD_FRAME;
|
||||
set_address(&srcaddr, AT_NONE, 1, &src);
|
||||
set_address(&srcaddr, irda_address_type, 1, &src);
|
||||
|
||||
set_address(&destaddr, AT_NONE, 1, &circuit_id);
|
||||
set_address(&destaddr, irda_address_type, 1, &circuit_id);
|
||||
|
||||
/* Find result value dissector */
|
||||
conv = find_conversation(pinfo->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0);
|
||||
|
@ -1188,9 +1192,9 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec
|
|||
|
||||
|
||||
/*g_message("%d: add_lmp_conversation(%p, %d, %d, %p) = ", pinfo->num, pinfo, dlsap, ttp, proto_dissector); */
|
||||
set_address(&srcaddr, AT_NONE, 1, &circuit_id);
|
||||
set_address(&srcaddr, irda_address_type, 1, &circuit_id);
|
||||
|
||||
set_address(&destaddr, AT_NONE, 1, &dest);
|
||||
set_address(&destaddr, irda_address_type, 1, &dest);
|
||||
|
||||
conv = find_conversation(pinfo->num, &destaddr, &srcaddr, PT_NONE, dlsap, 0, NO_PORT_B);
|
||||
if (conv)
|
||||
|
@ -1846,6 +1850,30 @@ static int dissect_irda(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, voi
|
|||
return tvb_captured_length(tvb);
|
||||
}
|
||||
|
||||
static int irda_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
|
||||
{
|
||||
const guint8 *addrdata = (const guint8 *)addr->data;
|
||||
gchar *start_buf = buf;
|
||||
|
||||
buf = uint_to_str_back(buf, *addrdata);
|
||||
*buf = '\0';
|
||||
return (int)(buf-start_buf+1);
|
||||
}
|
||||
|
||||
static int irda_addr_str_len(const address* addr _U_)
|
||||
{
|
||||
return 11; /* Leaves required space (10 bytes) for uint_to_str_back() */
|
||||
}
|
||||
|
||||
static const char* irda_col_filter_str(const address* addr _U_, gboolean is_src _U_)
|
||||
{
|
||||
return "irlap.a";
|
||||
}
|
||||
|
||||
static int irda_addr_len(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the protocol with Wireshark
|
||||
|
@ -2203,6 +2231,8 @@ void proto_register_irda(void)
|
|||
ett_iap_e[i] = &ett_iap_entry[i];
|
||||
}
|
||||
proto_register_subtree_array(ett_iap_e, MAX_IAP_ENTRIES);
|
||||
|
||||
irda_address_type = address_type_dissector_register("AT_IRDA", "IRDA Address", irda_addr_to_str, irda_addr_str_len, irda_col_filter_str, irda_addr_len, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue