summaryrefslogtreecommitdiff
path: root/src/protocol.h
blob: de7cb3ab6152cc31290060c0d705cc31f67da743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef BOKF_PROTOCOL_H
#define BOKF_PROTOCOL_H

#include <sqlite3.h>
#include <stdint.h>

#include "sessions.h"
#include "yyjson.h"

struct req {
    sqlite3 *db;
    yyjson_mut_doc *rdoc;
    const char *id;
    const char *cmd;
    struct session *sess;
    int64_t org_id;
    int has_org;
    int is_admin;
    const char *role;
    int dry_run;
    yyjson_val *args;
    const char *err_code;
    char err_msg[512];
    yyjson_mut_val *err_details;
};

/* Returns a malloc'd response line (no trailing newline). */
char *protocol_handle_line(sqlite3 *db, const char *line, size_t len);

#endif