5#include <proto/main.pb.h>
6#include "protocol/registry.h"
8#include "handlers/authenticate.h"
9#include "handlers/loader_flasher.h"
10#include "utils/logging.h"
12#include <handlers/carrier.h>
13#include <handlers/login_lock.h>
14#include <handlers/ping.h>
15#include <handlers/run_manager.h>
16#include <handlers/sys.h>
17#include <handlers/calibration.h>
19void msg::handlers::DynamicRegistry::init(carrier::Carrier &c) {
20 using namespace net::auth;
24 set(pb_Envelope_generic_tag, pb_GenericMessage_ping_command_tag,
new PingRequestHandler{});
28 set(pb_Envelope_message_v1_tag, pb_MessageV1_udp_data_streaming_command_tag,
new UdpDataStreamingHandler());
29 set(pb_Envelope_message_v1_tag, pb_MessageV1_stand_by_command_tag,
new StandByRequestHandler(c));
30 set(pb_Envelope_message_v1_tag, pb_MessageV1_reset_command_tag,
new ResetRequestHandler(c));
31 set(pb_Envelope_message_v1_tag, pb_MessageV1_config_command_tag,
new ConfigMessageHandler(c));
32 set(pb_Envelope_message_v1_tag, pb_MessageV1_extract_command_tag,
new ExtractMessageHandler(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());
37 set(pb_Envelope_message_v1_tag, pb_MessageV1_calibration_command_tag,
new CalibrationHandler(c));
39 set(pb_Envelope_message_v1_tag, pb_MessageV1_read_temperature_command_tag,
new ReadTemperaturesHandler(c));
40 set(pb_Envelope_message_v1_tag, pb_MessageV1_auth_request_tag,
new AuthRequestHandler());
42 set(pb_Envelope_message_v1_tag, pb_MessageV1_flash_init_command_tag,
new FlasherInitHandler());
43 set(pb_Envelope_message_v1_tag, pb_MessageV1_flash_data_command_tag,
new FlasherDataHandler());
44 set(pb_Envelope_message_v1_tag, pb_MessageV1_flash_complete_command_tag,
new FlasherCompleteHandler());
86 return static_cast<uint64_t
>(envelope_kind) << 32 | message_kind;
89msg::handlers::MessageHandler *msg::handlers::DynamicRegistry::lookup(
uint32_t envelope_kind,
91 auto found = protobuf_entries.find(
kind2key(envelope_kind, message_kind));
92 if (found == protobuf_entries.end())
95 return found->second.handler;
98bool msg::handlers::DynamicRegistry::set(
uint32_t envelope_kind,
uint32_t message_kind,
99 MessageHandler *handler) {
100 protobuf_entries.emplace(
101 kind2key(envelope_kind, message_kind),
102 RegistryEntry{handler}
static uint64_t kind2key(uint32_t envelope_kind, uint32_t message_kind)