diff options
author | kartofen <mladenovnasko0@gmail.com> | 2023-12-25 01:45:05 +0200 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2023-12-25 01:45:05 +0200 |
commit | 4b0fdca8673c76cb2305db301a3b36e9e3822e02 (patch) | |
tree | bbcf1c6364baba0afe9a2a595f4a579ad0946188 /include |
Diffstat (limited to 'include')
-rw-r--r-- | include/rctp.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/rctp.h b/include/rctp.h new file mode 100644 index 0000000..71aa812 --- /dev/null +++ b/include/rctp.h @@ -0,0 +1,50 @@ +#ifndef RCTP_H +#define RCTP_H + +typedef unsigned char rctp_byte; + +typedef struct request rctp_req_t; +typedef struct response rctp_res_t; + +typedef enum { + RCTP_OK = 0, + RCTP_ERROR, // unknown error + + RCTP_UNKNOWN_METHOD, + RCTP_UNKNOWN_STATUS, + + RCTP_INVALID_STRING, +} RCTP_STAT; + +#define RCTP_METHODS(X) \ + X(PING) \ + +#define RCTP_STATUSES(X) \ + X(PONG) \ + +#define TO_ENUM(s) s, +#define TO_STR(s) #s, + +enum rctp_method { + RCTP_METHODS(TO_ENUM) +} __attribute__((packed)); + +enum rctp_status { + RCTP_STATUSES(TO_ENUM) +} __attribute__((packed)); + +struct request { + enum rctp_req method; + union { + /* ... */ + }; +} __attribute__((packed)); + +struct response { + enum rctp_res status; + union { + /* ... */ + }; +} __attribute__((packed)); + +#endif |