]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - net.c
net: Make single-use macros local.
[paraslash.git] / net.c
diff --git a/net.c b/net.c
index 4dd376748313c4cd8e614da0744d734062bb5e80..23cd8032f5019796d601976524cb63a7067f7a43 100644 (file)
--- a/net.c
+++ b/net.c
@@ -224,6 +224,10 @@ const char *stringify_port(int port, const char *transport)
        return service;
 }
 
+#ifndef SOCK_DCCP
+#define SOCK_DCCP 6 /**< Linux socket type. */
+#endif
+
 /**
  * Determine the socket type for a given layer-4 protocol.
  *
@@ -834,6 +838,10 @@ int para_accept(int fd, void *addr, socklen_t size, int *new_fd)
        return -ERRNO_TO_PARA_ERROR(errno);
 }
 
+#ifndef DCCP_SOCKOPT_AVAILABLE_CCIDS
+#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12 /**< List of supported CCIDs. */
+#endif
+
 /**
  * Probe the list of DCCP CCIDs configured on this host.
  * \param ccid_array Pointer to return statically allocated array in.
@@ -866,6 +874,18 @@ int dccp_available_ccids(uint8_t **ccid_array)
        return nccids;
 }
 
+/**
+ * The buffer size of the sun_path component of struct sockaddr_un.
+ *
+ * While glibc doesn't define UNIX_PATH_MAX, it documents it has being limited
+ * to 108 bytes. On NetBSD it is only 104 bytes though. We trust UNIX_PATH_MAX
+ * if it is defined and use the size of the ->sun_path member otherwise. This
+ * should be safe everywhere.
+ */
+#ifndef UNIX_PATH_MAX
+#define UNIX_PATH_MAX (sizeof(((struct sockaddr_un *)0)->sun_path))
+#endif
+
 /*
  * Prepare a structure for AF_UNIX socket addresses.
  *