blob: b75b2ee7d645bad4e7b2c993eee14cd1a478630b (
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
|
#include <stdlib.h>
#include <stdio.h>
#include <ecp/core.h>
static void handle_err(ECPConnection *conn, unsigned char mtype, int err) {
printf("ERR: CTYPE:%d MTYPE:%x ERR:%d\n", conn->type, mtype, err);
}
static ECPConnection *conn_new(ECPSocket *sock, unsigned char type) {
ECPConnection *conn;
conn = malloc(sizeof(ECPConnection));
if (conn) ecp_conn_init(conn, sock, type);
return conn;
}
static void conn_free(ECPConnection *conn) {
if (ecp_conn_is_gc(conn)) free(conn);
}
int ecp_init(ECPContext *ctx) {
int rv;
rv = ecp_ctx_init(ctx, handle_err, conn_new, conn_free);
return rv;
}
|