* typedef wcsession, so we don't always need to say gcc again its a struct.
[citadel.git] / webcit / tcp_sockets.c
index fa5429d32b8099f4381af5d51e4863fe9b5ece04..8c603ee1e720fa300961485c54341faf33426c1b 100644 (file)
@@ -1,11 +1,6 @@
 /*
  * $Id$
  */
-/** 
- * \defgroup TcpSockets TCP client socket module for WebCit
- * \ingroup CitadelCommunitacion
- */
-/*@{*/
 
 /*
  * Uncomment this to log all communications with the Citadel server
@@ -16,9 +11,9 @@
 #include "webcit.h"
 #include "webserver.h"
 
-/**
- * \brief register the timeout
- * \param signum signalhandler number
+/*
+ *  register the timeout
+ *  signum signalhandler number
  * \return signals
  */
 RETSIGTYPE timeout(int signum)
@@ -28,9 +23,9 @@ RETSIGTYPE timeout(int signum)
 }
 
 
-/**
- * \brief Connect a unix domain socket
- * \param sockpath where to open a unix domain socket
+/*
+ *  Connect a unix domain socket
+ *  sockpath where to open a unix domain socket
  */
 int uds_connectsock(char *sockpath)
 {
@@ -59,10 +54,10 @@ int uds_connectsock(char *sockpath)
 }
 
 
-/**
- * \brief Connect a TCP/IP socket
- * \param host the host to connect to
- * \param service the service on the host to call
+/*
+ *  Connect a TCP/IP socket
+ *  host the host to connect to
+ *  service the service on the host to call
  */
 int tcp_connectsock(char *host, char *service)
 {
@@ -119,12 +114,12 @@ int tcp_connectsock(char *host, char *service)
 
 
 
-/**
- * \brief Input binary data from socket
- * \param buf the buffer to get the input to
- * \param bytes the maximal number of bytes to read
+/*
+ *  Input binary data from socket
+ *  buf the buffer to get the input to
+ *  bytes the maximal number of bytes to read
  */
-inline void _serv_read(char *buf, int bytes, struct wcsession *WCC)
+inline void _serv_read(char *buf, int bytes, wcsession *WCC)
 {
        int len, rlen;
 
@@ -148,16 +143,16 @@ inline void _serv_read(char *buf, int bytes, struct wcsession *WCC)
 
 void serv_read(char *buf, int bytes)
 {
-       struct wcsession *WCC = WC;
+       wcsession *WCC = WC;
        _serv_read(buf, bytes, WCC);
 }
 
-/**
- * \brief input string from pipe
+/*
+ *  input string from pipe
  */
 int serv_getln(char *strbuf, int bufsize)
 {
-       struct wcsession *WCC = WC;
+       wcsession *WCC = WC;
        int ch, len;
        char buf[2];
 
@@ -213,12 +208,12 @@ int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize)
        return rc;
 }
 
-/**
- * \brief send binary to server
- * \param buf the buffer to write to citadel server
- * \param nbytes how many bytes to send to citadel server
+/*
+ *  send binary to server
+ *  buf the buffer to write to citadel server
+ *  nbytes how many bytes to send to citadel server
  */
-void serv_write(char *buf, int nbytes)
+void serv_write(const char *buf, int nbytes)
 {
        int bytes_written = 0;
        int retval;
@@ -239,11 +234,11 @@ void serv_write(char *buf, int nbytes)
 }
 
 
-/**
- * \brief send line to server
- * \param string the line to send to the citadel server
+/*
+ *  send line to server
+ *  string the line to send to the citadel server
  */
-void serv_puts(char *string)
+void serv_puts(const char *string)
 {
 #ifdef SERV_TRACE
        lprintf(9, "%3d<%s\n", WC->serv_sock, string);
@@ -252,11 +247,24 @@ void serv_puts(char *string)
        serv_write("\n", 1);
 }
 
+/*
+ *  send line to server
+ *  string the line to send to the citadel server
+ */
+void serv_putbuf(const StrBuf *string)
+{
+#ifdef SERV_TRACE
+       lprintf(9, "%3d<%s\n", WC->serv_sock, ChrPtr(string));
+#endif
+       serv_write(ChrPtr(string), StrLength(string));
+       serv_write("\n", 1);
+}
+
 
-/**
- * \brief convenience function to send stuff to the server
- * \param format the formatstring
- * \param ... the entities to insert into format 
+/*
+ *  convenience function to send stuff to the server
+ *  format the formatstring
+ *  ... the entities to insert into format 
  */
 void serv_printf(const char *format,...)
 {
@@ -277,5 +285,3 @@ void serv_printf(const char *format,...)
 #endif
 }
 
-
-/*@}*/