/work/build/src/shared/ip-protocol-from-name.h
Line | Count | Source |
1 | | /* ANSI-C code produced by gperf version 3.0.4 */ |
2 | | /* Command-line: /usr/bin/gperf -L ANSI-C -t --ignore-case -N lookup_ip_protocol -H hash_ip_protocol_name -p -C src/shared/ip-protocol-from-name.gperf */ |
3 | | /* Computed positions: -k'1-3' */ |
4 | | |
5 | | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
6 | | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ |
7 | | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ |
8 | | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ |
9 | | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ |
10 | | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ |
11 | | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ |
12 | | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ |
13 | | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ |
14 | | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ |
15 | | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ |
16 | | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ |
17 | | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ |
18 | | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ |
19 | | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ |
20 | | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ |
21 | | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ |
22 | | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ |
23 | | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ |
24 | | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ |
25 | | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ |
26 | | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ |
27 | | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) |
28 | | /* The character set is not based on ISO-646. */ |
29 | | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." |
30 | | #endif |
31 | | |
32 | | #line 1 "src/shared/ip-protocol-from-name.gperf" |
33 | | |
34 | | #if __GNUC__ >= 7 |
35 | | _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") |
36 | | #endif |
37 | | #line 6 "src/shared/ip-protocol-from-name.gperf" |
38 | | struct ip_protocol_name { const char* name; int id; }; |
39 | | |
40 | | #define TOTAL_KEYWORDS 32 |
41 | 4.95k | #define MIN_WORD_LENGTH 2 |
42 | 11.3k | #define MAX_WORD_LENGTH 8 |
43 | | #define MIN_HASH_VALUE 2 |
44 | 8.38k | #define MAX_HASH_VALUE 76 |
45 | | /* maximum key range = 75, duplicates = 0 */ |
46 | | |
47 | | #ifndef GPERF_DOWNCASE |
48 | | #define GPERF_DOWNCASE 1 |
49 | | static unsigned char gperf_downcase[256] = |
50 | | { |
51 | | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
52 | | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, |
53 | | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
54 | | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, |
55 | | 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, |
56 | | 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
57 | | 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
58 | | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
59 | | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
60 | | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, |
61 | | 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, |
62 | | 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, |
63 | | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, |
64 | | 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, |
65 | | 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
66 | | 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, |
67 | | 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, |
68 | | 255 |
69 | | }; |
70 | | #endif |
71 | | |
72 | | #ifndef GPERF_CASE_STRCMP |
73 | | #define GPERF_CASE_STRCMP 1 |
74 | | static int |
75 | | gperf_case_strcmp (register const char *s1, register const char *s2) |
76 | 1.55k | { |
77 | 1.55k | for (;;) |
78 | 6.80k | { |
79 | 6.80k | unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; |
80 | 6.80k | unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; |
81 | 6.80k | if (c1 != 0 && c1 == c2) |
82 | 5.25k | continue; |
83 | 1.55k | return (int)c1 - (int)c2; |
84 | 1.55k | } |
85 | 1.55k | } |
86 | | #endif |
87 | | |
88 | | #ifdef __GNUC__ |
89 | | __inline |
90 | | #else |
91 | | #ifdef __cplusplus |
92 | | inline |
93 | | #endif |
94 | | #endif |
95 | | static unsigned int |
96 | | hash_ip_protocol_name (register const char *str, register unsigned int len) |
97 | 4.19k | { |
98 | 4.19k | static const unsigned char asso_values[] = |
99 | 4.19k | { |
100 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
101 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
102 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
103 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
104 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
105 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
106 | 4.19k | 77, 77, 77, 77, 77, 5, 0, 5, 5, 35, |
107 | 4.19k | 25, 10, 5, 0, 77, 77, 45, 0, 0, 20, |
108 | 4.19k | 0, 77, 5, 0, 25, 10, 35, 10, 77, 77, |
109 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 5, 0, 5, |
110 | 4.19k | 5, 35, 25, 10, 5, 0, 77, 77, 45, 0, |
111 | 4.19k | 0, 20, 0, 77, 5, 0, 25, 10, 35, 10, |
112 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
113 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
114 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
115 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
116 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
117 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
118 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
119 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
120 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
121 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
122 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
123 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
124 | 4.19k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
125 | 4.19k | 77, 77, 77, 77, 77, 77 |
126 | 4.19k | }; |
127 | 4.19k | register int hval = len; |
128 | 4.19k | |
129 | 4.19k | switch (hval) |
130 | 4.19k | { |
131 | 4.19k | default: |
132 | 3.29k | hval += asso_values[(unsigned char)str[2]]; |
133 | 3.29k | /*FALLTHROUGH*/ |
134 | 4.19k | case 2: |
135 | 4.19k | hval += asso_values[(unsigned char)str[1]]; |
136 | 4.19k | /*FALLTHROUGH*/ |
137 | 4.19k | case 1: |
138 | 4.19k | hval += asso_values[(unsigned char)str[0]]; |
139 | 4.19k | break; |
140 | 4.19k | } |
141 | 4.19k | return hval; |
142 | 4.19k | } |
143 | | |
144 | | #ifdef __GNUC__ |
145 | | __inline |
146 | | #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ |
147 | | __attribute__ ((__gnu_inline__)) |
148 | | #endif |
149 | | #endif |
150 | | const struct ip_protocol_name * |
151 | | lookup_ip_protocol (register const char *str, register unsigned int len) |
152 | 5.69k | { |
153 | 5.69k | static const struct ip_protocol_name wordlist[] = |
154 | 5.69k | { |
155 | 5.69k | {(char*)0}, {(char*)0}, |
156 | 5.69k | #line 24 "src/shared/ip-protocol-from-name.gperf" |
157 | 5.69k | {"IP", IPPROTO_IP}, |
158 | 5.69k | #line 31 "src/shared/ip-protocol-from-name.gperf" |
159 | 5.69k | {"PIM", IPPROTO_PIM}, |
160 | 5.69k | #line 25 "src/shared/ip-protocol-from-name.gperf" |
161 | 5.69k | {"IPIP", IPPROTO_IPIP}, |
162 | 5.69k | {(char*)0}, {(char*)0}, |
163 | 5.69k | #line 27 "src/shared/ip-protocol-from-name.gperf" |
164 | 5.69k | {"MH", IPPROTO_MH}, |
165 | 5.69k | #line 22 "src/shared/ip-protocol-from-name.gperf" |
166 | 5.69k | {"IDP", IPPROTO_IDP}, |
167 | 5.69k | #line 20 "src/shared/ip-protocol-from-name.gperf" |
168 | 5.69k | {"ICMP", IPPROTO_ICMP}, |
169 | 5.69k | {(char*)0}, |
170 | 5.69k | #line 21 "src/shared/ip-protocol-from-name.gperf" |
171 | 5.69k | {"ICMPV6", IPPROTO_ICMPV6}, |
172 | 5.69k | #line 9 "src/shared/ip-protocol-from-name.gperf" |
173 | 5.69k | {"AH", IPPROTO_AH}, |
174 | 5.69k | #line 32 "src/shared/ip-protocol-from-name.gperf" |
175 | 5.69k | {"PUP", IPPROTO_PUP}, |
176 | 5.69k | #line 23 "src/shared/ip-protocol-from-name.gperf" |
177 | 5.69k | {"IGMP", IPPROTO_IGMP}, |
178 | 5.69k | {(char*)0}, {(char*)0}, {(char*)0}, |
179 | 5.69k | #line 39 "src/shared/ip-protocol-from-name.gperf" |
180 | 5.69k | {"UDP", IPPROTO_UDP}, |
181 | 5.69k | #line 12 "src/shared/ip-protocol-from-name.gperf" |
182 | 5.69k | {"DCCP", IPPROTO_DCCP}, |
183 | 5.69k | {(char*)0}, {(char*)0}, |
184 | 5.69k | #line 40 "src/shared/ip-protocol-from-name.gperf" |
185 | 5.69k | {"UDPLITE", IPPROTO_UDPLITE}, |
186 | 5.69k | #line 33 "src/shared/ip-protocol-from-name.gperf" |
187 | 5.69k | {"RAW", IPPROTO_RAW}, |
188 | 5.69k | #line 30 "src/shared/ip-protocol-from-name.gperf" |
189 | 5.69k | {"NONE", IPPROTO_NONE}, |
190 | 5.69k | {(char*)0}, {(char*)0}, |
191 | 5.69k | #line 38 "src/shared/ip-protocol-from-name.gperf" |
192 | 5.69k | {"TP", IPPROTO_TP}, |
193 | 5.69k | #line 29 "src/shared/ip-protocol-from-name.gperf" |
194 | 5.69k | {"MTP", IPPROTO_MTP}, |
195 | 5.69k | #line 11 "src/shared/ip-protocol-from-name.gperf" |
196 | 5.69k | {"COMP", IPPROTO_COMP}, |
197 | 5.69k | {(char*)0}, {(char*)0}, |
198 | 5.69k | #line 19 "src/shared/ip-protocol-from-name.gperf" |
199 | 5.69k | {"HOPOPTS", IPPROTO_HOPOPTS}, |
200 | 5.69k | #line 37 "src/shared/ip-protocol-from-name.gperf" |
201 | 5.69k | {"TCP", IPPROTO_TCP}, |
202 | 5.69k | #line 36 "src/shared/ip-protocol-from-name.gperf" |
203 | 5.69k | {"SCTP", IPPROTO_SCTP}, |
204 | 5.69k | {(char*)0}, {(char*)0}, |
205 | 5.69k | #line 13 "src/shared/ip-protocol-from-name.gperf" |
206 | 5.69k | {"DSTOPTS", IPPROTO_DSTOPTS}, |
207 | 5.69k | #line 16 "src/shared/ip-protocol-from-name.gperf" |
208 | 5.69k | {"ESP", IPPROTO_ESP}, |
209 | 5.69k | #line 26 "src/shared/ip-protocol-from-name.gperf" |
210 | 5.69k | {"IPV6", IPPROTO_IPV6}, |
211 | 5.69k | {(char*)0}, {(char*)0}, |
212 | 5.69k | #line 34 "src/shared/ip-protocol-from-name.gperf" |
213 | 5.69k | {"ROUTING", IPPROTO_ROUTING}, |
214 | 5.69k | #line 17 "src/shared/ip-protocol-from-name.gperf" |
215 | 5.69k | {"FRAGMENT", IPPROTO_FRAGMENT}, |
216 | 5.69k | #line 35 "src/shared/ip-protocol-from-name.gperf" |
217 | 5.69k | {"RSVP", IPPROTO_RSVP}, |
218 | 5.69k | #line 15 "src/shared/ip-protocol-from-name.gperf" |
219 | 5.69k | {"ENCAP", IPPROTO_ENCAP}, |
220 | 5.69k | {(char*)0}, {(char*)0}, |
221 | 5.69k | #line 14 "src/shared/ip-protocol-from-name.gperf" |
222 | 5.69k | {"EGP", IPPROTO_EGP}, |
223 | 5.69k | #line 28 "src/shared/ip-protocol-from-name.gperf" |
224 | 5.69k | {"MPLS", IPPROTO_MPLS}, |
225 | 5.69k | {(char*)0}, {(char*)0}, {(char*)0}, |
226 | 5.69k | #line 18 "src/shared/ip-protocol-from-name.gperf" |
227 | 5.69k | {"GRE", IPPROTO_GRE}, |
228 | 5.69k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
229 | 5.69k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
230 | 5.69k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
231 | 5.69k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
232 | 5.69k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
233 | 5.69k | {(char*)0}, {(char*)0}, |
234 | 5.69k | #line 10 "src/shared/ip-protocol-from-name.gperf" |
235 | 5.69k | {"BEETPH", IPPROTO_BEETPH} |
236 | 5.69k | }; |
237 | 5.69k | |
238 | 5.69k | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
239 | 5.69k | { |
240 | 4.19k | register int key = hash_ip_protocol_name (str, len); |
241 | 4.19k | |
242 | 4.19k | if (key <= MAX_HASH_VALUE && key >= 0) |
243 | 2.50k | { |
244 | 2.50k | register const char *s = wordlist[key].name; |
245 | 2.50k | |
246 | 2.50k | if (s && (((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s)) |
247 | 1.14k | return &wordlist[key]; |
248 | 4.55k | } |
249 | 4.19k | } |
250 | 4.55k | return 0; |
251 | 4.55k | } |