#ifndef RDBSERVER_RESPONSE_H_ #define RDBSERVER_RESPONSE_H_ #include #include #include #include typedef struct RdbResponse { int connfd; char *buf; size_t buflen; size_t len; char chk; bool should_ack; } RdbResponse; void rdb_response_init(RdbResponse *self, int connfd, char *buf, size_t buflen); void rdb_response_begin_packet(RdbResponse *self); bool rdb_response_write_str(RdbResponse *self, const char *str); bool rdb_response_write_str_hex(RdbResponse *self, const char *str); bool rdb_response_write_i8_hex(RdbResponse *self, uint8_t value); bool rdb_response_write_i32_hex(RdbResponse *self, uint32_t value); int rdb_response_send_packet(RdbResponse *self); #endif