summaryrefslogtreecommitdiff
path: root/ecp/src/ecp/dir/dir.h
blob: f88cf7c8feb38b8c2f4e8b4e5abf7ef128078f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#define ECP_SIZE_DIR_ITEM       40

#define ECP_MTYPE_DIR_REQ       0x00
#define ECP_MTYPE_DIR_REP       (0x01 | ECP_MTYPE_FLAG_FRAG)

#define ECP_CTYPE_DIR           (0x00 | ECP_CTYPE_FLAG_SYS)

#define ECP_ROLE_DIR            0x01
#define ECP_ROLE_VCONN          0x02

typedef struct ECPDirItem {
    ECPNode node;
    uint8_t region;
    uint8_t roles;
} ECPDirItem;

int ecp_dir_item_eq(ECPDirItem *item1, ECPDirItem *item2);
size_t ecp_dir_item_parse(ECPDirItem *item, unsigned char *buf);
size_t ecp_dir_item_serialize(ECPDirItem *item, unsigned char *buf);

int ecp_dir_handle_open(ECPConnection *conn, ECP2Buffer *b);
ssize_t ecp_dir_send_req(ECPConnection *conn);
void ecp_dir_conn_init(ECPConnection *conn, ECPSocket *sock);