X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftcp_sockets.c;h=37d538c370865b367d9a595f35afaf8568755552;hb=1e32899153e9e52aaec1e651e0c33a563b8aaed8;hp=9e38fac27d2c350694530a36710a32665c440c90;hpb=e179f15e9ec8978e1ebda8f59ca3842f6c2205bd;p=citadel.git diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index 9e38fac27..37d538c37 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -1,44 +1,25 @@ /* * $Id$ - * - * TCP client socket module for WebCit - * */ +/** + * \defgroup TcpSockets TCP client socket module for WebCit + * \ingroup CitadelCommunitacion + */ +/*@{*/ /* * Uncomment this to log all communications with the Citadel server #define SERV_TRACE 1 */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "webcit.h" #include "webserver.h" - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - +/** + * \brief register the timeout + * \param signum signalhandler number + * \return signals + */ RETSIGTYPE timeout(int signum) { lprintf(1, "Connection timed out.\n"); @@ -46,9 +27,9 @@ RETSIGTYPE timeout(int signum) } - -/* - * Connect a unix domain socket +/** + * \brief Connect a unix domain socket + * \param sockpath where to open a unix domain socket */ int uds_connectsock(char *sockpath) { @@ -77,8 +58,10 @@ int uds_connectsock(char *sockpath) } -/* - * Connect a TCP/IP socket +/** + * \brief Connect a TCP/IP socket + * \param host the host to connect to + * \param service the service on the host to call */ int tcp_connectsock(char *host, char *service) { @@ -135,8 +118,10 @@ int tcp_connectsock(char *host, char *service) -/* - * Input binary data from socket +/** + * \brief Input binary data from socket + * \param buf the buffer to get the input to + * \param bytes the maximal number of bytes to read */ void serv_read(char *buf, int bytes) { @@ -160,21 +145,21 @@ void serv_read(char *buf, int bytes) } -/* - * input string from pipe +/** + * \brief input string from pipe */ -void serv_gets(char *strbuf) +void serv_getln(char *strbuf, int bufsize) { int ch, len; char buf[2]; len = 0; - strcpy(strbuf, ""); + strbuf[0] = 0; do { serv_read(&buf[0], 1); ch = buf[0]; strbuf[len++] = ch; - } while ((ch != 10) && (ch != 0) && (len < (SIZ-1))); + } while ((ch != 10) && (ch != 0) && (len < (bufsize-1))); if (strbuf[len-1] == 10) strbuf[--len] = 0; if (strbuf[len-1] == 13) strbuf[--len] = 0; #ifdef SERV_TRACE @@ -184,8 +169,10 @@ void serv_gets(char *strbuf) -/* - * send binary to server +/** + * \brief send binary to server + * \param buf the buffer to write to citadel server + * \param nbytes how many bytes to send to citadel server */ void serv_write(char *buf, int nbytes) { @@ -208,8 +195,9 @@ void serv_write(char *buf, int nbytes) } -/* - * send line to server +/** + * \brief send line to server + * \param string the line to send to the citadel server */ void serv_puts(char *string) { @@ -223,8 +211,10 @@ void serv_puts(char *string) } -/* - * convenience function to send stuff to the server +/** + * \brief convenience function to send stuff to the server + * \param format the formatstring + * \param ... the entities to insert into format */ void serv_printf(const char *format,...) { @@ -241,3 +231,6 @@ void serv_printf(const char *format,...) lprintf(9, "<%s", buf); #endif } + + +/*@}*/