3 /* transport - low level communication (send/receive bunches of bytes) */
5 /* module's public interface exported within GRAS, but not to end user. */
7 /* Authors: Martin Quinson */
8 /* Copyright (C) 2004 Martin Quinson. */
10 /* This program is free software; you can redistribute it and/or modify it
11 under the terms of the license (GNU LGPL) which comes with this package. */
13 #ifndef GRAS_TRP_INTERFACE_H
14 #define GRAS_TRP_INTERFACE_H
16 #include "gras_private.h"
19 *** Main user functions
21 gras_error_t gras_trp_chunk_send(gras_socket_t *sd,
24 gras_error_t gras_trp_chunk_recv(gras_socket_t *sd,
28 /* Find which socket needs to be read next */
30 gras_trp_select(double timeout,
35 *** Module declaration
37 gras_error_t gras_trp_init(void);
38 void gras_trp_exit(void);
45 typedef struct gras_trp_plugin_ gras_trp_plugin_t;
51 * Caracterize each possible transport plugin
53 typedef enum e_gras_trp_plugin {
54 e_gras_trp_plugin_undefined = 0,
57 } gras_trp_plugin_type_t;
60 struct gras_trp_plugin_ {
63 gras_error_t (*socket_client)(gras_trp_plugin_t *self,
67 /* OUT */ gras_socket_t **dst);
68 gras_error_t (*socket_server)(gras_trp_plugin_t *self,
71 /* OUT */ gras_socket_t **dst);
72 gras_error_t (*socket_accept)(gras_socket_t *sock,
73 /* OUT */gras_socket_t **dst);
76 /* socket_close() is responsible of telling the OS that the socket is over,
77 but should not free the socket itself (beside the specific part) */
78 void (*socket_close)(gras_socket_t *sd);
80 gras_error_t (*chunk_send)(gras_socket_t *sd,
83 gras_error_t (*chunk_recv)(gras_socket_t *sd,
88 void (*free_specific)(void *);
92 gras_trp_plugin_get_by_name(const char *name,
93 gras_trp_plugin_t **dst);
95 #endif /* GRAS_TRP_INTERFACE_H */