From 8183983c2c1cc50e3e0c82a8ab08d5fd66e0dc86 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 17 Aug 2023 16:12:44 +0200 Subject: ipcpd: Add IDs to enrollment The enrollment messages now have a 64-bit ID to easier track enrollments in the logs in larger scale tests. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/protobuf.h | 10 +++++----- include/ouroboros/serdes-oep.h | 33 +++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 15 deletions(-) (limited to 'include/ouroboros') diff --git a/include/ouroboros/protobuf.h b/include/ouroboros/protobuf.h index edcbe4f0..bb802148 100644 --- a/include/ouroboros/protobuf.h +++ b/include/ouroboros/protobuf.h @@ -84,16 +84,16 @@ struct qos_spec qos_spec_msg_to_s(const qosspec_msg_t * msg); /* Enrollment */ -enroll_req_msg_t * enroll_req_s_to_msg(void); +enroll_req_msg_t * enroll_req_s_to_msg(const struct enroll_req * s); -int enroll_req_msg_to_s(const enroll_req_msg_t * msg); +struct enroll_req 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); +struct enroll_resp enroll_resp_msg_to_s(const enroll_resp_msg_t * msg); -enroll_ack_msg_t * enroll_ack_s_to_msg(const int response); +enroll_ack_msg_t * enroll_ack_s_to_msg(const struct enroll_ack * s); -int enroll_ack_msg_to_s(const enroll_ack_msg_t * msg); +struct enroll_ack enroll_ack_msg_to_s(const enroll_ack_msg_t * msg); #endif /* OUROBOROS_PROTOBUF_H */ \ No newline at end of file diff --git a/include/ouroboros/serdes-oep.h b/include/ouroboros/serdes-oep.h index c503b31a..4409b047 100644 --- a/include/ouroboros/serdes-oep.h +++ b/include/ouroboros/serdes-oep.h @@ -30,18 +30,31 @@ /* Enrollment */ -/* no structs yet for req and ack. TODO: authentication. */ +#define ENROLL_ID_LEN 8 + +struct enroll_req { + /* TODO: Authentication */ + uint8_t id[ENROLL_ID_LEN]; +}; struct enroll_resp { - struct timespec t; - int response; - struct ipcp_config conf; + uint8_t id[ENROLL_ID_LEN]; + struct timespec t; + int response; + struct ipcp_config conf; +}; + +struct enroll_ack { + uint8_t id[ENROLL_ID_LEN]; + int result; }; -ssize_t enroll_req_ser(buffer_t buf); +ssize_t enroll_req_ser(const struct enroll_req * req, + buffer_t buf); -int enroll_req_des(const buffer_t buf); +int enroll_req_des(struct enroll_req * req, + const buffer_t buf); ssize_t enroll_resp_ser(const struct enroll_resp * resp, buffer_t buf); @@ -49,10 +62,10 @@ ssize_t enroll_resp_ser(const struct enroll_resp * resp, int enroll_resp_des(struct enroll_resp * resp, buffer_t buf); -ssize_t enroll_ack_ser(const int response, - buffer_t buf); +ssize_t enroll_ack_ser(const struct enroll_ack * ack, + buffer_t buf); -int enroll_ack_des(int * response, - const buffer_t buf); +int enroll_ack_des(struct enroll_ack * ack, + const buffer_t buf); #endif /* OUROBOROS_LIB_SERDES_OEP_H*/ \ No newline at end of file -- cgit v1.2.3