chiark / gitweb /
nss-myhostname: ensure that glibc's assert is used
[elogind.git] / src / core / socket.c
index d6d531d377fee5e40954a89caf78e712b5d1759d..9f1af1e28f2c92accfa94de70a1b0da3e1d85687 100644 (file)
@@ -46,7 +46,7 @@
 #include "dbus-socket.h"
 #include "missing.h"
 #include "special.h"
-#include "bus-errors.h"
+#include "dbus-common.h"
 #include "label.h"
 #include "exit-status.h"
 #include "def.h"
@@ -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);