(Trivial) Fix spellling in a comment.
[metze/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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25
26 #ifndef __IP_OPTS_H__
27 #define __IP_OPTS_H__
28
29 #include "ws_symbol_export.h"
30
31 /** @file
32  */
33
34 typedef enum {
35   OPT_LEN_NO_LENGTH,                /**< option has no data, hence no length */
36   OPT_LEN_FIXED_LENGTH,             /**< option always has the same length */
37   OPT_LEN_VARIABLE_LENGTH           /**< option is variable-length - optlen is minimum */
38 } opt_len_type;
39
40 /** Member of table of IP or TCP options. */
41 typedef struct ip_tcp_opt {
42   int           optcode;            /**< code for option */
43   const char   *name;               /**< name of option */
44   int          *subtree_index;      /**< pointer to subtree index for option */
45   opt_len_type  len_type;           /**< type of option length field */
46   int           optlen;             /**< value length should be (minimum if VARIABLE) */
47   void  (*dissect)(const struct ip_tcp_opt *,
48                    tvbuff_t *,
49                    int,
50                    guint,
51                    packet_info *,
52                    proto_tree *,
53                    void *);   /**< routine to dissect option */
54 } ip_tcp_opt;
55
56 typedef struct ip_tcp_opt_type {
57   int* phf_opt_type;
58   int* pett_opt_type;
59   int* phf_opt_type_copy;
60   int* phf_opt_type_class;
61   int* phf_opt_type_number;
62 } ip_tcp_opt_type;
63
64 /** Routine to dissect options that work like IPv4 options, where the
65    length field in the option, if present, includes the type and
66    length bytes. */
67 extern void dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
68                        const ip_tcp_opt *opttab, int nopts, int eol,
69                        ip_tcp_opt_type* opttypes, expert_field* ei_bad,
70                        packet_info *pinfo, proto_tree *opt_tree,
71                        proto_item *opt_item, void * data);
72
73 /* Quick-Start option, as defined by RFC4782 */
74 #define QS_FUNC_MASK        0xf0
75 #define QS_RATE_MASK        0x0f
76 #define QS_RATE_REQUEST     0
77 #define QS_RATE_REPORT      8
78
79 /* IP options */
80 #define IPOPT_COPY_MASK         0x80
81 #define IPOPT_CLASS_MASK        0x60
82 #define IPOPT_NUMBER_MASK       0x1F
83
84 WS_DLL_PUBLIC const value_string qs_func_vals[];
85 WS_DLL_PUBLIC value_string_ext qs_rate_vals_ext;
86
87 WS_DLL_PUBLIC const value_string ipopt_type_class_vals[];
88 WS_DLL_PUBLIC const value_string ipopt_type_number_vals[];
89
90 #endif