00001 // Copyright (C) 2006-2007 Benedikt Böhm <hollow@gentoo.org> 00002 // 00003 // This program is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU General Public License 00005 // as published by the Free Software Foundation; either version 2 00006 // of the License, or (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00016 00017 /*! 00018 * @defgroup tcp TCP socket wrappers 00019 * 00020 * The tcp family of functions provide wrappers around connect(2) and listen(2) 00021 * taking an IP address in the string pointed to by ip and the port number as 00022 * arguments. 00023 * 00024 * @{ 00025 */ 00026 00027 #ifndef _LUCID_TCP_H 00028 #define _LUCID_TCP_H 00029 00030 /*! 00031 * @brief listen for incomming connections 00032 * 00033 * @param ip IP to listen on 00034 * @param port port to listen on 00035 * @param backlog queue backlog 00036 * 00037 * @return filedescriptor for the newly allocated socket, -1 on error with errno set 00038 */ 00039 int tcp_listen(const char *ip, int port, int backlog); 00040 00041 /*! 00042 * @brief connect to TCP socket 00043 * 00044 * @param ip IP to connect to 00045 * @param port port to connect to 00046 * 00047 * @return filedescriptor for the newly allocated connection, -1 on error with errno set 00048 */ 00049 int tcp_connect(const char *ip, int port); 00050 00051 #endif 00052 00053 /*! @} tcp */