diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2023-03-04 03:48:48 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2023-03-08 15:59:37 +0100 |
commit | 89b58eaa2706c54aeb0a48252d1cfbd2b5ae01b7 (patch) | |
tree | 891c4a2de37e06fdb8879741911a6b7ff2f1b4b8 /src/lib/dev.c | |
parent | f16b4a1954ab4fbca0ec403f6a04c80375328921 (diff) | |
download | ouroboros-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 'src/lib/dev.c')
-rw-r--r-- | src/lib/dev.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index c46bbdd7..e84efe55 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -39,6 +39,7 @@ #include <ouroboros/fccntl.h> #include <ouroboros/bitmap.h> #include <ouroboros/np1_flow.h> +#include <ouroboros/protobuf.h> #include <ouroboros/pthread.h> #include <ouroboros/random.h> #include <ouroboros/shm_flow_set.h> @@ -795,7 +796,7 @@ int flow_accept(qosspec_t * qs, crypt_dh_pkp_destroy(pkp); fd = flow_init(recv_msg->flow_id, recv_msg->pid, - msg_to_spec(recv_msg->qosspec), s, + qos_spec_msg_to_s(recv_msg->qosspec), s, recv_msg->mpl); irm_msg__free_unpacked(recv_msg, NULL); @@ -827,7 +828,6 @@ static int __flow_alloc(const char * dst, bool join) { irm_msg_t msg = IRM_MSG__INIT; - qosspec_msg_t qs_msg = QOSSPEC_MSG__INIT; irm_msg_t * recv_msg; int fd; void * pkp = NULL; /* public key pair */ @@ -846,8 +846,7 @@ static int __flow_alloc(const char * dst, msg.dst = (char *) dst; msg.has_pid = true; msg.pid = getpid(); - qs_msg = spec_to_msg(qs); - msg.qosspec = &qs_msg; + msg.qosspec = qos_spec_s_to_msg(qs); if (timeo != NULL) { msg.has_timeo_sec = true; @@ -871,6 +870,8 @@ static int __flow_alloc(const char * dst, } recv_msg = send_recv_irm_msg(&msg); + qosspec_msg__free_unpacked(msg.qosspec, NULL); + if (recv_msg == NULL) goto fail_send; @@ -1832,7 +1833,6 @@ int ipcp_flow_req_arr(const uint8_t * dst, { irm_msg_t msg = IRM_MSG__INIT; irm_msg_t * recv_msg; - qosspec_msg_t qs_msg; int fd; assert(dst != NULL); @@ -1843,8 +1843,7 @@ int ipcp_flow_req_arr(const uint8_t * dst, msg.has_hash = true; msg.hash.len = len; msg.hash.data = (uint8_t *) dst; - qs_msg = spec_to_msg(&qs); - msg.qosspec = &qs_msg; + msg.qosspec = qos_spec_s_to_msg(&qs); msg.has_mpl = true; msg.mpl = mpl; msg.has_pk = true; @@ -1852,6 +1851,8 @@ int ipcp_flow_req_arr(const uint8_t * dst, msg.pk.len = dlen; recv_msg = send_recv_irm_msg(&msg); + qosspec_msg__free_unpacked(msg.qosspec, NULL); + if (recv_msg == NULL) return -EIRMD; |