X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=dccp.c;h=147e46307676b60025561e4f81167a3a72b22b90;hp=5e769be2b3c93df259257c956d632c21c224dc48;hb=e2213f2468eb1c6f8ca033c6529ee1b5ceadab7f;hpb=c9f109a9e7f2d6116b7906a852afc339c858c275 diff --git a/dccp.c b/dccp.c index 5e769be2..147e4630 100644 --- a/dccp.c +++ b/dccp.c @@ -1,7 +1,46 @@ +/* + * Copyright (C) 2006 Andre Noll + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + */ + +/** \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 + */ + #include "para.h" #include "error.h" #include "dccp.h" +/** \cond some magic dccp constants */ +#define SOL_DCCP 269 +#define SOCK_DCCP 6 +#define IPPROTO_DCCP 33 +#define DCCP_SOCKOPT_PACKET_SIZE 1 +#define DCCP_SOCKOPT_SERVICE 2 +/** \endcond */ + +/** + * 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,6 +50,13 @@ int dccp_get_socket(void) return s; } +/** + * prepare a dccp socket + * + * \param fd the file descriptor of the socket + * + * \returns positive on success, negative on errors. + */ int dccp_set_socket(int fd) { int pkt_size = 256, ret;