]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_data.h
update the names and add acceptor thread id to the general data
[frescor/fna.git] / src_frescan / frescan_data.h
index 0e78bdaec1ab5440e1b85c94b466df6c12be62d2..dbae6cceb94f2e9ea2f612fcdf0ea79a95d6caf5 100644 (file)
 #include <stdint.h>    // uint32_t
 #include <semaphore.h> // sem_t
 #include <time.h>      // struct timespec, timer_t
-#include <pthread.h>   // pthread_t
+#include "fosa_threads_and_signals.h"   // fosa_thread_id_t
 
 #include <misc/linux_list.h> // struct list_head
 #include <misc/freelist.h>   // freelist_t
 
-#include <drivers/frescan.h> // frescan_node_t, _prio_t, _budget_t
+#include "frescan.h"         // frescan_node_t, _prio_t, _budget_t
 #include "frescan_config.h"  // FRESCAN_MLOCK_T, FRESCAN_MX_XXX
 #include "frescan_packets.h" // frescan_packet_t
 #include "frescan_servers_replenishments.h" // frescan_repl_op_t
@@ -63,7 +63,11 @@ typedef struct {
 
 typedef struct {
         frescan_budget_t budget;
-        struct timespec period;
+        struct timespec  period;
+} frescan_budget_period_t;
+
+typedef struct {
+        frescan_budget_period_t values;
         frescan_prio_t prio;
 } frescan_server_params_t;
 
@@ -100,6 +104,25 @@ extern frescan_server_data_t the_servers_pool[FRESCAN_MX_NETWORKS][FRESCAN_MX_ID
 extern freelist_t the_servers_pool_freelist[FRESCAN_MX_NETWORKS];
 extern frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
 
+/**
+ * frescan_contract_t
+ */
+
+typedef struct {
+        frescan_budget_period_t min_values;
+        frescan_budget_period_t max_values;
+        frescan_prio_t prio;
+} frescan_contract_t;
+
+/**
+ * return info
+ */
+
+typedef struct {
+        int error;
+        frescan_ss_t id;
+} frescan_neg_return_info_t;
+
 /**
  * frescan_prio_queue_t - priority queue
  *
@@ -146,6 +169,10 @@ typedef struct {
  * @local_node: the local node id for that network. The implementation does not
  * support several interfaces for the same network.
  * @fd: file descriptor associated to /dev/canXX
+ * @repl_thread_id: replenishment thread id
+ * @neg_thread_id: master local negotiator thread id (only master node has it)
+ * @acceptor_thread_id: acceptor negotiation thread id (all nodes have one)
+ * @neg_messages_ss_id: sporadic server for negotiation messages
  * @queues: the queues of this network instance
  * @last_packet: pointer to the last packet from which a frame was inserted
  *               in the chip and its transmission is not complete.
@@ -166,7 +193,10 @@ typedef struct {
         FRESCAN_MLOCK_T lock;
         frescan_node_t local_node;
         int fd;
-        pthread_t repl_thread_id;
+        fosa_thread_id_t repl_thread_id;
+        fosa_thread_id_t neg_thread_id;
+        fosa_thread_id_t acceptor_thread_id;
+        frescan_ss_t neg_messages_ss_id;
         frescan_queues_t queues;
         frescan_packet_t *last_packet;
         frescan_prio_t last_packet_prio;