initial version from before

This commit is contained in:
2024-10-01 18:48:28 -04:00
commit bf969e72b4
5 changed files with 532 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#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