]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - include/fna.h
Added FWP to FNA. FNA ops extended for bind, unbind, send_endpoint_created, endpoint_...
[frescor/fna.git] / include / fna.h
index 242af53317914bfa5b55b45226ded8811b44ba58..475e7662ecc4e76bb7965ab79729601bdf1028c5 100644 (file)
 #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 */
@@ -551,7 +550,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
@@ -725,6 +724,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()
  *
@@ -744,7 +797,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
@@ -843,7 +913,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()
@@ -867,7 +937,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);
 
 /**
@@ -900,7 +970,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);
 
 /*@}*/
 
@@ -923,6 +993,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;