00001 // Copyright 2006 Benedikt Böhm <hollow@gentoo.org> 00002 // 00003 // This program is free software; you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation; either version 2 of the License, or 00006 // (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 00015 // Free Software Foundation, Inc., 00016 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 /*! 00019 * @defgroup tcp TCP socket wrappers 00020 * 00021 * The tcp family of functions provide wrappers around connect(2) and listen(2) 00022 * taking an IP address in the string pointed to by ip and the port number as 00023 * arguments. 00024 * 00025 * @{ 00026 */ 00027 00028 #ifndef _LUCID_TCP_H 00029 #define _LUCID_TCP_H 00030 00031 /*! 00032 * @brief listen for incomming connections 00033 * 00034 * @param ip IP to listen on 00035 * @param port port to listen on 00036 * @param backlog queue backlog 00037 * 00038 * @return filedescriptor for the newly allocated socket, -1 on error with errno set 00039 */ 00040 int tcp_listen(const char *ip, int port, int backlog); 00041 00042 /*! 00043 * @brief connect to TCP socket 00044 * 00045 * @param ip IP to connect to 00046 * @param port port to connect to 00047 * 00048 * @return filedescriptor for the newly allocated connection, -1 on error with errno set 00049 */ 00050 int tcp_connect(const char *ip, int port); 00051 00052 #endif 00053 00054 /*! @} tcp */