PageRenderTime 93ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/cmpt471/a2/wireshark/epan/packet_info.h

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