5#include <proto/main.pb.h>
6#include "protocol/registry.h"
8#include "handlers/authenticate.h"
9#include "utils/logging.h"
11#include <handlers/carrier.h>
12#include <handlers/login_lock.h>
13#include <handlers/ping.h>
14#include <handlers/run_manager.h>
15#include <handlers/sys.h>
16#include <handlers/calibration.h>
18void msg::handlers::DynamicRegistry::init(carrier::Carrier &c) {
19 using namespace net::auth;
23 set(pb_Envelope_generic_tag, pb_GenericMessage_ping_command_tag,
new PingRequestHandler{});
27 set(pb_Envelope_message_v1_tag, pb_MessageV1_udp_data_streaming_command_tag,
new UdpDataStreamingHandler());
28 set(pb_Envelope_message_v1_tag, pb_MessageV1_stand_by_command_tag,
new StandByRequestHandler(c));
29 set(pb_Envelope_message_v1_tag, pb_MessageV1_reset_command_tag,
new ResetRequestHandler(c));
30 set(pb_Envelope_message_v1_tag, pb_MessageV1_config_command_tag,
new ConfigMessageHandler(c));
31 set(pb_Envelope_message_v1_tag, pb_MessageV1_extract_command_tag,
new ExtractMessageHandler(c));
32 set(pb_Envelope_message_v1_tag, pb_MessageV1_describe_command_tag,
new DescribeRequestHandler(c));
33 set(pb_Envelope_message_v1_tag, pb_MessageV1_register_external_entities_command_tag,
34 new RegisterExternalEntitiesRequestHandler());
35 set(pb_Envelope_message_v1_tag, pb_MessageV1_start_run_command_tag,
new StartRunRequestHandler());
36 set(pb_Envelope_message_v1_tag, pb_MessageV1_stop_run_command_tag,
new StopRunRequestHandler());
38 set(pb_Envelope_message_v1_tag, pb_MessageV1_read_temperature_command_tag,
new ReadTemperaturesHandler(c));
39 set(pb_Envelope_message_v1_tag, pb_MessageV1_auth_request_tag,
new AuthRequestHandler());
81 return static_cast<uint64_t
>(envelope_kind) << 32 | message_kind;
84msg::handlers::MessageHandler *msg::handlers::DynamicRegistry::lookup(
uint32_t envelope_kind,
86 auto found = protobuf_entries.find(
kind2key(envelope_kind, message_kind));
87 if (found == protobuf_entries.end())
90 return found->second.handler;
93bool msg::handlers::DynamicRegistry::set(
uint32_t envelope_kind,
uint32_t message_kind,
94 MessageHandler *handler) {
95 protobuf_entries.emplace(
96 kind2key(envelope_kind, message_kind),
97 RegistryEntry{handler}
static uint64_t kind2key(uint32_t envelope_kind, uint32_t message_kind)