First working client/server protobuf ping-pong

This commit is contained in:
Michael Mandl 2015-02-22 21:35:09 +01:00
parent 078f329c34
commit 8a0555eacd
19 changed files with 2222 additions and 352 deletions

View file

@ -1,23 +1,38 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "proto/client.pb.h" #include <zmq.hpp>
#include "proto/request.pb.h"
#include "proto/reply.pb.h"
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
std::cout << "Client running" << std::endl; std::cout << "Client running" << std::endl;
std::string bufferString; zmq::context_t context(1);
zmq::socket_t socket(context, ZMQ_REQ);
socket.connect("tcp://localhost:5555");
client::ClientInfo clientInfoIn; while (true)
{
Messages::Request requestMessage;
requestMessage.set_text("Hello Server");
clientInfoIn.set_name("Herbert"); zmq::message_t request(requestMessage.ByteSize());
clientInfoIn.SerializeToString(&bufferString); requestMessage.SerializeToArray(request.data(), request.size());
socket.send(request);
client::ClientInfo clientInfoOut; zmq::message_t reply;
clientInfoOut.ParseFromString(bufferString); socket.recv(&reply);
std::cout << "read: " << clientInfoOut.name() << std::endl; Messages::Reply replyMessage;
replyMessage.ParseFromArray(reply.data(), reply.size());
std::cout << "Received reply: " << replyMessage.text() << std::endl;
Sleep(1000);
}
return 0; return 0;
} }

View file

@ -52,13 +52,13 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\protobuf\src\</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\protobuf\src\;..\zeromq\include\</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck> <SDLCheck>false</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libprotobuf.lib</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libprotobuf.lib;;libzmq.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -71,7 +71,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\protobuf\src\</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\protobuf\src\;..\zeromq\include\</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck> <SDLCheck>false</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
@ -79,29 +79,38 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libprotobuf.lib</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libprotobuf.lib;;libzmq.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Client.cpp" /> <ClCompile Include="Client.cpp" />
<ClCompile Include="proto\client.pb.cc" /> <ClCompile Include="proto\reply.pb.cc" />
<ClCompile Include="proto\request.pb.cc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="proto\client.proto"> <CustomBuild Include="..\proto\reply.proto">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
</CustomBuild>
<CustomBuild Include="..\proto\request.proto">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<FileType>Document</FileType> <FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">proto\client.pb.h;proto\client.pb.cc;%(Outputs)</Outputs>
<TreatOutputAsContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</TreatOutputAsContent>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">proto\client.pb.h;proto\client.pb.cc;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
<TreatOutputAsContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</TreatOutputAsContent> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="proto\client.pb.h" /> <ClInclude Include="proto\reply.pb.h" />
<ClInclude Include="proto\request.pb.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View file

@ -21,17 +21,26 @@
<ClCompile Include="Client.cpp"> <ClCompile Include="Client.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="proto\client.pb.cc"> <ClCompile Include="proto\reply.pb.cc">
<Filter>proto</Filter>
</ClCompile>
<ClCompile Include="proto\request.pb.cc">
<Filter>proto</Filter> <Filter>proto</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="proto\client.proto"> <CustomBuild Include="..\proto\reply.proto">
<Filter>proto</Filter>
</CustomBuild>
<CustomBuild Include="..\proto\request.proto">
<Filter>proto</Filter> <Filter>proto</Filter>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="proto\client.pb.h"> <ClInclude Include="proto\reply.pb.h">
<Filter>proto</Filter>
</ClInclude>
<ClInclude Include="proto\request.pb.h">
<Filter>proto</Filter> <Filter>proto</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>

View file

