summaryrefslogtreecommitdiff
path: root/include/ouroboros/ipcp.h
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2023-03-04 03:48:48 +0100
committerSander Vrijders <sander@ouroboros.rocks>2023-03-08 15:59:37 +0100
commit89b58eaa2706c54aeb0a48252d1cfbd2b5ae01b7 (patch)
tree891c4a2de37e06fdb8879741911a6b7ff2f1b4b8 /include/ouroboros/ipcp.h
parentf16b4a1954ab4fbca0ec403f6a04c80375328921 (diff)
downloadouroboros-89b58eaa2706c54aeb0a48252d1cfbd2b5ae01b7.tar.gz
ouroboros-89b58eaa2706c54aeb0a48252d1cfbd2b5ae01b7.zip
irmd: Add configuration file support
This adds initial support for configuration files using the C99 TOML parser (to be installed separately from https://github.com/cktan/tomlc99). The default location for the IRMd configuration file is /etc/ouroboros/irmd.conf. This is configurable at build time. An example file will be installed in the configuration directory with the name irmd.conf.example. Config file support can be disabled using the DISABLE_CONFIGFILE build option. There were some refactors and changes to the configuration messages and protobuf files. This works towards consolidation of protobuf C as an option for more generic handling of serialization/deserialization of various messages. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'include/ouroboros/ipcp.h')
-rw-r--r--include/ouroboros/ipcp.h72
1 files changed, 67 insertions, 5 deletions
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
index 49deeffd..c4d596b2 100644
--- a/include/ouroboros/ipcp.h
+++ b/include/ouroboros/ipcp.h
@@ -28,6 +28,11 @@
#include <stdbool.h>
#define LAYER_NAME_SIZE 255
+#define DEV_NAME_SIZE 255
+
+/* Unicast IPCP components. */
+#define DT_COMP "Data Transfer"
+#define MGMT_COMP "Management"
/* NOTE: The IRMd uses this order to select an IPCP for flow allocation. */
enum ipcp_type {
@@ -42,25 +47,29 @@ enum ipcp_type {
/* Unicast IPCP policies */
enum pol_addr_auth {
- ADDR_AUTH_FLAT_RANDOM = 0
+ ADDR_AUTH_FLAT_RANDOM = 0,
+ ADDR_AUTH_INVALID
};
enum pol_routing {
ROUTING_LINK_STATE = 0,
ROUTING_LINK_STATE_LFA,
- ROUTING_LINK_STATE_ECMP
+ ROUTING_LINK_STATE_ECMP,
+ ROUTING_INVALID
};
enum pol_cong_avoid {
CA_NONE = 0,
- CA_MB_ECN
+ CA_MB_ECN,
+ CA_INVALID
};
enum pol_dir_hash {
DIR_HASH_SHA3_224,
DIR_HASH_SHA3_256,
DIR_HASH_SHA3_384,
- DIR_HASH_SHA3_512
+ DIR_HASH_SHA3_512,
+ DIR_HASH_INVALID
};
struct dt_config {
@@ -78,7 +87,7 @@ struct uni_config {
};
struct eth_config {
- char * dev;
+ char dev[DEV_NAME_SIZE + 1];
uint16_t ethertype; /* DIX only*/
};
@@ -106,4 +115,57 @@ struct ipcp_config {
};
};
+/* default configurations */
+static const struct ipcp_config local_default_conf = {
+ .type = IPCP_LOCAL,
+ .layer_info = {
+ .dir_hash_algo = DIR_HASH_SHA3_256
+ }
+};
+
+static const struct ipcp_config eth_dix_default_conf = {
+ .type = IPCP_ETH_DIX,
+ .layer_info = {
+ .dir_hash_algo = DIR_HASH_SHA3_256
+ },
+ .eth = {
+ .ethertype=0xA000,
+ }
+};
+
+static const struct ipcp_config eth_llc_default_conf = {
+ .type = IPCP_ETH_LLC,
+ .layer_info = {
+ .dir_hash_algo = DIR_HASH_SHA3_256
+ }
+};
+
+static const struct ipcp_config udp_default_conf = {
+ .type = IPCP_UDP,
+ .udp = {
+ .port = 3435
+ }
+};
+
+static const struct ipcp_config uni_default_conf = {
+ .type = IPCP_UNICAST,
+ .layer_info = {
+ .dir_hash_algo = DIR_HASH_SHA3_256
+ },
+ .unicast = {
+ .dt = {
+ .addr_size = 4,
+ .eid_size = 8,
+ .max_ttl = 6,
+ .routing_type = ROUTING_LINK_STATE
+ },
+ .addr_auth_type = ADDR_AUTH_FLAT_RANDOM,
+ .cong_avoid = CA_MB_ECN
+ }
+};
+
+static const struct ipcp_config bc_default_conf = {
+ .type = IPCP_BROADCAST
+};
+
#endif /* OUROBOROS_IPCP_H */