21 #ifndef COMMON_RPC_STREAMRPCCHANNEL_H_
22 #define COMMON_RPC_STREAMRPCCHANNEL_H_
29 #include <google/protobuf/service.h>
31 #include <ola/io/Descriptor.h>
32 #include <ola/io/SelectServer.h>
33 #include <ola/util/SequenceNumber.h>
43 using google::protobuf::Message;
44 using google::protobuf::MethodDescriptor;
45 using google::protobuf::RpcChannel;
46 using google::protobuf::RpcController;
47 using google::protobuf::Service;
60 RpcController *controller;
73 RpcController *controller;
74 google::protobuf::Closure *callback;
141 const MethodDescriptor *method,
142 RpcController *controller,
143 const Message *request,
145 google::protobuf::Closure *done);
160 typedef HASH_NAMESPACE::HASH_MAP_CLASS<int, OutstandingResponse*>
163 bool SendMsg(RpcMessage *msg);
164 int AllocateMsgBuffer(
unsigned int size);
165 int ReadHeader(
unsigned int *version,
unsigned int *size)
const;
166 bool HandleNewMsg(uint8_t *buffer,
unsigned int size);
167 void HandleRequest(RpcMessage *msg);
168 void HandleStreamRequest(RpcMessage *msg);
172 void SendNotImplemented(
int msg_id);
176 void HandleResponse(RpcMessage *msg);
177 void HandleFailedResponse(RpcMessage *msg);
178 void HandleCanceledResponse(RpcMessage *msg);
179 void HandleNotImplemented(RpcMessage *msg);
181 void HandleChannelClose();
184 std::auto_ptr<SingleUseCallback0<void> > m_on_close;
189 unsigned int m_buffer_size;
190 unsigned int m_expected_size;
191 unsigned int m_current_size;
192 HASH_NAMESPACE::HASH_MAP_CLASS<int, OutstandingRequest*> m_requests;
193 ResponseMap m_responses;
197 static const char K_RPC_RECEIVED_TYPE_VAR[];
198 static const char K_RPC_RECEIVED_VAR[];
199 static const char K_RPC_SENT_ERROR_VAR[];
200 static const char K_RPC_SENT_VAR[];
201 static const char *K_RPC_VARIABLES[];
202 static const char STREAMING_NO_RESPONSE[];
203 static const unsigned int INITIAL_BUFFER_SIZE = 1 << 11;
204 static const unsigned int MAX_BUFFER_SIZE = 1 << 20;
208 #endif // COMMON_RPC_STREAMRPCCHANNEL_H_