diff options
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 |