diff options
Diffstat (limited to 'src/core/socket.c')
-rw-r--r-- | src/core/socket.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index d6d531d377..f3cbe08a44 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1969,6 +1969,28 @@ static const char *socket_sub_state_to_string(Unit *u) { return socket_state_to_string(SOCKET(u)->state); } +const char* socket_port_type_to_string(SocketPort *p) { + + assert(p); + + switch (p->type) { + case SOCKET_SOCKET: + switch (p->address.type) { + case SOCK_STREAM: return "Stream"; + case SOCK_DGRAM: return "Datagram"; + case SOCK_SEQPACKET: return "SequentialPacket"; + case SOCK_RAW: + if (socket_address_family(&p->address) == AF_NETLINK) + return "Netlink"; + default: return "Invalid"; + } + case SOCKET_SPECIAL: return "Special"; + case SOCKET_MQUEUE: return "MessageQueue"; + case SOCKET_FIFO: return "FIFO"; + default: return NULL; + } +} + static bool socket_check_gc(Unit *u) { Socket *s = SOCKET(u); |