]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_bwres_requests.c
Unified header for FNA
[frescor/fna.git] / src_frescan / frescan_bwres_requests.c
index b32b227cf30e2dfdc543ec399ee2da7e97d45d3e..4c995ac7f802c2f8ba5a4c42eaa45ae89796bf2e 100644 (file)
  *
  * @license
  *
- * -----------------------------------------------------------------------
- *  Copyright (C) 2006 - 2008 FRESCOR consortium partners:
- *
- *    Universidad de Cantabria,              SPAIN
- *    University of York,                    UK
- *    Scuola Superiore Sant'Anna,            ITALY
- *    Kaiserslautern University,             GERMANY
- *    Univ. Politécnica  Valencia,           SPAIN
- *    Czech Technical University in Prague,  CZECH REPUBLIC
- *    ENEA                                   SWEDEN
- *    Thales Communication S.A.              FRANCE
- *    Visual Tools S.A.                      SPAIN
- *    Rapita Systems Ltd                     UK
- *    Evidence                               ITALY
- *
- *    See http://www.frescor.org for a link to partners' websites
- *
- *           FRESCOR project (FP6/2005/IST/5-034026) is funded
- *        in part by the European Union Sixth Framework Programme
- *        The European Union is not liable of any use that may be
- *        made of this code.
- *
- *  This file is part of FRESCAN
- *
- *  FRESCAN is free software; you can  redistribute it and/or  modify
- *  it under the terms of  the GNU General Public License as published by
- *  the Free Software Foundation;  either  version 2, or (at  your option)
- *  any later version.
- *
- *  FRESCAN  is distributed  in  the hope  that  it  will  be useful,  but
- *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
- *  MERCHANTABILITY  or  FITNESS FOR  A  PARTICULAR PURPOSE. See  the  GNU
- *  General Public License for more details.
- *
- *  You should have  received a  copy of  the  GNU  General Public License
- *  distributed  with  FRESCAN;  see file COPYING.   If not,  write to the
- *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
- *  02111-1307, USA.
- *
- * As a special exception, including FRESCAN header files in a file,
- * instantiating FRESCAN generics or templates, or linking other files
- * with FRESCAN objects to produce an executable application, does not
- * by itself cause the resulting executable application to be covered
- * by the GNU General Public License. This exception does not
- * however invalidate any other reasons why the executable file might be
- * covered by the GNU Public License.
- * -----------------------------------------------------------------------
+//----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2009 by the FRESCOR consortium:
+//
+//    Universidad de Cantabria,              SPAIN
+//    University of York,                    UK
+//    Scuola Superiore Sant'Anna,            ITALY
+//    Kaiserslautern University,             GERMANY
+//    Univ. Politecnica  Valencia,           SPAIN
+//    Czech Technical University in Prague,  CZECH REPUBLIC
+//    ENEA                                   SWEDEN
+//    Thales Communication S.A.              FRANCE
+//    Visual Tools S.A.                      SPAIN
+//    Rapita Systems Ltd                     UK
+//    Evidence                               ITALY
+//
+//    See http://www.frescor.org
+//
+//        The FRESCOR project (FP6/2005/IST/5-034026) is funded
+//        in part by the European Union Sixth Framework Programme
+//        The European Union is not liable of any use that may be
+//        made of this code.
+//
+//
+//  based on previous work (FSF) done in the FIRST project
+//
+//   Copyright (C) 2005  Mälardalen University, SWEDEN
+//                       Scuola Superiore S.Anna, ITALY
+//                       Universidad de Cantabria, SPAIN
+//                       University of York, UK
+//
+// This file is part of FNA (Frescor Network Adaptation)
+//
+// FNA is free software; you can redistribute it and/or modify it
+// under terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option) any
+// later version.  FNA is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details. You should have received a
+// copy of the GNU General Public License along with FNA; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
+//
+// As a special exception, including FNA header files in a file,
+// instantiating FNA generics or templates, or linking other files
+// with FNA objects to produce an executable application, does not
+// by itself cause the resulting executable application to be covered
+// by the GNU General Public License. This exception does not
+// however invalidate any other reasons why the executable file might be
+// covered by the GNU Public License.
+// -----------------------------------------------------------------------
  *
  */
 
@@ -83,7 +87,7 @@ static bool is_initialized = false;
  **/
 
 struct request_t {
-        frescan_request_data_t request_data;
+        frescan_bwres_request_data_t request_data;
         struct list_head       request_list;
         int pool_pos;
 };
