As with "file_write_error_message()", so with
[obnox/wireshark/wip.git] / ip_opts.h
1 /* ip_opts.h
2  * Definitions of structures and routines for dissection of options that
3  * work like IPv4 or IPv6 options
4  *
5  * $Id: ip_opts.h,v 1.1 2003/07/11 09:30:48 guy Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __IP_OPTS_H__
27 #define __IP_OPTS_H__
28
29 typedef enum {
30   NO_LENGTH,            /* option has no data, hence no length */
31   FIXED_LENGTH,         /* option always has the same length */
32   VARIABLE_LENGTH       /* option is variable-length - optlen is minimum */
33 } opt_len_type;
34
35 /* Member of table of IP or TCP options. */
36 typedef struct ip_tcp_opt {
37   int   optcode;        /* code for option */
38   char  *name;          /* name of option */
39   int   *subtree_index; /* pointer to subtree index for option */
40   opt_len_type len_type; /* type of option length field */
41   int   optlen;         /* value length should be (minimum if VARIABLE) */
42   void  (*dissect)(const struct ip_tcp_opt *, tvbuff_t *, int, guint,
43                    packet_info *, proto_tree *);
44                         /* routine to dissect option */
45 } ip_tcp_opt;
46
47 /* Routine to dissect options that work like IPv4 options, where the
48    length field in the option, if present, includes the type and
49    length bytes. */
50 extern void dissect_ip_tcp_options(tvbuff_t *, int, guint,
51     const ip_tcp_opt *, int, int, packet_info *, proto_tree *);
52
53 /* Routine to dissect options that work like IPv6 options, where the
54    length field in the option, if present, includes only the data, not
55    the type and length bytes. */
56 extern void dissect_ipv6_options(tvbuff_t *, int, guint,
57     const ip_tcp_opt *, int, int, packet_info *, proto_tree *);
58
59 #endif