Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Transport becomes a real module
[simgrid.git] / src / gras / Transport / transport_private.h
1 /* $Id$ */
2
3 /* trp (transport) - send/receive a bunch of bytes                          */
4
5 /* This file implements the public interface of this module, exported to the*/
6 /*  other modules of GRAS, but not to the end user.                         */
7
8 /* Authors: Martin Quinson                                                  */
9 /* Copyright (C) 2004 Martin Quinson.                                       */
10
11 /* This program is free software; you can redistribute it and/or modify it
12    under the terms of the license (GNU LGPL) which comes with this package. */
13
14 #ifndef GRAS_TRP_PRIVATE_H
15 #define GRAS_TRP_PRIVATE_H
16
17 #include "gras_private.h"
18 /* A low-level socket type (each plugin implements it the way it prefers */
19 //typedef void gras_trp_sock_t;
20  
21 /* A plugin type */
22 struct gras_trp_plugin_ {
23   const char *name;
24  
25   gras_error_t (*init)(void);
26   void         (*exit)(gras_trp_plugin_t *);
27  
28   gras_error_t (*socket_client_open)(const char *host,
29                                      unsigned short port,
30                                      int raw,
31                                      unsigned int bufSize,
32                                      /* OUT */ gras_trp_sock_t **dst);
33   gras_error_t (*socket_server_open)(unsigned short port,
34                                      int raw,
35                                      unsigned int bufSize,
36                                      /* OUT */ gras_trp_sock_t **dst);
37   void (*socket_close)(gras_trp_sock_t **sd);
38  
39   gras_error_t (*select)(double timeOut,
40                          gras_trp_sock_t **sd);
41    
42   gras_error_t (*bloc_send)(gras_trp_sock_t *sd,
43                             void *data,
44                             size_t size,
45                             double timeOut);
46   gras_error_t (*bloc_recv)(gras_trp_sock_t *sd,
47                             void *data,
48                             size_t size,
49                             double timeOut);
50   gras_error_t (*flush)(gras_trp_sock_t *sd);
51  
52   void *specific;
53 };
54
55 /**********************************************************************
56  * Internal stuff to the module. Other modules shouldn't fool with it *
57  **********************************************************************/
58
59 /* TCP driver */
60 gras_error_t gras_trp_tcp_init(void);
61 void         gras_trp_tcp_exit(gras_trp_plugin_t *plugin);
62 gras_error_t gras_trp_tcp_socket_client(const char *host,
63                                         unsigned short port,
64                                         int raw, 
65                                         unsigned int bufSize, 
66                                         /* OUT */ gras_trp_sock_t **dst);
67 gras_error_t gras_trp_tcp_socket_server(unsigned short port,
68                                         int raw, 
69                                         unsigned int bufSize, 
70                                         /* OUT */ gras_trp_sock_t **dst);
71 void         gras_trp_tcp_socket_close(gras_trp_sock_t **sd);
72 gras_error_t gras_trp_tcp_select(double timeOut,
73                                  gras_trp_sock_t **sd);
74   
75 gras_error_t gras_trp_tcp_bloc_send(gras_trp_sock_t *sd,
76                                     void *data,
77                                     size_t size,
78                                     double timeOut);
79
80 gras_error_t gras_trp_tcp_bloc_recv(gras_trp_sock_t *sd,
81                                     void *data,
82                                     size_t size,
83                                     double timeOut);
84 gras_error_t gras_trp_tcp_flush(gras_trp_sock_t *sd);
85
86 /* SG driver */
87 gras_error_t gras_trp_sg_init(void);
88 void         gras_trp_sg_exit(gras_trp_plugin_t *plugin);
89 gras_error_t gras_trp_sg_socket_client(const char *host,
90                                        unsigned short port,
91                                        int raw, 
92                                        unsigned int bufSize, 
93                                        /* OUT */ gras_trp_sock_t **dst);
94 gras_error_t gras_trp_sg_socket_server(unsigned short port,
95                                        int raw, 
96                                        unsigned int bufSize, 
97                                        /* OUT */ gras_trp_sock_t **dst);
98 void         gras_trp_sg_socket_close(gras_trp_sock_t **sd);
99 gras_error_t gras_trp_sg_select(double timeOut,
100                                 gras_trp_sock_t **sd);
101
102 gras_error_t gras_trp_sg_bloc_send(gras_trp_sock_t *sd,
103                                    void *data,
104                                    size_t size,
105                                    double timeOut);
106
107 gras_error_t gras_trp_sg_bloc_recv(gras_trp_sock_t *sd,
108                                    void *data,
109                                    size_t size,
110                                    double timeOut);
111 gras_error_t gras_trp_sg_flush(gras_trp_sock_t *sd);
112
113
114
115 #endif /* GRAS_TRP_PRIVATE_H */