create a new address type AT_USB and start populating the packet list
with nice data svn path=/trunk/; revision=19524
This commit is contained in:
parent
057c7a0555
commit
24ef4fcef0
|
@ -46,7 +46,9 @@ typedef enum {
|
|||
AT_STRINGZ, /* null-terminated string */
|
||||
AT_EUI64, /* IEEE EUI-64 */
|
||||
AT_URI, /* URI/URL/URN */
|
||||
AT_TIPC /* TIPC Address Zone,Subnetwork,Processor */
|
||||
AT_TIPC, /* TIPC Address Zone,Subnetwork,Processor */
|
||||
AT_USB /* USB Device address
|
||||
* (0xffffffff represents the host) */
|
||||
} address_type;
|
||||
|
||||
typedef struct _address {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <epan/prefs.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef enum {
|
||||
URB_CONTROL_INPUT,
|
||||
|
@ -94,6 +95,8 @@ dissect_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
|
|||
int type;
|
||||
gboolean setup;
|
||||
proto_tree *tree = NULL;
|
||||
static guint32 src_addr=0xffffffff, dst_addr=0xffffffff; /* has to be static due to SET_ADDRESS */
|
||||
guint32 tmpaddr;
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "USB");
|
||||
|
@ -110,8 +113,31 @@ dissect_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
|
|||
type = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_item(tree, hf_usb_urb_type, tvb, offset, 4, FALSE);
|
||||
offset += 4;
|
||||
|
||||
#define USB_ADDR_LEN 4
|
||||
proto_tree_add_item(tree, hf_usb_device_address, tvb, offset, 4, FALSE);
|
||||
switch(type){
|
||||
case URB_CONTROL_INPUT:
|
||||
case URB_ISOCHRONOUS_INPUT:
|
||||
case URB_INTERRUPT_INPUT:
|
||||
case URB_BULK_INPUT:
|
||||
src_addr=tvb_get_ntohl(tvb, offset);
|
||||
break;
|
||||
case URB_CONTROL_OUTPUT:
|
||||
case URB_ISOCHRONOUS_OUTPUT:
|
||||
case URB_INTERRUPT_OUTPUT:
|
||||
case URB_BULK_OUTPUT:
|
||||
dst_addr=tvb_get_ntohl(tvb, offset);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
offset += 4;
|
||||
SET_ADDRESS(&pinfo->net_src, AT_USB, USB_ADDR_LEN, (char *)&src_addr);
|
||||
SET_ADDRESS(&pinfo->src, AT_USB, USB_ADDR_LEN, (char *)&src_addr);
|
||||
SET_ADDRESS(&pinfo->net_dst, AT_USB, USB_ADDR_LEN, (char *)&dst_addr);
|
||||
SET_ADDRESS(&pinfo->dst, AT_USB, USB_ADDR_LEN, (char *)&dst_addr);
|
||||
|
||||
proto_tree_add_item(tree, hf_usb_endpoint_number, tvb, offset, 4, FALSE);
|
||||
offset += 4;
|
||||
|
||||
|
|
|
@ -316,6 +316,17 @@ vines_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len)
|
|||
g_snprintf(buf, buf_len, "%08x.%04x", pntohl(&addrp[0]), pntohs(&addrp[4]));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
usb_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len)
|
||||
{
|
||||
if(pletohl(&addrp[0])==0xffffffff){
|
||||
g_snprintf(buf, buf_len, "host");
|
||||
} else {
|
||||
g_snprintf(buf, buf_len, "%d", pletohl(&addrp[0]));
|
||||
}
|
||||
}
|
||||
|
||||
#define PLURALIZE(n) (((n) > 1) ? "s" : "")
|
||||
#define COMMA(do_it) ((do_it) ? ", " : "")
|
||||
|
||||
|
@ -799,6 +810,9 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
|
|||
case AT_VINES:
|
||||
vines_addr_to_str_buf(addr->data, buf, buf_len);
|
||||
break;
|
||||
case AT_USB:
|
||||
usb_addr_to_str_buf(addr->data, buf, buf_len);
|
||||
break;
|
||||
case AT_OSI:
|
||||
print_nsap_net_buf(addr->data, addr->len, buf, buf_len);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue