]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - include/fna.h
fna_vres_id_t definition depends on kind of FRSH implementations
[frescor/fna.git] / include / fna.h
index fce4ab8e2193cd9ea1d0a9e05edb7f439ee1386d..25992a81dc1913501bf69aa8ca847d3c9072f1f1 100644 (file)
@@ -1,11 +1,11 @@
-// -----------------------------------------------------------------------
-//  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+//----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
 //
 //    Universidad de Cantabria,              SPAIN
 //    University of York,                    UK
 //    Scuola Superiore Sant'Anna,            ITALY
 //    Kaiserslautern University,             GERMANY
-//    Univ. Politécnica  Valencia,           SPAIN
+//    Univ. Politecnica  Valencia,           SPAIN
 //    Czech Technical University in Prague,  CZECH REPUBLIC
 //    ENEA                                   SWEDEN
 //    Thales Communication S.A.              FRANCE
@@ -13,9 +13,9 @@
 //    Rapita Systems Ltd                     UK
 //    Evidence                               ITALY
 //
-//    See http://www.frescor.org for a link to partners' websites
+//    See http://www.frescor.org
 //
-//           FRESCOR project (FP6/2005/IST/5-034026) is funded
+//        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.
 //                       Universidad de Cantabria, SPAIN
 //                       University of York, UK
 //
-//   FSF API web pages: http://marte.unican.es/fsf/docs
-//                      http://shark.sssup.it/contrib/first/docs/
-//
-//  This file is part of FRSH API
-//
-//  FRSH API 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.
-//
-//  FRSH API  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.
+// This file is part of FNA (Frescor Network Adaptation)
 //
-//  You should have  received a  copy of  the  GNU  General Public License
-//  distributed  with  FRSH API;  see file COPYING.   If not,  write to the
-//  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
-//  02111-1307, USA.
+// 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, if you include this header file into source
-//  files to be compiled, this header file does not by itself cause
-//  the resulting executable 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 General
-//  Public License.
+// 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.
 // -----------------------------------------------------------------------
 
 //==============================================
 #ifndef _FNA_H_
 #define _FNA_H_
 
-/* for frsh_resource_id_t, frsh_contract_t, etc */
-#include "frsh_core_types.h"
-/* for frsh_network_address_t, frsh_stream_id_t */
-#include "frsh_distributed_types.h"
+/* for frsh_resource_id_t, frsh_contract_t, for frsh_network_address_t,
+   frsh_stream_id_t, ... */
+#include "frsh.h"
 /* for timespec */
 #include <time.h>
 /* for ERROR constants */
@@ -144,6 +137,7 @@ typedef int fna_init_t(const frsh_resource_id_t resource_id);
  * @{
  **/
 
+#ifndef FRSH_FORB
 /**
  * fna_vres_id_t
  *
@@ -153,6 +147,13 @@ typedef int fna_init_t(const frsh_resource_id_t resource_id);
  *
  **/
 typedef uint16_t fna_vres_id_t;
+#else
+/**
+ * In FRSH_FORB implementation, we do not distinguish between vreses
+ * of different resources.
+ */
+typedef frsh_vres_id_t fna_vres_id_t;
+#endif
 
 /**
  * fna_contract_negotiate()
@@ -557,7 +558,7 @@ typedef enum {
     FRSH_RECEIVE_ENDPOINT_TYPE
 } frsh_endpoint_type_t;
 
-typedef struct {
+typedef struct fna_endpoint_data {
     frsh_endpoint_type_t endpoint_type; // send_endpoint or receive_endpoint
     fna_vres_id_t vres;                 // only for send_endpoints
     bool is_bound;                      // only for send_endpoints
@@ -731,6 +732,60 @@ typedef int fna_send_endpoint_get_status_t
     frsh_endpoint_network_status_t *network_status,
     frsh_protocol_status_t *protocol_status);
 
+/**
+ * fna_send_endpoint_bind_t()
+ *
+ * This operation is a called from frsh_send_endpoint_bind and binds send 
+ * edpoint to vres.
+ *
+ * @param[in] endpoint the endpoint object.
+ * @param[in] vres The internal virtual resource id
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ **/
+typedef  
+int fna_send_endpoint_bind_t(fna_endpoint_data_t *endpoint, fna_vres_id_t vres);
+
+/**
+ * fna_send_endpoint_unbind_t()
+ *
+ * This operation is a called from frsh_send_endpoint_bind.
+ *
+ * @param[in] endpoint the endpoint object.
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ **/
+typedef  
+int fna_send_endpoint_unbind_t(fna_endpoint_data_t *endpoint);
+
+/**
+ * fna_send_endpoint_create_callback()
+ *
+ * This operation is a called from frsh_send_endpoint_create with a
+ * send_endpoint structure already filled.
+ *
+ * @param[in] endpoint the endpoint object.
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ **/
+typedef int fna_send_endpoint_create_callback_t
+   (fna_endpoint_data_t *endpoint);
+
 /**
  * fna_receive_endpoint_create_callback()
  *
@@ -750,7 +805,24 @@ typedef int fna_send_endpoint_get_status_t
  *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
  **/
 typedef int fna_receive_endpoint_create_callback_t
-   (const fna_endpoint_data_t *endpoint);
+   (fna_endpoint_data_t *endpoint);
+
+/**
+ * fna_endpoint_destroy()
+ *
+ * This operation is a called from frsh_send(receive)_endpoint_destroy.
+ *
+ * @param[in] endpoint the endpoint object.
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ **/
+typedef int fna_endpoint_destroy_t
+   (fna_endpoint_data_t *endpoint);
 
 /**
  * fna_receive_endpoint_get_pending_messages
@@ -849,7 +921,7 @@ typedef int fna_network_get_max_message_size_t
 typedef int fna_network_bytes_to_budget_t
    (const frsh_resource_id_t resource_id,
     const size_t nbytes,
-    struct timespec *budget);
+    frsh_rel_time_t *budget);
 
 /**
  * fna_network_budget_to_bytes()
@@ -873,7 +945,7 @@ typedef int fna_network_bytes_to_budget_t
  **/
 typedef int fna_network_budget_to_bytes_t
    (const frsh_resource_id_t resource_id,
-    const struct timespec *budget,
+    const frsh_rel_time_t *budget,
     size_t *nbytes);
 
 /**
@@ -906,7 +978,7 @@ typedef int fna_network_budget_to_bytes_t
  **/
 typedef int fna_network_get_min_effective_budget_t
    (const frsh_resource_id_t resource_id,
-    struct timespec *budget);
+    frsh_rel_time_t *budget);
 
 /*@}*/
 
@@ -929,6 +1001,10 @@ typedef struct {
     fna_receive_sync_t *fna_receive_sync;
     fna_receive_async_t *fna_receive_async;
     fna_send_endpoint_get_status_t *fna_send_endpoint_get_status;
+    fna_send_endpoint_bind_t *fna_send_endpoint_bind;
+    fna_send_endpoint_unbind_t *fna_send_endpoint_unbind;
+    fna_endpoint_destroy_t *fna_endpoint_destroy;
+    fna_send_endpoint_create_callback_t *fna_send_endpoint_created;
     fna_receive_endpoint_create_callback_t *fna_receive_endpoint_created;
     fna_receive_endpoint_get_status_t *fna_receive_endpoint_get_status;
     fna_network_get_max_message_size_t *fna_network_get_max_message_size;