Skip to content

Commit

Permalink
feat: initial protocol definition
Browse files Browse the repository at this point in the history
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
  • Loading branch information
rgallor committed Sep 26, 2023
1 parent 245b368 commit 0d190dc
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
27 changes: 27 additions & 0 deletions edgehog/device/forwarder/http.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";

package edgehog.device.forwarder;

message Http {
oneof message {
Request request = 1;
Response response = 2;
}

message Request {
bytes request_id = 1;
string path = 2;
string method = 3;
optional string querystring = 4;
map<string, string> headers = 5;
optional bytes payload = 6;
uint32 port = 7;
}

message Response {
bytes request_id = 1;
uint32 status_code = 2;
map<string, string> headers = 3;
optional bytes payload = 4;
}
}
13 changes: 13 additions & 0 deletions edgehog/device/forwarder/message.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package edgehog.device.forwarder;

import "edgehog/device/forwarder/http.proto";
import "edgehog/device/forwarder/ws.proto";

message Message {
oneof protocol {
Http http = 1;
WebSocket ws = 2;
}
}
20 changes: 20 additions & 0 deletions edgehog/device/forwarder/ws.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package edgehog.device.forwarder;

message WebSocket {
bytes socket_id = 1;

oneof message {
string text = 2;
bytes binary = 3;
bytes ping = 4;
bytes pong = 5;
Close close = 6;
}

message Close {
uint32 code = 1;
optional string reason = 2;
}
}

0 comments on commit 0d190dc

Please sign in to comment.