RX and AFS dissectors tvbuffified, and bugs fixed, by Ronnie Sahlberg.
[obnox/wireshark/wip.git] / epan / packet_info.h
1 /* packet_info.h
2  * Definitions for packet info structures and routines
3  *
4  * $Id: packet_info.h,v 1.2 2001/05/27 01:48:25 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * 
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  * 
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __PACKET_INFO_H__
27 #define __PACKET_INFO_H__
28
29 #include "frame_data.h"
30 #include "tvbuff.h"
31
32 /* Types of addresses Ethereal knows about. */
33 typedef enum {
34   AT_NONE,              /* no link-layer address */
35   AT_ETHER,             /* MAC (Ethernet, 802.x, FDDI) address */
36   AT_IPv4,              /* IPv4 */
37   AT_IPv6,              /* IPv6 */
38   AT_IPX,               /* IPX */
39   AT_SNA,               /* SNA */
40   AT_ATALK,             /* Appletalk DDP */
41   AT_VINES,             /* Banyan Vines */
42   AT_OSI,               /* OSI NSAP */
43   AT_DLCI               /* Frame Relay DLCI */
44 } address_type;
45
46 typedef struct _address {
47   address_type  type;           /* type of address */
48   int           len;            /* length of address, in bytes */
49   const guint8 *data;           /* bytes that constitute address */
50 } address;
51
52 #define SET_ADDRESS(addr, addr_type, addr_len, addr_data) { \
53         (addr)->type = (addr_type); \
54         (addr)->len = (addr_len); \
55         (addr)->data = (addr_data); \
56         }
57
58 /* Types of port numbers Ethereal knows about. */
59 typedef enum {
60   PT_NONE,              /* no port number */
61   PT_SCTP,              /* SCTP */
62   PT_TCP,               /* TCP */
63   PT_UDP,               /* UDP */
64   PT_NCP                /* NCP connection */
65 } port_type;
66
67 #define P2P_DIR_UNKNOWN -1
68 #define P2P_DIR_SENT    0
69 #define P2P_DIR_RECV    1
70
71 typedef struct _packet_info {
72   const char *current_proto;    /* name of protocol currently being dissected */
73   frame_data *fd;
74   tvbuff_t *compat_top_tvb;     /* only needed while converting Ethereal to use tvbuffs */
75   union wtap_pseudo_header *pseudo_header;
76   int     len;
77   int     captured_len;
78   address dl_src;               /* link-layer source address */
79   address dl_dst;               /* link-layer destination address */
80   address net_src;              /* network-layer source address */
81   address net_dst;              /* network-layer destination address */
82   address src;                  /* source address (net if present, DL otherwise )*/
83   address dst;                  /* destination address (net if present, DL otherwise )*/
84   guint32 ethertype;            /* Ethernet Type Code, if this is an Ethernet packet */
85   guint32 ipproto;              /* IP protocol, if this is an IP packet */
86   guint32 ipxptype;             /* IPX packet type, if this is an IPX packet */
87   gboolean fragmented;          /* TRUE if the protocol is only a fragment */
88   port_type ptype;              /* type of the following two port numbers */
89   guint32 srcport;              /* source port */
90   guint32 destport;             /* destination port */
91   guint32 match_port;
92   int     iplen;
93   int     iphdrlen;
94   int     p2p_dir;
95   union {
96     struct {
97       guint8    type;
98       guint8    flags;
99       guint16   serviceid;
100       guint32   callnumber;
101       guint32   seq;
102     } rx;                       /* fields specific for RX protocol */
103   } ps;                         /* protocol specific data */
104 } packet_info;
105
106 void blank_packetinfo(void);
107
108 extern packet_info pi;
109
110 #endif /* __PACKET_INFO_H__ */