21 #ifndef COMMON_RPC_RPCCHANNEL_H_
22 #define COMMON_RPC_RPCCHANNEL_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>
37 #include "common/rpc/RpcController.h"
57 google::protobuf::Message *response;
121 void CallMethod(
const google::protobuf::MethodDescriptor *method,
123 const google::protobuf::Message *request,
124 google::protobuf::Message *response,
140 typedef HASH_NAMESPACE::HASH_MAP_CLASS<int, class OutstandingResponse*>
143 bool SendMsg(RpcMessage *msg);
144 int AllocateMsgBuffer(
unsigned int size);
145 int ReadHeader(
unsigned int *version,
unsigned int *size)
const;
146 bool HandleNewMsg(uint8_t *buffer,
unsigned int size);
147 void HandleRequest(RpcMessage *msg);
148 void HandleStreamRequest(RpcMessage *msg);
152 void SendNotImplemented(
int msg_id);
156 void HandleResponse(RpcMessage *msg);
157 void HandleFailedResponse(RpcMessage *msg);
158 void HandleCanceledResponse(RpcMessage *msg);
159 void HandleNotImplemented(RpcMessage *msg);
161 void HandleChannelClose();
164 std::auto_ptr<SingleUseCallback0<void> > m_on_close;
169 unsigned int m_buffer_size;
170 unsigned int m_expected_size;
171 unsigned int m_current_size;
172 HASH_NAMESPACE::HASH_MAP_CLASS<int, OutstandingRequest*> m_requests;
173 ResponseMap m_responses;
177 static const char K_RPC_RECEIVED_TYPE_VAR[];
178 static const char K_RPC_RECEIVED_VAR[];
179 static const char K_RPC_SENT_ERROR_VAR[];
180 static const char K_RPC_SENT_VAR[];
181 static const char *K_RPC_VARIABLES[];
182 static const char STREAMING_NO_RESPONSE[];
183 static const unsigned int INITIAL_BUFFER_SIZE = 1 << 11;
184 static const unsigned int MAX_BUFFER_SIZE = 1 << 20;
188 #endif // COMMON_RPC_RPCCHANNEL_H_