-typedef struct s_gras_socket gras_socket_t;
-
-gras_error_t gras_socket_client(const char *host,
- unsigned short port,
- /* OUT */ gras_socket_t **dst);
-gras_error_t gras_socket_server(unsigned short port,
- /* OUT */ gras_socket_t **dst);
-void gras_socket_close(gras_socket_t *sd);
-
-/* get information about socket */
-int gras_socket_my_port (gras_socket_t *sock);
-int gras_socket_peer_port(gras_socket_t *sock);
-char *gras_socket_peer_name(gras_socket_t *sock);
-
-/* extended interface to get all details */
-gras_error_t gras_socket_client_ext(const char *host,
- unsigned short port,
- unsigned long int bufSize,
- int raw,
- /* OUT */ gras_socket_t **dst);
-gras_error_t gras_socket_server_ext(unsigned short port,
- unsigned long int bufSize,
- int raw,
- /* OUT */ gras_socket_t **dst);
-
-/* using raw sockets */
-gras_error_t gras_socket_raw_send(gras_socket_t *peer,
- unsigned int timeout,
- unsigned long int expSize,
- unsigned long int msgSize);
-gras_error_t gras_socket_raw_recv(gras_socket_t *peer,
- unsigned int timeout,
- unsigned long int expSize,
- unsigned long int msgSize);
+#include "xbt/socket.h"
+
+/** \addtogroup GRAS_sock
+ * \brief Socket handling
+ *
+ * The model of communications in GRAS is very close to the BSD socket one.
+ * To get two hosts exchanging data, one of them need to open a
+ * <i>server</i> socket on which it can listen for incoming messages and the
+ * other one must connect a <i>client</i> socket onto the server one.
+ *
+ * The main difference is that you cannot exchange arbitrary bytes on
+ * sockets, but messages. See the \ref GRAS_msg section for details.
+ *
+ * If you need an example of how to use sockets, check \ref GRAS_ex_ping.
+ *
+ */
+
+/** \defgroup GRAS_sock_create Socket creation functions
+ * \ingroup GRAS_sock
+ *
+ */
+/* @{*/
+
+/** \brief Simply create a client socket (to speak to a remote host) */
+XBT_PUBLIC(xbt_socket_t) gras_socket_client(const char *host,
+ unsigned short port);
+XBT_PUBLIC(xbt_socket_t) gras_socket_client_from_string(const char *host);
+/** \brief Simply create a server socket (to ear from remote hosts speaking to you) */
+XBT_PUBLIC(xbt_socket_t) gras_socket_server(unsigned short port);
+XBT_PUBLIC(void) gras_socket_close(xbt_socket_t sd);
+XBT_PUBLIC(void) gras_socket_close_voidp(void *sock);
+
+/** \brief Create a client socket, full interface to all relevant settings */
+XBT_PUBLIC(xbt_socket_t) gras_socket_client_ext(const char *host,
+ unsigned short port,
+ unsigned long int bufSize,
+ int measurement);
+/** \brief Create a server socket, full interface to all relevant settings */
+XBT_PUBLIC(xbt_socket_t) gras_socket_server_ext(unsigned short port,
+ unsigned long int bufSize,
+ int measurement);
+XBT_PUBLIC(xbt_socket_t)
+ gras_socket_server_range(unsigned short minport, unsigned short maxport,
+ unsigned long int buf_size, int measurement);