Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
control.h
Go to the documentation of this file.
1// Copyright 2026 The Symbian SDK Authors.
2// Licensed under the Apache License, Version 2.0.
3
4#ifndef SYMBIAN_AGENT_CONTROL_H_
5#define SYMBIAN_AGENT_CONTROL_H_
6
7#include <cstddef>
8#include <cstdint>
9#include <string>
10#include <string_view>
11
12#include "absl/status/statusor.h"
13#include "nlohmann/json.hpp"
14
15namespace symbian::agent {
16
18inline constexpr std::size_t kMaximumControlBytes = 4096;
19
21enum class ControlKind : std::uint8_t {
22 kHello = 1,
23 kStatus = 2,
24 kCancel = 3,
25 kResult = 4,
26 kError = 5,
27 kLogs = 6,
29};
30
40 std::uint32_t version = 1;
41 std::uint64_t request_id = 0;
43 std::uint64_t deadline_millis = 0;
44 nlohmann::json body = nlohmann::json::object();
45 nlohmann::json extensions = nlohmann::json::object();
46};
47
53absl::StatusOr<ControlMessage> ParseControl(std::string_view encoded);
54
56absl::StatusOr<std::string> PackControl(const ControlMessage& message);
57
58} // namespace symbian::agent
59
60#endif // SYMBIAN_AGENT_CONTROL_H_
Definition control.cc:11
ControlKind
Version-one control operations; none grants write or device access.
Definition control.h:21
absl::StatusOr< ControlMessage > ParseControl(std::string_view encoded)
Parse one bounded MessagePack control payload.
Definition control.cc:36
absl::StatusOr< std::string > PackControl(const ControlMessage &message)
Validate and serialize a control envelope as MessagePack.
Definition control.cc:88
constexpr std::size_t kMaximumControlBytes
Control messages have a smaller budget than data frames.
Definition control.h:18
Typed control envelope carried as MessagePack inside a wire frame.
Definition control.h:39
nlohmann::json body
Definition control.h:44
nlohmann::json extensions
Definition control.h:45
ControlKind kind
Definition control.h:42
std::uint64_t deadline_millis
Definition control.h:43
std::uint64_t request_id
Definition control.h:41
std::uint32_t version
Definition control.h:40