]> rtime.felk.cvut.cz Git - frescor/fna.git/blob - src_rtep/rtep_frsh_fna_c.c
1cd5f5f5da03f57e783cdeca2001e39e2e7241cd
[frescor/fna.git] / src_rtep / rtep_frsh_fna_c.c
1 #include "frsh_fna.h"
2 #include "rtep_bandwith_reservation.h"
3
4 //////////////////////////////////////////////////////////////////////
5 //           MAPPING FUNCTIONS
6 //////////////////////////////////////////////////////////////////////
7
8 /**
9  * frsh_XXXX_map_network_address()
10  *
11  * To map a XXXX protocol network address into a FRSH address.
12  * The protocol must keep this mapping consistent. Instead of using a function
13  * a hardwired mapping could be used.
14  *
15  * @param[in] resource_id The network we are referring to (a protocol
16  * could be able to handle several networks at the same time)
17  * @param[in] in_address The network address we want to map to a frsh address
18  * @param[out] out_address The FRSH abstract network address
19  *
20  * @return
21  *   FNA_NO_ERROR: in this case it also means contract accepted \n
22  *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
23  *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
24  *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
25  *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
26  *
27  **/
28 int frsh_rtep_map_network_address
29       (const frsh_resource_id_t resource_id,
30        const rtep_station_id_t in_address,
31        frsh_network_address_t *out_address)
32 {
33    if (out_address == NULL) return -1;
34    *out_address = in_address;
35    return 0;
36 }
37
38 /**
39  * frsh_XXXX_map_stream_id()
40  *
41  * To map a XXXX protocol network stream, port, channel... into a FRSH stream.
42  * The protocol must keep this mapping consistent. Instead of using a function
43  * a hardwired mapping could be used.
44  *
45  * @param[in] resource_id The network we are referring to (a protocol
46  * could be able to handle several networks at the same time)
47  * @param[in] in_stream The network stream we want to map to a FRSH stream
48  * @param[out] out_stream The FRSH abstract network stream
49  *
50  * @return
51  *   FNA_NO_ERROR: in this case it also means contract accepted \n
52  *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
53  *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
54  *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
55  *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
56  *
57  **/
58 int frsh_rtep_map_stream_id
59       (const frsh_resource_id_t resource_id,
60        const rtep_channel_t in_stream,
61        frsh_stream_id_t *out_stream)
62 {
63    if (out_stream == NULL) return -1;
64    *out_stream = in_stream;
65    return 0;
66 }
67
68 ///////////////////////////////////////////////////////////////////
69 //           NEGOTIATION SERVICE PARAMETERS
70 ///////////////////////////////////////////////////////////////////
71
72 /**
73  * frsh_XXXX_negotiation_messages__vres_renegotiate()
74  *
75  * This function allows the application to change the minimum period
76  * of the negotiation messages sent through the network. It is similar
77  * to the service thread but for the network messages. We do not provide
78  * budget here because the size of the negotiation messages is fixed.
79  *
80  * This change is similar to a renegotiation so a schedulability test
81  * must be done to see if the change can be accepted or not.
82  *
83  * @param[in] resource_id The network we are referring to (a protocol
84  * could be able to handle several networks at the same time)
85  * @param[in] period The new period for negotiation messages
86  * @param[out] accepted If the change has been accepted or not
87  *
88  * @return
89  *   FNA_NO_ERROR: in this case it also means contract accepted \n
90  *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
91  *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
92  *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
93  *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
94  *
95  **/
96
97 int frsh_rtep_negotiation_messages_vres_renegotiate
98       (const frsh_resource_id_t resource_id,
99        const struct timespec *period)
100 {
101    return rtep_bwres_renegotiate_negotiation_period(period);
102 }
103
104 /**
105  * frsh_XXXX_negotiation_messages_vres_get_period()
106  *
107  * This function gets the minimum period of the negotiation messages
108  * sent through the network.
109  *
110  * @param[in] resource_id The network we are referring to (a protocol
111  * could be able to handle several networks at the same time)
112  * @param[out] period The period for negotiation messages
113  *
114  * @return
115  *   FNA_NO_ERROR: in this case it also means contract accepted \n
116  *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
117  *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
118  *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
119  *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
120  *
121  **/
122 int frsh_rtep_negotiation_messages_vres_get_period
123       (const frsh_resource_id_t resource_id,
124        struct timespec *period)
125 {
126    return rtep_bwres_get_negotiation_period (period);
127 }
128
129 /**
130  * frsh_XXXX_service_thread_vres_renegotiate()
131  *
132  * This function allows the application to change the period and
133  * budget of the service thread that makes the negotiations and
134  * schedulability tests in a network.
135  *
136  * The service thread starts with a default budget and period that
137  * should be configurable
138  *
139  * @param[in] resource_id The network we are referring to (a protocol
140  * could be able to handle several networks at the same time)
141  * @param[in] budget The new budget for the service thread
142  * @param[in] period The new period for the service thread
143  * @param[out] accepted If the negotiation has been accepted or not
144  *
145  * @return
146  *   FNA_NO_ERROR: in this case it also means contract accepted \n
147  *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
148  *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
149  *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
150  *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
151  *
152  **/
153 int frsh_rtep_service_thread_vres_renegotiate
154    (const frsh_resource_id_t resource_id,
155     const struct timespec *budget,
156     const struct timespec *period,
157     bool *accepted)
158 {
159    return -1;
160 }
161
162 /**
163  * frsh_XXXX_service_thread_vres_get_budget_and_period()
164  *
165  * This function gets the budget and period of a service thread.
166  *
167  * @param[in] resource_id The network we are referring to (a protocol
168  * could be able to handle several networks at the same time)
169  * @param[out] budget The budget of the service thread
170  * @param[out] period The period of the service thread
171  *
172  * @return
173  *   FNA_NO_ERROR: in this case it also means contract accepted \n
174  *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
175  *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
176  *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
177  *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
178  *
179  **/
180 int frsh_rtep_service_thread_vres_get_budget_and_period
181       (const frsh_resource_id_t resource_id,
182        struct timespec *budget,
183        struct timespec *period)
184 {
185    return -1;
186 }
187