Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
document last changes
[simgrid.git] / src / nws_portability / Include / timeouts.h
1 /* $Id$ */
2
3 #ifndef TIMEOUTS_H
4 #define TIMEOUTS_H
5
6 /*
7  * This modules defines functions used to keep track of adaptive
8  * timeouts. You can use these functions to (for example) keep track of
9  * how long you should wait to receive a packet from a remote host.
10  */
11
12 #include "dnsutil.h"
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /**
19  * We reserve timeouts for receive and send packets, connection time and
20  * we leave space for 3 user definable timeouts.
21  */
22 typedef enum {RECV, SEND, CONN, USER1, USER2, USER3} timeoutTypes;
23 #define TIMEOUT_TYPES_NUMBER 6
24
25 /**
26  * Sets the bounds on a specific class of timeouts. 
27  */
28 void
29 SetDefaultTimeout(timeoutTypes type, double min, double max);
30
31 /**
32  * get the current defaults timeouts
33  */
34 void
35 GetDefaultTimeout(timeoutTypes type, double *min, double *max);
36
37
38 /**
39  * Returns the current timeouts value for the specific class given the
40  * IPAddress and the #size# of the data to be sent/received. If #size# is
41  * <= 0 it will be ignored.
42  */
43 double
44 GetTimeOut(timeoutTypes type, IPAddress addr, long size);
45
46 /**
47  * Reports how long it took to perform the action (say send or receive a
48  * packet) last time and if it timed out and how many bytes were
49  * sent/received (if applicable).
50  */
51 void
52 SetTimeOut(timeoutTypes type, IPAddress addr, double duration, long size,  int timedOut);
53
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif /* TIMEOUTS_H */