LCOV - code coverage report
Current view: top level - network - networkd-network-gperf.c (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 15 16 93.8 %
Date: 2015-07-29 18:47:03 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* ANSI-C code produced by gperf version 3.0.4 */
       2             : /* Command-line: gperf  */
       3             : /* Computed positions: -k'1,9,13' */
       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             : 
      33             : #include <stddef.h>
      34             : #include "conf-parser.h"
      35             : #include "networkd.h"
      36             : #include "network-internal.h"
      37             : #include <string.h>
      38             : 
      39             : #define TOTAL_KEYWORDS 74
      40             : #define MIN_WORD_LENGTH 10
      41             : #define MAX_WORD_LENGTH 69
      42             : #define MIN_HASH_VALUE 12
      43             : #define MAX_HASH_VALUE 109
      44             : /* maximum key range = 98, duplicates = 0 */
      45             : 
      46             : #ifdef __GNUC__
      47             : __inline
      48             : #else
      49             : #ifdef __cplusplus
      50             : inline
      51             : #endif
      52             : #endif
      53             : static unsigned int
      54          12 : network_network_gperf_hash (register const char *str, register unsigned int len)
      55             : {
      56             :   static const unsigned char asso_values[] =
      57             :     {
      58             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      59             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      60             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      61             :       110, 110,   0, 110, 110, 110, 110, 110, 110, 110,
      62             :       110, 110, 110, 110, 110, 110, 110,   0, 110, 110,
      63             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      64             :       110, 110, 110, 110, 110,  35,   5,   0,   5,  15,
      65             :       110, 110,  40,   0,  10, 110,  20,   5,   0,  70,
      66             :        30,  20,   0,  20,  60,  50, 110,  50, 110, 110,
      67             :       110, 110, 110, 110, 110, 110, 110,  20,  40,  60,
      68             :        20,   0,  25,   0, 110,  35,  15, 110,  35,  25,
      69             :        70,   5,  25,  65,  20,   0,   0,  30,  45,  40,
      70             :       110,  15, 110, 110, 110, 110, 110, 110, 110, 110,
      71             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      72             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      73             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      74             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      75             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      76             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      77             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      78             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      79             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      80             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      81             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      82             :       110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
      83             :       110, 110, 110, 110, 110, 110, 110
      84             :     };
      85          12 :   register int hval = len;
      86             : 
      87          12 :   switch (hval)
      88             :     {
      89             :       default:
      90           6 :         hval += asso_values[(unsigned char)str[12]];
      91             :       /*FALLTHROUGH*/
      92             :       case 12:
      93             :       case 11:
      94             :       case 10:
      95             :       case 9:
      96          12 :         hval += asso_values[(unsigned char)str[8]+1];
      97             :       /*FALLTHROUGH*/
      98             :       case 8:
      99             :       case 7:
     100             :       case 6:
     101             :       case 5:
     102             :       case 4:
     103             :       case 3:
     104             :       case 2:
     105             :       case 1:
     106          12 :         hval += asso_values[(unsigned char)str[0]];
     107          12 :         break;
     108             :     }
     109          12 :   return hval;
     110             : }
     111             : 
     112             : #ifdef __GNUC__
     113             : __inline
     114             : #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
     115             : __attribute__ ((__gnu_inline__))
     116             : #endif
     117             : #endif
     118             : const struct ConfigPerfItem *
     119          12 : network_network_gperf_lookup (register const char *str, register unsigned int len)
     120             : {
     121             :   static const struct ConfigPerfItem wordlist[] =
     122             :     {
     123             :       {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
     124             :       {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
     125             :       {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
     126             :       {"Network.Bond",                  config_parse_netdev,                            0,                             offsetof(Network, bond)},
     127             :       {(char*)0},
     128             :       {"Network.Bridge",                config_parse_netdev,                            0,                             offsetof(Network, bridge)},
     129             :       {"Match.Host",                    config_parse_net_condition,                     CONDITION_HOST,                offsetof(Network, match_host)},
     130             :       {"DHCP.UseMTU",                   config_parse_bool,                              0,                             offsetof(Network, dhcp_mtu)},
     131             :       {"Network.LLDP",                  config_parse_bool,                              0,                             offsetof(Network, lldp)},
     132             :       {"Network.LLMNR",                 config_parse_llmnr,                             0,                             offsetof(Network, llmnr)},
     133             :       {"Network.BindCarrier",           config_parse_strv,                              0,                             offsetof(Network, bind_carrier)},
     134             :       {"Network.Address",               config_parse_address,                           0,                             0},
     135             :       {(char*)0},
     136             :       {"DHCP.SendHostname",             config_parse_bool,                              0,                             offsetof(Network, dhcp_sendhost)},
     137             :       {"DHCPv4.UseHostname",            config_parse_bool,                              0,                             offsetof(Network, dhcp_hostname)},
     138             :       {"Bridge.UseBPDU",                config_parse_bool,                              0,                             offsetof(Network, use_bpdu)},
     139             :       {"BridgeFDB.MACAddress",          config_parse_fdb_hwaddr,                        0,                             0},
     140             :       {"Network.DNS",                   config_parse_strv,                              0,                             offsetof(Network, dns)},
     141             :       {"Network.DHCP",                  config_parse_dhcp,                              0,                             offsetof(Network, dhcp)},
     142             :       {"Match.KernelCommandLine",       config_parse_net_condition,                     CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, match_kernel)},
     143             :       {"Bridge.UnicastFlood",           config_parse_bool,                              0,                             offsetof(Network, unicast_flood)},
     144             :       {"Network.IPMasquerade",          config_parse_bool,                              0,                             offsetof(Network, ip_masquerade)},
     145             :       {"DHCP.UseDNS",                   config_parse_bool,                              0,                             offsetof(Network, dhcp_dns)},
     146             :       {"Match.Driver",                  config_parse_strv,                              0,                             offsetof(Network, match_driver)},
     147             :       {"Link.MTUBytes",                 config_parse_iec_size,                          0,                             offsetof(Network, mtu)},
     148             :       {(char*)0},
     149             :       {"Network.MACVLAN",               config_parse_netdev,                            0,                             0},
     150             :       {"Route.Scope",                   config_parse_route_scope,                       0,                             0},
     151             :       {"Route.Destination",             config_parse_destination,                       0,                             0},
     152             :       {"DHCPv4.UseDNS",                 config_parse_bool,                              0,                             offsetof(Network, dhcp_dns)},
     153             :       {"DHCP.UseRoutes",                config_parse_bool,                              0,                             offsetof(Network, dhcp_routes)},
     154             :       {"Link.MACAddress",               config_parse_hwaddr,                            0,                             offsetof(Network, mac)},
     155             :       {"Bridge.Cost",                   config_parse_unsigned,                          0,                             offsetof(Network, cost)},
     156             :       {"Route.Metric",                  config_parse_route_priority,                    0,                             0},
     157             :       {"Match.Architecture",            config_parse_net_condition,                     CONDITION_ARCHITECTURE,        offsetof(Network, match_arch)},
     158             :       {"Network.IPv4LL",                config_parse_ipv4ll,                            0,                             offsetof(Network, link_local)},
     159             :       {"Match.Path",                    config_parse_strv,                              0,                             offsetof(Network, match_path)},
     160             :       {"Match.MACAddress",              config_parse_hwaddr,                            0,                             offsetof(Network, match_mac)},
     161             :       {"Network.IPForward",             config_parse_address_family_boolean_with_kernel,0,                             offsetof(Network, ip_forward)},
     162             :       {"DHCP.Hostname",                 config_parse_hostname,                          0,                             offsetof(Network, hostname)},
     163             :       {"Network.IPv4LLRoute",           config_parse_bool,                              0,                             offsetof(Network, ipv4ll_route)},
     164             :       {"DHCPv4.UseDomainName",          config_parse_bool,                              0,                             offsetof(Network, dhcp_domains)},
     165             :       {"DHCP.RouteMetric",              config_parse_unsigned,                          0,                             offsetof(Network, dhcp_route_metric)},
     166             :       {"Network.LinkLocalAddressing",   config_parse_address_family_boolean,            0,                             offsetof(Network, link_local)},
     167             :       {"Network.DHCPServer",            config_parse_bool,                              0,                             offsetof(Network, dhcp_server)},
     168             :       {"Network.Description",           config_parse_string,                            0,                             offsetof(Network, description)},
     169             :       {"Address.Address",               config_parse_address,                           0,                             0},
     170             :       {"BridgeFDB.VLANId",              config_parse_fdb_vlan_id,                       0,                             0},
     171             :       {"Route.Source",                  config_parse_destination,                       0,                             0},
     172             :       {"Route.Gateway",                 config_parse_gateway,                           0,                             0},
     173             :       {"Network.IPVLAN",                config_parse_netdev,                            0,                             0},
     174             :       {"Match.Virtualization",          config_parse_net_condition,                     CONDITION_VIRTUALIZATION,      offsetof(Network, match_virt)},
     175             :       {"Bridge.FastLeave",              config_parse_bool,                              0,                             offsetof(Network, fast_leave)},
     176             :       {"Network.VLAN",                  config_parse_netdev,                            0,                             0},
     177             :       {"Network.VXLAN",                 config_parse_netdev,                            0,                             0},
     178             :       {"Network.Tunnel",                config_parse_tunnel,                            0,                             0},
     179             :       {"Network.Domains",               config_parse_domains,                           0,                             offsetof(Network, domains)},
     180             :       {"DHCP.VendorClassIdentifier",    config_parse_string,                            0,                             offsetof(Network, dhcp_vendor_class_identifier)},
     181             :       {"Address.Peer",                  config_parse_address,                           0,                             0},
     182             :       {"DHCPv4.UseMTU",                 config_parse_bool,                              0,                             offsetof(Network, dhcp_mtu)},
     183             :       {"Network.IPv6PrivacyExtensions", config_parse_ipv6_privacy_extensions,           0,                             offsetof(Network, ipv6_privacy_extensions)},
     184             :       {"DHCP.UseDomains",               config_parse_bool,                              0,                             offsetof(Network, dhcp_domains)},
     185             :       {"DHCP.ClientIdentifier",         config_parse_dhcp_client_identifier,            0,                             offsetof(Network, dhcp_client_identifier)},
     186             :       {"Address.Broadcast",             config_parse_broadcast,                         0,                             0},
     187             :       {"DHCP.UseDomainName",            config_parse_bool,                              0,                             offsetof(Network, dhcp_domains)},
     188             :       {(char*)0},
     189             :       {"Network.MACVTAP",               config_parse_netdev,                            0,                             0},
     190             :       {"DHCP.RequestBroadcast",         config_parse_bool,                              0,                             offsetof(Network, dhcp_broadcast)},
     191             :       {(char*)0}, {(char*)0}, {(char*)0},
     192             :       {"Match.Type",                    config_parse_strv,                              0,                             offsetof(Network, match_type)},
     193             :       {"Network.NTP",                   config_parse_strv,                              0,                             offsetof(Network, ntp)},
     194             :       {(char*)0}, {(char*)0},
     195             :       {"Bridge.AllowPortToBeRoot",      config_parse_bool,                              0,                             offsetof(Network, allow_port_to_be_root)},
     196             :       {"Match.Name",                    config_parse_ifnames,                           0,                             offsetof(Network, match_name)},
     197             :       {"DHCP.UseNTP",                   config_parse_bool,                              0,                             offsetof(Network, dhcp_ntp)},
     198             :       {"Network.IPv6Token",             config_parse_ipv6token,                         0,                             offsetof(Network, ipv6_token)},
     199             :       {"Address.Label",                 config_parse_label,                             0,                             0},
     200             :       {(char*)0},
     201             :       {"DHCPv4.CriticalConnection",     config_parse_bool,                              0,                             offsetof(Network, dhcp_critical)},
     202             :       {"DHCP.UseHostname",              config_parse_bool,                              0,                             offsetof(Network, dhcp_hostname)},
     203             :       {(char*)0},
     204             :       {"DHCP.CriticalConnection",       config_parse_bool,                              0,                             offsetof(Network, dhcp_critical)},
     205             :       {"Bridge.HairPin",                config_parse_bool,                              0,                             offsetof(Network, hairpin)},
     206             :       {"Network.Gateway",               config_parse_gateway,                           0,                             0},
     207             :       {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
     208             :       {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
     209             :       {(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
     210             :       {(char*)0},
     211             :       {"/* backwards compatibility: do not add new entries to this section */"}
     212             :     };
     213             : 
     214          12 :   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     215             :     {
     216          12 :       register int key = network_network_gperf_hash (str, len);
     217             : 
     218          12 :       if (key <= MAX_HASH_VALUE && key >= 0)
     219             :         {
     220          12 :           register const char *s = wordlist[key].section_and_lvalue;
     221             : 
     222          12 :           if (s && *str == *s && !strcmp (str + 1, s + 1))
     223          12 :             return &wordlist[key];
     224             :         }
     225             :     }
     226           0 :   return 0;
     227             : }

Generated by: LCOV version 1.11