@ -1,221 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: client.proto
#ifndef PROTOBUF_client_2eproto__INCLUDED
#define PROTOBUF_client_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2006000
#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 2006001 < 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/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
namespace client {
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_client_2eproto();
void protobuf_AssignDesc_client_2eproto();
void protobuf_ShutdownFile_client_2eproto();
class ClientInfo;
// ===================================================================
class ClientInfo : public ::google::protobuf::Message {
public:
ClientInfo();
virtual ~ClientInfo();
ClientInfo(const ClientInfo& from);
inline ClientInfo& operator=(const ClientInfo& 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 ClientInfo& default_instance();
void Swap(ClientInfo* other);
// implements Message ----------------------------------------------
ClientInfo* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const ClientInfo& from);
void MergeFrom(const ClientInfo& 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 -------------------------------------------------------
// optional string name = 1 [default = ""];
inline bool has_name() const;
inline void clear_name();
static const int kNameFieldNumber = 1;
inline const ::std::string& name() const;
inline void set_name(const ::std::string& value);
inline void set_name(const char* value);
inline void set_name(const char* value, size_t size);
inline ::std::string* mutable_name();
inline ::std::string* release_name();
inline void set_allocated_name(::std::string* name);
// @@protoc_insertion_point(class_scope:client.ClientInfo)
private:
inline void set_has_name();
inline void clear_has_name();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::uint32 _has_bits_[1];
mutable int _cached_size_;
::std::string* name_;
friend void protobuf_AddDesc_client_2eproto();
friend void protobuf_AssignDesc_client_2eproto();
friend void protobuf_ShutdownFile_client_2eproto();
void InitAsDefaultInstance();
static ClientInfo* default_instance_;
};
// ===================================================================
// ===================================================================
// ClientInfo
// optional string name = 1 [default = ""];
inline bool ClientInfo::has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void ClientInfo::set_has_name() {
_has_bits_[0] |= 0x00000001u;
}
inline void ClientInfo::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void ClientInfo::clear_name() {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_->clear();
}
clear_has_name();
}
inline const ::std::string& ClientInfo::name() const {
// @@protoc_insertion_point(field_get:client.ClientInfo.name)
return *name_;
}
inline void ClientInfo::set_name(const ::std::string& value) {
set_has_name();
if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_ = new ::std::string;
}
name_->assign(value);
// @@protoc_insertion_point(field_set:client.ClientInfo.name)
}
inline void ClientInfo::set_name(const char* value) {
set_has_name();
if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_ = new ::std::string;
}
name_->assign(value);
// @@protoc_insertion_point(field_set_char:client.ClientInfo.name)
}
inline void ClientInfo::set_name(const char* value, size_t size) {
set_has_name();
if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_ = new ::std::string;
}
name_->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:client.ClientInfo.name)
}
inline ::std::string* ClientInfo::mutable_name() {
set_has_name();
if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_ = new ::std::string;
}
// @@protoc_insertion_point(field_mutable:client.ClientInfo.name)
return name_;
}
inline ::std::string* ClientInfo::release_name() {
clear_has_name();
if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
return NULL;
} else {
::std::string* temp = name_;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
return temp;
}
}
inline void ClientInfo::set_allocated_name(::std::string* name) {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete name_;
}
if (name) {
set_has_name();
name_ = name;
} else {
clear_has_name();
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
// @@protoc_insertion_point(field_set_allocated:client.ClientInfo.name)
}
// @@protoc_insertion_point(namespace_scope)
} // namespace client
#ifndef SWIG
namespace google {
namespace protobuf {
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_client_2eproto__INCLUDED

View file

@ -1,7 +0,0 @@
package client;
message ClientInfo
{
optional string name = 1 [default = ""];
}

View file

@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: client.proto // source: reply.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "client.pb.h" #include "reply.pb.h"
#include <algorithm> #include <algorithm>
@ -16,38 +16,38 @@
#include <google/protobuf/wire_format.h> #include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes) // @@protoc_insertion_point(includes)
namespace client { namespace Messages {
namespace { namespace {
const ::google::protobuf::Descriptor* ClientInfo_descriptor_ = NULL; const ::google::protobuf::Descriptor* Reply_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection* const ::google::protobuf::internal::GeneratedMessageReflection*
ClientInfo_reflection_ = NULL; Reply_reflection_ = NULL;
} // namespace } // namespace
void protobuf_AssignDesc_client_2eproto() { void protobuf_AssignDesc_reply_2eproto() {
protobuf_AddDesc_client_2eproto(); protobuf_AddDesc_reply_2eproto();
const ::google::protobuf::FileDescriptor* file = const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"client.proto"); "reply.proto");
GOOGLE_CHECK(file != NULL); GOOGLE_CHECK(file != NULL);
ClientInfo_descriptor_ = file->message_type(0); Reply_descriptor_ = file->message_type(0);
static const int ClientInfo_offsets_[1] = { static const int Reply_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ClientInfo, name_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, text_),
}; };
ClientInfo_reflection_ = Reply_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection( new ::google::protobuf::internal::GeneratedMessageReflection(
ClientInfo_descriptor_, Reply_descriptor_,
ClientInfo::default_instance_, Reply::default_instance_,
ClientInfo_offsets_, Reply_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ClientInfo, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ClientInfo, _unknown_fields_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _unknown_fields_),
-1, -1,
::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(), ::google::protobuf::MessageFactory::generated_factory(),
sizeof(ClientInfo)); sizeof(Reply));
} }
namespace { namespace {
@ -55,137 +55,137 @@ namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() { inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_client_2eproto); &protobuf_AssignDesc_reply_2eproto);
} }
void protobuf_RegisterTypes(const ::std::string&) { void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce(); protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ClientInfo_descriptor_, &ClientInfo::default_instance()); Reply_descriptor_, &Reply::default_instance());
} }
} // namespace } // namespace
void protobuf_ShutdownFile_client_2eproto() { void protobuf_ShutdownFile_reply_2eproto() {
delete ClientInfo::default_instance_; delete Reply::default_instance_;
delete ClientInfo_reflection_; delete Reply_reflection_;
} }
void protobuf_AddDesc_client_2eproto() { void protobuf_AddDesc_reply_2eproto() {
static bool already_here = false; static bool already_here = false;
if (already_here) return; if (already_here) return;
already_here = true; already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION; GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile( ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\014client.proto\022\006client\"\034\n\nClientInfo\022\016\n\004" "\n\013reply.proto\022\010Messages\"\025\n\005Reply\022\014\n\004text"
"name\030\001 \001(\t:\000", 52); "\030\001 \001(\t", 46);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"client.proto", &protobuf_RegisterTypes); "reply.proto", &protobuf_RegisterTypes);
ClientInfo::default_instance_ = new ClientInfo(); Reply::default_instance_ = new Reply();
ClientInfo::default_instance_->InitAsDefaultInstance(); Reply::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_client_2eproto); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_reply_2eproto);
} }
// Force AddDescriptors() to be called at static initialization time. // Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_client_2eproto { struct StaticDescriptorInitializer_reply_2eproto {
StaticDescriptorInitializer_client_2eproto() { StaticDescriptorInitializer_reply_2eproto() {
protobuf_AddDesc_client_2eproto(); protobuf_AddDesc_reply_2eproto();
} }
} static_descriptor_initializer_client_2eproto_; } static_descriptor_initializer_reply_2eproto_;
// =================================================================== // ===================================================================
#ifndef _MSC_VER #ifndef _MSC_VER
const int ClientInfo::kNameFieldNumber; const int Reply::kTextFieldNumber;
#endif // !_MSC_VER #endif // !_MSC_VER
ClientInfo::ClientInfo() Reply::Reply()
: ::google::protobuf::Message() { : ::google::protobuf::Message() {
SharedCtor(); SharedCtor();
// @@protoc_insertion_point(constructor:client.ClientInfo) // @@protoc_insertion_point(constructor:Messages.Reply)
} }
void ClientInfo::InitAsDefaultInstance() { void Reply::InitAsDefaultInstance() {
} }
ClientInfo::ClientInfo(const ClientInfo& from) Reply::Reply(const Reply& from)
: ::google::protobuf::Message() { : ::google::protobuf::Message() {
SharedCtor(); SharedCtor();
MergeFrom(from); MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:client.ClientInfo) // @@protoc_insertion_point(copy_constructor:Messages.Reply)
} }
void ClientInfo::SharedCtor() { void Reply::SharedCtor() {
::google::protobuf::internal::GetEmptyString(); ::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0; _cached_size_ = 0;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_)); ::memset(_has_bits_, 0, sizeof(_has_bits_));
} }
ClientInfo::~ClientInfo() { Reply::~Reply() {
// @@protoc_insertion_point(destructor:client.ClientInfo) // @@protoc_insertion_point(destructor:Messages.Reply)
SharedDtor(); SharedDtor();
} }
void ClientInfo::SharedDtor() { void Reply::SharedDtor() {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete name_; delete text_;
} }
if (this != default_instance_) { if (this != default_instance_) {
} }
} }
void ClientInfo::SetCachedSize(int size) const { void Reply::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size; _cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END(); GOOGLE_SAFE_CONCURRENT_WRITES_END();
} }
const ::google::protobuf::Descriptor* ClientInfo::descriptor() { const ::google::protobuf::Descriptor* Reply::descriptor() {
protobuf_AssignDescriptorsOnce(); protobuf_AssignDescriptorsOnce();
return ClientInfo_descriptor_; return Reply_descriptor_;
} }
const ClientInfo& ClientInfo::default_instance() { const Reply& Reply::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_client_2eproto(); if (default_instance_ == NULL) protobuf_AddDesc_reply_2eproto();
return *default_instance_; return *default_instance_;
} }
ClientInfo* ClientInfo::default_instance_ = NULL; Reply* Reply::default_instance_ = NULL;
ClientInfo* ClientInfo::New() const { Reply* Reply::New() const {
return new ClientInfo; return new Reply;
} }
void ClientInfo::Clear() { void Reply::Clear() {
if (has_name()) { if (has_text()) {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_->clear(); text_->clear();
} }
} }
::memset(_has_bits_, 0, sizeof(_has_bits_)); ::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear(); mutable_unknown_fields()->Clear();
} }
bool ClientInfo::MergePartialFromCodedStream( bool Reply::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) { ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure #define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag; ::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:client.ClientInfo) // @@protoc_insertion_point(parse_start:Messages.Reply)
for (;;) { for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first; tag = p.first;
if (!p.second) goto handle_unusual; if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1 [default = ""]; // optional string text = 1;
case 1: { case 1: {
if (tag == 10) { if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString( DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name())); input, this->mutable_text()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::PARSE, ::google::protobuf::internal::WireFormat::PARSE,
"name"); "text");
} else { } else {
goto handle_unusual; goto handle_unusual;
} }
@ -207,65 +207,65 @@ bool ClientInfo::MergePartialFromCodedStream(
} }
} }
success: success:
// @@protoc_insertion_point(parse_success:client.ClientInfo) // @@protoc_insertion_point(parse_success:Messages.Reply)
return true; return true;
failure: failure:
// @@protoc_insertion_point(parse_failure:client.ClientInfo) // @@protoc_insertion_point(parse_failure:Messages.Reply)
return false; return false;
#undef DO_ #undef DO_
} }
void ClientInfo::SerializeWithCachedSizes( void Reply::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const { ::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:client.ClientInfo) // @@protoc_insertion_point(serialize_start:Messages.Reply)
// optional string name = 1 [default = ""]; // optional string text = 1;
if (has_name()) { if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"name"); "text");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output); 1, this->text(), output);
} }
if (!unknown_fields().empty()) { if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields( ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output); unknown_fields(), output);
} }
// @@protoc_insertion_point(serialize_end:client.ClientInfo) // @@protoc_insertion_point(serialize_end:Messages.Reply)
} }
::google::protobuf::uint8* ClientInfo::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* Reply::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const { ::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:client.ClientInfo) // @@protoc_insertion_point(serialize_to_array_start:Messages.Reply)
// optional string name = 1 [default = ""]; // optional string text = 1;
if (has_name()) { if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(), this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE, ::google::protobuf::internal::WireFormat::SERIALIZE,
"name"); "text");
target = target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray( ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target); 1, this->text(), target);
} }
if (!unknown_fields().empty()) { if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target); unknown_fields(), target);
} }
// @@protoc_insertion_point(serialize_to_array_end:client.ClientInfo) // @@protoc_insertion_point(serialize_to_array_end:Messages.Reply)
return target; return target;
} }
int ClientInfo::ByteSize() const { int Reply::ByteSize() const {
int total_size = 0; int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string name = 1 [default = ""]; // optional string text = 1;
if (has_name()) { if (has_text()) {
total_size += 1 + total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize( ::google::protobuf::internal::WireFormatLite::StringSize(
this->name()); this->text());
} }
} }
@ -280,10 +280,10 @@ int ClientInfo::ByteSize() const {
return total_size; return total_size;
} }
void ClientInfo::MergeFrom(const ::google::protobuf::Message& from) { void Reply::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this); GOOGLE_CHECK_NE(&from, this);
const ClientInfo* source = const Reply* source =
::google::protobuf::internal::dynamic_cast_if_available<const ClientInfo*>( ::google::protobuf::internal::dynamic_cast_if_available<const Reply*>(
&from); &from);
if (source == NULL) { if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this); ::google::protobuf::internal::ReflectionOps::Merge(from, this);
@ -292,53 +292,53 @@ void ClientInfo::MergeFrom(const ::google::protobuf::Message& from) {
} }
} }
void ClientInfo::MergeFrom(const ClientInfo& from) { void Reply::MergeFrom(const Reply& from) {
GOOGLE_CHECK_NE(&from, this); GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_name()) { if (from.has_text()) {
set_name(from.name()); set_text(from.text());
} }
} }
mutable_unknown_fields()->MergeFrom(from.unknown_fields()); mutable_unknown_fields()->MergeFrom(from.unknown_fields());
} }
void ClientInfo::CopyFrom(const ::google::protobuf::Message& from) { void Reply::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return; if (&from == this) return;
Clear(); Clear();
MergeFrom(from); MergeFrom(from);
} }
void ClientInfo::CopyFrom(const ClientInfo& from) { void Reply::CopyFrom(const Reply& from) {
if (&from == this) return; if (&from == this) return;
Clear(); Clear();
MergeFrom(from); MergeFrom(from);
} }
bool ClientInfo::IsInitialized() const { bool Reply::IsInitialized() const {
return true; return true;
} }
void ClientInfo::Swap(ClientInfo* other) { void Reply::Swap(Reply* other) {
if (other != this) { if (other != this) {
std::swap(name_, other->name_); std::swap(text_, other->text_);
std::swap(_has_bits_[0], other->_has_bits_[0]); std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_); _unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_); std::swap(_cached_size_, other->_cached_size_);
} }
} }
::google::protobuf::Metadata ClientInfo::GetMetadata() const { ::google::protobuf::Metadata Reply::GetMetadata() const {
protobuf_AssignDescriptorsOnce(); protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata; ::google::protobuf::Metadata metadata;
metadata.descriptor = ClientInfo_descriptor_; metadata.descriptor = Reply_descriptor_;
metadata.reflection = ClientInfo_reflection_; metadata.reflection = Reply_reflection_;
return metadata; return metadata;
} }
// @@protoc_insertion_point(namespace_scope) // @@protoc_insertion_point(namespace_scope)
} // namespace client } // namespace Messages
// @@protoc_insertion_point(global_scope) // @@protoc_insertion_point(global_scope)

