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