@@ -91,19 +95,19 @@ struct request_t {
 static fosa_mutex_t requests_mutex;
 static fosa_cond_t  requests_cond;
 
-static struct request_t the_requests_pool[FRESCAN_MX_REQUESTS];
+static struct request_t the_requests_pool[FRESCAN_BWRES_MX_REQUESTS];
 static freelist_t freelist;
 
 static struct request_t the_requests_list;
 
 /**
- * frescan_requests_init()
+ * frescan_bwres_requests_init()
  *
  * Init the freelist, requests list, cond var and mutex.
  *
  **/
 
-int frescan_requests_init(int max_ceiling)
+int frescan_bwres_requests_init(int max_ceiling)
 {
         int err;
 
@@ -113,7 +117,7 @@ int frescan_requests_init(int max_ceiling)
         err = fosa_cond_init(&requests_cond);
         if (err != 0) return err;
 
-        err = freelist_init(&freelist, FRESCAN_MX_REQUESTS);
+        err = freelist_init(&freelist, FRESCAN_BWRES_MX_REQUESTS);
         if (err != 0) return err;
 
         INIT_LIST_HEAD(&the_requests_list.request_list);
@@ -123,17 +127,17 @@ int frescan_requests_init(int max_ceiling)
 }
 
 /**
- * frescan_requests_alloc()
+ * frescan_bwres_requests_alloc()
  *
  * Allocate a request with the mutex locked
  *
  **/
 
-int frescan_requests_alloc(frescan_request_id_t *req)
+int frescan_bwres_requests_alloc(frescan_bwres_request_id_t *req)
 {
         int err, pos;
 
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG, "alloc\n");
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG, "alloc\n");
 
         if (is_initialized == false) return -1;
 
@@ -157,17 +161,17 @@ locked_error:
 }
 
 /**
- * frescan_requests_free()
+ * frescan_bwres_requests_free()
  *
  * free the request from the pool
  *
  **/
 
-int frescan_requests_free(frescan_request_id_t req)
+int frescan_bwres_requests_free(frescan_bwres_request_id_t req)
 {
         int err;
 
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG, "free\n");
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG, "free\n");
 
         if (is_initialized == false) return -1;
 
@@ -188,38 +192,38 @@ locked_error:
 }
 
 /**
- * frescan_requests_get_data() - gets the data of the request
+ * frescan_bwres_requests_get_data() - gets the data of the request
  *
  */
 
-int frescan_requests_get_data(frescan_request_id_t   req,
-                              frescan_request_data_t **data)
+int frescan_bwres_requests_get_data(frescan_bwres_request_id_t   req,
+                              frescan_bwres_request_data_t **data)
 {
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG, "request id:%d\n", req);
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG, "request id:%d\n", req);
         *data = &the_requests_pool[req].request_data;
         return 0;
 }
 
 /**
- * frescan_requests_enqueue()
+ * frescan_bwres_requests_enqueue()
  *
  **/
 
-int frescan_requests_enqueue(frescan_request_id_t req)
+int frescan_bwres_requests_enqueue(frescan_bwres_request_id_t req)
 {
         int err;
 
         err = fosa_mutex_lock(&requests_mutex);
         if (err != 0) return err;
 
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG,
               "is list empty A? %d\n",
               list_empty(&the_requests_list.request_list));
 
         list_add_tail(&the_requests_pool[req].request_list,
                       &the_requests_list.request_list);
 
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG,
               "is list empty B? %d\n",
               list_empty(&the_requests_list.request_list));
 
@@ -237,11 +241,11 @@ locked_error:
 }
 
 /**
- * frescan_requestqueue_dequeue()
+ * frescan_bwres_requestqueue_dequeue()
  *
  **/
 
-int frescan_requests_dequeue(frescan_request_id_t *req)
+int frescan_bwres_requests_dequeue(frescan_bwres_request_id_t *req)
 {
         int err;
         struct list_head *pos;
@@ -250,15 +254,15 @@ int frescan_requests_dequeue(frescan_request_id_t *req)
         err = fosa_mutex_lock(&requests_mutex);
         if (err != 0) return err;
 
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG, "entering\n");
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG, "entering\n");
 
         while (list_empty(&the_requests_list.request_list)) {
                 err = fosa_cond_wait(&requests_cond, &requests_mutex);
                 if (err != 0) goto locked_error;
-                DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG, "received signal\n");
+                DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG, "received signal\n");
         }
 
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG, "dequeueing a request\n");
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG, "dequeueing a request\n");
 
         list_for_each(pos, &the_requests_list.request_list) {
                 request = list_entry(pos, struct request_t, request_list);
@@ -269,7 +273,7 @@ int frescan_requests_dequeue(frescan_request_id_t *req)
 
         *req = request->pool_pos;
 
-        DEBUG(FRESCAN_REQUESTS_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_REQUESTS_ENABLE_DEBUG,
               "is list empty now? %d\n",
               list_empty(&the_requests_list.request_list));