21#include <citrusleaf/cf_byte_order.h>
33#define AS_PROTO_VERSION 2
36#define AS_INFO_MESSAGE_TYPE 1
37#define AS_ADMIN_MESSAGE_TYPE 2
38#define AS_MESSAGE_TYPE 3
39#define AS_COMPRESSED_MESSAGE_TYPE 4
40#define PROTO_SIZE_MAX (128 * 1024 * 1024)
46#if defined(__APPLE__) || defined(_MSC_VER)
94} __attribute__ ((__packed__)) as_proto;
100} __attribute__((__packed__)) as_compressed_proto;
115} __attribute__((__packed__)) as_msg;
120} __attribute__((__packed__)) as_proto_msg;
141 if (
proto->type != expected_type) {
150 if (size <
sizeof(as_msg)) {
160 *size = (size_t)cf_swap_from_be64(*(uint64_t*)buf);
as_status as_proto_parse(as_error *err, as_proto *proto)
as_status as_proto_type_error(as_error *err, as_proto *proto, uint8_t expected)
as_status as_compressed_size_error(as_error *err, size_t size)
void as_proto_swap_from_be(as_proto *m)
static as_status as_proto_parse_type(as_error *err, as_proto *proto, uint8_t expected_type)
void as_msg_swap_header_from_be(as_msg *m)
as_status as_proto_size_error(as_error *err, size_t size)
void as_proto_swap_to_be(as_proto *m)
static as_status as_compressed_size_parse(as_error *err, const uint8_t *buf, size_t *size)
as_status as_proto_version_error(as_error *err, as_proto *proto)
as_status as_proto_decompress(as_error *err, uint8_t *trg, size_t trg_sz, uint8_t *src, size_t src_sz)
static as_status as_msg_parse(as_error *err, as_msg *msg, size_t size)