3 /* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts */
5 /* Authors: Martin Quinson */
6 /* Copyright (C) 2003 the OURAGAN project. */
8 /* This program is free software; you can redistribute it and/or modify it
9 under the terms of the license (GNU LGPL) which comes with this package. */
11 #ifndef GRAS_BANDWIDTH_H
12 #define GRAS_BANDWIDTH_H
14 #include <gras/modules/base.h>
16 /* ****************************************************************************
17 * The messages themselves
18 * ****************************************************************************/
20 #ifndef GRAS_BANDWIDTH_FIRST_MESSAGE
21 #define GRAS_BANDWIDTH_FIRST_MESSAGE 0
24 #define GRASMSG_BW_REQUEST GRAS_BANDWIDTH_FIRST_MESSAGE
25 #define GRASMSG_BW_RESULT GRAS_BANDWIDTH_FIRST_MESSAGE+1
26 #define GRASMSG_BW_HANDSHAKE GRAS_BANDWIDTH_FIRST_MESSAGE+2
27 #define GRASMSG_BW_HANDSHAKED GRAS_BANDWIDTH_FIRST_MESSAGE+3
29 #define GRASMSG_SAT_START GRAS_BANDWIDTH_FIRST_MESSAGE+4
30 #define GRASMSG_SAT_STARTED GRAS_BANDWIDTH_FIRST_MESSAGE+5
31 #define GRASMSG_SAT_STOP GRAS_BANDWIDTH_FIRST_MESSAGE+6
32 #define GRASMSG_SAT_STOPPED GRAS_BANDWIDTH_FIRST_MESSAGE+7
34 #define GRASMSG_SAT_BEGIN GRAS_BANDWIDTH_FIRST_MESSAGE+8
35 #define GRASMSG_SAT_BEGUN GRAS_BANDWIDTH_FIRST_MESSAGE+9
36 #define GRASMSG_SAT_END GRAS_BANDWIDTH_FIRST_MESSAGE+10
37 #define GRASMSG_SAT_ENDED GRAS_BANDWIDTH_FIRST_MESSAGE+11
39 /* ****************************************************************************
40 * The functions to triger those messages
41 * ****************************************************************************/
44 * grasbw_register_messages:
46 * Register all messages and callbacks needed for the current process to be ready
49 gras_error_t grasbw_register_messages(void);
51 /* ***************************************************************************
53 * ***************************************************************************/
56 * @to_name: Name of the host with which we should conduct the experiment
57 * @to_port: port on which the peer process is listening (for message, do not
58 * give a raw socket here. The needed raw socket will be negociated between
60 * @bufSize: Size of the socket buffer
61 * @expSize: Total size of data sent across the network
62 * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent.
63 * @sec: where the result (in seconds) should be stored.
64 * @bw: observed Bandwidth (in Mb/s)
66 * Conduct a bandwidth test from the local process to the given peer.
67 * This call is blocking until the end of the experiment.
69 gras_error_t grasbw_test(const char*to_name,unsigned int to_port,
70 unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
71 /*OUT*/ double *sec, double*bw);
75 * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
76 * @from_port: port on which the process we are asking for an experiment is listening for message
77 * @to_name: Name of the host with which we should conduct the experiment
78 * @to_port: port on which the peer process is listening (for message, do not
79 * give a raw socket here. The needed raw socket will be negociated between
81 * @bufSize: Size of the socket buffer
82 * @expSize: Total size of data sent across the network
83 * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent.
84 * @sec: where the result (in seconds) should be stored.
85 * @bw: observed Bandwidth (in Mb/s)
87 * Conduct a bandwidth test from the process from_host:from_port to to_host:to_port.
88 * This call is blocking until the end of the experiment.
90 gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
91 const char* to_name,unsigned int to_port,
92 unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
93 /*OUT*/ double *sec, double*bw);
96 /* ***************************************************************************
98 * ***************************************************************************/
101 * grasbw_saturate_start:
102 * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
103 * @from_port: port on which the process we are asking for an experiment is listening
104 * (for message, do not give a raw socket here. The needed raw socket will be negociated
106 * @to_name: Name of the host with which we should conduct the experiment
107 * @to_port: port on which the peer process is listening for message
108 * @msgSize: Size of each message sent.
109 * @timeout: How long in maximum should be the saturation.
111 * Ask the process 'from_name:from_port' to start to saturate the link between itself
112 * and to_name:to_name.
114 gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
115 const char* to_name,unsigned int to_port,
116 unsigned int msgSize, unsigned int timeout);
119 * grasbw_saturate_stop:
120 * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port)
121 * @from_port: port on which the process we are asking for an experiment is listening
122 * (for message, do not give a raw socket here. The needed raw socket will be negociated
124 * @to_name: Name of the host with which we should conduct the experiment
125 * @to_port: port on which the peer process is listening for message
127 * Ask the process 'from_name:from_port' to stop saturating the link between itself
128 * and to_name:to_name.
130 gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
131 const char* to_name,unsigned int to_port);
135 #endif /* GRAS_BANDWIDTH_H */