Put the first rpc service into action. (untested though).

* Added functions to split up MsgId into Extension / Service / SubMsg.
 * Updated the generated code.
 * Switched on compilation too.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5461 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-08-23 15:20:43 +00:00
parent ccb43660a8
commit b67f66faa0
10 changed files with 1677 additions and 123 deletions

View File

@ -179,7 +179,7 @@ sshserver {
DEFINES *= RS_SSH_SERVER
# Include Protobuf classes.
#CONFIG += protorpc
CONFIG += protorpc
}
protorpc {

View File

@ -34,6 +34,18 @@ const ::google::protobuf::internal::GeneratedMessageReflection*
const ::google::protobuf::Descriptor* Dir_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Dir_reflection_ = NULL;
const ::google::protobuf::Descriptor* SystemStatus_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SystemStatus_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* SystemStatus_NetCode_descriptor_ = NULL;
const ::google::protobuf::Descriptor* Bandwidth_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Bandwidth_reflection_ = NULL;
const ::google::protobuf::Descriptor* BandwidthSet_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
BandwidthSet_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* ExtensionId_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* PackageId_descriptor_ = NULL;
} // namespace
@ -133,6 +145,57 @@ void protobuf_AssignDesc_base_2eproto() {
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(Dir));
SystemStatus_descriptor_ = file->message_type(5);
static const int SystemStatus_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SystemStatus, net_status_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SystemStatus, msg_),
};
SystemStatus_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
SystemStatus_descriptor_,
SystemStatus::default_instance_,
SystemStatus_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SystemStatus, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SystemStatus, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(SystemStatus));
SystemStatus_NetCode_descriptor_ = SystemStatus_descriptor_->enum_type(0);
Bandwidth_descriptor_ = file->message_type(6);
static const int Bandwidth_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bandwidth, up_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bandwidth, down_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bandwidth, name_),
};
Bandwidth_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
Bandwidth_descriptor_,
Bandwidth::default_instance_,
Bandwidth_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bandwidth, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bandwidth, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(Bandwidth));
BandwidthSet_descriptor_ = file->message_type(7);
static const int BandwidthSet_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BandwidthSet, bandwidths_),
};
BandwidthSet_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
BandwidthSet_descriptor_,
BandwidthSet::default_instance_,
BandwidthSet_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BandwidthSet, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BandwidthSet, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(BandwidthSet));
ExtensionId_descriptor_ = file->enum_type(0);
PackageId_descriptor_ = file->enum_type(1);
}
namespace {
@ -155,6 +218,12 @@ void protobuf_RegisterTypes(const ::std::string&) {
File_descriptor_, &File::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Dir_descriptor_, &Dir::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SystemStatus_descriptor_, &SystemStatus::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Bandwidth_descriptor_, &Bandwidth::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
BandwidthSet_descriptor_, &BandwidthSet::default_instance());
}
} // namespace
@ -170,6 +239,12 @@ void protobuf_ShutdownFile_base_2eproto() {
delete File_reflection_;
delete Dir::default_instance_;
delete Dir_reflection_;
delete SystemStatus::default_instance_;
delete SystemStatus_reflection_;
delete Bandwidth::default_instance_;
delete Bandwidth_reflection_;
delete BandwidthSet::default_instance_;
delete BandwidthSet_reflection_;
}
void protobuf_AddDesc_base_2eproto() {
@ -191,7 +266,19 @@ void protobuf_AddDesc_base_2eproto() {
"\030\002 \002(\t\022\014\n\004size\030\003 \002(\003\022\014\n\004path\030\004 \001(\t\022\r\n\005av"
"ail\030\005 \001(\t\"f\n\003Dir\022\014\n\004name\030\001 \002(\t\022\014\n\004path\030\002"
" \002(\t\022!\n\007subdirs\030\003 \003(\0132\020.rsctrl.base.Dir\022"
" \n\005files\030\004 \003(\0132\021.rsctrl.base.File", 513);
" \n\005files\030\004 \003(\0132\021.rsctrl.base.File\"\372\001\n\014Sy"
"stemStatus\0225\n\nnet_status\030\001 \002(\0162!.rsctrl."
"base.SystemStatus.NetCode\022\013\n\003msg\030\002 \001(\t\"\245"
"\001\n\007NetCode\022\017\n\013BAD_UNKNOWN\020\000\022\017\n\013BAD_OFFLI"
"NE\020\001\022\016\n\nBAD_NATSYM\020\002\022\021\n\rBAD_NODHT_NAT\020\003\022"
"\023\n\017WARNING_RESTART\020\004\022\022\n\016WARNING_NATTED\020\005"
"\022\021\n\rWARNING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FOR"
"WARD\020\010\"3\n\tBandwidth\022\n\n\002up\030\001 \002(\002\022\014\n\004down\030"
"\002 \002(\002\022\014\n\004name\030\003 \001(\t\":\n\014BandwidthSet\022*\n\nb"
"andwidths\030\001 \003(\0132\026.rsctrl.base.Bandwidth*"
"\027\n\013ExtensionId\022\010\n\004BASE\020\000*A\n\tPackageId\022\t\n"
"\005PEERS\020\001\022\n\n\006SYSTEM\020\002\022\t\n\005FILES\020\003\022\010\n\004MSGS\020"
"\004\022\010\n\003GXS\020\350\007", 971);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"base.proto", &protobuf_RegisterTypes);
Status::default_instance_ = new Status();
@ -199,11 +286,17 @@ void protobuf_AddDesc_base_2eproto() {
Person::default_instance_ = new Person();
File::default_instance_ = new File();
Dir::default_instance_ = new Dir();
SystemStatus::default_instance_ = new SystemStatus();
Bandwidth::default_instance_ = new Bandwidth();
BandwidthSet::default_instance_ = new BandwidthSet();
Status::default_instance_->InitAsDefaultInstance();
Location::default_instance_->InitAsDefaultInstance();
Person::default_instance_->InitAsDefaultInstance();
File::default_instance_->InitAsDefaultInstance();
Dir::default_instance_->InitAsDefaultInstance();
SystemStatus::default_instance_->InitAsDefaultInstance();
Bandwidth::default_instance_->InitAsDefaultInstance();
BandwidthSet::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_base_2eproto);
}
@ -214,6 +307,36 @@ struct StaticDescriptorInitializer_base_2eproto {
}
} static_descriptor_initializer_base_2eproto_;
const ::google::protobuf::EnumDescriptor* ExtensionId_descriptor() {
protobuf_AssignDescriptorsOnce();
return ExtensionId_descriptor_;
}
bool ExtensionId_IsValid(int value) {
switch(value) {
case 0:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* PackageId_descriptor() {
protobuf_AssignDescriptorsOnce();
return PackageId_descriptor_;
}
bool PackageId_IsValid(int value) {
switch(value) {
case 1:
case 2:
case 3:
case 4:
case 1000:
return true;
default:
return false;
}
}
// ===================================================================
@ -2036,6 +2159,818 @@ void Dir::Swap(Dir* other) {
}
// ===================================================================
const ::google::protobuf::EnumDescriptor* SystemStatus_NetCode_descriptor() {
protobuf_AssignDescriptorsOnce();
return SystemStatus_NetCode_descriptor_;
}
bool SystemStatus_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 SystemStatus_NetCode SystemStatus::BAD_UNKNOWN;
const SystemStatus_NetCode SystemStatus::BAD_OFFLINE;
const SystemStatus_NetCode SystemStatus::BAD_NATSYM;
const SystemStatus_NetCode SystemStatus::BAD_NODHT_NAT;
const SystemStatus_NetCode SystemStatus::WARNING_RESTART;
const SystemStatus_NetCode SystemStatus::WARNING_NATTED;
const SystemStatus_NetCode SystemStatus::WARNING_NODHT;
const SystemStatus_NetCode SystemStatus::GOOD;
const SystemStatus_NetCode SystemStatus::ADV_FORWARD;
const SystemStatus_NetCode SystemStatus::NetCode_MIN;
const SystemStatus_NetCode SystemStatus::NetCode_MAX;
const int SystemStatus::NetCode_ARRAYSIZE;
#endif // _MSC_VER
#ifndef _MSC_VER
const int SystemStatus::kNetStatusFieldNumber;
const int SystemStatus::kMsgFieldNumber;
#endif // !_MSC_VER
SystemStatus::SystemStatus()
: ::google::protobuf::Message() {
SharedCtor();
}
void SystemStatus::InitAsDefaultInstance() {
}
SystemStatus::SystemStatus(const SystemStatus& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void SystemStatus::SharedCtor() {
_cached_size_ = 0;
net_status_ = 0;
msg_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
SystemStatus::~SystemStatus() {
SharedDtor();
}
void SystemStatus::SharedDtor() {
if (msg_ != &::google::protobuf::internal::kEmptyString) {
delete msg_;
}
if (this != default_instance_) {
}
}
void SystemStatus::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SystemStatus::descriptor() {
protobuf_AssignDescriptorsOnce();
return SystemStatus_descriptor_;
}
const SystemStatus& SystemStatus::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_base_2eproto(); return *default_instance_;
}
SystemStatus* SystemStatus::default_instance_ = NULL;
SystemStatus* SystemStatus::New() const {
return new SystemStatus;
}
void SystemStatus::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
net_status_ = 0;
if (has_msg()) {
if (msg_ != &::google::protobuf::internal::kEmptyString) {
msg_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool SystemStatus::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.base.SystemStatus.NetCode net_status = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::rsctrl::base::SystemStatus_NetCode_IsValid(value)) {
set_net_status(static_cast< ::rsctrl::base::SystemStatus_NetCode >(value));
} else {
mutable_unknown_fields()->AddVarint(1, value);
}
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_msg;
break;
}
// optional string msg = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_msg:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_msg()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->msg().data(), this->msg().length(),
::google::protobuf::internal::WireFormat::PARSE);
} 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 SystemStatus::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .rsctrl.base.SystemStatus.NetCode net_status = 1;
if (has_net_status()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
1, this->net_status(), output);
}
// optional string msg = 2;
if (has_msg()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->msg().data(), this->msg().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
2, this->msg(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* SystemStatus::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .rsctrl.base.SystemStatus.NetCode net_status = 1;
if (has_net_status()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
1, this->net_status(), target);
}
// optional string msg = 2;
if (has_msg()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->msg().data(), this->msg().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->msg(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int SystemStatus::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .rsctrl.base.SystemStatus.NetCode net_status = 1;
if (has_net_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->net_status());
}
// optional string msg = 2;
if (has_msg()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->msg());
}
}
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 SystemStatus::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const SystemStatus* source =
::google::protobuf::internal::dynamic_cast_if_available<const SystemStatus*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void SystemStatus::MergeFrom(const SystemStatus& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_net_status()) {
set_net_status(from.net_status());
}
if (from.has_msg()) {
set_msg(from.msg());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void SystemStatus::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SystemStatus::CopyFrom(const SystemStatus& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SystemStatus::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
return true;
}
void SystemStatus::Swap(SystemStatus* other) {
if (other != this) {
std::swap(net_status_, other->net_status_);
std::swap(msg_, other->msg_);
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 SystemStatus::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SystemStatus_descriptor_;
metadata.reflection = SystemStatus_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int Bandwidth::kUpFieldNumber;
const int Bandwidth::kDownFieldNumber;
const int Bandwidth::kNameFieldNumber;
#endif // !_MSC_VER
Bandwidth::Bandwidth()
: ::google::protobuf::Message() {
SharedCtor();
}
void Bandwidth::InitAsDefaultInstance() {
}
Bandwidth::Bandwidth(const Bandwidth& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void Bandwidth::SharedCtor() {
_cached_size_ = 0;
up_ = 0;
down_ = 0;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Bandwidth::~Bandwidth() {
SharedDtor();
}
void Bandwidth::SharedDtor() {
if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (this != default_instance_) {
}
}
void Bandwidth::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Bandwidth::descriptor() {
protobuf_AssignDescriptorsOnce();
return Bandwidth_descriptor_;
}
const Bandwidth& Bandwidth::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_base_2eproto(); return *default_instance_;
}
Bandwidth* Bandwidth::default_instance_ = NULL;
Bandwidth* Bandwidth::New() const {
return new Bandwidth;
}
void Bandwidth::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
up_ = 0;
down_ = 0;
if (has_name()) {
if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool Bandwidth::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 float up = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &up_)));
set_has_up();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(21)) goto parse_down;
break;
}
// required float down = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) {
parse_down:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &down_)));
set_has_down();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_name;
break;
}
// optional string name = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE);
} 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 Bandwidth::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required float up = 1;
if (has_up()) {
::google::protobuf::internal::WireFormatLite::WriteFloat(1, this->up(), output);
}
// required float down = 2;
if (has_down()) {
::google::protobuf::internal::WireFormatLite::WriteFloat(2, this->down(), output);
}
// optional string name = 3;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
3, this->name(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* Bandwidth::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required float up = 1;
if (has_up()) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(1, this->up(), target);
}
// required float down = 2;
if (has_down()) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(2, this->down(), target);
}
// optional string name = 3;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->name(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int Bandwidth::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required float up = 1;
if (has_up()) {
total_size += 1 + 4;
}
// required float down = 2;
if (has_down()) {
total_size += 1 + 4;
}
// optional string name = 3;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
}
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 Bandwidth::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const Bandwidth* source =
::google::protobuf::internal::dynamic_cast_if_available<const Bandwidth*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void Bandwidth::MergeFrom(const Bandwidth& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_up()) {
set_up(from.up());
}
if (from.has_down()) {
set_down(from.down());
}
if (from.has_name()) {
set_name(from.name());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void Bandwidth::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Bandwidth::CopyFrom(const Bandwidth& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Bandwidth::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void Bandwidth::Swap(Bandwidth* other) {
if (other != this) {
std::swap(up_, other->up_);
std::swap(down_, other->down_);
std::swap(name_, other->name_);
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 Bandwidth::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Bandwidth_descriptor_;
metadata.reflection = Bandwidth_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int BandwidthSet::kBandwidthsFieldNumber;
#endif // !_MSC_VER
BandwidthSet::BandwidthSet()
: ::google::protobuf::Message() {
SharedCtor();
}
void BandwidthSet::InitAsDefaultInstance() {
}
BandwidthSet::BandwidthSet(const BandwidthSet& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void BandwidthSet::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
BandwidthSet::~BandwidthSet() {
SharedDtor();
}
void BandwidthSet::SharedDtor() {
if (this != default_instance_) {
}
}
void BandwidthSet::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* BandwidthSet::descriptor() {
protobuf_AssignDescriptorsOnce();
return BandwidthSet_descriptor_;
}
const BandwidthSet& BandwidthSet::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_base_2eproto(); return *default_instance_;
}
BandwidthSet* BandwidthSet::default_instance_ = NULL;
BandwidthSet* BandwidthSet::New() const {
return new BandwidthSet;
}
void BandwidthSet::Clear() {
bandwidths_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool BandwidthSet::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)) {
// repeated .rsctrl.base.Bandwidth bandwidths = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_bandwidths:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_bandwidths()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(10)) goto parse_bandwidths;
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 BandwidthSet::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// repeated .rsctrl.base.Bandwidth bandwidths = 1;
for (int i = 0; i < this->bandwidths_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->bandwidths(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* BandwidthSet::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// repeated .rsctrl.base.Bandwidth bandwidths = 1;
for (int i = 0; i < this->bandwidths_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->bandwidths(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int BandwidthSet::ByteSize() const {
int total_size = 0;
// repeated .rsctrl.base.Bandwidth bandwidths = 1;
total_size += 1 * this->bandwidths_size();
for (int i = 0; i < this->bandwidths_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->bandwidths(i));
}
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 BandwidthSet::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const BandwidthSet* source =
::google::protobuf::internal::dynamic_cast_if_available<const BandwidthSet*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void BandwidthSet::MergeFrom(const BandwidthSet& from) {
GOOGLE_CHECK_NE(&from, this);
bandwidths_.MergeFrom(from.bandwidths_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void BandwidthSet::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void BandwidthSet::CopyFrom(const BandwidthSet& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool BandwidthSet::IsInitialized() const {
for (int i = 0; i < bandwidths_size(); i++) {
if (!this->bandwidths(i).IsInitialized()) return false;
}
return true;
}
void BandwidthSet::Swap(BandwidthSet* other) {
if (other != this) {
bandwidths_.Swap(&other->bandwidths_);
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 BandwidthSet::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = BandwidthSet_descriptor_;
metadata.reflection = BandwidthSet_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace base

View File

@ -38,6 +38,9 @@ class Location;
class Person;
class File;
class Dir;
class SystemStatus;
class Bandwidth;
class BandwidthSet;
enum Status_StatusCode {
Status_StatusCode_FAILED = 0,
@ -60,6 +63,72 @@ inline bool Status_StatusCode_Parse(
return ::google::protobuf::internal::ParseNamedEnum<Status_StatusCode>(
Status_StatusCode_descriptor(), name, value);
}
enum SystemStatus_NetCode {
SystemStatus_NetCode_BAD_UNKNOWN = 0,
SystemStatus_NetCode_BAD_OFFLINE = 1,
SystemStatus_NetCode_BAD_NATSYM = 2,
SystemStatus_NetCode_BAD_NODHT_NAT = 3,
SystemStatus_NetCode_WARNING_RESTART = 4,
SystemStatus_NetCode_WARNING_NATTED = 5,
SystemStatus_NetCode_WARNING_NODHT = 6,
SystemStatus_NetCode_GOOD = 7,
SystemStatus_NetCode_ADV_FORWARD = 8
};
bool SystemStatus_NetCode_IsValid(int value);
const SystemStatus_NetCode SystemStatus_NetCode_NetCode_MIN = SystemStatus_NetCode_BAD_UNKNOWN;
const SystemStatus_NetCode SystemStatus_NetCode_NetCode_MAX = SystemStatus_NetCode_ADV_FORWARD;
const int SystemStatus_NetCode_NetCode_ARRAYSIZE = SystemStatus_NetCode_NetCode_MAX + 1;
const ::google::protobuf::EnumDescriptor* SystemStatus_NetCode_descriptor();
inline const ::std::string& SystemStatus_NetCode_Name(SystemStatus_NetCode value) {
return ::google::protobuf::internal::NameOfEnum(
SystemStatus_NetCode_descriptor(), value);
}
inline bool SystemStatus_NetCode_Parse(
const ::std::string& name, SystemStatus_NetCode* value) {
return ::google::protobuf::internal::ParseNamedEnum<SystemStatus_NetCode>(
SystemStatus_NetCode_descriptor(), name, value);
}
enum ExtensionId {
BASE = 0
};
bool ExtensionId_IsValid(int value);
const ExtensionId ExtensionId_MIN = BASE;
const ExtensionId ExtensionId_MAX = BASE;
const int ExtensionId_ARRAYSIZE = ExtensionId_MAX + 1;
const ::google::protobuf::EnumDescriptor* ExtensionId_descriptor();
inline const ::std::string& ExtensionId_Name(ExtensionId value) {
return ::google::protobuf::internal::NameOfEnum(
ExtensionId_descriptor(), value);
}
inline bool ExtensionId_Parse(
const ::std::string& name, ExtensionId* value) {
return ::google::protobuf::internal::ParseNamedEnum<ExtensionId>(
ExtensionId_descriptor(), name, value);
}
enum PackageId {
PEERS = 1,
SYSTEM = 2,
FILES = 3,
MSGS = 4,
GXS = 1000
};
bool PackageId_IsValid(int value);
const PackageId PackageId_MIN = PEERS;
const PackageId PackageId_MAX = GXS;
const int PackageId_ARRAYSIZE = PackageId_MAX + 1;
const ::google::protobuf::EnumDescriptor* PackageId_descriptor();
inline const ::std::string& PackageId_Name(PackageId value) {
return ::google::protobuf::internal::NameOfEnum(
PackageId_descriptor(), value);
}
inline bool PackageId_Parse(
const ::std::string& name, PackageId* value) {
return ::google::protobuf::internal::ParseNamedEnum<PackageId>(
PackageId_descriptor(), name, value);
}
// ===================================================================
class Status : public ::google::protobuf::Message {
@ -687,6 +756,324 @@ class Dir : public ::google::protobuf::Message {
void InitAsDefaultInstance();
static Dir* default_instance_;
};
// -------------------------------------------------------------------
class SystemStatus : public ::google::protobuf::Message {
public:
SystemStatus();
virtual ~SystemStatus();
SystemStatus(const SystemStatus& from);
inline SystemStatus& operator=(const SystemStatus& 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 SystemStatus& default_instance();
void Swap(SystemStatus* other);
// implements Message ----------------------------------------------
SystemStatus* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const SystemStatus& from);
void MergeFrom(const SystemStatus& 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 SystemStatus_NetCode NetCode;
static const NetCode BAD_UNKNOWN = SystemStatus_NetCode_BAD_UNKNOWN;
static const NetCode BAD_OFFLINE = SystemStatus_NetCode_BAD_OFFLINE;
static const NetCode BAD_NATSYM = SystemStatus_NetCode_BAD_NATSYM;
static const NetCode BAD_NODHT_NAT = SystemStatus_NetCode_BAD_NODHT_NAT;
static const NetCode WARNING_RESTART = SystemStatus_NetCode_WARNING_RESTART;
static const NetCode WARNING_NATTED = SystemStatus_NetCode_WARNING_NATTED;
static const NetCode WARNING_NODHT = SystemStatus_NetCode_WARNING_NODHT;
static const NetCode GOOD = SystemStatus_NetCode_GOOD;
static const NetCode ADV_FORWARD = SystemStatus_NetCode_ADV_FORWARD;
static inline bool NetCode_IsValid(int value) {
return SystemStatus_NetCode_IsValid(value);
}
static const NetCode NetCode_MIN =
SystemStatus_NetCode_NetCode_MIN;
static const NetCode NetCode_MAX =
SystemStatus_NetCode_NetCode_MAX;
static const int NetCode_ARRAYSIZE =
SystemStatus_NetCode_NetCode_ARRAYSIZE;
static inline const ::google::protobuf::EnumDescriptor*
NetCode_descriptor() {
return SystemStatus_NetCode_descriptor();
}
static inline const ::std::string& NetCode_Name(NetCode value) {
return SystemStatus_NetCode_Name(value);
}
static inline bool NetCode_Parse(const ::std::string& name,
NetCode* value) {
return SystemStatus_NetCode_Parse(name, value);
}
// accessors -------------------------------------------------------
// required .rsctrl.base.SystemStatus.NetCode net_status = 1;
inline bool has_net_status() const;
inline void clear_net_status();
static const int kNetStatusFieldNumber = 1;
inline ::rsctrl::base::SystemStatus_NetCode net_status() const;
inline void set_net_status(::rsctrl::base::SystemStatus_NetCode value);
// optional string msg = 2;
inline bool has_msg() const;
inline void clear_msg();
static const int kMsgFieldNumber = 2;
inline const ::std::string& msg() const;
inline void set_msg(const ::std::string& value);
inline void set_msg(const char* value);
inline void set_msg(const char* value, size_t size);
inline ::std::string* mutable_msg();
inline ::std::string* release_msg();
// @@protoc_insertion_point(class_scope:rsctrl.base.SystemStatus)
private:
inline void set_has_net_status();
inline void clear_has_net_status();
inline void set_has_msg();
inline void clear_has_msg();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::std::string* msg_;
int net_status_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
friend void protobuf_AddDesc_base_2eproto();
friend void protobuf_AssignDesc_base_2eproto();
friend void protobuf_ShutdownFile_base_2eproto();
void InitAsDefaultInstance();
static SystemStatus* default_instance_;
};
// -------------------------------------------------------------------
class Bandwidth : public ::google::protobuf::Message {
public:
Bandwidth();
virtual ~Bandwidth();
Bandwidth(const Bandwidth& from);
inline Bandwidth& operator=(const Bandwidth& 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 Bandwidth& default_instance();
void Swap(Bandwidth* other);
// implements Message ----------------------------------------------
Bandwidth* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const Bandwidth& from);
void MergeFrom(const Bandwidth& 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 -------------------------------------------------------
// required float up = 1;
inline bool has_up() const;
inline void clear_up();
static const int kUpFieldNumber = 1;
inline float up() const;
inline void set_up(float value);
// required float down = 2;
inline bool has_down() const;
inline void clear_down();
static const int kDownFieldNumber = 2;
inline float down() const;
inline void set_down(float value);
// optional string name = 3;
inline bool has_name() const;
inline void clear_name();
static const int kNameFieldNumber = 3;
inline const ::std::string& name() const;
inline void set_name(const ::std::string& value);
inline void set_name(const char* value);
inline void set_name(const char* value, size_t size);
inline ::std::string* mutable_name();
inline ::std::string* release_name();
// @@protoc_insertion_point(class_scope:rsctrl.base.Bandwidth)
private:
inline void set_has_up();
inline void clear_has_up();
inline void set_has_down();
inline void clear_has_down();
inline void set_has_name();
inline void clear_has_name();
::google::protobuf::UnknownFieldSet _unknown_fields_;
float up_;
float down_;
::std::string* name_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
friend void protobuf_AddDesc_base_2eproto();
friend void protobuf_AssignDesc_base_2eproto();
friend void protobuf_ShutdownFile_base_2eproto();
void InitAsDefaultInstance();
static Bandwidth* default_instance_;
};
// -------------------------------------------------------------------
class BandwidthSet : public ::google::protobuf::Message {
public:
BandwidthSet();
virtual ~BandwidthSet();
BandwidthSet(const BandwidthSet& from);
inline BandwidthSet& operator=(const BandwidthSet& 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 BandwidthSet& default_instance();
void Swap(BandwidthSet* other);
// implements Message ----------------------------------------------
BandwidthSet* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const BandwidthSet& from);
void MergeFrom(const BandwidthSet& 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 -------------------------------------------------------
// repeated .rsctrl.base.Bandwidth bandwidths = 1;
inline int bandwidths_size() const;
inline void clear_bandwidths();
static const int kBandwidthsFieldNumber = 1;
inline const ::rsctrl::base::Bandwidth& bandwidths(int index) const;
inline ::rsctrl::base::Bandwidth* mutable_bandwidths(int index);
inline ::rsctrl::base::Bandwidth* add_bandwidths();
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Bandwidth >&
bandwidths() const;
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Bandwidth >*
mutable_bandwidths();
// @@protoc_insertion_point(class_scope:rsctrl.base.BandwidthSet)
private:
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::RepeatedPtrField< ::rsctrl::base::Bandwidth > bandwidths_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
friend void protobuf_AddDesc_base_2eproto();
friend void protobuf_AssignDesc_base_2eproto();
friend void protobuf_ShutdownFile_base_2eproto();
void InitAsDefaultInstance();
static BandwidthSet* default_instance_;
};
// ===================================================================
@ -1584,6 +1971,226 @@ Dir::mutable_files() {
return &files_;
}
// -------------------------------------------------------------------
// SystemStatus
// required .rsctrl.base.SystemStatus.NetCode net_status = 1;
inline bool SystemStatus::has_net_status() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void SystemStatus::set_has_net_status() {
_has_bits_[0] |= 0x00000001u;
}
inline void SystemStatus::clear_has_net_status() {
_has_bits_[0] &= ~0x00000001u;
}
inline void SystemStatus::clear_net_status() {
net_status_ = 0;
clear_has_net_status();
}
inline ::rsctrl::base::SystemStatus_NetCode SystemStatus::net_status() const {
return static_cast< ::rsctrl::base::SystemStatus_NetCode >(net_status_);
}
inline void SystemStatus::set_net_status(::rsctrl::base::SystemStatus_NetCode value) {
GOOGLE_DCHECK(::rsctrl::base::SystemStatus_NetCode_IsValid(value));
set_has_net_status();
net_status_ = value;
}
// optional string msg = 2;
inline bool SystemStatus::has_msg() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void SystemStatus::set_has_msg() {
_has_bits_[0] |= 0x00000002u;
}
inline void SystemStatus::clear_has_msg() {
_has_bits_[0] &= ~0x00000002u;
}
inline void SystemStatus::clear_msg() {
if (msg_ != &::google::protobuf::internal::kEmptyString) {
msg_->clear();
}
clear_has_msg();
}
inline const ::std::string& SystemStatus::msg() const {
return *msg_;
}
inline void SystemStatus::set_msg(const ::std::string& value) {
set_has_msg();
if (msg_ == &::google::protobuf::internal::kEmptyString) {
msg_ = new ::std::string;
}
msg_->assign(value);
}
inline void SystemStatus::set_msg(const char* value) {
set_has_msg();
if (msg_ == &::google::protobuf::internal::kEmptyString) {
msg_ = new ::std::string;
}
msg_->assign(value);
}
inline void SystemStatus::set_msg(const char* value, size_t size) {
set_has_msg();
if (msg_ == &::google::protobuf::internal::kEmptyString) {
msg_ = new ::std::string;
}
msg_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* SystemStatus::mutable_msg() {
set_has_msg();
if (msg_ == &::google::protobuf::internal::kEmptyString) {
msg_ = new ::std::string;
}
return msg_;
}
inline ::std::string* SystemStatus::release_msg() {
clear_has_msg();
if (msg_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = msg_;
msg_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
// -------------------------------------------------------------------
// Bandwidth
// required float up = 1;
inline bool Bandwidth::has_up() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Bandwidth::set_has_up() {
_has_bits_[0] |= 0x00000001u;
}
inline void Bandwidth::clear_has_up() {
_has_bits_[0] &= ~0x00000001u;
}
inline void Bandwidth::clear_up() {
up_ = 0;
clear_has_up();
}
inline float Bandwidth::up() const {
return up_;
}
inline void Bandwidth::set_up(float value) {
set_has_up();
up_ = value;
}
// required float down = 2;
inline bool Bandwidth::has_down() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void Bandwidth::set_has_down() {
_has_bits_[0] |= 0x00000002u;
}
inline void Bandwidth::clear_has_down() {
_has_bits_[0] &= ~0x00000002u;
}
inline void Bandwidth::clear_down() {
down_ = 0;
clear_has_down();
}
inline float Bandwidth::down() const {
return down_;
}
inline void Bandwidth::set_down(float value) {
set_has_down();
down_ = value;
}
// optional string name = 3;
inline bool Bandwidth::has_name() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void Bandwidth::set_has_name() {
_has_bits_[0] |= 0x00000004u;
}
inline void Bandwidth::clear_has_name() {
_has_bits_[0] &= ~0x00000004u;
}
inline void Bandwidth::clear_name() {
if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
clear_has_name();
}
inline const ::std::string& Bandwidth::name() const {
return *name_;
}
inline void Bandwidth::set_name(const ::std::string& value) {
set_has_name();
if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
}
inline void Bandwidth::set_name(const char* value) {
set_has_name();
if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(value);
}
inline void Bandwidth::set_name(const char* value, size_t size) {
set_has_name();
if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
name_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Bandwidth::mutable_name() {
set_has_name();
if (name_ == &::google::protobuf::internal::kEmptyString) {
name_ = new ::std::string;
}
return name_;
}
inline ::std::string* Bandwidth::release_name() {
clear_has_name();
if (name_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = name_;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
// -------------------------------------------------------------------
// BandwidthSet
// repeated .rsctrl.base.Bandwidth bandwidths = 1;
inline int BandwidthSet::bandwidths_size() const {
return bandwidths_.size();
}
inline void BandwidthSet::clear_bandwidths() {
bandwidths_.Clear();
}
inline const ::rsctrl::base::Bandwidth& BandwidthSet::bandwidths(int index) const {
return bandwidths_.Get(index);
}
inline ::rsctrl::base::Bandwidth* BandwidthSet::mutable_bandwidths(int index) {
return bandwidths_.Mutable(index);
}
inline ::rsctrl::base::Bandwidth* BandwidthSet::add_bandwidths() {
return bandwidths_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Bandwidth >&
BandwidthSet::bandwidths() const {
return bandwidths_;
}
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::base::Bandwidth >*
BandwidthSet::mutable_bandwidths() {
return &bandwidths_;
}
// @@protoc_insertion_point(namespace_scope)
@ -1598,6 +2205,18 @@ template <>
inline const EnumDescriptor* GetEnumDescriptor< ::rsctrl::base::Status_StatusCode>() {
return ::rsctrl::base::Status_StatusCode_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::rsctrl::base::SystemStatus_NetCode>() {
return ::rsctrl::base::SystemStatus_NetCode_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::base::ExtensionId>() {
return rsctrl::base::ExtensionId_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::base::PackageId>() {
return rsctrl::base::PackageId_descriptor();
}
} // namespace google
} // namespace protobuf

View File

@ -40,8 +40,6 @@ const ::google::protobuf::EnumDescriptor* RequestModifyPeer_ModCmd_descriptor_ =
const ::google::protobuf::Descriptor* ResponseModifyPeer_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ResponseModifyPeer_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* ExtensionId_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* PackageId_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor_ = NULL;
@ -156,10 +154,8 @@ void protobuf_AssignDesc_peers_2eproto() {
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ResponseModifyPeer));
ExtensionId_descriptor_ = file->enum_type(0);
PackageId_descriptor_ = file->enum_type(1);
RequestMsgIds_descriptor_ = file->enum_type(2);
ResponseMsgIds_descriptor_ = file->enum_type(3);
RequestMsgIds_descriptor_ = file->enum_type(0);
ResponseMsgIds_descriptor_ = file->enum_type(1);
}
namespace {
@ -212,35 +208,34 @@ void protobuf_AddDesc_peers_2eproto() {
::rsctrl::base::protobuf_AddDesc_base_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\013peers.proto\022\014rsctrl.peers\032\nbase.proto\""
"\217\002\n\014RequestPeers\0221\n\003set\030\001 \002(\0162$.rsctrl.p"
"\246\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\"D\n\tSetOption\022\n\n\006LISTED"
"\020\001\022\n\n\006ONLINE\020\002\022\013\n\007FRIENDS\020\003\022\t\n\005VALID\020\004\022\007"
"\n\003ALL\020\005\"@\n\nInfoOption\022\014\n\010NAMEONLY\020\001\022\t\n\005B"
"ASIC\020\002\022\014\n\010LOCATION\020\003\022\013\n\007ALLINFO\020\004\"[\n\020Res"
"ponsePeerList\022#\n\006status\030\001 \002(\0132\023.rsctrl.b"
"\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\"\242\001\n\016RequestAddPeer\022\016\n\006gpg_id\030\001 \002("
"\t\0220\n\003cmd\030\002 \002(\0162#.rsctrl.peers.RequestAdd"
"Peer.AddCmd\022\014\n\004cert\030\003 \001(\t\"@\n\006AddCmd\022\010\n\004N"
"OOP\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.rsctrl.base.Status\022\"\n\005peers\030\002 \003"
"(\0132\023.rsctrl.base.Person\"\231\001\n\021RequestModif"
"yPeer\0223\n\003cmd\030\001 \002(\0162&.rsctrl.peers.Reques"
"tModifyPeer.ModCmd\022\"\n\005peers\030\002 \003(\0132\023.rsct"
"rl.base.Person\"+\n\006ModCmd\022\010\n\004NOOP\020\000\022\013\n\007AD"
"DRESS\020\001\022\n\n\006DYNDNS\020\002\"]\n\022ResponseModifyPee"
"r\022#\n\006status\030\001 \002(\0132\023.rsctrl.base.Status\022\""
"\n\005peers\030\002 \003(\0132\023.rsctrl.base.Person*\027\n\013Ex"
"tensionId\022\010\n\004BASE\020\000*\026\n\tPackageId\022\t\n\005PEER"
"S\020\001*^\n\rRequestMsgIds\022\026\n\022MsgId_RequestPee"
"rs\020\001\022\030\n\024MsgId_RequestAddPeer\020\002\022\033\n\027MsgId_"
"RequestModifyPeer\020\003*e\n\016ResponseMsgIds\022\032\n"
"\026MsgId_ResponsePeerList\020\001\022\031\n\025MsgId_Respo"
"nseAddPeer\020\002\022\034\n\030MsgId_ResponseModifyPeer"
"\020\003", 1162);
"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);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"peers.proto", &protobuf_RegisterTypes);
RequestPeers::default_instance_ = new RequestPeers();
@ -265,32 +260,6 @@ struct StaticDescriptorInitializer_peers_2eproto {
}
} static_descriptor_initializer_peers_2eproto_;
const ::google::protobuf::EnumDescriptor* ExtensionId_descriptor() {
protobuf_AssignDescriptorsOnce();
return ExtensionId_descriptor_;
}
bool ExtensionId_IsValid(int value) {
switch(value) {
case 0:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* PackageId_descriptor() {
protobuf_AssignDescriptorsOnce();
return PackageId_descriptor_;
}
bool PackageId_IsValid(int value) {
switch(value) {
case 1:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor() {
protobuf_AssignDescriptorsOnce();
return RequestMsgIds_descriptor_;
@ -335,6 +304,8 @@ bool RequestPeers_SetOption_IsValid(int value) {
case 3:
case 4:
case 5:
case 6:
case 7:
return true;
default:
return false;
@ -342,10 +313,12 @@ 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::FRIENDS;
const RequestPeers_SetOption RequestPeers::VALID;
const RequestPeers_SetOption RequestPeers::SIGNED;
const RequestPeers_SetOption RequestPeers::ALL;
const RequestPeers_SetOption RequestPeers::SetOption_MIN;
const RequestPeers_SetOption RequestPeers::SetOption_MAX;

View File

@ -42,14 +42,16 @@ class RequestModifyPeer;
class ResponseModifyPeer;
enum RequestPeers_SetOption {
RequestPeers_SetOption_LISTED = 1,
RequestPeers_SetOption_ONLINE = 2,
RequestPeers_SetOption_FRIENDS = 3,
RequestPeers_SetOption_VALID = 4,
RequestPeers_SetOption_ALL = 5
RequestPeers_SetOption_OWNID = 1,
RequestPeers_SetOption_LISTED = 2,
RequestPeers_SetOption_ONLINE = 3,
RequestPeers_SetOption_FRIENDS = 4,
RequestPeers_SetOption_VALID = 5,
RequestPeers_SetOption_SIGNED = 6,
RequestPeers_SetOption_ALL = 7
};
bool RequestPeers_SetOption_IsValid(int value);
const RequestPeers_SetOption RequestPeers_SetOption_SetOption_MIN = RequestPeers_SetOption_LISTED;
const RequestPeers_SetOption RequestPeers_SetOption_SetOption_MIN = RequestPeers_SetOption_OWNID;
const RequestPeers_SetOption RequestPeers_SetOption_SetOption_MAX = RequestPeers_SetOption_ALL;
const int RequestPeers_SetOption_SetOption_ARRAYSIZE = RequestPeers_SetOption_SetOption_MAX + 1;
@ -126,42 +128,6 @@ inline bool RequestModifyPeer_ModCmd_Parse(
return ::google::protobuf::internal::ParseNamedEnum<RequestModifyPeer_ModCmd>(
RequestModifyPeer_ModCmd_descriptor(), name, value);
}
enum ExtensionId {
BASE = 0
};
bool ExtensionId_IsValid(int value);
const ExtensionId ExtensionId_MIN = BASE;
const ExtensionId ExtensionId_MAX = BASE;
const int ExtensionId_ARRAYSIZE = ExtensionId_MAX + 1;
const ::google::protobuf::EnumDescriptor* ExtensionId_descriptor();
inline const ::std::string& ExtensionId_Name(ExtensionId value) {
return ::google::protobuf::internal::NameOfEnum(
ExtensionId_descriptor(), value);
}
inline bool ExtensionId_Parse(
const ::std::string& name, ExtensionId* value) {
return ::google::protobuf::internal::ParseNamedEnum<ExtensionId>(
ExtensionId_descriptor(), name, value);
}
enum PackageId {
PEERS = 1
};
bool PackageId_IsValid(int value);
const PackageId PackageId_MIN = PEERS;
const PackageId PackageId_MAX = PEERS;
const int PackageId_ARRAYSIZE = PackageId_MAX + 1;
const ::google::protobuf::EnumDescriptor* PackageId_descriptor();
inline const ::std::string& PackageId_Name(PackageId value) {
return ::google::protobuf::internal::NameOfEnum(
PackageId_descriptor(), value);
}
inline bool PackageId_Parse(
const ::std::string& name, PackageId* value) {
return ::google::protobuf::internal::ParseNamedEnum<PackageId>(
PackageId_descriptor(), name, value);
}
enum RequestMsgIds {
MsgId_RequestPeers = 1,
MsgId_RequestAddPeer = 2,
@ -257,10 +223,12 @@ class RequestPeers : public ::google::protobuf::Message {
// nested types ----------------------------------------------------
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 FRIENDS = RequestPeers_SetOption_FRIENDS;
static const SetOption VALID = RequestPeers_SetOption_VALID;
static const SetOption SIGNED = RequestPeers_SetOption_SIGNED;
static const SetOption ALL = RequestPeers_SetOption_ALL;
static inline bool SetOption_IsValid(int value) {
return RequestPeers_SetOption_IsValid(value);
@ -1402,14 +1370,6 @@ inline const EnumDescriptor* GetEnumDescriptor< ::rsctrl::peers::RequestModifyPe
return ::rsctrl::peers::RequestModifyPeer_ModCmd_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::peers::ExtensionId>() {
return rsctrl::peers::ExtensionId_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::peers::PackageId>() {
return rsctrl::peers::PackageId_descriptor();
}
template <>
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::peers::RequestMsgIds>() {
return rsctrl::peers::RequestMsgIds_descriptor();
}

View File

@ -39,15 +39,32 @@ RpcProtoPeers::RpcProtoPeers(uint32_t serviceId)
int RpcProtoPeers::processMsg(uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
/* check the msgId */
uint8_t topbyte = 0;
uint8_t service = 0;
uint8_t submsg = 0;
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 << "RpcProtoPeers::processMsg() topbyte: " << topbyte;
std::cerr << " service: " << service << " submsg: " << submsg;
std::cerr << std::endl;
if (service != (uint8_t) rsctrl::peers::BASE)
if (isResponse)
{
std::cerr << "RpcProtoPeers::processMsg() isResponse() - not processing";
std::cerr << std::endl;
return 0;
}
if (topbyte != (uint8_t) rsctrl::base::BASE)
{
std::cerr << "RpcProtoPeers::processMsg() Extension Mismatch - not processing";
std::cerr << std::endl;
return 0;
}
if (service != (uint16_t) rsctrl::base::PEERS)
{
std::cerr << "RpcProtoPeers::processMsg() Service Mismatch - not processing";
std::cerr << std::endl;
@ -231,7 +248,6 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
}
}
std::string outmsg;
if (!respp.SerializeToString(&outmsg))
{
@ -241,15 +257,13 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
}
// Correctly Name Message.
uint32_t out_msg_id = create_msg_id(
rsctrl::peers::BASE,
rsctrl::peers::MsgId_ResponsePeerList);
uint32_t out_msg_id = constructMsgId(rsctrl::base::BASE, rsctrl::base::PEERS,
rsctrl::peers::MsgId_ResponsePeerList, true);
// queue it.
queueResponse(out_msg_id, req_id, outmsg);
return 1;
}

View File

@ -27,7 +27,7 @@
#include "rpc/rpcserver.h"
class RpcProtoPeers: RpcQueueService
class RpcProtoPeers: public RpcQueueService
{
public:
RpcProtoPeers(uint32_t serviceId);

View File

@ -225,3 +225,42 @@ int RpcQueueService::queueResponse(uint32_t msg_id, uint32_t req_id, const std::
}
// Lower 8 bits.
uint8_t getRpcMsgIdSubMsg(uint32_t msg_id)
{
return msg_id & 0xFF;
}
// Middle 16 bits.
uint16_t getRpcMsgIdService(uint32_t msg_id)
{
return (msg_id >> 8) & 0xFFFF;
}
// Top 8 bits.
uint8_t getRpcMsgIdExtension(uint32_t msg_id)
{
return (msg_id >> 24) & 0xFE; // Bottom Bit is for Request / Response
}
bool isRpcMsgIdResponse(uint32_t msg_id)
{
return (msg_id >> 24) & 0x01;
}
uint32_t constructMsgId(uint8_t ext, uint16_t service, uint8_t submsg, bool is_response)
{
if (is_response)
ext |= 0x01; // Set Bottom Bit.
else
ext &= 0xFE; // Clear Bottom Bit.
uint32_t msg_id = (ext << 24) + (service << 8) + (submsg);
return msg_id;
}

View File

@ -32,6 +32,15 @@
#include "util/rsthreads.h"
// Dividing up MsgIds into components:
uint8_t getRpcMsgIdSubMsg(uint32_t msg_id);
uint16_t getRpcMsgIdService(uint32_t msg_id); // Middle 16 bits.
uint8_t getRpcMsgIdExtension(uint32_t msg_id); // Top 7 of 8 bits. Bottom Bit is for Request / Response
bool isRpcMsgIdResponse(uint32_t msg_id);
uint32_t constructMsgId(uint8_t ext, uint16_t service, uint8_t submsg, bool is_response);
/*** This can be overloaded for plugins
* Also allows a natural seperation of the full interface into sections.
*/

View File

@ -24,8 +24,9 @@
#include "rpc/rpcsetup.h"
#include "rpc/rpcserver.h"
#include "rpc/rpcecho.h"
#include "rpc/proto/rpcprotopeers.h"
#include "rpc/rpcecho.h"
RpcMediator *CreateRpcSystem(RpcComms *comms)
{
@ -33,6 +34,10 @@ RpcMediator *CreateRpcSystem(RpcComms *comms)
RpcServer *server = new RpcServer(med);
/* add services */
RpcProtoPeers *peers = new RpcProtoPeers(1);
server->addService(peers);
/* Finally an Echo Service - which will echo back any unprocesses commands. */
RpcEcho *echo = new RpcEcho(1);
server->addService(echo);