2024-10-06 22:47:44 +00:00
|
|
|
#ifndef RDBSERVER_CMDBUF_H_
|
|
|
|
#define RDBSERVER_CMDBUF_H_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
typedef struct CommandBuf {
|
|
|
|
char *buf;
|
|
|
|
size_t len;
|
|
|
|
} CommandBuf;
|
|
|
|
|
|
|
|
/* Try to consume a string literal. */
|
2024-10-10 22:38:40 +00:00
|
|
|
bool cmdMatchStr(CommandBuf *cmd, const char *str);
|
2024-10-06 22:47:44 +00:00
|
|
|
/* Try to consume a base-16 number, and return the value. */
|
2024-10-10 22:38:40 +00:00
|
|
|
bool cmdMatchHexNumber(CommandBuf *cmd, uint32_t *value);
|
2024-10-06 22:47:44 +00:00
|
|
|
/* Try to consume a hex-encoded list of bytes, and return the value. */
|
2024-10-10 22:38:40 +00:00
|
|
|
bool cmdMatchHexBytes(CommandBuf *cmd, const uint32_t count, uint8_t *value);
|
2024-10-06 22:47:44 +00:00
|
|
|
|
|
|
|
#endif
|