From 021713f548c5dd03616941cb3f0d96ee4c47777b Mon Sep 17 00:00:00 2001 From: drbob Date: Mon, 25 Feb 2013 23:30:41 +0000 Subject: [PATCH] Changes to RPC protocol. - Adding first pass at defining stream protocol. - Added ADD/REMOVE peer Command, tweaked other parameters / response msgs too. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-rpc-b1@6147 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- rsctrl/src/Makefile | 4 +- rsctrl/src/definition/core.proto | 13 ++- rsctrl/src/definition/peers.proto | 46 ++++----- rsctrl/src/definition/stream.proto | 152 +++++++++++++++++++++++++++++ 4 files changed, 189 insertions(+), 26 deletions(-) create mode 100644 rsctrl/src/definition/stream.proto diff --git a/rsctrl/src/Makefile b/rsctrl/src/Makefile index 82f721f0b..a4c556640 100644 --- a/rsctrl/src/Makefile +++ b/rsctrl/src/Makefile @@ -1,7 +1,7 @@ EXEC = protoc -#PROTO = core.proto peers.proto system.proto chat.proto search.proto files.proto gxs.proto msgs.proto -PROTO = core.proto peers.proto system.proto chat.proto search.proto files.proto +#PROTO = core.proto peers.proto system.proto chat.proto search.proto files.proto stream.proto gxs.proto msgs.proto +PROTO = core.proto peers.proto system.proto chat.proto search.proto files.proto stream.proto PROTOPATH = ./definition #CDESTPATH = ./gencc diff --git a/rsctrl/src/definition/core.proto b/rsctrl/src/definition/core.proto index c9ef85508..ffa051124 100644 --- a/rsctrl/src/definition/core.proto +++ b/rsctrl/src/definition/core.proto @@ -17,9 +17,10 @@ enum PackageId { CHAT = 3; SEARCH = 4; FILES = 5; + STREAM = 6; + // BELOW HERE IS STILL BEING DESIGNED. - //MSGS = 5; - //TRANSFER = 6; + //MSGS = 7; // THEORETICAL ONES. GXS = 1000; @@ -111,6 +112,14 @@ message Dir { } +/////////////////////////////////////////////////////////////// + +message Timestamp { + required uint64 secs = 1; + required uint32 microsecs = 2; +} + + /////////////////////////////////////////////////////////////// // System Status diff --git a/rsctrl/src/definition/peers.proto b/rsctrl/src/definition/peers.proto index 8e27ae8f8..4ee240b10 100644 --- a/rsctrl/src/definition/peers.proto +++ b/rsctrl/src/definition/peers.proto @@ -9,13 +9,12 @@ import "core.proto"; enum RequestMsgIds { MsgId_RequestPeers = 1; MsgId_RequestAddPeer = 2; - MsgId_RequestModifyPeer = 3; + MsgId_RequestExaminePeer = 3; + MsgId_RequestModifyPeer = 4; } enum ResponseMsgIds { MsgId_ResponsePeerList = 1; - MsgId_ResponseAddPeer = 2; - MsgId_ResponseModifyPeer = 3; } /////////////////////////////////////////////////////////////// @@ -44,7 +43,7 @@ message RequestPeers { required SetOption set = 1; required InfoOption info = 2; - repeated string gpg_ids = 3; + repeated string pgp_ids = 3; } @@ -60,22 +59,31 @@ message ResponsePeerList { message RequestAddPeer { enum AddCmd { - NOOP = 0; // No op. - ADD = 1; // Add existing from gpg_id. - REMOVE = 2; // Remove existing from gpg_id. - IMPORT = 3; // Import from cert, with gpg_id. + ADD = 1; // Add existing from gpg_id. + REMOVE = 2; // Remove existing from gpg_id. + } + + required AddCmd cmd = 1; + required string pgp_id = 2; + optional string ssl_id = 3; + +} + +/////////////////////////////////////////////////////////////// + +// REQUEST: RequestExaminePeer +message RequestExaminePeer { + + enum ExamineCmd { + IMPORT = 3; // Import from cert, with gpg_id. EXAMINE = 4; // Examine cert, but no action. } - required string gpg_id = 1; - required AddCmd cmd = 2; - optional string cert = 3; -} + // Must have GPG ID to import. Proves you've looked at it. + required string pgp_id = 1; + required ExamineCmd cmd = 2; + required string cert = 3; -// RESPONSE: ResponseAddPeer -message ResponseAddPeer { - required rsctrl.core.Status status = 1; - repeated rsctrl.core.Person peers = 2; } /////////////////////////////////////////////////////////////// @@ -98,11 +106,5 @@ message RequestModifyPeer { repeated rsctrl.core.Person peers = 2; } -// RESPONSE: ResponseModifyPeer -message ResponseModifyPeer { - required rsctrl.core.Status status = 1; - repeated rsctrl.core.Person peers = 2; -} - /////////////////////////////////////////////////////////////// diff --git a/rsctrl/src/definition/stream.proto b/rsctrl/src/definition/stream.proto new file mode 100644 index 000000000..085fa3b29 --- /dev/null +++ b/rsctrl/src/definition/stream.proto @@ -0,0 +1,152 @@ +package rsctrl.stream; + +import "core.proto"; + +/////////////////////////////////////////////////////////////// +// This protocol defines how to stream data from retroshare. +// It can be used for VoIP or Files, or whatever. +// +// There are two parts. +// Control and actual streaming. +// +/////////////////////////////////////////////////////////////// + +enum RequestMsgIds { + MsgId_RequestStartFileStream = 1; + MsgId_RequestControlStream = 2; + MsgId_RequestListStreams = 3; +} + +enum ResponseMsgIds { + MsgId_ResponseStreamDetail = 1; // RESPONSE to + MsgId_StreamData = 2; +} + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// + +// Building Blocks + +enum StreamType { + STREAM_TYPE_ALL = 1; // all streams + STREAM_TYPE_FILES = 2; // files stream + STREAM_TYPE_VOIP = 3; // VoIP stream + STREAM_TYPE_OTHER = 4; // Who knows what else. +} + +enum StreamState { + STREAM_STATE_ERROR = 0; + STREAM_STATE_RUN = 1; + STREAM_STATE_PAUSED = 2; + STREAM_TYPE_FINISHED = 3; +} + +message StreamFileDetail { + + required rsctrl.core.File file = 1; + required uint64 offset = 5; + +} + + +message StreamVoipDetail { + + // THIS NEEDS MORE DEFINITION. + required string peerId = 1; + required uint64 duration = 2; + required uint64 offset = 3; + +} + + +message StreamDesc { + + required uint32 stream_id = 1; + required StreamType stream_type = 2; + required StreamState stream_state = 3; + required float rate_kBs = 4; + optional StreamFileDetail file = 5; + optional StreamVoipDetail voip = 6; + +} + + +message StreamData { + + required uint32 stream_id = 1; + required StreamState stream_state = 2; + required rsctrl.core.Timestamp send_time = 3; + required uint64 offset = 4; + required uint32 size = 5; + required bytes stream_data = 6; + +} + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// + + +// REQUEST: RequestStartFileStream +message RequestStartFileStream { + + required rsctrl.core.File file = 1; + required float rate_kBs = 2; + + // byte range. allows to restart transfer! + optional uint64 startByte = 3; + optional uint64 endByte = 4; + +} + +// RESPONSE: ResponseStreamDetail +message ResponseStreamDetail { + + required rsctrl.core.Status status = 1; + repeated StreamDesc streams = 2; + +} + + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// + +// REQUEST: RequestControlStream +message RequestControlStream { + + enum StreamAction { + STREAM_START = 1; // start stream + STREAM_STOP = 2; // stop stream + STREAM_PAUSE = 3; // pause stream + STREAM_CHANGE_RATE = 4; // rate of the stream + STREAM_SEEK = 5; // move streaming position. + } + + required uint32 stream_id = 1; + required StreamAction action = 2; + optional float rate_kBs = 3; + optional int64 seek_byte = 4; +} + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// + +// REQUEST: RequestListStreams +message RequestListStreams { + + required StreamType request_type = 1; + +} + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// + +// RESPONSE: ResponseStreamData +message ResponseStreamData { + required rsctrl.core.Status status = 1; + required StreamData data = 2; +} + + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// +