221
Client/proto/reply.pb.h Normal file
View file

@ -0,0 +1,221 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: reply.proto
#ifndef PROTOBUF_reply_2eproto__INCLUDED
#define PROTOBUF_reply_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2006000
#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 2006001 < 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/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
namespace Messages {
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_reply_2eproto();
void protobuf_AssignDesc_reply_2eproto();
void protobuf_ShutdownFile_reply_2eproto();
class Reply;
// ===================================================================
class Reply : public ::google::protobuf::Message {
public:
Reply();
virtual ~Reply();
Reply(const Reply& from);
inline Reply& operator=(const Reply& 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 Reply& default_instance();
void Swap(Reply* other);
// implements Message ----------------------------------------------
Reply* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const Reply& from);
void MergeFrom(const Reply& 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 -------------------------------------------------------
// optional string text = 1;
inline bool has_text() const;
inline void clear_text();
static const int kTextFieldNumber = 1;
inline const ::std::string& text() const;
inline void set_text(const ::std::string& value);
inline void set_text(const char* value);
inline void set_text(const char* value, size_t size);
inline ::std::string* mutable_text();
inline ::std::string* release_text();
inline void set_allocated_text(::std::string* text);
// @@protoc_insertion_point(class_scope:Messages.Reply)
private:
inline void set_has_text();
inline void clear_has_text();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::uint32 _has_bits_[1];
mutable int _cached_size_;
::std::string* text_;
friend void protobuf_AddDesc_reply_2eproto();
friend void protobuf_AssignDesc_reply_2eproto();
friend void protobuf_ShutdownFile_reply_2eproto();
void InitAsDefaultInstance();
static Reply* default_instance_;
};
// ===================================================================
// ===================================================================
// Reply
// optional string text = 1;
inline bool Reply::has_text() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Reply::set_has_text() {
_has_bits_[0] |= 0x00000001u;
}
inline void Reply::clear_has_text() {
_has_bits_[0] &= ~0x00000001u;
}
inline void Reply::clear_text() {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_->clear();
}
clear_has_text();
}
inline const ::std::string& Reply::text() const {
// @@protoc_insertion_point(field_get:Messages.Reply.text)
return *text_;
}
inline void Reply::set_text(const ::std::string& value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set:Messages.Reply.text)
}
inline void Reply::set_text(const char* value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set_char:Messages.Reply.text)
}
inline void Reply::set_text(const char* value, size_t size) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:Messages.Reply.text)
}
inline ::std::string* Reply::mutable_text() {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
// @@protoc_insertion_point(field_mutable:Messages.Reply.text)
return text_;
}
inline ::std::string* Reply::release_text() {
clear_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
return NULL;
} else {
::std::string* temp = text_;
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
return temp;
}
}
inline void Reply::set_allocated_text(::std::string* text) {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete text_;
}
if (text) {
set_has_text();
text_ = text;
} else {
clear_has_text();
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
// @@protoc_insertion_point(field_set_allocated:Messages.Reply.text)
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Messages
#ifndef SWIG
namespace google {
namespace protobuf {
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_reply_2eproto__INCLUDED

344
Client/proto/request.pb.cc Normal file
View file

@ -0,0 +1,344 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: request.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "request.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace Messages {
namespace {
const ::google::protobuf::Descriptor* Request_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Request_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_request_2eproto() {
protobuf_AddDesc_request_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"request.proto");
GOOGLE_CHECK(file != NULL);
Request_descriptor_ = file->message_type(0);
static const int Request_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, text_),
};
Request_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
Request_descriptor_,
Request::default_instance_,
Request_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(Request));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_request_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Request_descriptor_, &Request::default_instance());
}
} // namespace
void protobuf_ShutdownFile_request_2eproto() {
delete Request::default_instance_;
delete Request_reflection_;
}
void protobuf_AddDesc_request_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\rrequest.proto\022\010Messages\"\027\n\007Request\022\014\n\004"
"text\030\001 \001(\t", 50);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"request.proto", &protobuf_RegisterTypes);
Request::default_instance_ = new Request();
Request::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_request_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_request_2eproto {
StaticDescriptorInitializer_request_2eproto() {
protobuf_AddDesc_request_2eproto();
}
} static_descriptor_initializer_request_2eproto_;
// ===================================================================
#ifndef _MSC_VER
const int Request::kTextFieldNumber;
#endif // !_MSC_VER
Request::Request()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Messages.Request)
}
void Request::InitAsDefaultInstance() {
}
Request::Request(const Request& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Messages.Request)
}
void Request::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Request::~Request() {
// @@protoc_insertion_point(destructor:Messages.Request)
SharedDtor();
}
void Request::SharedDtor() {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete text_;
}
if (this != default_instance_) {
}
}
void Request::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Request::descriptor() {
protobuf_AssignDescriptorsOnce();
return Request_descriptor_;
}
const Request& Request::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_request_2eproto();
return *default_instance_;
}
Request* Request::default_instance_ = NULL;
Request* Request::New() const {
return new Request;
}
void Request::Clear() {
if (has_text()) {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_->clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool Request::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Messages.Request)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string text = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_text()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::PARSE,
"text");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Messages.Request)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Messages.Request)
return false;
#undef DO_
}
void Request::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Messages.Request)
// optional string text = 1;
if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"text");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->text(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Messages.Request)
}
::google::protobuf::uint8* Request::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Messages.Request)
// optional string text = 1;
if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"text");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->text(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Messages.Request)
return target;
}
int Request::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string text = 1;
if (has_text()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->text());
}
}
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 Request::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const Request* source =
::google::protobuf::internal::dynamic_cast_if_available<const Request*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void Request::MergeFrom(const Request& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_text()) {
set_text(from.text());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void Request::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Request::CopyFrom(const Request& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Request::IsInitialized() const {
return true;
}
void Request::Swap(Request* other) {
if (other != this) {
std::swap(text_, other->text_);
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 Request::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Request_descriptor_;
metadata.reflection = Request_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Messages
// @@protoc_insertion_point(global_scope)

221
Client/proto/request.pb.h Normal file
View file

@ -0,0 +1,221 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: request.proto
#ifndef PROTOBUF_request_2eproto__INCLUDED
#define PROTOBUF_request_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2006000
#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 2006001 < 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/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
namespace Messages {
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_request_2eproto();
void protobuf_AssignDesc_request_2eproto();
void protobuf_ShutdownFile_request_2eproto();
class Request;
// ===================================================================
class Request : public ::google::protobuf::Message {
public:
Request();
virtual ~Request();
Request(const Request& from);
inline Request& operator=(const Request& 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 Request& default_instance();
void Swap(Request* other);
// implements Message ----------------------------------------------
Request* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const Request& from);
void MergeFrom(const Request& 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 -------------------------------------------------------
// optional string text = 1;
inline bool has_text() const;
inline void clear_text();
static const int kTextFieldNumber = 1;
inline const ::std::string& text() const;
inline void set_text(const ::std::string& value);
inline void set_text(const char* value);
inline void set_text(const char* value, size_t size);
inline ::std::string* mutable_text();
inline ::std::string* release_text();
inline void set_allocated_text(::std::string* text);
// @@protoc_insertion_point(class_scope:Messages.Request)
private:
inline void set_has_text();
inline void clear_has_text();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::uint32 _has_bits_[1];
mutable int _cached_size_;
::std::string* text_;
friend void protobuf_AddDesc_request_2eproto();
friend void protobuf_AssignDesc_request_2eproto();
friend void protobuf_ShutdownFile_request_2eproto();
void InitAsDefaultInstance();
static Request* default_instance_;
};
// ===================================================================
// ===================================================================
// Request
// optional string text = 1;
inline bool Request::has_text() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Request::set_has_text() {
_has_bits_[0] |= 0x00000001u;
}
inline void Request::clear_has_text() {
_has_bits_[0] &= ~0x00000001u;
}
inline void Request::clear_text() {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_->clear();
}
clear_has_text();
}
inline const ::std::string& Request::text() const {
// @@protoc_insertion_point(field_get:Messages.Request.text)
return *text_;
}
inline void Request::set_text(const ::std::string& value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set:Messages.Request.text)
}
inline void Request::set_text(const char* value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set_char:Messages.Request.text)
}
inline void Request::set_text(const char* value, size_t size) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:Messages.Request.text)
}
inline ::std::string* Request::mutable_text() {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
// @@protoc_insertion_point(field_mutable:Messages.Request.text)
return text_;
}
inline ::std::string* Request::release_text() {
clear_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
return NULL;
} else {
::std::string* temp = text_;
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
return temp;
}
}
inline void Request::set_allocated_text(::std::string* text) {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete text_;
}
if (text) {
set_has_text();
text_ = text;
} else {
clear_has_text();
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
// @@protoc_insertion_point(field_set_allocated:Messages.Request.text)
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Messages
#ifndef SWIG
namespace google {
namespace protobuf {
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_request_2eproto__INCLUDED

View file

@ -26,32 +26,79 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "protoc", "protobuf\vsprojec
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE} = {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE} {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE} = {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "zermq", "zermq", "{A0BC6B90-A412-4E7C-8F34-E3BBF135AC1B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzmq", "zeromq\builds\msvc\libzmq\libzmq.vcxproj", "{641C5F36-32EE-4323-B740-992B651CF9D6}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
StaticDebug|Win32 = StaticDebug|Win32
StaticRelease|Win32 = StaticRelease|Win32
WithOpenPGM|Win32 = WithOpenPGM|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Debug|Win32.ActiveCfg = Debug|Win32 {DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Debug|Win32.ActiveCfg = Debug|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Debug|Win32.Build.0 = Debug|Win32 {DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Debug|Win32.Build.0 = Debug|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Release|Win32.ActiveCfg = Release|Win32 {DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Release|Win32.ActiveCfg = Release|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Release|Win32.Build.0 = Release|Win32 {DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.Release|Win32.Build.0 = Release|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.StaticDebug|Win32.ActiveCfg = Debug|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.StaticDebug|Win32.Build.0 = Debug|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.StaticRelease|Win32.ActiveCfg = Release|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.StaticRelease|Win32.Build.0 = Release|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.WithOpenPGM|Win32.ActiveCfg = Release|Win32
{DD8094A4-9A06-48C2-8089-8F9CD17DB56A}.WithOpenPGM|Win32.Build.0 = Release|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Debug|Win32.ActiveCfg = Debug|Win32 {010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Debug|Win32.ActiveCfg = Debug|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Debug|Win32.Build.0 = Debug|Win32 {010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Debug|Win32.Build.0 = Debug|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Release|Win32.ActiveCfg = Release|Win32 {010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Release|Win32.ActiveCfg = Release|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Release|Win32.Build.0 = Release|Win32 {010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.Release|Win32.Build.0 = Release|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.StaticDebug|Win32.ActiveCfg = Debug|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.StaticDebug|Win32.Build.0 = Debug|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.StaticRelease|Win32.ActiveCfg = Release|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.StaticRelease|Win32.Build.0 = Release|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.WithOpenPGM|Win32.ActiveCfg = Release|Win32
{010C073D-B9CB-4FF6-8CA5-5029D6A6A2C7}.WithOpenPGM|Win32.Build.0 = Release|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Debug|Win32.ActiveCfg = Debug|Win32 {3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Debug|Win32.ActiveCfg = Debug|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Debug|Win32.Build.0 = Debug|Win32 {3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Debug|Win32.Build.0 = Debug|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Release|Win32.ActiveCfg = Release|Win32 {3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Release|Win32.ActiveCfg = Release|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Release|Win32.Build.0 = Release|Win32 {3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.Release|Win32.Build.0 = Release|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.StaticDebug|Win32.ActiveCfg = Debug|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.StaticDebug|Win32.Build.0 = Debug|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.StaticRelease|Win32.ActiveCfg = Release|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.StaticRelease|Win32.Build.0 = Release|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.WithOpenPGM|Win32.ActiveCfg = Release|Win32
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30}.WithOpenPGM|Win32.Build.0 = Release|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Debug|Win32.ActiveCfg = Debug|Win32 {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Debug|Win32.ActiveCfg = Debug|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Debug|Win32.Build.0 = Debug|Win32 {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Debug|Win32.Build.0 = Debug|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Release|Win32.ActiveCfg = Release|Win32 {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Release|Win32.ActiveCfg = Release|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Release|Win32.Build.0 = Release|Win32 {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.Release|Win32.Build.0 = Release|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.StaticDebug|Win32.ActiveCfg = Debug|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.StaticDebug|Win32.Build.0 = Debug|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.StaticRelease|Win32.ActiveCfg = Release|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.StaticRelease|Win32.Build.0 = Release|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.WithOpenPGM|Win32.ActiveCfg = Release|Win32
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE}.WithOpenPGM|Win32.Build.0 = Release|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Debug|Win32.ActiveCfg = Debug|Win32 {1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Debug|Win32.ActiveCfg = Debug|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Debug|Win32.Build.0 = Debug|Win32 {1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Debug|Win32.Build.0 = Debug|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Release|Win32.ActiveCfg = Release|Win32 {1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Release|Win32.ActiveCfg = Release|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Release|Win32.Build.0 = Release|Win32 {1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.Release|Win32.Build.0 = Release|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.StaticDebug|Win32.ActiveCfg = Debug|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.StaticDebug|Win32.Build.0 = Debug|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.StaticRelease|Win32.ActiveCfg = Release|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.StaticRelease|Win32.Build.0 = Release|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.WithOpenPGM|Win32.ActiveCfg = Release|Win32
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E}.WithOpenPGM|Win32.Build.0 = Release|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Debug|Win32.ActiveCfg = Debug|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Debug|Win32.Build.0 = Debug|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.ActiveCfg = Release|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.Build.0 = Release|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.StaticDebug|Win32.ActiveCfg = StaticDebug|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.StaticDebug|Win32.Build.0 = StaticDebug|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.StaticRelease|Win32.ActiveCfg = StaticRelease|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.StaticRelease|Win32.Build.0 = StaticRelease|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.WithOpenPGM|Win32.ActiveCfg = WithOpenPGM|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.WithOpenPGM|Win32.Build.0 = WithOpenPGM|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -60,5 +107,6 @@ Global
{3E283F37-A4ED-41B7-A3E6-A2D89D131A30} = {79C6CA55-40CE-4F5F-A29E-F06C0158D617} {3E283F37-A4ED-41B7-A3E6-A2D89D131A30} = {79C6CA55-40CE-4F5F-A29E-F06C0158D617}
{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE} = {79C6CA55-40CE-4F5F-A29E-F06C0158D617} {B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE} = {79C6CA55-40CE-4F5F-A29E-F06C0158D617}
{1738D5F6-ED1E-47E0-B2F0-456864B93C1E} = {79C6CA55-40CE-4F5F-A29E-F06C0158D617} {1738D5F6-ED1E-47E0-B2F0-456864B93C1E} = {79C6CA55-40CE-4F5F-A29E-F06C0158D617}
{641C5F36-32EE-4323-B740-992B651CF9D6} = {A0BC6B90-A412-4E7C-8F34-E3BBF135AC1B}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View file

@ -1,8 +1,36 @@
#include <iostream> #include <iostream>
#include <string>
#include <zmq.hpp>
#include "proto/request.pb.h"
#include "proto/reply.pb.h"
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
std::cout << "Server running" << std::endl; std::cout << "Server running" << std::endl;
zmq::context_t context(1);
zmq::socket_t socket(context, ZMQ_REP);
socket.bind("tcp://*:5555");
while (true)
{
zmq::message_t request;
socket.recv(&request);
Messages::Request requestMessage;
requestMessage.ParseFromArray(request.data(), request.size());
std::cout << "Received request: " << requestMessage.text() << std::endl;
Messages::Reply replyMessage;
replyMessage.set_text("Hello Client");
zmq::message_t reply(replyMessage.ByteSize());
replyMessage.SerializeToArray(reply.data(), reply.size());
socket.send(reply);
}
return 0; return 0;
} }

View file

@ -52,10 +52,14 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\protobuf\src\;..\zeromq\include\</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libzmq.lib;libprotobuf.lib</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -67,17 +71,47 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\protobuf\src\;..\zeromq\include\</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libzmq.lib;libprotobuf.lib</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="proto\reply.pb.cc" />
<ClCompile Include="proto\request.pb.cc" />
<ClCompile Include="Server.cpp" /> <ClCompile Include="Server.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<CustomBuild Include="..\proto\reply.proto">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
</CustomBuild>
<CustomBuild Include="..\proto\request.proto">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">proto\%(Filename).pb.h;proto\%(Filename).pb.cc</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="proto\reply.pb.h" />
<ClInclude Include="proto\request.pb.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View file

@ -13,10 +13,35 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
<Filter Include="proto">
<UniqueIdentifier>{95877168-7cc8-4323-8a83-927d71656fd0}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Server.cpp"> <ClCompile Include="Server.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="proto\reply.pb.cc">
<Filter>proto</Filter>
</ClCompile>
<ClCompile Include="proto\request.pb.cc">
<Filter>proto</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\proto\reply.proto">
<Filter>proto</Filter>
</CustomBuild>
<CustomBuild Include="..\proto\request.proto">
<Filter>proto</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="proto\reply.pb.h">
<Filter>proto</Filter>
</ClInclude>
<ClInclude Include="proto\request.pb.h">
<Filter>proto</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

344
Server/proto/reply.pb.cc Normal file
View file

@ -0,0 +1,344 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: reply.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "reply.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace Messages {
namespace {
const ::google::protobuf::Descriptor* Reply_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Reply_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_reply_2eproto() {
protobuf_AddDesc_reply_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"reply.proto");
GOOGLE_CHECK(file != NULL);
Reply_descriptor_ = file->message_type(0);
static const int Reply_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, text_),
};
Reply_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
Reply_descriptor_,
Reply::default_instance_,
Reply_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(Reply));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_reply_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Reply_descriptor_, &Reply::default_instance());
}
} // namespace
void protobuf_ShutdownFile_reply_2eproto() {
delete Reply::default_instance_;
delete Reply_reflection_;
}
void protobuf_AddDesc_reply_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\013reply.proto\022\010Messages\"\025\n\005Reply\022\014\n\004text"
"\030\001 \001(\t", 46);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"reply.proto", &protobuf_RegisterTypes);
Reply::default_instance_ = new Reply();
Reply::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_reply_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_reply_2eproto {
StaticDescriptorInitializer_reply_2eproto() {
protobuf_AddDesc_reply_2eproto();
}
} static_descriptor_initializer_reply_2eproto_;
// ===================================================================
#ifndef _MSC_VER
const int Reply::kTextFieldNumber;
#endif // !_MSC_VER
Reply::Reply()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Messages.Reply)
}
void Reply::InitAsDefaultInstance() {
}
Reply::Reply(const Reply& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Messages.Reply)
}
void Reply::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Reply::~Reply() {
// @@protoc_insertion_point(destructor:Messages.Reply)
SharedDtor();
}
void Reply::SharedDtor() {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete text_;
}
if (this != default_instance_) {
}
}
void Reply::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Reply::descriptor() {
protobuf_AssignDescriptorsOnce();
return Reply_descriptor_;
}
const Reply& Reply::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_reply_2eproto();
return *default_instance_;
}
Reply* Reply::default_instance_ = NULL;
Reply* Reply::New() const {
return new Reply;
}
void Reply::Clear() {
if (has_text()) {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_->clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool Reply::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Messages.Reply)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string text = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_text()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::PARSE,
"text");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Messages.Reply)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Messages.Reply)
return false;
#undef DO_
}
void Reply::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Messages.Reply)
// optional string text = 1;
if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"text");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->text(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Messages.Reply)
}
::google::protobuf::uint8* Reply::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Messages.Reply)
// optional string text = 1;
if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"text");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->text(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Messages.Reply)
return target;
}
int Reply::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string text = 1;
if (has_text()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->text());
}
}
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 Reply::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const Reply* source =
::google::protobuf::internal::dynamic_cast_if_available<const Reply*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void Reply::MergeFrom(const Reply& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_text()) {
set_text(from.text());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void Reply::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Reply::CopyFrom(const Reply& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Reply::IsInitialized() const {
return true;
}
void Reply::Swap(Reply* other) {
if (other != this) {
std::swap(text_, other->text_);
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 Reply::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Reply_descriptor_;
metadata.reflection = Reply_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Messages
// @@protoc_insertion_point(global_scope)

221
Server/proto/reply.pb.h Normal file
View file

@ -0,0 +1,221 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: reply.proto
#ifndef PROTOBUF_reply_2eproto__INCLUDED
#define PROTOBUF_reply_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2006000
#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 2006001 < 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/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
namespace Messages {
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_reply_2eproto();
void protobuf_AssignDesc_reply_2eproto();
void protobuf_ShutdownFile_reply_2eproto();
class Reply;
// ===================================================================
class Reply : public ::google::protobuf::Message {
public:
Reply();
virtual ~Reply();
Reply(const Reply& from);
inline Reply& operator=(const Reply& 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 Reply& default_instance();
void Swap(Reply* other);
// implements Message ----------------------------------------------
Reply* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const Reply& from);
void MergeFrom(const Reply& 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 -------------------------------------------------------
// optional string text = 1;
inline bool has_text() const;
inline void clear_text();
static const int kTextFieldNumber = 1;
inline const ::std::string& text() const;
inline void set_text(const ::std::string& value);
inline void set_text(const char* value);
inline void set_text(const char* value, size_t size);
inline ::std::string* mutable_text();
inline ::std::string* release_text();
inline void set_allocated_text(::std::string* text);
// @@protoc_insertion_point(class_scope:Messages.Reply)
private:
inline void set_has_text();
inline void clear_has_text();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::uint32 _has_bits_[1];
mutable int _cached_size_;
::std::string* text_;
friend void protobuf_AddDesc_reply_2eproto();
friend void protobuf_AssignDesc_reply_2eproto();
friend void protobuf_ShutdownFile_reply_2eproto();
void InitAsDefaultInstance();
static Reply* default_instance_;
};
// ===================================================================
// ===================================================================
// Reply
// optional string text = 1;
inline bool Reply::has_text() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Reply::set_has_text() {
_has_bits_[0] |= 0x00000001u;
}
inline void Reply::clear_has_text() {
_has_bits_[0] &= ~0x00000001u;
}
inline void Reply::clear_text() {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_->clear();
}
clear_has_text();
}
inline const ::std::string& Reply::text() const {
// @@protoc_insertion_point(field_get:Messages.Reply.text)
return *text_;
}
inline void Reply::set_text(const ::std::string& value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set:Messages.Reply.text)
}
inline void Reply::set_text(const char* value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set_char:Messages.Reply.text)
}
inline void Reply::set_text(const char* value, size_t size) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:Messages.Reply.text)
}
inline ::std::string* Reply::mutable_text() {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
// @@protoc_insertion_point(field_mutable:Messages.Reply.text)
return text_;
}
inline ::std::string* Reply::release_text() {
clear_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
return NULL;
} else {
::std::string* temp = text_;
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
return temp;
}
}
inline void Reply::set_allocated_text(::std::string* text) {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete text_;
}
if (text) {
set_has_text();
text_ = text;
} else {
clear_has_text();
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
// @@protoc_insertion_point(field_set_allocated:Messages.Reply.text)
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Messages
#ifndef SWIG
namespace google {
namespace protobuf {
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_reply_2eproto__INCLUDED

344
Server/proto/request.pb.cc Normal file
View file

@ -0,0 +1,344 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: request.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "request.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace Messages {
namespace {
const ::google::protobuf::Descriptor* Request_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Request_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_request_2eproto() {
protobuf_AddDesc_request_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"request.proto");
GOOGLE_CHECK(file != NULL);
Request_descriptor_ = file->message_type(0);
static const int Request_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, text_),
};
Request_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
Request_descriptor_,
Request::default_instance_,
Request_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(Request));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_request_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Request_descriptor_, &Request::default_instance());
}
} // namespace
void protobuf_ShutdownFile_request_2eproto() {
delete Request::default_instance_;
delete Request_reflection_;
}
void protobuf_AddDesc_request_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\rrequest.proto\022\010Messages\"\027\n\007Request\022\014\n\004"
"text\030\001 \001(\t", 50);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"request.proto", &protobuf_RegisterTypes);
Request::default_instance_ = new Request();
Request::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_request_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_request_2eproto {
StaticDescriptorInitializer_request_2eproto() {
protobuf_AddDesc_request_2eproto();
}
} static_descriptor_initializer_request_2eproto_;
// ===================================================================
#ifndef _MSC_VER
const int Request::kTextFieldNumber;
#endif // !_MSC_VER
Request::Request()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Messages.Request)
}
void Request::InitAsDefaultInstance() {
}
Request::Request(const Request& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Messages.Request)
}
void Request::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Request::~Request() {
// @@protoc_insertion_point(destructor:Messages.Request)
SharedDtor();
}
void Request::SharedDtor() {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete text_;
}
if (this != default_instance_) {
}
}
void Request::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Request::descriptor() {
protobuf_AssignDescriptorsOnce();
return Request_descriptor_;
}
const Request& Request::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_request_2eproto();
return *default_instance_;
}
Request* Request::default_instance_ = NULL;
Request* Request::New() const {
return new Request;
}
void Request::Clear() {
if (has_text()) {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_->clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool Request::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Messages.Request)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string text = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_text()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::PARSE,
"text");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Messages.Request)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Messages.Request)
return false;
#undef DO_
}
void Request::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Messages.Request)
// optional string text = 1;
if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"text");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->text(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Messages.Request)
}
::google::protobuf::uint8* Request::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Messages.Request)
// optional string text = 1;
if (has_text()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->text().data(), this->text().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"text");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->text(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Messages.Request)
return target;
}
int Request::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string text = 1;
if (has_text()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->text());
}
}
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 Request::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const Request* source =
::google::protobuf::internal::dynamic_cast_if_available<const Request*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void Request::MergeFrom(const Request& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_text()) {
set_text(from.text());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void Request::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Request::CopyFrom(const Request& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Request::IsInitialized() const {
return true;
}
void Request::Swap(Request* other) {
if (other != this) {
std::swap(text_, other->text_);
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 Request::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Request_descriptor_;
metadata.reflection = Request_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Messages
// @@protoc_insertion_point(global_scope)

221
Server/proto/request.pb.h Normal file
View file

@ -0,0 +1,221 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: request.proto
#ifndef PROTOBUF_request_2eproto__INCLUDED
#define PROTOBUF_request_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2006000
#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 2006001 < 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/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
namespace Messages {
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_request_2eproto();
void protobuf_AssignDesc_request_2eproto();
void protobuf_ShutdownFile_request_2eproto();
class Request;
// ===================================================================
class Request : public ::google::protobuf::Message {
public:
Request();
virtual ~Request();
Request(const Request& from);
inline Request& operator=(const Request& 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 Request& default_instance();
void Swap(Request* other);
// implements Message ----------------------------------------------
Request* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const Request& from);
void MergeFrom(const Request& 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 -------------------------------------------------------
// optional string text = 1;
inline bool has_text() const;
inline void clear_text();
static const int kTextFieldNumber = 1;
inline const ::std::string& text() const;
inline void set_text(const ::std::string& value);
inline void set_text(const char* value);
inline void set_text(const char* value, size_t size);
inline ::std::string* mutable_text();
inline ::std::string* release_text();
inline void set_allocated_text(::std::string* text);
// @@protoc_insertion_point(class_scope:Messages.Request)
private:
inline void set_has_text();
inline void clear_has_text();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::uint32 _has_bits_[1];
mutable int _cached_size_;
::std::string* text_;
friend void protobuf_AddDesc_request_2eproto();
friend void protobuf_AssignDesc_request_2eproto();
friend void protobuf_ShutdownFile_request_2eproto();
void InitAsDefaultInstance();
static Request* default_instance_;
};
// ===================================================================
// ===================================================================
// Request
// optional string text = 1;
inline bool Request::has_text() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Request::set_has_text() {
_has_bits_[0] |= 0x00000001u;
}
inline void Request::clear_has_text() {
_has_bits_[0] &= ~0x00000001u;
}
inline void Request::clear_text() {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_->clear();
}
clear_has_text();
}
inline const ::std::string& Request::text() const {
// @@protoc_insertion_point(field_get:Messages.Request.text)
return *text_;
}
inline void Request::set_text(const ::std::string& value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set:Messages.Request.text)
}
inline void Request::set_text(const char* value) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(value);
// @@protoc_insertion_point(field_set_char:Messages.Request.text)
}
inline void Request::set_text(const char* value, size_t size) {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
text_->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:Messages.Request.text)
}
inline ::std::string* Request::mutable_text() {
set_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
text_ = new ::std::string;
}
// @@protoc_insertion_point(field_mutable:Messages.Request.text)
return text_;
}
inline ::std::string* Request::release_text() {
clear_has_text();
if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
return NULL;
} else {
::std::string* temp = text_;
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
return temp;
}
}
inline void Request::set_allocated_text(::std::string* text) {
if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete text_;
}
if (text) {
set_has_text();
text_ = text;
} else {
clear_has_text();
text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
// @@protoc_insertion_point(field_set_allocated:Messages.Request.text)
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Messages
#ifndef SWIG
namespace google {
namespace protobuf {
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_request_2eproto__INCLUDED

7
proto/reply.proto Normal file
View file

@ -0,0 +1,7 @@
package Messages;
message Reply
{
optional string text = 1;
}

7
proto/request.proto Normal file
View file

@ -0,0 +1,7 @@
package Messages;
message Request
{
optional string text = 1;
}