aboutsummaryrefslogtreecommitdiff
path: root/include/rctp.h
blob: 71aa81212622cfd6eea36d99fe4d9a402f80d392 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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