- Replace flags used for LCP/IPCP with state machine.
[l2tpns.git] / constants.c
1 // L2TPNS: constants
2
3 char const *cvs_id_constants = "$Id: constants.c,v 1.7 2005/07/31 10:04:10 bodea Exp $";
4
5 #include <stdio.h>
6 #include "constants.h"
7
8 #define CONSTANT(table, ...) \
9 static char const *table ## s[] = { \
10 __VA_ARGS__ \
11 }; \
12 char const *table(int index) \
13 { \
14 static char n[16]; \
15 if (index >= 0 && index < sizeof(table ## s) / sizeof(table ## s[0]) \
16 && table ## s[index]) \
17 return table ## s[index]; \
18 snprintf(n, sizeof(n), "%d", index); \
19 return n; \
20 }
21
22 CONSTANT(l2tp_code,
23 0, // 0
24 "SCCRQ", // 1
25 "SCCRP", // 2
26 "SCCCN", // 3
27 "StopCCN", // 4
28 0, // 5
29 "HELLO", // 6
30 "OCRQ", // 7
31 "OCRP", // 8
32 "OCCN", // 9
33 "ICRQ", // 10
34 "ICRP", // 11
35 "ICCN", // 12
36 0, // 13
37 "CDN", // 14
38 "WEN", // 15
39 "SLI" // 16
40 )
41
42 CONSTANT(l2tp_avp_name,
43 "Message Type", // 0
44 "Result Code", // 1
45 "Protocol Version", // 2
46 "Framing Capabilities", // 3
47 "Bearer Capabilities", // 4
48 "Tie Breaker", // 5
49 "Firmware Revision", // 6
50 "Host Name", // 7
51 "Vendor Name", // 8
52 "Assigned Tunnel ID", // 9
53 "Receive Window Size", // 10
54 "Challenge", // 11
55 "Q.931 Cause Code", // 12
56 "Challenge Response", // 13
57 "Assigned Session ID", // 14
58 "Call Serial Number", // 15
59 "Minimum BPS", // 16
60 "Maximum BPS", // 17
61 "Bearer Type", // 18 (2 = Analog, 1 = Digital)
62 "Framing Type", // 19 (2 = Async, 1 = Sync)
63 0, // 20
64 "Called Number", // 21
65 "Calling Number", // 22
66 "Sub Address", // 23
67 "Tx Connect Speed", // 24
68 "Physical Channel ID", // 25
69 "Initial Received LCP CONFREQ", // 26
70 "Last Sent LCP CONFREQ", // 27
71 "Last Received LCP CONFREQ", // 28
72 "Proxy Authen Type", // 29
73 "Proxy Authen Name", // 30
74 "Proxy Authen Challenge", // 31
75 "Proxy Authen ID", // 32
76 "Proxy Authen Response", // 33
77 "Call Errors", // 34
78 "ACCM", // 35
79 "Random Vector", // 36
80 "Private Group ID", // 37
81 "Rx Connect Speed", // 38
82 "Sequencing Required" // 39
83 )
84
85 CONSTANT(l2tp_stopccn_result_code,
86 0, // 0
87 "General request to clear control connection", // 1
88 "General error--Error Code indicates the problem", // 2
89 "Control channel already exists", // 3
90 "Requester is not authorized to establish a"
91 " control channel", // 4
92 "The protocol version of the requester is not"
93 " supported", // 5
94 "Requester is being shut down", // 6
95 "Finite State Machine error" // 7
96 )
97
98 CONSTANT(l2tp_cdn_result_code,
99 0, // 0
100 "Call disconnected due to loss of carrier", // 1
101 "Call disconnected for the reason indicated in"
102 " error code", // 2
103 "Call disconnected for administrative reasons", // 3
104 "Call failed due to lack of appropriate facilities"
105 " being available (temporary condition)", // 4
106 "Call failed due to lack of appropriate facilities"
107 " being available (permanent condition)", // 5
108 "Invalid destination", // 6
109 "Call failed due to no carrier detected", // 7
110 "Call failed due to detection of a busy signal", // 8
111 "Call failed due to lack of a dial tone", // 9
112 "Call was not established within time allotted by"
113 " LAC", // 10
114 "Call was connected but no appropriate framing was"
115 " detected" // 11
116 )
117
118 CONSTANT(l2tp_error_code,
119 "No general error", // 0
120 "No control connection exists yet for this LAC-LNS"
121 " pair", // 1
122 "Length is wrong", // 2
123 "One of the field values was out of range or"
124 " reserved field was non-zero", // 3
125 "Insufficient resources to handle this operation"
126 " now", // 4
127 "The Session ID is invalid in this context", // 5
128 "A generic vendor-specific error occurred in the"
129 " LAC", // 6
130 "Try another LNS", // 7
131 "Session or tunnel was shutdown due to receipt of"
132 " an unknown AVP with the M-bit set" // 8
133 )
134
135 CONSTANT(ppp_phase,
136 "Dead", // 0
137 "Establish", // 1
138 "Authenticate", // 2
139 "Network", // 3
140 "Terminate", // 4
141 )
142
143 CONSTANT(ppp_state,
144 "Initial", // 0
145 "Starting", // 1
146 "Closed", // 2
147 "Stopped", // 3
148 "Closing", // 4
149 "Stopping", // 5
150 "Request-Sent", // 6
151 "Ack-Received", // 7
152 "Ack-Sent", // 8
153 "Opened" // 9
154 )
155
156 CONSTANT(ppp_auth_type,
157 0, // 0
158 "Textual username/password exchange", // 1
159 "PPP CHAP", // 2
160 "PPP PAP", // 3
161 "No Authentication", // 4
162 "Microsoft CHAP Version 1 (MSCHAPv1)" // 5
163 )
164
165 CONSTANT(ppp_code,
166 0, // 0
167 "ConfigReq", // 1
168 "ConfigAck", // 2
169 "ConfigNak", // 3
170 "ConfigRej", // 4
171 "TerminateReq", // 5
172 "TerminateAck", // 6
173 "CodeRej", // 7
174 "ProtocolRej", // 8
175 "EchoReq", // 9
176 "EchoReply", // 10
177 "DiscardRequest", // 11
178 "IdentRequest" // 12
179 )
180
181 CONSTANT(ppp_lcp_option,
182 0, // 0
183 "Maximum-Receive-Unit", // 1
184 "Async-Control-Map", // 2
185 "Authentication-Protocol", // 3
186 "Quality-Protocol", // 4
187 "Magic-Number", // 5
188 0, // 6
189 "Protocol-Field-Compression", // 7
190 "Address-and-Control-Field-Compression" // 8
191 )
192
193 CONSTANT(radius_state,
194 "RADIUSNULL", // 0
195 "RADIUSCHAP", // 1
196 "RADIUSAUTH", // 2
197 "RADIUSSTART", // 3
198 "RADIUSSTOP", // 4
199 "RADIUSINTERIM", // 5
200 "RADIUSWAIT" // 6
201 )
202
203 CONSTANT(radius_code,
204 0, // 0
205 "Access-Request", // 1
206 "Access-Accept", // 2
207 "Access-Reject", // 3
208 "Accounting-Request", // 4
209 "Accounting-Response", // 5
210 0, // 6
211 0, // 7
212 0, // 8
213 0, // 9
214 0, // 10
215 "Access-Challenge", // 11
216 "Status-Server", // 12
217 "Status-Client", // 13
218 0, 0, 0, 0, 0, 0, // 14-19
219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20-29
220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30-39
221 "Disconnect-Request", // 40
222 "Disconnect-ACK", // 41
223 "Disconnect-NAK", // 42
224 "CoA-Request", // 43
225 "CoA-ACK", // 44
226 "CoA-NAK" // 45
227 )