Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
f5f1c3d96ec55f7b935cff63decf461952bfe187
[simgrid.git] / src / gras / Transport / transport_private.h
1 /* $Id$ */
2
3 /* transport - low level communication (send/receive bunches of bytes)      */
4
5 /* module's private interface masked even to other parts of GRAS.           */
6
7 /* Authors: Martin Quinson                                                  */
8 /* Copyright (C) 2004 Martin Quinson.                                       */
9
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. */
12
13 #ifndef GRAS_TRP_PRIVATE_H
14 #define GRAS_TRP_PRIVATE_H
15
16 #include "gras_private.h"
17 #include "gras/Transport/transport_interface.h"
18 #include "gras/Virtu/virtu_interface.h" /* socketset_get() */
19
20 /**
21  * s_gras_socket:
22  * 
23  * Description of a socket.
24  */
25 typedef struct gras_trp_bufdata_ gras_trp_bufdata_t;
26
27 struct s_gras_socket  {
28   gras_trp_plugin_t *plugin;
29     
30   int incoming :1; /* true if we can read from this sock */
31   int outgoing :1; /* true if we can write on this sock */
32   int accepting :1; /* true if master incoming sock in tcp */
33   int raw :1; /* true if this is an experiment socket instead of messaging */
34
35   unsigned long int bufSize; /* what to say to the OS. field here to remember it when accepting */
36    
37   int  sd; 
38   int  port; /* port on this side */
39   int  peer_port; /* port on the other side */
40   char *peer_name; /* hostname of the other side */
41
42   void *data;    /* plugin specific data */
43
44   /* buffer plugin specific data. Yeah, C is not OO, so I got to trick */
45   gras_trp_bufdata_t *bufdata; 
46 };
47         
48 void gras_trp_socket_new(int incomming,
49                          gras_socket_t **dst);
50
51 /* The drivers */
52 typedef gras_error_t (*gras_trp_setup_t)(gras_trp_plugin_t *dst);
53
54 gras_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug);
55 gras_error_t gras_trp_file_setup(gras_trp_plugin_t *plug);
56 gras_error_t gras_trp_sg_setup(gras_trp_plugin_t *plug);
57 gras_error_t gras_trp_buf_setup(gras_trp_plugin_t *plug);
58
59 /*
60
61   I'm tired of that shit. the select in SG has to create a socket to expeditor
62   manually do deal with the weirdness of the hostdata, themselves here to deal
63   with the weird channel concept of SG and convert them back to ports.
64   
65   When introducing buffered transport (whith I want to get used in SG to debug
66   the buffering itself), we should not make the rest of the code aware of the
67   change and not specify code for this. This is bad design.
68   
69   But there is bad design all over the place, so fuck off for now, when we can
70   get rid of MSG and rely directly on SG, this crude hack can go away. But in
71   the meanwhile, I want to sleep this night (FIXME).
72   
73   Hu! You evil problem! Taste my axe!
74
75 */
76
77 void gras_trp_buf_init_sock(gras_socket_t *sock);
78
79
80 /* Data exchange over raw sockets */
81 gras_error_t gras_socket_raw_exchange(gras_socket_t *peer,
82                                       int sender,
83                                       unsigned int timeout,
84                                       unsigned long int expSize,
85                                       unsigned long int msgSize);
86
87 #endif /* GRAS_TRP_PRIVATE_H */