简化协议,

/**
 * Request
 * Cmd: 	| OP(1) | argc(1) | repeat { arglen(4) | arg } |
 *
 * Response
 * Rsp:		| OP(1) | status(1) | datalen(4) | data |
 */

封装客户端进行批处理和单条命令测试。
This commit is contained in:
2026-01-06 19:16:12 +08:00
parent 0dc86f5aa5
commit 144b374aa2
13 changed files with 815 additions and 634 deletions

View File

@@ -27,13 +27,15 @@
#if ENABLE_KVSTORE
typedef int (*msg_handler)(char *msg, int length, char *response);
// typedef int (*msg_handler)(char *msg, int length, char *response);
typedef int (*msg_handler)(char *request, int request_length, int *consumed_out, char *response, int *response_length);
static msg_handler kvs_handler;
int kvs_request(struct conn *c) {
c->wlength = kvs_handler(c->rbuffer, c->rlength, c->wbuffer);
int consumed_out;
int ret = kvs_handler(c->rbuffer, c->rlength, &consumed_out, c->wbuffer, &c->wlength);
}