Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Detect socket closed by peer in the transport layer, so that such things don't polute...
[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/dynar.h"
18 #include "xbt/dict.h"
19
20 #include "gras/emul.h"       /* gras_if_RL() */
21
22 #include "gras_modinter.h"   /* module init/exit */
23 #include "gras/transport.h"  /* rest of module interface */
24
25 #include "gras/Transport/transport_interface.h" /* semi-public API */
26 #include "gras/Virtu/virtu_interface.h" /* libdata management */
27
28 extern int gras_trp_libdata_id; /* our libdata identifier */
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 meas :1; /* true if this is an experiment socket instead of messaging */
43   int recv_ok :1; /* true if it is valid to recv() on the socket (false if it is a file) */
44
45   unsigned long int buf_size; /* what to say to the OS. field here to remember it when accepting */
46    
47   int  sd; 
48   int  port; /* port on this side */
49   int  peer_port; /* port on the other side */
50   char *peer_name; /* hostname of the other side */
51   char *peer_proc; /* process on the other side */
52
53   void *data;    /* plugin specific data */
54
55   /* buffer plugin specific data. Yeah, C is not OO, so I got to trick */
56   gras_trp_bufdata_t *bufdata; 
57 }s_gras_socket_t;
58         
59 void gras_trp_socket_new(int incomming,
60                          gras_socket_t *dst);
61
62 /* The drivers */
63 typedef void (*gras_trp_setup_t)(gras_trp_plugin_t dst);
64
65 void gras_trp_tcp_setup(gras_trp_plugin_t plug);
66 void gras_trp_iov_setup(gras_trp_plugin_t plug);
67 void gras_trp_file_setup(gras_trp_plugin_t plug);
68 void gras_trp_sg_setup(gras_trp_plugin_t plug);
69
70 /*
71
72   I'm tired of that shit. the select in SG has to create a socket to expeditor
73   manually do deal with the weirdness of the hostdata, themselves here to deal
74   with the weird channel concept of SG and convert them back to ports.
75   
76   When introducing buffered transport (which I want to get used in SG to debug
77   the buffering itself), we should not make the rest of the code aware of the
78   change and not specify code for this. This is bad design.
79   
80   But there is bad design all over the place, so fuck off for now, when we can
81   get rid of MSG and rely directly on SG, this crude hack can go away. But in
82   the meanwhile, I want to sleep this night (FIXME).
83   
84   Hu! You evil problem! Taste my axe!
85
86 */
87
88 gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock);
89
90 #endif /* GRAS_TRP_PRIVATE_H */