25 lines
641 B
C
25 lines
641 B
C
|
#ifndef RDBSERVER_CLIENT_H_
|
||
|
#define RDBSERVER_CLIENT_H_
|
||
|
|
||
|
#include <stdbool.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <sys/types.h>
|
||
|
|
||
|
#define RDB_CLIENT_BUFLEN 8096
|
||
|
|
||
|
typedef struct RdbClient {
|
||
|
int connfd;
|
||
|
char full_buf[RDB_CLIENT_BUFLEN];
|
||
|
size_t len;
|
||
|
char chk;
|
||
|
bool should_ack;
|
||
|
} RdbClient;
|
||
|
|
||
|
void rdb_client_init(RdbClient *self, int connfd);
|
||
|
ssize_t rdb_client_read(RdbClient *self, char *buf, size_t len);
|
||
|
void rdb_client_begin_packet(RdbClient *self);
|
||
|
bool rdb_client_write_str(RdbClient *self, const char *str);
|
||
|
bool rdb_client_write_str_hex(RdbClient *self, const char *str);
|
||
|
int rdb_client_send_packet(RdbClient *self);
|
||
|
|
||
|
#endif
|