syntax = "proto2";
package et;
option optimize_for = LITE_RUNTIME;

import "ET.proto";

enum TerminalPacketType {
  KEEP_ALIVE = 0;
  TERMINAL_BUFFER = 1;
  TERMINAL_INFO = 2;
  PORT_FORWARD_DESTINATION_REQUEST = 5;
  PORT_FORWARD_DESTINATION_RESPONSE = 6;
  PORT_FORWARD_DATA = 7;
  TERMINAL_USER_INFO = 8;
  TERMINAL_INIT = 9;
  JUMPHOST_INIT = 10;
}

message TerminalBuffer {
  optional bytes buffer = 1;
}

message TerminalInfo {
  optional string id = 1;
  optional int32 row = 2;
  optional int32 column = 3;
  optional int32 width = 4;
  optional int32 height = 5;
}

message PortForwardSourceRequest {
  optional SocketEndpoint source = 1;
  optional SocketEndpoint destination = 2;
  optional string environmentvariable = 3;
}

message PortForwardSourceResponse {
  optional string error = 1;
}

message PortForwardDestinationRequest {
  optional SocketEndpoint destination = 1;
  optional int32 fd = 2;
}

message PortForwardDestinationResponse {
  optional int32 clientfd = 1;
  optional int32 socketid = 2;
  optional string error = 3;
}

message PortForwardData {
  optional bool sourcetodestination = 1;
  optional int32 socketid = 2;
  optional bytes buffer = 3;
  optional string error = 4;
  optional bool closed = 5;
}

message InitialPayload {
  optional bool jumphost = 1 [default = false];
  repeated PortForwardSourceRequest reversetunnels = 2;
}

message InitialResponse {
  optional string error = 1;
}

message ConfigParams {
  optional int32 vlevel = 1;
  optional int32 minloglevel = 2;
}

message TermInit {
  repeated string environmentnames = 1;
  repeated string environmentvalues = 2;
}

message TerminalUserInfo {
  optional string id = 1;
  optional string passkey = 2;
  optional int64 uid = 3;
  optional int64 gid = 4;
  optional int64 fd = 5;
}