mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
Added more RPC functionality:
* System: Quit & shutdown. * Search: New Search, List Searches, Close Search, Search Results. * Files: TranferLists, ControlDownloads (Start, Stop, Pause, etc). Changed the way NotifyTxt records search results. * Must register searchId for results to be saved. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5528 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
277b8e66ae
commit
a9f95289d0
@ -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<MenuListSearch *>(parent());
|
||||
@ -645,7 +652,7 @@ int MenuListShared::getEntryDesc(int idx, std::string &desc)
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
std::list<SharedDirInfo>::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<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
std::list<SharedDirInfo>::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<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
unsigned int i=0;
|
||||
int i=0;
|
||||
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
|
||||
if (it != dirs.end())
|
||||
{
|
||||
|
@ -159,11 +159,13 @@ class MenuOpSearchNew: public MenuOpLineInput
|
||||
{
|
||||
public:
|
||||
|
||||
MenuOpSearchNew() :MenuOpLineInput("New") { return; }
|
||||
MenuOpSearchNew(NotifyTxt *notify)
|
||||
:MenuOpLineInput("New"), mNotify(notify) { return; }
|
||||
virtual uint32_t process_lines(std::string input);
|
||||
virtual uint32_t drawPage(uint32_t drawFlags, std::string &buffer);
|
||||
|
||||
|
||||
private:
|
||||
NotifyTxt *mNotify;
|
||||
};
|
||||
|
||||
|
||||
|
@ -230,8 +230,15 @@ void NotifyTxt::notifyTurtleSearchResult(uint32_t search_id,const std::list<Turt
|
||||
it = mSearchResults.find(search_id);
|
||||
if (it == mSearchResults.end())
|
||||
{
|
||||
std::cerr << "NotifyTxt::notifyTurtleSearchResult() " << found_files.size();
|
||||
std::cerr << "ERROR: new results for Id: " << search_id;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "But list not installed...";
|
||||
std::cerr << " DROPPING SEARCH RESULTS";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* new entry */
|
||||
mSearchResults[search_id] = found_files;
|
||||
//mSearchResults[search_id] = found_files;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -288,15 +295,42 @@ int NotifyTxt::getSearchResultCount(uint32_t id)
|
||||
return it->second.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<uint32_t, std::list<TurtleFileInfo> >::iterator it;
|
||||
it = mSearchResults.find(searchId);
|
||||
if (it == mSearchResults.end())
|
||||
{
|
||||
std::list<TurtleFileInfo> 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<uint32_t, std::list<TurtleFileInfo> >::iterator it;
|
||||
it = mSearchResults.find(searchId);
|
||||
if (it == mSearchResults.end())
|
||||
{
|
||||
std::cerr << "NotifyTxt::clearSearchId() ERROR Id not there";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,14 @@ class NotifyTxt: public NotifyBase
|
||||
|
||||
/* interface for handling SearchResults */
|
||||
void getSearchIds(std::list<uint32_t> &searchIds);
|
||||
int getSearchResults(uint32_t id, std::list<TurtleFileInfo> &searchResults);
|
||||
int clearSearchId(uint32_t searchId);
|
||||
|
||||
int getSearchResultCount(uint32_t id);
|
||||
int getSearchResults(uint32_t id, std::list<TurtleFileInfo> &searchResults);
|
||||
|
||||
// only collect results for selected searches.
|
||||
// will drop others.
|
||||
int collectSearchResults(uint32_t searchId);
|
||||
int clearSearchId(uint32_t searchId);
|
||||
|
||||
|
||||
private:
|
||||
|
@ -187,21 +187,29 @@ protorpc {
|
||||
HEADERS += rpc/proto/rpcprotopeers.h \
|
||||
rpc/proto/rpcprotosystem.h \
|
||||
rpc/proto/rpcprotochat.h \
|
||||
rpc/proto/rpcprotosearch.h \
|
||||
rpc/proto/rpcprotofiles.h \
|
||||
|
||||
SOURCES += rpc/proto/rpcprotopeers.cc \
|
||||
rpc/proto/rpcprotosystem.cc \
|
||||
rpc/proto/rpcprotochat.cc \
|
||||
rpc/proto/rpcprotosearch.cc \
|
||||
rpc/proto/rpcprotofiles.cc \
|
||||
|
||||
# Generated ProtoBuf Code the RPC System
|
||||
HEADERS += rpc/proto/gencc/core.pb.h \
|
||||
rpc/proto/gencc/peers.pb.h \
|
||||
rpc/proto/gencc/system.pb.h \
|
||||
rpc/proto/gencc/chat.pb.h \
|
||||
rpc/proto/gencc/search.pb.h \
|
||||
rpc/proto/gencc/files.pb.h \
|
||||
|
||||
SOURCES += rpc/proto/gencc/core.pb.cc \
|
||||
rpc/proto/gencc/peers.pb.cc \
|
||||
rpc/proto/gencc/system.pb.cc \
|
||||
rpc/proto/gencc/chat.pb.cc \
|
||||
rpc/proto/gencc/search.pb.cc \
|
||||
rpc/proto/gencc/files.pb.cc \
|
||||
|
||||
QMAKE_CFLAGS += -pthread
|
||||
QMAKE_CXXFLAGS += -pthread
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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_);
|
||||
|
@ -47,8 +47,9 @@ enum Status_StatusCode {
|
||||
Status_StatusCode_FAILED = 0,
|
||||
Status_StatusCode_NO_IMPL_YET = 1,
|
||||
Status_StatusCode_INVALID_QUERY = 2,
|
||||
Status_StatusCode_SUCCESS = 3,
|
||||
Status_StatusCode_READMSG = 4
|
||||
Status_StatusCode_PARTIAL_SUCCESS = 3,
|
||||
Status_StatusCode_SUCCESS = 4,
|
||||
Status_StatusCode_READMSG = 5
|
||||
};
|
||||
bool Status_StatusCode_IsValid(int value);
|
||||
const Status_StatusCode Status_StatusCode_StatusCode_MIN = Status_StatusCode_FAILED;
|
||||
@ -154,6 +155,8 @@ enum PackageId {
|
||||
PEERS = 1,
|
||||
SYSTEM = 2,
|
||||
CHAT = 3,
|
||||
SEARCH = 4,
|
||||
FILES = 5,
|
||||
GXS = 1000
|
||||
};
|
||||
bool PackageId_IsValid(int value);
|
||||
@ -229,6 +232,7 @@ class Status : public ::google::protobuf::Message {
|
||||
static const StatusCode FAILED = Status_StatusCode_FAILED;
|
||||
static const StatusCode NO_IMPL_YET = Status_StatusCode_NO_IMPL_YET;
|
||||
static const StatusCode INVALID_QUERY = Status_StatusCode_INVALID_QUERY;
|
||||
static const StatusCode PARTIAL_SUCCESS = Status_StatusCode_PARTIAL_SUCCESS;
|
||||
static const StatusCode SUCCESS = Status_StatusCode_SUCCESS;
|
||||
static const StatusCode READMSG = Status_StatusCode_READMSG;
|
||||
static inline bool StatusCode_IsValid(int value) {
|
||||
@ -774,34 +778,12 @@ class File : public ::google::protobuf::Message {
|
||||
inline ::std::string* mutable_hash();
|
||||
inline ::std::string* release_hash();
|
||||
|
||||
// required int64 size = 3;
|
||||
// required uint64 size = 3;
|
||||
inline bool has_size() const;
|
||||
inline void clear_size();
|
||||
static const int kSizeFieldNumber = 3;
|
||||
inline ::google::protobuf::int64 size() const;
|
||||
inline void set_size(::google::protobuf::int64 value);
|
||||
|
||||
// optional string path = 4;
|
||||
inline bool has_path() const;
|
||||
inline void clear_path();
|
||||
static const int kPathFieldNumber = 4;
|
||||
inline const ::std::string& path() const;
|
||||
inline void set_path(const ::std::string& value);
|
||||
inline void set_path(const char* value);
|
||||
inline void set_path(const char* value, size_t size);
|
||||
inline ::std::string* mutable_path();
|
||||
inline ::std::string* release_path();
|
||||
|
||||
// optional string avail = 5;
|
||||
inline bool has_avail() const;
|
||||
inline void clear_avail();
|
||||
static const int kAvailFieldNumber = 5;
|
||||
inline const ::std::string& avail() const;
|
||||
inline void set_avail(const ::std::string& value);
|
||||
inline void set_avail(const char* value);
|
||||
inline void set_avail(const char* value, size_t size);
|
||||
inline ::std::string* mutable_avail();
|
||||
inline ::std::string* release_avail();
|
||||
inline ::google::protobuf::uint64 size() const;
|
||||
inline void set_size(::google::protobuf::uint64 value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.core.File)
|
||||
private:
|
||||
@ -811,21 +793,15 @@ class File : public ::google::protobuf::Message {
|
||||
inline void clear_has_hash();
|
||||
inline void set_has_size();
|
||||
inline void clear_has_size();
|
||||
inline void set_has_path();
|
||||
inline void clear_has_path();
|
||||
inline void set_has_avail();
|
||||
inline void clear_has_avail();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
::std::string* name_;
|
||||
::std::string* hash_;
|
||||
::google::protobuf::int64 size_;
|
||||
::std::string* path_;
|
||||
::std::string* avail_;
|
||||
::google::protobuf::uint64 size_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
|
||||
::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_core_2eproto();
|
||||
friend void protobuf_AssignDesc_core_2eproto();
|
||||
@ -1938,7 +1914,7 @@ inline ::std::string* File::release_hash() {
|
||||
}
|
||||
}
|
||||
|
||||
// required int64 size = 3;
|
||||
// required uint64 size = 3;
|
||||
inline bool File::has_size() const {
|
||||
return (_has_bits_[0] & 0x00000004u) != 0;
|
||||
}
|
||||
@ -1949,133 +1925,17 @@ inline void File::clear_has_size() {
|
||||
_has_bits_[0] &= ~0x00000004u;
|
||||
}
|
||||
inline void File::clear_size() {
|
||||
size_ = GOOGLE_LONGLONG(0);
|
||||
size_ = GOOGLE_ULONGLONG(0);
|
||||
clear_has_size();
|
||||
}
|
||||
inline ::google::protobuf::int64 File::size() const {
|
||||
inline ::google::protobuf::uint64 File::size() const {
|
||||
return size_;
|
||||
}
|
||||
inline void File::set_size(::google::protobuf::int64 value) {
|
||||
inline void File::set_size(::google::protobuf::uint64 value) {
|
||||
set_has_size();
|
||||
size_ = value;
|
||||
}
|
||||
|
||||
// optional string path = 4;
|
||||
inline bool File::has_path() const {
|
||||
return (_has_bits_[0] & 0x00000008u) != 0;
|
||||
}
|
||||
inline void File::set_has_path() {
|
||||
_has_bits_[0] |= 0x00000008u;
|
||||
}
|
||||
inline void File::clear_has_path() {
|
||||
_has_bits_[0] &= ~0x00000008u;
|
||||
}
|
||||
inline void File::clear_path() {
|
||||
if (path_ != &::google::protobuf::internal::kEmptyString) {
|
||||
path_->clear();
|
||||
}
|
||||
clear_has_path();
|
||||
}
|
||||
inline const ::std::string& File::path() const {
|
||||
return *path_;
|
||||
}
|
||||
inline void File::set_path(const ::std::string& value) {
|
||||
set_has_path();
|
||||
if (path_ == &::google::protobuf::internal::kEmptyString) {
|
||||
path_ = new ::std::string;
|
||||
}
|
||||
path_->assign(value);
|
||||
}
|
||||
inline void File::set_path(const char* value) {
|
||||
set_has_path();
|
||||
if (path_ == &::google::protobuf::internal::kEmptyString) {
|
||||
path_ = new ::std::string;
|
||||
}
|
||||
path_->assign(value);
|
||||
}
|
||||
inline void File::set_path(const char* value, size_t size) {
|
||||
set_has_path();
|
||||
if (path_ == &::google::protobuf::internal::kEmptyString) {
|
||||
path_ = new ::std::string;
|
||||
}
|
||||
path_->assign(reinterpret_cast<const char*>(value), size);
|
||||
}
|
||||
inline ::std::string* File::mutable_path() {
|
||||
set_has_path();
|
||||
if (path_ == &::google::protobuf::internal::kEmptyString) {
|
||||
path_ = new ::std::string;
|
||||
}
|
||||
return path_;
|
||||
}
|
||||
inline ::std::string* File::release_path() {
|
||||
clear_has_path();
|
||||
if (path_ == &::google::protobuf::internal::kEmptyString) {
|
||||
return NULL;
|
||||
} else {
|
||||
::std::string* temp = path_;
|
||||
path_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
// optional string avail = 5;
|
||||
inline bool File::has_avail() const {
|
||||
return (_has_bits_[0] & 0x00000010u) != 0;
|
||||
}
|
||||
inline void File::set_has_avail() {
|
||||
_has_bits_[0] |= 0x00000010u;
|
||||
}
|
||||
inline void File::clear_has_avail() {
|
||||
_has_bits_[0] &= ~0x00000010u;
|
||||
}
|
||||
inline void File::clear_avail() {
|
||||
if (avail_ != &::google::protobuf::internal::kEmptyString) {
|
||||
avail_->clear();
|
||||
}
|
||||
clear_has_avail();
|
||||
}
|
||||
inline const ::std::string& File::avail() const {
|
||||
return *avail_;
|
||||
}
|
||||
inline void File::set_avail(const ::std::string& value) {
|
||||
set_has_avail();
|
||||
if (avail_ == &::google::protobuf::internal::kEmptyString) {
|
||||
avail_ = new ::std::string;
|
||||
}
|
||||
avail_->assign(value);
|
||||
}
|
||||
inline void File::set_avail(const char* value) {
|
||||
set_has_avail();
|
||||
if (avail_ == &::google::protobuf::internal::kEmptyString) {
|
||||
avail_ = new ::std::string;
|
||||
}
|
||||
avail_->assign(value);
|
||||
}
|
||||
inline void File::set_avail(const char* value, size_t size) {
|
||||
set_has_avail();
|
||||
if (avail_ == &::google::protobuf::internal::kEmptyString) {
|
||||
avail_ = new ::std::string;
|
||||
}
|
||||
avail_->assign(reinterpret_cast<const char*>(value), size);
|
||||
}
|
||||
inline ::std::string* File::mutable_avail() {
|
||||
set_has_avail();
|
||||
if (avail_ == &::google::protobuf::internal::kEmptyString) {
|
||||
avail_ = new ::std::string;
|
||||
}
|
||||
return avail_;
|
||||
}
|
||||
inline ::std::string* File::release_avail() {
|
||||
clear_has_avail();
|
||||
if (avail_ == &::google::protobuf::internal::kEmptyString) {
|
||||
return NULL;
|
||||
} else {
|
||||
::std::string* temp = avail_;
|
||||
avail_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// Dir
|
||||
|
1594
retroshare-nogui/src/rpc/proto/gencc/files.pb.cc
Normal file
1594
retroshare-nogui/src/rpc/proto/gencc/files.pb.cc
Normal file
File diff suppressed because it is too large
Load Diff
930
retroshare-nogui/src/rpc/proto/gencc/files.pb.h
Normal file
930
retroshare-nogui/src/rpc/proto/gencc/files.pb.h
Normal file
@ -0,0 +1,930 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: files.proto
|
||||
|
||||
#ifndef PROTOBUF_files_2eproto__INCLUDED
|
||||
#define PROTOBUF_files_2eproto__INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
#if GOOGLE_PROTOBUF_VERSION < 2004000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 2004001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/repeated_field.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include "core.pb.h"
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace rsctrl {
|
||||
namespace files {
|
||||
|
||||
// Internal implementation detail -- do not call these.
|
||||
void protobuf_AddDesc_files_2eproto();
|
||||
void protobuf_AssignDesc_files_2eproto();
|
||||
void protobuf_ShutdownFile_files_2eproto();
|
||||
|
||||
class FileTransfer;
|
||||
class RequestTransferList;
|
||||
class ResponseTransferList;
|
||||
class RequestControlDownload;
|
||||
class ResponseControlDownload;
|
||||
|
||||
enum RequestControlDownload_Action {
|
||||
RequestControlDownload_Action_ACTION_START = 1,
|
||||
RequestControlDownload_Action_ACTION_CONTINUE = 2,
|
||||
RequestControlDownload_Action_ACTION_WAIT = 3,
|
||||
RequestControlDownload_Action_ACTION_PAUSE = 4,
|
||||
RequestControlDownload_Action_ACTION_RESTART = 5,
|
||||
RequestControlDownload_Action_ACTION_CHECK = 6,
|
||||
RequestControlDownload_Action_ACTION_CANCEL = 7
|
||||
};
|
||||
bool RequestControlDownload_Action_IsValid(int value);
|
||||
const RequestControlDownload_Action RequestControlDownload_Action_Action_MIN = RequestControlDownload_Action_ACTION_START;
|
||||
const RequestControlDownload_Action RequestControlDownload_Action_Action_MAX = RequestControlDownload_Action_ACTION_CANCEL;
|
||||
const int RequestControlDownload_Action_Action_ARRAYSIZE = RequestControlDownload_Action_Action_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* RequestControlDownload_Action_descriptor();
|
||||
inline const ::std::string& RequestControlDownload_Action_Name(RequestControlDownload_Action value) {
|
||||
return ::google::protobuf::internal::NameOfEnum(
|
||||
RequestControlDownload_Action_descriptor(), value);
|
||||
}
|
||||
inline bool RequestControlDownload_Action_Parse(
|
||||
const ::std::string& name, RequestControlDownload_Action* value) {
|
||||
return ::google::protobuf::internal::ParseNamedEnum<RequestControlDownload_Action>(
|
||||
RequestControlDownload_Action_descriptor(), name, value);
|
||||
}
|
||||
enum RequestMsgIds {
|
||||
MsgId_RequestTransferList = 1,
|
||||
MsgId_RequestControlDownload = 2
|
||||
};
|
||||
bool RequestMsgIds_IsValid(int value);
|
||||
const RequestMsgIds RequestMsgIds_MIN = MsgId_RequestTransferList;
|
||||
const RequestMsgIds RequestMsgIds_MAX = MsgId_RequestControlDownload;
|
||||
const int RequestMsgIds_ARRAYSIZE = RequestMsgIds_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor();
|
||||
inline const ::std::string& RequestMsgIds_Name(RequestMsgIds value) {
|
||||
return ::google::protobuf::internal::NameOfEnum(
|
||||
RequestMsgIds_descriptor(), value);
|
||||
}
|
||||
inline bool RequestMsgIds_Parse(
|
||||
const ::std::string& name, RequestMsgIds* value) {
|
||||
return ::google::protobuf::internal::ParseNamedEnum<RequestMsgIds>(
|
||||
RequestMsgIds_descriptor(), name, value);
|
||||
}
|
||||
enum ResponseMsgIds {
|
||||
MsgId_ResponseTransferList = 1,
|
||||
MsgId_ResponseControlDownload = 2
|
||||
};
|
||||
bool ResponseMsgIds_IsValid(int value);
|
||||
const ResponseMsgIds ResponseMsgIds_MIN = MsgId_ResponseTransferList;
|
||||
const ResponseMsgIds ResponseMsgIds_MAX = MsgId_ResponseControlDownload;
|
||||
const int ResponseMsgIds_ARRAYSIZE = ResponseMsgIds_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor();
|
||||
inline const ::std::string& ResponseMsgIds_Name(ResponseMsgIds value) {
|
||||
return ::google::protobuf::internal::NameOfEnum(
|
||||
ResponseMsgIds_descriptor(), value);
|
||||
}
|
||||
inline bool ResponseMsgIds_Parse(
|
||||
const ::std::string& name, ResponseMsgIds* value) {
|
||||
return ::google::protobuf::internal::ParseNamedEnum<ResponseMsgIds>(
|
||||
ResponseMsgIds_descriptor(), name, value);
|
||||
}
|
||||
enum Direction {
|
||||
DIRECTION_UPLOAD = 1,
|
||||
DIRECTION_DOWNLOAD = 2
|
||||
};
|
||||
bool Direction_IsValid(int value);
|
||||
const Direction Direction_MIN = DIRECTION_UPLOAD;
|
||||
const Direction Direction_MAX = DIRECTION_DOWNLOAD;
|
||||
const int Direction_ARRAYSIZE = Direction_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* Direction_descriptor();
|
||||
inline const ::std::string& Direction_Name(Direction value) {
|
||||
return ::google::protobuf::internal::NameOfEnum(
|
||||
Direction_descriptor(), value);
|
||||
}
|
||||
inline bool Direction_Parse(
|
||||
const ::std::string& name, Direction* value) {
|
||||
return ::google::protobuf::internal::ParseNamedEnum<Direction>(
|
||||
Direction_descriptor(), name, value);
|
||||
}
|
||||
// ===================================================================
|
||||
|
||||
class FileTransfer : public ::google::protobuf::Message {
|
||||
public:
|
||||
FileTransfer();
|
||||
virtual ~FileTransfer();
|
||||
|
||||
FileTransfer(const FileTransfer& from);
|
||||
|
||||
inline FileTransfer& operator=(const FileTransfer& 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 FileTransfer& default_instance();
|
||||
|
||||
void Swap(FileTransfer* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
FileTransfer* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const FileTransfer& from);
|
||||
void MergeFrom(const FileTransfer& 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 .rsctrl.core.File file = 1;
|
||||
inline bool has_file() const;
|
||||
inline void clear_file();
|
||||
static const int kFileFieldNumber = 1;
|
||||
inline const ::rsctrl::core::File& file() const;
|
||||
inline ::rsctrl::core::File* mutable_file();
|
||||
inline ::rsctrl::core::File* release_file();
|
||||
|
||||
// required .rsctrl.files.Direction direction = 2;
|
||||
inline bool has_direction() const;
|
||||
inline void clear_direction();
|
||||
static const int kDirectionFieldNumber = 2;
|
||||
inline rsctrl::files::Direction direction() const;
|
||||
inline void set_direction(rsctrl::files::Direction value);
|
||||
|
||||
// required float fraction = 3;
|
||||
inline bool has_fraction() const;
|
||||
inline void clear_fraction();
|
||||
static const int kFractionFieldNumber = 3;
|
||||
inline float fraction() const;
|
||||
inline void set_fraction(float value);
|
||||
|
||||
// required float rate_kBs = 4;
|
||||
inline bool has_rate_kbs() const;
|
||||
inline void clear_rate_kbs();
|
||||
static const int kRateKBsFieldNumber = 4;
|
||||
inline float rate_kbs() const;
|
||||
inline void set_rate_kbs(float value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.files.FileTransfer)
|
||||
private:
|
||||
inline void set_has_file();
|
||||
inline void clear_has_file();
|
||||
inline void set_has_direction();
|
||||
inline void clear_has_direction();
|
||||
inline void set_has_fraction();
|
||||
inline void clear_has_fraction();
|
||||
inline void set_has_rate_kbs();
|
||||
inline void clear_has_rate_kbs();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
::rsctrl::core::File* file_;
|
||||
int direction_;
|
||||
float fraction_;
|
||||
float rate_kbs_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_files_2eproto();
|
||||
friend void protobuf_AssignDesc_files_2eproto();
|
||||
friend void protobuf_ShutdownFile_files_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static FileTransfer* default_instance_;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class RequestTransferList : public ::google::protobuf::Message {
|
||||
public:
|
||||
RequestTransferList();
|
||||
virtual ~RequestTransferList();
|
||||
|
||||
RequestTransferList(const RequestTransferList& from);
|
||||
|
||||
inline RequestTransferList& operator=(const RequestTransferList& 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 RequestTransferList& default_instance();
|
||||
|
||||
void Swap(RequestTransferList* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
RequestTransferList* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const RequestTransferList& from);
|
||||
void MergeFrom(const RequestTransferList& 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 .rsctrl.files.Direction direction = 1;
|
||||
inline bool has_direction() const;
|
||||
inline void clear_direction();
|
||||
static const int kDirectionFieldNumber = 1;
|
||||
inline rsctrl::files::Direction direction() const;
|
||||
inline void set_direction(rsctrl::files::Direction value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.files.RequestTransferList)
|
||||
private:
|
||||
inline void set_has_direction();
|
||||
inline void clear_has_direction();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
int direction_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_files_2eproto();
|
||||
friend void protobuf_AssignDesc_files_2eproto();
|
||||
friend void protobuf_ShutdownFile_files_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static RequestTransferList* default_instance_;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class ResponseTransferList : public ::google::protobuf::Message {
|
||||
public:
|
||||
ResponseTransferList();
|
||||
virtual ~ResponseTransferList();
|
||||
|
||||
ResponseTransferList(const ResponseTransferList& from);
|
||||
|
||||
inline ResponseTransferList& operator=(const ResponseTransferList& 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 ResponseTransferList& default_instance();
|
||||
|
||||
void Swap(ResponseTransferList* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
ResponseTransferList* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const ResponseTransferList& from);
|
||||
void MergeFrom(const ResponseTransferList& 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 .rsctrl.core.Status status = 1;
|
||||
inline bool has_status() const;
|
||||
inline void clear_status();
|
||||
static const int kStatusFieldNumber = 1;
|
||||
inline const ::rsctrl::core::Status& status() const;
|
||||
inline ::rsctrl::core::Status* mutable_status();
|
||||
inline ::rsctrl::core::Status* release_status();
|
||||
|
||||
// repeated .rsctrl.files.FileTransfer transfers = 2;
|
||||
inline int transfers_size() const;
|
||||
inline void clear_transfers();
|
||||
static const int kTransfersFieldNumber = 2;
|
||||
inline const ::rsctrl::files::FileTransfer& transfers(int index) const;
|
||||
inline ::rsctrl::files::FileTransfer* mutable_transfers(int index);
|
||||
inline ::rsctrl::files::FileTransfer* add_transfers();
|
||||
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::files::FileTransfer >&
|
||||
transfers() const;
|
||||
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::files::FileTransfer >*
|
||||
mutable_transfers();
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.files.ResponseTransferList)
|
||||
private:
|
||||
inline void set_has_status();
|
||||
inline void clear_has_status();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
::rsctrl::core::Status* status_;
|
||||
::google::protobuf::RepeatedPtrField< ::rsctrl::files::FileTransfer > transfers_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_files_2eproto();
|
||||
friend void protobuf_AssignDesc_files_2eproto();
|
||||
friend void protobuf_ShutdownFile_files_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static ResponseTransferList* default_instance_;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class RequestControlDownload : public ::google::protobuf::Message {
|
||||
public:
|
||||
RequestControlDownload();
|
||||
virtual ~RequestControlDownload();
|
||||
|
||||
RequestControlDownload(const RequestControlDownload& from);
|
||||
|
||||
inline RequestControlDownload& operator=(const RequestControlDownload& 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 RequestControlDownload& default_instance();
|
||||
|
||||
void Swap(RequestControlDownload* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
RequestControlDownload* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const RequestControlDownload& from);
|
||||
void MergeFrom(const RequestControlDownload& 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 RequestControlDownload_Action Action;
|
||||
static const Action ACTION_START = RequestControlDownload_Action_ACTION_START;
|
||||
static const Action ACTION_CONTINUE = RequestControlDownload_Action_ACTION_CONTINUE;
|
||||
static const Action ACTION_WAIT = RequestControlDownload_Action_ACTION_WAIT;
|
||||
static const Action ACTION_PAUSE = RequestControlDownload_Action_ACTION_PAUSE;
|
||||
static const Action ACTION_RESTART = RequestControlDownload_Action_ACTION_RESTART;
|
||||
static const Action ACTION_CHECK = RequestControlDownload_Action_ACTION_CHECK;
|
||||
static const Action ACTION_CANCEL = RequestControlDownload_Action_ACTION_CANCEL;
|
||||
static inline bool Action_IsValid(int value) {
|
||||
return RequestControlDownload_Action_IsValid(value);
|
||||
}
|
||||
static const Action Action_MIN =
|
||||
RequestControlDownload_Action_Action_MIN;
|
||||
static const Action Action_MAX =
|
||||
RequestControlDownload_Action_Action_MAX;
|
||||
static const int Action_ARRAYSIZE =
|
||||
RequestControlDownload_Action_Action_ARRAYSIZE;
|
||||
static inline const ::google::protobuf::EnumDescriptor*
|
||||
Action_descriptor() {
|
||||
return RequestControlDownload_Action_descriptor();
|
||||
}
|
||||
static inline const ::std::string& Action_Name(Action value) {
|
||||
return RequestControlDownload_Action_Name(value);
|
||||
}
|
||||
static inline bool Action_Parse(const ::std::string& name,
|
||||
Action* value) {
|
||||
return RequestControlDownload_Action_Parse(name, value);
|
||||
}
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// required .rsctrl.core.File file = 1;
|
||||
inline bool has_file() const;
|
||||
inline void clear_file();
|
||||
static const int kFileFieldNumber = 1;
|
||||
inline const ::rsctrl::core::File& file() const;
|
||||
inline ::rsctrl::core::File* mutable_file();
|
||||
inline ::rsctrl::core::File* release_file();
|
||||
|
||||
// required .rsctrl.files.RequestControlDownload.Action action = 2;
|
||||
inline bool has_action() const;
|
||||
inline void clear_action();
|
||||
static const int kActionFieldNumber = 2;
|
||||
inline ::rsctrl::files::RequestControlDownload_Action action() const;
|
||||
inline void set_action(::rsctrl::files::RequestControlDownload_Action value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.files.RequestControlDownload)
|
||||
private:
|
||||
inline void set_has_file();
|
||||
inline void clear_has_file();
|
||||
inline void set_has_action();
|
||||
inline void clear_has_action();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
::rsctrl::core::File* file_;
|
||||
int action_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_files_2eproto();
|
||||
friend void protobuf_AssignDesc_files_2eproto();
|
||||
friend void protobuf_ShutdownFile_files_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static RequestControlDownload* default_instance_;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class ResponseControlDownload : public ::google::protobuf::Message {
|
||||
public:
|
||||
ResponseControlDownload();
|
||||
virtual ~ResponseControlDownload();
|
||||
|
||||
ResponseControlDownload(const ResponseControlDownload& from);
|
||||
|
||||
inline ResponseControlDownload& operator=(const ResponseControlDownload& 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 ResponseControlDownload& default_instance();
|
||||
|
||||
void Swap(ResponseControlDownload* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
ResponseControlDownload* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const ResponseControlDownload& from);
|
||||
void MergeFrom(const ResponseControlDownload& 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 .rsctrl.core.Status status = 1;
|
||||
inline bool has_status() const;
|
||||
inline void clear_status();
|
||||
static const int kStatusFieldNumber = 1;
|
||||
inline const ::rsctrl::core::Status& status() const;
|
||||
inline ::rsctrl::core::Status* mutable_status();
|
||||
inline ::rsctrl::core::Status* release_status();
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.files.ResponseControlDownload)
|
||||
private:
|
||||
inline void set_has_status();
|
||||
inline void clear_has_status();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
::rsctrl::core::Status* status_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_files_2eproto();
|
||||
friend void protobuf_AssignDesc_files_2eproto();
|
||||
friend void protobuf_ShutdownFile_files_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static ResponseControlDownload* default_instance_;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
// FileTransfer
|
||||
|
||||
// required .rsctrl.core.File file = 1;
|
||||
inline bool FileTransfer::has_file() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void FileTransfer::set_has_file() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void FileTransfer::clear_has_file() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void FileTransfer::clear_file() {
|
||||
if (file_ != NULL) file_->::rsctrl::core::File::Clear();
|
||||
clear_has_file();
|
||||
}
|
||||
inline const ::rsctrl::core::File& FileTransfer::file() const {
|
||||
return file_ != NULL ? *file_ : *default_instance_->file_;
|
||||
}
|
||||
inline ::rsctrl::core::File* FileTransfer::mutable_file() {
|
||||
set_has_file();
|
||||
if (file_ == NULL) file_ = new ::rsctrl::core::File;
|
||||
return file_;
|
||||
}
|
||||
inline ::rsctrl::core::File* FileTransfer::release_file() {
|
||||
clear_has_file();
|
||||
::rsctrl::core::File* temp = file_;
|
||||
file_ = NULL;
|
||||
return temp;
|
||||
}
|
||||
|
||||
// required .rsctrl.files.Direction direction = 2;
|
||||
inline bool FileTransfer::has_direction() const {
|
||||
return (_has_bits_[0] & 0x00000002u) != 0;
|
||||
}
|
||||
inline void FileTransfer::set_has_direction() {
|
||||
_has_bits_[0] |= 0x00000002u;
|
||||
}
|
||||
inline void FileTransfer::clear_has_direction() {
|
||||
_has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
inline void FileTransfer::clear_direction() {
|
||||
direction_ = 1;
|
||||
clear_has_direction();
|
||||
}
|
||||
inline rsctrl::files::Direction FileTransfer::direction() const {
|
||||
return static_cast< rsctrl::files::Direction >(direction_);
|
||||
}
|
||||
inline void FileTransfer::set_direction(rsctrl::files::Direction value) {
|
||||
GOOGLE_DCHECK(rsctrl::files::Direction_IsValid(value));
|
||||
set_has_direction();
|
||||
direction_ = value;
|
||||
}
|
||||
|
||||
// required float fraction = 3;
|
||||
inline bool FileTransfer::has_fraction() const {
|
||||
return (_has_bits_[0] & 0x00000004u) != 0;
|
||||
}
|
||||
inline void FileTransfer::set_has_fraction() {
|
||||
_has_bits_[0] |= 0x00000004u;
|
||||
}
|
||||
inline void FileTransfer::clear_has_fraction() {
|
||||
_has_bits_[0] &= ~0x00000004u;
|
||||
}
|
||||
inline void FileTransfer::clear_fraction() {
|
||||
fraction_ = 0;
|
||||
clear_has_fraction();
|
||||
}
|
||||
inline float FileTransfer::fraction() const {
|
||||
return fraction_;
|
||||
}
|
||||
inline void FileTransfer::set_fraction(float value) {
|
||||
set_has_fraction();
|
||||
fraction_ = value;
|
||||
}
|
||||
|
||||
// required float rate_kBs = 4;
|
||||
inline bool FileTransfer::has_rate_kbs() const {
|
||||
return (_has_bits_[0] & 0x00000008u) != 0;
|
||||
}
|
||||
inline void FileTransfer::set_has_rate_kbs() {
|
||||
_has_bits_[0] |= 0x00000008u;
|
||||
}
|
||||
inline void FileTransfer::clear_has_rate_kbs() {
|
||||
_has_bits_[0] &= ~0x00000008u;
|
||||
}
|
||||
inline void FileTransfer::clear_rate_kbs() {
|
||||
rate_kbs_ = 0;
|
||||
clear_has_rate_kbs();
|
||||
}
|
||||
inline float FileTransfer::rate_kbs() const {
|
||||
return rate_kbs_;
|
||||
}
|
||||
inline void FileTransfer::set_rate_kbs(float value) {
|
||||
set_has_rate_kbs();
|
||||
rate_kbs_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// RequestTransferList
|
||||
|
||||
// required .rsctrl.files.Direction direction = 1;
|
||||
inline bool RequestTransferList::has_direction() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void RequestTransferList::set_has_direction() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void RequestTransferList::clear_has_direction() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void RequestTransferList::clear_direction() {
|
||||
direction_ = 1;
|
||||
clear_has_direction();
|
||||
}
|
||||
inline rsctrl::files::Direction RequestTransferList::direction() const {
|
||||
return static_cast< rsctrl::files::Direction >(direction_);
|
||||
}
|
||||
inline void RequestTransferList::set_direction(rsctrl::files::Direction value) {
|
||||
GOOGLE_DCHECK(rsctrl::files::Direction_IsValid(value));
|
||||
set_has_direction();
|
||||
direction_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// ResponseTransferList
|
||||
|
||||
// required .rsctrl.core.Status status = 1;
|
||||
inline bool ResponseTransferList::has_status() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void ResponseTransferList::set_has_status() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void ResponseTransferList::clear_has_status() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void ResponseTransferList::clear_status() {
|
||||
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
|
||||
clear_has_status();
|
||||
}
|
||||
inline const ::rsctrl::core::Status& ResponseTransferList::status() const {
|
||||
return status_ != NULL ? *status_ : *default_instance_->status_;
|
||||
}
|
||||
inline ::rsctrl::core::Status* ResponseTransferList::mutable_status() {
|
||||
set_has_status();
|
||||
if (status_ == NULL) status_ = new ::rsctrl::core::Status;
|
||||
return status_;
|
||||
}
|
||||
inline ::rsctrl::core::Status* ResponseTransferList::release_status() {
|
||||
clear_has_status();
|
||||
::rsctrl::core::Status* temp = status_;
|
||||
status_ = NULL;
|
||||
return temp;
|
||||
}
|
||||
|
||||
// repeated .rsctrl.files.FileTransfer transfers = 2;
|
||||
inline int ResponseTransferList::transfers_size() const {
|
||||
return transfers_.size();
|
||||
}
|
||||
inline void ResponseTransferList::clear_transfers() {
|
||||
transfers_.Clear();
|
||||
}
|
||||
inline const ::rsctrl::files::FileTransfer& ResponseTransferList::transfers(int index) const {
|
||||
return transfers_.Get(index);
|
||||
}
|
||||
inline ::rsctrl::files::FileTransfer* ResponseTransferList::mutable_transfers(int index) {
|
||||
return transfers_.Mutable(index);
|
||||
}
|
||||
inline ::rsctrl::files::FileTransfer* ResponseTransferList::add_transfers() {
|
||||
return transfers_.Add();
|
||||
}
|
||||
inline const ::google::protobuf::RepeatedPtrField< ::rsctrl::files::FileTransfer >&
|
||||
ResponseTransferList::transfers() const {
|
||||
return transfers_;
|
||||
}
|
||||
inline ::google::protobuf::RepeatedPtrField< ::rsctrl::files::FileTransfer >*
|
||||
ResponseTransferList::mutable_transfers() {
|
||||
return &transfers_;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// RequestControlDownload
|
||||
|
||||
// required .rsctrl.core.File file = 1;
|
||||
inline bool RequestControlDownload::has_file() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void RequestControlDownload::set_has_file() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void RequestControlDownload::clear_has_file() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void RequestControlDownload::clear_file() {
|
||||
if (file_ != NULL) file_->::rsctrl::core::File::Clear();
|
||||
clear_has_file();
|
||||
}
|
||||
inline const ::rsctrl::core::File& RequestControlDownload::file() const {
|
||||
return file_ != NULL ? *file_ : *default_instance_->file_;
|
||||
}
|
||||
inline ::rsctrl::core::File* RequestControlDownload::mutable_file() {
|
||||
set_has_file();
|
||||
if (file_ == NULL) file_ = new ::rsctrl::core::File;
|
||||
return file_;
|
||||
}
|
||||
inline ::rsctrl::core::File* RequestControlDownload::release_file() {
|
||||
clear_has_file();
|
||||
::rsctrl::core::File* temp = file_;
|
||||
file_ = NULL;
|
||||
return temp;
|
||||
}
|
||||
|
||||
// required .rsctrl.files.RequestControlDownload.Action action = 2;
|
||||
inline bool RequestControlDownload::has_action() const {
|
||||
return (_has_bits_[0] & 0x00000002u) != 0;
|
||||
}
|
||||
inline void RequestControlDownload::set_has_action() {
|
||||
_has_bits_[0] |= 0x00000002u;
|
||||
}
|
||||
inline void RequestControlDownload::clear_has_action() {
|
||||
_has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
inline void RequestControlDownload::clear_action() {
|
||||
action_ = 1;
|
||||
clear_has_action();
|
||||
}
|
||||
inline ::rsctrl::files::RequestControlDownload_Action RequestControlDownload::action() const {
|
||||
return static_cast< ::rsctrl::files::RequestControlDownload_Action >(action_);
|
||||
}
|
||||
inline void RequestControlDownload::set_action(::rsctrl::files::RequestControlDownload_Action value) {
|
||||
GOOGLE_DCHECK(::rsctrl::files::RequestControlDownload_Action_IsValid(value));
|
||||
set_has_action();
|
||||
action_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// ResponseControlDownload
|
||||
|
||||
// required .rsctrl.core.Status status = 1;
|
||||
inline bool ResponseControlDownload::has_status() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void ResponseControlDownload::set_has_status() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void ResponseControlDownload::clear_has_status() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void ResponseControlDownload::clear_status() {
|
||||
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
|
||||
clear_has_status();
|
||||
}
|
||||
inline const ::rsctrl::core::Status& ResponseControlDownload::status() const {
|
||||
return status_ != NULL ? *status_ : *default_instance_->status_;
|
||||
}
|
||||
inline ::rsctrl::core::Status* ResponseControlDownload::mutable_status() {
|
||||
set_has_status();
|
||||
if (status_ == NULL) status_ = new ::rsctrl::core::Status;
|
||||
return status_;
|
||||
}
|
||||
inline ::rsctrl::core::Status* ResponseControlDownload::release_status() {
|
||||
clear_has_status();
|
||||
::rsctrl::core::Status* temp = status_;
|
||||
status_ = NULL;
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace files
|
||||
} // namespace rsctrl
|
||||
|
||||
#ifndef SWIG
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< ::rsctrl::files::RequestControlDownload_Action>() {
|
||||
return ::rsctrl::files::RequestControlDownload_Action_descriptor();
|
||||
}
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::files::RequestMsgIds>() {
|
||||
return rsctrl::files::RequestMsgIds_descriptor();
|
||||
}
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::files::ResponseMsgIds>() {
|
||||
return rsctrl::files::ResponseMsgIds_descriptor();
|
||||
}
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::files::Direction>() {
|
||||
return rsctrl::files::Direction_descriptor();
|
||||
}
|
||||
|
||||
} // namespace google
|
||||
} // namespace protobuf
|
||||
#endif // SWIG
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#endif // PROTOBUF_files_2eproto__INCLUDED
|
2437
retroshare-nogui/src/rpc/proto/gencc/search.pb.cc
Normal file
2437
retroshare-nogui/src/rpc/proto/gencc/search.pb.cc
Normal file
File diff suppressed because it is too large
Load Diff
1370
retroshare-nogui/src/rpc/proto/gencc/search.pb.h
Normal file
1370
retroshare-nogui/src/rpc/proto/gencc/search.pb.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -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<const RequestSystemQuit*>(
|
||||
&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<const ResponseSystemQuit*>(
|
||||
&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
|
||||
|
@ -36,6 +36,8 @@ void protobuf_ShutdownFile_system_2eproto();
|
||||
|
||||
class RequestSystemStatus;
|
||||
class ResponseSystemStatus;
|
||||
class RequestSystemQuit;
|
||||
class ResponseSystemQuit;
|
||||
|
||||
enum ResponseSystemStatus_NetCode {
|
||||
ResponseSystemStatus_NetCode_BAD_UNKNOWN = 0,
|
||||
@ -63,12 +65,32 @@ inline bool ResponseSystemStatus_NetCode_Parse(
|
||||
return ::google::protobuf::internal::ParseNamedEnum<ResponseSystemStatus_NetCode>(
|
||||
ResponseSystemStatus_NetCode_descriptor(), name, value);
|
||||
}
|
||||
enum RequestSystemQuit_QuitCode {
|
||||
RequestSystemQuit_QuitCode_CLOSE_CHANNEL = 1,
|
||||
RequestSystemQuit_QuitCode_SHUTDOWN_RS = 2
|
||||
};
|
||||
bool RequestSystemQuit_QuitCode_IsValid(int value);
|
||||
const RequestSystemQuit_QuitCode RequestSystemQuit_QuitCode_QuitCode_MIN = RequestSystemQuit_QuitCode_CLOSE_CHANNEL;
|
||||
const RequestSystemQuit_QuitCode RequestSystemQuit_QuitCode_QuitCode_MAX = RequestSystemQuit_QuitCode_SHUTDOWN_RS;
|
||||
const int RequestSystemQuit_QuitCode_QuitCode_ARRAYSIZE = RequestSystemQuit_QuitCode_QuitCode_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* RequestSystemQuit_QuitCode_descriptor();
|
||||
inline const ::std::string& RequestSystemQuit_QuitCode_Name(RequestSystemQuit_QuitCode value) {
|
||||
return ::google::protobuf::internal::NameOfEnum(
|
||||
RequestSystemQuit_QuitCode_descriptor(), value);
|
||||
}
|
||||
inline bool RequestSystemQuit_QuitCode_Parse(
|
||||
const ::std::string& name, RequestSystemQuit_QuitCode* value) {
|
||||
return ::google::protobuf::internal::ParseNamedEnum<RequestSystemQuit_QuitCode>(
|
||||
RequestSystemQuit_QuitCode_descriptor(), name, value);
|
||||
}
|
||||
enum RequestMsgIds {
|
||||
MsgId_RequestSystemStatus = 1
|
||||
MsgId_RequestSystemStatus = 1,
|
||||
MsgId_RequestSystemQuit = 2
|
||||
};
|
||||
bool RequestMsgIds_IsValid(int value);
|
||||
const RequestMsgIds RequestMsgIds_MIN = MsgId_RequestSystemStatus;
|
||||
const RequestMsgIds RequestMsgIds_MAX = MsgId_RequestSystemStatus;
|
||||
const RequestMsgIds RequestMsgIds_MAX = MsgId_RequestSystemQuit;
|
||||
const int RequestMsgIds_ARRAYSIZE = RequestMsgIds_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* RequestMsgIds_descriptor();
|
||||
@ -82,11 +104,12 @@ inline bool RequestMsgIds_Parse(
|
||||
RequestMsgIds_descriptor(), name, value);
|
||||
}
|
||||
enum ResponseMsgIds {
|
||||
MsgId_ResponseSystemStatus = 1
|
||||
MsgId_ResponseSystemStatus = 1,
|
||||
MsgId_ResponseSystemQuit = 2
|
||||
};
|
||||
bool ResponseMsgIds_IsValid(int value);
|
||||
const ResponseMsgIds ResponseMsgIds_MIN = MsgId_ResponseSystemStatus;
|
||||
const ResponseMsgIds ResponseMsgIds_MAX = MsgId_ResponseSystemStatus;
|
||||
const ResponseMsgIds ResponseMsgIds_MAX = MsgId_ResponseSystemQuit;
|
||||
const int ResponseMsgIds_ARRAYSIZE = ResponseMsgIds_MAX + 1;
|
||||
|
||||
const ::google::protobuf::EnumDescriptor* ResponseMsgIds_descriptor();
|
||||
@ -326,6 +349,195 @@ class ResponseSystemStatus : public ::google::protobuf::Message {
|
||||
void InitAsDefaultInstance();
|
||||
static ResponseSystemStatus* default_instance_;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class RequestSystemQuit : public ::google::protobuf::Message {
|
||||
public:
|
||||
RequestSystemQuit();
|
||||
virtual ~RequestSystemQuit();
|
||||
|
||||
RequestSystemQuit(const RequestSystemQuit& from);
|
||||
|
||||
inline RequestSystemQuit& operator=(const RequestSystemQuit& 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 RequestSystemQuit& default_instance();
|
||||
|
||||
void Swap(RequestSystemQuit* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
RequestSystemQuit* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const RequestSystemQuit& from);
|
||||
void MergeFrom(const RequestSystemQuit& 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 RequestSystemQuit_QuitCode QuitCode;
|
||||
static const QuitCode CLOSE_CHANNEL = RequestSystemQuit_QuitCode_CLOSE_CHANNEL;
|
||||
static const QuitCode SHUTDOWN_RS = RequestSystemQuit_QuitCode_SHUTDOWN_RS;
|
||||
static inline bool QuitCode_IsValid(int value) {
|
||||
return RequestSystemQuit_QuitCode_IsValid(value);
|
||||
}
|
||||
static const QuitCode QuitCode_MIN =
|
||||
RequestSystemQuit_QuitCode_QuitCode_MIN;
|
||||
static const QuitCode QuitCode_MAX =
|
||||
RequestSystemQuit_QuitCode_QuitCode_MAX;
|
||||
static const int QuitCode_ARRAYSIZE =
|
||||
RequestSystemQuit_QuitCode_QuitCode_ARRAYSIZE;
|
||||
static inline const ::google::protobuf::EnumDescriptor*
|
||||
QuitCode_descriptor() {
|
||||
return RequestSystemQuit_QuitCode_descriptor();
|
||||
}
|
||||
static inline const ::std::string& QuitCode_Name(QuitCode value) {
|
||||
return RequestSystemQuit_QuitCode_Name(value);
|
||||
}
|
||||
static inline bool QuitCode_Parse(const ::std::string& name,
|
||||
QuitCode* value) {
|
||||
return RequestSystemQuit_QuitCode_Parse(name, value);
|
||||
}
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1;
|
||||
inline bool has_quit_code() const;
|
||||
inline void clear_quit_code();
|
||||
static const int kQuitCodeFieldNumber = 1;
|
||||
inline ::rsctrl::system::RequestSystemQuit_QuitCode quit_code() const;
|
||||
inline void set_quit_code(::rsctrl::system::RequestSystemQuit_QuitCode value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.system.RequestSystemQuit)
|
||||
private:
|
||||
inline void set_has_quit_code();
|
||||
inline void clear_has_quit_code();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
int quit_code_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_system_2eproto();
|
||||
friend void protobuf_AssignDesc_system_2eproto();
|
||||
friend void protobuf_ShutdownFile_system_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static RequestSystemQuit* default_instance_;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class ResponseSystemQuit : public ::google::protobuf::Message {
|
||||
public:
|
||||
ResponseSystemQuit();
|
||||
virtual ~ResponseSystemQuit();
|
||||
|
||||
ResponseSystemQuit(const ResponseSystemQuit& from);
|
||||
|
||||
inline ResponseSystemQuit& operator=(const ResponseSystemQuit& 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 ResponseSystemQuit& default_instance();
|
||||
|
||||
void Swap(ResponseSystemQuit* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
ResponseSystemQuit* New() const;
|
||||
void CopyFrom(const ::google::protobuf::Message& from);
|
||||
void MergeFrom(const ::google::protobuf::Message& from);
|
||||
void CopyFrom(const ResponseSystemQuit& from);
|
||||
void MergeFrom(const ResponseSystemQuit& 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 .rsctrl.core.Status status = 1;
|
||||
inline bool has_status() const;
|
||||
inline void clear_status();
|
||||
static const int kStatusFieldNumber = 1;
|
||||
inline const ::rsctrl::core::Status& status() const;
|
||||
inline ::rsctrl::core::Status* mutable_status();
|
||||
inline ::rsctrl::core::Status* release_status();
|
||||
|
||||
// @@protoc_insertion_point(class_scope:rsctrl.system.ResponseSystemQuit)
|
||||
private:
|
||||
inline void set_has_status();
|
||||
inline void clear_has_status();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
::rsctrl::core::Status* status_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
|
||||
|
||||
friend void protobuf_AddDesc_system_2eproto();
|
||||
friend void protobuf_AssignDesc_system_2eproto();
|
||||
friend void protobuf_ShutdownFile_system_2eproto();
|
||||
|
||||
void InitAsDefaultInstance();
|
||||
static ResponseSystemQuit* default_instance_;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
@ -462,6 +674,66 @@ inline ::rsctrl::core::Bandwidth* ResponseSystemStatus::release_bw_total() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// RequestSystemQuit
|
||||
|
||||
// required .rsctrl.system.RequestSystemQuit.QuitCode quit_code = 1;
|
||||
inline bool RequestSystemQuit::has_quit_code() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void RequestSystemQuit::set_has_quit_code() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void RequestSystemQuit::clear_has_quit_code() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void RequestSystemQuit::clear_quit_code() {
|
||||
quit_code_ = 1;
|
||||
clear_has_quit_code();
|
||||
}
|
||||
inline ::rsctrl::system::RequestSystemQuit_QuitCode RequestSystemQuit::quit_code() const {
|
||||
return static_cast< ::rsctrl::system::RequestSystemQuit_QuitCode >(quit_code_);
|
||||
}
|
||||
inline void RequestSystemQuit::set_quit_code(::rsctrl::system::RequestSystemQuit_QuitCode value) {
|
||||
GOOGLE_DCHECK(::rsctrl::system::RequestSystemQuit_QuitCode_IsValid(value));
|
||||
set_has_quit_code();
|
||||
quit_code_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// ResponseSystemQuit
|
||||
|
||||
// required .rsctrl.core.Status status = 1;
|
||||
inline bool ResponseSystemQuit::has_status() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void ResponseSystemQuit::set_has_status() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void ResponseSystemQuit::clear_has_status() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void ResponseSystemQuit::clear_status() {
|
||||
if (status_ != NULL) status_->::rsctrl::core::Status::Clear();
|
||||
clear_has_status();
|
||||
}
|
||||
inline const ::rsctrl::core::Status& ResponseSystemQuit::status() const {
|
||||
return status_ != NULL ? *status_ : *default_instance_->status_;
|
||||
}
|
||||
inline ::rsctrl::core::Status* ResponseSystemQuit::mutable_status() {
|
||||
set_has_status();
|
||||
if (status_ == NULL) status_ = new ::rsctrl::core::Status;
|
||||
return status_;
|
||||
}
|
||||
inline ::rsctrl::core::Status* ResponseSystemQuit::release_status() {
|
||||
clear_has_status();
|
||||
::rsctrl::core::Status* temp = status_;
|
||||
status_ = NULL;
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
@ -477,6 +749,10 @@ inline const EnumDescriptor* GetEnumDescriptor< ::rsctrl::system::ResponseSystem
|
||||
return ::rsctrl::system::ResponseSystemStatus_NetCode_descriptor();
|
||||
}
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< ::rsctrl::system::RequestSystemQuit_QuitCode>() {
|
||||
return ::rsctrl::system::RequestSystemQuit_QuitCode_descriptor();
|
||||
}
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< rsctrl::system::RequestMsgIds>() {
|
||||
return rsctrl::system::RequestMsgIds_descriptor();
|
||||
}
|
||||
|
344
retroshare-nogui/src/rpc/proto/rpcprotofiles.cc
Normal file
344
retroshare-nogui/src/rpc/proto/rpcprotofiles.cc
Normal file
@ -0,0 +1,344 @@
|
||||
/*
|
||||
* RetroShare External Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rpc/proto/rpcprotofiles.h"
|
||||
#include "rpc/proto/gencc/files.pb.h"
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
||||
#include "util/rsstring.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <set>
|
||||
|
||||
|
||||
RpcProtoFiles::RpcProtoFiles(uint32_t serviceId)
|
||||
:RpcQueueService(serviceId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int RpcProtoFiles::processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
/* check the msgId */
|
||||
uint8_t topbyte = getRpcMsgIdExtension(msg_id);
|
||||
uint16_t service = getRpcMsgIdService(msg_id);
|
||||
uint8_t submsg = getRpcMsgIdSubMsg(msg_id);
|
||||
bool isResponse = isRpcMsgIdResponse(msg_id);
|
||||
|
||||
|
||||
std::cerr << "RpcProtoFiles::processMsg() topbyte: " << (int32_t) topbyte;
|
||||
std::cerr << " service: " << (int32_t) service << " submsg: " << (int32_t) submsg;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (isResponse)
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processMsg() isResponse() - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (topbyte != (uint8_t) rsctrl::core::CORE)
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processMsg() Extension Mismatch - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (service != (uint16_t) rsctrl::core::FILES)
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processMsg() Service Mismatch - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!rsctrl::files::RequestMsgIds_IsValid(submsg))
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processMsg() SubMsg Mismatch - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(submsg)
|
||||
{
|
||||
case rsctrl::files::MsgId_RequestTransferList:
|
||||
processReqTransferList(chan_id, msg_id, req_id, msg);
|
||||
break;
|
||||
|
||||
case rsctrl::files::MsgId_RequestControlDownload:
|
||||
processReqControlDownload(chan_id, msg_id, req_id, msg);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "RpcProtoFiles::processMsg() ERROR should never get here";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* must have matched id to get here */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int RpcProtoFiles::processReqTransferList(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processReqTransferList()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// parse msg.
|
||||
rsctrl::files::RequestTransferList req;
|
||||
if (!req.ParseFromString(msg))
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processReqTransferList() ERROR ParseFromString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// response.
|
||||
rsctrl::files::ResponseTransferList resp;
|
||||
bool success = true;
|
||||
std::string errorMsg;
|
||||
|
||||
std::list<std::string> file_list;
|
||||
int hints = 0;
|
||||
|
||||
/* convert msg parameters into local ones */
|
||||
switch(req.direction())
|
||||
{
|
||||
case rsctrl::files::DIRECTION_UPLOAD:
|
||||
{
|
||||
rsFiles->FileUploads(file_list);
|
||||
hints = RS_FILE_HINTS_UPLOAD;
|
||||
break;
|
||||
}
|
||||
case rsctrl::files::DIRECTION_DOWNLOAD:
|
||||
{
|
||||
rsFiles->FileDownloads(file_list);
|
||||
hints = RS_FILE_HINTS_DOWNLOAD;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
std::cerr << "RpcProtoFiles::processReqTransferList() ERROR Unknown Dir";
|
||||
std::cerr << std::endl;
|
||||
success = false;
|
||||
errorMsg = "Unknown Direction";
|
||||
break;
|
||||
}
|
||||
|
||||
std::list<std::string>::iterator lit;
|
||||
for(lit = file_list.begin(); lit != file_list.end(); lit++)
|
||||
{
|
||||
rsctrl::files::FileTransfer *transfer = resp.add_transfers();
|
||||
transfer->set_direction(req.direction());
|
||||
|
||||
FileInfo info;
|
||||
if (!rsFiles->FileDetails(*lit, hints, info))
|
||||
{
|
||||
/* error */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* copy file details */
|
||||
rsctrl::core::File *filedetails = transfer->mutable_file();
|
||||
filedetails->set_hash(info.hash);
|
||||
filedetails->set_size(info.size);
|
||||
filedetails->set_name(info.fname);
|
||||
|
||||
transfer->set_fraction( (float) info.transfered / info.size );
|
||||
transfer->set_rate_kbs( info.tfRate );
|
||||
}
|
||||
|
||||
/* DONE - Generate Reply */
|
||||
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(errorMsg);
|
||||
}
|
||||
|
||||
std::string outmsg;
|
||||
if (!resp.SerializeToString(&outmsg))
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processReqTransferList() ERROR SerialiseToString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Correctly Name Message.
|
||||
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::FILES,
|
||||
rsctrl::files::MsgId_ResponseTransferList, true);
|
||||
|
||||
// queue it.
|
||||
queueResponse(chan_id, out_msg_id, req_id, outmsg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RpcProtoFiles::processReqControlDownload(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processReqControlDownload()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// parse msg.
|
||||
rsctrl::files::RequestControlDownload req;
|
||||
if (!req.ParseFromString(msg))
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processReqControlDownload() ERROR ParseFromString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// response.
|
||||
rsctrl::files::ResponseControlDownload resp;
|
||||
bool success = true;
|
||||
std::string errorMsg;
|
||||
|
||||
std::string filehash = req.file().hash();
|
||||
switch(req.action())
|
||||
{
|
||||
case rsctrl::files::RequestControlDownload::ACTION_START:
|
||||
{
|
||||
std::list<std::string> srcIds;
|
||||
|
||||
std::string filename = req.file().name();
|
||||
uint64_t filesize = req.file().size();
|
||||
|
||||
// We Set NETWORK_WIDE flag here -> as files will be found via search.
|
||||
// If this changes, we might be adjust flag (or pass it in!)
|
||||
if (!rsFiles -> FileRequest(filename, filehash, filesize,
|
||||
"", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "FileRequest ERROR";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rsctrl::files::RequestControlDownload::ACTION_CONTINUE:
|
||||
{
|
||||
if (!rsFiles->changeQueuePosition(filehash,QUEUE_TOP))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "File QueuePosition(Top) ERROR";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rsctrl::files::RequestControlDownload::ACTION_WAIT:
|
||||
{
|
||||
if (!rsFiles->changeQueuePosition(filehash,QUEUE_BOTTOM))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "File QueuePosition(Bottom) ERROR";
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rsctrl::files::RequestControlDownload::ACTION_PAUSE:
|
||||
{
|
||||
if (!rsFiles->FileControl(filehash,RS_FILE_CTRL_PAUSE))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "FileControl(Pause) ERROR";
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rsctrl::files::RequestControlDownload::ACTION_RESTART:
|
||||
{
|
||||
if (!rsFiles->FileControl(filehash,RS_FILE_CTRL_START))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "FileControl(Start) ERROR";
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rsctrl::files::RequestControlDownload::ACTION_CHECK:
|
||||
{
|
||||
if (!rsFiles->FileControl(filehash,RS_FILE_CTRL_FORCE_CHECK))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "FileControl(Check) ERROR";
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rsctrl::files::RequestControlDownload::ACTION_CANCEL:
|
||||
{
|
||||
if (!rsFiles->FileCancel(filehash))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "FileCancel ERROR";
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
success = false;
|
||||
errorMsg = "Invalid Action";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* DONE - Generate Reply */
|
||||
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(errorMsg);
|
||||
}
|
||||
|
||||
std::string outmsg;
|
||||
if (!resp.SerializeToString(&outmsg))
|
||||
{
|
||||
std::cerr << "RpcProtoFiles::processReqControlDownload() ERROR SerialiseToString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Correctly Name Message.
|
||||
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::FILES,
|
||||
rsctrl::files::MsgId_ResponseControlDownload, true);
|
||||
|
||||
// queue it.
|
||||
queueResponse(chan_id, out_msg_id, req_id, outmsg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/***** HELPER FUNCTIONS *****/
|
||||
|
44
retroshare-nogui/src/rpc/proto/rpcprotofiles.h
Normal file
44
retroshare-nogui/src/rpc/proto/rpcprotofiles.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* RetroShare External Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RS_RPC_PROTO_FILES_H
|
||||
#define RS_RPC_PROTO_FILES_H
|
||||
|
||||
#include "rpc/rpcserver.h"
|
||||
|
||||
class RpcProtoFiles: public RpcQueueService
|
||||
{
|
||||
public:
|
||||
RpcProtoFiles(uint32_t serviceId);
|
||||
|
||||
virtual int processMsg(uint32_t chan_id, uint32_t msgId, uint32_t req_id, const std::string &msg);
|
||||
|
||||
protected:
|
||||
|
||||
int processReqTransferList(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
int processReqControlDownload(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
|
||||
};
|
||||
|
||||
#endif /* RS_PROTO_FILES_H */
|
593
retroshare-nogui/src/rpc/proto/rpcprotosearch.cc
Normal file
593
retroshare-nogui/src/rpc/proto/rpcprotosearch.cc
Normal file
@ -0,0 +1,593 @@
|
||||
/*
|
||||
* RetroShare External Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rpc/proto/rpcprotosearch.h"
|
||||
#include "rpc/proto/gencc/search.pb.h"
|
||||
|
||||
#include "notifytxt.h"
|
||||
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <retroshare/rsexpr.h>
|
||||
|
||||
#include "util/rsstring.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <set>
|
||||
|
||||
|
||||
RpcProtoSearch::RpcProtoSearch(uint32_t serviceId, NotifyTxt *notify)
|
||||
:RpcQueueService(serviceId), mNotify(notify), searchMtx("RpcProtoSearch")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void RpcProtoSearch::reset(uint32_t chan_id)
|
||||
{
|
||||
RpcQueueService::reset(chan_id);
|
||||
|
||||
/* must clear all searches */
|
||||
clear_searches(chan_id);
|
||||
}
|
||||
|
||||
|
||||
int RpcProtoSearch::processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
/* check the msgId */
|
||||
uint8_t topbyte = getRpcMsgIdExtension(msg_id);
|
||||
uint16_t service = getRpcMsgIdService(msg_id);
|
||||
uint8_t submsg = getRpcMsgIdSubMsg(msg_id);
|
||||
bool isResponse = isRpcMsgIdResponse(msg_id);
|
||||
|
||||
|
||||
std::cerr << "RpcProtoSearch::processMsg() topbyte: " << (int32_t) topbyte;
|
||||
std::cerr << " service: " << (int32_t) service << " submsg: " << (int32_t) submsg;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (isResponse)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processMsg() isResponse() - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (topbyte != (uint8_t) rsctrl::core::CORE)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processMsg() Extension Mismatch - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (service != (uint16_t) rsctrl::core::SEARCH)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processMsg() Service Mismatch - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!rsctrl::search::RequestMsgIds_IsValid(submsg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processMsg() SubMsg Mismatch - not processing";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(submsg)
|
||||
{
|
||||
case rsctrl::search::MsgId_RequestBasicSearch:
|
||||
processReqBasicSearch(chan_id, msg_id, req_id, msg);
|
||||
break;
|
||||
|
||||
case rsctrl::search::MsgId_RequestCloseSearch:
|
||||
processReqCloseSearch(chan_id, msg_id, req_id, msg);
|
||||
break;
|
||||
|
||||
case rsctrl::search::MsgId_RequestListSearches:
|
||||
processReqListSearches(chan_id, msg_id, req_id, msg);
|
||||
break;
|
||||
|
||||
case rsctrl::search::MsgId_RequestSearchResults:
|
||||
processReqSearchResults(chan_id, msg_id, req_id, msg);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "RpcProtoSearch::processMsg() ERROR should never get here";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* must have matched id to get here */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int RpcProtoSearch::processReqBasicSearch(uint32_t chan_id, uint32_t /* msg_id */, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqBasicSearch()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// parse msg.
|
||||
rsctrl::search::RequestBasicSearch req;
|
||||
if (!req.ParseFromString(msg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqBasicSearch() ERROR ParseFromString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// response.
|
||||
rsctrl::search::ResponseSearchIds resp;
|
||||
bool success = true;
|
||||
std::string errorMsg;
|
||||
|
||||
/* convert msg parameters into local ones */
|
||||
std::list<std::string> terms;
|
||||
|
||||
int no_terms = req.terms_size();
|
||||
for(int i = 0; i < no_terms; i++)
|
||||
{
|
||||
std::string term = req.terms(i);
|
||||
/* check for valid term? */
|
||||
if (term.size() > 0)
|
||||
{
|
||||
terms.push_back(term);
|
||||
}
|
||||
}
|
||||
|
||||
NameExpression nameexp(ContainsAllStrings, terms, true);
|
||||
LinearizedExpression lexpr;
|
||||
nameexp.linearize(lexpr);
|
||||
|
||||
uint32_t searchId = (uint32_t) rsTurtle->turtleSearch(lexpr);
|
||||
mNotify->collectSearchResults(searchId);
|
||||
|
||||
/* add into search array */
|
||||
add_search(chan_id, searchId);
|
||||
|
||||
/* add to answer */
|
||||
resp.add_search_id(searchId);
|
||||
|
||||
/* DONE - Generate Reply */
|
||||
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(errorMsg);
|
||||
}
|
||||
|
||||
std::string outmsg;
|
||||
if (!resp.SerializeToString(&outmsg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqBasicSearch() ERROR SerialiseToString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Correctly Name Message.
|
||||
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::SEARCH,
|
||||
rsctrl::search::MsgId_ResponseSearchIds, true);
|
||||
|
||||
// queue it.
|
||||
queueResponse(chan_id, out_msg_id, req_id, outmsg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RpcProtoSearch::processReqCloseSearch(uint32_t chan_id, uint32_t /* msg_id */, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqCloseSearch()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// parse msg.
|
||||
rsctrl::search::RequestCloseSearch req;
|
||||
if (!req.ParseFromString(msg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqCloseSearch() ERROR ParseFromString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// response.
|
||||
rsctrl::search::ResponseSearchIds resp;
|
||||
bool success = true;
|
||||
std::string errorMsg;
|
||||
|
||||
/* convert msg parameters into local ones */
|
||||
uint32_t searchId = req.search_id();
|
||||
|
||||
|
||||
/* remove into search array */
|
||||
if (!remove_search(chan_id, searchId))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "Unknown SearchId in List";
|
||||
}
|
||||
|
||||
/* clear search results
|
||||
* we cannot cancel a turtle search
|
||||
* so we tell notify to ignore further results
|
||||
*/
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (!mNotify->clearSearchId(searchId))
|
||||
{
|
||||
success = false;
|
||||
errorMsg = "Unknown SearchId in Notify";
|
||||
}
|
||||
}
|
||||
|
||||
/* add to answer */
|
||||
if (success)
|
||||
{
|
||||
resp.add_search_id(searchId);
|
||||
}
|
||||
|
||||
/* DONE - Generate Reply */
|
||||
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(errorMsg);
|
||||
}
|
||||
|
||||
std::string outmsg;
|
||||
if (!resp.SerializeToString(&outmsg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqCloseSearch() ERROR SerialiseToString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Correctly Name Message.
|
||||
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::SEARCH,
|
||||
rsctrl::search::MsgId_ResponseSearchIds, true);
|
||||
|
||||
// queue it.
|
||||
queueResponse(chan_id, out_msg_id, req_id, outmsg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RpcProtoSearch::processReqListSearches(uint32_t chan_id, uint32_t /* msg_id */, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqListSearches()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// parse msg.
|
||||
rsctrl::search::RequestListSearches req;
|
||||
if (!req.ParseFromString(msg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqListSearches() ERROR ParseFromString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// response.
|
||||
rsctrl::search::ResponseSearchIds resp;
|
||||
bool success = true;
|
||||
std::string errorMsg;
|
||||
|
||||
/* convert msg parameters into local ones */
|
||||
// Nothing to do.
|
||||
|
||||
std::list<uint32_t> reg_search_ids;
|
||||
std::list<uint32_t>::iterator it;
|
||||
if (!get_search_list(chan_id, reg_search_ids))
|
||||
{
|
||||
/* warning */
|
||||
success = false;
|
||||
errorMsg = "No Searches Active";
|
||||
}
|
||||
|
||||
/* iterate through search array */
|
||||
for(it = reg_search_ids.begin(); it != reg_search_ids.end(); it++)
|
||||
{
|
||||
/* add to answer */
|
||||
resp.add_search_id(*it);
|
||||
}
|
||||
|
||||
/* DONE - Generate Reply */
|
||||
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(errorMsg);
|
||||
}
|
||||
|
||||
std::string outmsg;
|
||||
if (!resp.SerializeToString(&outmsg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqListSearches() ERROR SerialiseToString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Correctly Name Message.
|
||||
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::SEARCH,
|
||||
rsctrl::search::MsgId_ResponseSearchIds, true);
|
||||
|
||||
// queue it.
|
||||
queueResponse(chan_id, out_msg_id, req_id, outmsg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RpcProtoSearch::processReqSearchResults(uint32_t chan_id, uint32_t /* msg_id */, uint32_t req_id, const std::string &msg)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqSearchResults()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// parse msg.
|
||||
rsctrl::search::RequestSearchResults req;
|
||||
if (!req.ParseFromString(msg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqSearchResults() ERROR ParseFromString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// response.
|
||||
rsctrl::search::ResponseSearchResults resp;
|
||||
bool success = true;
|
||||
std::string errorMsg;
|
||||
|
||||
/* convert msg parameters into local ones */
|
||||
std::list<uint32_t> reg_search_ids;
|
||||
std::list<uint32_t> requested_search_ids;
|
||||
if (!get_search_list(chan_id, reg_search_ids))
|
||||
{
|
||||
/* warning */
|
||||
}
|
||||
|
||||
int no_searches = req.search_ids_size();
|
||||
if (no_searches)
|
||||
{
|
||||
/* painful check that they are our searches */
|
||||
for(int i = 0; i < no_searches; i++)
|
||||
{
|
||||
uint32_t search_id = req.search_ids(i);
|
||||
|
||||
/* check that its in reg_search_ids */
|
||||
if (reg_search_ids.end() != std::find(reg_search_ids.begin(), reg_search_ids.end(), search_id))
|
||||
{
|
||||
/* error */
|
||||
continue;
|
||||
}
|
||||
requested_search_ids.push_back(search_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* all current searches */
|
||||
requested_search_ids = reg_search_ids;
|
||||
}
|
||||
|
||||
|
||||
std::list<uint32_t>::iterator rit;
|
||||
for(rit = requested_search_ids.begin();
|
||||
rit != requested_search_ids.end(); rit++)
|
||||
{
|
||||
rsctrl::search::SearchSet *set = resp.add_searches();
|
||||
/* add to answer */
|
||||
set->set_search_id(*rit);
|
||||
/* no search details at the moment */
|
||||
|
||||
/* add into search array */
|
||||
std::list<TurtleFileInfo>::iterator it;
|
||||
std::list<TurtleFileInfo> searchResults;
|
||||
mNotify->getSearchResults(*rit, searchResults);
|
||||
|
||||
/* convert into useful list */
|
||||
for(it = searchResults.begin(); it != searchResults.end(); it++)
|
||||
{
|
||||
/* add to answer */
|
||||
rsctrl::search::SearchHit *hit = set->add_hits();
|
||||
rsctrl::core::File *file = hit->mutable_file();
|
||||
|
||||
file->set_hash(it->hash);
|
||||
file->set_name(it->name);
|
||||
file->set_size(it->size);
|
||||
|
||||
// Uhm not provided for now. default to NETWORK
|
||||
hit->set_loc(rsctrl::search::SearchHit::NETWORK);
|
||||
hit->set_no_hits(1); // No aggregation yet.
|
||||
}
|
||||
}
|
||||
|
||||
/* DONE - Generate Reply */
|
||||
/* different to others - partial success possible */
|
||||
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(errorMsg);
|
||||
}
|
||||
|
||||
std::string outmsg;
|
||||
if (!resp.SerializeToString(&outmsg))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::processReqSearchResults() ERROR SerialiseToString()";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Correctly Name Message.
|
||||
uint32_t out_msg_id = constructMsgId(rsctrl::core::CORE, rsctrl::core::SEARCH,
|
||||
rsctrl::search::MsgId_ResponseSearchResults, true);
|
||||
|
||||
// queue it.
|
||||
queueResponse(chan_id, out_msg_id, req_id, outmsg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***** HELPER FUNCTIONS *****/
|
||||
|
||||
// These private functions use Mutex below and manipulate mActiveSearches.
|
||||
int RpcProtoSearch::get_search_list(uint32_t chan_id, std::list<uint32_t> &search_ids)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::get_search_list(" << chan_id << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsStackMutex stack(searchMtx); /******* LOCKED *********/
|
||||
|
||||
std::map<uint32_t, std::list<uint32_t> >::iterator mit;
|
||||
|
||||
mit = mActiveSearches.find(chan_id);
|
||||
if (mit == mActiveSearches.end())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
search_ids = mit->second;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RpcProtoSearch::add_search(uint32_t chan_id, uint32_t search_id)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::add_search(" << chan_id << ", " << search_id << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsStackMutex stack(searchMtx); /******* LOCKED *********/
|
||||
|
||||
std::map<uint32_t, std::list<uint32_t> >::iterator mit;
|
||||
|
||||
mit = mActiveSearches.find(chan_id);
|
||||
if (mit == mActiveSearches.end())
|
||||
{
|
||||
std::list<uint32_t> emptyList;
|
||||
mActiveSearches[chan_id] = emptyList;
|
||||
|
||||
mit = mActiveSearches.find(chan_id);
|
||||
}
|
||||
|
||||
/* sanity check */
|
||||
if (mit->second.end() != std::find(mit->second.begin(), mit->second.end(), search_id))
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::add_search() ERROR search_id already exists";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mit->second.push_back(search_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RpcProtoSearch::remove_search(uint32_t chan_id, uint32_t search_id)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::remove_search(" << chan_id << ", " << search_id << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsStackMutex stack(searchMtx); /******* LOCKED *********/
|
||||
|
||||
std::map<uint32_t, std::list<uint32_t> >::iterator mit;
|
||||
|
||||
mit = mActiveSearches.find(chan_id);
|
||||
if (mit == mActiveSearches.end())
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::remove_search() ERROR search set doesn't exist";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool removed = false;
|
||||
std::list<uint32_t>::iterator lit;
|
||||
for(lit = mit->second.begin(); lit != mit->second.end();)
|
||||
{
|
||||
if (*lit == search_id)
|
||||
{
|
||||
lit = mit->second.erase(lit);
|
||||
if (removed)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::remove_search() ERROR removed multiple";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
removed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lit++;
|
||||
}
|
||||
}
|
||||
|
||||
if (removed)
|
||||
return 1;
|
||||
|
||||
std::cerr << "RpcProtoSearch::remove_search() ERROR search_id not found";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RpcProtoSearch::clear_searches(uint32_t chan_id)
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::clear_searches(" << chan_id << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsStackMutex stack(searchMtx); /******* LOCKED *********/
|
||||
|
||||
std::map<uint32_t, std::list<uint32_t> >::iterator mit;
|
||||
|
||||
mit = mActiveSearches.find(chan_id);
|
||||
if (mit == mActiveSearches.end())
|
||||
{
|
||||
std::cerr << "RpcProtoSearch::clear_searches() WARNING search set not found";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mActiveSearches.erase(mit);
|
||||
return 1;
|
||||
}
|
||||
|
64
retroshare-nogui/src/rpc/proto/rpcprotosearch.h
Normal file
64
retroshare-nogui/src/rpc/proto/rpcprotosearch.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* RetroShare External Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RS_RPC_PROTO_SEARCH_H
|
||||
#define RS_RPC_PROTO_SEARCH_H
|
||||
|
||||
#include "rpc/rpcserver.h"
|
||||
|
||||
class NotifyTxt;
|
||||
|
||||
class RpcProtoSearch: public RpcQueueService
|
||||
{
|
||||
public:
|
||||
RpcProtoSearch(uint32_t serviceId, NotifyTxt *notify);
|
||||
virtual void reset(uint32_t chan_id);
|
||||
|
||||
virtual int processMsg(uint32_t chan_id, uint32_t msgId, uint32_t req_id, const std::string &msg);
|
||||
|
||||
protected:
|
||||
|
||||
int processReqBasicSearch(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
int processReqCloseSearch(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
int processReqListSearches(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
int processReqSearchResults(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
|
||||
|
||||
private:
|
||||
// These private functions use Mutex below and manipulate mActiveSearches.
|
||||
int get_search_list(uint32_t chan_id, std::list<uint32_t> &search_ids);
|
||||
int add_search(uint32_t chan_id, uint32_t search_id);
|
||||
int remove_search(uint32_t chan_id, uint32_t search_id);
|
||||
int clear_searches(uint32_t chan_id);
|
||||
|
||||
NotifyTxt *mNotify;
|
||||
|
||||
RsMutex searchMtx;
|
||||
|
||||
/* must store list of active searches per channel */
|
||||
std::map<uint32_t, std::list<uint32_t> > mActiveSearches;
|
||||
|
||||
};
|
||||
|
||||
#endif /* RS_PROTO_SEARCH_H */
|
@ -86,6 +86,9 @@ 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;
|
||||
case rsctrl::system::MsgId_RequestSystemQuit:
|
||||
processSystemQuit(chan_id, msg_id, req_id, msg);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "RpcProtoSystem::processMsg() ERROR should never get here";
|
||||
std::cerr << std::endl;
|
||||
@ -211,3 +214,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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
virtual int processMsg(uint32_t chan_id, uint32_t msgId, uint32_t req_id, const std::string &msg);
|
||||
|
||||
virtual int processSystemStatus(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
virtual int processSystemQuit(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ virtual int tick();
|
||||
int recv_msg(uint32_t chan_id);
|
||||
int send(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg);
|
||||
|
||||
int error(uint32_t chan_id, std::string msg); // pass an error up to comms level.
|
||||
private:
|
||||
RpcComms *mComms;
|
||||
RpcServer *mServer;
|
||||
|
@ -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;
|
||||
|
@ -67,17 +67,23 @@ public:
|
||||
std::string mMsg;
|
||||
};
|
||||
|
||||
class RpcServer;
|
||||
|
||||
class RpcService
|
||||
{
|
||||
public:
|
||||
RpcService(uint32_t /* serviceId */ ) { return; }
|
||||
RpcService(uint32_t /* serviceId */ ):mRpcServer(NULL) { return; }
|
||||
virtual void reset(uint32_t /* chan_id */) { return; }
|
||||
virtual int msgsAccepted(std::list<uint32_t> & /* msgIds */) { return 0; } /* not used at the moment */
|
||||
virtual int processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg) = 0; /* returns 0 - not handled, > 0, accepted */
|
||||
virtual int getResponse(uint32_t &chan_id, uint32_t &msgId, uint32_t &req_id, std::string &msg) = 0; /* 0 - not ready, > 0 heres the response */
|
||||
|
||||
virtual int getEvents(std::list<RpcQueuedMsg> & /* events */) { return 0; } /* 0 = none, optional feature */
|
||||
|
||||
void setRpcServer(RpcServer *server) {mRpcServer = server; }
|
||||
RpcServer *getRpcServer() { return mRpcServer; }
|
||||
private:
|
||||
RpcServer *mRpcServer;
|
||||
};
|
||||
|
||||
|
||||
@ -140,6 +146,7 @@ public:
|
||||
bool checkEvents();
|
||||
|
||||
void reset(uint32_t chan_id);
|
||||
int error(uint32_t chan_id, std::string msg); // pass an error to mediator.
|
||||
|
||||
private:
|
||||
bool sendQueuedMsgs(std::list<RpcQueuedMsg> &msgs);
|
||||
|
@ -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);
|
||||
|
@ -28,7 +28,9 @@
|
||||
|
||||
#include "rpc/rpc.h"
|
||||
|
||||
RpcMediator *CreateRpcSystem(RpcComms *comms);
|
||||
class NotifyTxt;
|
||||
|
||||
RpcMediator *CreateRpcSystem(RpcComms *comms, NotifyTxt *notify);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user