Rename RdbClient to RdbResponse

This commit is contained in:
2024-10-07 22:18:42 -04:00
parent 1b273171ad
commit 6ea396a974
9 changed files with 201 additions and 199 deletions
-27
View File
@@ -1,27 +0,0 @@
#ifndef RDBSERVER_CLIENT_H_
#define RDBSERVER_CLIENT_H_
#include <stdbool.h>
#include <stdint.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);
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);
bool rdb_client_write_i8_hex(RdbClient *self, uint8_t value);
bool rdb_client_write_i32_hex(RdbClient *self, uint32_t value);
int rdb_client_send_packet(RdbClient *self);
#endif
+1 -1
View File
@@ -35,7 +35,7 @@ typedef struct RdbRequest {
char chk;
} RdbRequest;
void rdb_request_init(RdbRequest *req, int connfd, char *cmd, size_t cmdlen);
void rdb_request_init(RdbRequest *req, int connfd, char *buf, size_t buflen);
void rdb_request_reset(RdbRequest *req);
void rdb_request_set_blocking(RdbRequest *req, bool blocking);
rdb_read_result_t rdb_request_read(RdbRequest *req, CommandBuf *cmd);
+26
View File
@@ -0,0 +1,26 @@
#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;
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
+2 -2
View File
@@ -1,11 +1,11 @@
#ifndef RDBSERVER_SERVER_H_
#define RDBSERVER_SERVER_H_
#include <client.h>
#include <cmdbuf.h>
#include <response.h>
#include <stdbool.h>
#include <vb.h>
int handle_command(RdbClient *client, CommandBuf *cmd, VB *sim, bool *running);
int handle_command(RdbResponse *res, CommandBuf *cmd, VB *sim, bool *running);
#endif