summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2024-01-21 10:59:17 +0100
committerSander Vrijders <sander@ouroboros.rocks>2024-01-31 10:27:56 +0100
commit02f68ff5ccc637b2177f832a4f7ddf4f9f737d22 (patch)
treeeeef68d751d4feb0c95b3831b3e325d45ca9bc9b /include
parent396c311842ae7d138c13a6d054e1978d95af4c63 (diff)
downloadouroboros-02f68ff5ccc637b2177f832a4f7ddf4f9f737d22.tar.gz
ouroboros-02f68ff5ccc637b2177f832a4f7ddf4f9f737d22.zip
include: Use common definition between lib and IRMd
Some definitions/enums were different between the library and IRMd (flow_state, ipcp_state). This moves them to common ground. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/flow.h54
-rw-r--r--include/ouroboros/ipcp.h49
-rw-r--r--include/ouroboros/irm.h17
3 files changed, 90 insertions, 30 deletions
diff --git a/include/ouroboros/flow.h b/include/ouroboros/flow.h
new file mode 100644
index 00000000..e8c1dfdf
--- /dev/null
+++ b/include/ouroboros/flow.h
@@ -0,0 +1,54 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2024
+ *
+ * Flows
+ *
+ * Dimitri Staessens <dimitri@ouroboros.rocks>
+ * Sander Vrijders <sander@ouroboros.rocks>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., http://www.fsf.org/about/contact/.
+ */
+
+#ifndef OUROBOROS_LIB_FLOW_H
+#define OUROBOROS_LIB_FLOW_H
+
+#include <ouroboros/qos.h>
+
+#include <sys/types.h>
+
+ enum flow_state { /* DO NOT CHANGE ORDER! */
+ FLOW_INIT = 0,
+ FLOW_ALLOC_PENDING,
+ FLOW_ALLOC_REQ_PENDING,
+ FLOW_ALLOCATED,
+ FLOW_DEALLOC_PENDING,
+ FLOW_DEALLOCATED,
+ FLOW_DESTROY,
+ FLOW_NULL
+};
+
+struct flow_info {
+ int id;
+
+ pid_t n_pid;
+ pid_t n_1_pid;
+
+ time_t mpl;
+
+ struct qos_spec qs;
+
+ enum flow_state state;
+};
+
+#endif /* OUROBOROS_LIB_FLOW_H */ \ No newline at end of file
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
index a2c7720a..eb7d1670 100644
--- a/include/ouroboros/ipcp.h
+++ b/include/ouroboros/ipcp.h
@@ -26,17 +26,21 @@
#include <stdint.h>
#include <unistd.h>
#include <stdbool.h>
+#include <sys/types.h>
#define IPCP_NAME_SIZE 255
#define LAYER_NAME_SIZE 255
#define DEV_NAME_SIZE 255
-/* Unicast IPCP components. */
-#define DT_COMP "Data Transfer"
-#define MGMT_COMP "Management"
+enum ipcp_state {
+ IPCP_INIT = 0,
+ IPCP_BOOT,
+ IPCP_OPERATIONAL,
+ IPCP_SHUTDOWN,
+ IPCP_NULL
+};
-/* NOTE: The IRMd uses this order to select an IPCP for flow allocation. */
-enum ipcp_type {
+enum ipcp_type { /* IRMd uses order to select an IPCP for flow allocation. */
IPCP_LOCAL = 0,
IPCP_UNICAST,
IPCP_BROADCAST,
@@ -46,6 +50,17 @@ enum ipcp_type {
IPCP_INVALID
};
+struct ipcp_info {
+ enum ipcp_type type;
+ pid_t pid;
+ char name[IPCP_NAME_SIZE + 1];
+ enum ipcp_state state;
+};
+
+/* Unicast IPCP components. */
+#define DT_COMP "Data Transfer"
+#define MGMT_COMP "Management"
+
/* Unicast IPCP policies */
enum pol_addr_auth {
ADDR_AUTH_FLAT_RANDOM = 0,
@@ -65,14 +80,6 @@ enum pol_cong_avoid {
CA_INVALID
};
-enum pol_dir_hash {
- DIR_HASH_SHA3_224,
- DIR_HASH_SHA3_256,
- DIR_HASH_SHA3_384,
- DIR_HASH_SHA3_512,
- DIR_HASH_INVALID
-};
-
struct dt_config {
uint8_t addr_size;
uint8_t eid_size;
@@ -98,16 +105,18 @@ struct udp_config {
uint16_t port;
};
-/* Info about the IPCP */
-struct ipcp_info {
- enum ipcp_type type;
- char name[IPCP_NAME_SIZE + 1];
+/* Layers */
+enum pol_dir_hash {
+ DIR_HASH_SHA3_224,
+ DIR_HASH_SHA3_256,
+ DIR_HASH_SHA3_384,
+ DIR_HASH_SHA3_512,
+ DIR_HASH_INVALID
};
-/* Info reported back to the IRMd about the layer on enrollment */
struct layer_info {
- char name[LAYER_NAME_SIZE + 1];
- int dir_hash_algo;
+ char name[LAYER_NAME_SIZE + 1];
+ enum pol_dir_hash dir_hash_algo;
};
/* Structure to configure the first IPCP */
diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h
index 9d55ebd4..30d461ab 100644
--- a/include/ouroboros/irm.h
+++ b/include/ouroboros/irm.h
@@ -31,27 +31,24 @@
/* Name binding options. */
#define BIND_AUTO 0x01
+#define NAME_SIZE 255
-#define NAME_SIZE 256
-#define LAYER_SIZE LAYER_NAME_SIZE
-
-/* Load balancing policy for incoming flows. */
enum pol_balance {
LB_RR = 0,
LB_SPILL,
LB_INVALID
};
+struct name_info {
+ char name[NAME_SIZE + 1];
+ enum pol_balance pol_lb;
+};
+
struct ipcp_list_info {
pid_t pid;
enum ipcp_type type;
char name[NAME_SIZE];
- char layer[LAYER_SIZE];
-};
-
-struct name_info {
- char name[NAME_SIZE];
- enum pol_balance pol_lb;
+ char layer[LAYER_NAME_SIZE];
};
__BEGIN_DECLS