1 //----------------------------------------------------------------------
2 // Copyright (C) 2006 - 2007 by the FRESCOR consortium:
4 // Universidad de Cantabria, SPAIN
5 // University of York, UK
6 // Scuola Superiore Sant'Anna, ITALY
7 // Kaiserslautern University, GERMANY
8 // Univ. Politecnica Valencia, SPAIN
9 // Czech Technical University in Prague, CZECH REPUBLIC
11 // Thales Communication S.A. FRANCE
12 // Visual Tools S.A. SPAIN
13 // Rapita Systems Ltd UK
16 // See http://www.frescor.org
18 // The FRESCOR project (FP6/2005/IST/5-034026) is funded
19 // in part by the European Union Sixth Framework Programme
20 // The European Union is not liable of any use that may be
24 // based on previous work (FSF) done in the FIRST project
26 // Copyright (C) 2005 Mälardalen University, SWEDEN
27 // Scuola Superiore S.Anna, ITALY
28 // Universidad de Cantabria, SPAIN
29 // University of York, UK
31 // This file is part of FNA (Frescor Network Adaptation)
33 // FNA is free software; you can redistribute it and/or modify it
34 // under terms of the GNU General Public License as published by the
35 // Free Software Foundation; either version 2, or (at your option) any
36 // later version. FNA is distributed in the hope that it will be
37 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
38 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39 // General Public License for more details. You should have received a
40 // copy of the GNU General Public License along with FNA; see file
41 // COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
42 // Cambridge, MA 02139, USA.
44 // As a special exception, including FNA header files in a file,
45 // instantiating FNA generics or templates, or linking other files
46 // with FNA objects to produce an executable application, does not
47 // by itself cause the resulting executable application to be covered
48 // by the GNU General Public License. This exception does not
49 // however invalidate any other reasons why the executable file might be
50 // covered by the GNU Public License.
51 // -----------------------------------------------------------------------
53 //==============================================
54 // ******** **** ** **
55 // **///// /**/** /** ****
56 // ** /**//** /** **//**
57 // ******* /** //** /** ** //**
58 // **//// /** //**/** **********
59 // ** /** //****/**//////**
60 // ** /** //***/** /**
63 // FNA(Frescor Network Adaptation layer), pronounced "efe ene a"
64 //==============================================================
65 #include <malloc.h> /* for malloc and free */
66 #include "unix_fna.h" /* function prototypes */
70 #define DEBUG(x,args...) printf("%s: " x, __func__ , ##args)
72 #define DEBUG(x,args...)
75 //////////////////////////////////////////////////////////////////////
77 //////////////////////////////////////////////////////////////////////
79 char *the_unix_stream_ids[MX_UNIX_STREAM_IDS] = {
93 int unix_fna_init(const frsh_resource_id_t resource_id)
95 DEBUG("NOT IMPLEMENTED\n");
99 ///////////////////////////////////////////////////////////////////
101 ///////////////////////////////////////////////////////////////////
104 * unix_fna_contract_negotiate()
108 int unix_fna_contract_negotiate(const frsh_resource_id_t resource_id,
109 const frsh_contract_t *contract,
112 DEBUG("NOT IMPLEMENTED\n");
117 * unix_fna_contract_renegotiate_sync()
121 int unix_fna_contract_renegotiate_sync(const frsh_resource_id_t resource_id,
122 const fna_vres_id_t vres,
123 const frsh_contract_t *new_contract)
125 DEBUG("NOT IMPLEMENTED\n");
130 * unix_fna_contract_renegotiate_async()
134 int unix_fna_contract_renegotiate_async(const frsh_resource_id_t resource_id,
135 const fna_vres_id_t vres,
136 const frsh_contract_t *new_contract,
137 frsh_signal_t signal_to_notify,
138 frsh_signal_info_t signal_info)
140 DEBUG("NOT IMPLEMENTED\n");
145 * unix_fna_vres_get_renegotiation_status()
149 int unix_fna_vres_get_renegotiation_status(const frsh_resource_id_t resource_id,
150 const fna_vres_id_t vres,
151 frsh_renegotiation_status_t *renegotiation_status)
153 DEBUG("NOT IMPLEMENTED\n");
158 * unix_fna_vres_destroy()
162 int unix_fna_vres_destroy(const frsh_resource_id_t resource_id,
163 const fna_vres_id_t vres)
165 DEBUG("NOT IMPLEMENTED\n");
170 * unix_fna_vres_get_contract()
174 int unix_fna_vres_get_contract(const frsh_resource_id_t resource_id,
175 const fna_vres_id_t vres,
176 frsh_contract_t *contract)
178 DEBUG("NOT IMPLEMENTED\n");
183 * unix_fna_vres_get_usage()
187 int unix_fna_vres_get_usage(const frsh_resource_id_t resource_id,
188 const fna_vres_id_t vres,
189 struct timespec *usage)
191 DEBUG("NOT IMPLEMENTED\n");
196 * unix_fna_vres_get_remaining_budget()
200 int unix_fna_vres_get_remaining_budget(const frsh_resource_id_t resource_id,
201 const fna_vres_id_t vres,
202 struct timespec *remaining_budget)
204 DEBUG("NOT IMPLEMENTED\n");
209 * unix_fna_vres_get_budget_and_period()
213 int unix_fna_vres_get_budget_and_period(const frsh_resource_id_t resource_id,
214 const fna_vres_id_t vres,
215 struct timespec *budget,
216 struct timespec *period)
218 DEBUG("NOT IMPLEMENTED\n");
222 ///////////////////////////////////////////////////////////////////
223 // SPARE CAPACITY FUNCIONS
224 ///////////////////////////////////////////////////////////////////
227 * unix_fna_resource_get_capacity()
231 int unix_fna_resource_get_capacity(const frsh_resource_id_t resource_id,
232 const int importance,
235 DEBUG("NOT IMPLEMENTED\n");
240 * unix_fna_resource_get_total_weight()
244 int unix_fna_resource_get_total_weight(const frsh_resource_id_t resource_id,
245 const int importance,
248 DEBUG("NOT IMPLEMENTED\n");
253 * unix_fna_vres_decrease_capacity()
257 int unix_fna_vres_decrease_capacity(const frsh_resource_id_t resource_id,
258 const fna_vres_id_t vres,
259 const struct timespec new_budget,
260 const struct timespec new_period)
262 DEBUG("NOT IMPLEMENTED\n");
266 ///////////////////////////////////////////////////////////////////
267 // SEND RECEIVE OPERATIONS
268 ///////////////////////////////////////////////////////////////////
271 * unix_fna_send_sync()
275 int unix_fna_send_sync(const fna_endpoint_data_t *endpoint,
279 DEBUG("NOT IMPLEMENTED\n");
284 * unix_fna_send_async()
288 int unix_fna_send_async(const fna_endpoint_data_t *endpoint,
292 DEBUG("send async\n");
297 * unix_fna_receive_sync()
301 int unix_fna_receive_sync(const fna_endpoint_data_t *endpoint,
303 const size_t buffer_size,
304 size_t *received_bytes,
305 frsh_network_address_t *from)
307 DEBUG("receive sync\n");
312 * unix_fna_receive_async()
316 int unix_fna_receive_async(const fna_endpoint_data_t *endpoint,
318 const size_t buffer_size,
319 size_t *received_bytes,
320 frsh_network_address_t *from)
322 DEBUG("NOT IMPLEMENTED\n");
327 * unix_fna_send_endpoint_get_status()
331 int unix_fna_send_endpoint_get_status(const fna_endpoint_data_t *endpoint,
332 int *number_of_pending_messages,
333 frsh_endpoint_network_status_t *network_status,
334 frsh_protocol_status_t *protocol_status)
336 DEBUG("NOT IMPLEMENTED\n");
341 * unix_fna_receive_endpoint_created()
344 int unix_fna_receive_endpoint_created(const fna_endpoint_data_t *endpoint)
346 DEBUG("NOT IMPLEMENTED\n");
351 * unix_fna_receive_endpoint_get_pending_messages
355 int unix_fna_receive_endpoint_get_status(const fna_endpoint_data_t *endpoint,
356 int *number_of_pending_messages,
357 frsh_endpoint_network_status_t *network_status,
358 frsh_protocol_status_t *protocol_status)
360 DEBUG("NOT IMPLEMENTED\n");
364 //////////////////////////////////////////////////////////////////////
365 // NETWORK CONFIGURATION FUNCTIONS
366 //////////////////////////////////////////////////////////////////////
369 * unix_fna_network_get_max_message_size()
373 int unix_fna_network_get_max_message_size(const frsh_resource_id_t resource_id,
374 const frsh_network_address_t destination,
377 DEBUG("NOT IMPLEMENTED\n");
382 * unix_fna_network_bytes_to_budget()
386 int unix_fna_network_bytes_to_budget(const frsh_resource_id_t resource_id,
388 struct timespec *budget)
390 DEBUG("NOT IMPLEMENTED\n");
395 * unix_fna_network_budget_to_bytes()
399 int unix_fna_network_budget_to_bytes(const frsh_resource_id_t resource_id,
400 const struct timespec *budget,
403 DEBUG("NOT IMPLEMENTED\n");
408 * unix_fna_network_get_min_eff_budget()
412 int unix_fna_network_get_min_eff_budget(const frsh_resource_id_t resource_id,
413 struct timespec *budget)
415 DEBUG("NOT IMPLEMENTED\n");
419 // GLOBAL variable to install the network protocol in FRESCOR
421 fna_operations_t unix_fna_operations = {
422 .fna_init = unix_fna_init,
423 .fna_contract_negotiate = unix_fna_contract_negotiate,
424 .fna_contract_renegotiate_sync = unix_fna_contract_renegotiate_sync,
425 .fna_contract_renegotiate_async = unix_fna_contract_renegotiate_async,
426 .fna_vres_get_renegotiation_status = unix_fna_vres_get_renegotiation_status,
427 .fna_vres_destroy = unix_fna_vres_destroy,
428 .fna_vres_get_contract = unix_fna_vres_get_contract,
429 .fna_vres_get_usage = unix_fna_vres_get_usage,
430 .fna_vres_get_remaining_budget = unix_fna_vres_get_remaining_budget,
431 .fna_vres_get_budget_and_period = unix_fna_vres_get_budget_and_period,
432 .fna_resource_get_capacity = unix_fna_resource_get_capacity,
433 .fna_resource_get_total_weight = unix_fna_resource_get_total_weight,
434 .fna_vres_decrease_capacity = unix_fna_vres_decrease_capacity,
435 .fna_send_sync = unix_fna_send_sync,
436 .fna_send_async = unix_fna_send_async,
437 .fna_receive_sync = unix_fna_receive_sync,
438 .fna_receive_async = unix_fna_receive_async,
439 .fna_send_endpoint_get_status = unix_fna_send_endpoint_get_status,
440 .fna_receive_endpoint_created = unix_fna_receive_endpoint_created,
441 .fna_receive_endpoint_get_status = unix_fna_receive_endpoint_get_status,
442 .fna_network_get_max_message_size = unix_fna_network_get_max_message_size,
443 .fna_network_bytes_to_budget = unix_fna_network_bytes_to_budget,
444 .fna_network_budget_to_bytes = unix_fna_network_budget_to_bytes,
445 .fna_network_get_min_eff_budget = unix_fna_network_get_min_eff_budget