summaryrefslogtreecommitdiff
path: root/ecp/src/ecp/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'ecp/src/ecp/core.h')
-rw-r--r--ecp/src/ecp/core.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/ecp/src/ecp/core.h b/ecp/src/ecp/core.h
index 5fa00a7..da200b7 100644
--- a/ecp/src/ecp/core.h
+++ b/ecp/src/ecp/core.h
@@ -299,6 +299,7 @@ typedef ssize_t (*ecp_conn_auth_t) (struct ECPSocket *sock, struct ECPConnection
typedef struct ECPConnection * (*ecp_conn_new_t) (struct ECPSocket *sock, struct ECPConnection *parent, unsigned char type);
typedef void (*ecp_conn_free_t) (struct ECPConnection *conn);
typedef void (*ecp_err_handler_t) (struct ECPConnection *conn, unsigned char mtype, int err);
+typedef void (*ecp_dir_handler_t) (struct ECPConnection *conn, void *dir_list, int err);
typedef int (*ecp_logger_t) (const char *fmt, ...);
typedef int (*ecp_open_handler_t) (struct ECPConnection *conn, struct ECP2Buffer *b);
@@ -364,6 +365,9 @@ typedef struct ECPContext {
ecp_conn_new_t conn_new; /* inbound connections only */
ecp_conn_free_t conn_free;
ecp_err_handler_t handle_err;
+#ifdef ECP_WITH_DIR
+ ecp_dir_handler_t handle_dir;
+#endif
ecp_logger_t logger;
ECPConnHandler *handler[ECP_MAX_CTYPE];
ECPConnHandler *handler_sys[ECP_MAX_CTYPE_SYS];
@@ -399,7 +403,7 @@ typedef struct ECPVConnTable {
typedef struct ECPSocket {
ECPContext *ctx;
- unsigned char running;
+ volatile int running;
ecp_tr_sock_t sock;
ecp_nonce_t nonce_out;
ECPDHKey key_perma;
@@ -448,6 +452,10 @@ typedef struct ECPConnection {
#ifdef ECP_WITH_PTHREAD
pthread_mutex_t mutex;
#endif
+#ifdef ECP_WITH_SYNC
+ pthread_cond_t cond;
+ int rv_sync;
+#endif
} ECPConnection;
int ecp_dhkey_gen(ECPDHKey *key);
@@ -523,6 +531,13 @@ void ecp_conn_unlock(ECPConnection *conn);
int ecp_conn_refcount_inc(ECPConnection *conn);
void ecp_conn_refcount_dec(ECPConnection *conn);
+#ifdef ECP_WITH_SYNC
+int ecp_conn_open_sync(ECPConnection *conn, ecp_ecdh_public_t *public, ecp_tr_addr_t *addr);
+int ecp_conn_keyx_sync(ECPConnection *conn);
+int ecp_conn_signal(ECPConnection *conn, int rv_sync);
+int ecp_conn_wait(ECPConnection *conn);
+#endif
+
int ecp_conn_dhkey_new(ECPConnection *conn);
int ecp_conn_dhkey_get(ECPConnection *conn, unsigned char idx, ECPDHKey *key);
void ecp_conn_dhkey_set_curr(ECPConnection *conn);