Got the first RPC commands working now and tested with python library.

* Switched from BASE => CORE in proto files.
 * finished first RPC call to list peers.
 * return "NO_IMPL_YET" for other peer fns (Not Implemented Yet)
 * Added SystemStatus RPC call too.
 * Disable Verbose SSH logging - so we can see debug better.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5469 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-08-25 11:47:20 +00:00
parent 51fc0c59fe
commit c8350ad011
12 changed files with 2914 additions and 539 deletions

View File

@ -185,15 +185,19 @@ sshserver {
protorpc {
# Proto Services
HEADERS += rpc/proto/rpcprotopeers.h \
rpc/proto/rpcprotosystem.h \
SOURCES += rpc/proto/rpcprotopeers.cc \
rpc/proto/rpcprotosystem.cc \
# Generated ProtoBuf Code the RPC System
HEADERS += rpc/proto/gencc/base.pb.h \
HEADERS += rpc/proto/gencc/core.pb.h \
rpc/proto/gencc/peers.pb.h \
rpc/proto/gencc/system.pb.h \
SOURCES += rpc/proto/gencc/base.pb.cc \
SOURCES += rpc/proto/gencc/core.pb.cc \
rpc/proto/gencc/peers.pb.cc \
rpc/proto/gencc/system.pb.cc \
QMAKE_CFLAGS += -pthread
QMAKE_CXXFLAGS += -pthread

View File

@ -205,37 +205,37 @@ void protobuf_AddDesc_peers_2eproto() {
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::rsctrl::base::protobuf_AddDesc_base_2eproto();
::rsctrl::core::protobuf_AddDesc_core_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\013peers.proto\022\014rsctrl.peers\032\nbase.proto\""
"\246\002\n\014RequestPeers\0221\n\003set\030\001 \002(\0162$.rsctrl.p"
"\n\013peers.proto\022\014rsctrl.peers\032\ncore.proto\""
"\251\002\n\014RequestPeers\0221\n\003set\030\001 \002(\0162$.rsctrl.p"
"eers.RequestPeers.SetOption\0223\n\004info\030\002 \002("
"\0162%.rsctrl.peers.RequestPeers.InfoOption"
"\022\017\n\007gpg_ids\030\003 \003(\t\"[\n\tSetOption\022\t\n\005OWNID\020"
"\001\022\n\n\006LISTED\020\002\022\n\n\006ONLINE\020\003\022\013\n\007FRIENDS\020\004\022\t"
"\n\005VALID\020\005\022\n\n\006SIGNED\020\006\022\007\n\003ALL\020\007\"@\n\nInfoOp"
"tion\022\014\n\010NAMEONLY\020\001\022\t\n\005BASIC\020\002\022\014\n\010LOCATIO"
"N\020\003\022\013\n\007ALLINFO\020\004\"[\n\020ResponsePeerList\022#\n\006"
"status\030\001 \002(\0132\023.rsctrl.base.Status\022\"\n\005pee"
"rs\030\002 \003(\0132\023.rsctrl.base.Person\"\242\001\n\016Reques"
"tAddPeer\022\016\n\006gpg_id\030\001 \002(\t\0220\n\003cmd\030\002 \002(\0162#."
"rsctrl.peers.RequestAddPeer.AddCmd\022\014\n\004ce"
"rt\030\003 \001(\t\"@\n\006AddCmd\022\010\n\004NOOP\020\000\022\007\n\003ADD\020\001\022\n\n"
"\006REMOVE\020\002\022\n\n\006IMPORT\020\003\022\013\n\007EXAMINE\020\004\"Z\n\017Re"
"sponseAddPeer\022#\n\006status\030\001 \002(\0132\023.rsctrl.b"
"ase.Status\022\"\n\005peers\030\002 \003(\0132\023.rsctrl.base."
"Person\"\231\001\n\021RequestModifyPeer\0223\n\003cmd\030\001 \002("
"\0162&.rsctrl.peers.RequestModifyPeer.ModCm"
"d\022\"\n\005peers\030\002 \003(\0132\023.rsctrl.base.Person\"+\n"
"\006ModCmd\022\010\n\004NOOP\020\000\022\013\n\007ADDRESS\020\001\022\n\n\006DYNDNS"
"\020\002\"]\n\022ResponseModifyPeer\022#\n\006status\030\001 \002(\013"
"2\023.rsctrl.base.Status\022\"\n\005peers\030\002 \003(\0132\023.r"
"sctrl.base.Person*^\n\rRequestMsgIds\022\026\n\022Ms"
"gId_RequestPeers\020\001\022\030\n\024MsgId_RequestAddPe"
"er\020\002\022\033\n\027MsgId_RequestModifyPeer\020\003*e\n\016Res"
"ponseMsgIds\022\032\n\026MsgId_ResponsePeerList\020\001\022"
"\031\n\025MsgId_ResponseAddPeer\020\002\022\034\n\030MsgId_Resp"
"onseModifyPeer\020\003", 1136);
"\022\017\n\007gpg_ids\030\003 \003(\t\"^\n\tSetOption\022\t\n\005OWNID\020"
"\001\022\n\n\006LISTED\020\002\022\r\n\tCONNECTED\020\003\022\013\n\007FRIENDS\020"
"\004\022\t\n\005VALID\020\005\022\n\n\006SIGNED\020\006\022\007\n\003ALL\020\007\"@\n\nInf"
"oOption\022\014\n\010NAMEONLY\020\001\022\t\n\005BASIC\020\002\022\014\n\010LOCA"
"TION\020\003\022\013\n\007ALLINFO\020\004\"[\n\020ResponsePeerList\022"
"#\n\006status\030\001 \002(\0132\023.rsctrl.core.Status\022\"\n\005"
"peers\030\002 \003(\0132\023.rsctrl.core.Person\"\242\001\n\016Req"
"uestAddPeer\022\016\n\006gpg_id\030\001 \002(\t\0220\n\003cmd\030\002 \002(\016"
"2#.rsctrl.peers.RequestAddPeer.AddCmd\022\014\n"
"\004cert\030\003 \001(\t\"@\n\006AddCmd\022\010\n\004NOOP\020\000\022\007\n\003ADD\020\001"
"\022\n\n\006REMOVE\020\002\022\n\n\006IMPORT\020\003\022\013\n\007EXAMINE\020\004\"Z\n"
"\017ResponseAddPeer\022#\n\006status\030\001 \002(\0132\023.rsctr"
"l.core.Status\022\"\n\005peers\030\002 \003(\0132\023.rsctrl.co"
"re.Person\"\231\001\n\021RequestModifyPeer\0223\n\003cmd\030\001"
" \002(\0162&.rsctrl.peers.RequestModifyPeer.Mo"
"dCmd\022\"\n\005peers\030\002 \003(\0132\023.rsctrl.core.Person"
"\"+\n\006ModCmd\022\010\n\004NOOP\020\000\022\013\n\007ADDRESS\020\001\022\n\n\006DYN"
"DNS\020\002\"]\n\022ResponseModifyPeer\022#\n\006status\030\001 "
"\002(\0132\023.rsctrl.core.Status\022\"\n\005peers\030\002 \003(\0132"
"\023.rsctrl.core.Person*^\n\rRequestMsgIds\022\026\n"
"\022MsgId_RequestPeers\020\001\022\030\n\024MsgId_RequestAd"
"dPeer\020\002\022\033\n\027MsgId_RequestModifyPeer\020\003*e\n\016"
"ResponseMsgIds\022\032\n\026MsgId_ResponsePeerList"
"\020\001\022\031\n\025MsgId_ResponseAddPeer\020\002\022\034\n\030MsgId_R"
"esponseModifyPeer\020\003", 1139);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"peers.proto", &protobuf_RegisterTypes);
RequestPeers::default_instance_ = new RequestPeers();
@ -315,7 +315,7 @@ bool RequestPeers_SetOption_IsValid(int value) {
#ifndef _MSC_VER
const RequestPeers_SetOption RequestPeers::OWNID;
const RequestPeers_SetOption RequestPeers::LISTED;
const RequestPeers_SetOption RequestPeers::ONLINE;
const RequestPeers_SetOption RequestPeers::CONNECTED;
const RequestPeers_SetOption RequestPeers::FRIENDS;
const RequestPeers_SetOption RequestPeers::VALID;
const RequestPeers_SetOption RequestPeers::SIGNED;
@ -667,7 +667,7 @@ ResponsePeerList::ResponsePeerList()
}
void ResponsePeerList::InitAsDefaultInstance() {
status_ = const_cast< ::rsctrl::base::Status*>(&::rsctrl::base::Status::default_instance());
status_ = const_cast< ::rsctrl::core::Status*>(&::rsctrl::core::Status::default_instance());
}
ResponsePeerList::ResponsePeerList(const ResponsePeerList& from)
@ -715,7 +715,7 @@ ResponsePeerList* ResponsePeerList::New() const {
void ResponsePeerList::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_status()) {
if (status_ != NULL) status_->::rsctrl::base::Status::Clear();
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
}
}
peers_.Clear();
@ -729,7 +729,7 @@ bool ResponsePeerList::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
@ -742,7 +742,7 @@ bool ResponsePeerList::MergePartialFromCodedStream(
break;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
@ -775,13 +775,13 @@ bool ResponsePeerList::MergePartialFromCodedStream(
void ResponsePeerList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->status(), output);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->peers(i), output);
@ -795,14 +795,14 @@ void ResponsePeerList::SerializeWithCachedSizes(
::google::protobuf::uint8* ResponsePeerList::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->status(), target);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
@ -820,7 +820,7 @@ int ResponsePeerList::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
@ -828,7 +828,7 @@ int ResponsePeerList::ByteSize() const {
}
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
total_size += 1 * this->peers_size();
for (int i = 0; i < this->peers_size(); i++) {
total_size +=
@ -864,7 +864,7 @@ void ResponsePeerList::MergeFrom(const ResponsePeerList& from) {
peers_.MergeFrom(from.peers_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_status()) {
mutable_status()->::rsctrl::base::Status::MergeFrom(from.status());
mutable_status()->::rsctrl::core::Status::MergeFrom(from.status());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
@ -1281,7 +1281,7 @@ ResponseAddPeer::ResponseAddPeer()
}
void ResponseAddPeer::InitAsDefaultInstance() {
status_ = const_cast< ::rsctrl::base::Status*>(&::rsctrl::base::Status::default_instance());
status_ = const_cast< ::rsctrl::core::Status*>(&::rsctrl::core::Status::default_instance());
}
ResponseAddPeer::ResponseAddPeer(const ResponseAddPeer& from)
@ -1329,7 +1329,7 @@ ResponseAddPeer* ResponseAddPeer::New() const {
void ResponseAddPeer::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_status()) {
if (status_ != NULL) status_->::rsctrl::base::Status::Clear();
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
}
}
peers_.Clear();
@ -1343,7 +1343,7 @@ bool ResponseAddPeer::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
@ -1356,7 +1356,7 @@ bool ResponseAddPeer::MergePartialFromCodedStream(
break;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
@ -1389,13 +1389,13 @@ bool ResponseAddPeer::MergePartialFromCodedStream(
void ResponseAddPeer::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->status(), output);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->peers(i), output);
@ -1409,14 +1409,14 @@ void ResponseAddPeer::SerializeWithCachedSizes(
::google::protobuf::uint8* ResponseAddPeer::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->status(), target);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
@ -1434,7 +1434,7 @@ int ResponseAddPeer::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
@ -1442,7 +1442,7 @@ int ResponseAddPeer::ByteSize() const {
}
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
total_size += 1 * this->peers_size();
for (int i = 0; i < this->peers_size(); i++) {
total_size +=
@ -1478,7 +1478,7 @@ void ResponseAddPeer::MergeFrom(const ResponseAddPeer& from) {
peers_.MergeFrom(from.peers_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_status()) {
mutable_status()->::rsctrl::base::Status::MergeFrom(from.status());
mutable_status()->::rsctrl::core::Status::MergeFrom(from.status());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
@ -1641,7 +1641,7 @@ bool RequestModifyPeer::MergePartialFromCodedStream(
break;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
@ -1680,7 +1680,7 @@ void RequestModifyPeer::SerializeWithCachedSizes(
1, this->cmd(), output);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->peers(i), output);
@ -1700,7 +1700,7 @@ void RequestModifyPeer::SerializeWithCachedSizes(
1, this->cmd(), target);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
@ -1725,7 +1725,7 @@ int RequestModifyPeer::ByteSize() const {
}
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
total_size += 1 * this->peers_size();
for (int i = 0; i < this->peers_size(); i++) {
total_size +=
@ -1820,7 +1820,7 @@ ResponseModifyPeer::ResponseModifyPeer()
}
void ResponseModifyPeer::InitAsDefaultInstance() {
status_ = const_cast< ::rsctrl::base::Status*>(&::rsctrl::base::Status::default_instance());
status_ = const_cast< ::rsctrl::core::Status*>(&::rsctrl::core::Status::default_instance());
}
ResponseModifyPeer::ResponseModifyPeer(const ResponseModifyPeer& from)
@ -1868,7 +1868,7 @@ ResponseModifyPeer* ResponseModifyPeer::New() const {
void ResponseModifyPeer::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_status()) {
if (status_ != NULL) status_->::rsctrl::base::Status::Clear();
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
}
}
peers_.Clear();
@ -1882,7 +1882,7 @@ bool ResponseModifyPeer::MergePartialFromCodedStream(
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
@ -1895,7 +1895,7 @@ bool ResponseModifyPeer::MergePartialFromCodedStream(
break;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
@ -1928,13 +1928,13 @@ bool ResponseModifyPeer::MergePartialFromCodedStream(
void ResponseModifyPeer::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->status(), output);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->peers(i), output);
@ -1948,14 +1948,14 @@ void ResponseModifyPeer::SerializeWithCachedSizes(
::google::protobuf::uint8* ResponseModifyPeer::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->status(), target);
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
for (int i = 0; i < this->peers_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
@ -1973,7 +1973,7 @@ int ResponseModifyPeer::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
if (has_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
@ -1981,7 +1981,7 @@ int ResponseModifyPeer::ByteSize() const {
}
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
total_size += 1 * this->peers_size();
for (int i = 0; i < this->peers_size(); i++) {
total_size +=
@ -2017,7 +2017,7 @@ void ResponseModifyPeer::MergeFrom(const ResponseModifyPeer& from) {
peers_.MergeFrom(from.peers_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_status()) {
mutable_status()->::rsctrl::base::Status::MergeFrom(from.status());
mutable_status()->::rsctrl::core::Status::MergeFrom(from.status());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());

View File

@ -23,7 +23,7 @@
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/generated_message_reflection.h>
#include "base.pb.h"
#include "core.pb.h"
// @@protoc_insertion_point(includes)
namespace rsctrl {
@ -44,7 +44,7 @@ class ResponseModifyPeer;
enum RequestPeers_SetOption {
RequestPeers_SetOption_OWNID = 1,
RequestPeers_SetOption_LISTED = 2,
RequestPeers_SetOption_ONLINE = 3,
RequestPeers_SetOption_CONNECTED = 3,
RequestPeers_SetOption_FRIENDS = 4,
RequestPeers_SetOption_VALID = 5,
RequestPeers_SetOption_SIGNED = 6,
@ -225,7 +225,7 @@ class RequestPeers : public ::google::protobuf::Message {
typedef RequestPeers_SetOption SetOption;
static const SetOption OWNID = RequestPeers_SetOption_OWNID;
static const SetOption LISTED = RequestPeers_SetOption_LISTED;
static const SetOption ONLINE = RequestPeers_SetOption_ONLINE;
static const SetOption CONNECTED = RequestPeers_SetOption_CONNECTED;
static const SetOption FRIENDS = RequestPeers_SetOption_FRIENDS;
static const SetOption VALID = RequestPeers_SetOption_VALID;
static const SetOption SIGNED = RequestPeers_SetOption_SIGNED;
@ -388,24 +388,24 @@ class ResponsePeerList : public ::google::protobuf::Message {
// accessors -------------------------------------------------------
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
inline bool has_status() const;
inline void clear_status();
static const int kStatusFieldNumber = 1;
inline const ::rsctrl::base::Status& status() const;
inline ::rsctrl::base::Status* mutable_status();
inline ::rsctrl::base::Status* release_status();
inline const ::rsctrl::core::Status& status() const;
inline ::rsctrl::core::Status* mutable_status();
inline ::rsctrl::core::Status* release_status();
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int peers_size() const;
inline void clear_peers();
static const int kPeersFieldNumber = 2;
inline const ::rsctrl::base::Person& peers(int index) const;
inline ::rsctrl::base::Person* mutable_peers(int index);
inline ::rsctrl::base::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::rsctrl::core::Person& peers(int index) const;
inline ::rsctrl::core::Person* mutable_peers(int index);
inline ::rsctrl::core::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
peers() const;
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
mutable_peers();
// @@protoc_insertion_point(class_scope:rsctrl.peers.ResponsePeerList)
@ -415,8 +415,8 @@ class ResponsePeerList : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
::rsctrl::base::Status* status_;
::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person > peers_;
::rsctrl::core::Status* status_;
::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person > peers_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
@ -621,24 +621,24 @@ class ResponseAddPeer : public ::google::protobuf::Message {
// accessors -------------------------------------------------------
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
inline bool has_status() const;
inline void clear_status();
static const int kStatusFieldNumber = 1;
inline const ::rsctrl::base::Status& status() const;
inline ::rsctrl::base::Status* mutable_status();
inline ::rsctrl::base::Status* release_status();
inline const ::rsctrl::core::Status& status() const;
inline ::rsctrl::core::Status* mutable_status();
inline ::rsctrl::core::Status* release_status();
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int peers_size() const;
inline void clear_peers();
static const int kPeersFieldNumber = 2;
inline const ::rsctrl::base::Person& peers(int index) const;
inline ::rsctrl::base::Person* mutable_peers(int index);
inline ::rsctrl::base::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::rsctrl::core::Person& peers(int index) const;
inline ::rsctrl::core::Person* mutable_peers(int index);
inline ::rsctrl::core::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
peers() const;
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
mutable_peers();
// @@protoc_insertion_point(class_scope:rsctrl.peers.ResponseAddPeer)
@ -648,8 +648,8 @@ class ResponseAddPeer : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
::rsctrl::base::Status* status_;
::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person > peers_;
::rsctrl::core::Status* status_;
::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person > peers_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
@ -749,16 +749,16 @@ class RequestModifyPeer : public ::google::protobuf::Message {
inline ::rsctrl::peers::RequestModifyPeer_ModCmd cmd() const;
inline void set_cmd(::rsctrl::peers::RequestModifyPeer_ModCmd value);
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int peers_size() const;
inline void clear_peers();
static const int kPeersFieldNumber = 2;
inline const ::rsctrl::base::Person& peers(int index) const;
inline ::rsctrl::base::Person* mutable_peers(int index);
inline ::rsctrl::base::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::rsctrl::core::Person& peers(int index) const;
inline ::rsctrl::core::Person* mutable_peers(int index);
inline ::rsctrl::core::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
peers() const;
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
mutable_peers();
// @@protoc_insertion_point(class_scope:rsctrl.peers.RequestModifyPeer)
@ -768,7 +768,7 @@ class RequestModifyPeer : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person > peers_;
::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person > peers_;
int cmd_;
mutable int _cached_size_;
@ -837,24 +837,24 @@ class ResponseModifyPeer : public ::google::protobuf::Message {
// accessors -------------------------------------------------------
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
inline bool has_status() const;
inline void clear_status();
static const int kStatusFieldNumber = 1;
inline const ::rsctrl::base::Status& status() const;
inline ::rsctrl::base::Status* mutable_status();
inline ::rsctrl::base::Status* release_status();
inline const ::rsctrl::core::Status& status() const;
inline ::rsctrl::core::Status* mutable_status();
inline ::rsctrl::core::Status* release_status();
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int peers_size() const;
inline void clear_peers();
static const int kPeersFieldNumber = 2;
inline const ::rsctrl::base::Person& peers(int index) const;
inline ::rsctrl::base::Person* mutable_peers(int index);
inline ::rsctrl::base::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::rsctrl::core::Person& peers(int index) const;
inline ::rsctrl::core::Person* mutable_peers(int index);
inline ::rsctrl::core::Person* add_peers();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
peers() const;
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
mutable_peers();
// @@protoc_insertion_point(class_scope:rsctrl.peers.ResponseModifyPeer)
@ -864,8 +864,8 @@ class ResponseModifyPeer : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
::rsctrl::base::Status* status_;
::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person > peers_;
::rsctrl::core::Status* status_;
::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person > peers_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
@ -978,7 +978,7 @@ RequestPeers::mutable_gpg_ids() {
// ResponsePeerList
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
inline bool ResponsePeerList::has_status() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
@ -989,45 +989,45 @@ inline void ResponsePeerList::clear_has_status() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ResponsePeerList::clear_status() {
if (status_ != NULL) status_->::rsctrl::base::Status::Clear();
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
clear_has_status();
}
inline const ::rsctrl::base::Status& ResponsePeerList::status() const {
inline const ::rsctrl::core::Status& ResponsePeerList::status() const {
return status_ != NULL ? *status_ : *default_instance_->status_;
}
inline ::rsctrl::base::Status* ResponsePeerList::mutable_status() {
inline ::rsctrl::core::Status* ResponsePeerList::mutable_status() {
set_has_status();
if (status_ == NULL) status_ = new ::rsctrl::base::Status;
if (status_ == NULL) status_ = new ::rsctrl::core::Status;
return status_;
}
inline ::rsctrl::base::Status* ResponsePeerList::release_status() {
inline ::rsctrl::core::Status* ResponsePeerList::release_status() {
clear_has_status();
::rsctrl::base::Status* temp = status_;
::rsctrl::core::Status* temp = status_;
status_ = NULL;
return temp;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int ResponsePeerList::peers_size() const {
return peers_.size();
}
inline void ResponsePeerList::clear_peers() {
peers_.Clear();
}
inline const ::rsctrl::base::Person& ResponsePeerList::peers(int index) const {
inline const ::rsctrl::core::Person& ResponsePeerList::peers(int index) const {
return peers_.Get(index);
}
inline ::rsctrl::base::Person* ResponsePeerList::mutable_peers(int index) {
inline ::rsctrl::core::Person* ResponsePeerList::mutable_peers(int index) {
return peers_.Mutable(index);
}
inline ::rsctrl::base::Person* ResponsePeerList::add_peers() {
inline ::rsctrl::core::Person* ResponsePeerList::add_peers() {
return peers_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
ResponsePeerList::peers() const {
return peers_;
}
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
ResponsePeerList::mutable_peers() {
return &peers_;
}
@ -1179,7 +1179,7 @@ inline ::std::string* RequestAddPeer::release_cert() {
// ResponseAddPeer
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
inline bool ResponseAddPeer::has_status() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
@ -1190,45 +1190,45 @@ inline void ResponseAddPeer::clear_has_status() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ResponseAddPeer::clear_status() {
if (status_ != NULL) status_->::rsctrl::base::Status::Clear();
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
clear_has_status();
}
inline const ::rsctrl::base::Status& ResponseAddPeer::status() const {
inline const ::rsctrl::core::Status& ResponseAddPeer::status() const {
return status_ != NULL ? *status_ : *default_instance_->status_;
}
inline ::rsctrl::base::Status* ResponseAddPeer::mutable_status() {
inline ::rsctrl::core::Status* ResponseAddPeer::mutable_status() {
set_has_status();
if (status_ == NULL) status_ = new ::rsctrl::base::Status;
if (status_ == NULL) status_ = new ::rsctrl::core::Status;
return status_;
}
inline ::rsctrl::base::Status* ResponseAddPeer::release_status() {
inline ::rsctrl::core::Status* ResponseAddPeer::release_status() {
clear_has_status();
::rsctrl::base::Status* temp = status_;
::rsctrl::core::Status* temp = status_;
status_ = NULL;
return temp;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int ResponseAddPeer::peers_size() const {
return peers_.size();
}
inline void ResponseAddPeer::clear_peers() {
peers_.Clear();
}
inline const ::rsctrl::base::Person& ResponseAddPeer::peers(int index) const {
inline const ::rsctrl::core::Person& ResponseAddPeer::peers(int index) const {
return peers_.Get(index);
}
inline ::rsctrl::base::Person* ResponseAddPeer::mutable_peers(int index) {
inline ::rsctrl::core::Person* ResponseAddPeer::mutable_peers(int index) {
return peers_.Mutable(index);
}
inline ::rsctrl::base::Person* ResponseAddPeer::add_peers() {
inline ::rsctrl::core::Person* ResponseAddPeer::add_peers() {
return peers_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
ResponseAddPeer::peers() const {
return peers_;
}
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
ResponseAddPeer::mutable_peers() {
return &peers_;
}
@ -1260,27 +1260,27 @@ inline void RequestModifyPeer::set_cmd(::rsctrl::peers::RequestModifyPeer_ModCmd
cmd_ = value;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int RequestModifyPeer::peers_size() const {
return peers_.size();
}
inline void RequestModifyPeer::clear_peers() {
peers_.Clear();
}
inline const ::rsctrl::base::Person& RequestModifyPeer::peers(int index) const {
inline const ::rsctrl::core::Person& RequestModifyPeer::peers(int index) const {
return peers_.Get(index);
}
inline ::rsctrl::base::Person* RequestModifyPeer::mutable_peers(int index) {
inline ::rsctrl::core::Person* RequestModifyPeer::mutable_peers(int index) {
return peers_.Mutable(index);
}
inline ::rsctrl::base::Person* RequestModifyPeer::add_peers() {
inline ::rsctrl::core::Person* RequestModifyPeer::add_peers() {
return peers_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
RequestModifyPeer::peers() const {
return peers_;
}
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
RequestModifyPeer::mutable_peers() {
return &peers_;
}
@ -1289,7 +1289,7 @@ RequestModifyPeer::mutable_peers() {
// ResponseModifyPeer
// required .rsctrl.base.Status status = 1;
// required .rsctrl.core.Status status = 1;
inline bool ResponseModifyPeer::has_status() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
@ -1300,45 +1300,45 @@ inline void ResponseModifyPeer::clear_has_status() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ResponseModifyPeer::clear_status() {
if (status_ != NULL) status_->::rsctrl::base::Status::Clear();
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
clear_has_status();
}
inline const ::rsctrl::base::Status& ResponseModifyPeer::status() const {
inline const ::rsctrl::core::Status& ResponseModifyPeer::status() const {
return status_ != NULL ? *status_ : *default_instance_->status_;
}
inline ::rsctrl::base::Status* ResponseModifyPeer::mutable_status() {
inline ::rsctrl::core::Status* ResponseModifyPeer::mutable_status() {
set_has_status();
if (status_ == NULL) status_ = new ::rsctrl::base::Status;
if (status_ == NULL) status_ = new ::rsctrl::core::Status;
return status_;
}
inline ::rsctrl::base::Status* ResponseModifyPeer::release_status() {
inline ::rsctrl::core::Status* ResponseModifyPeer::release_status() {
clear_has_status();
::rsctrl::base::Status* temp = status_;
::rsctrl::core::Status* temp = status_;
status_ = NULL;
return temp;
}
// repeated .rsctrl.base.Person peers = 2;
// repeated .rsctrl.core.Person peers = 2;
inline int ResponseModifyPeer::peers_size() const {
return peers_.size();
}
inline void ResponseModifyPeer::clear_peers() {
peers_.Clear();
}
inline const ::rsctrl::base::Person& ResponseModifyPeer::peers(int index) const {
inline const ::rsctrl::core::Person& ResponseModifyPeer::peers(int index) const {
return peers_.Get(index);
}
inline ::rsctrl::base::Person* ResponseModifyPeer::mutable_peers(int index) {
inline ::rsctrl::core::Person* ResponseModifyPeer::mutable_peers(int index) {
return peers_.Mutable(index);
}
inline ::rsctrl::base::Person* ResponseModifyPeer::add_peers() {
inline ::rsctrl::core::Person* ResponseModifyPeer::add_peers() {
return peers_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >&
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >&
ResponseModifyPeer::peers() const {
return peers_;
}
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Person >*
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::core::Person >*
ResponseModifyPeer::mutable_peers() {
return &peers_;
}

View File

@ -0,0 +1,753 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "system.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace rsctrl {
namespace system {
namespace {
const ::google::protobuf::Descriptor* RequestSystemStatus_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RequestSystemStatus_reflection_ = NULL;
const ::google::protobuf::Descriptor* ResponseSystemStatus_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ResponseSystemStatus_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* ResponseSystemStatus_NetCode_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor_ = NULL;
} // namespace
void protobuf_AssignDesc_system_2eproto() {
protobuf_AddDesc_system_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"system.proto");
GOOGLE_CHECK(file != NULL);
RequestSystemStatus_descriptor_ = file->message_type(0);
static const int RequestSystemStatus_offsets_[1] = {
};
RequestSystemStatus_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
RequestSystemStatus_descriptor_,
RequestSystemStatus::default_instance_,
RequestSystemStatus_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemStatus, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemStatus, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(RequestSystemStatus));
ResponseSystemStatus_descriptor_ = file->message_type(1);
static const int ResponseSystemStatus_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemStatus, status_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemStatus, no_peers_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemStatus, no_connected_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemStatus, net_status_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemStatus, bw_total_),
};
ResponseSystemStatus_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ResponseSystemStatus_descriptor_,
ResponseSystemStatus::default_instance_,
ResponseSystemStatus_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemStatus, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemStatus, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ResponseSystemStatus));
ResponseSystemStatus_NetCode_descriptor_ = ResponseSystemStatus_descriptor_->enum_type(0);
RequestMsgIds_descriptor_ = file->enum_type(0);
ResponseMsgIds_descriptor_ = file->enum_type(1);
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_system_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RequestSystemStatus_descriptor_, &RequestSystemStatus::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ResponseSystemStatus_descriptor_, &ResponseSystemStatus::default_instance());
}
} // namespace
void protobuf_ShutdownFile_system_2eproto() {
delete RequestSystemStatus::default_instance_;
delete RequestSystemStatus_reflection_;
delete ResponseSystemStatus::default_instance_;
delete ResponseSystemStatus_reflection_;
}
void protobuf_AddDesc_system_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::rsctrl::core::protobuf_AddDesc_core_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\014system.proto\022\rrsctrl.system\032\ncore.prot"
"o\"\025\n\023RequestSystemStatus\"\366\002\n\024ResponseSys"
"temStatus\022#\n\006status\030\001 \002(\0132\023.rsctrl.core."
"Status\022\020\n\010no_peers\030\002 \002(\r\022\024\n\014no_connected"
"\030\003 \002(\r\022\?\n\nnet_status\030\004 \002(\0162+.rsctrl.syst"
"em.ResponseSystemStatus.NetCode\022(\n\010bw_to"
"tal\030\005 \002(\0132\026.rsctrl.core.Bandwidth\"\245\001\n\007Ne"
"tCode\022\017\n\013BAD_UNKNOWN\020\000\022\017\n\013BAD_OFFLINE\020\001\022"
"\016\n\nBAD_NATSYM\020\002\022\021\n\rBAD_NODHT_NAT\020\003\022\023\n\017WA"
"RNING_RESTART\020\004\022\022\n\016WARNING_NATTED\020\005\022\021\n\rW"
"ARNING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FORWARD\020"
"\010*.\n\rRequestMsgIds\022\035\n\031MsgId_RequestSyste"
"mStatus\020\001*0\n\016ResponseMsgIds\022\036\n\032MsgId_Res"
"ponseSystemStatus\020\001", 539);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"system.proto", &protobuf_RegisterTypes);
RequestSystemStatus::default_instance_ = new RequestSystemStatus();
ResponseSystemStatus::default_instance_ = new ResponseSystemStatus();
RequestSystemStatus::default_instance_->InitAsDefaultInstance();
ResponseSystemStatus::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_system_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_system_2eproto {
StaticDescriptorInitializer_system_2eproto() {
protobuf_AddDesc_system_2eproto();
}
} static_descriptor_initializer_system_2eproto_;
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor() {
protobuf_AssignDescriptorsOnce();
return RequestMsgIds_descriptor_;
}
bool RequestMsgIds_IsValid(int value) {
switch(value) {
case 1:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor() {
protobuf_AssignDescriptorsOnce();
return ResponseMsgIds_descriptor_;
}
bool ResponseMsgIds_IsValid(int value) {
switch(value) {
case 1:
return true;
default:
return false;
}
}
// ===================================================================
#ifndef _MSC_VER
#endif // !_MSC_VER
RequestSystemStatus::RequestSystemStatus()
: ::google::protobuf::Message() {
SharedCtor();
}
void RequestSystemStatus::InitAsDefaultInstance() {
}
RequestSystemStatus::RequestSystemStatus(const RequestSystemStatus& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void RequestSystemStatus::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
RequestSystemStatus::~RequestSystemStatus() {
SharedDtor();
}
void RequestSystemStatus::SharedDtor() {
if (this != default_instance_) {
}
}
void RequestSystemStatus::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RequestSystemStatus::descriptor() {
protobuf_AssignDescriptorsOnce();
return RequestSystemStatus_descriptor_;
}
const RequestSystemStatus& RequestSystemStatus::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_system_2eproto(); return *default_instance_;
}
RequestSystemStatus* RequestSystemStatus::default_instance_ = NULL;
RequestSystemStatus* RequestSystemStatus::New() const {
return new RequestSystemStatus;
}
void RequestSystemStatus::Clear() {
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool RequestSystemStatus::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
}
return true;
#undef DO_
}
void RequestSystemStatus::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* RequestSystemStatus::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int RequestSystemStatus::ByteSize() const {
int total_size = 0;
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RequestSystemStatus::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const RequestSystemStatus* source =
::google::protobuf::internal::dynamic_cast_if_available<const RequestSystemStatus*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void RequestSystemStatus::MergeFrom(const RequestSystemStatus& from) {
GOOGLE_CHECK_NE(&from, this);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void RequestSystemStatus::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RequestSystemStatus::CopyFrom(const RequestSystemStatus& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RequestSystemStatus::IsInitialized() const {
return true;
}
void RequestSystemStatus::Swap(RequestSystemStatus* other) {
if (other != this) {
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata RequestSystemStatus::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RequestSystemStatus_descriptor_;
metadata.reflection = RequestSystemStatus_reflection_;
return metadata;
}
// ===================================================================
const ::google::protobuf::EnumDescriptor* ResponseSystemStatus_NetCode_descriptor() {
protobuf_AssignDescriptorsOnce();
return ResponseSystemStatus_NetCode_descriptor_;
}
bool ResponseSystemStatus_NetCode_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
return true;
default:
return false;
}
}
#ifndef _MSC_VER
const ResponseSystemStatus_NetCode ResponseSystemStatus::BAD_UNKNOWN;
const ResponseSystemStatus_NetCode ResponseSystemStatus::BAD_OFFLINE;
const ResponseSystemStatus_NetCode ResponseSystemStatus::BAD_NATSYM;
const ResponseSystemStatus_NetCode ResponseSystemStatus::BAD_NODHT_NAT;
const ResponseSystemStatus_NetCode ResponseSystemStatus::WARNING_RESTART;
const ResponseSystemStatus_NetCode ResponseSystemStatus::WARNING_NATTED;
const ResponseSystemStatus_NetCode ResponseSystemStatus::WARNING_NODHT;
const ResponseSystemStatus_NetCode ResponseSystemStatus::GOOD;
const ResponseSystemStatus_NetCode ResponseSystemStatus::ADV_FORWARD;
const ResponseSystemStatus_NetCode ResponseSystemStatus::NetCode_MIN;
const ResponseSystemStatus_NetCode ResponseSystemStatus::NetCode_MAX;
const int ResponseSystemStatus::NetCode_ARRAYSIZE;
#endif // _MSC_VER
#ifndef _MSC_VER
const int ResponseSystemStatus::kStatusFieldNumber;
const int ResponseSystemStatus::kNoPeersFieldNumber;
const int ResponseSystemStatus::kNoConnectedFieldNumber;
const int ResponseSystemStatus::kNetStatusFieldNumber;
const int ResponseSystemStatus::kBwTotalFieldNumber;
#endif // !_MSC_VER
ResponseSystemStatus::ResponseSystemStatus()
: ::google::protobuf::Message() {
SharedCtor();
}
void ResponseSystemStatus::InitAsDefaultInstance() {
status_ = const_cast< ::rsctrl::core::Status*>(&::rsctrl::core::Status::default_instance());
bw_total_ = const_cast< ::rsctrl::core::Bandwidth*>(&::rsctrl::core::Bandwidth::default_instance());
}
ResponseSystemStatus::ResponseSystemStatus(const ResponseSystemStatus& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ResponseSystemStatus::SharedCtor() {
_cached_size_ = 0;
status_ = NULL;
no_peers_ = 0u;
no_connected_ = 0u;
net_status_ = 0;
bw_total_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ResponseSystemStatus::~ResponseSystemStatus() {
SharedDtor();
}
void ResponseSystemStatus::SharedDtor() {
if (this != default_instance_) {
delete status_;
delete bw_total_;
}
}
void ResponseSystemStatus::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ResponseSystemStatus::descriptor() {
protobuf_AssignDescriptorsOnce();
return ResponseSystemStatus_descriptor_;
}
const ResponseSystemStatus& ResponseSystemStatus::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_system_2eproto(); return *default_instance_;
}
ResponseSystemStatus* ResponseSystemStatus::default_instance_ = NULL;
ResponseSystemStatus* ResponseSystemStatus::New() const {
return new ResponseSystemStatus;
}
void ResponseSystemStatus::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_status()) {
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
}
no_peers_ = 0u;
no_connected_ = 0u;
net_status_ = 0;
if (has_bw_total()) {
if (bw_total_ != NULL) bw_total_->::rsctrl::core::Bandwidth::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ResponseSystemStatus::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .rsctrl.core.Status status = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_status()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(16)) goto parse_no_peers;
break;
}
// required uint32 no_peers = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_no_peers:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &no_peers_)));
set_has_no_peers();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(24)) goto parse_no_connected;
break;
}
// required uint32 no_connected = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_no_connected:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &no_connected_)));
set_has_no_connected();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(32)) goto parse_net_status;
break;
}
// required .rsctrl.system.ResponseSystemStatus.NetCode net_status = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_net_status:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::rsctrl::system::ResponseSystemStatus_NetCode_IsValid(value)) {
set_net_status(static_cast< ::rsctrl::system::ResponseSystemStatus_NetCode >(value));
} else {
mutable_unknown_fields()->AddVarint(4, value);
}
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(42)) goto parse_bw_total;
break;
}
// required .rsctrl.core.Bandwidth bw_total = 5;
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_bw_total:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_bw_total()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ResponseSystemStatus::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .rsctrl.core.Status status = 1;
if (has_status()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->status(), output);
}
// required uint32 no_peers = 2;
if (has_no_peers()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->no_peers(), output);
}
// required uint32 no_connected = 3;
if (has_no_connected()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->no_connected(), output);
}
// required .rsctrl.system.ResponseSystemStatus.NetCode net_status = 4;
if (has_net_status()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
4, this->net_status(), output);
}
// required .rsctrl.core.Bandwidth bw_total = 5;
if (has_bw_total()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->bw_total(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ResponseSystemStatus::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .rsctrl.core.Status status = 1;
if (has_status()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->status(), target);
}
// required uint32 no_peers = 2;
if (has_no_peers()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->no_peers(), target);
}
// required uint32 no_connected = 3;
if (has_no_connected()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->no_connected(), target);
}
// required .rsctrl.system.ResponseSystemStatus.NetCode net_status = 4;
if (has_net_status()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
4, this->net_status(), target);
}
// required .rsctrl.core.Bandwidth bw_total = 5;
if (has_bw_total()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->bw_total(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ResponseSystemStatus::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .rsctrl.core.Status status = 1;
if (has_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->status());
}
// required uint32 no_peers = 2;
if (has_no_peers()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->no_peers());
}
// required uint32 no_connected = 3;
if (has_no_connected()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->no_connected());
}
// required .rsctrl.system.ResponseSystemStatus.NetCode net_status = 4;
if (has_net_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->net_status());
}
// required .rsctrl.core.Bandwidth bw_total = 5;
if (has_bw_total()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->bw_total());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ResponseSystemStatus::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ResponseSystemStatus* source =
::google::protobuf::internal::dynamic_cast_if_available<const ResponseSystemStatus*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ResponseSystemStatus::MergeFrom(const ResponseSystemStatus& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_status()) {
mutable_status()->::rsctrl::core::Status::MergeFrom(from.status());
}
if (from.has_no_peers()) {
set_no_peers(from.no_peers());
}
if (from.has_no_connected()) {
set_no_connected(from.no_connected());
}
if (from.has_net_status()) {
set_net_status(from.net_status());
}
if (from.has_bw_total()) {
mutable_bw_total()->::rsctrl::core::Bandwidth::MergeFrom(from.bw_total());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ResponseSystemStatus::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ResponseSystemStatus::CopyFrom(const ResponseSystemStatus& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ResponseSystemStatus::IsInitialized() const {
if ((_has_bits_[0] & 0x0000001f) != 0x0000001f) return false;
if (has_status()) {
if (!this->status().IsInitialized()) return false;
}
if (has_bw_total()) {
if (!this->bw_total().IsInitialized()) return false;
}
return true;
}
void ResponseSystemStatus::Swap(ResponseSystemStatus* other) {
if (other != this) {
std::swap(status_, other->status_);
std::swap(no_peers_, other->no_peers_);
std::swap(no_connected_, other->no_connected_);
std::swap(net_status_, other->net_status_);
std::swap(bw_total_, other->bw_total_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ResponseSystemStatus::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ResponseSystemStatus_descriptor_;
metadata.reflection = ResponseSystemStatus_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace system
} // namespace rsctrl
// @@protoc_insertion_point(global_scope)

View File

@ -0,0 +1,494 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: system.proto
#ifndef PROTOBUF_system_2eproto__INCLUDED
#define PROTOBUF_system_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 2004001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/generated_message_reflection.h>
#include "core.pb.h"
// @@protoc_insertion_point(includes)
namespace rsctrl {
namespace system {
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_system_2eproto();
void protobuf_AssignDesc_system_2eproto();
void protobuf_ShutdownFile_system_2eproto();
class RequestSystemStatus;
class ResponseSystemStatus;
enum ResponseSystemStatus_NetCode {
ResponseSystemStatus_NetCode_BAD_UNKNOWN = 0,
ResponseSystemStatus_NetCode_BAD_OFFLINE = 1,
ResponseSystemStatus_NetCode_BAD_NATSYM = 2,
ResponseSystemStatus_NetCode_BAD_NODHT_NAT = 3,
ResponseSystemStatus_NetCode_WARNING_RESTART = 4,
ResponseSystemStatus_NetCode_WARNING_NATTED = 5,
ResponseSystemStatus_NetCode_WARNING_NODHT = 6,
ResponseSystemStatus_NetCode_GOOD = 7,
ResponseSystemStatus_NetCode_ADV_FORWARD = 8
};
bool ResponseSystemStatus_NetCode_IsValid(int value);
const ResponseSystemStatus_NetCode ResponseSystemStatus_NetCode_NetCode_MIN = ResponseSystemStatus_NetCode_BAD_UNKNOWN;
const ResponseSystemStatus_NetCode ResponseSystemStatus_NetCode_NetCode_MAX = ResponseSystemStatus_NetCode_ADV_FORWARD;
const int ResponseSystemStatus_NetCode_NetCode_ARRAYSIZE = ResponseSystemStatus_NetCode_NetCode_MAX + 1;
const ::google::protobuf::EnumDescriptor* ResponseSystemStatus_NetCode_descriptor();
inline const ::std::string& ResponseSystemStatus_NetCode_Name(ResponseSystemStatus_NetCode value) {
return ::google::protobuf::internal::NameOfEnum(
ResponseSystemStatus_NetCode_descriptor(), value);
}
inline bool ResponseSystemStatus_NetCode_Parse(
const ::std::string& name, ResponseSystemStatus_NetCode* value) {
return ::google::protobuf::internal::ParseNamedEnum<ResponseSystemStatus_NetCode>(
ResponseSystemStatus_NetCode_descriptor(), name, value);
}
enum RequestMsgIds {
MsgId_RequestSystemStatus = 1
};
bool RequestMsgIds_IsValid(int value);
const RequestMsgIds RequestMsgIds_MIN = MsgId_RequestSystemStatus;
const RequestMsgIds RequestMsgIds_MAX = MsgId_RequestSystemStatus;
const int RequestMsgIds_ARRAYSIZE = RequestMsgIds_MAX + 1;
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor();
inline const ::std::string& RequestMsgIds_Name(RequestMsgIds value) {
return ::google::protobuf::internal::NameOfEnum(
RequestMsgIds_descriptor(), value);
}
inline bool RequestMsgIds_Parse(
const ::std::string& name, RequestMsgIds* value) {
return ::google::protobuf::internal::ParseNamedEnum<RequestMsgIds>(
RequestMsgIds_descriptor(), name, value);
}
enum ResponseMsgIds {
MsgId_ResponseSystemStatus = 1
};
bool ResponseMsgIds_IsValid(int value);
const ResponseMsgIds ResponseMsgIds_MIN = MsgId_ResponseSystemStatus;
const ResponseMsgIds ResponseMsgIds_MAX = MsgId_ResponseSystemStatus;
const int ResponseMsgIds_ARRAYSIZE = ResponseMsgIds_MAX + 1;
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor();
inline const ::std::string& ResponseMsgIds_Name(ResponseMsgIds value) {
return ::google::protobuf::internal::NameOfEnum(
ResponseMsgIds_descriptor(), value);
}
inline bool ResponseMsgIds_Parse(
const ::std::string& name, ResponseMsgIds* value) {
return ::google::protobuf::internal::ParseNamedEnum<ResponseMsgIds>(
ResponseMsgIds_descriptor(), name, value);
}
// ===================================================================
class RequestSystemStatus : public ::google::protobuf::Message {
public:
RequestSystemStatus();
virtual ~RequestSystemStatus();
RequestSystemStatus(const RequestSystemStatus& from);
inline RequestSystemStatus& operator=(const RequestSystemStatus& from) {
CopyFrom(from);
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
return _unknown_fields_;
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
return &_unknown_fields_;
}
static const ::google::protobuf::Descriptor* descriptor();
static const RequestSystemStatus& default_instance();
void Swap(RequestSystemStatus* other);
// implements Message ----------------------------------------------
RequestSystemStatus* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const RequestSystemStatus& from);
void MergeFrom(const RequestSystemStatus& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// @@protoc_insertion_point(class_scope:rsctrl.system.RequestSystemStatus)
private:
::google::protobuf::UnknownFieldSet _unknown_fields_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[1];
friend void protobuf_AddDesc_system_2eproto();
friend void protobuf_AssignDesc_system_2eproto();
friend void protobuf_ShutdownFile_system_2eproto();
void InitAsDefaultInstance();
static RequestSystemStatus* default_instance_;
};
// -------------------------------------------------------------------
class ResponseSystemStatus : public ::google::protobuf::Message {
public:
ResponseSystemStatus();
virtual ~ResponseSystemStatus();
ResponseSystemStatus(const ResponseSystemStatus& from);
inline ResponseSystemStatus& operator=(const ResponseSystemStatus& from) {
CopyFrom(from);
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
return _unknown_fields_;
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
return &_unknown_fields_;
}
static const ::google::protobuf::Descriptor* descriptor();
static const ResponseSystemStatus& default_instance();
void Swap(ResponseSystemStatus* other);
// implements Message ----------------------------------------------
ResponseSystemStatus* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const ResponseSystemStatus& from);
void MergeFrom(const ResponseSystemStatus& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
typedef ResponseSystemStatus_NetCode NetCode;
static const NetCode BAD_UNKNOWN = ResponseSystemStatus_NetCode_BAD_UNKNOWN;
static const NetCode BAD_OFFLINE = ResponseSystemStatus_NetCode_BAD_OFFLINE;
static const NetCode BAD_NATSYM = ResponseSystemStatus_NetCode_BAD_NATSYM;
static const NetCode BAD_NODHT_NAT = ResponseSystemStatus_NetCode_BAD_NODHT_NAT;
static const NetCode WARNING_RESTART = ResponseSystemStatus_NetCode_WARNING_RESTART;
static const NetCode WARNING_NATTED = ResponseSystemStatus_NetCode_WARNING_NATTED;
static const NetCode WARNING_NODHT = ResponseSystemStatus_NetCode_WARNING_NODHT;
static const NetCode GOOD = ResponseSystemStatus_NetCode_GOOD;
static const NetCode ADV_FORWARD = ResponseSystemStatus_NetCode_ADV_FORWARD;
static inline bool NetCode_IsValid(int value) {
return ResponseSystemStatus_NetCode_IsValid(value);
}
static const NetCode NetCode_MIN =
ResponseSystemStatus_NetCode_NetCode_MIN;
static const NetCode NetCode_MAX =
ResponseSystemStatus_NetCode_NetCode_MAX;
static const int NetCode_ARRAYSIZE =
ResponseSystemStatus_NetCode_NetCode_ARRAYSIZE;
static inline const ::google::protobuf::EnumDescriptor*
NetCode_descriptor() {
return ResponseSystemStatus_NetCode_descriptor();
}
static inline const ::std::string& NetCode_Name(NetCode value) {
return ResponseSystemStatus_NetCode_Name(value);
}
static inline bool NetCode_Parse(const ::std::string& name,
NetCode* value) {
return ResponseSystemStatus_NetCode_Parse(name, value);
}
// accessors -------------------------------------------------------
// required .rsctrl.core.Status status = 1;
inline bool has_status() const;
inline void clear_status();
static const int kStatusFieldNumber = 1;
inline const ::rsctrl::core::Status& status() const;
inline ::rsctrl::core::Status* mutable_status();
inline ::rsctrl::core::Status* release_status();
// required uint32 no_peers = 2;
inline bool has_no_peers() const;
inline void clear_no_peers();
static const int kNoPeersFieldNumber = 2;
inline ::google::protobuf::uint32 no_peers() const;
inline void set_no_peers(::google::protobuf::uint32 value);
// required uint32 no_connected = 3;
inline bool has_no_connected() const;
inline void clear_no_connected();
static const int kNoConnectedFieldNumber = 3;
inline ::google::protobuf::uint32 no_connected() const;
inline void set_no_connected(::google::protobuf::uint32 value);
// required .rsctrl.system.ResponseSystemStatus.NetCode net_status = 4;
inline bool has_net_status() const;
inline void clear_net_status();
static const int kNetStatusFieldNumber = 4;
inline ::rsctrl::system::ResponseSystemStatus_NetCode net_status() const;
inline void set_net_status(::rsctrl::system::ResponseSystemStatus_NetCode value);
// required .rsctrl.core.Bandwidth bw_total = 5;
inline bool has_bw_total() const;
inline void clear_bw_total();
static const int kBwTotalFieldNumber = 5;
inline const ::rsctrl::core::Bandwidth& bw_total() const;
inline ::rsctrl::core::Bandwidth* mutable_bw_total();
inline ::rsctrl::core::Bandwidth* release_bw_total();
// @@protoc_insertion_point(class_scope:rsctrl.system.ResponseSystemStatus)
private:
inline void set_has_status();
inline void clear_has_status();
inline void set_has_no_peers();
inline void clear_has_no_peers();
inline void set_has_no_connected();
inline void clear_has_no_connected();
inline void set_has_net_status();
inline void clear_has_net_status();
inline void set_has_bw_total();
inline void clear_has_bw_total();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::rsctrl::core::Status* status_;
::google::protobuf::uint32 no_peers_;
::google::protobuf::uint32 no_connected_;
::rsctrl::core::Bandwidth* bw_total_;
int net_status_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
friend void protobuf_AddDesc_system_2eproto();
friend void protobuf_AssignDesc_system_2eproto();
friend void protobuf_ShutdownFile_system_2eproto();
void InitAsDefaultInstance();
static ResponseSystemStatus* default_instance_;
};
// ===================================================================
// ===================================================================
// RequestSystemStatus
// -------------------------------------------------------------------
// ResponseSystemStatus
// required .rsctrl.core.Status status = 1;
inline bool ResponseSystemStatus::has_status() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void ResponseSystemStatus::set_has_status() {
_has_bits_[0] |= 0x00000001u;
}
inline void ResponseSystemStatus::clear_has_status() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ResponseSystemStatus::clear_status() {
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
clear_has_status();
}
inline const ::rsctrl::core::Status& ResponseSystemStatus::status() const {
return status_ != NULL ? *status_ : *default_instance_->status_;
}
inline ::rsctrl::core::Status* ResponseSystemStatus::mutable_status() {
set_has_status();
if (status_ == NULL) status_ = new ::rsctrl::core::Status;
return status_;
}
inline ::rsctrl::core::Status* ResponseSystemStatus::release_status() {
clear_has_status();
::rsctrl::core::Status* temp = status_;
status_ = NULL;
return temp;
}
// required uint32 no_peers = 2;
inline bool ResponseSystemStatus::has_no_peers() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void ResponseSystemStatus::set_has_no_peers() {
_has_bits_[0] |= 0x00000002u;
}
inline void ResponseSystemStatus::clear_has_no_peers() {
_has_bits_[0] &= ~0x00000002u;
}
inline void ResponseSystemStatus::clear_no_peers() {
no_peers_ = 0u;
clear_has_no_peers();
}
inline ::google::protobuf::uint32 ResponseSystemStatus::no_peers() const {
return no_peers_;
}
inline void ResponseSystemStatus::set_no_peers(::google::protobuf::uint32 value) {
set_has_no_peers();
no_peers_ = value;
}
// required uint32 no_connected = 3;
inline bool ResponseSystemStatus::has_no_connected() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void ResponseSystemStatus::set_has_no_connected() {
_has_bits_[0] |= 0x00000004u;
}
inline void ResponseSystemStatus::clear_has_no_connected() {
_has_bits_[0] &= ~0x00000004u;
}
inline void ResponseSystemStatus::clear_no_connected() {
no_connected_ = 0u;
clear_has_no_connected();
}
inline ::google::protobuf::uint32 ResponseSystemStatus::no_connected() const {
return no_connected_;
}
inline void ResponseSystemStatus::set_no_connected(::google::protobuf::uint32 value) {
set_has_no_connected();
no_connected_ = value;
}
// required .rsctrl.system.ResponseSystemStatus.NetCode net_status = 4;
inline bool ResponseSystemStatus::has_net_status() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
inline void ResponseSystemStatus::set_has_net_status() {
_has_bits_[0] |= 0x00000008u;
}
inline void ResponseSystemStatus::clear_has_net_status() {
_has_bits_[0] &= ~0x00000008u;
}
inline void ResponseSystemStatus::clear_net_status() {
net_status_ = 0;
clear_has_net_status();
}
inline ::rsctrl::system::ResponseSystemStatus_NetCode ResponseSystemStatus::net_status() const {
return static_cast< ::rsctrl::system::ResponseSystemStatus_NetCode >(net_status_);
}
inline void ResponseSystemStatus::set_net_status(::rsctrl::system::ResponseSystemStatus_NetCode value) {
GOOGLE_DCHECK(::rsctrl::system::ResponseSystemStatus_NetCode_IsValid(value));
set_has_net_status();
net_status_ = value;
}
// required .rsctrl.core.Bandwidth bw_total = 5;
inline bool ResponseSystemStatus::has_bw_total() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
inline void ResponseSystemStatus::set_has_bw_total() {
_has_bits_[0] |= 0x00000010u;
}
inline void ResponseSystemStatus::clear_has_bw_total() {
_has_bits_[0] &= ~0x00000010u;
}
inline void ResponseSystemStatus::clear_bw_total() {
if (bw_total_ != NULL) bw_total_->::rsctrl::core::Bandwidth::Clear();
clear_has_bw_total();
}
inline const ::rsctrl::core::Bandwidth& ResponseSystemStatus::bw_total() const {
return bw_total_ != NULL ? *bw_total_ : *default_instance_->bw_total_;
}
inline ::rsctrl::core::Bandwidth* ResponseSystemStatus::mutable_bw_total() {
set_has_bw_total();
if (bw_total_ == NULL) bw_total_ = new ::rsctrl::core::Bandwidth;
return bw_total_;
}
inline ::rsctrl::core::Bandwidth* ResponseSystemStatus::release_bw_total() {
clear_has_bw_total();
::rsctrl::core::Bandwidth* temp = bw_total_;
bw_total_ = NULL;
return temp;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace system
} // namespace rsctrl
#ifndef SWIG
namespace google {
namespace protobuf {
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::rsctrl::system::ResponseSystemStatus_NetCode>() {
return ::rsctrl::system::ResponseSystemStatus_NetCode_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::system::RequestMsgIds>() {
return rsctrl::system::RequestMsgIds_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::system::ResponseMsgIds>() {
return rsctrl::system::ResponseMsgIds_descriptor();
}
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_system_2eproto__INCLUDED

View File

@ -25,6 +25,8 @@
#include "rpc/proto/gencc/peers.pb.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <iostream>
#include <algorithm>
@ -45,8 +47,8 @@ int RpcProtoPeers::processMsg(uint32_t msg_id, uint32_t req_id, const std::strin
bool isResponse = isRpcMsgIdResponse(msg_id);
std::cerr << "RpcProtoPeers::processMsg() topbyte: " << topbyte;
std::cerr << " service: " << service << " submsg: " << submsg;
std::cerr << "RpcProtoPeers::processMsg() topbyte: " << (int32_t) topbyte;
std::cerr << " service: " << (int32_t) service << " submsg: " << (int32_t) submsg;
std::cerr << std::endl;
if (isResponse)
@ -57,14 +59,14 @@ int RpcProtoPeers::processMsg(uint32_t msg_id, uint32_t req_id, const std::strin
}
if (topbyte != (uint8_t) rsctrl::base::BASE)
if (topbyte != (uint8_t) rsctrl::core::CORE)
{
std::cerr << "RpcProtoPeers::processMsg() Extension Mismatch - not processing";
std::cerr << std::endl;
return 0;
}
if (service != (uint16_t) rsctrl::base::PEERS)
if (service != (uint16_t) rsctrl::core::PEERS)
{
std::cerr << "RpcProtoPeers::processMsg() Service Mismatch - not processing";
std::cerr << std::endl;
@ -105,18 +107,81 @@ int RpcProtoPeers::processAddPeer(uint32_t msg_id, uint32_t req_id, const std::s
std::cerr << "RpcProtoPeers::processAddPeer() NOT FINISHED";
std::cerr << std::endl;
// response.
rsctrl::peers::ResponseAddPeer resp;
bool success = false;
if (success)
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::SUCCESS);
}
else
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::NO_IMPL_YET);
}
std::string outmsg;
if (!resp.SerializeToString(&outmsg))
{
std::cerr << "RpcProtoPeers::processAddPeer() ERROR SerialiseToString()";
std::cerr << std::endl;
return 0;
}
// Correctly Name Message.
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::PEERS,
rsctrl::peers::MsgId_ResponseAddPeer, true);
// queue it.
queueResponse(out_msg_id, req_id, outmsg);
return 1;
}
int RpcProtoPeers::processModifyPeer(uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
std::cerr << "RpcProtoPeers::processModifyPeer() NOT FINISHED";
std::cerr << std::endl;
// response.
rsctrl::peers::ResponseModifyPeer resp;
bool success = false;
if (success)
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::SUCCESS);
}
else
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::NO_IMPL_YET);
}
std::string outmsg;
if (!resp.SerializeToString(&outmsg))
{
std::cerr << "RpcProtoPeers::processModifyPeer() ERROR SerialiseToString()";
std::cerr << std::endl;
return 0;
}
// Correctly Name Message.
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::PEERS,
rsctrl::peers::MsgId_ResponseModifyPeer, true);
// queue it.
queueResponse(out_msg_id, req_id, outmsg);
return 1;
}
int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const std::string &msg)
@ -135,17 +200,22 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
// Get the list of gpg_id to generate data for.
std::list<std::string> ids;
bool onlyOnline = false;
bool onlyConnected = false;
bool success = true;
switch(reqp.set())
{
case rsctrl::peers::RequestPeers::OWNID:
{
std::cerr << "RpcProtoPeers::processRequestPeers() OWNID";
std::cerr << std::endl;
std::string own_id = rsPeers->getGPGOwnId();
ids.push_back(own_id);
break;
}
case rsctrl::peers::RequestPeers::LISTED:
{
std::cerr << "RpcProtoPeers::processRequestPeers() LISTED";
std::cerr << std::endl;
/* extract ids from request (TODO) */
std::string own_id = rsPeers->getGPGOwnId();
ids.push_back(own_id);
@ -153,12 +223,16 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
}
case rsctrl::peers::RequestPeers::ALL:
std::cerr << "RpcProtoPeers::processRequestPeers() ALL";
std::cerr << std::endl;
rsPeers->getGPGAllList(ids);
break;
case rsctrl::peers::RequestPeers::ONLINE:
case rsctrl::peers::RequestPeers::CONNECTED:
{
std::cerr << "RpcProtoPeers::processRequestPeers() CONNECTED";
std::cerr << std::endl;
/* this ones a bit hard too */
onlyOnline = true;
onlyConnected = true;
std::list<std::string> ssl_ids;
std::list<std::string>::const_iterator sit;
rsPeers->getOnlineList(ssl_ids);
@ -176,12 +250,18 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
break;
}
case rsctrl::peers::RequestPeers::FRIENDS:
std::cerr << "RpcProtoPeers::processRequestPeers() FRIENDS";
std::cerr << std::endl;
rsPeers->getGPGAcceptedList(ids);
break;
case rsctrl::peers::RequestPeers::SIGNED:
std::cerr << "RpcProtoPeers::processRequestPeers() SIGNED";
std::cerr << std::endl;
rsPeers->getGPGSignedList(ids);
break;
case rsctrl::peers::RequestPeers::VALID:
std::cerr << "RpcProtoPeers::processRequestPeers() VALID";
std::cerr << std::endl;
rsPeers->getGPGSignedList(ids);
break;
}
@ -215,13 +295,41 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
continue; /* uhm.. */
}
rsctrl::base::Person *person = respp.add_peers();
rsctrl::core::Person *person = respp.add_peers();
/* fill in key gpg details */
person->set_gpg_id(*git);
person->set_name(details.name);
std::cerr << "RpcProtoPeers::processRequestPeers() Adding GPGID: ";
std::cerr << *git << " name: " << details.name;
std::cerr << std::endl;
if (details.state & RS_PEER_STATE_FRIEND)
{
person->set_relation(rsctrl::core::Person::FRIEND);
}
else
{
std::list<std::string> common_friends;
rsDisc->getDiscGPGFriends(*git, common_friends);
int size = common_friends.size();
if (size)
{
if (size > 2)
{
person->set_relation(rsctrl::core::Person::FRIEND_OF_MANY_FRIENDS);
}
else
{
person->set_relation(rsctrl::core::Person::FRIEND_OF_FRIENDS);
}
}
else
{
person->set_relation(rsctrl::core::Person::UNKNOWN);
}
}
if (getLocations)
{
@ -240,14 +348,66 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
{
continue; /* uhm.. */
}
if ((onlyConnected) &&
(!(ssldetails.state & RS_PEER_STATE_CONNECTED)))
{
continue;
}
rsctrl::base::Location *loc = person->add_locations();
rsctrl::core::Location *loc = person->add_locations();
std::cerr << "RpcProtoPeers::processRequestPeers() \t Adding Location: ";
std::cerr << *sit << " loc: " << ssldetails.location;
std::cerr << std::endl;
/* fill in ssl details */
loc->set_ssl_id(*sit);
loc->set_location(ssldetails.location);
/* set addresses */
rsctrl::core::IpAddr *laddr = loc->mutable_localaddr();
laddr->set_addr(ssldetails.localAddr);
laddr->set_port(ssldetails.localPort);
rsctrl::core::IpAddr *eaddr = loc->mutable_extaddr();
eaddr->set_addr(ssldetails.extAddr);
eaddr->set_port(ssldetails.extPort);
/* translate status */
uint32_t loc_state = 0;
//dont think this state should be here.
//if (ssldetails.state & RS_PEER_STATE_FRIEND)
if (ssldetails.state & RS_PEER_STATE_ONLINE)
{
loc_state |= (uint32_t) rsctrl::core::Location::ONLINE;
}
if (ssldetails.state & RS_PEER_STATE_CONNECTED)
{
loc_state |= (uint32_t) rsctrl::core::Location::CONNECTED;
}
if (ssldetails.state & RS_PEER_STATE_UNREACHABLE)
{
loc_state |= (uint32_t) rsctrl::core::Location::UNREACHABLE;
}
loc->set_state(loc_state);
}
}
}
if (success)
{
rsctrl::core::Status *status = respp.mutable_status();
status->set_code(rsctrl::core::Status::SUCCESS);
}
else
{
rsctrl::core::Status *status = respp.mutable_status();
status->set_code(rsctrl::core::Status::FAILED);
status->set_msg("Unknown ERROR");
}
std::string outmsg;
if (!respp.SerializeToString(&outmsg))
{
@ -257,7 +417,7 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
}
// Correctly Name Message.
uint32_t out_msg_id = constructMsgId(rsctrl::base::BASE, rsctrl::base::PEERS,
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::PEERS,
rsctrl::peers::MsgId_ResponsePeerList, true);
// queue it.

View File

@ -0,0 +1,213 @@
/*
* RetroShare External Interface.
*
* Copyright 2012-2012 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "rpc/proto/rpcprotosystem.h"
#include "rpc/proto/gencc/system.pb.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsconfig.h>
#include <retroshare/rsiface.h>
#include <iostream>
#include <algorithm>
RpcProtoSystem::RpcProtoSystem(uint32_t serviceId)
:RpcQueueService(serviceId)
{
return;
}
//RpcProtoSystem::msgsAccepted(std::list<uint32_t> &msgIds); /* not used at the moment */
int RpcProtoSystem::processMsg(uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
/* check the msgId */
uint8_t topbyte = getRpcMsgIdExtension(msg_id);
uint16_t service = getRpcMsgIdService(msg_id);
uint8_t submsg = getRpcMsgIdSubMsg(msg_id);
bool isResponse = isRpcMsgIdResponse(msg_id);
std::cerr << "RpcProtoSystem::processMsg() topbyte: " << (int32_t) topbyte;
std::cerr << " service: " << (int32_t) service << " submsg: " << (int32_t) submsg;
std::cerr << std::endl;
if (isResponse)
{
std::cerr << "RpcProtoSystem::processMsg() isResponse() - not processing";
std::cerr << std::endl;
return 0;
}
if (topbyte != (uint8_t) rsctrl::core::CORE)
{
std::cerr << "RpcProtoSystem::processMsg() Extension Mismatch - not processing";
std::cerr << std::endl;
return 0;
}
if (service != (uint16_t) rsctrl::core::SYSTEM)
{
std::cerr << "RpcProtoSystem::processMsg() Service Mismatch - not processing";
std::cerr << std::endl;
return 0;
}
if (!rsctrl::system::RequestMsgIds_IsValid(submsg))
{
std::cerr << "RpcProtoSystem::processMsg() SubMsg Mismatch - not processing";
std::cerr << std::endl;
return 0;
}
switch(submsg)
{
case rsctrl::system::MsgId_RequestSystemStatus:
processSystemStatus(msg_id, req_id, msg);
break;
default:
std::cerr << "RpcProtoSystem::processMsg() ERROR should never get here";
std::cerr << std::endl;
return 0;
}
/* must have matched id to get here */
return 1;
}
int RpcProtoSystem::processSystemStatus(uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
std::cerr << "RpcProtoSystem::processSystemStatus()";
std::cerr << std::endl;
// parse msg.
rsctrl::system::RequestSystemStatus req;
if (!req.ParseFromString(msg))
{
std::cerr << "RpcProtoSystem::processSystemStatus() ERROR ParseFromString()";
std::cerr << std::endl;
return 0;
}
// NO Options... so go straight to answer.
// response.
rsctrl::system::ResponseSystemStatus resp;
bool success = true;
unsigned int nTotal = 0;
unsigned int nConnected = 0;
rsPeers->getPeerCount(&nTotal, &nConnected, false);
float downKb = 0;
float upKb = 0;
rsicontrol -> ConfigGetDataRates(downKb, upKb);
// set the data.
resp.set_no_peers(nTotal);
resp.set_no_connected(nConnected);
rsctrl::core::Bandwidth *bw = resp.mutable_bw_total();
bw->set_up(upKb);
bw->set_down(downKb);
bw->set_name("Total Connection Bandwidth");
uint32_t netState = rsConfig->getNetState();
std::string natState("Unknown");
rsctrl::system::ResponseSystemStatus_NetCode protoCode;
switch(netState)
{
default:
case RSNET_NETSTATE_BAD_UNKNOWN:
protoCode = rsctrl::system::ResponseSystemStatus::BAD_UNKNOWN;
break;
case RSNET_NETSTATE_BAD_OFFLINE:
protoCode = rsctrl::system::ResponseSystemStatus::BAD_OFFLINE;
break;
case RSNET_NETSTATE_BAD_NATSYM:
protoCode = rsctrl::system::ResponseSystemStatus::BAD_NATSYM;
break;
case RSNET_NETSTATE_BAD_NODHT_NAT:
protoCode = rsctrl::system::ResponseSystemStatus::BAD_NODHT_NAT;
break;
case RSNET_NETSTATE_WARNING_RESTART:
protoCode = rsctrl::system::ResponseSystemStatus::WARNING_RESTART;
break;
case RSNET_NETSTATE_WARNING_NATTED:
protoCode = rsctrl::system::ResponseSystemStatus::WARNING_NATTED;
break;
case RSNET_NETSTATE_WARNING_NODHT:
protoCode = rsctrl::system::ResponseSystemStatus::WARNING_NODHT;
break;
case RSNET_NETSTATE_GOOD:
protoCode = rsctrl::system::ResponseSystemStatus::GOOD;
break;
case RSNET_NETSTATE_ADV_FORWARD:
protoCode = rsctrl::system::ResponseSystemStatus::ADV_FORWARD;
break;
}
resp.set_net_status(protoCode);
if (success)
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::SUCCESS);
}
else
{
rsctrl::core::Status *status = resp.mutable_status();
status->set_code(rsctrl::core::Status::FAILED);
status->set_msg("Unknown ERROR");
}
std::string outmsg;
if (!resp.SerializeToString(&outmsg))
{
std::cerr << "RpcProtoSystem::processSystemStatus() ERROR SerialiseToString()";
std::cerr << std::endl;
return 0;
}
// Correctly Name Message.
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::SYSTEM,
rsctrl::system::MsgId_ResponseSystemStatus, true);
// queue it.
queueResponse(out_msg_id, req_id, outmsg);
return 1;
}

View File

@ -0,0 +1,41 @@
/*
* RetroShare External Interface.
*
* Copyright 2012-2012 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef RS_RPC_PROTO_SYSTEM_H
#define RS_RPC_PROTO_SYSTEM_H
#include "rpc/rpcserver.h"
class RpcProtoSystem: public RpcQueueService
{
public:
RpcProtoSystem(uint32_t serviceId);
// virtual msgsAccepted(std::list<uint32_t> &msgIds); /* not used at the moment */
virtual int processMsg(uint32_t msgId, uint32_t req_id, const std::string &msg);
virtual int processSystemStatus(uint32_t msg_id, uint32_t req_id, const std::string &msg);
};
#endif /* RS_PROTO_SYSTEM_H */

View File

@ -25,6 +25,7 @@
#include "rpc/rpcserver.h"
#include "rpc/proto/rpcprotopeers.h"
#include "rpc/proto/rpcprotosystem.h"
#include "rpc/rpcecho.h"
@ -37,6 +38,9 @@ RpcMediator *CreateRpcSystem(RpcComms *comms)
RpcProtoPeers *peers = new RpcProtoPeers(1);
server->addService(peers);
RpcProtoSystem *system = new RpcProtoSystem(1);
server->addService(system);
/* Finally an Echo Service - which will echo back any unprocesses commands. */
RpcEcho *echo = new RpcEcho(1);
server->addService(echo);

View File

@ -77,7 +77,7 @@ int RsSshd::init(std::string pathrsakey)
//ssh_bind_options_set(mBind, SSH_BIND_OPTIONS_DSAKEY, arg);
//ssh_bind_options_set(mBind, SSH_BIND_OPTIONS_HOSTKEY, arg);
ssh_bind_options_set(mBind, SSH_BIND_OPTIONS_RSAKEY, pathrsakey.c_str());
ssh_bind_options_set(mBind, SSH_BIND_OPTIONS_LOG_VERBOSITY_STR, "3");
//ssh_bind_options_set(mBind, SSH_BIND_OPTIONS_LOG_VERBOSITY_STR, "3");
mState = RSSSHD_STATE_INIT_OK;
mBindState = 0;