/work/build/src/shared/ip-protocol-from-name.inc
Line | Count | Source (jump to first uncovered line) |
1 | | /* ANSI-C code produced by gperf version 3.1 */ |
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-gperf@gnu.org>." |
30 | | #endif |
31 | | |
32 | | #line 1 "src/shared/ip-protocol-from-name.gperf" |
33 | | |
34 | | _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") |
35 | | #if __GNUC__ >= 15 |
36 | | _Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") |
37 | | #endif |
38 | | #include <netinet/in.h> |
39 | | #line 8 "src/shared/ip-protocol-from-name.gperf" |
40 | | struct ip_protocol_name { const char* name; int id; }; |
41 | | |
42 | | #define TOTAL_KEYWORDS 32 |
43 | 16.5k | #define MIN_WORD_LENGTH 2 |
44 | 37.7k | #define MAX_WORD_LENGTH 8 |
45 | | #define MIN_HASH_VALUE 2 |
46 | 12.5k | #define MAX_HASH_VALUE 76 |
47 | | /* maximum key range = 75, duplicates = 0 */ |
48 | | |
49 | | #ifndef GPERF_DOWNCASE |
50 | | #define GPERF_DOWNCASE 1 |
51 | | static unsigned char gperf_downcase[256] = |
52 | | { |
53 | | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
54 | | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, |
55 | | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
56 | | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, |
57 | | 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, |
58 | | 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
59 | | 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
60 | | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
61 | | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
62 | | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, |
63 | | 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, |
64 | | 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, |
65 | | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, |
66 | | 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, |
67 | | 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
68 | | 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, |
69 | | 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, |
70 | | 255 |
71 | | }; |
72 | | #endif |
73 | | |
74 | | #ifndef GPERF_CASE_STRCMP |
75 | | #define GPERF_CASE_STRCMP 1 |
76 | | static int |
77 | | gperf_case_strcmp (register const char *s1, register const char *s2) |
78 | 3.50k | { |
79 | 3.50k | for (;;) |
80 | 14.8k | { |
81 | 14.8k | unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; |
82 | 14.8k | unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; |
83 | 14.8k | if (c1 != 0 && c1 == c2) |
84 | 11.3k | continue; |
85 | 3.50k | return (int)c1 - (int)c2; |
86 | 14.8k | } |
87 | 3.50k | } |
88 | | #endif |
89 | | |
90 | | #ifdef __GNUC__ |
91 | | __inline |
92 | | #else |
93 | | #ifdef __cplusplus |
94 | | inline |
95 | | #endif |
96 | | #endif |
97 | | static unsigned int |
98 | | hash_ip_protocol_name (register const char *str, register size_t len) |
99 | 12.5k | { |
100 | 12.5k | static const unsigned char asso_values[] = |
101 | 12.5k | { |
102 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
103 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
104 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
105 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
106 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
107 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
108 | 12.5k | 77, 77, 77, 77, 77, 5, 0, 5, 5, 35, |
109 | 12.5k | 25, 10, 5, 0, 77, 77, 45, 0, 0, 20, |
110 | 12.5k | 0, 77, 5, 0, 25, 10, 35, 10, 77, 77, |
111 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 5, 0, 5, |
112 | 12.5k | 5, 35, 25, 10, 5, 0, 77, 77, 45, 0, |
113 | 12.5k | 0, 20, 0, 77, 5, 0, 25, 10, 35, 10, |
114 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
115 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
116 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
117 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
118 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
119 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
120 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
121 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
122 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
123 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
124 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
125 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
126 | 12.5k | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
127 | 12.5k | 77, 77, 77, 77, 77, 77 |
128 | 12.5k | }; |
129 | 12.5k | register unsigned int hval = len; |
130 | | |
131 | 12.5k | switch (hval) |
132 | 12.5k | { |
133 | 6.67k | default: |
134 | 6.67k | hval += asso_values[(unsigned char)str[2]]; |
135 | | /*FALLTHROUGH*/ |
136 | 12.5k | case 2: |
137 | 12.5k | hval += asso_values[(unsigned char)str[1]]; |
138 | | /*FALLTHROUGH*/ |
139 | 12.5k | case 1: |
140 | 12.5k | hval += asso_values[(unsigned char)str[0]]; |
141 | 12.5k | break; |
142 | 12.5k | } |
143 | 12.5k | return hval; |
144 | 12.5k | } |
145 | | |
146 | | const struct ip_protocol_name * |
147 | | lookup_ip_protocol (register const char *str, register size_t len) |
148 | 18.8k | { |
149 | 18.8k | static const struct ip_protocol_name wordlist[] = |
150 | 18.8k | { |
151 | 18.8k | {(char*)0}, {(char*)0}, |
152 | 18.8k | #line 26 "src/shared/ip-protocol-from-name.gperf" |
153 | 18.8k | {"IP", IPPROTO_IP}, |
154 | 18.8k | #line 33 "src/shared/ip-protocol-from-name.gperf" |
155 | 18.8k | {"PIM", IPPROTO_PIM}, |
156 | 18.8k | #line 27 "src/shared/ip-protocol-from-name.gperf" |
157 | 18.8k | {"IPIP", IPPROTO_IPIP}, |
158 | 18.8k | {(char*)0}, {(char*)0}, |
159 | 18.8k | #line 29 "src/shared/ip-protocol-from-name.gperf" |
160 | 18.8k | {"MH", IPPROTO_MH}, |
161 | 18.8k | #line 24 "src/shared/ip-protocol-from-name.gperf" |
162 | 18.8k | {"IDP", IPPROTO_IDP}, |
163 | 18.8k | #line 22 "src/shared/ip-protocol-from-name.gperf" |
164 | 18.8k | {"ICMP", IPPROTO_ICMP}, |
165 | 18.8k | {(char*)0}, |
166 | 18.8k | #line 23 "src/shared/ip-protocol-from-name.gperf" |
167 | 18.8k | {"ICMPV6", IPPROTO_ICMPV6}, |
168 | 18.8k | #line 11 "src/shared/ip-protocol-from-name.gperf" |
169 | 18.8k | {"AH", IPPROTO_AH}, |
170 | 18.8k | #line 34 "src/shared/ip-protocol-from-name.gperf" |
171 | 18.8k | {"PUP", IPPROTO_PUP}, |
172 | 18.8k | #line 25 "src/shared/ip-protocol-from-name.gperf" |
173 | 18.8k | {"IGMP", IPPROTO_IGMP}, |
174 | 18.8k | {(char*)0}, {(char*)0}, {(char*)0}, |
175 | 18.8k | #line 41 "src/shared/ip-protocol-from-name.gperf" |
176 | 18.8k | {"UDP", IPPROTO_UDP}, |
177 | 18.8k | #line 14 "src/shared/ip-protocol-from-name.gperf" |
178 | 18.8k | {"DCCP", IPPROTO_DCCP}, |
179 | 18.8k | {(char*)0}, {(char*)0}, |
180 | 18.8k | #line 42 "src/shared/ip-protocol-from-name.gperf" |
181 | 18.8k | {"UDPLITE", IPPROTO_UDPLITE}, |
182 | 18.8k | #line 35 "src/shared/ip-protocol-from-name.gperf" |
183 | 18.8k | {"RAW", IPPROTO_RAW}, |
184 | 18.8k | #line 32 "src/shared/ip-protocol-from-name.gperf" |
185 | 18.8k | {"NONE", IPPROTO_NONE}, |
186 | 18.8k | {(char*)0}, {(char*)0}, |
187 | 18.8k | #line 40 "src/shared/ip-protocol-from-name.gperf" |
188 | 18.8k | {"TP", IPPROTO_TP}, |
189 | 18.8k | #line 31 "src/shared/ip-protocol-from-name.gperf" |
190 | 18.8k | {"MTP", IPPROTO_MTP}, |
191 | 18.8k | #line 13 "src/shared/ip-protocol-from-name.gperf" |
192 | 18.8k | {"COMP", IPPROTO_COMP}, |
193 | 18.8k | {(char*)0}, {(char*)0}, |
194 | 18.8k | #line 21 "src/shared/ip-protocol-from-name.gperf" |
195 | 18.8k | {"HOPOPTS", IPPROTO_HOPOPTS}, |
196 | 18.8k | #line 39 "src/shared/ip-protocol-from-name.gperf" |
197 | 18.8k | {"TCP", IPPROTO_TCP}, |
198 | 18.8k | #line 38 "src/shared/ip-protocol-from-name.gperf" |
199 | 18.8k | {"SCTP", IPPROTO_SCTP}, |
200 | 18.8k | {(char*)0}, {(char*)0}, |
201 | 18.8k | #line 15 "src/shared/ip-protocol-from-name.gperf" |
202 | 18.8k | {"DSTOPTS", IPPROTO_DSTOPTS}, |
203 | 18.8k | #line 18 "src/shared/ip-protocol-from-name.gperf" |
204 | 18.8k | {"ESP", IPPROTO_ESP}, |
205 | 18.8k | #line 28 "src/shared/ip-protocol-from-name.gperf" |
206 | 18.8k | {"IPV6", IPPROTO_IPV6}, |
207 | 18.8k | {(char*)0}, {(char*)0}, |
208 | 18.8k | #line 36 "src/shared/ip-protocol-from-name.gperf" |
209 | 18.8k | {"ROUTING", IPPROTO_ROUTING}, |
210 | 18.8k | #line 19 "src/shared/ip-protocol-from-name.gperf" |
211 | 18.8k | {"FRAGMENT", IPPROTO_FRAGMENT}, |
212 | 18.8k | #line 37 "src/shared/ip-protocol-from-name.gperf" |
213 | 18.8k | {"RSVP", IPPROTO_RSVP}, |
214 | 18.8k | #line 17 "src/shared/ip-protocol-from-name.gperf" |
215 | 18.8k | {"ENCAP", IPPROTO_ENCAP}, |
216 | 18.8k | {(char*)0}, {(char*)0}, |
217 | 18.8k | #line 16 "src/shared/ip-protocol-from-name.gperf" |
218 | 18.8k | {"EGP", IPPROTO_EGP}, |
219 | 18.8k | #line 30 "src/shared/ip-protocol-from-name.gperf" |
220 | 18.8k | {"MPLS", IPPROTO_MPLS}, |
221 | 18.8k | {(char*)0}, {(char*)0}, {(char*)0}, |
222 | 18.8k | #line 20 "src/shared/ip-protocol-from-name.gperf" |
223 | 18.8k | {"GRE", IPPROTO_GRE}, |
224 | 18.8k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
225 | 18.8k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
226 | 18.8k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
227 | 18.8k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
228 | 18.8k | {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0}, |
229 | 18.8k | {(char*)0}, {(char*)0}, |
230 | 18.8k | #line 12 "src/shared/ip-protocol-from-name.gperf" |
231 | 18.8k | {"BEETPH", IPPROTO_BEETPH} |
232 | 18.8k | }; |
233 | | |
234 | 18.8k | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
235 | 12.5k | { |
236 | 12.5k | register unsigned int key = hash_ip_protocol_name (str, len); |
237 | | |
238 | 12.5k | if (key <= MAX_HASH_VALUE) |
239 | 6.31k | { |
240 | 6.31k | register const char *s = wordlist[key].name; |
241 | | |
242 | 6.31k | if (s && (((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s)) |
243 | 1.57k | return &wordlist[key]; |
244 | 6.31k | } |
245 | 12.5k | } |
246 | 17.3k | return 0; |
247 | 18.8k | } |