summaryrefslogtreecommitdiffstats
path: root/nanohttp/nanohttp-socket.h
diff options
context:
space:
mode:
authorGravatar m0gg2007-11-03 22:40:09 +0000
committerGravatar m0gg2007-11-03 22:40:09 +0000
commit8a6946b18003fae6400a137389f0cb13d0ac4bd6 (patch)
tree1fb0e6f58de5596f8dae00998da18472fb4952a1 /nanohttp/nanohttp-socket.h
parentc1a7b2dabdc691139b744f0d4750f3b797b69073 (diff)
downloadcsoap-8a6946b18003fae6400a137389f0cb13d0ac4bd6.tar.gz
csoap-8a6946b18003fae6400a137389f0cb13d0ac4bd6.tar.bz2
Split nanoHTTP and cSOAP logging
Diffstat (limited to 'nanohttp/nanohttp-socket.h')
-rw-r--r--nanohttp/nanohttp-socket.h127
1 files changed, 41 insertions, 86 deletions
diff --git a/nanohttp/nanohttp-socket.h b/nanohttp/nanohttp-socket.h
index 115defe..c4f2188 100644
--- a/nanohttp/nanohttp-socket.h
+++ b/nanohttp/nanohttp-socket.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: nanohttp-socket.h,v 1.38 2006/12/11 08:13:19 m0gg Exp $
+ * $Id: nanohttp-socket.h,v 1.39 2007/11/03 22:40:15 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -24,16 +24,19 @@
#ifndef __nanohttp_socket_h
#define __nanohttp_socket_h
-/** @defgroup socket_errors Socket errors
+/** @file nanohttp-socket.h Socket wrapper
+ *
+ * @defgroup NANOHTTP_SOCKET Socket wrapper
+ * @ingroup NANOHTTP
*
*/
-/*@{*/
+/**@{*/
-/**
- *
- * Generic socket error
+/** @defgroup NANOHTTP_SOCKET_ERRORS Generic socket errors
+ * @ingroup NANOHTTP_ERRORS
*
*/
+/**@{*/
#define HSOCKET_ERROR 1000
#define HSOCKET_ERROR_CREATE (HSOCKET_ERROR + 1)
#define HSOCKET_ERROR_GET_HOSTNAME (HSOCKET_ERROR + 2)
@@ -45,23 +48,9 @@
#define HSOCKET_ERROR_ACCEPT (HSOCKET_ERROR + 8)
#define HSOCKET_ERROR_NOT_INITIALIZED (HSOCKET_ERROR + 9)
#define HSOCKET_ERROR_IOCTL (HSOCKET_ERROR + 10)
-
/*@}*/
-/**
- *
- * @todo move the next two items to nanohttp-ssl.h
- *
- */
-#define HSOCKET_ERROR_SSLCLOSE (HSOCKET_ERROR + 11)
-#define HSOCKET_ERROR_SSLCTX (HSOCKET_ERROR + 11)
-
-/*}*/
-
-/**
- *
- * Socket definition
- *
+/** Socket definition
*/
struct hsocket_t
{
@@ -81,54 +70,42 @@ extern "C"
{
#endif
-/**
- *
- * Initializes the socket modul. This should be called only once for an
- * application.
+/** This function iitializes the socket modul. This should be called
+ * only once for an application.
*
* @return This function should always return H_OK.
*
+ * @see hssl_module_destroy()
*/
extern herror_t hsocket_module_init(int argc, char **argv);
-
-/**
- *
- * Destroys the socket modul. This should be called after finishing an
- * application.
- *
- * @see hssl_module_destroy
+/** This function destroys the socket modul. This should be called
+ * after finishing an application.
*
+ * @see hssl_module_init()
*/
extern void hsocket_module_destroy(void);
-/**
- *
- * Initializes a given socket object. This function (or hsokcet_init_ssl) should
- * be called for every socket before using it.
+/** This function initializes a given socket object. This function
+ * (or hsokcet_init_ssl) should be called for every socket before
+ * using it.
*
* @param sock the destination socket to initialize.
*
* @return This function should always return H_OK.
*
- * @see hssl_module_init
- *
+ * @see hssl_module_init()
*/
extern herror_t hsocket_init(struct hsocket_t * sock);
-/**
- *
- * Destroys and releases a given socket.
+/** This function destroys and releases a given socket.
*
* @param sock the socket to destroy
- *
*/
extern void hsocket_free(struct hsocket_t * sock);
-/**
- *
- * Connects to a given host. The hostname can be an IP number or a humen
- * readable hostname.
+/** This function connects to a given host. The hostname can be an IP
+ * number or a humen readable hostname.
*
* @param sock the destonation socket object to use
* @param host hostname
@@ -143,19 +120,14 @@ extern void hsocket_free(struct hsocket_t * sock);
*/
extern herror_t hsocket_open(struct hsocket_t *sock, const char *host, int port, int ssl);
-/**
- e
- * Close a socket connection.
+/** This function closes a socket connection.
*
* @param sock the socket to close
- *
*/
extern void hsocket_close(struct hsocket_t *sock);
-/**
- *
- * Binds a socket to a given port number. After bind you can call
- * hsocket_listen() to listen to the port.
+/** This function binds a socket to a given port number. After bind you
+ * can call hsocket_listen() to listen to the port.
*
* @param sock socket to use.
* @param port port number to bind to
@@ -164,29 +136,24 @@ extern void hsocket_close(struct hsocket_t *sock);
* - HSOCKET_ERROR_CREATE
* - HSOCKET_ERROR_BIND
*
- * @see hsocket_listen
- *
+ * @see hsocket_listen()
*/
extern herror_t hsocket_bind(struct hsocket_t *sock, unsigned short port);
-/**
- *
- * Set the socket to the listen mode. You must bind the socket to a port with
- * hsocket_bind() before you can listen to the port.
+/** This function sets the socket to the listen mode. You must bind the
+ * socket to a port with hsocket_bind() before you can listen to the
+ * port.
*
* @param sock the socket to use
*
* @return H_OK if success. One of the followings if fails:<
* - HSOCKET_ERROR_NOT_INITIALIZED
* - HSOCKET_ERROR_LISTEN
- *
*/
extern herror_t hsocket_listen(struct hsocket_t *sock);
-/**
- *
- * Accepts an incoming socket request. Note that this function
- * will not return until a socket connection is ready.
+/** This function accepts an incoming socket request. Note that this
+ * function will not return until a socket connection is ready.
*
* @param sock the socket which listents to a port
* @param dest the destination socket which will be created
@@ -197,9 +164,7 @@ extern herror_t hsocket_listen(struct hsocket_t *sock);
*/
extern herror_t hsocket_accept(struct hsocket_t *sock, struct hsocket_t *dest);
-/**
- *
- * Sends data throught the socket.
+/** This function sends data throught the socket.
*
* @param sock the socket to use to send the data
* @param bytes bytes to send
@@ -211,9 +176,7 @@ extern herror_t hsocket_accept(struct hsocket_t *sock, struct hsocket_t *dest);
*/
extern herror_t hsocket_send(struct hsocket_t *sock, const unsigned char *bytes, int size);
-/**
- *
- * Sends a string throught the socket
+/** This function sends a string throught the socket
*
* @param sock the socket to use to send the data
* @param str the null terminated string to sent
@@ -221,15 +184,12 @@ extern herror_t hsocket_send(struct hsocket_t *sock, const unsigned char *bytes,
* @return H_OK on success. One of the followings if fails:
* - HSOCKET_ERROR_NOT_INITIALIZED
* - HSOCKET_ERROR_SEND
- *
*/
extern herror_t hsocket_send_string(struct hsocket_t *sock, const char *str);
extern int hsocket_select_recv(int sock, char *buf, size_t len);
-/**
- *
- * Reads data from the socket.
+/** This function reads data from the socket.
*
* @param sock the socket to read data from
* @param buffer the buffer to use to save the readed bytes
@@ -240,29 +200,22 @@ extern int hsocket_select_recv(int sock, char *buf, size_t len);
*
* @return This function will return -1 if an read error was occured. Otherwise
* the return value is the size of bytes readed from the socket.
- *
*/
extern herror_t hsocket_recv(struct hsocket_t * sock, unsigned char *buffer, int size, int force, int *len);
-/**
- *
- * Get the socket read/write timeout.
+/** This function gets the socket read/write timeout.
*
* @return The socket timeout in seconds.
*
- * @see hsocket_set_timeout
- *
+ * @see hsocket_set_timeout()
*/
extern int hsocket_get_timeout(void);
-/**
- *
- * Set the socket read/write timeout.
+/** This function sets the socket read/write timeout.
*
* @param secs Timeout in seconds.
*
- * @see hsocket_get_timeout
- *
+ * @see hsocket_get_timeout()
*/
extern void hsocket_set_timeout(int secs);
@@ -270,4 +223,6 @@ extern void hsocket_set_timeout(int secs);
}
#endif
+/**@}*/
+
#endif