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