Logo AND Algorithmique Numérique Distribuée

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