2024-10-08 02:18:42 +00:00
|
|
|
#ifndef RDBSERVER_RESPONSE_H_
|
|
|
|
#define RDBSERVER_RESPONSE_H_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
typedef struct RdbResponse {
|
|
|
|
int connfd;
|
|
|
|
char *buf;
|
|
|
|
size_t buflen;
|
|
|
|
size_t len;
|
|
|
|
char chk;
|
|
|
|
bool should_ack;
|
|
|
|
} RdbResponse;
|
|
|
|
|
2024-10-10 22:38:40 +00:00
|
|
|
void rdbResponseInit(RdbResponse *self, int connfd, char *buf, size_t buflen);
|
|
|
|
void rdbResponseBeginPacket(RdbResponse *self);
|
|
|
|
bool rdbResponseWriteStr(RdbResponse *self, const char *str);
|
|
|
|
bool rdbResponseWriteStrHex(RdbResponse *self, const char *str);
|
|
|
|
bool rdbResponseWriteI8Hex(RdbResponse *self, uint8_t value);
|
|
|
|
bool rdbResponseWriteI32Hex(RdbResponse *self, uint32_t value);
|
|
|
|
int rdbResponseSendPacket(RdbResponse *self);
|
2024-10-08 02:18:42 +00:00
|
|
|
|
|
|
|
#endif
|