+#define CONSTANT(table, ...) \
+ static char const *table ## s[] = { \
+ __VA_ARGS__ \
+ }; \
+ char const *table(int index) \
+ { \
+ static char n[16]; \
+ if (index >= 0 && index < sizeof(table ## s) / sizeof(table ## s[0]) \
+ && table ## s[index]) \
+ return table ## s[index]; \
+ snprintf(n, sizeof(n), "%d", index); \
+ return n; \
+ }
+
+CONSTANT(lcp_type,
+ 0, // 0
+ "Maximum-Receive-Unit", // 1
+ "Async-Control-Map", // 2
+ "Authentication-Protocol", // 3
+ "Quality-Protocol", // 4
+ "Magic-Number", // 5
+ 0, // 6
+ "Protocol-Field-Compression", // 7
+ "Address-and-Control-Field-Compression" // 8
+)
+
+CONSTANT(avp_name,
+ "Message Type", // 0
+ "Result Code", // 1
+ "Protocol Version", // 2
+ "Framing Capabilities", // 3
+ "Bearer Capabilities", // 4
+ "Tie Breaker", // 5
+ "Firmware Revision", // 6
+ "Host Name", // 7
+ "Vendor Name", // 8
+ "Assigned Tunnel ID", // 9
+ "Receive Window Size", // 10
+ "Challenge", // 11
+ "Q.931 Cause Code", // 12
+ "Challenge Response", // 13
+ "Assigned Session ID", // 14
+ "Call Serial Number", // 15
+ "Minimum BPS", // 16
+ "Maximum BPS", // 17
+ "Bearer Type", // 18 (2 = Analog, 1 = Digital)
+ "Framing Type", // 19 (2 = Async, 1 = Sync)
+ 0, // 20
+ "Called Number", // 21
+ "Calling Number", // 22
+ "Sub Address", // 23
+ "Tx Connect Speed", // 24
+ "Physical Channel ID", // 25
+ "Initial Received LCP CONFREQ", // 26
+ "Last Sent LCP CONFREQ", // 27
+ "Last Received LCP CONFREQ", // 28
+ "Proxy Authen Type", // 29
+ "Proxy Authen Name", // 30
+ "Proxy Authen Challenge", // 31
+ "Proxy Authen ID", // 32
+ "Proxy Authen Response", // 33
+ "Call Errors", // 34
+ "ACCM", // 35
+ "Random Vector", // 36
+ "Private Group ID", // 37
+ "Rx Connect Speed", // 38
+ "Sequencing Required" // 39
+)