core-extra/daemon/proto/core.proto
2019-02-25 22:45:57 -08:00

222 lines
4 KiB
Protocol Buffer

syntax = "proto3";
package core;
service CoreApi {
rpc CreateSession (CreateSessionRequest) returns (CreateSessionResponse) {
}
rpc DeleteSession (DeleteSessionRequest) returns (DeleteSessionResponse) {
}
rpc GetSessions (SessionsRequest) returns (SessionsResponse) {
}
rpc GetSession (SessionRequest) returns (SessionResponse) {
}
rpc GetSessionOptions (SessionOptionsRequest) returns (SessionOptionsResponse) {
}
rpc GetSessionLocation (GetSessionLocationRequest) returns (GetSessionLocationResponse) {
}
rpc SetSessionLocation (SetSessionLocationRequest) returns (SetSessionLocationResponse) {
}
rpc SetSessionState (SetSessionStateRequest) returns (SetSessionStateResponse) {
}
rpc CreateNode (CreateNodeRequest) returns (CreateNodeResponse) {
}
rpc EditNode (EditNodeRequest) returns (EditNodeResponse) {
}
}
// rpc request/response messages
message CreateSessionRequest {
}
message CreateSessionResponse {
int32 id = 1;
int32 state = 2;
}
message DeleteSessionRequest {
int32 id = 1;
}
message DeleteSessionResponse {
bool result = 1;
}
message SessionsRequest {
}
message SessionsResponse {
repeated Session sessions = 1;
}
message SessionRequest {
int32 id = 1;
}
message SessionResponse {
int32 state = 1;
repeated Node nodes = 2;
repeated Link links = 3;
}
message SessionOptionsRequest {
int32 id = 1;
}
message SessionOptionsResponse {
repeated ConfigGroup groups = 1;
}
message GetSessionLocationRequest {
int32 id = 1;
}
message GetSessionLocationResponse {
Position position = 1;
float scale = 2;
}
message SetSessionLocationRequest {
int32 id = 1;
Position position = 2;
float scale = 3;
}
message SetSessionLocationResponse {
}
message SetSessionStateRequest {
int32 id = 1;
SessionState state = 2;
}
message SetSessionStateResponse {
bool result = 1;
}
message CreateNodeRequest {
int32 session = 1;
int32 id = 2;
NodeType type = 3;
string name = 4;
string model = 5;
string icon = 6;
repeated string services = 7;
Position position = 8;
string emane = 9;
string opaque = 10;
}
message CreateNodeResponse {
int32 id = 1;
}
message EditNodeRequest {
int32 session = 1;
int32 id = 2;
Position position = 3;
}
message EditNodeResponse {
bool result = 1;
}
// data structures for messages below
enum SessionState {
NONE = 0;
DEFINITION = 1;
CONFIGURATION = 2;
INSTANTIATION = 3;
RUNTIME = 4;
DATACOLLECT = 5;
SHUTDOWN = 6;
}
enum NodeType {
DEFAULT = 0;
PHYSICAL = 1;
TBD = 3;
SWITCH = 4;
HUB = 5;
WIRELESS_LAN = 6;
RJ45 = 7;
TUNNEL = 8;
KTUNNEL = 9;
EMANE = 10;
TAP_BRIDGE = 11;
PEER_TO_PEER = 12;
CONTROL_NET = 13;
EMANE_NET = 14;
}
message ConfigGroup {
string name = 1;
repeated ConfigOption options = 2;
}
message ConfigOption {
string label = 1;
string name = 2;
string value = 3;
int32 type = 4;
repeated string select = 5;
}
message Session {
int32 id = 1;
int32 state = 2;
int32 nodes = 3;
}
message Node {
int32 id = 1;
string name = 2;
int32 type = 3;
string model = 4;
Position position = 5;
repeated string services = 6;
string emane = 7;
}
message Link {
int32 node_one = 1;
int32 node_two = 2;
int32 type = 3;
Interface interface_one = 4;
Interface interface_two = 5;
LinkOptions options = 6;
}
message LinkOptions {
string opaque = 1;
float jitter = 2;
string key = 3;
float mburst = 4;
float mer = 5;
float per = 6;
float bandwidth = 7;
float burst = 8;
float delay = 9;
float dup = 10;
bool unidirectional = 11;
}
message Interface {
int32 id = 1;
string name = 2;
string mac = 3;
string ip4 = 4;
int32 ip4mask = 5;
string ip6 = 6;
int32 ip6mask = 7;
}
message Position {
float x = 1;
float y = 2;
float z = 3;
float lat = 4;
float lon = 5;
float alt = 6;
}