]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - dccp.c
04_DCCP-socket-functions.diff
[paraslash.git] / dccp.c
diff --git a/dccp.c b/dccp.c
index 5e769be2b3c93df259257c956d632c21c224dc48..f5f940a665d1d4c160bd3b312f09c61c5e815ce5 100644 (file)
--- a/dccp.c
+++ b/dccp.c
@@ -1,7 +1,31 @@
+/*
+ * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
+ *
+ * Licensed under the GPL v2. For licencing details see COPYING.
+ */
+
+/** \file dccp.c common functions of the dccp sender/receiver */
+
+/*
+ * based on common.c of dccp-cs-0.01.tar.bz2,
+ * (C) 2005 Ian McDonald <imcdnzl@gmail.com>
+ */
+
+#include <sys/types.h>
+#include <dirent.h>
+
 #include "para.h"
 #include "error.h"
 #include "dccp.h"
+#include "fd.h"
+#include "net.h"
 
+/**
+ * obtain a dccp socket for sending/receiving
+ *
+ * \return the file descriptor of the new socket or \p -E_DCCP_SOCKET
+ * on errors.
+ */
 int dccp_get_socket(void)
 {
        int s = socket(AF_INET, SOCK_DCCP, IPPROTO_DCCP);
@@ -11,18 +35,14 @@ int dccp_get_socket(void)
        return s;
 }
 
-int dccp_set_socket(int fd)
+/**
+ * prepare a dccp socket
+ *
+ * \param fd the file descriptor of the socket
+ *
+ * \returns positive on success, negative on errors.
+ */
+int dccp_set_socket(__a_unused int fd)
 {
-       int pkt_size = 256, ret;
-
-       /* hack to get a service code */
-       ret = setsockopt(fd, SOL_DCCP, DCCP_SOCKOPT_PACKET_SIZE,
-               (char*)&pkt_size, sizeof(pkt_size));
-       if (ret < 0)
-               return -E_DCCP_PACKET_SIZE;
-       ret = setsockopt(fd, SOL_DCCP, DCCP_SOCKOPT_SERVICE,
-               (char*)&pkt_size, sizeof(pkt_size));
-       if (ret < 0)
-               return -E_DCCP_SERVICE;
-       return 1;
+       return 1;       /* nothing to do at the moment */
 }