]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/socket-protocol-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright 2014 Lennart Poettering
6 #include <netinet/in.h>
9 #include "socket-protocol-list.h"
12 static const struct socket_protocol_name
* lookup_socket_protocol(register const char *str
, register GPERF_LEN_TYPE len
);
14 #include "socket-protocol-from-name.h"
15 #include "socket-protocol-to-name.h"
17 const char *socket_protocol_to_name(int id
) {
22 if (id
>= (int) ELEMENTSOF(socket_protocol_names
))
25 return socket_protocol_names
[id
];
28 int socket_protocol_from_name(const char *name
) {
29 const struct socket_protocol_name
*sc
;
33 sc
= lookup_socket_protocol(name
, strlen(name
));
40 int socket_protocol_max(void) {
41 return ELEMENTSOF(socket_protocol_names
);