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 /include/ouroboros/protobuf.h | |
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 'include/ouroboros/protobuf.h')
-rw-r--r-- | include/ouroboros/protobuf.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/include/ouroboros/protobuf.h b/include/ouroboros/protobuf.h new file mode 100644 index 00000000..edcbe4f0 --- /dev/null +++ b/include/ouroboros/protobuf.h @@ -0,0 +1,99 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2023 + * + * Protobuf syntax conversion + * + * 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_PROTOBUF_H +#define OUROBOROS_PROTOBUF_H + +#include <ouroboros/qos.h> +#include <ouroboros/ipcp.h> +#include <ouroboros/serdes-oep.h> + +#include "ipcp_config.pb-c.h" +typedef IpcpConfigMsg ipcp_config_msg_t; +typedef LayerInfoMsg layer_info_msg_t; +typedef DtConfigMsg dt_config_msg_t; +typedef EthConfigMsg eth_config_msg_t; +typedef UdpConfigMsg udp_config_msg_t; +typedef UniConfigMsg uni_config_msg_t; + +#include "ipcpd_messages.pb-c.h" +typedef IpcpMsg ipcp_msg_t; + +#include "irmd_messages.pb-c.h" +typedef IpcpInfoMsg ipcp_info_msg_t; +typedef NameInfoMsg name_info_msg_t; + +#include "qosspec.pb-c.h" +typedef QosspecMsg qosspec_msg_t; + +#include "enroll.pb-c.h" +typedef EnrollReqMsg enroll_req_msg_t; +typedef EnrollRespMsg enroll_resp_msg_t; +typedef EnrollAckMsg enroll_ack_msg_t; + +/* IPCP configuration */ + +layer_info_msg_t * layer_info_s_to_msg(const struct layer_info * s); + +struct layer_info layer_info_msg_to_s(const layer_info_msg_t * msg); + +dt_config_msg_t * dt_config_s_to_msg(const struct dt_config * s); + +struct dt_config dt_config_msg_to_s(const dt_config_msg_t * msg); + +uni_config_msg_t * uni_config_s_to_msg(const struct uni_config * s); + +struct uni_config uni_config_msg_to_s(const uni_config_msg_t * msg); + +eth_config_msg_t * eth_config_s_to_msg(const struct eth_config * s); + +struct eth_config eth_config_msg_to_s(const eth_config_msg_t * msg); + +udp_config_msg_t * udp_config_s_to_msg(const struct udp_config * s); + +struct udp_config udp_config_msg_to_s(const udp_config_msg_t * msg); + +ipcp_config_msg_t * ipcp_config_s_to_msg(const struct ipcp_config * s); + +struct ipcp_config ipcp_config_msg_to_s(const ipcp_config_msg_t * msg); + +/* QoS */ + +qosspec_msg_t * qos_spec_s_to_msg(const struct qos_spec * s); + +struct qos_spec qos_spec_msg_to_s(const qosspec_msg_t * msg); + +/* Enrollment */ + +enroll_req_msg_t * enroll_req_s_to_msg(void); + +int enroll_req_msg_to_s(const enroll_req_msg_t * msg); + +enroll_resp_msg_t * enroll_resp_s_to_msg(const struct enroll_resp * s); + +struct enroll_resp enroll_resp_msg_to_s(enroll_resp_msg_t * msg); + +enroll_ack_msg_t * enroll_ack_s_to_msg(const int response); + +int enroll_ack_msg_to_s(const enroll_ack_msg_t * msg); + +#endif /* OUROBOROS_PROTOBUF_H */
\ No newline at end of file |