Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3347726
D12521.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12521.diff
View Options
diff --git a/lib/types/tunnelbroker/message-to-tunnelbroker-request-types.js b/lib/types/tunnelbroker/message-to-tunnelbroker-request-types.js
new file mode 100644
--- /dev/null
+++ b/lib/types/tunnelbroker/message-to-tunnelbroker-request-types.js
@@ -0,0 +1,19 @@
+// @flow
+
+import type { TInterface } from 'tcomb';
+import t from 'tcomb';
+
+import { tShape, tString } from '../../utils/validation-utils.js';
+
+export type MessageToTunnelbrokerRequest = {
+ +type: 'MessageToTunnelbrokerRequest',
+ +clientMessageID: string,
+ +payload: string,
+};
+
+export const messageToTunnelbrokerRequestValidator: TInterface<MessageToTunnelbrokerRequest> =
+ tShape<MessageToTunnelbrokerRequest>({
+ type: tString('MessageToTunnelbrokerRequest'),
+ clientMessageID: t.String,
+ payload: t.String,
+ });
diff --git a/lib/types/tunnelbroker/messages.js b/lib/types/tunnelbroker/messages.js
--- a/lib/types/tunnelbroker/messages.js
+++ b/lib/types/tunnelbroker/messages.js
@@ -19,6 +19,10 @@
type MessageToDevice,
messageToDeviceValidator,
} from './message-to-device-types.js';
+import {
+ type MessageToTunnelbrokerRequest,
+ messageToTunnelbrokerRequestValidator,
+} from './message-to-tunnelbroker-request-types.js';
import {
type ConnectionInitializationMessage,
connectionInitializationMessageValidator,
@@ -49,6 +53,7 @@
ANONYMOUS_INITIALIZATION_MESSAGE: 'AnonymousInitializationMessage',
MESSAGE_TO_DEVICE_REQUEST_STATUS: 'MessageToDeviceRequestStatus',
MESSAGE_TO_DEVICE_REQUEST: 'MessageToDeviceRequest',
+ MESSAGE_TO_TUNNELBROKER_REQUEST: 'MessageToTunnelbrokerRequest',
MESSAGE_TO_DEVICE: 'MessageToDevice',
MESSAGE_RECEIVE_CONFIRMATION: 'MessageReceiveConfirmation',
HEARTBEAT: 'Heartbeat',
@@ -63,6 +68,7 @@
messageToDeviceValidator,
messageReceiveConfirmationValidator,
heartbeatValidator,
+ messageToTunnelbrokerRequestValidator,
]);
export type TunnelbrokerMessage =
@@ -72,4 +78,5 @@
| MessageToDeviceRequest
| MessageToDevice
| MessageReceiveConfirmation
- | Heartbeat;
+ | Heartbeat
+ | MessageToTunnelbrokerRequest;
diff --git a/shared/tunnelbroker_messages/src/messages/message_to_tunnelbroker_request.rs b/shared/tunnelbroker_messages/src/messages/message_to_tunnelbroker_request.rs
new file mode 100644
--- /dev/null
+++ b/shared/tunnelbroker_messages/src/messages/message_to_tunnelbroker_request.rs
@@ -0,0 +1,11 @@
+//! Message sent from device to Tunnelbroker.
+
+use serde::{Deserialize, Serialize};
+
+#[derive(Serialize, Deserialize, PartialEq, Debug)]
+#[serde(tag = "type", rename_all = "camelCase")]
+pub struct MessageToTunnelbrokerRequest {
+ #[serde(rename = "clientMessageID")]
+ pub client_message_id: String,
+ pub payload: String,
+}
diff --git a/shared/tunnelbroker_messages/src/messages/mod.rs b/shared/tunnelbroker_messages/src/messages/mod.rs
--- a/shared/tunnelbroker_messages/src/messages/mod.rs
+++ b/shared/tunnelbroker_messages/src/messages/mod.rs
@@ -6,6 +6,7 @@
pub mod message_to_device;
pub mod message_to_device_request;
pub mod message_to_device_request_status;
+pub mod message_to_tunnelbroker_request;
pub mod session;
pub use device_list_updated::*;
@@ -14,6 +15,7 @@
pub use message_to_device::*;
pub use message_to_device_request::*;
pub use message_to_device_request_status::*;
+pub use message_to_tunnelbroker_request::*;
pub use session::*;
pub use websocket_messages::{
ConnectionInitializationResponse, ConnectionInitializationStatus, Heartbeat,
@@ -42,6 +44,7 @@
MessageToDeviceRequest(MessageToDeviceRequest),
MessageToDevice(MessageToDevice),
MessageReceiveConfirmation(MessageReceiveConfirmation),
+ MessageToTunnelbrokerRequest(MessageToTunnelbrokerRequest),
Heartbeat(Heartbeat),
IdentityDeviceListUpdated(IdentityDeviceListUpdated),
}
@@ -52,3 +55,7 @@
RefreshKeysRequest(RefreshKeyRequest),
IdentityDeviceListUpdated(IdentityDeviceListUpdated),
}
+
+#[derive(Serialize, Deserialize, Debug)]
+#[serde(untagged)]
+pub enum MessageToTunnelbroker {}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 1:06 PM (19 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2570738
Default Alt Text
D12521.diff (3 KB)
Attached To
Mode
D12521: [Tunnelbroker] add `MessageToTunnelbrokerRequest` type
Attached
Detach File
Event Timeline
Log In to Comment