4 * @brief global data used from different modules in frescan
15 * In frescan_data module we store global data to FRESCAN to make the protocol
16 * easier and efficient to implement.
20 //----------------------------------------------------------------------
21 // Copyright (C) 2006 - 2009 by the FRESCOR consortium:
23 // Universidad de Cantabria, SPAIN
24 // University of York, UK
25 // Scuola Superiore Sant'Anna, ITALY
26 // Kaiserslautern University, GERMANY
27 // Univ. Politecnica Valencia, SPAIN
28 // Czech Technical University in Prague, CZECH REPUBLIC
30 // Thales Communication S.A. FRANCE
31 // Visual Tools S.A. SPAIN
32 // Rapita Systems Ltd UK
35 // See http://www.frescor.org
37 // The FRESCOR project (FP6/2005/IST/5-034026) is funded
38 // in part by the European Union Sixth Framework Programme
39 // The European Union is not liable of any use that may be
43 // based on previous work (FSF) done in the FIRST project
45 // Copyright (C) 2005 Mälardalen University, SWEDEN
46 // Scuola Superiore S.Anna, ITALY
47 // Universidad de Cantabria, SPAIN
48 // University of York, UK
50 // This file is part of FNA (Frescor Network Adaptation)
52 // FNA is free software; you can redistribute it and/or modify it
53 // under terms of the GNU General Public License as published by the
54 // Free Software Foundation; either version 2, or (at your option) any
55 // later version. FNA is distributed in the hope that it will be
56 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
57 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
58 // General Public License for more details. You should have received a
59 // copy of the GNU General Public License along with FNA; see file
60 // COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
61 // Cambridge, MA 02139, USA.
63 // As a special exception, including FNA header files in a file,
64 // instantiating FNA generics or templates, or linking other files
65 // with FNA objects to produce an executable application, does not
66 // by itself cause the resulting executable application to be covered
67 // by the GNU General Public License. This exception does not
68 // however invalidate any other reasons why the executable file might be
69 // covered by the GNU Public License.
70 // -----------------------------------------------------------------------
74 #include "frescan_data.h"
76 frescan_network_data_t frescan_data[FRESCAN_MX_NETWORKS];
78 int frescan_data_init(int fd, frescan_init_params_t *params)
84 frescan_data[params->net].fd = fd;
85 frescan_data[params->net].local_node = params->node;
86 frescan_data[params->net].last_packet = NULL;
87 frescan_data[params->net].last_packet_prio = 0;
89 FRESCAN_CREATE_LOCK(&frescan_data[params->net].lock);
91 for(id=0; id<FRESCAN_MX_IDS; id++) {
92 for(src=0; src<FRESCAN_MX_NODES; src++) {
93 frescan_data[params->net].id_queues[src][id] = NULL;
97 for(prio=0; prio<FRESCAN_MX_PRIOS; prio++) {
98 for(src=0; src<FRESCAN_MX_NODES; src++) {
99 frescan_data[params->net].id_fp_queues[src][prio] = NULL;