diff options
author | Thomas Graf <tgr@lsx.localdomain> | 2008-05-15 13:26:32 +0200 |
---|---|---|
committer | Thomas Graf <tgr@lsx.localdomain> | 2008-05-15 13:26:32 +0200 |
commit | 1155370f520cb64657e25153255cf7dc1424317f (patch) | |
tree | bfa1323d2495dfe5729eb27d0536d4349f2a9d86 /include | |
parent | 0cf780859cbce363a6e2cd4b8d19c5498a3530f5 (diff) | |
download | libnl-1155370f520cb64657e25153255cf7dc1424317f.tar.gz |
Rename struct nl_handle to struct nl_sock
The idea of a common handle is long revised and only misleading,
nl_handle really represents a socket with some additional
action handlers assigned to it.
Alias for nl_handle is kept for backwards compatibility.
Diffstat (limited to 'include')
25 files changed, 118 insertions, 116 deletions
diff --git a/include/netlink-types.h b/include/netlink-types.h index d5e23646..a818f996 100644 --- a/include/netlink-types.h +++ b/include/netlink-types.h @@ -26,7 +26,7 @@ #define NL_MSG_CRED_PRESENT 1 struct nl_cache_ops; -struct nl_handle; +struct nl_sock; struct nl_object; struct nl_cb @@ -39,34 +39,34 @@ struct nl_cb /** May be used to replace nl_recvmsgs with your own implementation * in all internal calls to nl_recvmsgs. */ - int (*cb_recvmsgs_ow)(struct nl_handle *, + int (*cb_recvmsgs_ow)(struct nl_sock *, struct nl_cb *); /** Overwrite internal calls to nl_recv, must return the number of * octets read and allocate a buffer for the received data. */ - int (*cb_recv_ow)(struct nl_handle *, + int (*cb_recv_ow)(struct nl_sock *, struct sockaddr_nl *, unsigned char **, struct ucred **); /** Overwrites internal calls to nl_send, must send the netlink * message. */ - int (*cb_send_ow)(struct nl_handle *, + int (*cb_send_ow)(struct nl_sock *, struct nl_msg *); int cb_refcnt; }; -struct nl_handle +struct nl_sock { - struct sockaddr_nl h_local; - struct sockaddr_nl h_peer; - int h_fd; - int h_proto; - unsigned int h_seq_next; - unsigned int h_seq_expect; - int h_flags; - struct nl_cb * h_cb; + struct sockaddr_nl s_local; + struct sockaddr_nl s_peer; + int s_fd; + int s_proto; + unsigned int s_seq_next; + unsigned int s_seq_expect; + int s_flags; + struct nl_cb * s_cb; }; struct nl_cache @@ -89,7 +89,7 @@ struct nl_cache_mngr int cm_protocol; int cm_flags; int cm_nassocs; - struct nl_handle * cm_handle; + struct nl_sock * cm_handle; struct nl_cache_assoc * cm_assocs; }; diff --git a/include/netlink/cache-api.h b/include/netlink/cache-api.h index 96699ed1..22fc449d 100644 --- a/include/netlink/cache-api.h +++ b/include/netlink/cache-api.h @@ -39,7 +39,7 @@ extern "C" { * // function which must trigger a complete dump on the kernel-side of * // whatever the cache covers. * static int my_request_update(struct nl_cache *cache, - * struct nl_handle *socket) + * struct nl_sock *socket) * { * // In this example, we request a full dump of the interface table * return nl_rtgen_request(socket, RTM_GETLINK, AF_UNSPEC, NLM_F_DUMP); @@ -172,7 +172,7 @@ struct nl_cache_ops * Called whenever an update of the cache is required. Must send * a request message to the kernel requesting a complete dump. */ - int (*co_request_update)(struct nl_cache *, struct nl_handle *); + int (*co_request_update)(struct nl_cache *, struct nl_sock *); /** * Called whenever a message was received that needs to be parsed. diff --git a/include/netlink/cache.h b/include/netlink/cache.h index 604a56f8..f4db3b9b 100644 --- a/include/netlink/cache.h +++ b/include/netlink/cache.h @@ -38,7 +38,7 @@ extern struct nl_object * nl_cache_get_prev(struct nl_object *); extern struct nl_cache * nl_cache_alloc(struct nl_cache_ops *); extern int nl_cache_alloc_and_fill(struct nl_cache_ops *, - struct nl_handle *, + struct nl_sock *, struct nl_cache **); extern int nl_cache_alloc_name(const char *, struct nl_cache **); @@ -53,11 +53,11 @@ extern int nl_cache_add(struct nl_cache *, extern int nl_cache_parse_and_add(struct nl_cache *, struct nl_msg *); extern void nl_cache_remove(struct nl_object *); -extern int nl_cache_refill(struct nl_handle *, +extern int nl_cache_refill(struct nl_sock *, struct nl_cache *); -extern int nl_cache_pickup(struct nl_handle *, +extern int nl_cache_pickup(struct nl_sock *, struct nl_cache *); -extern int nl_cache_resync(struct nl_handle *, +extern int nl_cache_resync(struct nl_sock *, struct nl_cache *, change_func_t); extern int nl_cache_include(struct nl_cache *, @@ -106,7 +106,7 @@ struct nl_cache_mngr; #define NL_AUTO_PROVIDE 1 -extern int nl_cache_mngr_alloc(struct nl_handle *, +extern int nl_cache_mngr_alloc(struct nl_sock *, int, int, struct nl_cache_mngr **); extern int nl_cache_mngr_add(struct nl_cache_mngr *, diff --git a/include/netlink/fib_lookup/lookup.h b/include/netlink/fib_lookup/lookup.h index 201a7a08..8bf27b8d 100644 --- a/include/netlink/fib_lookup/lookup.h +++ b/include/netlink/fib_lookup/lookup.h @@ -31,7 +31,7 @@ extern struct nl_cache * flnl_result_alloc_cache(void); extern int flnl_lookup_build_request(struct flnl_request *, int, struct nl_msg **); -extern int flnl_lookup(struct nl_handle *, +extern int flnl_lookup(struct nl_sock *, struct flnl_request *, struct nl_cache *); diff --git a/include/netlink/genl/ctrl.h b/include/netlink/genl/ctrl.h index f66338e1..1ae62f44 100644 --- a/include/netlink/genl/ctrl.h +++ b/include/netlink/genl/ctrl.h @@ -22,12 +22,12 @@ extern "C" { struct genl_family; -extern int genl_ctrl_alloc_cache(struct nl_handle *, +extern int genl_ctrl_alloc_cache(struct nl_sock *, struct nl_cache **); extern struct genl_family * genl_ctrl_search(struct nl_cache *, int); extern struct genl_family * genl_ctrl_search_by_name(struct nl_cache *, const char *); -extern int genl_ctrl_resolve(struct nl_handle *, +extern int genl_ctrl_resolve(struct nl_sock *, const char *); #ifdef __cplusplus diff --git a/include/netlink/genl/genl.h b/include/netlink/genl/genl.h index de142d07..3f3340cf 100644 --- a/include/netlink/genl/genl.h +++ b/include/netlink/genl/genl.h @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_GENL_H_ @@ -20,9 +20,9 @@ extern "C" { #endif -extern int genl_connect(struct nl_handle *); +extern int genl_connect(struct nl_sock *); -extern int genl_send_simple(struct nl_handle *, int, int, +extern int genl_send_simple(struct nl_sock *, int, int, int, int); extern void * genlmsg_put(struct nl_msg *, uint32_t, uint32_t, diff --git a/include/netlink/handlers.h b/include/netlink/handlers.h index ebcf9117..38c9ba0d 100644 --- a/include/netlink/handlers.h +++ b/include/netlink/handlers.h @@ -23,7 +23,7 @@ extern "C" { #endif struct nl_cb; -struct nl_handle; +struct nl_sock; struct nl_msg; /** @@ -143,15 +143,15 @@ extern int nl_cb_err(struct nl_cb *, enum nl_cb_kind, nl_recvmsg_err_cb_t, void *); extern void nl_cb_overwrite_recvmsgs(struct nl_cb *, - int (*func)(struct nl_handle *, + int (*func)(struct nl_sock *, struct nl_cb *)); extern void nl_cb_overwrite_recv(struct nl_cb *, - int (*func)(struct nl_handle *, + int (*func)(struct nl_sock *, struct sockaddr_nl *, unsigned char **, struct ucred **)); extern void nl_cb_overwrite_send(struct nl_cb *, - int (*func)(struct nl_handle *, + int (*func)(struct nl_sock *, struct nl_msg *)); #ifdef __cplusplus diff --git a/include/netlink/netfilter/ct.h b/include/netlink/netfilter/ct.h index 2e082287..e1f93869 100644 --- a/include/netlink/netfilter/ct.h +++ b/include/netlink/netfilter/ct.h @@ -28,7 +28,7 @@ struct nfnl_ct; extern struct nl_object_ops ct_obj_ops; extern struct nfnl_ct * nfnl_ct_alloc(void); -extern int nfnl_ct_alloc_cache(struct nl_handle *, struct nl_cache **); +extern int nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **); extern int nfnlmsg_ct_group(struct nlmsghdr *); extern int nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **); @@ -36,19 +36,19 @@ extern int nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **); extern void nfnl_ct_get(struct nfnl_ct *); extern void nfnl_ct_put(struct nfnl_ct *); -extern int nfnl_ct_dump_request(struct nl_handle *); +extern int nfnl_ct_dump_request(struct nl_sock *); extern int nfnl_ct_build_add_request(const struct nfnl_ct *, int, struct nl_msg **); -extern int nfnl_ct_add(struct nl_handle *, const struct nfnl_ct *, int); +extern int nfnl_ct_add(struct nl_sock *, const struct nfnl_ct *, int); extern int nfnl_ct_build_delete_request(const struct nfnl_ct *, int, struct nl_msg **); -extern int nfnl_ct_delete(struct nl_handle *, const struct nfnl_ct *, int); +extern int nfnl_ct_delete(struct nl_sock *, const struct nfnl_ct *, int); extern int nfnl_ct_build_query_request(const struct nfnl_ct *, int, struct nl_msg **); -extern int nfnl_ct_query(struct nl_handle *, const struct nfnl_ct *, int); +extern int nfnl_ct_query(struct nl_sock *, const struct nfnl_ct *, int); extern void nfnl_ct_set_family(struct nfnl_ct *, uint8_t); extern uint8_t nfnl_ct_get_family(const struct nfnl_ct *); diff --git a/include/netlink/netfilter/log.h b/include/netlink/netfilter/log.h index be8dd325..2002fa8b 100644 --- a/include/netlink/netfilter/log.h +++ b/include/netlink/netfilter/log.h @@ -21,7 +21,7 @@ extern "C" { #endif -struct nl_handle; +struct nl_sock; struct nlmsghdr; struct nfnl_log; @@ -84,22 +84,22 @@ extern char * nfnl_log_flags2str(unsigned int, char *, size_t); extern unsigned int nfnl_log_str2flags(const char *); extern int nfnl_log_build_pf_bind(uint8_t, struct nl_msg **); -extern int nfnl_log_pf_bind(struct nl_handle *, uint8_t); +extern int nfnl_log_pf_bind(struct nl_sock *, uint8_t); extern int nfnl_log_build_pf_unbind(uint8_t, struct nl_msg **); -extern int nfnl_log_pf_unbind(struct nl_handle *, uint8_t); +extern int nfnl_log_pf_unbind(struct nl_sock *, uint8_t); extern int nfnl_log_build_create_request(const struct nfnl_log *, struct nl_msg **); -extern int nfnl_log_create(struct nl_handle *, const struct nfnl_log *); +extern int nfnl_log_create(struct nl_sock *, const struct nfnl_log *); extern int nfnl_log_build_change_request(const struct nfnl_log *, struct nl_msg **); -extern int nfnl_log_change(struct nl_handle *, const struct nfnl_log *); +extern int nfnl_log_change(struct nl_sock *, const struct nfnl_log *); extern int nfnl_log_build_delete_request(const struct nfnl_log *, struct nl_msg **); -extern int nfnl_log_delete(struct nl_handle *, const struct nfnl_log *); +extern int nfnl_log_delete(struct nl_sock *, const struct nfnl_log *); #ifdef __cplusplus } diff --git a/include/netlink/netfilter/log_msg.h b/include/netlink/netfilter/log_msg.h index 42e1f70c..63b0f642 100644 --- a/include/netlink/netfilter/log_msg.h +++ b/include/netlink/netfilter/log_msg.h @@ -21,7 +21,6 @@ extern "C" { #endif -struct nl_handle; struct nlmsghdr; struct nfnl_log_msg; diff --git a/include/netlink/netfilter/nfnl.h b/include/netlink/netfilter/nfnl.h index 123d93ea..8da4ba16 100644 --- a/include/netlink/netfilter/nfnl.h +++ b/include/netlink/netfilter/nfnl.h @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2007 Philip Craig <philipc@snapgear.com> * Copyright (c) 2007 Secure Computing Corporation */ @@ -23,14 +23,14 @@ extern "C" { #define NFNL_HDRLEN NLMSG_ALIGN(sizeof(struct nfgenmsg)) #define NFNLMSG_TYPE(subsys, subtype) (((subsys) << 8) | (subtype)) -extern int nfnl_connect(struct nl_handle *); +extern int nfnl_connect(struct nl_sock *); extern uint8_t nfnlmsg_subsys(struct nlmsghdr *); extern uint8_t nfnlmsg_subtype(struct nlmsghdr *); extern uint8_t nfnlmsg_family(struct nlmsghdr *); extern uint16_t nfnlmsg_res_id(struct nlmsghdr *); -extern int nfnl_send_simple(struct nl_handle *, uint8_t, uint8_t, +extern int nfnl_send_simple(struct nl_sock *, uint8_t, uint8_t, int, uint8_t, uint16_t); extern struct nl_msg * nfnlmsg_alloc_simple(uint8_t, uint8_t, int, uint8_t, uint16_t); diff --git a/include/netlink/netfilter/queue.h b/include/netlink/netfilter/queue.h index d480135d..491b361d 100644 --- a/include/netlink/netfilter/queue.h +++ b/include/netlink/netfilter/queue.h @@ -18,7 +18,7 @@ extern "C" { #endif -struct nl_handle; +struct nl_sock; struct nlmsghdr; struct nfnl_queue; @@ -60,24 +60,24 @@ extern int nfnl_queue_test_copy_range(const struct nfnl_queue *); extern uint32_t nfnl_queue_get_copy_range(const struct nfnl_queue *); extern int nfnl_queue_build_pf_bind(uint8_t, struct nl_msg **); -extern int nfnl_queue_pf_bind(struct nl_handle *, uint8_t); +extern int nfnl_queue_pf_bind(struct nl_sock *, uint8_t); extern int nfnl_queue_build_pf_unbind(uint8_t, struct nl_msg **); -extern int nfnl_queue_pf_unbind(struct nl_handle *, uint8_t); +extern int nfnl_queue_pf_unbind(struct nl_sock *, uint8_t); extern int nfnl_queue_build_create_request(const struct nfnl_queue *, struct nl_msg **); -extern int nfnl_queue_create(struct nl_handle *, +extern int nfnl_queue_create(struct nl_sock *, const struct nfnl_queue *); extern int nfnl_queue_build_change_request(const struct nfnl_queue *, struct nl_msg **); -extern int nfnl_queue_change(struct nl_handle *, +extern int nfnl_queue_change(struct nl_sock *, const struct nfnl_queue *); extern int nfnl_queue_build_delete_request(const struct nfnl_queue *, struct nl_msg **); -extern int nfnl_queue_delete(struct nl_handle *, +extern int nfnl_queue_delete(struct nl_sock *, const struct nfnl_queue *); #ifdef __cplusplus diff --git a/include/netlink/netfilter/queue_msg.h b/include/netlink/netfilter/queue_msg.h index f8f034c9..95a5d656 100644 --- a/include/netlink/netfilter/queue_msg.h +++ b/include/netlink/netfilter/queue_msg.h @@ -18,7 +18,7 @@ extern "C" { #endif -struct nl_handle; +struct nl_sock; struct nlmsghdr; struct nfnl_queue_msg; @@ -91,7 +91,7 @@ extern int nfnl_queue_msg_test_verdict(const struct nfnl_queue_msg *); extern unsigned int nfnl_queue_msg_get_verdict(const struct nfnl_queue_msg *); extern struct nl_msg * nfnl_queue_msg_build_verdict(const struct nfnl_queue_msg *); -extern int nfnl_queue_msg_send_verdict(struct nl_handle *, +extern int nfnl_queue_msg_send_verdict(struct nl_sock *, const struct nfnl_queue_msg *); #ifdef __cplusplus diff --git a/include/netlink/netlink.h b/include/netlink/netlink.h index 4dafbc8e..a7b64e50 100644 --- a/include/netlink/netlink.h +++ b/include/netlink/netlink.h @@ -39,29 +39,29 @@ extern int nl_debug; extern struct nl_dump_params nl_debug_dp; /* Connection Management */ -extern int nl_connect(struct nl_handle *, int); -extern void nl_close(struct nl_handle *); +extern int nl_connect(struct nl_sock *, int); +extern void nl_close(struct nl_sock *); /* Send */ -extern int nl_sendto(struct nl_handle *, void *, size_t); -extern int nl_sendmsg(struct nl_handle *, struct nl_msg *, +extern int nl_sendto(struct nl_sock *, void *, size_t); +extern int nl_sendmsg(struct nl_sock *, struct nl_msg *, struct msghdr *); -extern int nl_send(struct nl_handle *, struct nl_msg *); -extern int nl_send_auto_complete(struct nl_handle *, +extern int nl_send(struct nl_sock *, struct nl_msg *); +extern int nl_send_auto_complete(struct nl_sock *, struct nl_msg *); -extern int nl_send_simple(struct nl_handle *, int, int, +extern int nl_send_simple(struct nl_sock *, int, int, void *, size_t); /* Receive */ -extern int nl_recv(struct nl_handle *, +extern int nl_recv(struct nl_sock *, struct sockaddr_nl *, unsigned char **, struct ucred **); -extern int nl_recvmsgs(struct nl_handle *, struct nl_cb *); +extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *); -extern int nl_recvmsgs_default(struct nl_handle *); +extern int nl_recvmsgs_default(struct nl_sock *); -extern int nl_wait_for_ack(struct nl_handle *); +extern int nl_wait_for_ack(struct nl_sock *); /* Netlink Family Translations */ extern char * nl_nlfamily2str(int, char *, size_t); diff --git a/include/netlink/route/addr.h b/include/netlink/route/addr.h index a2390727..f92c36be 100644 --- a/include/netlink/route/addr.h +++ b/include/netlink/route/addr.h @@ -28,15 +28,15 @@ struct rtnl_addr; extern struct rtnl_addr *rtnl_addr_alloc(void); extern void rtnl_addr_put(struct rtnl_addr *); -extern int rtnl_addr_alloc_cache(struct nl_handle *, struct nl_cache **); +extern int rtnl_addr_alloc_cache(struct nl_sock *, struct nl_cache **); extern int rtnl_addr_build_add_request(struct rtnl_addr *, int, struct nl_msg **); -extern int rtnl_addr_add(struct nl_handle *, struct rtnl_addr *, int); +extern int rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int); extern int rtnl_addr_build_delete_request(struct rtnl_addr *, int, struct nl_msg **); -extern int rtnl_addr_delete(struct nl_handle *, +extern int rtnl_addr_delete(struct nl_sock *, struct rtnl_addr *, int); extern char * rtnl_addr_flags2str(int, char *, size_t); diff --git a/include/netlink/route/class.h b/include/netlink/route/class.h index a704ed15..012128b9 100644 --- a/include/netlink/route/class.h +++ b/include/netlink/route/class.h @@ -26,7 +26,7 @@ extern struct nl_object_ops class_obj_ops; extern struct rtnl_class * rtnl_class_alloc(void); extern void rtnl_class_put(struct rtnl_class *); -extern int rtnl_class_alloc_cache(struct nl_handle *, int, +extern int rtnl_class_alloc_cache(struct nl_sock *, int, struct nl_cache **); /* leaf qdisc access */ @@ -35,7 +35,7 @@ extern struct rtnl_qdisc * rtnl_class_leaf_qdisc(struct rtnl_class *, extern int rtnl_class_build_add_request(struct rtnl_class *, int, struct nl_msg **); -extern int rtnl_class_add(struct nl_handle *, struct rtnl_class *, +extern int rtnl_class_add(struct nl_sock *, struct rtnl_class *, int); extern void rtnl_class_set_ifindex(struct rtnl_class *, int); diff --git a/include/netlink/route/classifier.h b/include/netlink/route/classifier.h index 0ee563e5..0c0b9c54 100644 --- a/include/netlink/route/classifier.h +++ b/include/netlink/route/classifier.h @@ -26,18 +26,18 @@ extern struct nl_object_ops cls_obj_ops; extern struct rtnl_cls *rtnl_cls_alloc(void); extern void rtnl_cls_put(struct rtnl_cls *); -extern int rtnl_cls_alloc_cache(struct nl_handle *, int, uint32_t, +extern int rtnl_cls_alloc_cache(struct nl_sock *, int, uint32_t, struct nl_cache **); extern int rtnl_cls_build_add_request(struct rtnl_cls *, int, struct nl_msg **); -extern int rtnl_cls_add(struct nl_handle *, struct rtnl_cls *, int); +extern int rtnl_cls_add(struct nl_sock *, struct rtnl_cls *, int); extern int rtnl_cls_build_change_request(struct rtnl_cls *, int, struct nl_msg **); extern int rtnl_cls_build_delete_request(struct rtnl_cls *, int, struct nl_msg **); -extern int rtnl_cls_delete(struct nl_handle *, struct rtnl_cls *, int); +extern int rtnl_cls_delete(struct nl_sock *, struct rtnl_cls *, int); extern void rtnl_cls_set_ifindex(struct rtnl_cls *, int); extern void rtnl_cls_set_handle(struct rtnl_cls *, uint32_t); diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h index ec151aa7..4b630f74 100644 --- a/include/netlink/route/link.h +++ b/include/netlink/route/link.h @@ -57,7 +57,7 @@ extern void rtnl_link_put(struct rtnl_link *); extern void rtnl_link_free(struct rtnl_link *); /* link cache management */ -extern int rtnl_link_alloc_cache(struct nl_handle *, struct nl_cache **); +extern int rtnl_link_alloc_cache(struct nl_sock *, struct nl_cache **); extern struct rtnl_link *rtnl_link_get(struct nl_cache *, int); extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *); @@ -65,7 +65,7 @@ extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *); extern int rtnl_link_build_change_request(struct rtnl_link *, struct rtnl_link *, int, struct nl_msg **); -extern int rtnl_link_change(struct nl_handle *, struct rtnl_link *, +extern int rtnl_link_change(struct nl_sock *, struct rtnl_link *, struct rtnl_link *, int); /* Name <-> Index Translations */ diff --git a/include/netlink/route/neighbour.h b/include/netlink/route/neighbour.h index 7b5ed248..d390af1a 100644 --- a/include/netlink/route/neighbour.h +++ b/include/netlink/route/neighbour.h @@ -25,7 +25,7 @@ struct rtnl_neigh; extern struct rtnl_neigh *rtnl_neigh_alloc(void); extern void rtnl_neigh_put(struct rtnl_neigh *); -extern int rtnl_neigh_alloc_cache(struct nl_handle *, struct nl_cache **); +extern int rtnl_neigh_alloc_cache(struct nl_sock *, struct nl_cache **); extern struct rtnl_neigh *rtnl_neigh_get(struct nl_cache *, int, struct nl_addr *); @@ -35,15 +35,15 @@ extern int rtnl_neigh_str2state(const char *); extern char * rtnl_neigh_flags2str(int, char *, size_t); extern int rtnl_neigh_str2flag(const char *); -extern int rtnl_neigh_add(struct nl_handle *, struct rtnl_neigh *, int); +extern int rtnl_neigh_add(struct nl_sock *, struct rtnl_neigh *, int); extern int rtnl_neigh_build_add_request(struct rtnl_neigh *, int, struct nl_msg **); -extern int rtnl_neigh_change(struct nl_handle *, struct rtnl_neigh *, int); +extern int rtnl_neigh_change(struct nl_sock *, struct rtnl_neigh *, int); extern int rtnl_neigh_build_change_request(struct rtnl_neigh *, int, struct nl_msg **); -extern int rtnl_neigh_delete(struct nl_handle *, struct rtnl_neigh *, int); +extern int rtnl_neigh_delete(struct nl_sock *, struct rtnl_neigh *, int); extern int rtnl_neigh_build_delete_request(struct rtnl_neigh *, int, struct nl_msg **); diff --git a/include/netlink/route/neightbl.h b/include/netlink/route/neightbl.h index 7120053f..412c3e94 100644 --- a/include/netlink/route/neightbl.h +++ b/include/netlink/route/neightbl.h @@ -25,7 +25,7 @@ struct rtnl_neightbl; extern struct rtnl_neightbl *rtnl_neightbl_alloc(void); extern void rtnl_neightbl_put(struct rtnl_neightbl *); extern void rtnl_neightbl_free(struct rtnl_neightbl *); -extern int rtnl_neightbl_alloc_cache(struct nl_handle *, struct nl_cache **); +extern int rtnl_neightbl_alloc_cache(struct nl_sock *, struct nl_cache **); extern struct rtnl_neightbl *rtnl_neightbl_get(struct nl_cache *, const char *, int); extern void rtnl_neightbl_dump(struct rtnl_neightbl *, FILE *, @@ -34,7 +34,7 @@ extern void rtnl_neightbl_dump(struct rtnl_neightbl *, FILE *, extern int rtnl_neightbl_build_change_request(struct rtnl_neightbl *, struct rtnl_neightbl *, struct nl_msg **); -extern int rtnl_neightbl_change(struct nl_handle *, struct rtnl_neightbl *, +extern int rtnl_neightbl_change(struct nl_sock *, struct rtnl_neightbl *, struct rtnl_neightbl *); extern void rtnl_neightbl_set_family(struct rtnl_neightbl *, int); diff --git a/include/netlink/route/qdisc.h b/include/netlink/route/qdisc.h index d3bc99bd..5acd6e1c 100644 --- a/include/netlink/route/qdisc.h +++ b/include/netlink/route/qdisc.h @@ -27,24 +27,24 @@ extern struct nl_object_ops qdisc_obj_ops; extern struct rtnl_qdisc *rtnl_qdisc_alloc(void); extern void rtnl_qdisc_put(struct rtnl_qdisc *); -extern int rtnl_qdisc_alloc_cache(struct nl_handle *, struct nl_cache **); +extern int rtnl_qdisc_alloc_cache(struct nl_sock *, struct nl_cache **); extern struct rtnl_qdisc *rtnl_qdisc_get(struct nl_cache *, int, uint32_t); extern struct rtnl_qdisc *rtnl_qdisc_get_by_parent(struct nl_cache *, int, uint32_t); extern int rtnl_qdisc_build_add_request(struct rtnl_qdisc *, int, struct nl_msg **); -extern int rtnl_qdisc_add(struct nl_handle *, struct rtnl_qdisc *, int); +extern int rtnl_qdisc_add(struct nl_sock *, struct rtnl_qdisc *, int); extern int rtnl_qdisc_build_change_request(struct rtnl_qdisc *, struct rtnl_qdisc *, struct nl_msg **); -extern int rtnl_qdisc_change(struct nl_handle *, struct rtnl_qdisc *, +extern int rtnl_qdisc_change(struct nl_sock *, struct rtnl_qdisc *, struct rtnl_qdisc *); extern int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *, struct nl_msg **); -extern int rtnl_qdisc_delete(struct nl_handle *, struct rtnl_qdisc *); +extern int rtnl_qdisc_delete(struct nl_sock *, struct rtnl_qdisc *); extern void rtnl_qdisc_set_ifindex(struct rtnl_qdisc *, int); extern int rtnl_qdisc_get_ifindex(struct rtnl_qdisc *); diff --git a/include/netlink/route/route.h b/include/netlink/route/route.h index b3a9b9e9..488ecc48 100644 --- a/include/netlink/route/route.h +++ b/include/netlink/route/route.h @@ -44,7 +44,7 @@ extern struct nl_object_ops route_obj_ops; extern struct rtnl_route * rtnl_route_alloc(void); extern void rtnl_route_put(struct rtnl_route *); -extern int rtnl_route_alloc_cache(struct nl_handle *, int, int, +extern int rtnl_route_alloc_cache(struct nl_sock *, int, int, struct nl_cache **); extern void rtnl_route_get(struct rtnl_route *); @@ -55,10 +55,10 @@ extern int rtnl_route_build_msg(struct nl_msg *, struct rtnl_route *); extern int rtnl_route_build_add_request(struct rtnl_route *, int, struct nl_msg **); -extern int rtnl_route_add(struct nl_handle *, struct rtnl_route *, int); +extern int rtnl_route_add(struct nl_sock *, struct rtnl_route *, int); extern int rtnl_route_build_del_request(struct rtnl_route *, int, struct nl_msg **); -extern int rtnl_route_delete(struct nl_handle *, struct rtnl_route *, int); +extern int rtnl_route_delete(struct nl_sock *, struct rtnl_route *, int); extern void rtnl_route_set_table(struct rtnl_route *, uint32_t); extern uint32_t rtnl_route_get_table(struct rtnl_route *); diff --git a/include/netlink/route/rtnl.h b/include/netlink/route/rtnl.h index b12479ae..f551a5d3 100644 --- a/include/netlink/route/rtnl.h +++ b/include/netlink/route/rtnl.h @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_RTNL_H_ @@ -49,7 +49,7 @@ extern "C" { /* General */ -extern int nl_rtgen_request(struct nl_handle *, int, int, int); +extern int nl_rtgen_request(struct nl_sock *, int, int, int); /* Routing Type Translations */ extern char * nl_rtntype2str(int, char *, size_t); diff --git a/include/netlink/route/rule.h b/include/netlink/route/rule.h index 2602f77f..928dc0f1 100644 --- a/include/netlink/route/rule.h +++ b/include/netlink/route/rule.h @@ -27,16 +27,16 @@ struct rtnl_rule; extern struct rtnl_rule * rtnl_rule_alloc(void); extern void rtnl_rule_put(struct rtnl_rule *); -extern int rtnl_rule_alloc_cache(struct nl_handle *, int, +extern int rtnl_rule_alloc_cache(struct nl_sock *, int, struct nl_cache **); extern void rtnl_rule_dump(struct rtnl_rule *, FILE *, struct nl_dump_params *); extern int rtnl_rule_build_add_request(struct rtnl_rule *, int, struct nl_msg **); -extern int rtnl_rule_add(struct nl_handle *, struct rtnl_rule *, int); +extern int rtnl_rule_add(struct nl_sock *, struct rtnl_rule *, int); extern int rtnl_rule_build_delete_request(struct rtnl_rule *, int, struct nl_msg **); -extern int rtnl_rule_delete(struct nl_handle *, struct rtnl_rule *, int); +extern int rtnl_rule_delete(struct nl_sock *, struct rtnl_rule *, int); /* attribute modification */ diff --git a/include/netlink/socket.h b/include/netlink/socket.h index 038df7a7..68477e41 100644 --- a/include/netlink/socket.h +++ b/include/netlink/socket.h @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_SOCKET_H_ @@ -19,45 +19,48 @@ extern "C" { #endif -extern struct nl_handle * nl_handle_alloc(void); -extern struct nl_handle * nl_handle_alloc_cb(struct nl_cb *); -extern void nl_handle_destroy(struct nl_handle *); +/* backwards compatibility for now */ +#define nl_handle nl_sock -extern uint32_t nl_socket_get_local_port(struct nl_handle *); -extern void nl_socket_set_local_port(struct nl_handle *, +extern struct nl_sock * nl_socket_alloc(void); +extern struct nl_sock * nl_socket_alloc_cb(struct nl_cb *); +extern void nl_socket_free(struct nl_sock *); + +extern uint32_t nl_socket_get_local_port(struct nl_sock *); +extern void nl_socket_set_local_port(struct nl_sock *, uint32_t); -extern int nl_socket_add_membership(struct nl_handle *, +extern int nl_socket_add_membership(struct nl_sock *, int); -extern int nl_socket_drop_membership(struct nl_handle *, +extern int nl_socket_drop_membership(struct nl_sock *, int); -extern void nl_join_groups(struct nl_handle *, int); +extern void nl_join_groups(struct nl_sock *, int); -extern uint32_t nl_socket_get_peer_port(struct nl_handle *); -extern void nl_socket_set_peer_port(struct nl_handle *, +extern uint32_t nl_socket_get_peer_port(struct nl_sock *); +extern void nl_socket_set_peer_port(struct nl_sock *, uint32_t); -extern struct nl_cb * nl_socket_get_cb(struct nl_handle *); -extern void nl_socket_set_cb(struct nl_handle *, +extern struct nl_cb * nl_socket_get_cb(struct nl_sock *); +extern void nl_socket_set_cb(struct nl_sock *, struct nl_cb *); -extern int nl_socket_modify_cb(struct nl_handle *, +extern int nl_socket_modify_cb(struct nl_sock *, enum nl_cb_type, enum nl_cb_kind, nl_recvmsg_msg_cb_t, void *); -extern int nl_set_buffer_size(struct nl_handle *, +extern int nl_set_buffer_size(struct nl_sock *, int, int); -extern int nl_set_passcred(struct nl_handle *, int); -extern int nl_socket_recv_pktinfo(struct nl_handle *, int); +extern int nl_set_passcred(struct nl_sock *, int); +extern int nl_socket_recv_pktinfo(struct nl_sock *, int); -extern void nl_disable_sequence_check(struct nl_handle *); -extern unsigned int nl_socket_use_seq(struct nl_handle *); +extern void nl_disable_sequence_check(struct nl_sock *); +extern unsigned int nl_socket_use_seq(struct nl_sock *); -extern int nl_socket_get_fd(struct nl_handle *); -extern int nl_socket_set_nonblocking(struct nl_handle *); -extern void nl_socket_enable_msg_peek(struct nl_handle *); -extern void nl_socket_disable_msg_peek(struct nl_handle *); +extern int nl_socket_get_fd(struct nl_sock *); +extern int nl_socket_set_nonblocking(struct nl_sock *); +extern void nl_socket_enable_msg_peek(struct nl_sock *); +extern void nl_socket_disable_msg_peek(struct nl_sock *); #ifdef __cplusplus } |