2 * Definitions for packet info structures and routines
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
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.
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.
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.
25 #ifndef __PACKET_INFO_H__
26 #define __PACKET_INFO_H__
28 #include "frame_data.h"
32 /* Also defined in wiretap/wtap.h */
33 #define P2P_DIR_UNKNOWN -1
34 #define P2P_DIR_SENT 0
35 #define P2P_DIR_RECV 1
38 #define LINK_DIR_UNKNOWN -1
42 #define PINFO_SOF_FIRST_FRAME 0x1
43 #define PINFO_SOF_SOFF 0x2
44 #define PINFO_EOF_LAST_FRAME 0x80
45 #define PINFO_EOF_INVALID 0x40
46 #define MAX_NUMBER_OF_PPIDS 2
48 typedef struct _packet_info {
49 const char *current_proto; /* name of protocol currently being dissected */
50 column_info *cinfo; /* Column formatting information */
52 union wtap_pseudo_header *pseudo_header;
53 GSList *data_src; /* Frame data sources */
54 address dl_src; /* link-layer source address */
55 address dl_dst; /* link-layer destination address */
56 address net_src; /* network-layer source address */
57 address net_dst; /* network-layer destination address */
58 address src; /* source address (net if present, DL otherwise )*/
59 address dst; /* destination address (net if present, DL otherwise )*/
60 guint32 ethertype; /* Ethernet Type Code, if this is an Ethernet packet */
61 guint32 ipproto; /* IP protocol, if this is an IP packet */
62 guint32 ipxptype; /* IPX packet type, if this is an IPX packet */
63 guint32 mpls_label; /* last mpls label in label stack, if this is a MPLS packet */
64 circuit_type ctype; /* type of circuit, for protocols with a VC identifier */
65 guint32 circuit_id; /* circuit ID, for protocols with a VC identifier */
66 const char *noreassembly_reason; /* reason why reassembly wasn't done, if any */
67 gboolean fragmented; /* TRUE if the protocol is only a fragment */
68 gboolean in_error_pkt; /* TRUE if we're inside an {ICMP,CLNP,...} error packet */
69 port_type ptype; /* type of the following two port numbers */
70 guint32 srcport; /* source port */
71 guint32 destport; /* destination port */
72 guint32 match_uint; /* matched uint for calling subdissector from table */
73 const char *match_string; /* matched string for calling subdissector from table */
74 guint16 can_desegment; /* >0 if this segment could be desegmented.
75 A dissector that can offer this API (e.g.
76 TCP) sets can_desegment=2, then
77 can_desegment is decremented by 1 each time
78 we pass to the next subdissector. Thus only
79 the dissector immediately above the
80 protocol which sets the flag can use it*/
81 guint16 saved_can_desegment; /* Value of can_desegment before current
82 dissector was called. Supplied so that
83 dissectors for proxy protocols such as
84 SOCKS can restore it, allowing the
85 dissectors that they call to use the
86 TCP dissector's desegmentation (SOCKS
87 just retransmits TCP segments once it's
88 finished setting things up, so the TCP
89 desegmentor can desegment its payload). */
90 int desegment_offset; /* offset to stuff needing desegmentation */
91 #define DESEGMENT_ONE_MORE_SEGMENT 0x0fffffff
92 #define DESEGMENT_UNTIL_FIN 0x0ffffffe
93 guint32 desegment_len; /* requested desegmentation additional length
95 DESEGMENT_ONE_MORE_SEGMENT:
96 Desegment one more full segment
97 (warning! only partially implemented)
99 Desgment all data for this tcp session
100 until the FIN segment.
102 guint16 want_pdu_tracking; /* >0 if the subdissector has specified
103 a value in 'bytes_until_next_pdu'.
104 When a dissector detects that the next PDU
105 will start beyond the start of the next
106 segment, it can set this value to 2
107 and 'bytes_until_next_pdu' to the number of
108 bytes beyond the next segment where the
111 If the protocol dissector below this
112 one is capable of PDU tracking it can
113 use this hint to detect PDUs that starts
114 unaligned to the segment boundaries.
115 The TCP dissector is using this hint from
116 (some) protocols to detect when a new PDU
117 starts in the middle of a tcp segment.
119 There is intelligence in the glue between
120 dissector layers to make sure that this
121 request is only passed down to the protocol
122 immediately below the current one and not
125 guint32 bytes_until_next_pdu;
128 int iplen; /* total length of IP packet */
129 int iphdrlen; /* length of IP header */
130 guint8 ip_ttl; /* IP time to live */
131 int p2p_dir; /* Packet was captured as an
132 outbound (P2P_DIR_SENT)
133 inbound (P2P_DIR_RECV)
134 unknown (P2P_DIR_UNKNOWN) */
135 guint16 oxid; /* next 2 fields reqd to identify fibre */
136 guint16 rxid; /* channel conversations */
137 guint8 r_ctl; /* R_CTL field in Fibre Channel Protocol */
138 guint8 sof_eof; /* FC's SOF/EOF encoding passed to FC decoder
139 * Bit 7 set if Last frame in sequence
140 * Bit 6 set if invalid frame content
142 * Bit 1 set if first frame in sequence
144 guint16 src_idx; /* Source port index (Cisco MDS-specific) */
145 guint16 dst_idx; /* Dest port index (Cisco MDS-specific) */
146 guint16 vsan; /* Fibre channel/Cisco MDS-specific */
148 /* Extra data for DCERPC handling and tracking of context ids */
149 guint16 dcectxid; /* Context ID (DCERPC-specific) */
150 int dcetransporttype; /* Transport type
151 * Value -1 means "not a DCERPC packet"
153 guint16 dcetransportsalt; /* fid: if transporttype==DCE_CN_TRANSPORT_SMBPIPE */
155 /* Extra data for handling of decryption of GSSAPI wrapped tvbuffs.
156 Caller sets decrypt_gssapi_tvb if this service is requested.
157 If gssapi_encrypted_tvb is NULL, then the rest of the tvb data following
158 the gssapi blob itself is decrypted othervise the gssapi_encrypted_tvb
159 tvb will be decrypted (DCERPC has the data before the gssapi blob)
160 If, on return, gssapi_data_encrypted is FALSE, the wrapped tvbuff
161 was signed (i.e., an encrypted signature was present, to check
162 whether the data was modified by a man in the middle) but not sealed
163 (i.e., the data itself wasn't encrypted).
165 #define DECRYPT_GSSAPI_NORMAL 1
166 #define DECRYPT_GSSAPI_DCE 2
167 guint16 decrypt_gssapi_tvb;
168 tvbuff_t *gssapi_wrap_tvb;
169 tvbuff_t *gssapi_encrypted_tvb;
170 tvbuff_t *gssapi_decrypted_tvb;
171 gboolean gssapi_data_encrypted;
173 guint32 ppid; /* SCTP PPI of current DATA chunk */
174 guint32 ppids[MAX_NUMBER_OF_PPIDS]; /* The first NUMBER_OF_PPIDS PPIDS which are present
177 void *private_data; /* pointer to data passed from one dissector to another */
178 /* TODO: Use emem_strbuf_t instead */
179 GString *layer_names; /* layers of each protocol */
182 guint16 profinet_type; /* the type of PROFINET packet (0: not a PROFINET packet) */
183 void *profinet_conv; /* the PROFINET conversation data (NULL: not a PROFINET packet) */
185 void *tcp_tree; /* proto_tree for the tcp layer */
187 const char *dcerpc_procedure_name; /* Used by PIDL to store the name of the current dcerpc procedure */
189 struct _sccp_msg_info_t* sccp_info;
190 guint16 clnp_srcref; /* clnp/cotp source reference (can't use srcport, this would confuse tpkt) */
191 guint16 clnp_dstref; /* clnp/cotp destination reference (can't use dstport, this would confuse tpkt) */
193 guint16 zbee_cluster_id; /* ZigBee cluster ID, an application-specific message identifier that
194 * happens to be included in the transport (APS) layer header.
196 guint8 zbee_stack_vers; /* ZigBee stack version number, present in the ZigBee network layer, but
197 * impacts the packet format at all layers of the ZigBee stack.
199 int link_dir; /* 3GPP messages are sometime different UP link(UL) or Downlink(DL)
204 /* For old code that hasn't yet been changed. */
205 #define match_port match_uint
207 #endif /* __PACKET_INFO_H__ */