c37ae13511a7423211e20f850edbc8a7a54048bb
[obnox/wireshark/wip.git] / epan / packet_info.h
1 /* packet_info.h
2  * Definitions for packet info structures and routines
3  *
4  * $Id$
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __PACKET_INFO_H__
26 #define __PACKET_INFO_H__
27
28 #include "frame_data.h"
29 #include "tvbuff.h"
30 #include "address.h"
31
32 #define P2P_DIR_UNKNOWN -1
33 #define P2P_DIR_SENT    0
34 #define P2P_DIR_RECV    1
35
36 #define PINFO_SOF_FIRST_FRAME   0x1
37 #define PINFO_SOF_SOFF          0x2
38 #define PINFO_EOF_LAST_FRAME    0x80
39 #define PINFO_EOF_INVALID       0x40
40 #define MAX_NUMBER_OF_PPIDS     2
41
42 typedef struct _packet_info {
43   const char *current_proto;    /* name of protocol currently being dissected */
44   column_info *cinfo;           /* Column formatting information */
45   frame_data *fd;
46   union wtap_pseudo_header *pseudo_header;
47   GSList *data_src;             /* Frame data sources */
48   address dl_src;               /* link-layer source address */
49   address dl_dst;               /* link-layer destination address */
50   address net_src;              /* network-layer source address */
51   address net_dst;              /* network-layer destination address */
52   address src;                  /* source address (net if present, DL otherwise )*/
53   address dst;                  /* destination address (net if present, DL otherwise )*/
54   guint32 ethertype;            /* Ethernet Type Code, if this is an Ethernet packet */
55   guint32 ipproto;              /* IP protocol, if this is an IP packet */
56   guint32 ipxptype;             /* IPX packet type, if this is an IPX packet */
57   circuit_type ctype;           /* type of circuit, for protocols with a VC identifier */
58   guint32 circuit_id;           /* circuit ID, for protocols with a VC identifier */
59   char   *noreassembly_reason;  /* reason why reassembly wasn't done, if any */
60   gboolean fragmented;          /* TRUE if the protocol is only a fragment */
61   gboolean in_error_pkt;        /* TRUE if we're inside an {ICMP,CLNP,...} error packet */
62   port_type ptype;              /* type of the following two port numbers */
63   guint32 srcport;              /* source port */
64   guint32 destport;             /* destination port */
65   guint32 match_port;
66   const char *match_string;     /* Subdissectors with string dissector tables use this */
67   guint16 can_desegment;        /* >0 if this segment could be desegmented.
68                                    A dissector that can offer this API (e.g.
69                                    TCP) sets can_desegment=2, then
70                                    can_desegment is decremented by 1 each time
71                                    we pass to the next subdissector. Thus only
72                                    the dissector immediately above the
73                                    protocol which sets the flag can use it*/
74   guint16 saved_can_desegment;  /* Value of can_desegment before current
75                                    dissector was called.  Supplied so that
76                                    dissectors for proxy protocols such as
77                                    SOCKS can restore it, allowing the
78                                    dissectors that they call to use the
79                                    TCP dissector's desegmentation (SOCKS
80                                    just retransmits TCP segments once it's
81                                    finished setting things up, so the TCP
82                                    desegmentor can desegment its payload). */
83   int desegment_offset;         /* offset to stuff needing desegmentation */
84   guint32 desegment_len;        /* requested desegmentation additional length */
85   guint16 want_pdu_tracking;    /* >0 if the subdissector has specified
86                                    a value in 'bytes_until_next_pdu'.
87                                    When a dissector detects that the next PDU
88                                    will start beyond the start of the next
89                                    segment, it can set this value to 2
90                                    and 'bytes_until_next_pdu' to the number of
91                                    bytes beyond the next segment where the
92                                    next PDU starts.
93
94                                    If the protocol dissector below this
95                                    one is capable of PDU tracking it can
96                                    use this hint to detect PDUs that starts
97                                    unaligned to the segment boundaries.
98                                    The TCP dissector is using this hint from
99                                    (some) protocols to detect when a new PDU
100                                    starts in the middle of a tcp segment.
101
102                                    There is intelligence in the glue between
103                                    dissector layers to make sure that this
104                                    request is only passed down to the protocol
105                                    immediately below the current one and not
106                                    any further.
107                                 */
108   guint32 bytes_until_next_pdu;
109
110
111   int     iplen;
112   int     iphdrlen;
113   int     p2p_dir;
114   guint16 oxid;                 /* next 2 fields reqd to identify fibre */
115   guint16 rxid;                 /* channel conversations */
116   guint8  r_ctl;                /* R_CTL field in Fibre Channel Protocol */
117   guint8  sof_eof;              /* FC's SOF/EOF encoding passed to FC decoder
118                                  * Bit 7 set if Last frame in sequence
119                                  * Bit 6 set if invalid frame content
120                                  * Bit 2 set if SOFf
121                                  * Bit 1 set if first frame in sequence
122                                  */
123   guint16 src_idx;              /* Source port index (Cisco MDS-specific) */
124   guint16 dst_idx;              /* Dest port index (Cisco MDS-specific) */
125   guint16 vsan;                 /* Fibre channel/Cisco MDS-specific */
126   guint16 dcectxid;             /* Context ID (DCERPC-specific) */
127   int     dcetransporttype;     /* Transport type, tag for private_data (DCERPC-specific)
128                                  * Value -1 means "not a DCERPC packet"
129                                  */
130   guint32 ppid[MAX_NUMBER_OF_PPIDS]; /* The first NUMBER_OF_PPIDS PPIDS which are present
131                                       * in the SCTP packet
132                                       */
133   void    *private_data;        /* pointer to data passed from one dissector to another */
134   GString *layer_names;         /* layers of each protocol */
135 } packet_info;
136
137 #endif /* __PACKET_INFO_H__ */