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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __PACKET_INFO_H__
26 #define __PACKET_INFO_H__
28 #include "frame_data.h"
33 * Dissected packet data and metadata.
36 /** @defgroup packetinfo Packet Data and Metadata
41 /* Also defined in wiretap/wtap.h */
42 #define P2P_DIR_UNKNOWN -1
43 #define P2P_DIR_SENT 0
44 #define P2P_DIR_RECV 1
47 #define LINK_DIR_UNKNOWN -1
51 #define PINFO_SOF_FIRST_FRAME 0x1
52 #define PINFO_SOF_SOFF 0x2
53 #define PINFO_EOF_LAST_FRAME 0x80
54 #define PINFO_EOF_INVALID 0x40
56 typedef struct _packet_info {
57 const char *current_proto; /**< name of protocol currently being dissected */
58 column_info *cinfo; /**< Column formatting information */
60 union wtap_pseudo_header *pseudo_header;
61 struct wtap_pkthdr *phdr;
62 GSList *data_src; /**< Frame data sources */
63 address dl_src; /**< link-layer source address */
64 address dl_dst; /**< link-layer destination address */
65 address net_src; /**< network-layer source address */
66 address net_dst; /**< network-layer destination address */
67 address src; /**< source address (net if present, DL otherwise )*/
68 address dst; /**< destination address (net if present, DL otherwise )*/
69 guint32 ipproto; /**< IP protocol, if this is an IP packet */
70 circuit_type ctype; /**< type of circuit, for protocols with a VC identifier */
71 guint32 circuit_id; /**< circuit ID, for protocols with a VC identifier */
72 const char *noreassembly_reason; /**< reason why reassembly wasn't done, if any */
73 gboolean fragmented; /**< TRUE if the protocol is only a fragment */
75 guint32 in_error_pkt:1; /**< TRUE if we're inside an {ICMP,CLNP,...} error packet */
76 guint32 in_gre_pkt:1; /**< TRUE if we're encapsulated inside a GRE packet */
78 port_type ptype; /**< type of the following two port numbers */
79 guint32 srcport; /**< source port */
80 guint32 destport; /**< destination port */
81 guint32 match_uint; /**< matched uint for calling subdissector from table */
82 const char *match_string; /**< matched string for calling subdissector from table */
83 guint16 can_desegment; /**< >0 if this segment could be desegmented.
84 A dissector that can offer this API (e.g.
85 TCP) sets can_desegment=2, then
86 can_desegment is decremented by 1 each time
87 we pass to the next subdissector. Thus only
88 the dissector immediately above the
89 protocol which sets the flag can use it*/
90 guint16 saved_can_desegment; /**< Value of can_desegment before current
91 dissector was called. Supplied so that
92 dissectors for proxy protocols such as
93 SOCKS can restore it, allowing the
94 dissectors that they call to use the
95 TCP dissector's desegmentation (SOCKS
96 just retransmits TCP segments once it's
97 finished setting things up, so the TCP
98 desegmentor can desegment its payload). */
99 int desegment_offset; /**< offset to stuff needing desegmentation */
100 #define DESEGMENT_ONE_MORE_SEGMENT 0x0fffffff
101 #define DESEGMENT_UNTIL_FIN 0x0ffffffe
102 guint32 desegment_len; /**< requested desegmentation additional length
104 DESEGMENT_ONE_MORE_SEGMENT:
105 Desegment one more full segment
106 (warning! only partially implemented)
108 Desgment all data for this tcp session
109 until the FIN segment.
111 guint16 want_pdu_tracking; /**< >0 if the subdissector has specified
112 a value in 'bytes_until_next_pdu'.
113 When a dissector detects that the next PDU
114 will start beyond the start of the next
115 segment, it can set this value to 2
116 and 'bytes_until_next_pdu' to the number of
117 bytes beyond the next segment where the
120 If the protocol dissector below this
121 one is capable of PDU tracking it can
122 use this hint to detect PDUs that starts
123 unaligned to the segment boundaries.
124 The TCP dissector is using this hint from
125 (some) protocols to detect when a new PDU
126 starts in the middle of a tcp segment.
128 There is intelligence in the glue between
129 dissector layers to make sure that this
130 request is only passed down to the protocol
131 immediately below the current one and not
134 guint32 bytes_until_next_pdu;
136 int p2p_dir; /**< Packet was captured as an
137 outbound (P2P_DIR_SENT)
138 inbound (P2P_DIR_RECV)
139 unknown (P2P_DIR_UNKNOWN) */
140 guint16 oxid; /**< next 2 fields reqd to identify fibre */
141 guint16 rxid; /**< channel conversations */
142 guint8 r_ctl; /**< R_CTL field in Fibre Channel Protocol */
143 guint8 sof_eof; /**< FC's SOF/EOF encoding passed to FC decoder
144 * Bit 7 set if Last frame in sequence
145 * Bit 6 set if invalid frame content
147 * Bit 1 set if first frame in sequence
150 /**< Extra data for handling of decryption of GSSAPI wrapped tvbuffs.
151 Caller sets decrypt_gssapi_tvb if this service is requested.
152 If gssapi_encrypted_tvb is NULL, then the rest of the tvb data following
153 the gssapi blob itself is decrypted othervise the gssapi_encrypted_tvb
154 tvb will be decrypted (DCERPC has the data before the gssapi blob)
155 If, on return, gssapi_data_encrypted is FALSE, the wrapped tvbuff
156 was signed (i.e., an encrypted signature was present, to check
157 whether the data was modified by a man in the middle) but not sealed
158 (i.e., the data itself wasn't encrypted).
160 #define DECRYPT_GSSAPI_NORMAL 1
161 #define DECRYPT_GSSAPI_DCE 2
162 guint16 decrypt_gssapi_tvb;
163 tvbuff_t *gssapi_wrap_tvb;
164 tvbuff_t *gssapi_encrypted_tvb;
165 tvbuff_t *gssapi_decrypted_tvb;
166 gboolean gssapi_data_encrypted;
168 void *private_data; /**< pointer to data passed from one dissector to another */
169 GHashTable *private_table; /**< a hash table passed from one dissector to another */
171 wmem_list_t *layers; /**< layers of each protocol */
172 guint8 curr_layer_num; /**< The current "depth" or layer number in the current frame */
174 guint8 annex_a_used; /**< used in packet-mtp2.c
176 * MTP2_ANNEX_A_NOT_USED 0
177 * MTP2_ANNEX_A_USED 1
178 * MTP2_ANNEX_A_USED_UNKNOWN 2
180 guint16 profinet_type; /**< the type of PROFINET packet (0: not a PROFINET packet) */
182 struct _sccp_msg_info_t* sccp_info;
183 guint16 clnp_srcref; /**< clnp/cotp source reference (can't use srcport, this would confuse tpkt) */
184 guint16 clnp_dstref; /**< clnp/cotp destination reference (can't use dstport, this would confuse tpkt) */
186 int link_dir; /**< 3GPP messages are sometime different UP link(UL) or Downlink(DL) */
188 GSList* proto_data; /**< Per packet proto data */
190 GSList* dependent_frames; /**< A list of frames which this one depends on */
192 GSList* frame_end_routines;
194 wmem_allocator_t *pool; /**< Memory pool scoped to the pinfo struct */
195 struct epan_session *epan;
196 nstime_t rel_ts; /**< Relative timestamp (yes, it can be negative) */
197 const gchar *pkt_comment; /**< NULL if not available */
202 #endif /* __PACKET_INFO_H__ */