HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / circuit.h
blob0541f6dfa1af93459f4cea8acd54e2970e57ced5
1 /* circuit.h
2 * Routines for building lists of packets that are part of a "circuit"
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __CIRCUIT_H__
26 #define __CIRCUIT_H__
28 #include "packet.h" /* for circuit dissector type */
29 #include "ws_symbol_export.h"
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
35 /**
36 * Data structure representing a circuit.
38 typedef struct circuit_key {
39 circuit_type ctype;
40 guint32 circuit_id;
41 } circuit_key;
43 typedef struct circuit {
44 struct circuit *next; /**< pointer to next circuit with given circuit ID */
45 guint32 first_frame; /**< # of first frame for that circuit */
46 guint32 last_frame; /**< # of last frame for that circuit */
47 guint32 index; /**< unique ID for circuit */
48 GSList *data_list; /**< list of data associated with circuit */
49 dissector_handle_t dissector_handle; /**< handle for protocol dissector client associated with circuit */
50 guint options; /**< wildcard flags */
51 circuit_key *key_ptr; /**< pointer to the key for this circuit */
52 } circuit_t;
54 /**
55 * Destroy all existing circuits.
57 extern void circuit_cleanup(void);
59 /**
60 * Initialize some variables every time a file is loaded or re-loaded.
61 * Create a new hash table for the circuits in the new file.
63 extern void circuit_init(void);
65 /**
66 * Given a circuit type and circuit ID for a packet, create a new circuit
67 * to contain packets for that circuit.
69 WS_DLL_PUBLIC circuit_t *circuit_new(circuit_type ctype, guint32 circuit_id,
70 guint32 first_frame);
72 /**
73 * Given a circuit type and ID, and a frame number, search for a circuit with
74 * that type and ID whose range of frames includes that frame number.
75 * Returns NULL if not found.
77 WS_DLL_PUBLIC circuit_t *find_circuit(circuit_type ctype, guint32 circuit_id,
78 guint32 frame);
80 /**
81 * Set the last frame of a circuit, if it's not already known,
82 * "closing" the circuit.
84 extern void close_circuit(circuit_t *circuit, guint32 last_frame);
86 WS_DLL_PUBLIC void circuit_add_proto_data(circuit_t *conv, int proto,
87 void *proto_data);
88 WS_DLL_PUBLIC void *circuit_get_proto_data(circuit_t *conv, int proto);
89 void circuit_delete_proto_data(circuit_t *conv, int proto);
91 extern void circuit_set_dissector(circuit_t *circuit,
92 dissector_handle_t handle);
93 extern dissector_handle_t circuit_get_dissector(circuit_t *circuit);
95 /**
96 * Given a circuit type and ID for a packet, search for a matching
97 * circuit and, if found and it has a circuit dissector,
98 * call that dissector and return TRUE, otherwise return FALSE.
100 extern gboolean
101 try_circuit_dissector(circuit_type ctype, guint32 circuit_id, guint32 frame,
102 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
104 #ifdef __cplusplus
106 #endif /* __cplusplus */
108 #endif /* circuit.h */