net.h: add missing __printf_2_3 attribute to send_va_buffer()
[paraslash.git] / dccp.c
1 /*
2 * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file dccp.c common functions of the dccp sender/receiver */
8
9 /*
10 * based on common.c of dccp-cs-0.01.tar.bz2,
11 * (C) 2005 Ian McDonald <imcdnzl@gmail.com>
12 */
13
14 #include "para.h"
15 #include "error.h"
16 #include "dccp.h"
17 #include "fd.h"
18
19 /** \cond some magic dccp constants */
20 #define SOCK_DCCP 6
21 #define IPPROTO_DCCP 33
22 /** \endcond */
23
24 /**
25 * obtain a dccp socket for sending/receiving
26 *
27 * \return the file descriptor of the new socket or \p -E_DCCP_SOCKET
28 * on errors.
29 */
30 int dccp_get_socket(void)
31 {
32 int s = socket(AF_INET, SOCK_DCCP, IPPROTO_DCCP);
33
34 if (s < 0)
35 return -E_DCCP_SOCKET;
36 return s;
37 }
38
39 /**
40 * prepare a dccp socket
41 *
42 * \param fd the file descriptor of the socket
43 *
44 * \returns positive on success, negative on errors.
45 */
46 int dccp_set_socket(__a_unused int fd)
47 {
48 return 1; /* nothing to do at the moment */
49 }