From Steve Magnani:
[obnox/wireshark/wip.git] / epan / 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$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
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 /** @file
30  */
31
32 typedef enum {
33   NO_LENGTH,                        /**< option has no data, hence no length */
34   FIXED_LENGTH,                     /**< option always has the same length */
35   VARIABLE_LENGTH                   /**< option is variable-length - optlen is minimum */
36 } opt_len_type;
37
38 /** Member of table of IP or TCP options. */
39 typedef struct ip_tcp_opt {
40   int   optcode;                    /**< code for option */
41   const char  *name;                /**< name of option */
42   int   *subtree_index;             /**< pointer to subtree index for option */
43   opt_len_type len_type;            /**< type of option length field */
44   int   optlen;                     /**< value length should be (minimum if VARIABLE) */
45   void  (*dissect)(const struct ip_tcp_opt *,
46                    tvbuff_t *,
47                    int,
48                    guint,
49                    packet_info *,
50                    proto_tree *);   /**< routine to dissect option */
51 } ip_tcp_opt;
52
53 /** Routine to dissect options that work like IPv4 options, where the
54    length field in the option, if present, includes the type and
55    length bytes. */
56 extern void dissect_ip_tcp_options(tvbuff_t *, int, guint,
57                                    const ip_tcp_opt *, int, int,
58                                    packet_info *, proto_tree *, proto_item *);
59
60 /** Routine to dissect options that work like IPv6 options, where the
61    length field in the option, if present, includes only the data, not
62    the type and length bytes. */
63 extern void dissect_ipv6_options(tvbuff_t *, int, guint,
64                                  const ip_tcp_opt *, int, int,
65                                  packet_info *, proto_tree *);
66
67 #endif