3 /* transport - low level communication (send/receive bunches of bytes) */
5 /* module's public interface exported within GRAS, but not to end user. */
7 /* Copyright (c) 2004 Martin Quinson. All rights reserved. */
9 /* This program is free software; you can redistribute it and/or modify it
10 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #ifndef GRAS_TRP_INTERFACE_H
13 #define GRAS_TRP_INTERFACE_H
16 *** Main user functions
18 /* stable if we know the storage will keep as is until the next trp_flush */
19 void gras_trp_send(gras_socket_t sd, char *data, long int size, int stable);
20 void gras_trp_recv(gras_socket_t sd, char *data, long int size);
21 void gras_trp_flush(gras_socket_t sd);
23 /* Find which socket needs to be read next */
24 gras_socket_t gras_trp_select(double timeout);
32 typedef struct gras_trp_plugin_ s_gras_trp_plugin_t, *gras_trp_plugin_t;
35 struct gras_trp_plugin_ {
38 /* dst pointers are created and initialized with default values
39 before call to socket_client/server.
40 Retrive the info you need from there. */
41 void (*socket_client)(gras_trp_plugin_t self,
43 void (*socket_server)(gras_trp_plugin_t self,
46 gras_socket_t (*socket_accept)(gras_socket_t from);
49 /* socket_close() is responsible of telling the OS that the socket is over,
50 but should not free the socket itself (beside the specific part) */
51 void (*socket_close)(gras_socket_t sd);
53 /* send/recv may be buffered */
54 void (*send)(gras_socket_t sd,
56 unsigned long int size,
57 int stable /* storage will survive until flush*/);
58 int (*recv)(gras_socket_t sd,
60 unsigned long int size);
61 /* raw_send/raw_recv is never buffered (use it for measurement stuff) */
62 void (*raw_send)(gras_socket_t sd,
64 unsigned long int size);
65 int (*raw_recv)(gras_socket_t sd,
67 unsigned long int size);
69 /* flush has to make sure that the pending communications are achieved */
70 void (*flush)(gras_socket_t sd);
72 void *data; /* plugin-specific data */
74 /* exit is responsible for freeing data and telling the OS this plugin goes */
75 /* exit=NULL, data gets freed. (ie exit function needed only when data contains pointers) */
76 void (*exit)(gras_trp_plugin_t);
80 gras_trp_plugin_get_by_name(const char *name);
82 /* Data of this module specific to each process
83 * (used by sg_process.c to cleanup the SG channel cruft)
89 unsigned int name_len;
91 xbt_dynar_t sockets; /* all sockets known to this process */
94 /* SG only elements. In RL, they are part of the OS ;) */
95 int chan; /* Formated messages channel */
96 int measChan; /* Unformated echange channel for performance measurement*/
98 } s_gras_trp_procdata_t,*gras_trp_procdata_t;
100 #endif /* GRAS_TRP_INTERFACE_H */