Rework SCTP auth pipeline to allow dynamic key change
The SCTP key sharing mechanism won't be using a file to communicate
the active authentication key anymore as we will be receiving
it directly into message bridge through an AOS channel instead.
Change-Id: I46e079b98cbb6a0ed52fca36c67f7fa724ba249c
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/network/sctp_server.h b/aos/network/sctp_server.h
index a8c70aa..e641fd8 100644
--- a/aos/network/sctp_server.h
+++ b/aos/network/sctp_server.h
@@ -13,6 +13,7 @@
#include <cstring>
#include <memory>
+#include "absl/types/span.h"
#include "glog/logging.h"
#include "aos/network/sctp_lib.h"
@@ -24,7 +25,8 @@
class SctpServer {
public:
SctpServer(int streams, std::string_view local_host = "0.0.0.0",
- int local_port = 9971, std::vector<uint8_t> sctp_auth_key = {});
+ int local_port = 9971,
+ SctpAuthMethod requested_authentication = SctpAuthMethod::kNoAuth);
~SctpServer() {}
@@ -63,6 +65,10 @@
void SetPoolSize(size_t pool_size) { sctp_.SetPoolSize(pool_size); }
+ void SetAuthKey(absl::Span<const uint8_t> auth_key) {
+ sctp_.SetAuthKey(auth_key);
+ }
+
private:
struct sockaddr_storage sockaddr_local_;
SctpReadWrite sctp_;