move some defines to packet-usb.h so that they can be shared with other dissectors

svn path=/trunk/; revision=19587
This commit is contained in:
Ronnie Sahlberg 2006-10-18 09:10:14 +00:00
parent 5243edd737
commit df75f29284
3 changed files with 63 additions and 33 deletions

View File

@ -967,6 +967,7 @@ DISSECTOR_INCLUDES = \
packet-umts_rrc.h \
packet-umts_rrc_ies.h \
packet-umts_rrc_pdu_def.h \
packet-usb.h \
packet-vines.h \
packet-vlan.h \
packet-wap.h \

View File

@ -39,6 +39,7 @@
#include <epan/emem.h>
#include <epan/conversation.h>
#include <string.h>
#include "packet-usb.h"
/* protocols and header fields */
static int proto_usb = -1;
@ -104,36 +105,7 @@ static gint ett_descriptor_device = -1;
*/
#define NO_ENDPOINT 0xffff
/* there is one such structure for each device/endpoint conversation */
typedef struct _usb_conv_info_t {
guint16 class; /* class for this conversation */
emem_tree_t *transactions;
} usb_conv_info_t;
/* there is one such structure for each request/response */
typedef struct _usb_trans_info_t {
guint32 request_in;
guint32 response_in;
guint8 requesttype;
guint8 request;
union {
struct {
guint8 type;
guint8 index;
} get_descriptor;
};
/* used to pass the interface class from the
* interface descriptor onto the endpoint
* descriptors so that we can create a
* conversation with the appropriate class
* once we know the endpoint.
*/
usb_conv_info_t *interface_info;
} usb_trans_info_t;
typedef enum {
URB_CONTROL_INPUT,
@ -169,8 +141,6 @@ static const value_string usb_langid_vals[] = {
{0, NULL}
};
#define IF_CLASS_UNKNOWN 0xffff
#define IF_CLASS_MASSTORAGE 0x08
static const value_string usb_interfaceclass_vals[] = {
{IF_CLASS_MASSTORAGE, "Mass Storage Class"},
{0, NULL}
@ -918,7 +888,7 @@ dissect_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
{
proto_item *item;
item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 1, usb_conv_info->class);
item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 0, usb_conv_info->class);
PROTO_ITEM_SET_GENERATED(item);
}
break;
@ -926,7 +896,7 @@ dissect_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
{
proto_item *item;
item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 1, usb_conv_info->class);
item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 0, usb_conv_info->class);
PROTO_ITEM_SET_GENERATED(item);
}
break;

View File

@ -0,0 +1,59 @@
/* packet-usb.h
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PACKET_USB_H__
#define __PACKET_USB_H__
/* there is one such structure for each device/endpoint conversation */
typedef struct _usb_conv_info_t {
guint16 class; /* class for this conversation */
emem_tree_t *transactions;
} usb_conv_info_t;
/* there is one such structure for each request/response */
typedef struct _usb_trans_info_t {
guint32 request_in;
guint32 response_in;
guint8 requesttype;
guint8 request;
union {
struct {
guint8 type;
guint8 index;
} get_descriptor;
};
/* used to pass the interface class from the
* interface descriptor onto the endpoint
* descriptors so that we can create a
* conversation with the appropriate class
* once we know the endpoint.
*/
usb_conv_info_t *interface_info;
} usb_trans_info_t;
#define IF_CLASS_UNKNOWN 0xffff
#define IF_CLASS_MASSTORAGE 0x08
#endif