]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/ip-protocol-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include <netinet/in.h>
7 #include "ip-protocol-list.h"
10 static const struct ip_protocol_name
* lookup_ip_protocol(register const char *str
, register GPERF_LEN_TYPE len
);
12 #include "ip-protocol-from-name.h"
13 #include "ip-protocol-to-name.h"
15 const char *ip_protocol_to_name(int id
) {
20 if ((size_t) id
>= ELEMENTSOF(ip_protocol_names
))
23 return ip_protocol_names
[id
];
26 int ip_protocol_from_name(const char *name
) {
27 const struct ip_protocol_name
*sc
;
31 sc
= lookup_ip_protocol(name
, strlen(name
));