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