diff options
Diffstat (limited to 'ecp/src/ecp/vconn/vconn.h')
-rw-r--r-- | ecp/src/ecp/vconn/vconn.h | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/ecp/src/ecp/vconn/vconn.h b/ecp/src/ecp/vconn/vconn.h index 8871ded..62275bf 100644 --- a/ecp/src/ecp/vconn/vconn.h +++ b/ecp/src/ecp/vconn/vconn.h @@ -5,29 +5,39 @@ #define ECP_MTYPE_EXEC 0x02 #define ECP_MTYPE_RELAY 0x01 -/* inbound only */ -typedef struct ECPVConn { +typedef struct ECPVConnInb { ECPConnection b; + ECPConnection *next; ECPDHPub key_next[ECP_MAX_NODE_KEY]; unsigned char key_next_curr; -} ECPVConn; +} ECPVConnInb; + +typedef struct ECPVConnOutb { + ECPConnection b; + ECPConnection *next; +} ECPVConnOutb; ssize_t ecp_vconn_pack_parent(ECPConnection *conn, ECPBuffer *payload, ECPBuffer *packet, size_t pkt_size, ecp_tr_addr_t *addr); -int ecp_vconn_create(ECPConnection vconn[], ecp_ecdh_public_t keys[], size_t vconn_size, ECPConnection *conn); +void ecp_vconn_init(ECPVConnOutb vconn[], ecp_ecdh_public_t keys[], size_t vconn_size, ECPSocket *sock); #ifdef ECP_WITH_HTABLE -int ecp_vconn_create_inb(ECPVConn *conn, ECPSocket *sock); -void ecp_vconn_destroy(ECPConnection *conn); +void ecp_vconn_init_inb(ECPVConnInb *vconn, ECPSocket *sock); #endif -int ecp_vconn_open(ECPConnection *conn, ECPNode *node); - -int ecp_vlink_create(ECPConnection *conn, ECPSocket *sock); +int ecp_vconn_open(ECPVConnOutb *vconn, ECPConnection *conn, ECPNode *node); #ifdef ECP_WITH_HTABLE -int ecp_vlink_create_inb(ECPConnection *conn, ECPSocket *sock); -void ecp_vlink_destroy(ECPConnection *conn); -#endif - int ecp_vconn_handle_open(ECPConnection *conn, ECP2Buffer *bufs); void ecp_vconn_handle_close(ECPConnection *conn); +#endif ssize_t ecp_vconn_handle_msg(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype, unsigned char *msg, size_t msg_size, ECP2Buffer *bufs); ssize_t ecp_vconn_send_open_req(ECPConnection *conn, unsigned char *cookie); + + +void ecp_vlink_init(ECPConnection *conn, ECPSocket *sock); +#ifdef ECP_WITH_HTABLE +int ecp_vlink_handle_open(ECPConnection *conn, ECP2Buffer *bufs); +void ecp_vlink_handle_close(ECPConnection *conn); +#endif +ssize_t ecp_vlink_handle_msg(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype, unsigned char *msg, size_t msg_size, ECP2Buffer *bufs); + +int ecp_vconn_handler_init(ECPContext *ctx, ECPConnHandler *vconn_handler); +int ecp_vlink_handler_init(ECPContext *ctx, ECPConnHandler *vlink_handler); |