diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-17 19:55:36 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-17 19:55:36 +0200 |
| commit | 380195f7cd5e57acf2c1cf2bc41069e6b0b979ed (patch) | |
| tree | 32a88fb22a7fbe8f1fd5c105156d1f928c93950d /clients/client.h | |
| download | bokf-0.1.0.tar.gz bokf-0.1.0.zip | |
Initial commit: daemon, clients, docs, Docker deploy pipelinev0.1.0
Diffstat (limited to 'clients/client.h')
| -rw-r--r-- | clients/client.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clients/client.h b/clients/client.h new file mode 100644 index 0000000..7e18a23 --- /dev/null +++ b/clients/client.h @@ -0,0 +1,32 @@ +#ifndef BOKF_CLIENT_H +#define BOKF_CLIENT_H + +#include <stdint.h> + +/* Thin protocol client shared by bokfctl and bokftui. Connects to a unix + socket path or "tcp:host:port". */ + +int client_connect(const char *target); +int client_send_line(int fd, const char *line); +char *client_read_line(int fd); + +char *client_make_request(const char *cmd, const char *session, int64_t org, + const char *args_json, const char *id); +char *client_make_login_args(const char *user, const char *password); + +/* Sends one command and returns the raw response line (malloc'd), or NULL + on a transport error. */ +char *client_rpc(int fd, const char *cmd, const char *session, int64_t org, + const char *args_json); + +/* Password login. Returns 0 and sets *session_out on success; on failure + returns -1 and sets *err_out to the response line or an error message. */ +int client_login(int fd, const char *user, const char *password, + char **session_out, char **err_out); + +/* Convenience: true when the response line has "ok":true. */ +int client_ok(const char *response); +/* Extract result.session into buf; returns 0 on success. */ +int client_session_from(const char *response, char *buf, unsigned long cap); + +#endif |
