More 'char*' -> 'const char*' changes to fix warnings.
[obnox/wireshark/wip.git] / plugins / opsi / packet-opsi.h
1 /* packet-opsi.h
2  * Routines for OPSI protocol dissection
3  * Copyright 2004, Laurent Rabret <laurent.rabret@i.hate.spams.org>
4  *
5  * $Id$
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
27 #ifndef __PACKET_OPSI_H__
28 #define __PACKET_OPSI_H__
29
30 /* TCP destination port dedicated to the OPSI protocol */
31 #define TCP_PORT_OPSI           4002
32
33 /* Information position in OPSI header */
34 #define MAJOR_VERSION_OFFSET    0
35 #define MINOR_VERSION_OFFSET    1
36 #define CODE_OFFSET             2
37 #define HOOK_ID_OFFSET          3
38 #define PACKET_LENGTH_OFFSET    4
39 #define SESSION_OFFSET          6
40
41 #define HEADER_LENGTH           8
42
43
44 /* Valid OPSI code values */
45 #define DISCOVER_REQUEST        1
46 #define DISCOVER_RESPONSE       2
47 #define SERVICE_REQUEST         3
48 #define SERVICE_ACCEPT          4
49 #define SERVICE_REJECT          5
50 #define TERMINATE_REQUEST       6
51
52 /* Internal structure to dissect attributes */
53 typedef struct {
54         guint16         attribute_type;         /* attribute code */
55         const char      *tree_text;             /* text for fold out */
56         gint            *tree_id;               /* id for add_item */
57         int*            hf_type_attribute;      /* id for seach option */
58         void            (*dissect)(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length);
59 } opsi_attribute_handle_t;
60
61
62 /* Attributes codes */
63 #define USER_NAME_ATTRIBUTE             1
64 #define USER_PASSWD_ATTRIBUTE           2
65 #define CHAP_PASSWD_ATTRIBUTE           3
66 #define NAS_IP_ADDRESS_ATTRIBUTE        4
67 #define NAS_PORT_ATTRIBUTE              5
68 #define SERVICE_TYPE_ATTRIBUTE          6
69 #define FRAMED_PROTOCOL_ATTRIBUTE       7
70 #define FRAMED_ADDRESS_ATTRIBUTE        8
71 #define FRAMED_NETMASK_ATTRIBUTE        9
72 #define FRAMED_ROUTING_ATTRIBUTE        10
73 #define FRAMED_FILTER_ATTRIBUTE         11
74 #define FRAMED_MTU_ATTRIBUTE            12
75 #define FRAMED_COMPRESSION_ATTRIBUTE    13
76 #define CALLED_STATION_ID_ATTRIBUTE     30
77 #define CALLING_STATION_ID_ATTRIBUTE    31
78 #define NAS_IDENTIFIER                  32
79 #define ACCOUNTING_40_ATTRIBUTE         40
80 #define ACCOUNTING_41_ATTRIBUTE         41
81 #define ACCOUNTING_42_ATTRIBUTE         42
82 #define ACCOUNTING_43_ATTRIBUTE         43
83 #define ACCOUNTING_SESSION_ID_ATTRIBUTE 44
84 #define ACCOUNTING_45_ATTRIBUTE         45
85 #define ACCOUNTING_46_ATTRIBUTE         46
86 #define ACCOUNTING_47_ATTRIBUTE         47
87 #define ACCOUNTING_48_ATTRIBUTE         48
88 #define ACCOUNTING_49_ATTRIBUTE         49
89 #define ACCOUNTING_50_ATTRIBUTE         50
90 #define ACCOUNTING_51_ATTRIBUTE         51
91 #define ACCOUNTING_52_ATTRIBUTE         52
92 #define ACCOUNTING_53_ATTRIBUTE         53
93 #define ACCOUNTING_54_ATTRIBUTE         54
94 #define ACCOUNTING_55_ATTRIBUTE         55
95 #define ACCOUNTING_56_ATTRIBUTE         56
96 #define ACCOUNTING_57_ATTRIBUTE         57
97 #define ACCOUNTING_58_ATTRIBUTE         58
98 #define ACCOUNTING_59_ATTRIBUTE         59
99 #define CHAP_CHALLENGE_ATTRIBUTE        60
100 #define NAS_PORT_TYPE_ATTRIBUTE         61
101 #define DESIGNATION_NUMBER_ATTRIBUTE    77
102 #define NAS_PORT_ID_ATTRIBUTE           87
103
104 #define SMC_AAAID_ATTRIBUTE             651
105 #define SMC_VPNID_ATTRIBUTE             652
106 #define SMC_VPNNAME_ATTRIBUTE           653
107 #define SMC_RANID_ATTRIBUTE             654
108 #define SMC_RANIP_ATTRIBUTE             655
109 #define SMC_RANNAME_ATTRIBUTE           656
110 #define SMC_POPID_ATTRIBUTE             657
111 #define SMC_POPNAME_ATTRIBUTE           658
112 #define SMC_SMCID_ATTRIBUTE             659
113 #define SMC_RECEIVE_TIME_ATTRIBUTE      660
114 #define SMC_STAT_TIME_ATTRIBUTE         661
115
116 #define OPSI_FLAGS_ATTRIBUTE            674
117 #define OPSI_APPLICATION_NAME_ATTRIBUTE 675
118
119 /*
120  * Published API functions.  NOTE, "local" API functions 
121  * only valid from the packet-opsi file.
122  */
123
124 extern void decode_string_attribute(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length);
125 extern void decode_ipv4_attribute(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length);
126 extern void decode_longint_attribute(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length);
127 extern void decode_value_string_attribute(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length);
128 extern void decode_time_attribute(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int offset, int length);
129 #endif