From 51362f7baca4c6363d8318bbce0a10c5e9a850e1 Mon Sep 17 00:00:00 2001 From: drbob Date: Fri, 21 Sep 2012 23:15:26 +0000 Subject: [PATCH] restored back to svn 5549, before chris changed random stuff... how / why? git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5581 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-nogui/src/menu/menus.cc | 17 +- retroshare-nogui/src/notifytxt.cc | 40 +- retroshare-nogui/src/retroshare.cc | 2 +- .../src/rpc/proto/gencc/core.pb.cc | 206 ++----- .../src/rpc/proto/gencc/system.pb.cc | 515 +++++++++++++++++- .../src/rpc/proto/rpcprotosystem.cc | 73 +++ retroshare-nogui/src/rpc/rpc.cc | 5 + retroshare-nogui/src/rpc/rpcserver.cc | 5 + retroshare-nogui/src/rpc/rpcsetup.cc | 10 +- 9 files changed, 701 insertions(+), 172 deletions(-) diff --git a/retroshare-nogui/src/menu/menus.cc b/retroshare-nogui/src/menu/menus.cc index fc3b95105..46e044aa6 100644 --- a/retroshare-nogui/src/menu/menus.cc +++ b/retroshare-nogui/src/menu/menus.cc @@ -84,7 +84,7 @@ Menu *CreateMenuStructure(NotifyTxt *notify) MenuList *search = new MenuListSearch(notify); MenuList *searchlist = new MenuListSearchList(notify); - search->addMenuItem(MENU_SEARCH_KEY_ADD, new MenuOpSearchNew()); + search->addMenuItem(MENU_SEARCH_KEY_ADD, new MenuOpSearchNew(notify)); //search->addMenuItem(MENU_SEARCH_KEY_REMOVE, new MenuOpSearchDelete()); search->addMenuItem(MENU_SEARCH_KEY_VIEW, searchlist); searchlist->addMenuItem(MENU_SEARCH_KEY_DOWNLOAD, new MenuOpSearchListDownload()); @@ -362,11 +362,17 @@ int MenuListSearch::removeSearch(std::string strSearchId) it = mSearchIds.find(strSearchId); if (it != mSearchIds.end()) { - /* cleanup local maps */ /* cancel search */ + // CAN'T DO!!! /* clear results from Notify Collector */ + mNotify->clearSearchId(it->second); + + /* cleanup local maps */ + mSearchIds.erase(it); + + /* cleanup terms maps (TODO) */ } return 1; @@ -392,6 +398,7 @@ uint32_t MenuOpSearchNew::process_lines(std::string input) std::string search = input.substr(0, input.size() - 1); // remove \n. uint32_t searchId = (uint32_t) rsTurtle->turtleSearch(search); + mNotify->collectSearchResults(searchId); /* store request in parent */ MenuListSearch *ms = dynamic_cast(parent()); @@ -645,7 +652,7 @@ int MenuListShared::getEntryDesc(int idx, std::string &desc) rsFiles->getSharedDirectories(dirs); std::list::iterator it; std::string shareflag; - unsigned int i=0; + int i=0; for (it = dirs.begin(); (i < idx) && (it != dirs.end()); it++, i++); if (it != dirs.end()) { @@ -675,7 +682,7 @@ int MenuListShared::unshareSelected() std::list dirs; rsFiles->getSharedDirectories(dirs); std::list::iterator it; - unsigned int i=0; + int i=0; for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++); if (it != dirs.end()) { @@ -696,7 +703,7 @@ int MenuListShared::toggleFlagSelected(uint32_t shareflags) std::list dirs; rsFiles->getSharedDirectories(dirs); std::list::iterator it; - unsigned int i=0; + int i=0; for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++); if (it != dirs.end()) { diff --git a/retroshare-nogui/src/notifytxt.cc b/retroshare-nogui/src/notifytxt.cc index 9bc01d1a4..9995d3ba3 100644 --- a/retroshare-nogui/src/notifytxt.cc +++ b/retroshare-nogui/src/notifytxt.cc @@ -230,8 +230,15 @@ void NotifyTxt::notifyTurtleSearchResult(uint32_t search_id,const std::listsecond.size(); } - -int NotifyTxt::clearSearchId(uint32_t searchId) + // only collect results for selected searches. + // will drop others. +int NotifyTxt::collectSearchResults(uint32_t searchId) { + std::cerr << "NotifyTxt::collectSearchResult(" << searchId << ")"; + std::cerr << std::endl; + RsStackMutex stack(mNotifyMtx); /****** LOCKED *****/ std::map >::iterator it; it = mSearchResults.find(searchId); if (it == mSearchResults.end()) { + std::list emptyList; + mSearchResults[searchId] = emptyList; + return 1; + } + + std::cerr << "NotifyTxt::collectSearchResult() ERROR Id exists"; + std::cerr << std::endl; + return 1; +} + +int NotifyTxt::clearSearchId(uint32_t searchId) +{ + std::cerr << "NotifyTxt::clearSearchId(" << searchId << ")"; + std::cerr << std::endl; + + RsStackMutex stack(mNotifyMtx); /****** LOCKED *****/ + + std::map >::iterator it; + it = mSearchResults.find(searchId); + if (it == mSearchResults.end()) + { + std::cerr << "NotifyTxt::clearSearchId() ERROR Id not there"; + std::cerr << std::endl; return 0; } diff --git a/retroshare-nogui/src/retroshare.cc b/retroshare-nogui/src/retroshare.cc index 36fd0172e..d1b6a5abd 100644 --- a/retroshare-nogui/src/retroshare.cc +++ b/retroshare-nogui/src/retroshare.cc @@ -388,7 +388,7 @@ int main(int argc, char **argv) if (enableRpc) { /* Build RPC Server */ - RpcMediator *med = CreateRpcSystem(ssh); + RpcMediator *med = CreateRpcSystem(ssh, notify); ssh->setRpcSystem(med); ssh->setSleepPeriods(0.01, 0.1); } diff --git a/retroshare-nogui/src/rpc/proto/gencc/core.pb.cc b/retroshare-nogui/src/rpc/proto/gencc/core.pb.cc index e95575c67..cb1061f88 100644 --- a/retroshare-nogui/src/rpc/proto/gencc/core.pb.cc +++ b/retroshare-nogui/src/rpc/proto/gencc/core.pb.cc @@ -134,12 +134,10 @@ void protobuf_AssignDesc_core_2eproto() { sizeof(Person)); Person_Relationship_descriptor_ = Person_descriptor_->enum_type(0); File_descriptor_ = file->message_type(4); - static const int File_offsets_[5] = { + static const int File_offsets_[3] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, name_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, hash_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, size_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, path_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(File, avail_), }; File_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( @@ -283,39 +281,39 @@ void protobuf_AddDesc_core_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\ncore.proto\022\013rsctrl.core\"\233\001\n\006Status\022,\n\004" + "\n\ncore.proto\022\013rsctrl.core\"\260\001\n\006Status\022,\n\004" "code\030\001 \002(\0162\036.rsctrl.core.Status.StatusCo" - "de\022\013\n\003msg\030\002 \001(\t\"V\n\nStatusCode\022\n\n\006FAILED\020" - "\000\022\017\n\013NO_IMPL_YET\020\001\022\021\n\rINVALID_QUERY\020\002\022\013\n" - "\007SUCCESS\020\003\022\013\n\007READMSG\020\004\")\n\006IpAddr\022\016\n\004add" - "r\030\001 \002(\t:\000\022\017\n\004port\030\002 \002(\r:\0010\"\303\001\n\010Location\022" - "\016\n\006ssl_id\030\001 \002(\t\022\020\n\010location\030\002 \002(\t\022&\n\tloc" - "aladdr\030\003 \002(\0132\023.rsctrl.core.IpAddr\022$\n\007ext" - "addr\030\004 \002(\0132\023.rsctrl.core.IpAddr\022\r\n\005state" - "\030\005 \002(\r\"8\n\nStateFlags\022\n\n\006ONLINE\020\001\022\r\n\tCONN" - "ECTED\020\002\022\017\n\013UNREACHABLE\020\004\"\340\001\n\006Person\022\016\n\006g" - "pg_id\030\001 \002(\t\022\014\n\004name\030\002 \002(\t\0222\n\010relation\030\003 " - "\002(\0162 .rsctrl.core.Person.Relationship\022(\n" - "\tlocations\030\004 \003(\0132\025.rsctrl.core.Location\"" - "Z\n\014Relationship\022\n\n\006FRIEND\020\001\022\032\n\026FRIEND_OF" - "_MANY_FRIENDS\020\002\022\025\n\021FRIEND_OF_FRIENDS\020\003\022\013" - "\n\007UNKNOWN\020\004\"M\n\004File\022\014\n\004name\030\001 \002(\t\022\014\n\004has" - "h\030\002 \002(\t\022\014\n\004size\030\003 \002(\003\022\014\n\004path\030\004 \001(\t\022\r\n\005a" - "vail\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.core.Dir" - "\022 \n\005files\030\004 \003(\0132\021.rsctrl.core.File\"\372\001\n\014S" - "ystemStatus\0225\n\nnet_status\030\001 \002(\0162!.rsctrl" - ".core.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_OFFL" - "INE\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_FO" - "RWARD\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\n" - "bandwidths\030\001 \003(\0132\026.rsctrl.core.Bandwidth" - "*\027\n\013ExtensionId\022\010\n\004CORE\020\000*6\n\tPackageId\022\t" - "\n\005PEERS\020\001\022\n\n\006SYSTEM\020\002\022\010\n\004CHAT\020\003\022\010\n\003GXS\020\350" - "\007", 1281); + "de\022\013\n\003msg\030\002 \001(\t\"k\n\nStatusCode\022\n\n\006FAILED\020" + "\000\022\017\n\013NO_IMPL_YET\020\001\022\021\n\rINVALID_QUERY\020\002\022\023\n" + "\017PARTIAL_SUCCESS\020\003\022\013\n\007SUCCESS\020\004\022\013\n\007READM" + "SG\020\005\")\n\006IpAddr\022\016\n\004addr\030\001 \002(\t:\000\022\017\n\004port\030\002" + " \002(\r:\0010\"\303\001\n\010Location\022\016\n\006ssl_id\030\001 \002(\t\022\020\n\010" + "location\030\002 \002(\t\022&\n\tlocaladdr\030\003 \002(\0132\023.rsct" + "rl.core.IpAddr\022$\n\007extaddr\030\004 \002(\0132\023.rsctrl" + ".core.IpAddr\022\r\n\005state\030\005 \002(\r\"8\n\nStateFlag" + "s\022\n\n\006ONLINE\020\001\022\r\n\tCONNECTED\020\002\022\017\n\013UNREACHA" + "BLE\020\004\"\340\001\n\006Person\022\016\n\006gpg_id\030\001 \002(\t\022\014\n\004name" + "\030\002 \002(\t\0222\n\010relation\030\003 \002(\0162 .rsctrl.core.P" + "erson.Relationship\022(\n\tlocations\030\004 \003(\0132\025." + "rsctrl.core.Location\"Z\n\014Relationship\022\n\n\006" + "FRIEND\020\001\022\032\n\026FRIEND_OF_MANY_FRIENDS\020\002\022\025\n\021" + "FRIEND_OF_FRIENDS\020\003\022\013\n\007UNKNOWN\020\004\"0\n\004File" + "\022\014\n\004name\030\001 \002(\t\022\014\n\004hash\030\002 \002(\t\022\014\n\004size\030\003 \002" + "(\004\"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.core.Dir\022 \n\005file" + "s\030\004 \003(\0132\021.rsctrl.core.File\"\372\001\n\014SystemSta" + "tus\0225\n\nnet_status\030\001 \002(\0162!.rsctrl.core.Sy" + "stemStatus.NetCode\022\013\n\003msg\030\002 \001(\t\"\245\001\n\007NetC" + "ode\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\017WARN" + "ING_RESTART\020\004\022\022\n\016WARNING_NATTED\020\005\022\021\n\rWAR" + "NING_NODHT\020\006\022\010\n\004GOOD\020\007\022\017\n\013ADV_FORWARD\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\nbandwidt" + "hs\030\001 \003(\0132\026.rsctrl.core.Bandwidth*\027\n\013Exte" + "nsionId\022\010\n\004CORE\020\000*M\n\tPackageId\022\t\n\005PEERS\020" + "\001\022\n\n\006SYSTEM\020\002\022\010\n\004CHAT\020\003\022\n\n\006SEARCH\020\004\022\t\n\005F" + "ILES\020\005\022\010\n\003GXS\020\350\007", 1296); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "core.proto", &protobuf_RegisterTypes); Status::default_instance_ = new Status(); @@ -368,6 +366,8 @@ bool PackageId_IsValid(int value) { case 1: case 2: case 3: + case 4: + case 5: case 1000: return true; default: @@ -389,6 +389,7 @@ bool Status_StatusCode_IsValid(int value) { case 2: case 3: case 4: + case 5: return true; default: return false; @@ -399,6 +400,7 @@ bool Status_StatusCode_IsValid(int value) { const Status_StatusCode Status::FAILED; const Status_StatusCode Status::NO_IMPL_YET; const Status_StatusCode Status::INVALID_QUERY; +const Status_StatusCode Status::PARTIAL_SUCCESS; const Status_StatusCode Status::SUCCESS; const Status_StatusCode Status::READMSG; const Status_StatusCode Status::StatusCode_MIN; @@ -1782,8 +1784,6 @@ void Person::Swap(Person* other) { const int File::kNameFieldNumber; const int File::kHashFieldNumber; const int File::kSizeFieldNumber; -const int File::kPathFieldNumber; -const int File::kAvailFieldNumber; #endif // !_MSC_VER File::File() @@ -1804,9 +1804,7 @@ void File::SharedCtor() { _cached_size_ = 0; name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); hash_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - size_ = GOOGLE_LONGLONG(0); - path_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - avail_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + size_ = GOOGLE_ULONGLONG(0); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -1821,12 +1819,6 @@ void File::SharedDtor() { if (hash_ != &::google::protobuf::internal::kEmptyString) { delete hash_; } - if (path_ != &::google::protobuf::internal::kEmptyString) { - delete path_; - } - if (avail_ != &::google::protobuf::internal::kEmptyString) { - delete avail_; - } if (this != default_instance_) { } } @@ -1863,17 +1855,7 @@ void File::Clear() { hash_->clear(); } } - size_ = GOOGLE_LONGLONG(0); - if (has_path()) { - if (path_ != &::google::protobuf::internal::kEmptyString) { - path_->clear(); - } - } - if (has_avail()) { - if (avail_ != &::google::protobuf::internal::kEmptyString) { - avail_->clear(); - } - } + size_ = GOOGLE_ULONGLONG(0); } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); @@ -1918,52 +1900,18 @@ bool File::MergePartialFromCodedStream( break; } - // required int64 size = 3; + // required uint64 size = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_size: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( input, &size_))); set_has_size(); } else { goto handle_uninterpreted; } - if (input->ExpectTag(34)) goto parse_path; - break; - } - - // optional string path = 4; - case 4: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_path: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_path())); - ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->path().data(), this->path().length(), - ::google::protobuf::internal::WireFormat::PARSE); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(42)) goto parse_avail; - break; - } - - // optional string avail = 5; - case 5: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_avail: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_avail())); - ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->avail().data(), this->avail().length(), - ::google::protobuf::internal::WireFormat::PARSE); - } else { - goto handle_uninterpreted; - } if (input->ExpectAtEnd()) return true; break; } @@ -2004,27 +1952,9 @@ void File::SerializeWithCachedSizes( 2, this->hash(), output); } - // required int64 size = 3; + // required uint64 size = 3; if (has_size()) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->size(), output); - } - - // optional string path = 4; - if (has_path()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->path().data(), this->path().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE); - ::google::protobuf::internal::WireFormatLite::WriteString( - 4, this->path(), output); - } - - // optional string avail = 5; - if (has_avail()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->avail().data(), this->avail().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE); - ::google::protobuf::internal::WireFormatLite::WriteString( - 5, this->avail(), output); + ::google::protobuf::internal::WireFormatLite::WriteUInt64(3, this->size(), output); } if (!unknown_fields().empty()) { @@ -2055,29 +1985,9 @@ void File::SerializeWithCachedSizes( 2, this->hash(), target); } - // required int64 size = 3; + // required uint64 size = 3; if (has_size()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->size(), target); - } - - // optional string path = 4; - if (has_path()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->path().data(), this->path().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 4, this->path(), target); - } - - // optional string avail = 5; - if (has_avail()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->avail().data(), this->avail().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 5, this->avail(), target); + target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(3, this->size(), target); } if (!unknown_fields().empty()) { @@ -2105,27 +2015,13 @@ int File::ByteSize() const { this->hash()); } - // required int64 size = 3; + // required uint64 size = 3; if (has_size()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( + ::google::protobuf::internal::WireFormatLite::UInt64Size( this->size()); } - // optional string path = 4; - if (has_path()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->path()); - } - - // optional string avail = 5; - if (has_avail()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->avail()); - } - } if (!unknown_fields().empty()) { total_size += @@ -2162,12 +2058,6 @@ void File::MergeFrom(const File& from) { if (from.has_size()) { set_size(from.size()); } - if (from.has_path()) { - set_path(from.path()); - } - if (from.has_avail()) { - set_avail(from.avail()); - } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } @@ -2195,8 +2085,6 @@ void File::Swap(File* other) { std::swap(name_, other->name_); std::swap(hash_, other->hash_); std::swap(size_, other->size_); - std::swap(path_, other->path_); - std::swap(avail_, other->avail_); std::swap(_has_bits_[0], other->_has_bits_[0]); _unknown_fields_.Swap(&other->_unknown_fields_); std::swap(_cached_size_, other->_cached_size_); diff --git a/retroshare-nogui/src/rpc/proto/gencc/system.pb.cc b/retroshare-nogui/src/rpc/proto/gencc/system.pb.cc index ca729ce8f..915d6affd 100644 --- a/retroshare-nogui/src/rpc/proto/gencc/system.pb.cc +++ b/retroshare-nogui/src/rpc/proto/gencc/system.pb.cc @@ -25,6 +25,13 @@ 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::Descriptor* RequestSystemQuit_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + RequestSystemQuit_reflection_ = NULL; +const ::google::protobuf::EnumDescriptor* RequestSystemQuit_QuitCode_descriptor_ = NULL; +const ::google::protobuf::Descriptor* ResponseSystemQuit_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ResponseSystemQuit_reflection_ = NULL; const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor_ = NULL; const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor_ = NULL; @@ -71,6 +78,37 @@ void protobuf_AssignDesc_system_2eproto() { ::google::protobuf::MessageFactory::generated_factory(), sizeof(ResponseSystemStatus)); ResponseSystemStatus_NetCode_descriptor_ = ResponseSystemStatus_descriptor_->enum_type(0); + RequestSystemQuit_descriptor_ = file->message_type(2); + static const int RequestSystemQuit_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemQuit, quit_code_), + }; + RequestSystemQuit_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + RequestSystemQuit_descriptor_, + RequestSystemQuit::default_instance_, + RequestSystemQuit_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemQuit, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestSystemQuit, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(RequestSystemQuit)); + RequestSystemQuit_QuitCode_descriptor_ = RequestSystemQuit_descriptor_->enum_type(0); + ResponseSystemQuit_descriptor_ = file->message_type(3); + static const int ResponseSystemQuit_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemQuit, status_), + }; + ResponseSystemQuit_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + ResponseSystemQuit_descriptor_, + ResponseSystemQuit::default_instance_, + ResponseSystemQuit_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemQuit, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseSystemQuit, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(ResponseSystemQuit)); RequestMsgIds_descriptor_ = file->enum_type(0); ResponseMsgIds_descriptor_ = file->enum_type(1); } @@ -89,6 +127,10 @@ void protobuf_RegisterTypes(const ::std::string&) { RequestSystemStatus_descriptor_, &RequestSystemStatus::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( ResponseSystemStatus_descriptor_, &ResponseSystemStatus::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + RequestSystemQuit_descriptor_, &RequestSystemQuit::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ResponseSystemQuit_descriptor_, &ResponseSystemQuit::default_instance()); } } // namespace @@ -98,6 +140,10 @@ void protobuf_ShutdownFile_system_2eproto() { delete RequestSystemStatus_reflection_; delete ResponseSystemStatus::default_instance_; delete ResponseSystemStatus_reflection_; + delete RequestSystemQuit::default_instance_; + delete RequestSystemQuit_reflection_; + delete ResponseSystemQuit::default_instance_; + delete ResponseSystemQuit_reflection_; } void protobuf_AddDesc_system_2eproto() { @@ -119,15 +165,25 @@ void protobuf_AddDesc_system_2eproto() { "\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); + "\010\"\201\001\n\021RequestSystemQuit\022<\n\tquit_code\030\001 \002" + "(\0162).rsctrl.system.RequestSystemQuit.Qui" + "tCode\".\n\010QuitCode\022\021\n\rCLOSE_CHANNEL\020\001\022\017\n\013" + "SHUTDOWN_RS\020\002\"9\n\022ResponseSystemQuit\022#\n\006s" + "tatus\030\001 \002(\0132\023.rsctrl.core.Status*K\n\rRequ" + "estMsgIds\022\035\n\031MsgId_RequestSystemStatus\020\001" + "\022\033\n\027MsgId_RequestSystemQuit\020\002*N\n\016Respons" + "eMsgIds\022\036\n\032MsgId_ResponseSystemStatus\020\001\022" + "\034\n\030MsgId_ResponseSystemQuit\020\002", 789); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "system.proto", &protobuf_RegisterTypes); RequestSystemStatus::default_instance_ = new RequestSystemStatus(); ResponseSystemStatus::default_instance_ = new ResponseSystemStatus(); + RequestSystemQuit::default_instance_ = new RequestSystemQuit(); + ResponseSystemQuit::default_instance_ = new ResponseSystemQuit(); RequestSystemStatus::default_instance_->InitAsDefaultInstance(); ResponseSystemStatus::default_instance_->InitAsDefaultInstance(); + RequestSystemQuit::default_instance_->InitAsDefaultInstance(); + ResponseSystemQuit::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_system_2eproto); } @@ -145,6 +201,7 @@ const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor() { bool RequestMsgIds_IsValid(int value) { switch(value) { case 1: + case 2: return true; default: return false; @@ -158,6 +215,7 @@ const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor() { bool ResponseMsgIds_IsValid(int value) { switch(value) { case 1: + case 2: return true; default: return false; @@ -745,6 +803,457 @@ void ResponseSystemStatus::Swap(ResponseSystemStatus* other) { } +// =================================================================== + +const ::google::protobuf::EnumDescriptor* RequestSystemQuit_QuitCode_descriptor() { + protobuf_AssignDescriptorsOnce(); + return RequestSystemQuit_QuitCode_descriptor_; +} +bool RequestSystemQuit_QuitCode_IsValid(int value) { + switch(value) { + case 1: + case 2: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const RequestSystemQuit_QuitCode RequestSystemQuit::CLOSE_CHANNEL; +const RequestSystemQuit_QuitCode RequestSystemQuit::SHUTDOWN_RS; +const RequestSystemQuit_QuitCode RequestSystemQuit::QuitCode_MIN; +const RequestSystemQuit_QuitCode RequestSystemQuit::QuitCode_MAX; +const int RequestSystemQuit::QuitCode_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int RequestSystemQuit::kQuitCodeFieldNumber; +#endif // !_MSC_VER + +RequestSystemQuit::RequestSystemQuit() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void RequestSystemQuit::InitAsDefaultInstance() { +} + +RequestSystemQuit::RequestSystemQuit(const RequestSystemQuit& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void RequestSystemQuit::SharedCtor() { + _cached_size_ = 0; + quit_code_ = 1; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +RequestSystemQuit::~RequestSystemQuit() { + SharedDtor(); +} + +void RequestSystemQuit::SharedDtor() { + if (this != default_instance_) { + } +} + +void RequestSystemQuit::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* RequestSystemQuit::descriptor() { + protobuf_AssignDescriptorsOnce(); + return RequestSystemQuit_descriptor_; +} + +const RequestSystemQuit& RequestSystemQuit::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_system_2eproto(); return *default_instance_; +} + +RequestSystemQuit* RequestSystemQuit::default_instance_ = NULL; + +RequestSystemQuit* RequestSystemQuit::New() const { + return new RequestSystemQuit; +} + +void RequestSystemQuit::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + quit_code_ = 1; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool RequestSystemQuit::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.system.RequestSystemQuit.QuitCode quit_code = 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::system::RequestSystemQuit_QuitCode_IsValid(value)) { + set_quit_code(static_cast< ::rsctrl::system::RequestSystemQuit_QuitCode >(value)); + } else { + mutable_unknown_fields()->AddVarint(1, value); + } + } 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 RequestSystemQuit::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1; + if (has_quit_code()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->quit_code(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* RequestSystemQuit::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1; + if (has_quit_code()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 1, this->quit_code(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int RequestSystemQuit::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1; + if (has_quit_code()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->quit_code()); + } + + } + 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 RequestSystemQuit::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const RequestSystemQuit* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void RequestSystemQuit::MergeFrom(const RequestSystemQuit& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_quit_code()) { + set_quit_code(from.quit_code()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void RequestSystemQuit::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void RequestSystemQuit::CopyFrom(const RequestSystemQuit& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool RequestSystemQuit::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + return true; +} + +void RequestSystemQuit::Swap(RequestSystemQuit* other) { + if (other != this) { + std::swap(quit_code_, other->quit_code_); + 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 RequestSystemQuit::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = RequestSystemQuit_descriptor_; + metadata.reflection = RequestSystemQuit_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ResponseSystemQuit::kStatusFieldNumber; +#endif // !_MSC_VER + +ResponseSystemQuit::ResponseSystemQuit() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void ResponseSystemQuit::InitAsDefaultInstance() { + status_ = const_cast< ::rsctrl::core::Status*>(&::rsctrl::core::Status::default_instance()); +} + +ResponseSystemQuit::ResponseSystemQuit(const ResponseSystemQuit& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void ResponseSystemQuit::SharedCtor() { + _cached_size_ = 0; + status_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ResponseSystemQuit::~ResponseSystemQuit() { + SharedDtor(); +} + +void ResponseSystemQuit::SharedDtor() { + if (this != default_instance_) { + delete status_; + } +} + +void ResponseSystemQuit::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ResponseSystemQuit::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ResponseSystemQuit_descriptor_; +} + +const ResponseSystemQuit& ResponseSystemQuit::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_system_2eproto(); return *default_instance_; +} + +ResponseSystemQuit* ResponseSystemQuit::default_instance_ = NULL; + +ResponseSystemQuit* ResponseSystemQuit::New() const { + return new ResponseSystemQuit; +} + +void ResponseSystemQuit::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_status()) { + if (status_ != NULL) status_->::rsctrl::core::Status::Clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool ResponseSystemQuit::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->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 ResponseSystemQuit::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); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* ResponseSystemQuit::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); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int ResponseSystemQuit::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()); + } + + } + 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 ResponseSystemQuit::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const ResponseSystemQuit* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ResponseSystemQuit::MergeFrom(const ResponseSystemQuit& 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()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void ResponseSystemQuit::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ResponseSystemQuit::CopyFrom(const ResponseSystemQuit& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ResponseSystemQuit::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + if (has_status()) { + if (!this->status().IsInitialized()) return false; + } + return true; +} + +void ResponseSystemQuit::Swap(ResponseSystemQuit* other) { + if (other != this) { + std::swap(status_, other->status_); + 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 ResponseSystemQuit::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ResponseSystemQuit_descriptor_; + metadata.reflection = ResponseSystemQuit_reflection_; + return metadata; +} + + // @@protoc_insertion_point(namespace_scope) } // namespace system diff --git a/retroshare-nogui/src/rpc/proto/rpcprotosystem.cc b/retroshare-nogui/src/rpc/proto/rpcprotosystem.cc index 29c7c5cbc..7a0e1e52a 100644 --- a/retroshare-nogui/src/rpc/proto/rpcprotosystem.cc +++ b/retroshare-nogui/src/rpc/proto/rpcprotosystem.cc @@ -86,6 +86,11 @@ int RpcProtoSystem::processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_i case rsctrl::system::MsgId_RequestSystemStatus: processSystemStatus(chan_id, msg_id, req_id, msg); break; +#if 0 + case rsctrl::system::MsgId_RequestSystemQuit: + processSystemQuit(chan_id, msg_id, req_id, msg); + break; +#endif default: std::cerr << "RpcProtoSystem::processMsg() ERROR should never get here"; std::cerr << std::endl; @@ -211,3 +216,71 @@ int RpcProtoSystem::processSystemStatus(uint32_t chan_id, uint32_t msg_id, uint3 } + +int RpcProtoSystem::processSystemQuit(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg) +{ + std::cerr << "RpcProtoSystem::processSystemQuit()"; + std::cerr << std::endl; + + // parse msg. + rsctrl::system::RequestSystemQuit req; + if (!req.ParseFromString(msg)) + { + std::cerr << "RpcProtoSystem::processSystemQuit() ERROR ParseFromString()"; + std::cerr << std::endl; + return 0; + } + + // NO Options... so go straight to answer. + // response. + rsctrl::system::ResponseSystemQuit resp; + bool success = true; + + switch(req.quit_code()) + { + default: + case rsctrl::system::RequestSystemQuit::CLOSE_CHANNEL: + { + RpcServer *server = getRpcServer(); + server->error(chan_id, "CLOSE_CHANNEL"); + + break; + } + case rsctrl::system::RequestSystemQuit::SHUTDOWN_RS: + { + rsicontrol->rsGlobalShutDown(); + break; + } + } + + 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::processSystemQuit() 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_ResponseSystemQuit, true); + + // queue it. + queueResponse(chan_id, out_msg_id, req_id, outmsg); + + return 1; +} + + diff --git a/retroshare-nogui/src/rpc/rpc.cc b/retroshare-nogui/src/rpc/rpc.cc index 6fd5a0b74..a1aa1683b 100644 --- a/retroshare-nogui/src/rpc/rpc.cc +++ b/retroshare-nogui/src/rpc/rpc.cc @@ -43,6 +43,11 @@ void RpcMediator::reset(uint32_t chan_id) mServer->reset(chan_id); } +int RpcMediator::error(uint32_t chan_id, std::string msg) +{ + return mComms->error(chan_id, msg); +} + int RpcMediator::tick() { diff --git a/retroshare-nogui/src/rpc/rpcserver.cc b/retroshare-nogui/src/rpc/rpcserver.cc index 484a7576e..a879e08df 100644 --- a/retroshare-nogui/src/rpc/rpcserver.cc +++ b/retroshare-nogui/src/rpc/rpcserver.cc @@ -63,11 +63,16 @@ void RpcServer::reset(uint32_t chan_id) return; } +int RpcServer::error(uint32_t chan_id, std::string msg) +{ + return mMediator->error(chan_id, msg); +} int RpcServer::addService(RpcService *service) { RsStackMutex stack(mRpcMtx); /********** LOCKED MUTEX ***************/ + service->setRpcServer(this); mAllServices.push_back(service); return 1; diff --git a/retroshare-nogui/src/rpc/rpcsetup.cc b/retroshare-nogui/src/rpc/rpcsetup.cc index 528f5b425..015d72142 100644 --- a/retroshare-nogui/src/rpc/rpcsetup.cc +++ b/retroshare-nogui/src/rpc/rpcsetup.cc @@ -27,10 +27,12 @@ #include "rpc/proto/rpcprotopeers.h" #include "rpc/proto/rpcprotosystem.h" #include "rpc/proto/rpcprotochat.h" +#include "rpc/proto/rpcprotosearch.h" +#include "rpc/proto/rpcprotofiles.h" #include "rpc/rpcecho.h" -RpcMediator *CreateRpcSystem(RpcComms *comms) +RpcMediator *CreateRpcSystem(RpcComms *comms, NotifyTxt *notify) { RpcMediator *med = new RpcMediator(comms); RpcServer *server = new RpcServer(med); @@ -45,6 +47,12 @@ RpcMediator *CreateRpcSystem(RpcComms *comms) RpcProtoChat *chat = new RpcProtoChat(1); server->addService(chat); + RpcProtoSearch *search = new RpcProtoSearch(1, notify); + server->addService(search); + + RpcProtoFiles *files = new RpcProtoFiles(1); + server->addService(files); + /* Finally an Echo Service - which will echo back any unprocesses commands. */ RpcEcho *echo = new RpcEcho(1); server->addService(echo);