3 * Routines for exported_pdu dissection
4 * Copyright 2013, Anders Broman <anders-broman@ericsson.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #ifndef EXPORTED_PDU_H
28 #define EXPORTED_PDU_H
35 * Define different common tap names to extract PDU:s at different layers, otherwise one packet may
36 * be exported several times at different layers if all taps are run.
37 * NOTE if a new tap is added here it needs to be added to export_pdu_dlg.c and packet-exported_pdu.c
38 * TODO: Use an enum_val_t instead?
40 #define EXPORT_PDU_TAP_NAME_LAYER_3 "OSI layer 3"
41 #define EXPORT_PDU_TAP_NAME_LAYER_7 "OSI layer 7"
42 #define EXPORT_PDU_TAP_NAME_DVB_CI "DVB-CI"
45 * This struct is used as the data part of tap_queue_packet() and contains a
46 * buffer with metadata of the protocol PDU included in the tvb in the struct.
47 * the meta data is in TLV form, at least one tag MUST indicate what protocol is
51 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
52 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 * | Option Code | Option Length |
54 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
56 * / variable length, aligned to 32 bits /
57 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59 * / . . . other options . . . /
61 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62 * | Option Code == opt_endofopt | Option Length == 0 |
63 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
66 /* WARNING this is a first draft and tag values can be changed and tags removed
67 * if you want to use this feature outside of Wireshark request a tag freeze
68 * on Wireshark-dev mailing list.
71 #define EXP_PDU_TAG_END_OF_OPT 0 /**< End-of-options Tag. */
73 #define EXP_PDU_TAG_OPTIONS_LENGTH 10 /**< Total length of the options excluding this TLV */
74 #define EXP_PDU_TAG_LINKTYPE 11 /**< The value part is the linktype value defined by tcpdump
75 * http://www.tcpdump.org/linktypes.html
77 #define EXP_PDU_TAG_PROTO_NAME 12 /**< The value part should be an ASCII non NULL terminated string
78 * of the short protocol name used by Wireshark e.g "sip"
79 * Will be used to call the next dissector.
81 /* Add protocol type related tags here NOTE Only one protocol type tag may be present in a packet, the first one found will be used*/
82 /* 13 - 19 reserved */
83 #define EXP_PDU_TAG_IPV4_SRC 20
84 #define EXP_PDU_TAG_IPV4_DST 21
85 #define EXP_PDU_TAG_IPV6_SRC 22
86 #define EXP_PDU_TAG_IPV6_DST 23
88 #define EXP_PDU_TAG_PORT_TYPE 24
89 #define EXP_PDU_TAG_SRC_PORT 25
90 #define EXP_PDU_TAG_DST_PORT 26
92 #define EXP_PDU_TAG_SCTP_PPID 27
94 #define EXP_PDU_TAG_SS7_OPC 28
95 #define EXP_PDU_TAG_SS7_DPC 29
97 #define EXP_PDU_TAG_ORIG_FNO 30
99 #define EXP_PDU_TAG_DVBCI_EVT 31
102 typedef struct _exp_pdu_data_t
{
109 #define EXP_PDU_TAG_IP_SRC_BIT 0x00000001
110 #define EXP_PDU_TAG_IP_DST_BIT 0x00000002
112 #define EXP_PDU_TAG_SRC_PORT_BIT 0x00000004
113 #define EXP_PDU_TAG_DST_PORT_BIT 0x00000008
115 #define EXP_PDU_TAG_SCTP_PPID_BIT 0x00000010
117 #define EXP_PDU_TAG_SS7_OPC_BIT 0x00000020
118 #define EXP_PDU_TAG_SS7_DPC_BIT 0x00000040
120 #define EXP_PDU_TAG_ORIG_FNO_BIT 0x00000080
122 #define EXP_PDU_TAG_DVBCI_EVT_BIT 0x00000100
124 #define EXP_PDU_TAG_IPV4_SRC_LEN 4
125 #define EXP_PDU_TAG_IPV4_DST_LEN 4
126 #define EXP_PDU_TAG_IPV6_SRC_LEN 16
127 #define EXP_PDU_TAG_IPV6_DST_LEN 16
129 #define EXP_PDU_TAG_PORT_TYPE_LEN 4
130 #define EXP_PDU_TAG_SRC_PORT_LEN 4
131 #define EXP_PDU_TAG_DST_PORT_LEN 4
133 #define EXP_PDU_TAG_SCTP_PPID_LEN 4
135 #define EXP_PDU_TAG_SS7_OPC_LEN 8 /* 4 bytes PC, 2 bytes standard type, 1 byte NI, 1 byte padding */
136 #define EXP_PDU_TAG_SS7_DPC_LEN 8 /* 4 bytes PC, 2 bytes standard type, 1 byte NI, 1 byte padding */
138 #define EXP_PDU_TAG_ORIG_FNO_LEN 4
140 #define EXP_PDU_TAG_DVBCI_EVT_LEN 1
143 * Allocates and fills the exp_pdu_data_t struct according to the wanted_exp_tags
144 * bit_fileld, if proto_name is != NULL, wtap_encap must be -1 or vice-versa
146 * The tags in the tag buffer SHOULD be added in numerical order.
148 WS_DLL_PUBLIC exp_pdu_data_t
*load_export_pdu_tags(packet_info
*pinfo
,
149 const char* proto_name
, int wtap_encap
, guint32 wanted_exp_tags
);
151 #endif /* EXPORTED_PDU_H */