Coverage Report

Created: 2022-04-19 08:24

/work/build/src/shared/ip-protocol-from-name.h
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
#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
8.88k
#define MIN_WORD_LENGTH 2
42
21.5k
#define MAX_WORD_LENGTH 8
43
#define MIN_HASH_VALUE 2
44
7.62k
#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.80k
{
77
1.80k
  for (;;)
78
7.17k
    {
79
7.17k
      unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
80
7.17k
      unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
81
7.17k
      if (c1 != 0 && c1 == c2)
82
5.37k
        continue;
83
1.80k
      return (int)c1 - (int)c2;
84
7.17k
    }
85
1.80k
}
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 size_t len)
97
7.62k
{
98
7.62k
  static const unsigned char asso_values[] =
99
7.62k
    {
100
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
101
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
102
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
103
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
104
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
105
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
106
7.62k
      77, 77, 77, 77, 77,  5,  0,  5,  5, 35,
107
7.62k
      25, 10,  5,  0, 77, 77, 45,  0,  0, 20,
108
7.62k
       0, 77,  5,  0, 25, 10, 35, 10, 77, 77,
109
7.62k
      77, 77, 77, 77, 77, 77, 77,  5,  0,  5,
110
7.62k
       5, 35, 25, 10,  5,  0, 77, 77, 45,  0,
111
7.62k
       0, 20,  0, 77,  5,  0, 25, 10, 35, 10,
112
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
113
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
114
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
115
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
116
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
117
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
118
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
119
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
120
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
121
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
122
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
123
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
124
7.62k
      77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
125
7.62k
      77, 77, 77, 77, 77, 77
126
7.62k
    };
127
7.62k
  register unsigned int hval = len;
128
129
7.62k
  switch (hval)
130
7.62k
    {
131
5.02k
      default:
132
5.02k
        hval += asso_values[(unsigned char)str[2]];
133
      /*FALLTHROUGH*/
134
7.62k
      case 2:
135
7.62k
        hval += asso_values[(unsigned char)str[1]];
136
      /*FALLTHROUGH*/
137
7.62k
      case 1:
138
7.62k
        hval += asso_values[(unsigned char)str[0]];
139
7.62k
        break;
140
7.62k
    }
141
7.62k
  return hval;
142
7.62k
}
143
144
const struct ip_protocol_name *
145
lookup_ip_protocol (register const char *str, register size_t len)
146
10.7k
{
147
10.7k
  static const struct ip_protocol_name wordlist[] =
148
10.7k
    {
149
10.7k
      {(char*)0}, {(char*)0},
150
10.7k
#line 24 "src/shared/ip-protocol-from-name.gperf"
151
10.7k
      {"IP", IPPROTO_IP},
152
10.7k
#line 31 "src/shared/ip-protocol-from-name.gperf"
153
10.7k
      {"PIM", IPPROTO_PIM},
154
10.7k
#line 25 "src/shared/ip-protocol-from-name.gperf"
155
10.7k
      {"IPIP", IPPROTO_IPIP},
156
10.7k
      {(char*)0}, {(char*)0},
157
10.7k
#line 27 "src/shared/ip-protocol-from-name.gperf"
158
10.7k
      {"MH", IPPROTO_MH},
159
10.7k
#line 22 "src/shared/ip-protocol-from-name.gperf"
160
10.7k
      {"IDP", IPPROTO_IDP},
161
10.7k
#line 20 "src/shared/ip-protocol-from-name.gperf"
162
10.7k
      {"ICMP", IPPROTO_ICMP},
163
10.7k
      {(char*)0},
164
10.7k
#line 21 "src/shared/ip-protocol-from-name.gperf"
165
10.7k
      {"ICMPV6", IPPROTO_ICMPV6},
166
10.7k
#line 9 "src/shared/ip-protocol-from-name.gperf"
167
10.7k
      {"AH", IPPROTO_AH},
168
10.7k
#line 32 "src/shared/ip-protocol-from-name.gperf"
169
10.7k
      {"PUP", IPPROTO_PUP},
170
10.7k
#line 23 "src/shared/ip-protocol-from-name.gperf"
171
10.7k
      {"IGMP", IPPROTO_IGMP},
172
10.7k
      {(char*)0}, {(char*)0}, {(char*)0},
173
10.7k
#line 39 "src/shared/ip-protocol-from-name.gperf"
174
10.7k
      {"UDP", IPPROTO_UDP},
175
10.7k
#line 12 "src/shared/ip-protocol-from-name.gperf"
176
10.7k
      {"DCCP", IPPROTO_DCCP},
177
10.7k
      {(char*)0}, {(char*)0},
178
10.7k
#line 40 "src/shared/ip-protocol-from-name.gperf"
179
10.7k
      {"UDPLITE", IPPROTO_UDPLITE},
180
10.7k
#line 33 "src/shared/ip-protocol-from-name.gperf"
181
10.7k
      {"RAW", IPPROTO_RAW},
182
10.7k
#line 30 "src/shared/ip-protocol-from-name.gperf"
183
10.7k
      {"NONE", IPPROTO_NONE},
184
10.7k
      {(char*)0}, {(char*)0},
185
10.7k
#line 38 "src/shared/ip-protocol-from-name.gperf"
186
10.7k
      {"TP", IPPROTO_TP},
187
10.7k
#line 29 "src/shared/ip-protocol-from-name.gperf"
188
10.7k
      {"MTP", IPPROTO_MTP},
189
10.7k
#line 11 "src/shared/ip-protocol-from-name.gperf"
190
10.7k
      {"COMP", IPPROTO_COMP},
191
10.7k
      {(char*)0}, {(char*)0},
192
10.7k
#line 19 "src/shared/ip-protocol-from-name.gperf"
193
10.7k
      {"HOPOPTS", IPPROTO_HOPOPTS},
194
10.7k
#line 37 "src/shared/ip-protocol-from-name.gperf"
195
10.7k
      {"TCP", IPPROTO_TCP},
196
10.7k
#line 36 "src/shared/ip-protocol-from-name.gperf"
197
10.7k
      {"SCTP", IPPROTO_SCTP},
198
10.7k
      {(char*)0}, {(char*)0},
199
10.7k
#line 13 "src/shared/ip-protocol-from-name.gperf"
200
10.7k
      {"DSTOPTS", IPPROTO_DSTOPTS},
201
10.7k
#line 16 "src/shared/ip-protocol-from-name.gperf"
202
10.7k
      {"ESP", IPPROTO_ESP},
203
10.7k
#line 26 "src/shared/ip-protocol-from-name.gperf"
204
10.7k
      {"IPV6", IPPROTO_IPV6},
205
10.7k
      {(char*)0}, {(char*)0},
206
10.7k
#line 34 "src/shared/ip-protocol-from-name.gperf"
207
10.7k
      {"ROUTING", IPPROTO_ROUTING},
208
10.7k
#line 17 "src/shared/ip-protocol-from-name.gperf"
209
10.7k
      {"FRAGMENT", IPPROTO_FRAGMENT},
210
10.7k
#line 35 "src/shared/ip-protocol-from-name.gperf"
211
10.7k
      {"RSVP", IPPROTO_RSVP},
212
10.7k
#line 15 "src/shared/ip-protocol-from-name.gperf"
213
10.7k
      {"ENCAP", IPPROTO_ENCAP},
214
10.7k
      {(char*)0}, {(char*)0},
215
10.7k
#line 14 "src/shared/ip-protocol-from-name.gperf"
216
10.7k
      {"EGP", IPPROTO_EGP},
217
10.7k
#line 28 "src/shared/ip-protocol-from-name.gperf"
218
10.7k
      {"MPLS", IPPROTO_MPLS},
219
10.7k
      {(char*)0}, {(char*)0}, {(char*)0},
220
10.7k
#line 18 "src/shared/ip-protocol-from-name.gperf"
221
10.7k
      {"GRE", IPPROTO_GRE},
222
10.7k
      {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
223
10.7k
      {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
224
10.7k
      {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
225
10.7k
      {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
226
10.7k
      {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
227
10.7k
      {(char*)0}, {(char*)0},
228
10.7k
#line 10 "src/shared/ip-protocol-from-name.gperf"
229
10.7k
      {"BEETPH", IPPROTO_BEETPH}
230
10.7k
    };
231
232
10.7k
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
233
7.62k
    {
234
7.62k
      register unsigned int key = hash_ip_protocol_name (str, len);
235
236
7.62k
      if (key <= MAX_HASH_VALUE)
237
3.05k
        {
238
3.05k
          register const char *s = wordlist[key].name;
239
240
3.05k
          if (s && (((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s))
241
1.15k
            return &wordlist[key];
242
3.05k
        }
243
7.62k
    }
244
9.60k
  return 0;
245
10.7k
}