1 /* packet-tcap.h 2 * 3 * Copyright 2004, Tim Endean <endeant@hotmail.com> 4 * 5 * Wireshark - Network traffic analyzer 6 * By Gerald Combs <gerald@wireshark.org> 7 * Copyright 1998 Gerald Combs 8 * 9 * SPDX-License-Identifier: GPL-2.0-or-later 10 */ 11 12 13 #ifndef PACKET_tcap_H 14 #define PACKET_tcap_H 15 16 #include "ws_symbol_export.h" 17 18 /* TCAP component type */ 19 #define TCAP_COMP_INVOKE 0xa1 20 #define TCAP_COMP_RRL 0xa2 21 #define TCAP_COMP_RE 0xa3 22 #define TCAP_COMP_REJECT 0xa4 23 #define TCAP_COMP_RRN 0xa7 24 25 26 #define ANSI_TC_INVOKE_L 0xe9 27 #define ANSI_TC_RRL 0xea 28 #define ANSI_TC_RE 0xeb 29 #define ANSI_TC_REJECT 0xec 30 #define ANSI_TC_INVOKE_N 0xed 31 #define ANSI_TC_RRN 0xee 32 33 34 #define TCAP_SEQ_TAG 0x30 35 #define TCAP_SET_TAG 0x31 36 37 #define TCAP_INVOKE_ID_TAG 0x02 38 #define TCAP_LINKED_ID_TAG 0x80 39 40 #define TCAP_EOC_LEN 2 41 42 #define TCAP_CONSTRUCTOR(TCtag) (TCtag & 0x20) 43 44 #define TC_BEGIN 1 45 #define TC_CONT 2 46 #define TC_END 3 47 #define TC_ABORT 4 48 #define TC_ANSI_ABORT 5 49 #define TC_ANSI_ALL 6 50 51 struct tcap_private_t { 52 gboolean acv; /* Is the Application Context Version present */ 53 const void * oid; 54 guint32 session_id; 55 void * context; 56 gchar *TransactionID_str; 57 guint32 src_tid; 58 guint32 dst_tid; 59 }; 60 61 /** @file 62 * lists and hash tables used in wireshark's tcap dissector 63 * for calculation of delays in tcap-calls 64 */ 65 66 #define LENGTH_OID 23 67 struct tcaphash_context_t { 68 struct tcaphash_context_key_t * key; 69 guint32 session_id; 70 guint32 first_frame; 71 guint32 last_frame; 72 nstime_t begin_time; /**< time of arrival of TC_BEGIN */ 73 nstime_t end_time; /**< time of closing message */ 74 gboolean responded; /**< true, if request has been responded */ 75 gboolean closed; 76 gboolean upper_dissector; 77 gboolean oid_present; 78 gchar oid[LENGTH_OID+1]; 79 gboolean subdissector_present; 80 dissector_handle_t subdissector_handle; 81 void (* callback) (tvbuff_t *,packet_info *, proto_tree *, struct tcaphash_context_t *); 82 struct tcaphash_begincall_t * begincall; 83 struct tcaphash_contcall_t * contcall; 84 struct tcaphash_endcall_t * endcall; 85 struct tcaphash_ansicall_t * ansicall; 86 }; 87 88 struct tcaphash_begincall_t { 89 struct tcaphash_begin_info_key_t * beginkey; 90 struct tcaphash_context_t * context; 91 gboolean father; 92 struct tcaphash_begincall_t * next_begincall; 93 struct tcaphash_begincall_t * previous_begincall; 94 }; 95 96 struct tcaphash_contcall_t { 97 struct tcaphash_cont_info_key_t * contkey; 98 struct tcaphash_context_t * context; 99 gboolean father; 100 struct tcaphash_contcall_t * next_contcall; 101 struct tcaphash_contcall_t * previous_contcall; 102 }; 103 104 struct tcaphash_endcall_t { 105 struct tcaphash_end_info_key_t * endkey; 106 struct tcaphash_context_t * context; 107 gboolean father; 108 struct tcaphash_endcall_t * next_endcall; 109 struct tcaphash_endcall_t * previous_endcall; 110 }; 111 112 struct tcaphash_ansicall_t { 113 struct tcaphash_ansi_info_key_t * ansikey; 114 struct tcaphash_context_t * context; 115 gboolean father; 116 struct tcaphash_ansicall_t * next_ansicall; 117 struct tcaphash_ansicall_t * previous_ansicall; 118 }; 119 120 /** The Key for the hash table is the TCAP origine transaction identifier 121 of the TC_BEGIN containing the InitialDP */ 122 123 struct tcaphash_context_key_t { 124 guint32 session_id; 125 }; 126 127 struct tcaphash_begin_info_key_t { 128 guint32 hashKey; 129 guint32 tid; 130 guint32 pc_hash; 131 }; 132 133 struct tcaphash_cont_info_key_t { 134 guint32 hashKey; 135 guint32 src_tid; 136 guint32 dst_tid; 137 guint32 opc_hash; 138 guint32 dpc_hash; 139 }; 140 141 struct tcaphash_end_info_key_t { 142 guint32 hashKey; 143 guint32 tid; 144 guint32 opc_hash; 145 guint32 dpc_hash; 146 }; 147 148 struct tcaphash_ansi_info_key_t { 149 guint32 hashKey; 150 guint32 tid; 151 guint32 opc_hash; 152 guint32 dpc_hash; 153 }; 154 155 156 /** List of infos to store for the analyse */ 157 struct tcapsrt_info_t { 158 guint32 tcap_session_id; 159 guint32 src_tid; 160 guint32 dst_tid; 161 guint8 ope; 162 }; 163 164 /** 165 * Routine called when the TAP is initialized. 166 * so hash table are (re)created 167 */ 168 void tcapsrt_init_routine(void); 169 170 /** 171 * Initialize the Message Info used by the main dissector 172 * Data are linked to a TCAP transaction 173 */ 174 struct tcapsrt_info_t * tcapsrt_razinfo(void); 175 176 void tcapsrt_close(struct tcaphash_context_t * p_tcaphash_context, 177 packet_info * pinfo _U_); 178 179 /** 180 * Service Response Time analyze 181 * Called just after dissector call 182 * Associate a TCAP context to a tcap session and display session related infomations 183 * like the first frame, the last, the session duration, 184 * and a uniq session identifier for the filtering 185 * 186 * For ETSI tcap, the TCAP context can be reached through three keys 187 * - a key (BEGIN) identifying the session according to the tcap source identifier 188 * - a key (CONT) identifying the established session (src_id and dst_id) 189 * - a key (END) identifying the session according to the tcap destination identifier 190 * 191 * For ANSI tcap, the TCAP context is reached through a uniq key 192 * - a key (ANSI) identifying the session according to the tcap identifier 193 */ 194 struct tcaphash_context_t * tcapsrt_call_matching(tvbuff_t *tvb, 195 packet_info * pinfo _U_, 196 proto_tree *tree, 197 struct tcapsrt_info_t * p_tcap_info); 198 199 WS_DLL_PUBLIC gboolean gtcap_StatSRT; 200 201 extern gint tcap_standard; 202 203 extern const value_string tcap_component_type_str[]; 204 void proto_reg_handoff_tcap(void); 205 void proto_register_tcap(void); 206 207 extern dissector_handle_t get_itu_tcap_subdissector(guint32 ssn); 208 dissector_handle_t get_ansi_tcap_subdissector(guint32 ssn); 209 210 extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector); 211 WS_DLL_PUBLIC void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector); 212 213 extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector); 214 WS_DLL_PUBLIC void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector); 215 216 extern void call_tcap_dissector(dissector_handle_t, tvbuff_t*, packet_info*, proto_tree*); 217 218 #include "packet-tcap-exp.h" 219 220 #endif /* PACKET_tcap_H */ 221