diff options
Diffstat (limited to 'src/trans-libnl.c')
-rw-r--r-- | src/trans-libnl.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/trans-libnl.c b/src/trans-libnl.c index c623375..3da465f 100644 --- a/src/trans-libnl.c +++ b/src/trans-libnl.c @@ -112,14 +112,12 @@ static int set_no_enobufs(struct trans_handle *h) &val, sizeof(val)); } -int trans_init(struct trans_handle *h, trans_cb_t cb) +int lnl_init(struct trans_handle *h, trans_cb_t cb) { struct nl_handle *sock; int family; int err; - memset(h, 0x0, sizeof(*h)); - sock = nl_handle_alloc(); if (!sock) return nl_get_errno(); @@ -143,7 +141,6 @@ int trans_init(struct trans_handle *h, trans_cb_t cb) h->sock = sock; h->family = family; - h->cb = cb; err = set_no_enobufs(h); if (err) @@ -152,13 +149,13 @@ int trans_init(struct trans_handle *h, trans_cb_t cb) return 0; } -int trans_close(struct trans_handle *h) +int lnl_close(struct trans_handle *h) { nl_handle_destroy(h->sock); return 0; } -int trans_process(struct trans_handle *h) +int lnl_process(struct trans_handle *h) { int err; @@ -169,7 +166,7 @@ int trans_process(struct trans_handle *h) return err; } -int trans_send(struct trans_handle *h, struct trans_msg *m) +static int lnl_send(struct trans_handle *h, struct trans_msg *m) { struct nl_msg *msg; int err; @@ -201,12 +198,21 @@ int trans_send(struct trans_handle *h, struct trans_msg *m) return err > 0 ? 0 : err; } -int trans_group(struct trans_handle *h, int group) +static int lnl_group(struct trans_handle *h, int group) { return nl_socket_add_membership(h->sock, group); } -int trans_fd(struct trans_handle *h) +static int lnl_fd(struct trans_handle *h) { return nl_socket_get_fd(h->sock); } + +struct trans_layer trans_nl = { + .init = lnl_init, + .close = lnl_close, + .process = lnl_process, + .send = lnl_send, + .group = lnl_group, + .fd = lnl_fd, +}; |