summaryrefslogtreecommitdiffstats
path: root/include/netlink/route/neighbour.h
diff options
context:
space:
mode:
authorThomas Graf <tgr@lsx.localdomain>2008-05-14 15:49:44 (GMT)
committerThomas Graf <tgr@lsx.localdomain>2008-05-14 15:49:44 (GMT)
commit8a3efffa5b3fde252675239914118664d36a2c24 (patch)
treef8efc71b2bd4736f2a56084efea05d7ee191a422 /include/netlink/route/neighbour.h
parent85f932552e61c5997c1e83fe386098c94d93c273 (diff)
downloadlibnl-8a3efffa5b3fde252675239914118664d36a2c24.zip
libnl-8a3efffa5b3fde252675239914118664d36a2c24.tar.gz
libnl-8a3efffa5b3fde252675239914118664d36a2c24.tar.bz2
Thread-safe error handling
In order for the interface to become more thread safe, the error handling was revised to no longer depend on a static errno and error string buffer. This patch converts all error paths to return a libnl specific error code which can be translated to a error message using nl_geterror(int error). The functions nl_error() and nl_get_errno() are therefore obsolete. This change required various sets of function prototypes to be changed in order to return an error code, the most prominent are: struct nl_cache *foo_alloc_cache(...); changed to: int foo_alloc_cache(..., struct nl_cache **); struct nl_msg *foo_build_request(...); changed to: int foo_build_request(..., struct nl_msg **); struct foo *foo_parse(...); changed to: int foo_parse(..., struct foo **); This pretty much only leaves trivial allocation functions to still return a pointer object which can still return NULL to signal out of memory. This change is a serious API and ABI breaker, sorry!
Diffstat (limited to 'include/netlink/route/neighbour.h')
-rw-r--r--include/netlink/route/neighbour.h44
1 files changed, 18 insertions, 26 deletions
diff --git a/include/netlink/route/neighbour.h b/include/netlink/route/neighbour.h
index 078c3f4..7b5ed24 100644
--- a/include/netlink/route/neighbour.h
+++ b/include/netlink/route/neighbour.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_NEIGHBOUR_H_
@@ -22,39 +22,31 @@ extern "C" {
struct rtnl_neigh;
-/* neighbour object allocation/freeage */
-extern struct rtnl_neigh * rtnl_neigh_alloc(void);
-extern void rtnl_neigh_put(struct rtnl_neigh *);
+extern struct rtnl_neigh *rtnl_neigh_alloc(void);
+extern void rtnl_neigh_put(struct rtnl_neigh *);
-/* neighbour cache management */
-extern struct nl_cache * rtnl_neigh_alloc_cache(struct nl_handle *);
-extern struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *, int,
+extern int rtnl_neigh_alloc_cache(struct nl_handle *, struct nl_cache **);
+extern struct rtnl_neigh *rtnl_neigh_get(struct nl_cache *, int,
struct nl_addr *);
-/* Neigbour state translations */
-extern char * rtnl_neigh_state2str(int, char *, size_t);
-extern int rtnl_neigh_str2state(const char *);
+extern char * rtnl_neigh_state2str(int, char *, size_t);
+extern int rtnl_neigh_str2state(const char *);
-/* Neighbour flags translations */
-extern char * rtnl_neigh_flags2str(int, char *, size_t);
-extern int rtnl_neigh_str2flag(const char *);
+extern char * rtnl_neigh_flags2str(int, char *, size_t);
+extern int rtnl_neigh_str2flag(const char *);
-/* Neighbour Addition */
-extern int rtnl_neigh_add(struct nl_handle *,
- struct rtnl_neigh *, int);
-extern struct nl_msg * rtnl_neigh_build_add_request(struct rtnl_neigh *, int);
+extern int rtnl_neigh_add(struct nl_handle *, struct rtnl_neigh *, int);
+extern int rtnl_neigh_build_add_request(struct rtnl_neigh *, int,
+ struct nl_msg **);
-/* Neighbour Modification */
-extern int rtnl_neigh_change(struct nl_handle *,
- struct rtnl_neigh *, int);
-extern struct nl_msg * rtnl_neigh_build_change_request(struct rtnl_neigh *, int);
+extern int rtnl_neigh_change(struct nl_handle *, struct rtnl_neigh *, int);
+extern int rtnl_neigh_build_change_request(struct rtnl_neigh *, int,
+ struct nl_msg **);
-/* Neighbour Deletion */
-extern int rtnl_neigh_delete(struct nl_handle *,
- struct rtnl_neigh *, int);
-extern struct nl_msg * rtnl_neigh_build_delete_request(struct rtnl_neigh *, int);
+extern int rtnl_neigh_delete(struct nl_handle *, struct rtnl_neigh *, int);
+extern int rtnl_neigh_build_delete_request(struct rtnl_neigh *, int,
+ struct nl_msg **);
-/* Access functions */
extern void rtnl_neigh_set_state(struct rtnl_neigh *, int);
extern int rtnl_neigh_get_state(struct rtnl_neigh *);
extern void rtnl_neigh_unset_state(struct rtnl_neigh *,