diff options
34 files changed, 194 insertions, 651 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index 7a641ee7bc..1d08341ea3 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -96,9 +96,6 @@ libwireshark.so.0 libwireshark0 #MINVER# capture_dissector_get_count@Base 2.1.0 capture_dissector_increment_count@Base 2.1.0 chunk_type_values@Base 2.1.0 - circuit_add_proto_data@Base 1.9.1 - circuit_get_proto_data@Base 1.9.1 - circuit_new@Base 1.9.1 col_add_fstr@Base 1.9.1 col_add_lstr@Base 1.12.0~rc1 col_add_str@Base 1.9.1 @@ -151,9 +148,12 @@ libwireshark.so.0 libwireshark0 #MINVER# column_dump_column_formats@Base 1.12.0~rc1 conv_filter_list@Base 2.0.0 conversation_add_proto_data@Base 1.9.1 + conversation_create_endpoint@Base 2.5.0 + conversation_create_endpoint_by_id@Base 2.5.0 conversation_delete_proto_data@Base 1.9.1 conversation_filter_from_packet@Base 2.2.8 conversation_get_dissector@Base 2.0.0 + conversation_get_endpoint_by_id@Base 2.5.0 conversation_get_html_hash@Base 2.5.0 conversation_get_proto_data@Base 1.9.1 conversation_hash_exact@Base 2.5.0 @@ -162,7 +162,7 @@ libwireshark.so.0 libwireshark0 #MINVER# conversation_key_port1@Base 2.5.0 conversation_key_port2@Base 2.5.0 conversation_new@Base 1.9.1 - conversation_new_simple@Base 2.5.0 + conversation_new_by_id@Base 2.5.0 conversation_pt_to_endpoint_type@Base 2.5.0 conversation_set_dissector@Base 1.9.1 conversation_set_dissector_from_frame_number@Base 2.0.0 @@ -600,9 +600,8 @@ libwireshark.so.0 libwireshark0 #MINVER# filter_expression_new@Base 1.9.1 find_and_mark_frame_depended_upon@Base 1.12.0~rc1 find_capture_dissector@Base 2.3.0 - find_circuit@Base 1.9.1 find_conversation@Base 1.9.1 - find_conversation_simple@Base 2.5.0 + find_conversation_by_id@Base 2.5.0 find_conversation_pinfo@Base 2.5.0 find_conversation_filter@Base 2.0.0 find_depend_dissector_list@Base 2.1.0 diff --git a/epan/.editorconfig b/epan/.editorconfig index d9d8f5cf4f..79a7503f9a 100644 --- a/epan/.editorconfig +++ b/epan/.editorconfig @@ -19,10 +19,6 @@ indent_size = tab [asn1.[ch]] indent_size = 2 -[circuit.[ch]] -indent_style = tab -indent_size = tab - [column-utils.[ch]] indent_size = 2 diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index 7883464090..a4842ca40a 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -68,7 +68,6 @@ set(LIBWIRESHARK_PUBLIC_HEADERS capture_dissectors.h charsets.h chdlctypes.h - circuit.h color_filters.h column.h column-info.h @@ -184,7 +183,6 @@ set(LIBWIRESHARK_FILES asn1.c capture_dissectors.c charsets.c - circuit.c color_filters.c column.c column-utils.c diff --git a/epan/Makefile.am b/epan/Makefile.am index 2d31aa5dd5..eef075df03 100644 --- a/epan/Makefile.am +++ b/epan/Makefile.am @@ -47,7 +47,6 @@ LIBWIRESHARK_SRC = \ asn1.c \ capture_dissectors.c \ charsets.c \ - circuit.c \ color_filters.c \ column.c \ column-utils.c \ @@ -177,7 +176,6 @@ LIBWIRESHARK_INCLUDES_PUBLIC = \ capture_dissectors.h \ charsets.h \ chdlctypes.h \ - circuit.h \ color_filters.h \ column.h \ column-info.h \ diff --git a/epan/address.h b/epan/address.h index 04a353ee4a..74ce102f54 100644 --- a/epan/address.h +++ b/epan/address.h @@ -370,19 +370,6 @@ typedef enum { PT_BLUETOOTH } port_type; -/* Types of circuit IDs Wireshark knows about. */ -typedef enum { - CT_NONE, /* no circuit type */ - CT_DLCI, /* Frame Relay DLCI */ - CT_ISDN, /* ISDN channel number */ - CT_X25, /* X.25 logical channel number */ - CT_ISUP, /* ISDN User Part CIC */ - CT_IAX2, /* IAX2 call id */ - CT_H223, /* H.223 logical channel number */ - CT_BICC /* BICC Circuit identifier */ - /* Could also have ATM VPI/VCI pairs */ -} circuit_type; - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/epan/circuit.c b/epan/circuit.c deleted file mode 100644 index 04e96d05f1..0000000000 --- a/epan/circuit.c +++ /dev/null @@ -1,283 +0,0 @@ -/* circuit.c - * Routines for building lists of packets that are part of a "circuit" - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" - -#include <glib.h> -#include "packet.h" -#include "circuit.h" - -struct circuit_key { - circuit_type ctype; - guint32 circuit_id; -}; - -/* - * Hash table for circuits. - */ -static GHashTable *circuit_hashtable = NULL; - -static guint32 new_index; - -/* - * Compute the hash value for a circuit. - */ -static guint -circuit_hash(gconstpointer v) -{ - const circuit_key_t key = (const circuit_key_t)v; - - return key->ctype ^ key->circuit_id; -} - -/* - * Compare two circuit keys. - */ -static gint -circuit_match(gconstpointer v, gconstpointer w) -{ - const circuit_key_t v1 = (const circuit_key_t)v; - const circuit_key_t v2 = (const circuit_key_t)w; - - return v1->ctype == v2->ctype && v1->circuit_id == v2->circuit_id; -} - -/* - * Destroy all existing circuits. - */ -void -circuit_cleanup(void) -{ - /* - * Free up any space allocated for the circuit hashtable. - * - * We can free the hash as the structures pointed to in the - * hash are in "seasonal" memory which is freed separately. - * Note: circuit_cleanup() must be called only when - * seasonal memory is also freed. - */ - - if (circuit_hashtable != NULL) - g_hash_table_destroy(circuit_hashtable); - - circuit_hashtable = NULL; -} - -/* - * Initialize some variables every time a file is loaded or re-loaded. - * Create a new hash table for the circuits in the new file. - */ -void -circuit_init(void) -{ - g_assert(circuit_hashtable == NULL); - circuit_hashtable = g_hash_table_new(circuit_hash, circuit_match); - - /* - * Start the circuit indices over at 0. - */ - new_index = 0; -} - -/* - * Given a circuit type and circuit ID for a packet, create a new circuit - * to contain packets for that circuit. - */ -circuit_t * -circuit_new(circuit_type ctype, guint32 circuit_id, guint32 first_frame) -{ - circuit_t *circuit, *old_circuit; - circuit_key_t new_key; - - new_key = wmem_new(wmem_file_scope(), struct circuit_key); - new_key->ctype = ctype; - new_key->circuit_id = circuit_id; - - circuit = wmem_new(wmem_file_scope(), circuit_t); - circuit->next = NULL; - circuit->first_frame = first_frame; - circuit->last_frame = 0; /* not known yet */ - circuit->circuit_index = new_index; - circuit->data_list = NULL; - circuit->dissector_tree = wmem_tree_new(wmem_file_scope()); - circuit->key_ptr = new_key; - - new_index++; - - /* - * Is there already a circuit with this circuit ID? - */ - old_circuit = (circuit_t *)g_hash_table_lookup(circuit_hashtable, new_key); - if (old_circuit != NULL) { - /* - * Yes. Find the last circuit in the list of circuits - * with this circuit ID, and if its last frame isn't - * known, make it be the previous frame to this one. - */ - while (old_circuit->next != NULL) - old_circuit = old_circuit->next; - if (old_circuit->last_frame == 0) - old_circuit->last_frame = first_frame - 1; - - /* - * Now put the new circuit after the last one in the - * list. - */ - old_circuit->next = circuit; - } else { - /* - * No. This is the first one with this circuit ID; add - * it to the hash table. - */ - g_hash_table_insert(circuit_hashtable, new_key, circuit); - } - - return circuit; -} - -/* - * Given a circuit type and ID, and a frame number, search for a circuit with - * that type and ID whose range of frames includes that frame number. - * Returns NULL if not found. - */ -circuit_t * -find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame) -{ - struct circuit_key key; - circuit_t *circuit; - - key.ctype = ctype; - key.circuit_id = circuit_id; - - /* - * OK, search the list of circuits with that type and ID for - * a circuit whose range of frames includes that frame number. - */ - for (circuit = (circuit_t *)g_hash_table_lookup(circuit_hashtable, &key); - circuit != NULL; circuit = circuit->next) { - /* - * The circuit includes that frame number if: - * - * the circuit's first frame is unknown or is at or - * before that frame - * - * and - * - * the circuit's last frame is unknown or is at or - * after that frame. - */ - if ((circuit->first_frame == 0 || circuit->first_frame <= frame) - && (circuit->last_frame == 0 || circuit->last_frame >= frame)) - break; - } - return circuit; -} - -/* - * Set the last frame of a circuit, if it's not already known, - * "closing" the circuit. - */ -void -close_circuit(circuit_t *circuit, guint32 last_frame) -{ - if (circuit->last_frame == 0) - circuit->last_frame = last_frame; -} - -void -circuit_add_proto_data(circuit_t *conv, int proto, void *proto_data) -{ - /* Add it to the list of items for this conversation. */ - if (conv->data_list == NULL) - conv->data_list = wmem_tree_new(wmem_file_scope()); - - wmem_tree_insert32(conv->data_list, proto, proto_data); -} - -void * -circuit_get_proto_data(circuit_t *conv, int proto) -{ - /* No tree created yet */ - if (conv->data_list == NULL) - return NULL; - - return wmem_tree_lookup32(conv->data_list, proto); -} - -void -circuit_delete_proto_data(circuit_t *conv, int proto) -{ - if (conv->data_list != NULL) - wmem_tree_remove32(conv->data_list, proto); -} - -void -circuit_set_dissector(circuit_t *circuit, dissector_handle_t handle) -{ - wmem_tree_insert32(circuit->dissector_tree, 0, (void *)handle); -} - -dissector_handle_t -circuit_get_dissector(circuit_t *circuit) -{ - if (circuit == NULL) - return NULL; - - return (dissector_handle_t)wmem_tree_lookup32_le(circuit->dissector_tree, 0); -} - -/* - * Given a circuit type and ID for a packet, search for a matching - * circuit and, if found and it has a circuit dissector, - * call that dissector and return TRUE, otherwise return FALSE. - */ -gboolean -try_circuit_dissector(circuit_type ctype, guint32 circuit_id, guint32 frame, - tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) -{ - circuit_t *circuit; - dissector_handle_t handle; - - circuit = find_circuit(ctype, circuit_id, frame); - - if (circuit != NULL) { - handle = circuit_get_dissector(circuit); - if (handle == NULL) - return FALSE; - call_dissector_with_data(handle, tvb, pinfo, tree, data); - return TRUE; - } - return FALSE; -} - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 8 - * tab-width: 8 - * indent-tabs-mode: t - * End: - * - * vi: set shiftwidth=8 tabstop=8 noexpandtab: - * :indentSize=8:tabSize=8:noTabs=false: - */ diff --git a/epan/circuit.h b/epan/circuit.h deleted file mode 100644 index a11247f492..0000000000 --- a/epan/circuit.h +++ /dev/null @@ -1,112 +0,0 @@ -/* circuit.h - * Routines for building lists of packets that are part of a "circuit" - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __CIRCUIT_H__ -#define __CIRCUIT_H__ - -#include "packet.h" /* for circuit dissector type */ -#include "ws_symbol_export.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * Data structure representing a circuit. - */ -struct circuit_key; -typedef struct circuit_key* circuit_key_t; - -typedef struct circuit { - struct circuit *next; /**< pointer to next circuit with given circuit ID */ - guint32 first_frame; /**< # of first frame for that circuit */ - guint32 last_frame; /**< # of last frame for that circuit */ - guint32 circuit_index; /**< unique ID for circuit */ - wmem_tree_t *data_list; /**< list of data associated with circuit */ - wmem_tree_t *dissector_tree; /** tree containing protocol dissector client associated with circuit */ - guint options; /**< wildcard flags */ - circuit_key_t key_ptr; /**< pointer to the key for this circuit */ -} circuit_t; - -/** - * Destroy all existing circuits. - */ -extern void circuit_cleanup(void); - -/** - * Initialize some variables every time a file is loaded or re-loaded. - * Create a new hash table for the circuits in the new file. - */ -extern void circuit_init(void); - -/** - * Given a circuit type and circuit ID for a packet, create a new circuit - * to contain packets for that circuit. - */ -WS_DLL_PUBLIC circuit_t *circuit_new(circuit_type ctype, guint32 circuit_id, guint32 first_frame); - -/** - * Given a circuit type and ID, and a frame number, search for a circuit with - * that type and ID whose range of frames includes that frame number. - * Returns NULL if not found. - */ -WS_DLL_PUBLIC circuit_t *find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame); - -/** - * Set the last frame of a circuit, if it's not already known, - * "closing" the circuit. - */ -extern void close_circuit(circuit_t *circuit, guint32 last_frame); - -WS_DLL_PUBLIC void circuit_add_proto_data(circuit_t *conv, int proto, void *proto_data); -WS_DLL_PUBLIC void *circuit_get_proto_data(circuit_t *conv, int proto); -void circuit_delete_proto_data(circuit_t *conv, int proto); - -extern void circuit_set_dissector(circuit_t *circuit, dissector_handle_t handle); -extern dissector_handle_t circuit_get_dissector(circuit_t *circuit); - -/** - * Given a circuit type and ID for a packet, search for a matching - * circuit and, if found and it has a circuit dissector, - * call that dissector and return TRUE, otherwise return FALSE. - */ -extern gboolean -try_circuit_dissector(circuit_type ctype, guint32 circuit_id, guint32 frame, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* circuit.h */ - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 8 - * tab-width: 8 - * indent-tabs-mode: t - * End: - * - * vi: set shiftwidth=8 tabstop=8 noexpandtab: - * :indentSize=8:tabSize=8:noTabs=false: - */ diff --git a/epan/conversation.c b/epan/conversation.c index a7442ec6e4..aac4adc747 100644 --- a/epan/conversation.c +++ b/epan/conversation.c @@ -681,10 +681,10 @@ conversation_new(const guint32 setup_frame, const address *addr1, const address return conversation; } -conversation_t *conversation_new_simple(const guint32 setup_frame, const endpoint_type etype, const guint32 port1, const guint options) +conversation_t *conversation_new_by_id(const guint32 setup_frame, const endpoint_type etype, const guint32 id, const guint options) { /* Force the lack of an address or port 2 */ - return conversation_new(setup_frame, NULL, NULL, etype, port1, 0, options | NO_ADDR2 | NO_PORT2); + return conversation_new(setup_frame, NULL, NULL, etype, id, 0, options | NO_ADDR2 | NO_PORT2); } /* @@ -1187,10 +1187,10 @@ find_conversation(const guint32 frame_num, const address *addr_a, const address return NULL; } -conversation_t *find_conversation_simple(const guint32 frame, const endpoint_type etype, const guint32 port1, const guint options) +conversation_t *find_conversation_by_id(const guint32 frame, const endpoint_type etype, const guint32 id, const guint options) { /* Force the lack of a address or port B */ - return find_conversation(frame, NULL, NULL, etype, port1, 0, options|NO_ADDR_B|NO_PORT_B); + return find_conversation(frame, NULL, NULL, etype, id, 0, options|NO_ADDR_B|NO_PORT_B); } void @@ -1278,12 +1278,12 @@ try_conversation_dissector(const address *addr_a, const address *addr_b, const e } gboolean -try_conversation_dissector_simple(const endpoint_type etype, const guint32 port_a, tvbuff_t *tvb, +try_conversation_dissector_by_id(const endpoint_type etype, const guint32 id, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { conversation_t *conversation; - conversation = find_conversation_simple(pinfo->num, etype, port_a, 0); + conversation = find_conversation_by_id(pinfo->num, etype, id, 0); if (conversation != NULL) { int ret; @@ -1321,7 +1321,7 @@ find_conversation_pinfo(packet_info *pinfo, const guint options) DISSECTOR_ASSERT(pinfo->conv_endpoint); if((conv = find_conversation(pinfo->num, &pinfo->conv_endpoint->addr1, &pinfo->conv_endpoint->addr2, pinfo->conv_endpoint->etype, pinfo->conv_endpoint->port1, - pinfo->conv_endpoint->port2, options)) != NULL) { + pinfo->conv_endpoint->port2, pinfo->conv_endpoint->options)) != NULL) { DPRINT(("found previous conversation for frame #%d (last_frame=%d)", pinfo->num, conv->last_frame)); if (pinfo->num > conv->last_frame) { @@ -1389,6 +1389,25 @@ void conversation_create_endpoint(struct _packet_info *pinfo, address* addr1, ad pinfo->conv_endpoint->options = options; } +void conversation_create_endpoint_by_id(struct _packet_info *pinfo, + endpoint_type etype, guint32 id, const guint options) +{ + /* Force the lack of a address or port B */ + conversation_create_endpoint(pinfo, NULL, NULL, etype, id, 0, options|NO_ADDR_B|NO_PORT_B); +} + +guint32 conversation_get_endpoint_by_id(struct _packet_info *pinfo, endpoint_type etype, const guint options) +{ + if (pinfo->conv_endpoint == NULL) + return 0; + + if ((pinfo->conv_endpoint->etype != etype) && + ((options & USE_LAST_ENDPOINT) != USE_LAST_ENDPOINT)) + return 0; + + return pinfo->conv_endpoint->port1; +} + wmem_map_t * get_conversation_hashtable_exact(void) { diff --git a/epan/conversation.h b/epan/conversation.h index 30c254d31d..44cf276dac 100644 --- a/epan/conversation.h +++ b/epan/conversation.h @@ -55,6 +55,9 @@ extern "C" { #define NO_ADDR_B 0x01 #define NO_PORT_B 0x02 +/* Flags to handle endpoints */ +#define USE_LAST_ENDPOINT 0x08 /* Use last endpoint created, regardless of type */ + #include "packet.h" /* for conversation dissector type */ /* Types of port numbers Wireshark knows about. */ @@ -78,7 +81,15 @@ typedef enum { ENDPOINT_TDMOP, ENDPOINT_DVBCI, ENDPOINT_ISO14443, - ENDPOINT_ISDN /* ISDN channel number */ + ENDPOINT_ISDN, /* ISDN channel number */ + ENDPOINT_H223, /* H.223 logical channel number */ + ENDPOINT_X25, /* X.25 logical channel number */ + ENDPOINT_IAX2, /* IAX2 call id */ + ENDPOINT_DLCI, /* Frame Relay DLCI */ + ENDPOINT_ISUP, /* ISDN User Part CIC */ + ENDPOINT_BICC, /* BICC Circuit identifier */ + ENDPOINT_GSMTAP, + ENDPOINT_IUUP } endpoint_type; /** @@ -133,7 +144,7 @@ extern void conversation_epan_reset(void); WS_DLL_PUBLIC conversation_t *conversation_new(const guint32 setup_frame, const address *addr1, const address *addr2, const endpoint_type etype, const guint32 port1, const guint32 port2, const guint options); -WS_DLL_PUBLIC conversation_t *conversation_new_simple(const guint32 setup_frame, const endpoint_type etype, const guint32 port1, const guint options); +WS_DLL_PUBLIC conversation_t *conversation_new_by_id(const guint32 setup_frame, const endpoint_type etype, const guint32 id, const guint options); /** * Given two address/port pairs for a packet, search for a conversation @@ -174,7 +185,7 @@ WS_DLL_PUBLIC conversation_t *conversation_new_simple(const guint32 setup_frame, WS_DLL_PUBLIC conversation_t *find_conversation(const guint32 frame_num, const address *addr_a, const address *addr_b, const endpoint_type etype, const guint32 port_a, const guint32 port_b, const guint options); -WS_DLL_PUBLIC conversation_t *find_conversation_simple(const guint32 frame, const endpoint_type etype, const guint32 port1, const guint options); +WS_DLL_PUBLIC conversation_t *find_conversation_by_id(const guint32 frame, const endpoint_type etype, const guint32 id, const guint options); /** A helper function that calls find_conversation() using data from pinfo * The frame number and addresses are taken from pinfo. @@ -206,6 +217,12 @@ WS_DLL_PUBLIC dissector_handle_t conversation_get_dissector(conversation_t *conv WS_DLL_PUBLIC void conversation_create_endpoint(struct _packet_info *pinfo, address* addr1, address* addr2, endpoint_type etype, guint32 port1, guint32 port2, const guint options); +WS_DLL_PUBLIC void conversation_create_endpoint_by_id(struct _packet_info *pinfo, + endpoint_type etype, guint32 id, const guint options); + +WS_DLL_PUBLIC guint32 conversation_get_endpoint_by_id(struct _packet_info *pinfo, + endpoint_type etype, const guint options); + /** * Given two address/port pairs for a packet, search for a matching * conversation and, if found and it has a conversation dissector, @@ -222,7 +239,7 @@ try_conversation_dissector(const address *addr_a, const address *addr_b, const e proto_tree *tree, void* data); extern gboolean -try_conversation_dissector_simple(const endpoint_type etype, const guint32 port_a, tvbuff_t *tvb, +try_conversation_dissector_by_id(const endpoint_type etype, const guint32 id, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); /* These routines are used to set undefined values for a conversation */ diff --git a/epan/dissectors/asn1/h245/h245.cnf b/epan/dissectors/asn1/h245/h245.cnf index 2fd5aef742..2dabaaf9ff 100644 --- a/epan/dissectors/asn1/h245/h245.cnf +++ b/epan/dissectors/asn1/h245/h245.cnf @@ -55,7 +55,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format h223_mc = 0; %(DEFAULT_BODY)s if(h223_set_mc_handle) - (*h223_set_mc_handle)(%(ACTX)s->pinfo, h223_mc, h223_me, %(ACTX)s->pinfo->ctype, %(ACTX)s->pinfo->circuit_id); + (*h223_set_mc_handle)(%(ACTX)s->pinfo, h223_mc, h223_me); /* stuff */ #.END #---------------------------------------------------------------------------------------- @@ -240,9 +240,9 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format DISSECTOR_ASSERT( ( h223_rev_lc_num && pend->rev_channel_params) || (!h223_rev_lc_num && !pend->rev_channel_params) ); if(h223_add_lc_handle) { - (*h223_add_lc_handle)( %(ACTX)s->pinfo, h223_fw_lc_num, pend->fw_channel_params, %(ACTX)s->pinfo->ctype, %(ACTX)s->pinfo->circuit_id ); + (*h223_add_lc_handle)( %(ACTX)s->pinfo, h223_fw_lc_num, pend->fw_channel_params); if(h223_rev_lc_num) - (*h223_add_lc_handle)( %(ACTX)s->pinfo, h223_rev_lc_num, pend->rev_channel_params, %(ACTX)s->pinfo->ctype, %(ACTX)s->pinfo->circuit_id ); + (*h223_add_lc_handle)( %(ACTX)s->pinfo, h223_rev_lc_num, pend->rev_channel_params); } } else { /* we missed the OpenLogicalChannel packet */ diff --git a/epan/dissectors/asn1/h245/packet-h245-template.h b/epan/dissectors/asn1/h245/packet-h245-template.h index e83ee44505..d07408eea6 100644 --- a/epan/dissectors/asn1/h245/packet-h245-template.h +++ b/epan/dissectors/asn1/h245/packet-h245-template.h @@ -116,10 +116,10 @@ struct _h223_mux_element { #include <epan/packet_info.h> #include <epan/dissectors/packet-per.h> -typedef void (*h223_set_mc_handle_t) ( packet_info* pinfo, guint8 mc, h223_mux_element* me, circuit_type ctype, guint32 circuit_id ); +typedef void (*h223_set_mc_handle_t) ( packet_info* pinfo, guint8 mc, h223_mux_element* me); WS_DLL_PUBLIC void h245_set_h223_set_mc_handle( h223_set_mc_handle_t handle ); -typedef void (*h223_add_lc_handle_t) ( packet_info* pinfo, guint16 lc, h223_lc_params* params, circuit_type ctype, guint32 circuit_id ); +typedef void (*h223_add_lc_handle_t) ( packet_info* pinfo, guint16 lc, h223_lc_params* params); WS_DLL_PUBLIC void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle ); #include "packet-h245-exp.h" diff --git a/epan/dissectors/packet-dvbci.c b/epan/dissectors/packet-dvbci.c index b18f049516..8b65967fce 100644 --- a/epan/dissectors/packet-dvbci.c +++ b/epan/dissectors/packet-dvbci.c @@ -4322,7 +4322,7 @@ dissect_dvbci_spdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; } col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Session opened"); - conv = conversation_new_simple(pinfo->num, ENDPOINT_DVBCI, CT_ID(ssnb, tcid), 0); + conv = conversation_new_by_id(pinfo->num, ENDPOINT_DVBCI, CT_ID(ssnb, tcid), 0); /* we always add the resource id immediately after the circuit was created */ conversation_add_proto_data(conv, proto_dvbci, GUINT_TO_POINTER(res_id)); @@ -4343,7 +4343,7 @@ dissect_dvbci_spdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ssnb = tvb_get_ntohs(tvb, offset+1); proto_tree_add_item(sess_tree, hf_dvbci_sess_nb, tvb, offset+1, 2, ENC_BIG_ENDIAN); - conv = find_conversation_simple(pinfo->num, ENDPOINT_DVBCI, CT_ID(ssnb, tcid), 0); + conv = find_conversation_by_id(pinfo->num, ENDPOINT_DVBCI, CT_ID(ssnb, tcid), 0); if (conv) conv->last_frame = pinfo->num; break; @@ -4360,7 +4360,7 @@ dissect_dvbci_spdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (ssnb && !conv) - conv = find_conversation_simple(pinfo->num, ENDPOINT_DVBCI, CT_ID(ssnb, tcid), 0); + conv = find_conversation_by_id(pinfo->num, ENDPOINT_DVBCI, CT_ID(ssnb, tcid), 0); /* if the packet contains no resource id, we add the cached id from the circuit so that each packet has a resource id that can be diff --git a/epan/dissectors/packet-fr.c b/epan/dissectors/packet-fr.c index d35d0827b7..58cd2625bd 100644 --- a/epan/dissectors/packet-fr.c +++ b/epan/dissectors/packet-fr.c @@ -38,6 +38,7 @@ #include <epan/capture_dissectors.h> #include <epan/prefs.h> #include <epan/expert.h> +#include <epan/conversation.h> #include <wiretap/wtap.h> #include "packet-llc.h" @@ -507,9 +508,7 @@ dissect_fr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint(fr_tree, hf_fr_dlci, tvb, 0, offset, addr); } - pinfo->ctype = CT_DLCI; - pinfo->circuit_id = addr; - + conversation_create_endpoint_by_id(pinfo, ENDPOINT_DLCI, addr, 0); col_add_fstr(pinfo->cinfo, COL_INFO, "DLCI %u", addr); } diff --git a/epan/dissectors/packet-gsmtap.c b/epan/dissectors/packet-gsmtap.c index 1a44e8954e..c8a1c718fb 100644 --- a/epan/dissectors/packet-gsmtap.c +++ b/epan/dissectors/packet-gsmtap.c @@ -45,6 +45,7 @@ #include "config.h" #include <epan/packet.h> +#include <epan/conversation.h> #include "packet-gsmtap.h" #include "packet-lapdm.h" @@ -501,7 +502,7 @@ dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ /* Try to build an identifier of different 'streams' */ /* (AFCN _cant_ be used because of hopping */ - pinfo->circuit_id = (timeslot << 3) | subslot; + conversation_create_endpoint_by_id(pinfo, ENDPOINT_GSMTAP, (timeslot << 3) | subslot, 0); if (tree) { guint8 channel; diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c index e6805c201b..60c3eecb6c 100644 --- a/epan/dissectors/packet-h223.c +++ b/epan/dissectors/packet-h223.c @@ -25,7 +25,6 @@ #include <epan/packet.h> -#include <epan/circuit.h> #include <epan/conversation.h> #include <epan/exceptions.h> #include <epan/expert.h> @@ -405,19 +404,19 @@ static void init_logical_channel( guint32 start_frame, h223_call_info* call_info, int vc, int direction, h223_lc_params* params ) { guint32 circuit_id = circuit_chain_lookup(call_info, vc); - circuit_t *subcircuit; + conversation_t *subcircuit; h223_vc_info *vc_info; - subcircuit = find_circuit( CT_H223, circuit_id, start_frame ); + subcircuit = find_conversation_by_id( start_frame, ENDPOINT_H223, circuit_id, 0); if( subcircuit == NULL ) { - subcircuit = circuit_new( CT_H223, circuit_id, start_frame ); + subcircuit = conversation_new_by_id( start_frame, ENDPOINT_H223, circuit_id, 0 ); #ifdef DEBUG_H223 g_debug("%d: Created new circuit %d for call %p VC %d", start_frame, circuit_id, call_info, vc); #endif vc_info = h223_vc_info_new( call_info ); - circuit_add_proto_data( subcircuit, proto_h223, vc_info ); + conversation_add_proto_data( subcircuit, proto_h223, vc_info ); } else { - vc_info = (h223_vc_info *)circuit_get_proto_data( subcircuit, proto_h223 ); + vc_info = (h223_vc_info *)conversation_get_proto_data( subcircuit, proto_h223 ); } add_h223_lc_params( vc_info, direction, params, start_frame ); } @@ -450,17 +449,17 @@ create_call_info( guint32 start_frame ) /* find or create call_info struct for calls over circuits (eg, IAX) */ static h223_call_info * -find_or_create_call_info_circ(packet_info * pinfo, circuit_type ctype, guint32 circuit_id) +find_or_create_call_info_circ(packet_info * pinfo, endpoint_type etype, guint32 circuit_id) { h223_call_info *datax; - circuit_t *circ = NULL; + conversation_t *circ = NULL; - if(ctype != CT_NONE) - circ = find_circuit( ctype, circuit_id, pinfo->num ); + if(etype != ENDPOINT_NONE) + circ = find_conversation_by_id( pinfo->num, etype, circuit_id, 0); if(circ == NULL) return NULL; - datax = (h223_call_info *)circuit_get_proto_data(circ, proto_h223); + datax = (h223_call_info *)conversation_get_proto_data(circ, proto_h223); if( datax == NULL ) { datax = create_call_info(pinfo->num); @@ -469,7 +468,7 @@ find_or_create_call_info_circ(packet_info * pinfo, circuit_type ctype, guint32 c g_debug("%u: Created new call %p for circuit %p ctype %d, id %u", pinfo->num, datax, circ, type, circuit_id); #endif - circuit_add_proto_data(circ, proto_h223, datax); + conversation_add_proto_data(circ, proto_h223, datax); } /* work out what direction we're really going in */ @@ -555,11 +554,11 @@ find_or_create_call_info_conv(packet_info * pinfo) } static h223_call_info * -find_or_create_call_info ( packet_info * pinfo, circuit_type ctype, guint32 circuit_id ) +find_or_create_call_info ( packet_info * pinfo, endpoint_type etype, guint32 circuit_id ) { h223_call_info *datax; - datax = find_or_create_call_info_circ(pinfo, ctype, circuit_id); + datax = find_or_create_call_info_circ(pinfo, etype, circuit_id); if(datax == NULL) datax = find_or_create_call_info_conv(pinfo); return datax; @@ -567,30 +566,30 @@ find_or_create_call_info ( packet_info * pinfo, circuit_type ctype, guint32 circ /* called from the h245 dissector to handle a MultiplexEntrySend message */ static void -h223_set_mc( packet_info* pinfo, guint8 mc, h223_mux_element* me, circuit_type ctype, guint32 circuit_id ) +h223_set_mc( packet_info* pinfo, guint8 mc, h223_mux_element* me) { - circuit_t *circ = find_circuit( ctype, circuit_id, pinfo->num ); + conversation_t *circ = find_conversation_pinfo( pinfo, 0 ); h223_vc_info* vc_info; /* if this h245 pdu packet came from an h223 circuit, add the details on * the new mux entry */ if(circ) { - vc_info = (h223_vc_info *)circuit_get_proto_data(circ, proto_h223); + vc_info = (h223_vc_info *)conversation_get_proto_data(circ, proto_h223); add_h223_mux_element( &(vc_info->call_info->direction_data[pinfo->p2p_dir ? 0 : 1]), mc, me, pinfo->num ); } } /* called from the h245 dissector to handle an OpenLogicalChannelAck message */ static void -h223_add_lc( packet_info* pinfo, guint16 lc, h223_lc_params* params, circuit_type ctype, guint32 circuit_id ) +h223_add_lc( packet_info* pinfo, guint16 lc, h223_lc_params* params ) { - circuit_t *circ = find_circuit( ctype, circuit_id, pinfo->num ); + conversation_t *circ = find_conversation_pinfo( pinfo, 0 ); h223_vc_info* vc_info; /* if this h245 pdu packet came from an h223 circuit, add the details on * the new channel */ if(circ) { - vc_info = (h223_vc_info *)circuit_get_proto_data(circ, proto_h223); + vc_info = (h223_vc_info *)conversation_get_proto_data(circ, proto_h223); init_logical_channel( pinfo->num, vc_info->call_info, lc, pinfo->p2p_dir, params ); } } @@ -732,32 +731,27 @@ static void dissect_mux_sdu_fragment(tvbuff_t *volatile next_tvb, packet_info *pinfo, guint32 pkt_offset, proto_tree *pdu_tree, h223_call_info* call_info, guint16 vc, - gboolean end_of_mux_sdu, circuit_type orig_ctype, guint32 orig_circuit) + gboolean end_of_mux_sdu, endpoint_type orig_etype, guint32 orig_circuit) { /* update the circuit details before passing to a subdissector */ - circuit_type ctype = CT_H223; - /* XXX - Not sure if these need to be saved */ - pinfo->circuit_id = circuit_chain_lookup(call_info, vc); - pinfo->ctype = ctype; + guint32 circuit_id = circuit_chain_lookup(call_info, vc); + conversation_create_endpoint_by_id(pinfo, ENDPOINT_H223, circuit_id, 0); TRY { - guint32 circuit_id = pinfo->circuit_id; - circuit_t *subcircuit=find_circuit(ctype,circuit_id,pinfo->num); - proto_tree *vc_tree = NULL; + conversation_t *subcircuit = find_conversation_by_id(pinfo->num, ENDPOINT_H223, circuit_id, 0); + proto_tree *vc_tree; proto_item *vc_item; h223_vc_info *vc_info = NULL; h223_lc_params *lc_params = NULL; - if(pdu_tree) { - vc_item = proto_tree_add_uint(pdu_tree, hf_h223_mux_vc, next_tvb, 0, tvb_reported_length(next_tvb), vc); - vc_tree = proto_item_add_subtree (vc_item, ett_h223_mux_vc); - } + vc_item = proto_tree_add_uint(pdu_tree, hf_h223_mux_vc, next_tvb, 0, tvb_reported_length(next_tvb), vc); + vc_tree = proto_item_add_subtree (vc_item, ett_h223_mux_vc); if( subcircuit == NULL ) { g_message( "Frame %d: Subcircuit id %d not found for call %p VC %d", pinfo->num, circuit_id, (void *)call_info, vc ); } else { - vc_info = (h223_vc_info *)circuit_get_proto_data(subcircuit, proto_h223); + vc_info = (h223_vc_info *)conversation_get_proto_data(subcircuit, proto_h223); if( vc_info != NULL ) { lc_params = find_h223_lc_params( vc_info, pinfo->p2p_dir, pinfo->num ); } @@ -769,9 +763,9 @@ dissect_mux_sdu_fragment(tvbuff_t *volatile next_tvb, packet_info *pinfo, stream_t *substream; stream_pdu_fragment_t *frag; - substream = find_stream_circ(subcircuit,pinfo->p2p_dir); + substream = find_stream_conv(subcircuit,pinfo->p2p_dir); if(substream == NULL ) - substream = stream_new_circ(subcircuit,pinfo->p2p_dir); + substream = stream_new_conv(subcircuit,pinfo->p2p_dir); frag = stream_find_frag(substream,pinfo->num,pkt_offset); if(frag == NULL ) { @@ -808,8 +802,7 @@ dissect_mux_sdu_fragment(tvbuff_t *volatile next_tvb, packet_info *pinfo, /* restore the original circuit details for future PDUs */ FINALLY { - pinfo->ctype=orig_ctype; - pinfo->circuit_id=orig_circuit; + conversation_create_endpoint_by_id(pinfo, orig_etype, orig_circuit, 0); } ENDTRY; } @@ -851,7 +844,7 @@ dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, proto_tree *pdu_tree, h223_call_info* call_info, h223_mux_element *me, guint32 offset, - gboolean endOfMuxSdu, circuit_type ctype, guint32 circuit_id) + gboolean endOfMuxSdu, endpoint_type etype, guint32 circuit_id) { guint32 len = tvb_reported_length(tvb); guint32 frag_len; @@ -864,12 +857,12 @@ dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo, offset + sublist_len <= len; offset = dissect_mux_payload_by_me_list( tvb, pinfo, pkt_offset, pdu_tree, call_info, me->sublist, offset, endOfMuxSdu, - ctype, circuit_id) ); + etype, circuit_id) ); } else { for(i = 0; i < me->repeat_count; ++i) offset = dissect_mux_payload_by_me_list( tvb, pinfo, pkt_offset, pdu_tree, call_info, me->sublist, offset, endOfMuxSdu, - ctype, circuit_id); + etype, circuit_id); } } else { if ( me->repeat_count == 0 ) @@ -881,7 +874,7 @@ dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo, next_tvb = tvb_new_subset_length(tvb, offset, frag_len); dissect_mux_sdu_fragment( next_tvb, pinfo, pkt_offset + offset, pdu_tree, call_info, me->vc, (offset+frag_len==len) && endOfMuxSdu, - ctype, circuit_id); + etype, circuit_id); offset += frag_len; } } @@ -905,14 +898,14 @@ dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo, static void dissect_mux_payload( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, proto_tree *pdu_tree, h223_call_info *call_info, - guint8 mc, gboolean endOfMuxSdu, circuit_type ctype, guint32 circuit_id ) + guint8 mc, gboolean endOfMuxSdu, endpoint_type etype, guint32 circuit_id ) { guint32 len = tvb_reported_length(tvb); h223_mux_element* me = find_h223_mux_element( &(call_info->direction_data[pinfo->p2p_dir ? 0 : 1]), mc, pinfo->num, pkt_offset ); if( me ) { - dissect_mux_payload_by_me_list( tvb, pinfo, pkt_offset, pdu_tree, call_info, me, 0, endOfMuxSdu, ctype, circuit_id ); + dissect_mux_payload_by_me_list( tvb, pinfo, pkt_offset, pdu_tree, call_info, me, 0, endOfMuxSdu, etype, circuit_id ); } else { /* no entry found in mux-table. ignore packet and dissect as data */ proto_tree *vc_tree = NULL; @@ -939,7 +932,7 @@ dissect_mux_payload( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, */ static void dissect_mux_pdu( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, - proto_tree *h223_tree, h223_call_info *call_info, circuit_type ctype, guint32 circuit_id) + proto_tree *h223_tree, h223_call_info *call_info, endpoint_type etype, guint32 circuit_id) { guint32 offset = 0; /* actual (as opposed to reported) payload len */ @@ -1055,7 +1048,7 @@ dissect_mux_pdu( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, if(mpl > 0) { pdu_tvb = tvb_new_subset_length_caplen(tvb, offset, len, mpl); if(errors != -1) { - dissect_mux_payload(pdu_tvb,pinfo,pkt_offset+offset,pdu_tree,call_info,mc,end_of_mux_sdu, ctype, circuit_id); + dissect_mux_payload(pdu_tvb,pinfo,pkt_offset+offset,pdu_tree,call_info,mc,end_of_mux_sdu, etype, circuit_id); } else { call_dissector(data_handle,pdu_tvb,pinfo,pdu_tree); } @@ -1182,7 +1175,7 @@ h223_mux_check_hdlc(int h223_level, guint32 nbytes, guint32 tail_buf) static gint dissect_mux_pdu_fragment( tvbuff_t *tvb, guint32 start_offset, packet_info *pinfo, proto_tree *h223_tree, - h223_call_info *call_info, circuit_type ctype, guint32 circuit_id) + h223_call_info *call_info, endpoint_type etype, guint32 circuit_id) { tvbuff_t *volatile next_tvb; volatile guint32 offset = start_offset; @@ -1258,7 +1251,7 @@ dissect_mux_pdu_fragment( tvbuff_t *tvb, guint32 start_offset, * data. */ TRY { - dissect_mux_pdu( next_tvb, pinfo, start_offset, h223_tree, call_info, ctype, circuit_id); + dissect_mux_pdu( next_tvb, pinfo, start_offset, h223_tree, call_info, etype, circuit_id); } CATCH_NONFATAL_ERRORS { show_exception(tvb, pinfo, h223_tree, EXCEPT_CODE, GET_MESSAGE); @@ -1280,7 +1273,7 @@ dissect_mux_pdu_fragment( tvbuff_t *tvb, guint32 start_offset, * line up with the end of a pdu. */ static void -dissect_h223_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, circuit_type ctype, guint32 circuit_id) +dissect_h223_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, endpoint_type etype, guint32 circuit_id) { proto_tree *h223_tree = NULL; proto_item *h223_item = NULL; @@ -1293,7 +1286,7 @@ dissect_h223_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, circuit col_clear(pinfo->cinfo, COL_INFO); /* find or create the call_info for this call */ - call_info = find_or_create_call_info(pinfo, ctype, circuit_id); + call_info = find_or_create_call_info(pinfo, etype, circuit_id); /* add the 'h223' tree to the main tree */ if (tree) { @@ -1303,7 +1296,7 @@ dissect_h223_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, circuit while( offset < tvb_reported_length( tvb )) { int res = dissect_mux_pdu_fragment( tvb, offset, pinfo, - h223_tree, call_info, ctype, circuit_id); + h223_tree, call_info, etype, circuit_id); if(res <= 0) { /* the end of the tvb held the start of a PDU */ pinfo->desegment_offset = offset; @@ -1341,26 +1334,17 @@ dissect_h223_circuit_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v { iax2_dissector_info_t circuit_info; - if (data != NULL) - { - circuit_info = *((iax2_dissector_info_t*)data); - } - else - { - /* Just in case dissectors are still using the "old" method */ - /* XXX - This should eventually be removed */ - circuit_info.ctype = (circuit_type)pinfo->ctype; - circuit_info.circuit_id = pinfo->circuit_id; - } + DISSECTOR_ASSERT(data); + circuit_info = *((iax2_dissector_info_t*)data); - dissect_h223_common(tvb, pinfo, tree, circuit_info.ctype, circuit_info.circuit_id); + dissect_h223_common(tvb, pinfo, tree, circuit_info.etype, circuit_info.circuit_id); return tvb_captured_length(tvb); } static int dissect_h223(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - dissect_h223_common(tvb, pinfo, tree, CT_NONE, 0); + dissect_h223_common(tvb, pinfo, tree, ENDPOINT_NONE, 0); return tvb_captured_length(tvb); } @@ -1372,7 +1356,7 @@ dissect_h223(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ * normal entry point. */ static void -dissect_h223_bitswapped_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, circuit_type ctype, guint32 circuit_id) +dissect_h223_bitswapped_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, endpoint_type etype, guint32 circuit_id) { tvbuff_t *reversed_tvb; guint8 *datax; @@ -1392,7 +1376,7 @@ dissect_h223_bitswapped_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* Add the reversed data to the data source list. */ add_new_data_source(pinfo, reversed_tvb, "Bit-swapped H.223 frame" ); - dissect_h223_common(reversed_tvb,pinfo,tree,ctype,circuit_id); + dissect_h223_common(reversed_tvb,pinfo,tree,etype,circuit_id); } static int @@ -1400,26 +1384,17 @@ dissect_h223_bitswapped_circuit_data(tvbuff_t *tvb, packet_info *pinfo, proto_tr { iax2_dissector_info_t circuit_info; - if (data != NULL) - { - circuit_info = *((iax2_dissector_info_t*)data); - } - else - { - /* Just in case dissectors are still using the "old" method */ - /* XXX - This should eventually be removed */ - circuit_info.ctype = (circuit_type)pinfo->ctype; - circuit_info.circuit_id = pinfo->circuit_id; - } + DISSECTOR_ASSERT(data); + circuit_info = *((iax2_dissector_info_t*)data); - dissect_h223_bitswapped_common(tvb, pinfo, tree, circuit_info.ctype, circuit_info.circuit_id); + dissect_h223_bitswapped_common(tvb, pinfo, tree, circuit_info.etype, circuit_info.circuit_id); return tvb_captured_length(tvb); } static int dissect_h223_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - dissect_h223_bitswapped_common(tvb, pinfo, tree, CT_NONE, 0); + dissect_h223_bitswapped_common(tvb, pinfo, tree, ENDPOINT_NONE, 0); return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c index cd39bdc171..a489278dcb 100644 --- a/epan/dissectors/packet-h245.c +++ b/epan/dissectors/packet-h245.c @@ -9084,7 +9084,7 @@ dissect_h245_MultiplexEntryDescriptor(tvbuff_t *tvb _U_, int offset _U_, asn1_ct ett_h245_MultiplexEntryDescriptor, MultiplexEntryDescriptor_sequence); if(h223_set_mc_handle) - (*h223_set_mc_handle)(actx->pinfo, h223_mc, h223_me, actx->pinfo->ctype, actx->pinfo->circuit_id); + (*h223_set_mc_handle)(actx->pinfo, h223_mc, h223_me); /* stuff */ @@ -11114,9 +11114,9 @@ dissect_h245_OpenLogicalChannelAck(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t DISSECTOR_ASSERT( ( h223_rev_lc_num && pend->rev_channel_params) || (!h223_rev_lc_num && !pend->rev_channel_params) ); if(h223_add_lc_handle) { - (*h223_add_lc_handle)( actx->pinfo, h223_fw_lc_num, pend->fw_channel_params, actx->pinfo->ctype, actx->pinfo->circuit_id ); + (*h223_add_lc_handle)( actx->pinfo, h223_fw_lc_num, pend->fw_channel_params); if(h223_rev_lc_num) - (*h223_add_lc_handle)( actx->pinfo, h223_rev_lc_num, pend->rev_channel_params, actx->pinfo->ctype, actx->pinfo->circuit_id ); + (*h223_add_lc_handle)( actx->pinfo, h223_rev_lc_num, pend->rev_channel_params); } } else { /* we missed the OpenLogicalChannel packet */ diff --git a/epan/dissectors/packet-h245.h b/epan/dissectors/packet-h245.h index 38ceb2660a..ee6d62be9c 100644 --- a/epan/dissectors/packet-h245.h +++ b/epan/dissectors/packet-h245.h @@ -124,10 +124,10 @@ struct _h223_mux_element { #include <epan/packet_info.h> #include <epan/dissectors/packet-per.h> -typedef void (*h223_set_mc_handle_t) ( packet_info* pinfo, guint8 mc, h223_mux_element* me, circuit_type ctype, guint32 circuit_id ); +typedef void (*h223_set_mc_handle_t) ( packet_info* pinfo, guint8 mc, h223_mux_element* me); WS_DLL_PUBLIC void h245_set_h223_set_mc_handle( h223_set_mc_handle_t handle ); -typedef void (*h223_add_lc_handle_t) ( packet_info* pinfo, guint16 lc, h223_lc_params* params, circuit_type ctype, guint32 circuit_id ); +typedef void (*h223_add_lc_handle_t) ( packet_info* pinfo, guint16 lc, h223_lc_params* params); WS_DLL_PUBLIC void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle ); diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index 6d99aa6d34..81d47618da 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -32,7 +32,7 @@ #include <epan/packet.h> -#include <epan/circuit.h> +#include <epan/conversation.h> #include <epan/exceptions.h> #include <epan/reassemble.h> #include <epan/expert.h> @@ -743,12 +743,12 @@ typedef struct iax_call_data { -/* creates a new CT_IAX2 circuit with a specified circuit id for a call +/* creates a new ENDPOINT_IAX2 circuit with a specified circuit id for a call * * typically a call has up to three associated circuits: an original source, an * original destination, and the result of a transfer. * - * For each endpoint, a CT_IAX2 circuit is created and added to the call_data + * For each endpoint, a ENDPOINT_IAX2 circuit is created and added to the call_data * by this function * * 'reversed' should be true if this end is the one which would have _received_ @@ -756,11 +756,11 @@ typedef struct iax_call_data { * transferred. * */ -static circuit_t *iax2_new_circuit_for_call(packet_info *pinfo, proto_item * item, +static conversation_t *iax2_new_circuit_for_call(packet_info *pinfo, proto_item * item, guint circuit_id, guint framenum, iax_call_data *iax_call, gboolean reversed) { - circuit_t *res; + conversation_t *conv; if(!iax_call){ return NULL; @@ -771,18 +771,18 @@ static circuit_t *iax2_new_circuit_for_call(packet_info *pinfo, proto_item * ite return NULL; } - res = circuit_new(CT_IAX2, + conv = conversation_new_by_id(framenum, ENDPOINT_IAX2, circuit_id, framenum); - circuit_add_proto_data(res, proto_iax2, iax_call); + conversation_add_proto_data(conv, proto_iax2, iax_call); if (reversed) iax_call -> reverse_circuit_ids[iax_call->n_reverse_circuit_ids++] = circuit_id; else iax_call -> forward_circuit_ids[iax_call->n_forward_circuit_ids++] = circuit_id; - return res; + return conv; } @@ -821,15 +821,13 @@ static iax_call_data *iax_lookup_call_from_dest(packet_info *pinfo, proto_item * guint framenum, gboolean *reversed_p) { - circuit_t *dst_circuit; + conversation_t *dst_conv; iax_call_data *iax_call; gboolean reversed = FALSE; - dst_circuit = find_circuit(CT_IAX2, - dst_circuit_id, - framenum); + dst_conv = find_conversation_by_id(framenum, ENDPOINT_IAX2, dst_circuit_id, 0); - if (!dst_circuit) { + if (!dst_conv) { #ifdef DEBUG_HASHING g_debug("++ destination circuit not found, must have missed NEW packet"); #endif @@ -842,9 +840,9 @@ static iax_call_data *iax_lookup_call_from_dest(packet_info *pinfo, proto_item * g_debug("++ found destination circuit"); #endif - iax_call = (iax_call_data *)circuit_get_proto_data(dst_circuit, proto_iax2); + iax_call = (iax_call_data *)conversation_get_proto_data(dst_conv, proto_iax2); - /* there's no way we can create a CT_IAX2 circuit without adding + /* there's no way we can create a ENDPOINT_IAX2 circuit without adding iax call data to it; assert this */ DISSECTOR_ASSERT(iax_call); @@ -950,21 +948,19 @@ static iax_call_data *iax_lookup_call( packet_info *pinfo, iax_call = iax_lookup_call_from_dest(pinfo, NULL, src_circuit_id, dst_circuit_id, pinfo->num, &reversed); } else { - circuit_t *src_circuit; + conversation_t *src_conv; /* in all other circumstances, the source circuit should already * exist: its absence indicates that we missed the all-important NEW * packet. */ - src_circuit = find_circuit(CT_IAX2, - src_circuit_id, - pinfo->num); + src_conv = find_conversation_by_id(pinfo->num, ENDPOINT_IAX2, src_circuit_id, 0); - if (src_circuit) { - iax_call = (iax_call_data *)circuit_get_proto_data(src_circuit, proto_iax2); + if (src_conv) { + iax_call = (iax_call_data *)conversation_get_proto_data(src_conv, proto_iax2); - /* there's no way we can create a CT_IAX2 circuit without adding + /* there's no way we can create a ENDPOINT_IAX2 circuit without adding iax call data to it; assert this */ DISSECTOR_ASSERT(iax_call); @@ -2175,7 +2171,7 @@ static void process_iax_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * tbd what the best thing to do here is. */ memset(&dissector_info, 0, sizeof(dissector_info)); } else { - dissector_info.ctype = CT_IAX2; + dissector_info.etype = ENDPOINT_IAX2; dissector_info.circuit_id = (guint32)iax_packet->call_data->forward_circuit_ids[0]; } diff --git a/epan/dissectors/packet-iax2.h b/epan/dissectors/packet-iax2.h index fd926a8a80..a1c0f293f9 100644 --- a/epan/dissectors/packet-iax2.h +++ b/epan/dissectors/packet-iax2.h @@ -26,6 +26,7 @@ #define __PACKET_IAX2_H__ #include <epan/tap-voip.h> +#include <epan/conversation.h> /* Max version of IAX protocol we support */ #define IAX_PROTO_VERSION 2 @@ -255,7 +256,7 @@ typedef struct _iax2_info_t /* Container for passing data between dissectors */ typedef struct _iax2_dissector_info_t { - circuit_type ctype; + endpoint_type etype; guint32 circuit_id; } iax2_dissector_info_t; diff --git a/epan/dissectors/packet-isdn.c b/epan/dissectors/packet-isdn.c index 7e5bfe585c..cef118c179 100644 --- a/epan/dissectors/packet-isdn.c +++ b/epan/dissectors/packet-isdn.c @@ -108,9 +108,7 @@ dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "Network"); } - /* XXX - Are these still needed? We've used other values where necessary */ - pinfo->ctype = CT_ISDN; - pinfo->circuit_id = pinfo->pseudo_header->isdn.channel; + conversation_create_endpoint_by_id(pinfo, ENDPOINT_ISDN, pinfo->pseudo_header->isdn.channel, 0); if (tree) { ti = proto_tree_add_item(tree, proto_isdn, tvb, 0, 0, ENC_NA); @@ -123,9 +121,7 @@ dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* * Set up a circuit for this channel, and assign it a dissector. */ - conv = find_conversation_simple(pinfo->num, ENDPOINT_ISDN, pinfo->pseudo_header->isdn.channel, 0); - if (conv == NULL) - conv = conversation_new_simple(pinfo->num, ENDPOINT_ISDN, pinfo->pseudo_header->isdn.channel, 0); + conv = find_or_create_conversation(pinfo); if (conversation_get_dissector(conv, 0) == NULL) { /* @@ -196,7 +192,7 @@ dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ } } - if (!try_conversation_dissector_simple(ENDPOINT_ISDN, pinfo->pseudo_header->isdn.channel, + if (!try_conversation_dissector_by_id(ENDPOINT_ISDN, pinfo->pseudo_header->isdn.channel, tvb, pinfo, tree, NULL)) call_data_dissector(tvb, pinfo, tree); diff --git a/epan/dissectors/packet-iso14443.c b/epan/dissectors/packet-iso14443.c index cef146b192..db550569cd 100644 --- a/epan/dissectors/packet-iso14443.c +++ b/epan/dissectors/packet-iso14443.c @@ -693,7 +693,7 @@ static int dissect_iso14443_ats(tvbuff_t *tvb, gint offset, col_set_str(pinfo->cinfo, COL_INFO, "ATS"); proto_item_append_text(ti, ": ATS"); - conv = conversation_new_simple(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); + conv = conversation_new_by_id(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); conversation_add_proto_data(conv, proto_iso14443, GUINT_TO_POINTER((guint)ISO14443_A)); offset_tl = offset; @@ -919,7 +919,7 @@ dissect_iso14443_cmd_type_attrib(tvbuff_t *tvb, packet_info *pinfo, col_set_str(pinfo->cinfo, COL_INFO, "Response to Attrib"); proto_item_append_text(ti, ": Response to Attrib"); - conv = conversation_new_simple(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); + conv = conversation_new_by_id(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); conversation_add_proto_data(conv, proto_iso14443, GUINT_TO_POINTER((guint)ISO14443_B)); mbli = tvb_get_guint8(tvb, offset) >> 4; @@ -1091,7 +1091,7 @@ dissect_iso14443_cmd_type_block(tvbuff_t *tvb, packet_info *pinfo, iso14443_type_t t; conversation_t *conv; - conv = find_conversation_simple(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); + conv = find_conversation_by_id(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); if (conv) { t = (iso14443_type_t)GPOINTER_TO_UINT(conversation_get_proto_data(conv, proto_iso14443)); @@ -1374,7 +1374,7 @@ static int dissect_iso14443(tvbuff_t *tvb, /* all events that are not data transfers close the connection to the card (e.g. the field is switched on or off) */ - conv = find_conversation_simple(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); + conv = find_conversation_by_id(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); if (conv) conv->last_frame = pinfo->num; } diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index 71f5718332..79ec8449f9 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -49,6 +49,7 @@ #include <epan/packet.h> #include <epan/expert.h> #include <epan/exceptions.h> +#include <epan/conversation.h> #include <epan/stats_tree.h> #include <epan/asn1.h> #include <epan/prefs.h> @@ -10148,8 +10149,6 @@ dissect_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* Extract message type field */ message_type = tvb_get_guint8(tvb, CIC_OFFSET + CIC_LENGTH); - pinfo->ctype = CT_ISUP; - switch (mtp3_standard) { case ANSI_STANDARD: isup_standard = ANSI_STANDARD; @@ -10169,6 +10168,7 @@ dissect_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ isup_tree = proto_item_add_subtree(ti, ett_isup); proto_tree_add_uint(isup_tree, hf_isup_cic, tvb, CIC_OFFSET, CIC_LENGTH, cic); } + conversation_create_endpoint_by_id(pinfo, ENDPOINT_ISUP, cic, 0); message_tvb = tvb_new_subset_remaining(tvb, CIC_LENGTH); dissect_ansi_isup_message(message_tvb, pinfo, isup_tree, ISUP_ITU_STANDARD_VARIANT, cic); break; @@ -10217,6 +10217,7 @@ dissect_isup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ isup_tree = proto_item_add_subtree(ti, ett_isup); proto_tree_add_uint(isup_tree, hf_isup_cic, tvb, CIC_OFFSET, CIC_LENGTH, cic); } + conversation_create_endpoint_by_id(pinfo, ENDPOINT_ISUP, cic, 0); message_tvb = tvb_new_subset_remaining(tvb, CIC_LENGTH); dissect_isup_message(message_tvb, pinfo, isup_tree, itu_isup_variant, cic); } @@ -10270,7 +10271,7 @@ dissect_bicc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ bicc_cic = tvb_get_letohl(tvb, BICC_CIC_OFFSET); - pinfo->ctype = CT_BICC; + conversation_create_endpoint_by_id(pinfo, ENDPOINT_BICC, bicc_cic, 0); col_clear(pinfo->cinfo, COL_INFO); if (isup_show_cic_in_info) { diff --git a/epan/dissectors/packet-iuup.c b/epan/dissectors/packet-iuup.c index 348f2b8f4a..60b63bd7c8 100644 --- a/epan/dissectors/packet-iuup.c +++ b/epan/dissectors/packet-iuup.c @@ -34,6 +34,7 @@ #include <epan/packet.h> #include <epan/prefs.h> #include <epan/expert.h> +#include <epan/conversation.h> #include <epan/crc10-tvb.h> #include <wsutil/crc10.h> #include <wsutil/crc6.h> @@ -633,7 +634,7 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, phdr &= 0x7fff; - pinfo->circuit_id = phdr; + conversation_create_endpoint_by_id(pinfo, ENDPOINT_IUUP, phdr, 0); tvb = tvb_new_subset_length(tvb_in,2,len); } @@ -668,7 +669,7 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, proto_tree_add_item(iuup_tree,hf_iuup_rfci,tvb,1,1,ENC_BIG_ENDIAN); add_hdr_crc(tvb, pinfo, iuup_tree, crccheck); add_payload_crc(tvb, pinfo, iuup_tree); - dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,4,pinfo->circuit_id); + dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,4, conversation_get_endpoint_by_id(pinfo, ENDPOINT_IUUP, USE_LAST_ENDPOINT)); return tvb_captured_length(tvb); case PDUTYPE_DATA_NO_CRC: col_append_fstr(pinfo->cinfo, COL_INFO," RFCI %u", (guint)(second_octet & 0x3f)); @@ -682,7 +683,7 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, proto_tree_add_item(iuup_tree,hf_iuup_rfci,tvb,1,1,ENC_BIG_ENDIAN); add_hdr_crc(tvb, pinfo, iuup_tree, crccheck); - dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,3,pinfo->circuit_id); + dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,3, conversation_get_endpoint_by_id(pinfo, ENDPOINT_IUUP, USE_LAST_ENDPOINT)); return tvb_captured_length(tvb); case PDUTYPE_DATA_CONTROL_PROC: if (tree) { @@ -733,7 +734,7 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, switch( second_octet & PROCEDURE_MASK ) { case PROC_INIT: add_payload_crc(tvb, pinfo, iuup_tree); - dissect_iuup_init(tvb,pinfo,iuup_tree,pinfo->circuit_id); + dissect_iuup_init(tvb,pinfo,iuup_tree, conversation_get_endpoint_by_id(pinfo, ENDPOINT_IUUP, USE_LAST_ENDPOINT)); return tvb_captured_length(tvb); case PROC_RATE: add_payload_crc(tvb, pinfo, iuup_tree); diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index dce370c0fa..9757999357 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -223,7 +223,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree, void* data _U_) * XXX: this is prone to collisions! * we need an uniform way to manage circuits between dissectors */ - pinfo->circuit_id = g_str_hash(circuit_str); + conversation_create_endpoint_by_id(pinfo, ENDPOINT_NONE, g_str_hash(circuit_str), 0); proto_tree_add_uint(k12_tree, hf_k12_atm_vp, tvb, 0, 0, pinfo->pseudo_header->k12.input_info.atm.vp); diff --git a/epan/dissectors/packet-lapdm.c b/epan/dissectors/packet-lapdm.c index d351edd76e..de7cc1fced 100644 --- a/epan/dissectors/packet-lapdm.c +++ b/epan/dissectors/packet-lapdm.c @@ -56,6 +56,7 @@ #include <epan/prefs.h> #include <epan/xdlc.h> #include <epan/reassemble.h> +#include <epan/conversation.h> void proto_register_lapdm(void); @@ -326,7 +327,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) pinfo->fragmented = m; /* Rely on caller to provide a way to group fragments */ - fragment_id = (pinfo->circuit_id << 4) | (sapi << 1) | pinfo->p2p_dir; + fragment_id = (conversation_get_endpoint_by_id(pinfo, ENDPOINT_GSMTAP, USE_LAST_ENDPOINT) << 4) | (sapi << 1) | pinfo->p2p_dir; if (!PINFO_FD_VISITED(pinfo)) { /* Check if new N(S) is equal to previous N(S) (to avoid adding retransmissions in reassembly table) @@ -380,7 +381,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { if (!PINFO_FD_VISITED(pinfo) && ((control & XDLC_S_U_MASK) == XDLC_U) && ((control & XDLC_U_MODIFIER_MASK) == XDLC_SABM)) { /* SABM frame; reset the last N(S) to an invalid value */ - guint32 fragment_id = (pinfo->circuit_id << 4) | (sapi << 1) | pinfo->p2p_dir; + guint32 fragment_id = (conversation_get_endpoint_by_id(pinfo, ENDPOINT_GSMTAP, USE_LAST_ENDPOINT) << 4) | (sapi << 1) | pinfo->p2p_dir; wmem_map_insert(lapdm_last_n_s_map, GUINT_TO_POINTER(fragment_id), GUINT_TO_POINTER(0)); } diff --git a/epan/dissectors/packet-lapsat.c b/epan/dissectors/packet-lapsat.c index 10672749eb..73af54f2aa 100644 --- a/epan/dissectors/packet-lapsat.c +++ b/epan/dissectors/packet-lapsat.c @@ -35,6 +35,7 @@ #include <epan/packet.h> #include <epan/reassemble.h> +#include <epan/conversation.h> void proto_register_lapsat(void); @@ -516,7 +517,7 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissec pinfo->fragmented = !!(addr & LAPSAT_SI); /* Rely on caller to provide a way to group fragments */ - fragment_id = (pinfo->circuit_id << 3) | (sapi << 1) | pinfo->p2p_dir; + fragment_id = (conversation_get_endpoint_by_id(pinfo, ENDPOINT_GSMTAP, USE_LAST_ENDPOINT) << 3) | (sapi << 1) | pinfo->p2p_dir; /* Fragment reconstruction helpers */ fd_m = fragment_add_seq_next( diff --git a/epan/dissectors/packet-wcp.c b/epan/dissectors/packet-wcp.c index 1548cde061..9094c48900 100644 --- a/epan/dissectors/packet-wcp.c +++ b/epan/dissectors/packet-wcp.c @@ -102,7 +102,7 @@ #include <wiretap/wtap.h> #include <wsutil/pint.h> -#include <epan/circuit.h> +#include <epan/conversation.h> #include <epan/etypes.h> #include <epan/nlpid.h> #include <epan/expert.h> @@ -222,8 +222,8 @@ static const value_string ext_cmd_string[] = { -static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pinfo, proto_tree *tree, circuit_type ctype, guint32 circuit_id); -static wcp_window_t *get_wcp_window_ptr(packet_info *pinfo, circuit_type ctype, guint32 circuit_id); +static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pinfo, proto_tree *tree); +static wcp_window_t *get_wcp_window_ptr(packet_info *pinfo); static void dissect_wcp_con_req(tvbuff_t *tvb, int offset, proto_tree *tree) { @@ -278,14 +278,14 @@ dissect_wcp_reset( tvbuff_t *tvb, int offset, proto_tree *tree){ } -static void wcp_save_data( tvbuff_t *tvb, packet_info *pinfo, circuit_type ctype, guint32 circuit_id){ +static void wcp_save_data( tvbuff_t *tvb, packet_info *pinfo) { wcp_window_t *buf_ptr = 0; size_t len; /* discard first 2 bytes, header and last byte (check byte) */ len = tvb_reported_length( tvb)-3; - buf_ptr = get_wcp_window_ptr(pinfo, ctype, circuit_id); + buf_ptr = get_wcp_window_ptr(pinfo); if (( buf_ptr->buf_cur + len) <= (buf_ptr->buffer + MAX_WIN_BUF_LEN)){ tvb_memcpy( tvb, buf_ptr->buf_cur, 2, len); @@ -368,13 +368,13 @@ static int dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if ( cmd == 1) { /* uncompressed data */ if ( !pinfo->fd->flags.visited){ /* if first pass */ - wcp_save_data( tvb, pinfo, pinfo->ctype, pinfo->circuit_id); + wcp_save_data( tvb, pinfo); } next_tvb = tvb_new_subset_remaining(tvb, wcp_header_len); } else { /* cmd == 0 || (cmd == 0xf && ext_cmd == 0) */ - next_tvb = wcp_uncompress( tvb, wcp_header_len, pinfo, wcp_tree, pinfo->ctype, pinfo->circuit_id); + next_tvb = wcp_uncompress( tvb, wcp_header_len, pinfo, wcp_tree); if ( !next_tvb){ return tvb_captured_length(tvb); @@ -427,29 +427,25 @@ decompressed_entry(guint8 *dst, guint16 data_offset, static -wcp_window_t *get_wcp_window_ptr(packet_info *pinfo, circuit_type ctype, guint32 circuit_id){ +wcp_window_t *get_wcp_window_ptr(packet_info *pinfo){ /* find the circuit for this DLCI, create one if needed */ /* and return the wcp_window data structure pointer */ /* for the direction of this packet */ - circuit_t *circuit; + conversation_t *conv; wcp_circuit_data_t *wcp_circuit_data; - circuit = find_circuit( ctype, circuit_id, - pinfo->num); - if ( !circuit){ - circuit = circuit_new( ctype, circuit_id, - pinfo->num); - } - wcp_circuit_data = (wcp_circuit_data_t *)circuit_get_proto_data(circuit, proto_wcp); + conv = find_or_create_conversation(pinfo); + + wcp_circuit_data = (wcp_circuit_data_t *)conversation_get_proto_data(conv, proto_wcp); if ( !wcp_circuit_data){ wcp_circuit_data = wmem_new(wmem_file_scope(), wcp_circuit_data_t); wcp_circuit_data->recv.buf_cur = wcp_circuit_data->recv.buffer; wcp_circuit_data->recv.initialized = 0; wcp_circuit_data->send.buf_cur = wcp_circuit_data->send.buffer; wcp_circuit_data->send.initialized = 0; - circuit_add_proto_data(circuit, proto_wcp, wcp_circuit_data); + conversation_add_proto_data(conv, proto_wcp, wcp_circuit_data); } if (pinfo->pseudo_header->x25.flags & FROM_DCE) return &wcp_circuit_data->recv; @@ -458,7 +454,7 @@ wcp_window_t *get_wcp_window_ptr(packet_info *pinfo, circuit_type ctype, guint32 } -static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pinfo, proto_tree *tree, circuit_type ctype, guint32 circuit_id) { +static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pinfo, proto_tree *tree) { /* do the packet data uncompression and load it into the dst buffer */ @@ -475,7 +471,7 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin wcp_window_t *buf_ptr = 0; wcp_pdata_t *pdata_ptr; - buf_ptr = get_wcp_window_ptr(pinfo, ctype, circuit_id); + buf_ptr = get_wcp_window_ptr(pinfo); buf_start = buf_ptr->buffer; buf_end = buf_start + MAX_WIN_BUF_LEN; diff --git a/epan/dissectors/packet-x25.c b/epan/dissectors/packet-x25.c index b30ac71670..54db217d8e 100644 --- a/epan/dissectors/packet-x25.c +++ b/epan/dissectors/packet-x25.c @@ -27,7 +27,7 @@ #include <epan/packet.h> #include <epan/ax25_pids.h> #include <epan/llcsaps.h> -#include <epan/circuit.h> +#include <epan/conversation.h> #include <epan/reassemble.h> #include <epan/prefs.h> #include <epan/expert.h> @@ -542,45 +542,45 @@ static heur_dissector_list_t x25_heur_subdissector_list; static void x25_hash_add_proto_start(guint16 vc, guint32 frame, dissector_handle_t dissect) { - circuit_t *circuit; + conversation_t *conv; /* * Is there already a circuit with this VC number? */ - circuit = find_circuit(CT_X25, vc, frame); - if (circuit != NULL) { + conv = find_conversation_by_id(frame, ENDPOINT_X25, vc, 0); + if (conv != NULL) { /* * Yes - close it, as we're creating a new one. */ - close_circuit(circuit, frame - 1); + conv->last_frame = frame - 1; } /* * Set up a new circuit. */ - circuit = circuit_new(CT_X25, vc, frame); + conv = conversation_new_by_id(frame, ENDPOINT_X25, vc, 0); /* * Set its dissector. */ - circuit_set_dissector(circuit, dissect); + conversation_set_dissector(conv, dissect); } static void x25_hash_add_proto_end(guint16 vc, guint32 frame) { - circuit_t *circuit; + conversation_t *conv; /* * Try to find the circuit. */ - circuit = find_circuit(CT_X25, vc, frame); + conv = find_conversation_by_id(frame, ENDPOINT_X25, vc, 0); /* * If we succeeded, close it. */ - if (circuit != NULL) - close_circuit(circuit, frame); + if (conv != NULL) + conv->last_frame = frame; } static const range_string clear_code_rvals[] = { @@ -1241,8 +1241,7 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, modulo = ((bytes0_1 & 0x2000) ? 128 : 8); vc = (int)(bytes0_1 & 0x0FFF); - pinfo->ctype = CT_X25; - pinfo->circuit_id = vc; + conversation_create_endpoint_by_id(pinfo, ENDPOINT_X25, vc, 0); if (bytes0_1 & X25_ABIT) toa = TRUE; else toa = FALSE; @@ -1936,7 +1935,7 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, next_tvb = tvb_new_subset_remaining(tvb, localoffset); /* See if there's already a dissector for this circuit. */ - if (try_circuit_dissector(CT_X25, vc, pinfo->num, next_tvb, pinfo, + if (try_conversation_dissector_by_id(ENDPOINT_X25, vc, next_tvb, pinfo, tree, &q_bit_set)) { return; /* found it and dissected it */ } diff --git a/epan/epan.c b/epan/epan.c index 03a9724e71..bdd19cd6e8 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -43,7 +43,6 @@ #include "epan_dissect.h" #include "conversation.h" -#include "circuit.h" #include "except.h" #include "packet.h" #include "prefs.h" @@ -353,18 +352,6 @@ epan_conversation_init(void) conversation_epan_reset(); } -void -epan_circuit_init(void) -{ - circuit_init(); -} - -void -epan_circuit_cleanup(void) -{ - circuit_cleanup(); -} - /* Overrides proto_tree_visible i epan_dissect_init to make all fields visible. * This is > 0 if a Lua script wanted to see all fields all the time. * This is ref-counted, so clearing it won't override other taps/scripts wanting it. diff --git a/epan/epan.h b/epan/epan.h index 39ecf72fc1..bb1fafb70f 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -121,19 +121,6 @@ void epan_cleanup(void); */ void epan_conversation_init(void); -/** - * Initialize the table of circuits. Circuits are identified by a - * circuit ID; they are used for protocols where packets *do* contain - * a circuit ID value indicating to which flow the packet belongs. - * - * We might want to make a superclass for both endpoint-specified - * conversations and circuit ID-specified circuits, so we can attach - * information either to a circuit or a conversation with common - * code. - */ -void epan_circuit_init(void); -void epan_circuit_cleanup(void); - /** A client will create one epan_t for an entire dissection session. * A single epan_t will be used to analyze the entire sequence of packets, * sequentially, in a single session. A session corresponds to a single diff --git a/epan/packet.c b/epan/packet.c index e1a218d146..3904256d3c 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -325,9 +325,6 @@ init_dissection(void) /* Initialize the table of conversations. */ epan_conversation_init(); - /* Initialize the table of circuits. */ - epan_circuit_init(); - /* Initialize protocol-specific variables. */ g_slist_foreach(init_routines, &call_routine, NULL); @@ -341,9 +338,6 @@ init_dissection(void) void cleanup_dissection(void) { - /* Cleanup the table of circuits. */ - epan_circuit_cleanup(); - /* Cleanup protocol-specific variables. */ g_slist_foreach(cleanup_routines, &call_routine, NULL); @@ -540,7 +534,6 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype, clear_address(&edt->pi.net_dst); clear_address(&edt->pi.src); clear_address(&edt->pi.dst); - edt->pi.ctype = CT_NONE; edt->pi.noreassembly_reason = ""; edt->pi.ptype = PT_NONE; edt->pi.use_endpoint = FALSE; @@ -608,7 +601,6 @@ dissect_file(epan_dissect_t *edt, struct wtap_pkthdr *phdr, clear_address(&edt->pi.net_dst); clear_address(&edt->pi.src); clear_address(&edt->pi.dst); - edt->pi.ctype = CT_NONE; edt->pi.noreassembly_reason = ""; edt->pi.ptype = PT_NONE; edt->pi.use_endpoint = FALSE; diff --git a/epan/packet_info.h b/epan/packet_info.h index ca8fca50d4..5a8a076c6e 100644 --- a/epan/packet_info.h +++ b/epan/packet_info.h @@ -71,9 +71,7 @@ typedef struct _packet_info { address net_dst; /**< network-layer destination address */ address src; /**< source address (net if present, DL otherwise )*/ address dst; /**< destination address (net if present, DL otherwise )*/ - guint32 vlan_id; /**< First encountered VLAN Id if pressent otherwise 0 */ - circuit_type ctype; /**< type of circuit, for protocols with a VC identifier */ - guint32 circuit_id; /**< circuit ID, for protocols with a VC identifier */ + guint32 vlan_id; /**< First encountered VLAN Id if present otherwise 0 */ const char *noreassembly_reason; /**< reason why reassembly wasn't done, if any */ gboolean fragmented; /**< TRUE if the protocol is only a fragment */ struct { diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c index 3ce89e75be..7e96f4a223 100644 --- a/epan/wslua/wslua_pinfo.c +++ b/epan/wslua/wslua_pinfo.c @@ -238,10 +238,6 @@ WSLUA_ATTRIBUTE_BLOCK_NUMBER_GETTER(Pinfo,delta_ts,lua_delta_nstime_to_sec(obj, /* WSLUA_ATTRIBUTE Pinfo_delta_dis_ts RO Number of seconds passed since the last displayed packet. */ WSLUA_ATTRIBUTE_BLOCK_NUMBER_GETTER(Pinfo,delta_dis_ts,lua_delta_nstime_to_sec(obj, obj->ws_pinfo->fd, obj->ws_pinfo->fd->prev_dis_num)); -/* WSLUA_ATTRIBUTE Pinfo_circuit_id RW For circuit based protocols. */ -PINFO_NUMBER_GETTER(circuit_id); -PINFO_NUMBER_SETTER(circuit_id,guint32); - /* WSLUA_ATTRIBUTE Pinfo_curr_proto RO Which Protocol are we dissecting. */ WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(Pinfo,curr_proto,ws_pinfo->current_proto); @@ -456,7 +452,6 @@ WSLUA_ATTRIBUTES Pinfo_attributes[] = { WSLUA_ATTRIBUTE_ROREG(Pinfo,port_type), WSLUA_ATTRIBUTE_RWREG(Pinfo,src_port), WSLUA_ATTRIBUTE_RWREG(Pinfo,dst_port), - WSLUA_ATTRIBUTE_RWREG(Pinfo,circuit_id), WSLUA_ATTRIBUTE_ROREG(Pinfo,match), WSLUA_ATTRIBUTE_ROREG(Pinfo,curr_proto), WSLUA_ATTRIBUTE_ROREG(Pinfo,columns), diff --git a/ui/tap-iax2-analysis.c b/ui/tap-iax2-analysis.c index f057743eb6..b5d43b30eb 100644 --- a/ui/tap-iax2-analysis.c +++ b/ui/tap-iax2-analysis.c @@ -34,8 +34,6 @@ #include <glib.h> -#include <epan/circuit.h> - #include <epan/dissectors/packet-iax2.h> #include "tap-iax2-analysis.h" |