RDFS
The Rice Comp413 2017 class' continuation on the work of the 2016 RDFS.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
socket_reads.h
1 // Copyright 2017 Rice University, COMP 413 2017
2 
3 #include <netinet/in.h>
4 #include <iostream>
5 #include <asio.hpp>
6 
7 #include <ProtobufRpcEngine.pb.h>
8 
9 #pragma once
10 
11 using asio::ip::tcp;
12 
13 namespace rpcserver {
18 asio::error_code read_full(tcp::socket &sock, asio::mutable_buffers_1 buf);
23 bool read_byte(tcp::socket &sock, unsigned char *byte);
28 bool read_int16(tcp::socket &sock, uint16_t *out);
33 bool read_int32(tcp::socket &sock, uint32_t *out);
38 bool read_int64(tcp::socket &sock, uint64_t *out);
43 size_t read_varint(tcp::socket &sock, uint64_t *out);
49 bool read_delimited_proto(
50  tcp::socket &sock,
51  ::google::protobuf::Message &proto,
52  uint64_t *consumed);
57 bool read_delimited_proto(
58  tcp::socket &sock,
59  ::google::protobuf::Message &proto);
64 bool read_proto(
65  tcp::socket &sock,
66  ::google::protobuf::Message &proto, uint64_t len);
67 } // namespace rpcserver