mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-06 13:17:44 +03:00
socket-util: add socket_address_type_{from,to}_string()
This commit is contained in:
parent
038ed5a4b6
commit
398ce0bc5a
@ -55,6 +55,17 @@
|
||||
# define IDN_FLAGS 0
|
||||
#endif
|
||||
|
||||
static const char* const socket_address_type_table[] = {
|
||||
[SOCK_STREAM] = "Stream",
|
||||
[SOCK_DGRAM] = "Datagram",
|
||||
[SOCK_RAW] = "Raw",
|
||||
[SOCK_RDM] = "ReliableDatagram",
|
||||
[SOCK_SEQPACKET] = "SequentialPacket",
|
||||
[SOCK_DCCP] = "DatagramCongestionControl",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(socket_address_type, int);
|
||||
|
||||
int socket_address_parse(SocketAddress *a, const char *s) {
|
||||
char *e, *n;
|
||||
unsigned u;
|
||||
|
@ -72,6 +72,9 @@ typedef enum SocketAddressBindIPv6Only {
|
||||
|
||||
#define socket_address_family(a) ((a)->sockaddr.sa.sa_family)
|
||||
|
||||
const char* socket_address_type_to_string(int t) _const_;
|
||||
int socket_address_type_from_string(const char *s) _pure_;
|
||||
|
||||
int socket_address_parse(SocketAddress *a, const char *s);
|
||||
int socket_address_parse_and_warn(SocketAddress *a, const char *s);
|
||||
int socket_address_parse_netlink(SocketAddress *a, const char *s);
|
||||
|
Loading…
Reference in New Issue
Block a user