diff --git a/example/event_ops.c b/example/event_ops.c index f518467..ebce072 100644 --- a/example/event_ops.c +++ b/example/event_ops.c @@ -19,7 +19,7 @@ static void event_io_callback(int fd, short mask, void *data) if (mask & EV_WRITE) events |= DECT_FD_WRITE; - dect_handle_fd(dh, dfd, events); + dect_fd_process(dh, dfd, events); } static int register_fd(const struct dect_handle *dh, struct dect_fd *dfd, diff --git a/example/hijack.c b/example/hijack.c index 5eabc47..1fa909f 100644 --- a/example/hijack.c +++ b/example/hijack.c @@ -116,8 +116,8 @@ int main(int argc, char **argv) if (dfd == NULL) pexit("dect_raw_socket"); - dect_setup_fd(dfd, raw_sock_event, (void *)(unsigned long)slot); - if (dect_register_fd(dh, dfd, DECT_FD_WRITE) < 0) + dect_fd_setup(dfd, raw_sock_event, (void *)(unsigned long)slot); + if (dect_fd_register(dh, dfd, DECT_FD_WRITE) < 0) pexit("dect_register_fd"); timer = dect_timer_alloc(dh); @@ -129,7 +129,7 @@ int main(int argc, char **argv) dect_event_loop(); dect_timer_stop(dh, timer); - dect_unregister_fd(dh, dfd); + dect_fd_unregister(dh, dfd); dect_close(dh, dfd); dect_common_cleanup(dh); diff --git a/include/dect/libdect.h b/include/dect/libdect.h index d8b9c04..9678ef9 100644 --- a/include/dect/libdect.h +++ b/include/dect/libdect.h @@ -85,8 +85,8 @@ enum dect_fd_events { struct dect_fd; extern void *dect_fd_priv(struct dect_fd *dfd); extern int dect_fd_num(const struct dect_fd *dfd); -extern void dect_handle_fd(struct dect_handle *dh, struct dect_fd *dfd, - uint32_t events); +extern void dect_fd_process(struct dect_handle *dh, struct dect_fd *dfd, + uint32_t events); /** @} */ /** diff --git a/include/io.h b/include/io.h index 5d8c289..ff3f60c 100644 --- a/include/io.h +++ b/include/io.h @@ -33,8 +33,8 @@ struct dect_fd { uint8_t priv[] __aligned(__alignof__(uint64_t)); }; -extern struct dect_fd *dect_alloc_fd(const struct dect_handle *dh); -extern void dect_setup_fd(struct dect_fd *fd, +extern struct dect_fd *dect_fd_alloc(const struct dect_handle *dh); +extern void dect_fd_setup(struct dect_fd *fd, void (*cb)(struct dect_handle *, struct dect_fd *, uint32_t), void *data); @@ -46,8 +46,8 @@ extern struct dect_fd *dect_accept(const struct dect_handle *dh, const struct dect_fd *dfd, struct sockaddr *addr, socklen_t len); -extern int dect_register_fd(const struct dect_handle *dh, struct dect_fd *dfd, +extern int dect_fd_register(const struct dect_handle *dh, struct dect_fd *dfd, uint32_t events); -extern void dect_unregister_fd(const struct dect_handle *dh, struct dect_fd *dfd); +extern void dect_fd_unregister(const struct dect_handle *dh, struct dect_fd *dfd); #endif /* _LIBDECT_IO_H */ diff --git a/src/cc.c b/src/cc.c index b2dc6af..4848917 100644 --- a/src/cc.c +++ b/src/cc.c @@ -430,8 +430,8 @@ static int dect_call_connect_uplane(const struct dect_handle *dh, if (connect(call->lu_sap->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) goto err2; - dect_setup_fd(call->lu_sap, dect_cc_lu_event, call); - if (dect_register_fd(dh, call->lu_sap, DECT_FD_READ) < 0) + dect_fd_setup(call->lu_sap, dect_cc_lu_event, call); + if (dect_fd_register(dh, call->lu_sap, DECT_FD_READ) < 0) goto err2; cc_debug(call, "U-Plane connected"); return 0; @@ -450,7 +450,7 @@ static void dect_call_disconnect_uplane(const struct dect_handle *dh, if (call->lu_sap == NULL) return; - dect_unregister_fd(dh, call->lu_sap); + dect_fd_unregister(dh, call->lu_sap); dect_close(dh, call->lu_sap); call->lu_sap = NULL; cc_debug(call, "U-Plane disconnected"); diff --git a/src/io.c b/src/io.c index 6e5ed17..37fb452 100644 --- a/src/io.c +++ b/src/io.c @@ -22,7 +22,7 @@ * struct dect_event_ops to allow libdect to register it's file descriptors * with the application's event handler. The function dect_fd_num() can be used * to get the file decriptor number. When an event occurs, the function - * dect_handle_fd() must be invoked with a bitmask of enum #dect_fd_events + * dect_fd_handle() must be invoked with a bitmask of enum #dect_fd_events * specifying the events that occured. All events except the file descriptor * becoming writable map to #DECT_FD_READ. * @@ -49,7 +49,7 @@ #define SOCK_NONBLOCK O_NONBLOCK #endif -struct dect_fd *dect_alloc_fd(const struct dect_handle *dh) +struct dect_fd *dect_fd_alloc(const struct dect_handle *dh) { struct dect_fd *dfd; @@ -61,7 +61,7 @@ struct dect_fd *dect_alloc_fd(const struct dect_handle *dh) dfd->state = DECT_FD_UNREGISTERED; return dfd; } -EXPORT_SYMBOL(dect_alloc_fd); +EXPORT_SYMBOL(dect_fd_alloc); /** * Get a pointer to the private data area from a libdect file descriptor @@ -85,16 +85,16 @@ int dect_fd_num(const struct dect_fd *dfd) } EXPORT_SYMBOL(dect_fd_num); -void dect_setup_fd(struct dect_fd *dfd, +void dect_fd_setup(struct dect_fd *dfd, void (*cb)(struct dect_handle *, struct dect_fd *, uint32_t), void *data) { dfd->callback = cb; dfd->data = data; } -EXPORT_SYMBOL(dect_setup_fd); +EXPORT_SYMBOL(dect_fd_setup); -int dect_register_fd(const struct dect_handle *dh, struct dect_fd *dfd, +int dect_fd_register(const struct dect_handle *dh, struct dect_fd *dfd, uint32_t events) { int err; @@ -105,15 +105,15 @@ int dect_register_fd(const struct dect_handle *dh, struct dect_fd *dfd, dfd->state = DECT_FD_REGISTERED; return err; } -EXPORT_SYMBOL(dect_register_fd); +EXPORT_SYMBOL(dect_fd_register); -void dect_unregister_fd(const struct dect_handle *dh, struct dect_fd *dfd) +void dect_fd_unregister(const struct dect_handle *dh, struct dect_fd *dfd) { assert(dfd->state == DECT_FD_REGISTERED); dh->ops->event_ops->unregister_fd(dh, dfd); dfd->state = DECT_FD_UNREGISTERED; } -EXPORT_SYMBOL(dect_unregister_fd); +EXPORT_SYMBOL(dect_fd_unregister); /** * Process libdect file descriptor events @@ -125,12 +125,12 @@ EXPORT_SYMBOL(dect_unregister_fd); * Process the events specified by the events bitmask for the given file * descriptor. */ -void dect_handle_fd(struct dect_handle *dh, struct dect_fd *dfd, uint32_t events) +void dect_fd_process(struct dect_handle *dh, struct dect_fd *dfd, uint32_t events) { assert(dfd->state == DECT_FD_REGISTERED); dfd->callback(dh, dfd, events); } -EXPORT_SYMBOL(dect_handle_fd); +EXPORT_SYMBOL(dect_fd_process); void dect_close(const struct dect_handle *dh, struct dect_fd *dfd) { @@ -145,7 +145,7 @@ struct dect_fd *dect_socket(const struct dect_handle *dh, int type, int protocol { struct dect_fd *dfd; - dfd = dect_alloc_fd(dh); + dfd = dect_fd_alloc(dh); if (dfd == NULL) goto err1; @@ -167,7 +167,7 @@ struct dect_fd *dect_accept(const struct dect_handle *dh, { struct dect_fd *nfd; - nfd = dect_alloc_fd(dh); + nfd = dect_fd_alloc(dh); if (nfd == NULL) goto err1; diff --git a/src/lce.c b/src/lce.c index bf2ae13..4d580dc 100644 --- a/src/lce.c +++ b/src/lce.c @@ -227,7 +227,7 @@ static void dect_ddl_destroy(struct dect_handle *dh, struct dect_data_link *ddl) dect_mbuf_free(dh, mb); if (ddl->dfd != NULL) { - dect_unregister_fd(dh, ddl->dfd); + dect_fd_unregister(dh, ddl->dfd); dect_close(dh, ddl->dfd); } @@ -581,8 +581,8 @@ static void dect_ddl_complete_direct_establish(struct dect_handle *dh, dect_send(dh, ddl, mb); } - dect_unregister_fd(dh, ddl->dfd); - dect_register_fd(dh, ddl->dfd, DECT_FD_READ); + dect_fd_unregister(dh, ddl->dfd); + dect_fd_register(dh, ddl->dfd, DECT_FD_READ); } static void dect_ddl_complete_indirect_establish(struct dect_handle *dh, @@ -653,8 +653,8 @@ static struct dect_data_link *dect_ddl_establish(struct dect_handle *dh, ddl->dlei.dect_lln = 1; ddl->dlei.dect_sapi = 0; - dect_setup_fd(ddl->dfd, dect_lce_data_link_event, ddl); - if (dect_register_fd(dh, ddl->dfd, DECT_FD_WRITE) < 0) + dect_fd_setup(ddl->dfd, dect_lce_data_link_event, ddl); + if (dect_fd_register(dh, ddl->dfd, DECT_FD_WRITE) < 0) goto err2; if (connect(ddl->dfd->fd, (struct sockaddr *)&ddl->dlei, @@ -666,7 +666,7 @@ static struct dect_data_link *dect_ddl_establish(struct dect_handle *dh, return ddl; err3: - dect_unregister_fd(dh, ddl->dfd); + dect_fd_unregister(dh, ddl->dfd); err2: dect_free(dh, ddl); err1: @@ -733,8 +733,8 @@ static void dect_lce_ssap_listener_event(struct dect_handle *dh, goto err2; ddl->dfd = nfd; - dect_setup_fd(nfd, dect_lce_data_link_event, ddl); - if (dect_register_fd(dh, nfd, DECT_FD_READ) < 0) + dect_fd_setup(nfd, dect_lce_data_link_event, ddl); + if (dect_fd_register(dh, nfd, DECT_FD_READ) < 0) goto err3; ddl->state = DECT_DATA_LINK_ESTABLISHED; @@ -748,7 +748,7 @@ static void dect_lce_ssap_listener_event(struct dect_handle *dh, return; err4: - dect_unregister_fd(dh, nfd); + dect_fd_unregister(dh, nfd); err3: dect_close(dh, nfd); err2: @@ -1233,8 +1233,8 @@ int dect_lce_init(struct dect_handle *dh) if (bind(dh->b_sap->fd, (struct sockaddr *)&b_addr, sizeof(b_addr)) < 0) goto err2; - dect_setup_fd(dh->b_sap, dect_lce_bsap_event, NULL); - if (dect_register_fd(dh, dh->b_sap, DECT_FD_READ) < 0) + dect_fd_setup(dh->b_sap, dect_lce_bsap_event, NULL); + if (dect_fd_register(dh, dh->b_sap, DECT_FD_READ) < 0) goto err2; dh->page_transaction.state = DECT_TRANSACTION_CLOSED; @@ -1257,8 +1257,8 @@ int dect_lce_init(struct dect_handle *dh) if (listen(dh->s_sap->fd, 10) < 0) goto err4; - dect_setup_fd(dh->s_sap, dect_lce_ssap_listener_event, NULL); - if (dect_register_fd(dh, dh->s_sap, DECT_FD_READ) < 0) + dect_fd_setup(dh->s_sap, dect_lce_ssap_listener_event, NULL); + if (dect_fd_register(dh, dh->s_sap, DECT_FD_READ) < 0) goto err4; } @@ -1268,7 +1268,7 @@ int dect_lce_init(struct dect_handle *dh) err4: dect_close(dh, dh->s_sap); err3: - dect_unregister_fd(dh, dh->b_sap); + dect_fd_unregister(dh, dh->b_sap); err2: dect_close(dh, dh->b_sap); err1: @@ -1284,11 +1284,11 @@ void dect_lce_exit(struct dect_handle *dh) dect_ddl_shutdown(dh, ddl); if (dh->mode == DECT_MODE_FP) { - dect_unregister_fd(dh, dh->s_sap); + dect_fd_unregister(dh, dh->s_sap); dect_close(dh, dh->s_sap); } - dect_unregister_fd(dh, dh->b_sap); + dect_fd_unregister(dh, dh->b_sap); dect_close(dh, dh->b_sap); } diff --git a/src/netlink.c b/src/netlink.c index 6d974ce..f82feeb 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -273,13 +273,13 @@ int dect_netlink_init(struct dect_handle *dh, const char *cluster) if (err < 0) goto err2; - dh->nlfd = dect_alloc_fd(dh); + dh->nlfd = dect_fd_alloc(dh); if (dh->nlfd == NULL) goto err2; dh->nlfd->fd = nl_socket_get_fd(dh->nlsock); - dect_setup_fd(dh->nlfd, dect_netlink_event, NULL); - if (dect_register_fd(dh, dh->nlfd, DECT_FD_READ)) + dect_fd_setup(dh->nlfd, dect_netlink_event, NULL); + if (dect_fd_register(dh, dh->nlfd, DECT_FD_READ)) goto err3; err = dect_netlink_get_cluster(dh, cluster); @@ -299,7 +299,7 @@ int dect_netlink_init(struct dect_handle *dh, const char *cluster) return 0; err4: - dect_unregister_fd(dh, dh->nlfd); + dect_fd_unregister(dh, dh->nlfd); err3: dect_free(dh, dh->nlfd); err2: @@ -313,7 +313,7 @@ err1: void dect_netlink_exit(struct dect_handle *dh) { - dect_unregister_fd(dh, dh->nlfd); + dect_fd_unregister(dh, dh->nlfd); nl_close(dh->nlsock); nl_socket_free(dh->nlsock); dect_free(dh, dh->nlfd); diff --git a/src/raw.c b/src/raw.c index 7727d4a..94ae63d 100644 --- a/src/raw.c +++ b/src/raw.c @@ -165,8 +165,8 @@ struct dect_fd *dect_raw_socket(struct dect_handle *dh) if (bind(dfd->fd, (struct sockaddr *)&da, sizeof(da)) < 0) goto err2; - dect_setup_fd(dfd, dect_raw_event, dfd); - if (dect_register_fd(dh, dfd, DECT_FD_READ) < 0) + dect_fd_setup(dfd, dect_raw_event, dfd); + if (dect_fd_register(dh, dfd, DECT_FD_READ) < 0) goto err2; out: return dfd;