diff options
107 files changed, 1195 insertions, 1101 deletions
diff --git a/configure.ac b/configure.ac index 9599476..66f4f7b 100644 --- a/configure.ac +++ b/configure.ac @@ -6,36 +6,36 @@ # License as published by the Free Software Foundation version 2.1 # of the License. # -# Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> +# Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> # # copied from glib m4_define([libnl_major_version], [3]) m4_define([libnl_minor_version], [2]) -m4_define([libnl_micro_version], [20]) +m4_define([libnl_micro_version], [21]) -# If either revision or age are omitted, they default to 0. Also note that age -# must be less than or equal to the current interface number. +# The following explanation may help to understand the above rules a bit +# better: consider that there are three possible kinds of reactions from +# users of your library to changes in a shared library: # -# Here are a set of rules to help you update your library version information: +# 1. Programs using the previous version may use the new version as drop-in +# replacement, and programs using the new version can also work with the +# previous one. In other words, no recompiling nor relinking is needed. +# In this case, bump revision only, don't touch current nor age. # -# 1. Start with version information of `0:0:0' for each libtool library. -# 2. Update the version information only immediately before a public release -# of your software. More frequent updates are unnecessary, and only -# guarantee that the current interface number gets larger faster. -# 3. If the library source code has changed at all since the last update, then -# increment revision (`c:r:a' becomes `c:r+1:a'). -# 4. If any interfaces have been added, removed, or changed since the last -# update, increment current, and set revision to 0. -# 5. If any interfaces have been added since the last public release, then -# increment age. -# 6. If any interfaces have been removed since the last public release, then -# set age to 0. +# 2. Programs using the previous version may use the new version as drop-in +# replacement, but programs using the new version may use APIs not +# present in the previous one. In other words, a program linking against +# the new version may fail with “unresolved symbols” if linking against +# the old version at runtime: set revision to 0, bump current and age. +# +# 3. Programs may need to be changed, recompiled, relinked in order to use +# the new version. Bump current, set revision and age to 0. m4_define([libnl_lt_current], [216]) -m4_define([libnl_lt_revision], [0]) +m4_define([libnl_lt_revision], [1]) m4_define([libnl_lt_age], [16]) m4_define([libnl_version], diff --git a/doc/configure.ac b/doc/configure.ac index 1316f23..4c3a52f 100644 --- a/doc/configure.ac +++ b/doc/configure.ac @@ -6,10 +6,10 @@ # License as published by the Free Software Foundation version 2.1 # of the License. # -# Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> +# Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> # -AC_INIT(libnl-doc, [3.2.20], [http://www.infradead.org/~tgr/libnl/]) +AC_INIT(libnl-doc, [3.2.21], [http://www.infradead.org/~tgr/libnl/]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([foreign]) diff --git a/include/Makefile.am b/include/Makefile.am index 50d1e4e..1e07fdb 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -71,7 +71,13 @@ nobase_libnlinclude_HEADERS = \ netlink/socket.h \ netlink/types.h \ netlink/utils.h \ - netlink/version.h + netlink/version.h \ + netlink/cache-api.h \ + netlink/object-api.h \ + netlink/route/link/api.h \ + netlink/route/link/info-api.h \ + netlink/route/tc-api.h + if ENABLE_CLI nobase_libnlinclude_HEADERS += \ @@ -116,12 +122,11 @@ noinst_HEADERS = \ linux/rtnetlink.h \ linux/snmp.h \ linux/tc_ematch/tc_em_meta.h \ - netlink-generic.h \ - netlink-local.h \ - netlink-tc.h \ - netlink-types.h \ - netlink/cache-api.h \ - netlink/object-api.h \ - netlink/route/link/api.h \ - netlink/route/link/info-api.h \ - netlink/route/tc-api.h + netlink-private/genl.h \ + netlink-private/netlink.h \ + netlink-private/tc.h \ + netlink-private/types.h \ + netlink-private/cache-api.h \ + netlink-private/object-api.h \ + netlink-private/route/link/api.h \ + netlink-private/route/tc-api.h diff --git a/include/netlink-private/cache-api.h b/include/netlink-private/cache-api.h new file mode 100644 index 0000000..5d9b0ad --- /dev/null +++ b/include/netlink-private/cache-api.h @@ -0,0 +1,285 @@ +/* + * netlink-private/cache-api.h Caching API + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> + */ + +#ifndef NETLINK_CACHE_API_H_ +#define NETLINK_CACHE_API_H_ + +#include <netlink/netlink.h> +#include <netlink/cache.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @ingroup cache + * @defgroup cache_api Cache Implementation + * @brief + * + * @par 1) Cache Definition + * @code + * struct nl_cache_ops my_cache_ops = { + * .co_name = "route/link", + * .co_protocol = NETLINK_ROUTE, + * .co_hdrsize = sizeof(struct ifinfomsg), + * .co_obj_ops = &my_obj_ops, + * }; + * @endcode + * + * @par 2) + * @code + * // The simplest way to fill a cache is by providing a request-update + * // 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_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); + * } + * + * // The resulting netlink messages sent back will be fed into a message + * // parser one at a time. The message parser has to extract all relevant + * // information from the message and create an object reflecting the + * // contents of the message and pass it on to the parser callback function + * // provide which will add the object to the cache. + * static int my_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, + * struct nlmsghdr *nlh, struct nl_parser_param *pp) + * { + * struct my_obj *obj; + * + * obj = my_obj_alloc(); + * obj->ce_msgtype = nlh->nlmsg_type; + * + * // Parse the netlink message and continue creating the object. + * + * err = pp->pp_cb((struct nl_object *) obj, pp); + * if (err < 0) + * goto errout; + * } + * + * struct nl_cache_ops my_cache_ops = { + * ... + * .co_request_update = my_request_update, + * .co_msg_parser = my_msg_parser, + * }; + * @endcode + * + * @par 3) Notification based Updates + * @code + * // Caches can be kept up-to-date based on notifications if the kernel + * // sends out notifications whenever an object is added/removed/changed. + * // + * // It is trivial to support this, first a list of groups needs to be + * // defined which are required to join in order to receive all necessary + * // notifications. The groups are separated by address family to support + * // the common situation where a separate group is used for each address + * // family. If there is only one group, simply specify AF_UNSPEC. + * static struct nl_af_group addr_groups[] = { + * { AF_INET, RTNLGRP_IPV4_IFADDR }, + * { AF_INET6, RTNLGRP_IPV6_IFADDR }, + * { END_OF_GROUP_LIST }, + * }; + * + * // In order for the caching system to know the meaning of each message + * // type it requires a table which maps each supported message type to + * // a cache action, e.g. RTM_NEWADDR means address has been added or + * // updated, RTM_DELADDR means address has been removed. + * static struct nl_cache_ops rtnl_addr_ops = { + * ... + * .co_msgtypes = { + * { RTM_NEWADDR, NL_ACT_NEW, "new" }, + * { RTM_DELADDR, NL_ACT_DEL, "del" }, + * { RTM_GETADDR, NL_ACT_GET, "get" }, + * END_OF_MSGTYPES_LIST, + * }, + * .co_groups = addr_groups, + * }; + * + * // It is now possible to keep the cache up-to-date using the cache manager. + * @endcode + * @{ + */ + +enum { + NL_ACT_UNSPEC, + NL_ACT_NEW, + NL_ACT_DEL, + NL_ACT_GET, + NL_ACT_SET, + NL_ACT_CHANGE, + __NL_ACT_MAX, +}; + +#define NL_ACT_MAX (__NL_ACT_MAX - 1) + +#define END_OF_MSGTYPES_LIST { -1, -1, NULL } + +/** + * Message type to cache action association + */ +struct nl_msgtype +{ + /** Netlink message type */ + int mt_id; + + /** Cache action to take */ + int mt_act; + + /** Name of operation for human-readable printing */ + char * mt_name; +}; + +/** + * Address family to netlink group association + */ +struct nl_af_group +{ + /** Address family */ + int ag_family; + + /** Netlink group identifier */ + int ag_group; +}; + +#define END_OF_GROUP_LIST AF_UNSPEC, 0 + +/** + * Parser parameters + * + * This structure is used to configure what kind of parser to use + * when parsing netlink messages to create objects. + */ +struct nl_parser_param +{ + /** Function to parse netlink messages into objects */ + int (*pp_cb)(struct nl_object *, struct nl_parser_param *); + + /** Arbitary argument to be passed to the parser */ + void * pp_arg; +}; + +/** + * Cache Operations + * + * This structure defines the characterstics of a cache type. It contains + * pointers to functions which implement the specifics of the object type + * the cache can hold. + */ +struct nl_cache_ops +{ + /** Name of cache type (must be unique) */ + char * co_name; + + /** Size of family specific netlink header */ + int co_hdrsize; + + /** Netlink protocol */ + int co_protocol; + + /** cache object hash size **/ + int co_hash_size; + + /** cache flags */ + unsigned int co_flags; + + /** Reference counter */ + unsigned int co_refcnt; + + /** Group definition */ + struct nl_af_group * co_groups; + + /** + * 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_sock *); + + /** + * Called whenever a message was received that needs to be parsed. + * Must parse the message and call the paser callback function + * (nl_parser_param) provided via the argument. + */ + int (*co_msg_parser)(struct nl_cache_ops *, struct sockaddr_nl *, + struct nlmsghdr *, struct nl_parser_param *); + + /** + * The function registered under this callback is called after a + * netlink notification associated with this cache type has been + * parsed into an object and is being considered for inclusio into + * the specified cache. + * + * The purpose of this function is to filter out notifications + * which should be ignored when updating caches. + * + * The function must return NL_SKIP to prevent the object from + * being included, or NL_OK to include it. + * + * @code + * int my_filter(struct nl_cache *cache, struct nl_object *obj) + * { + * if (reason_to_not_include_obj(obj)) + * return NL_SKIP; + * + * return NL_OK; + * } + * @endcode + */ + int (*co_event_filter)(struct nl_cache *, struct nl_object *obj); + + /** + * The function registered under this callback is called when an + * object formed from a notification event needs to be included in + * a cache. + * + * For each modified object, the change callback \c change_cb must + * be called with the \c data argument provided. + * + * If no function is registered, the function nl_cache_include() + * will be used for this purpose. + * + * @see nl_cache_include() + */ + int (*co_include_event)(struct nl_cache *cache, struct nl_object *obj, + change_func_t change_cb, void *data); + + void (*reserved_1)(void); + void (*reserved_2)(void); + void (*reserved_3)(void); + void (*reserved_4)(void); + void (*reserved_5)(void); + void (*reserved_6)(void); + void (*reserved_7)(void); + void (*reserved_8)(void); + + /** Object operations */ + struct nl_object_ops * co_obj_ops; + + /** Internal, do not touch! */ + struct nl_cache_ops *co_next; + + struct nl_cache *co_major_cache; + struct genl_ops * co_genl; + + /* Message type definition */ + struct nl_msgtype co_msgtypes[]; +}; + +extern void nl_cache_ops_get(struct nl_cache_ops *); +extern void nl_cache_ops_put(struct nl_cache_ops *); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/netlink-generic.h b/include/netlink-private/genl.h index 10aa2f0..0aca6d7 100644 --- a/include/netlink-generic.h +++ b/include/netlink-private/genl.h @@ -1,18 +1,18 @@ /* - * netlink-generic.h Local Generic Netlink Interface + * netlink-private/genl.h Local Generic Netlink Interface * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * 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-2013 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_GENL_PRIV_H_ #define NETLINK_GENL_PRIV_H_ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #define GENL_HDRSIZE(hdrlen) (GENL_HDRLEN + (hdrlen)) diff --git a/include/netlink-local.h b/include/netlink-private/netlink.h index c0915f8..6ae6d17 100644 --- a/include/netlink-local.h +++ b/include/netlink-private/netlink.h @@ -1,12 +1,12 @@ /* - * netlink-local.h Local Netlink Interface + * netlink-private/netlink.h Local Netlink Interface * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_LOCAL_H_ @@ -63,9 +63,9 @@ #include <netlink/handlers.h> #include <netlink/cache.h> #include <netlink/route/tc.h> -#include <netlink/object-api.h> -#include <netlink/cache-api.h> -#include <netlink-types.h> +#include <netlink-private/object-api.h> +#include <netlink-private/cache-api.h> +#include <netlink-private/types.h> struct trans_tbl { int i; diff --git a/include/netlink-private/object-api.h b/include/netlink-private/object-api.h new file mode 100644 index 0000000..f4fd71e --- /dev/null +++ b/include/netlink-private/object-api.h @@ -0,0 +1,376 @@ +/* + * netlink-private/object-api.c Object API + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> + */ + +#ifndef NETLINK_OBJECT_API_H_ +#define NETLINK_OBJECT_API_H_ + +#include <netlink/netlink.h> +#include <netlink/utils.h> +#include <netlink/object.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @ingroup object + * @defgroup object_api Object API + * @brief + * + * @par 1) Object Definition + * @code + * // Define your object starting with the common object header + * struct my_obj { + * NLHDR_COMMON + * int my_data; + * }; + * + * // Fill out the object operations structure + * struct nl_object_ops my_ops = { + * .oo_name = "my_obj", + * .oo_size = sizeof(struct my_obj), + * }; + * + * // At this point the object can be allocated, you may want to provide a + * // separate _alloc() function to ease allocting objects of this kind. + * struct nl_object *obj = nl_object_alloc(&my_ops); + * + * // And release it again... + * nl_object_put(obj); + * @endcode + * + * @par 2) Allocating additional data + * @code + * // You may require to allocate additional data and store it inside + * // object, f.e. assuming there is a field `ptr'. + * struct my_obj { + * NLHDR_COMMON + * void * ptr; + * }; + * + * // And at some point you may assign allocated data to this field: + * my_obj->ptr = calloc(1, ...); + * + * // In order to not introduce any memory leaks you have to release + * // this data again when the last reference is given back. + * static void my_obj_free_data(struct nl_object *obj) + * { + * struct my_obj *my_obj = nl_object_priv(obj); + * + * free(my_obj->ptr); + * } + * + * // Also when the object is cloned, you must ensure for your pointer + * // stay valid even if one of the clones is freed by either making + * // a clone as well or increase the reference count. + * static int my_obj_clone(struct nl_object *src, struct nl_object *dst) + * { + * struct my_obj *my_src = nl_object_priv(src); + * struct my_obj *my_dst = nl_object_priv(dst); + * + * if (src->ptr) { + * dst->ptr = calloc(1, ...); + * memcpy(dst->ptr, src->ptr, ...); + * } + * } + * + * struct nl_object_ops my_ops = { + * ... + * .oo_free_data = my_obj_free_data, + * .oo_clone = my_obj_clone, + * }; + * @endcode + * + * @par 3) Object Dumping + * @code + * static int my_obj_dump_detailed(struct nl_object *obj, + * struct nl_dump_params *params) + * { + * struct my_obj *my_obj = nl_object_priv(obj); + * + * // It is absolutely essential to use nl_dump() when printing + * // any text to make sure the dumping parameters are respected. + * nl_dump(params, "Obj Integer: %d\n", my_obj->my_int); + * + * // Before we can dump the next line, make sure to prefix + * // this line correctly. + * nl_new_line(params); + * + * // You may also split a line into multiple nl_dump() calls. + * nl_dump(params, "String: %s ", my_obj->my_string); + * nl_dump(params, "String-2: %s\n", my_obj->another_string); + * } + * + * struct nl_object_ops my_ops = { + * ... + * .oo_dump[NL_DUMP_FULL] = my_obj_dump_detailed, + * }; + * @endcode + * + * @par 4) Object Attributes + * @code + * // The concept of object attributes is optional but can ease the typical + * // case of objects that have optional attributes, e.g. a route may have a + * // nexthop assigned but it is not required to. + * + * // The first step to define your object specific bitmask listing all + * // attributes + * #define MY_ATTR_FOO (1<<0) + * #define MY_ATTR_BAR (1<<1) + * + * // When assigning an optional attribute to the object, make sure + * // to mark its availability. + * my_obj->foo = 123123; + * my_obj->ce_mask |= MY_ATTR_FOO; + * + * // At any time you may use this mask to check for the availability + * // of the attribute, e.g. while dumping + * if (my_obj->ce_mask & MY_ATTR_FOO) + * nl_dump(params, "foo %d ", my_obj->foo); + * + * // One of the big advantages of this concept is that it allows for + * // standardized comparisons which make it trivial for caches to + * // identify unique objects by use of unified comparison functions. + * // In order for it to work, your object implementation must provide + * // a comparison function and define a list of attributes which + * // combined together make an object unique. + * + * static int my_obj_compare(struct nl_object *_a, struct nl_object *_b, + * uint32_t attrs, int flags) + * { + * struct my_obj *a = nl_object_priv(_a): + * struct my_obj *b = nl_object_priv(_b): + * int diff = 0; + * + * // We help ourselves in defining our own DIFF macro which will + * // call ATTR_DIFF() on both objects which will make sure to only + * // compare the attributes if required. + * #define MY_DIFF(ATTR, EXPR) ATTR_DIFF(attrs, MY_ATTR_##ATTR, a, b, EXPR) + * + * // Call our own diff macro for each attribute to build a bitmask + * // representing the attributes which mismatch. + * diff |= MY_DIFF(FOO, a->foo != b->foo) + * diff |= MY_DIFF(BAR, strcmp(a->bar, b->bar)) + * + * return diff; + * } + * + * // In order to identify identical objects with differing attributes + * // you must specify the attributes required to uniquely identify + * // your object. Make sure to not include too many attributes, this + * // list is used when caches look for an old version of an object. + * struct nl_object_ops my_ops = { + * ... + * .oo_id_attrs = MY_ATTR_FOO, + * .oo_compare = my_obj_compare, + * }; + * @endcode + * @{ + */ + +/** + * Common Object Header + * + * This macro must be included as first member in every object + * definition to allow objects to be cached. + */ +#define NLHDR_COMMON \ + int ce_refcnt; \ + struct nl_object_ops * ce_ops; \ + struct nl_cache * ce_cache; \ + struct nl_list_head ce_list; \ + int ce_msgtype; \ + int ce_flags; \ + uint32_t ce_mask; + +struct nl_object +{ + NLHDR_COMMON +}; + + +/** + * Return true if attribute is available in both objects + * @arg A an object + * @arg B another object + * @arg ATTR attribute bit + * + * @return True if the attribute is available, otherwise false is returned. + */ +#define AVAILABLE(A, B, ATTR) (((A)->ce_mask & (B)->ce_mask) & (ATTR)) + +/** + * Return true if attribute is available in only one of both objects + * @arg A an object + * @arg B another object + * @arg ATTR attribute bit + * + * @return True if the attribute is available in only one of both objects, + * otherwise false is returned. + */ +#define AVAILABLE_MISMATCH(A, B, ATTR) (((A)->ce_mask ^ (B)->ce_mask) & (ATTR)) + +/** + * Return true if attributes mismatch + * @arg A an object + * @arg B another object + * @arg ATTR attribute bit + * @arg EXPR Comparison expression + * + * This function will check if the attribute in question is available + * in both objects, if not this will count as a mismatch. + * + * If available the function will execute the expression which must + * return true if the attributes mismatch. + * + * @return True if the attribute mismatch, or false if they match. + */ +#define ATTR_MISMATCH(A, B, ATTR, EXPR) (AVAILABLE_MISMATCH(A, B, ATTR) || \ + (AVAILABLE(A, B, ATTR) && (EXPR))) + +/** + * Return attribute bit if attribute does not match + * @arg LIST list of attributes to be compared + * @arg ATTR attribute bit + * @arg A an object + * @arg B another object + * @arg EXPR Comparison expression + * + * This function will check if the attribute in question is available + * in both objects, if not this will count as a mismatch. + * + * If available the function will execute the expression which must + * return true if the attributes mismatch. + * + * In case the attributes mismatch, the attribute is returned, otherwise + * 0 is returned. + * + * @code + * diff |= ATTR_DIFF(attrs, MY_ATTR_FOO, a, b, a->foo != b->foo); + * @endcode + */ +#define ATTR_DIFF(LIST, ATTR, A, B, EXPR) \ +({ int diff = 0; \ + if (((LIST) & (ATTR)) && ATTR_MISMATCH(A, B, ATTR, EXPR)) \ + diff = ATTR; \ + diff; }) + +/** + * Object Operations + */ +struct nl_object_ops +{ + /** + * Unique name of object type + * + * Must be in the form family/name, e.g. "route/addr" + */ + char * oo_name; + + /** Size of object including its header */ + size_t oo_size; + + /* List of attributes needed to uniquely identify the object */ + uint32_t oo_id_attrs; + + /** + * Constructor function + * + * Will be called when a new object of this type is allocated. + * Can be used to initialize members such as lists etc. + */ + void (*oo_constructor)(struct nl_object *); + + /** + * Destructor function + * + * Will be called when an object is freed. Must free all + * resources which may have been allocated as part of this + * object. + */ + void (*oo_free_data)(struct nl_object *); + + /** + * Cloning function + * + * Will be called when an object needs to be cloned. Please + * note that the generic object code will make an exact + * copy of the object first, therefore you only need to take + * care of members which require reference counting etc. + * + * May return a negative error code to abort cloning. + */ + int (*oo_clone)(struct nl_object *, struct nl_object *); + + /** + * Dumping functions + * + * Will be called when an object is dumped. The implementations + * have to use nl_dump(), nl_dump_line(), and nl_new_line() to + * dump objects. + * + * The functions must return the number of lines printed. + */ + void (*oo_dump[NL_DUMP_MAX+1])(struct nl_object *, + struct nl_dump_params *); + + /** + * Comparison function + * + * Will be called when two objects of the same type are + * compared. It takes the two objects in question, an object + * specific bitmask defining which attributes should be + * compared and flags to control the behaviour. + * + * The function must return a bitmask with the relevant bit + * set for each attribute that mismatches. + */ + int (*oo_compare)(struct nl_object *, struct nl_object *, + uint32_t, int); + + + /** + * update function + * + * Will be called when the object given by first argument + * needs to be updated with the contents of the second object + * + * The function must return 0 for success and error for failure + * to update. In case of failure its assumed that the original + * object is not touched + */ + int (*oo_update)(struct nl_object *, struct nl_object *); + + /** + * Hash Key generator function + * + * When called returns a hash key for the object being + * referenced. This key will be used by higher level hash functions + * to build association lists. Each object type gets to specify + * it's own key formulation + */ + void (*oo_keygen)(struct nl_object *, uint32_t *, uint32_t); + + char *(*oo_attrs2str)(int, char *, size_t); + + /** + * Get key attributes by family function + */ + uint32_t (*oo_id_attrs_get)(struct nl_object *); +}; + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/netlink-private/route/link/api.h b/include/netlink-private/route/link/api.h new file mode 100644 index 0000000..bb98ccc --- /dev/null +++ b/include/netlink-private/route/link/api.h @@ -0,0 +1,153 @@ +/* + * netlink-private/route/link/api.h Link Modules API + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> + */ + +#ifndef NETLINK_LINK_API_H_ +#define NETLINK_LINK_API_H_ + +#include <netlink/netlink.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @ingroup link_api + * + * Available operations to modules implementing a link info type. + */ +struct rtnl_link_info_ops +{ + /** Name of link info type, must match name on kernel side */ + char * io_name; + + /** Reference count, DO NOT MODIFY */ + int io_refcnt; + + /** Called to assign an info type to a link. + * Has to allocate enough resources to hold attributes. Can + * use link->l_info to store a pointer. */ + int (*io_alloc)(struct rtnl_link *); + + /** Called to parse the link info attribute. + * Must parse the attribute and assign all values to the link. + */ + int (*io_parse)(struct rtnl_link *, + struct nlattr *, + struct nlattr *); + + /** Called when the link object is dumped. + * Must dump the info type specific attributes. */ + void (*io_dump[NL_DUMP_MAX+1])(struct rtnl_link *, + struct nl_dump_params *); + + /** Called when a link object is cloned. + * Must clone all info type specific attributes. */ + int (*io_clone)(struct rtnl_link *, struct rtnl_link *); + + /** Called when construction a link netlink message. + * Must append all info type specific attributes to the message. */ + int (*io_put_attrs)(struct nl_msg *, struct rtnl_link *); + + /** Called to release all resources previously allocated + * in either io_alloc() or io_parse(). */ + void (*io_free)(struct rtnl_link *); + + struct nl_list_head io_list; +}; + +extern struct rtnl_link_info_ops *rtnl_link_info_ops_lookup(const char *); +extern void rtnl_link_info_ops_put(struct rtnl_link_info_ops *); +extern int rtnl_link_register_info(struct rtnl_link_info_ops *); +extern int rtnl_link_unregister_info(struct rtnl_link_info_ops *); + + +/** + * @ingroup link_api + * + * Available operations to modules implementing a link address family. + */ +struct rtnl_link_af_ops +{ + /** The address family this operations set implements */ + const unsigned int ao_family; + + /** Number of users of this operations, DO NOT MODIFY. */ + int ao_refcnt; + + /** Validation policy for IFLA_PROTINFO attribute. This pointer + * can be set to a nla_policy structure describing the minimal + * requirements the attribute must meet. Failure of meeting these + * requirements will result in a parsing error. */ + const struct nla_policy *ao_protinfo_policy; + + /** Called after address family has been assigned to link. Must + * allocate data buffer to hold address family specific data and + * store it in link->l_af_data. */ + void * (*ao_alloc)(struct rtnl_link *); + + /** Called when the link is cloned, must allocate a clone of the + * address family specific buffer and return it. */ + void * (*ao_clone)(struct rtnl_link *, void *); + + /** Called when the link gets freed. Must free all allocated data */ + void (*ao_free)(struct rtnl_link *, void *); + + /** Called if a IFLA_PROTINFO attribute needs to be parsed. Typically + * stores the parsed data in the address family specific buffer. */ + int (*ao_parse_protinfo)(struct rtnl_link *, + struct nlattr *, void *); + + /** Called if a IFLA_AF_SPEC attribute needs to be parsed. Typically + * stores the parsed data in the address family specific buffer. */ + int (*ao_parse_af)(struct rtnl_link *, + struct nlattr *, void *); + + /** Called if a link message is sent to the kernel. Must append the + * link address family specific attributes to the message. */ + int (*ao_fill_af)(struct rtnl_link *, + struct nl_msg *msg, void *); + + /** Dump address family specific link attributes */ + void (*ao_dump[NL_DUMP_MAX+1])(struct rtnl_link *, + struct nl_dump_params *, + void *); + + /** Comparison function + * + * Will be called when two links are compared for their af data. It + * takes two link objects in question, an object specific bitmask + * defining which attributes should be compared and flags to control + * the behaviour + * + * The function must return a bitmask with the relevant bit set for + * each attribute that mismatches + */ + int (*ao_compare)(struct rtnl_link *, + struct rtnl_link *, int, uint32_t, int); +}; + +extern struct rtnl_link_af_ops *rtnl_link_af_ops_lookup(unsigned int); +extern void rtnl_link_af_ops_put(struct rtnl_link_af_ops *); +extern void * rtnl_link_af_alloc(struct rtnl_link *, + const struct rtnl_link_af_ops *); +extern void * rtnl_link_af_data(const struct rtnl_link *, + const struct rtnl_link_af_ops *); +extern int rtnl_link_af_register(struct rtnl_link_af_ops *); +extern int rtnl_link_af_unregister(struct rtnl_link_af_ops *); +extern int rtnl_link_af_data_compare(struct rtnl_link *a, + struct rtnl_link *b, + int family); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/netlink-private/route/tc-api.h b/include/netlink-private/route/tc-api.h new file mode 100644 index 0000000..bf0c8a3 --- /dev/null +++ b/include/netlink-private/route/tc-api.h @@ -0,0 +1,134 @@ +/* + * netlink-private/route/tc-api.h Traffic Control API + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * Copyright (c) 2011-2013 Thomas Graf <tgraf@suug.ch> + */ + +#ifndef NETLINK_TC_API_H_ +#define NETLINK_TC_API_H_ + +#include <netlink/netlink.h> +#include <netlink/msg.h> +#include <netlink/route/tc.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Traffic control object operations + * @ingroup tc + * + * This structure holds function pointers and settings implementing + * the features of each traffic control object implementation. + */ +struct rtnl_tc_ops +{ + /** + * Name of traffic control module + */ + char *to_kind; + + /** + * Type of traffic control object + */ + enum rtnl_tc_type to_type; + + + /** + * Size of private data + */ + size_t to_size; + + /** + * Dump callbacks + */ + void (*to_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, void *, + struct nl_dump_params *); + /** + * Used to fill the contents of TCA_OPTIONS + */ + int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *); + + /** + * Uesd to to fill tc related messages, unlike with to_msg_fill, + * the contents is not encapsulated with a TCA_OPTIONS nested + * attribute. + */ + int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *); + + /** + * TCA_OPTIONS message parser + */ + int (*to_msg_parser)(struct rtnl_tc *, void *); + + /** + * Called before a tc object is destroyed + */ + void (*to_free_data)(struct rtnl_tc *, void *); + + /** + * Called whenever a classifier object needs to be cloned + */ + int (*to_clone)(void *, void *); + + /** + * Internal, don't touch + */ + struct nl_list_head to_list; +}; + +struct rtnl_tc_type_ops +{ + enum rtnl_tc_type tt_type; + + char *tt_dump_prefix; + + /** + * Dump callbacks + */ + void (*tt_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, + struct nl_dump_params *); +}; + +extern int rtnl_tc_msg_parse(struct nlmsghdr *, + struct rtnl_tc *); +extern int rtnl_tc_msg_build(struct rtnl_tc *, int, + int, struct nl_msg **); + +extern void rtnl_tc_free_data(struct nl_object *); +extern int rtnl_tc_clone(struct nl_object *, + struct nl_object *); +extern void rtnl_tc_dump_line(struct nl_object *, + struct nl_dump_params *); +extern void rtnl_tc_dump_details(struct nl_object *, + struct nl_dump_params *); +extern void rtnl_tc_dump_stats(struct nl_object *, + struct nl_dump_params *); +extern int rtnl_tc_compare(struct nl_object *, + struct nl_object *, + uint32_t, int); + +extern void * rtnl_tc_data(struct rtnl_tc *); +extern void * rtnl_tc_data_check(struct rtnl_tc *, + struct rtnl_tc_ops *); + +extern struct rtnl_tc_ops * rtnl_tc_lookup_ops(enum rtnl_tc_type, + const char *); +extern struct rtnl_tc_ops * rtnl_tc_get_ops(struct rtnl_tc *); +extern int rtnl_tc_register(struct rtnl_tc_ops *); +extern void rtnl_tc_unregister(struct rtnl_tc_ops *); + +extern void rtnl_tc_type_register(struct rtnl_tc_type_ops *); +extern void rtnl_tc_type_unregister(struct rtnl_tc_type_ops *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/netlink-tc.h b/include/netlink-private/tc.h index 3e44642..182adaa 100644 --- a/include/netlink-tc.h +++ b/include/netlink-private/tc.h @@ -1,18 +1,18 @@ /* - * netlink-tc.h Local Traffic Control Interface + * netlink-private/tc.h Local Traffic Control Interface * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_TC_PRIV_H_ #define NETLINK_TC_PRIV_H_ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #ifdef __cplusplus extern "C" { diff --git a/include/netlink-types.h b/include/netlink-private/types.h index 46856a3..60a3bce 100644 --- a/include/netlink-types.h +++ b/include/netlink-private/types.h @@ -1,12 +1,12 @@ /* - * netlink-types.h Netlink Types (Private) + * netlink-private/types.h Netlink Types (Private) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ #ifndef NETLINK_LOCAL_TYPES_H_ @@ -17,7 +17,7 @@ #include <netlink/route/qdisc.h> #include <netlink/route/rtnl.h> #include <netlink/route/route.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #define NL_SOCK_BUFSIZE_SET (1<<0) #define NL_SOCK_PASSCRED (1<<1) diff --git a/include/netlink/cache-api.h b/include/netlink/cache-api.h index 493a551..e43c7ca 100644 --- a/include/netlink/cache-api.h +++ b/include/netlink/cache-api.h @@ -6,280 +6,15 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ -#ifndef NETLINK_CACHE_API_H_ -#define NETLINK_CACHE_API_H_ +#ifndef NETLINK_DUMMY_CACHE_API_H_ +#define NETLINK_DUMMY_CACHE_API_H_ #include <netlink/netlink.h> #include <netlink/cache.h> -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup cache - * @defgroup cache_api Cache Implementation - * @brief - * - * @par 1) Cache Definition - * @code - * struct nl_cache_ops my_cache_ops = { - * .co_name = "route/link", - * .co_protocol = NETLINK_ROUTE, - * .co_hdrsize = sizeof(struct ifinfomsg), - * .co_obj_ops = &my_obj_ops, - * }; - * @endcode - * - * @par 2) - * @code - * // The simplest way to fill a cache is by providing a request-update - * // 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_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); - * } - * - * // The resulting netlink messages sent back will be fed into a message - * // parser one at a time. The message parser has to extract all relevant - * // information from the message and create an object reflecting the - * // contents of the message and pass it on to the parser callback function - * // provide which will add the object to the cache. - * static int my_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, - * struct nlmsghdr *nlh, struct nl_parser_param *pp) - * { - * struct my_obj *obj; - * - * obj = my_obj_alloc(); - * obj->ce_msgtype = nlh->nlmsg_type; - * - * // Parse the netlink message and continue creating the object. - * - * err = pp->pp_cb((struct nl_object *) obj, pp); - * if (err < 0) - * goto errout; - * } - * - * struct nl_cache_ops my_cache_ops = { - * ... - * .co_request_update = my_request_update, - * .co_msg_parser = my_msg_parser, - * }; - * @endcode - * - * @par 3) Notification based Updates - * @code - * // Caches can be kept up-to-date based on notifications if the kernel - * // sends out notifications whenever an object is added/removed/changed. - * // - * // It is trivial to support this, first a list of groups needs to be - * // defined which are required to join in order to receive all necessary - * // notifications. The groups are separated by address family to support - * // the common situation where a separate group is used for each address - * // family. If there is only one group, simply specify AF_UNSPEC. - * static struct nl_af_group addr_groups[] = { - * { AF_INET, RTNLGRP_IPV4_IFADDR }, - * { AF_INET6, RTNLGRP_IPV6_IFADDR }, - * { END_OF_GROUP_LIST }, - * }; - * - * // In order for the caching system to know the meaning of each message - * // type it requires a table which maps each supported message type to - * // a cache action, e.g. RTM_NEWADDR means address has been added or - * // updated, RTM_DELADDR means address has been removed. - * static struct nl_cache_ops rtnl_addr_ops = { - * ... - * .co_msgtypes = { - * { RTM_NEWADDR, NL_ACT_NEW, "new" }, - * { RTM_DELADDR, NL_ACT_DEL, "del" }, - * { RTM_GETADDR, NL_ACT_GET, "get" }, - * END_OF_MSGTYPES_LIST, - * }, - * .co_groups = addr_groups, - * }; - * - * // It is now possible to keep the cache up-to-date using the cache manager. - * @endcode - * @{ - */ - -enum { - NL_ACT_UNSPEC, - NL_ACT_NEW, - NL_ACT_DEL, - NL_ACT_GET, - NL_ACT_SET, - NL_ACT_CHANGE, - __NL_ACT_MAX, -}; - -#define NL_ACT_MAX (__NL_ACT_MAX - 1) - -#define END_OF_MSGTYPES_LIST { -1, -1, NULL } - -/** - * Message type to cache action association - */ -struct nl_msgtype -{ - /** Netlink message type */ - int mt_id; - - /** Cache action to take */ - int mt_act; - - /** Name of operation for human-readable printing */ - char * mt_name; -}; - -/** - * Address family to netlink group association - */ -struct nl_af_group -{ - /** Address family */ - int ag_family; - - /** Netlink group identifier */ - int ag_group; -}; - -#define END_OF_GROUP_LIST AF_UNSPEC, 0 - -/** - * Parser parameters - * - * This structure is used to configure what kind of parser to use - * when parsing netlink messages to create objects. - */ -struct nl_parser_param -{ - /** Function to parse netlink messages into objects */ - int (*pp_cb)(struct nl_object *, struct nl_parser_param *); - - /** Arbitary argument to be passed to the parser */ - void * pp_arg; -}; - -/** - * Cache Operations - * - * This structure defines the characterstics of a cache type. It contains - * pointers to functions which implement the specifics of the object type - * the cache can hold. - */ -struct nl_cache_ops -{ - /** Name of cache type (must be unique) */ - char * co_name; - - /** Size of family specific netlink header */ - int co_hdrsize; - - /** Netlink protocol */ - int co_protocol; - - /** cache object hash size **/ - int co_hash_size; - - /** cache flags */ - unsigned int co_flags; - - /** Reference counter */ - unsigned int co_refcnt; - - /** Group definition */ - struct nl_af_group * co_groups; - - /** - * 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_sock *); - - /** - * Called whenever a message was received that needs to be parsed. - * Must parse the message and call the paser callback function - * (nl_parser_param) provided via the argument. - */ - int (*co_msg_parser)(struct nl_cache_ops *, struct sockaddr_nl *, - struct nlmsghdr *, struct nl_parser_param *); - - /** - * The function registered under this callback is called after a - * netlink notification associated with this cache type has been - * parsed into an object and is being considered for inclusio into - * the specified cache. - * - * The purpose of this function is to filter out notifications - * which should be ignored when updating caches. - * - * The function must return NL_SKIP to prevent the object from - * being included, or NL_OK to include it. - * - * @code - * int my_filter(struct nl_cache *cache, struct nl_object *obj) - * { - * if (reason_to_not_include_obj(obj)) - * return NL_SKIP; - * - * return NL_OK; - * } - * @endcode - */ - int (*co_event_filter)(struct nl_cache *, struct nl_object *obj); - - /** - * The function registered under this callback is called when an - * object formed from a notification event needs to be included in - * a cache. - * - * For each modified object, the change callback \c change_cb must - * be called with the \c data argument provided. - * - * If no function is registered, the function nl_cache_include() - * will be used for this purpose. - * - * @see nl_cache_include() - */ - int (*co_include_event)(struct nl_cache *cache, struct nl_object *obj, - change_func_t change_cb, void *data); - - void (*reserved_1)(void); - void (*reserved_2)(void); - void (*reserved_3)(void); - void (*reserved_4)(void); - void (*reserved_5)(void); - void (*reserved_6)(void); - void (*reserved_7)(void); - void (*reserved_8)(void); - - /** Object operations */ - struct nl_object_ops * co_obj_ops; - - /** Internal, do not touch! */ - struct nl_cache_ops *co_next; - - struct nl_cache *co_major_cache; - struct genl_ops * co_genl; - - /* Message type definition */ - struct nl_msgtype co_msgtypes[]; -}; - -extern void nl_cache_ops_get(struct nl_cache_ops *); -extern void nl_cache_ops_put(struct nl_cache_ops *); - -/** @} */ - -#ifdef __cplusplus -} -#endif +#warning "You are including a deprecated header file, include <netlink/cache.h>." #endif diff --git a/include/netlink/object-api.h b/include/netlink/object-api.h index ae6180a..75f29cb 100644 --- a/include/netlink/object-api.h +++ b/include/netlink/object-api.h @@ -1,375 +1,19 @@ /* - * netlink/object-api.c Object API + * netlink/object-api.h Object API * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2007 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ -#ifndef NETLINK_OBJECT_API_H_ -#define NETLINK_OBJECT_API_H_ +#ifndef NETLINK_DUMMY_OBJECT_API_H_ +#define NETLINK_DUMMY_OBJECT_API_H_ #include <netlink/netlink.h> #include <netlink/utils.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup object - * @defgroup object_api Object API - * @brief - * - * @par 1) Object Definition - * @code - * // Define your object starting with the common object header - * struct my_obj { - * NLHDR_COMMON - * int my_data; - * }; - * - * // Fill out the object operations structure - * struct nl_object_ops my_ops = { - * .oo_name = "my_obj", - * .oo_size = sizeof(struct my_obj), - * }; - * - * // At this point the object can be allocated, you may want to provide a - * // separate _alloc() function to ease allocting objects of this kind. - * struct nl_object *obj = nl_object_alloc(&my_ops); - * - * // And release it again... - * nl_object_put(obj); - * @endcode - * - * @par 2) Allocating additional data - * @code - * // You may require to allocate additional data and store it inside - * // object, f.e. assuming there is a field `ptr'. - * struct my_obj { - * NLHDR_COMMON - * void * ptr; - * }; - * - * // And at some point you may assign allocated data to this field: - * my_obj->ptr = calloc(1, ...); - * - * // In order to not introduce any memory leaks you have to release - * // this data again when the last reference is given back. - * static void my_obj_free_data(struct nl_object *obj) - * { - * struct my_obj *my_obj = nl_object_priv(obj); - * - * free(my_obj->ptr); - * } - * - * // Also when the object is cloned, you must ensure for your pointer - * // stay valid even if one of the clones is freed by either making - * // a clone as well or increase the reference count. - * static int my_obj_clone(struct nl_object *src, struct nl_object *dst) - * { - * struct my_obj *my_src = nl_object_priv(src); - * struct my_obj *my_dst = nl_object_priv(dst); - * - * if (src->ptr) { - * dst->ptr = calloc(1, ...); - * memcpy(dst->ptr, src->ptr, ...); - * } - * } - * - * struct nl_object_ops my_ops = { - * ... - * .oo_free_data = my_obj_free_data, - * .oo_clone = my_obj_clone, - * }; - * @endcode - * - * @par 3) Object Dumping - * @code - * static int my_obj_dump_detailed(struct nl_object *obj, - * struct nl_dump_params *params) - * { - * struct my_obj *my_obj = nl_object_priv(obj); - * - * // It is absolutely essential to use nl_dump() when printing - * // any text to make sure the dumping parameters are respected. - * nl_dump(params, "Obj Integer: %d\n", my_obj->my_int); - * - * // Before we can dump the next line, make sure to prefix - * // this line correctly. - * nl_new_line(params); - * - * // You may also split a line into multiple nl_dump() calls. - * nl_dump(params, "String: %s ", my_obj->my_string); - * nl_dump(params, "String-2: %s\n", my_obj->another_string); - * } - * - * struct nl_object_ops my_ops = { - * ... - * .oo_dump[NL_DUMP_FULL] = my_obj_dump_detailed, - * }; - * @endcode - * - * @par 4) Object Attributes - * @code - * // The concept of object attributes is optional but can ease the typical - * // case of objects that have optional attributes, e.g. a route may have a - * // nexthop assigned but it is not required to. - * - * // The first step to define your object specific bitmask listing all - * // attributes - * #define MY_ATTR_FOO (1<<0) - * #define MY_ATTR_BAR (1<<1) - * - * // When assigning an optional attribute to the object, make sure - * // to mark its availability. - * my_obj->foo = 123123; - * my_obj->ce_mask |= MY_ATTR_FOO; - * - * // At any time you may use this mask to check for the availability - * // of the attribute, e.g. while dumping - * if (my_obj->ce_mask & MY_ATTR_FOO) - * nl_dump(params, "foo %d ", my_obj->foo); - * - * // One of the big advantages of this concept is that it allows for - * // standardized comparisons which make it trivial for caches to - * // identify unique objects by use of unified comparison functions. - * // In order for it to work, your object implementation must provide - * // a comparison function and define a list of attributes which - * // combined together make an object unique. - * - * static int my_obj_compare(struct nl_object *_a, struct nl_object *_b, - * uint32_t attrs, int flags) - * { - * struct my_obj *a = nl_object_priv(_a): - * struct my_obj *b = nl_object_priv(_b): - * int diff = 0; - * - * // We help ourselves in defining our own DIFF macro which will - * // call ATTR_DIFF() on both objects which will make sure to only - * // compare the attributes if required. - * #define MY_DIFF(ATTR, EXPR) ATTR_DIFF(attrs, MY_ATTR_##ATTR, a, b, EXPR) - * - * // Call our own diff macro for each attribute to build a bitmask - * // representing the attributes which mismatch. - * diff |= MY_DIFF(FOO, a->foo != b->foo) - * diff |= MY_DIFF(BAR, strcmp(a->bar, b->bar)) - * - * return diff; - * } - * - * // In order to identify identical objects with differing attributes - * // you must specify the attributes required to uniquely identify - * // your object. Make sure to not include too many attributes, this - * // list is used when caches look for an old version of an object. - * struct nl_object_ops my_ops = { - * ... - * .oo_id_attrs = MY_ATTR_FOO, - * .oo_compare = my_obj_compare, - * }; - * @endcode - * @{ - */ - -/** - * Common Object Header - * - * This macro must be included as first member in every object - * definition to allow objects to be cached. - */ -#define NLHDR_COMMON \ - int ce_refcnt; \ - struct nl_object_ops * ce_ops; \ - struct nl_cache * ce_cache; \ - struct nl_list_head ce_list; \ - int ce_msgtype; \ - int ce_flags; \ - uint32_t ce_mask; - -struct nl_object -{ - NLHDR_COMMON -}; - - -/** - * Return true if attribute is available in both objects - * @arg A an object - * @arg B another object - * @arg ATTR attribute bit - * - * @return True if the attribute is available, otherwise false is returned. - */ -#define AVAILABLE(A, B, ATTR) (((A)->ce_mask & (B)->ce_mask) & (ATTR)) - -/** - * Return true if attribute is available in only one of both objects - * @arg A an object - * @arg B another object - * @arg ATTR attribute bit - * - * @return True if the attribute is available in only one of both objects, - * otherwise false is returned. - */ -#define AVAILABLE_MISMATCH(A, B, ATTR) (((A)->ce_mask ^ (B)->ce_mask) & (ATTR)) - -/** - * Return true if attributes mismatch - * @arg A an object - * @arg B another object - * @arg ATTR attribute bit - * @arg EXPR Comparison expression - * - * This function will check if the attribute in question is available - * in both objects, if not this will count as a mismatch. - * - * If available the function will execute the expression which must - * return true if the attributes mismatch. - * - * @return True if the attribute mismatch, or false if they match. - */ -#define ATTR_MISMATCH(A, B, ATTR, EXPR) (AVAILABLE_MISMATCH(A, B, ATTR) || \ - (AVAILABLE(A, B, ATTR) && (EXPR))) - -/** - * Return attribute bit if attribute does not match - * @arg LIST list of attributes to be compared - * @arg ATTR attribute bit - * @arg A an object - * @arg B another object - * @arg EXPR Comparison expression - * - * This function will check if the attribute in question is available - * in both objects, if not this will count as a mismatch. - * - * If available the function will execute the expression which must - * return true if the attributes mismatch. - * - * In case the attributes mismatch, the attribute is returned, otherwise - * 0 is returned. - * - * @code - * diff |= ATTR_DIFF(attrs, MY_ATTR_FOO, a, b, a->foo != b->foo); - * @endcode - */ -#define ATTR_DIFF(LIST, ATTR, A, B, EXPR) \ -({ int diff = 0; \ - if (((LIST) & (ATTR)) && ATTR_MISMATCH(A, B, ATTR, EXPR)) \ - diff = ATTR; \ - diff; }) - -/** - * Object Operations - */ -struct nl_object_ops -{ - /** - * Unique name of object type - * - * Must be in the form family/name, e.g. "route/addr" - */ - char * oo_name; - - /** Size of object including its header */ - size_t oo_size; - - /* List of attributes needed to uniquely identify the object */ - uint32_t oo_id_attrs; - - /** - * Constructor function - * - * Will be called when a new object of this type is allocated. - * Can be used to initialize members such as lists etc. - */ - void (*oo_constructor)(struct nl_object *); - - /** - * Destructor function - * - * Will be called when an object is freed. Must free all - * resources which may have been allocated as part of this - * object. - */ - void (*oo_free_data)(struct nl_object *); - - /** - * Cloning function - * - * Will be called when an object needs to be cloned. Please - * note that the generic object code will make an exact - * copy of the object first, therefore you only need to take - * care of members which require reference counting etc. - * - * May return a negative error code to abort cloning. - */ - int (*oo_clone)(struct nl_object *, struct nl_object *); - - /** - * Dumping functions - * - * Will be called when an object is dumped. The implementations - * have to use nl_dump(), nl_dump_line(), and nl_new_line() to - * dump objects. - * - * The functions must return the number of lines printed. - */ - void (*oo_dump[NL_DUMP_MAX+1])(struct nl_object *, - struct nl_dump_params *); - - /** - * Comparison function - * - * Will be called when two objects of the same type are - * compared. It takes the two objects in question, an object - * specific bitmask defining which attributes should be - * compared and flags to control the behaviour. - * - * The function must return a bitmask with the relevant bit - * set for each attribute that mismatches. - */ - int (*oo_compare)(struct nl_object *, struct nl_object *, - uint32_t, int); - - - /** - * update function - * - * Will be called when the object given by first argument - * needs to be updated with the contents of the second object - * - * The function must return 0 for success and error for failure - * to update. In case of failure its assumed that the original - * object is not touched - */ - int (*oo_update)(struct nl_object *, struct nl_object *); - - /** - * Hash Key generator function - * - * When called returns a hash key for the object being - * referenced. This key will be used by higher level hash functions - * to build association lists. Each object type gets to specify - * it's own key formulation - */ - void (*oo_keygen)(struct nl_object *, uint32_t *, uint32_t); - - char *(*oo_attrs2str)(int, char *, size_t); - - /** - * Get key attributes by family function - */ - uint32_t (*oo_id_attrs_get)(struct nl_object *); -}; - -/** @} */ - -#ifdef __cplusplus -} -#endif +#include <netlink/object.h> #endif diff --git a/include/netlink/route/link/api.h b/include/netlink/route/link/api.h index 28f2464..03b1e5e 100644 --- a/include/netlink/route/link/api.h +++ b/include/netlink/route/link/api.h @@ -6,148 +6,15 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ -#ifndef NETLINK_LINK_API_H_ -#define NETLINK_LINK_API_H_ +#ifndef NETLINK_DUMMY_LINK_API_H_ +#define NETLINK_DUMMY_LINK_API_H_ #include <netlink/netlink.h> +#include <netlink/route/link.h> -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup link_api - * - * Available operations to modules implementing a link info type. - */ -struct rtnl_link_info_ops -{ - /** Name of link info type, must match name on kernel side */ - char * io_name; - - /** Reference count, DO NOT MODIFY */ - int io_refcnt; - - /** Called to assign an info type to a link. - * Has to allocate enough resources to hold attributes. Can - * use link->l_info to store a pointer. */ - int (*io_alloc)(struct rtnl_link *); - - /** Called to parse the link info attribute. - * Must parse the attribute and assign all values to the link. - */ - int (*io_parse)(struct rtnl_link *, - struct nlattr *, - struct nlattr *); - - /** Called when the link object is dumped. - * Must dump the info type specific attributes. */ - void (*io_dump[NL_DUMP_MAX+1])(struct rtnl_link *, - struct nl_dump_params *); - - /** Called when a link object is cloned. - * Must clone all info type specific attributes. */ - int (*io_clone)(struct rtnl_link *, struct rtnl_link *); - - /** Called when construction a link netlink message. - * Must append all info type specific attributes to the message. */ - int (*io_put_attrs)(struct nl_msg *, struct rtnl_link *); - - /** Called to release all resources previously allocated - * in either io_alloc() or io_parse(). */ - void (*io_free)(struct rtnl_link *); - - struct nl_list_head io_list; -}; - -extern struct rtnl_link_info_ops *rtnl_link_info_ops_lookup(const char *); -extern void rtnl_link_info_ops_put(struct rtnl_link_info_ops *); -extern int rtnl_link_register_info(struct rtnl_link_info_ops *); -extern int rtnl_link_unregister_info(struct rtnl_link_info_ops *); - - -/** - * @ingroup link_api - * - * Available operations to modules implementing a link address family. - */ -struct rtnl_link_af_ops -{ - /** The address family this operations set implements */ - const unsigned int ao_family; - - /** Number of users of this operations, DO NOT MODIFY. */ - int ao_refcnt; - - /** Validation policy for IFLA_PROTINFO attribute. This pointer - * can be set to a nla_policy structure describing the minimal - * requirements the attribute must meet. Failure of meeting these - * requirements will result in a parsing error. */ - const struct nla_policy *ao_protinfo_policy; - - /** Called after address family has been assigned to link. Must - * allocate data buffer to hold address family specific data and - * store it in link->l_af_data. */ - void * (*ao_alloc)(struct rtnl_link *); - - /** Called when the link is cloned, must allocate a clone of the - * address family specific buffer and return it. */ - void * (*ao_clone)(struct rtnl_link *, void *); - - /** Called when the link gets freed. Must free all allocated data */ - void (*ao_free)(struct rtnl_link *, void *); - - /** Called if a IFLA_PROTINFO attribute needs to be parsed. Typically - * stores the parsed data in the address family specific buffer. */ - int (*ao_parse_protinfo)(struct rtnl_link *, - struct nlattr *, void *); - - /** Called if a IFLA_AF_SPEC attribute needs to be parsed. Typically - * stores the parsed data in the address family specific buffer. */ - int (*ao_parse_af)(struct rtnl_link *, - struct nlattr *, void *); - - /** Called if a link message is sent to the kernel. Must append the - * link address family specific attributes to the message. */ - int (*ao_fill_af)(struct rtnl_link *, - struct nl_msg *msg, void *); - - /** Dump address family specific link attributes */ - void (*ao_dump[NL_DUMP_MAX+1])(struct rtnl_link *, - struct nl_dump_params *, - void *); - - /** Comparison function - * - * Will be called when two links are compared for their af data. It - * takes two link objects in question, an object specific bitmask - * defining which attributes should be compared and flags to control - * the behaviour - * - * The function must return a bitmask with the relevant bit set for - * each attribute that mismatches - */ - int (*ao_compare)(struct rtnl_link *, - struct rtnl_link *, int, uint32_t, int); -}; - -extern struct rtnl_link_af_ops *rtnl_link_af_ops_lookup(unsigned int); -extern void rtnl_link_af_ops_put(struct rtnl_link_af_ops *); -extern void * rtnl_link_af_alloc(struct rtnl_link *, - const struct rtnl_link_af_ops *); -extern void * rtnl_link_af_data(const struct rtnl_link *, - const struct rtnl_link_af_ops *); -extern int rtnl_link_af_register(struct rtnl_link_af_ops *); -extern int rtnl_link_af_unregister(struct rtnl_link_af_ops *); -extern int rtnl_link_af_data_compare(struct rtnl_link *a, - struct rtnl_link *b, - int family); - -#ifdef __cplusplus -} -#endif +#warning "You are including a deprecated header file, include <netlink/route/link.h>." #endif diff --git a/include/netlink/route/link/info-api.h b/include/netlink/route/link/info-api.h index 4750e18..1087ad4 100644 --- a/include/netlink/route/link/info-api.h +++ b/include/netlink/route/link/info-api.h @@ -1,20 +1,20 @@ /* - * netlink/route/link/info-api.h Link Info API + * netlink/route/link/info-api.h Link Modules API * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ -#ifndef NETLINK_LINK_INFO_API_H_ -#define NETLINK_LINK_INFO_API_H_ +#ifndef NETLINK_DUMMY_LINK_INFO_API_H_ +#define NETLINK_DUMMY_LINK_INFO_API_H_ -#warning "<netlink/route/link/info-api.h> is obsolete and may be removed in the future." -#warning "include <netlink/route/link/api.h> instead. +#include <netlink/netlink.h> +#include <netlink/route/link.h> -#include <netlink/route/link/api.h> +#warning "You are including a deprecated header file, include <netlink/route/link.h>." #endif diff --git a/include/netlink/route/tc-api.h b/include/netlink/route/tc-api.h index 601a8df..b7771b5 100644 --- a/include/netlink/route/tc-api.h +++ b/include/netlink/route/tc-api.h @@ -6,131 +6,16 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ -#ifndef NETLINK_TC_API_H_ -#define NETLINK_TC_API_H_ +#ifndef NETLINK_DUMMY_TC_API_H_ +#define NETLINK_DUMMY_TC_API_H_ #include <netlink/netlink.h> #include <netlink/msg.h> #include <netlink/route/tc.h> -#ifdef __cplusplus -extern "C" { -#endif - -#define RTNL_TC_TYPE_MAX (__RTNL_TC_TYPE_MAX - 1) - -/** - * Traffic control object operations - * @ingroup tc - * - * This structure holds function pointers and settings implementing - * the features of each traffic control object implementation. - */ -struct rtnl_tc_ops -{ - /** - * Name of traffic control module - */ - char *to_kind; - - /** - * Type of traffic control object - */ - enum rtnl_tc_type to_type; - - - /** - * Size of private data - */ - size_t to_size; - - /** - * Dump callbacks - */ - void (*to_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, void *, - struct nl_dump_params *); - /** - * Used to fill the contents of TCA_OPTIONS - */ - int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *); - - /** - * Uesd to to fill tc related messages, unlike with to_msg_fill, - * the contents is not encapsulated with a TCA_OPTIONS nested - * attribute. - */ - int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *); - - /** - * TCA_OPTIONS message parser - */ - int (*to_msg_parser)(struct rtnl_tc *, void *); - - /** - * Called before a tc object is destroyed - */ - void (*to_free_data)(struct rtnl_tc *, void *); - - /** - * Called whenever a classifier object needs to be cloned - */ - int (*to_clone)(void *, void *); - - /** - * Internal, don't touch - */ - struct nl_list_head to_list; -}; - -struct rtnl_tc_type_ops -{ - enum rtnl_tc_type tt_type; - - char *tt_dump_prefix; - - /** - * Dump callbacks - */ - void (*tt_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, - struct nl_dump_params *); -}; - -extern int rtnl_tc_msg_parse(struct nlmsghdr *, - struct rtnl_tc *); -extern int rtnl_tc_msg_build(struct rtnl_tc *, int, - int, struct nl_msg **); - -extern void rtnl_tc_free_data(struct nl_object *); -extern int rtnl_tc_clone(struct nl_object *, - struct nl_object *); -extern void rtnl_tc_dump_line(struct nl_object *, - struct nl_dump_params *); -extern void rtnl_tc_dump_details(struct nl_object *, - struct nl_dump_params *); -extern void rtnl_tc_dump_stats(struct nl_object *, - struct nl_dump_params *); -extern int rtnl_tc_compare(struct nl_object *, - struct nl_object *, - uint32_t, int); - -extern void * rtnl_tc_data(struct rtnl_tc *); -extern void * rtnl_tc_data_check(struct rtnl_tc *, - struct rtnl_tc_ops *); - -extern struct rtnl_tc_ops * rtnl_tc_lookup_ops(enum rtnl_tc_type, - const char *); -extern struct rtnl_tc_ops * rtnl_tc_get_ops(struct rtnl_tc *); -extern int rtnl_tc_register(struct rtnl_tc_ops *); -extern void rtnl_tc_unregister(struct rtnl_tc_ops *); - -extern void rtnl_tc_type_register(struct rtnl_tc_type_ops *); -extern void rtnl_tc_type_unregister(struct rtnl_tc_type_ops *); - -#ifdef __cplusplus -} -#endif +#warning "You are including a deprecated header file, include <netlink/route/tc.h>." #endif diff --git a/include/netlink/route/tc.h b/include/netlink/route/tc.h index caee60c..836f7b1 100644 --- a/include/netlink/route/tc.h +++ b/include/netlink/route/tc.h @@ -30,6 +30,8 @@ enum rtnl_tc_type { __RTNL_TC_TYPE_MAX, }; +#define RTNL_TC_TYPE_MAX (__RTNL_TC_TYPE_MAX - 1) + /** * Compute tc handle based on major and minor parts * @ingroup tc @@ -27,7 +27,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/addr.h> @@ -9,7 +9,7 @@ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/addr.h> diff --git a/lib/cache.c b/lib/cache.c index 24ffa31..fafc023 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -49,7 +49,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/object.h> diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c index d5dc1f3..f8a65e3 100644 --- a/lib/cache_mngr.c +++ b/lib/cache_mngr.c @@ -32,7 +32,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/utils.h> diff --git a/lib/cache_mngt.c b/lib/cache_mngt.c index 62cde06..4d3d6ff 100644 --- a/lib/cache_mngt.c +++ b/lib/cache_mngt.c @@ -25,7 +25,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/utils.h> @@ -27,7 +27,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <linux/socket.h> diff --git a/lib/error.c b/lib/error.c index e8ee474..f30b9a5 100644 --- a/lib/error.c +++ b/lib/error.c @@ -9,7 +9,7 @@ * Copyright (c) 2008 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> static const char *errmsg[NLE_MAX+1] = { diff --git a/lib/fib_lookup/lookup.c b/lib/fib_lookup/lookup.c index ec82c16..6fe8dae 100644 --- a/lib/fib_lookup/lookup.c +++ b/lib/fib_lookup/lookup.c @@ -16,7 +16,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/utils.h> diff --git a/lib/fib_lookup/request.c b/lib/fib_lookup/request.c index ffcf8f5..1b021b6 100644 --- a/lib/fib_lookup/request.c +++ b/lib/fib_lookup/request.c @@ -16,7 +16,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/utils.h> diff --git a/lib/genl/ctrl.c b/lib/genl/ctrl.c index 057a1bf..c6db742 100644 --- a/lib/genl/ctrl.c +++ b/lib/genl/ctrl.c @@ -21,7 +21,7 @@ * @{ */ -#include <netlink-generic.h> +#include <netlink-private/genl.h> #include <netlink/netlink.h> #include <netlink/genl/genl.h> #include <netlink/genl/family.h> diff --git a/lib/genl/family.c b/lib/genl/family.c index 05e45ac..897c809 100644 --- a/lib/genl/family.c +++ b/lib/genl/family.c @@ -18,7 +18,7 @@ * @{ */ -#include <netlink-generic.h> +#include <netlink-private/genl.h> #include <netlink/netlink.h> #include <netlink/genl/genl.h> #include <netlink/genl/family.h> diff --git a/lib/genl/genl.c b/lib/genl/genl.c index 8d3def3..0c9b11e 100644 --- a/lib/genl/genl.c +++ b/lib/genl/genl.c @@ -15,7 +15,7 @@ * @{ */ -#include <netlink-generic.h> +#include <netlink-private/genl.h> #include <netlink/netlink.h> #include <netlink/genl/genl.h> #include <netlink/utils.h> diff --git a/lib/genl/mngt.c b/lib/genl/mngt.c index ad25172..a3faaf2 100644 --- a/lib/genl/mngt.c +++ b/lib/genl/mngt.c @@ -18,7 +18,7 @@ * @{ */ -#include <netlink-generic.h> +#include <netlink-private/genl.h> #include <netlink/netlink.h> #include <netlink/genl/genl.h> #include <netlink/genl/mngt.h> diff --git a/lib/handlers.c b/lib/handlers.c index 74276a1..ee1376b 100644 --- a/lib/handlers.c +++ b/lib/handlers.c @@ -25,7 +25,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/msg.h> diff --git a/lib/hashtable.c b/lib/hashtable.c index ecd5730..8b15925 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -9,7 +9,7 @@ * Copyright (c) 2012 Cumulus Networks, Inc */ #include <string.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/object.h> #include <netlink/hash.h> #include <netlink/hashtable.h> @@ -26,7 +26,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/cache.h> diff --git a/lib/netfilter/ct.c b/lib/netfilter/ct.c index 59ee1d9..5dde1d1 100644 --- a/lib/netfilter/ct.c +++ b/lib/netfilter/ct.c @@ -23,7 +23,7 @@ #include <sys/types.h> #include <linux/netfilter/nfnetlink_conntrack.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/attr.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/ct.h> diff --git a/lib/netfilter/ct_obj.c b/lib/netfilter/ct_obj.c index 4686170..bac775b 100644 --- a/lib/netfilter/ct_obj.c +++ b/lib/netfilter/ct_obj.c @@ -16,7 +16,7 @@ #include <linux/netfilter/nf_conntrack_common.h> #include <linux/netfilter/nf_conntrack_tcp.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/ct.h> diff --git a/lib/netfilter/exp.c b/lib/netfilter/exp.c index 4f4984f..a348f99 100644 --- a/lib/netfilter/exp.c +++ b/lib/netfilter/exp.c @@ -24,7 +24,7 @@ #include <sys/types.h> #include <linux/netfilter/nfnetlink_conntrack.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/attr.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/exp.h> diff --git a/lib/netfilter/exp_obj.c b/lib/netfilter/exp_obj.c index 182df23..69b4dd3 100644 --- a/lib/netfilter/exp_obj.c +++ b/lib/netfilter/exp_obj.c @@ -18,7 +18,7 @@ #include <linux/netfilter/nf_conntrack_common.h> #include <linux/netfilter/nf_conntrack_tcp.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/exp.h> diff --git a/lib/netfilter/log.c b/lib/netfilter/log.c index 96ae6c5..1bab9b6 100644 --- a/lib/netfilter/log.c +++ b/lib/netfilter/log.c @@ -21,7 +21,7 @@ #include <sys/types.h> #include <linux/netfilter/nfnetlink_log.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/attr.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/log.h> diff --git a/lib/netfilter/log_msg.c b/lib/netfilter/log_msg.c index 65448f9..6e09da2 100644 --- a/lib/netfilter/log_msg.c +++ b/lib/netfilter/log_msg.c @@ -22,7 +22,7 @@ #include <sys/types.h> #include <linux/netfilter/nfnetlink_log.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/attr.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/log_msg.h> diff --git a/lib/netfilter/log_msg_obj.c b/lib/netfilter/log_msg_obj.c index d2ad0ff..57db9d4 100644 --- a/lib/netfilter/log_msg_obj.c +++ b/lib/netfilter/log_msg_obj.c @@ -11,7 +11,7 @@ * Copyright (c) 2007 Secure Computing Corporation */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/netfilter.h> #include <netlink/netfilter/log_msg.h> diff --git a/lib/netfilter/log_obj.c b/lib/netfilter/log_obj.c index 43c4a06..2b11414 100644 --- a/lib/netfilter/log_obj.c +++ b/lib/netfilter/log_obj.c @@ -12,7 +12,7 @@ * Copyright (c) 2008 Patrick McHardy <kaber@trash.net> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/log.h> diff --git a/lib/netfilter/netfilter.c b/lib/netfilter/netfilter.c index addecd7..0062994 100644 --- a/lib/netfilter/netfilter.c +++ b/lib/netfilter/netfilter.c @@ -9,7 +9,7 @@ * Copyright (c) 2008 Patrick McHardy <kaber@trash.net> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netfilter/netfilter.h> #include <linux/netfilter.h> diff --git a/lib/netfilter/nfnl.c b/lib/netfilter/nfnl.c index 6d27c44..f028a85 100644 --- a/lib/netfilter/nfnl.c +++ b/lib/netfilter/nfnl.c @@ -61,7 +61,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/netfilter/nfnl.h> diff --git a/lib/netfilter/queue.c b/lib/netfilter/queue.c index ff1de0e..5655647 100644 --- a/lib/netfilter/queue.c +++ b/lib/netfilter/queue.c @@ -19,7 +19,7 @@ #include <sys/types.h> #include <linux/netfilter/nfnetlink_queue.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/attr.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/queue.h> diff --git a/lib/netfilter/queue_msg.c b/lib/netfilter/queue_msg.c index 30c522f..95d8ad3 100644 --- a/lib/netfilter/queue_msg.c +++ b/lib/netfilter/queue_msg.c @@ -20,7 +20,7 @@ #include <sys/types.h> #include <linux/netfilter/nfnetlink_queue.h> -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/attr.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/queue_msg.h> diff --git a/lib/netfilter/queue_msg_obj.c b/lib/netfilter/queue_msg_obj.c index bfaafc5..8085f1b 100644 --- a/lib/netfilter/queue_msg_obj.c +++ b/lib/netfilter/queue_msg_obj.c @@ -9,7 +9,7 @@ * Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/netfilter.h> #include <netlink/netfilter/queue_msg.h> diff --git a/lib/netfilter/queue_obj.c b/lib/netfilter/queue_obj.c index 05a9cb8..5edcc68 100644 --- a/lib/netfilter/queue_obj.c +++ b/lib/netfilter/queue_obj.c @@ -16,7 +16,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/queue.h> @@ -25,7 +25,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/handlers.h> diff --git a/lib/object.c b/lib/object.c index 7361194..17b98f6 100644 --- a/lib/object.c +++ b/lib/object.c @@ -27,7 +27,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/object.h> diff --git a/lib/route/addr.c b/lib/route/addr.c index c5e14bb..95a9447 100644 --- a/lib/route/addr.c +++ b/lib/route/addr.c @@ -106,7 +106,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/route/rtnl.h> #include <netlink/route/addr.h> diff --git a/lib/route/class.c b/lib/route/class.c index 399e8a2..050f42a 100644 --- a/lib/route/class.c +++ b/lib/route/class.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -15,10 +15,10 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/class.h> #include <netlink/route/qdisc.h> #include <netlink/route/classifier.h> diff --git a/lib/route/classid.c b/lib/route/classid.c index 255e075..f2d3a01 100644 --- a/lib/route/classid.c +++ b/lib/route/classid.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2010-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -15,8 +15,8 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/tc.h> diff --git a/lib/route/cls.c b/lib/route/cls.c index 35a010a..7a809bb 100644 --- a/lib/route/cls.c +++ b/lib/route/cls.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -15,11 +15,11 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/classifier.h> #include <netlink/route/link.h> diff --git a/lib/route/cls/basic.c b/lib/route/cls/basic.c index 9d7710a..fb1c382 100644 --- a/lib/route/cls/basic.c +++ b/lib/route/cls/basic.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2008-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2008-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -22,10 +22,10 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/classifier.h> #include <netlink/route/cls/basic.h> #include <netlink/route/cls/ematch.h> diff --git a/lib/route/cls/cgroup.c b/lib/route/cls/cgroup.c index 230863b..c5b7561 100644 --- a/lib/route/cls/cgroup.c +++ b/lib/route/cls/cgroup.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2009-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2009-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -16,12 +16,12 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/classifier.h> #include <netlink/route/cls/cgroup.h> #include <netlink/route/cls/ematch.h> diff --git a/lib/route/cls/ematch.c b/lib/route/cls/ematch.c index 8c9c3dd..89b5067 100644 --- a/lib/route/cls/ematch.c +++ b/lib/route/cls/ematch.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2008-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -16,8 +16,8 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/route/classifier.h> #include <netlink/route/cls/ematch.h> diff --git a/lib/route/cls/ematch/cmp.c b/lib/route/cls/ematch/cmp.c index 2a1070a..2997cdb 100644 --- a/lib/route/cls/ematch/cmp.c +++ b/lib/route/cls/ematch/cmp.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2008-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -16,8 +16,8 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/route/cls/ematch.h> #include <linux/tc_ematch/tc_em_cmp.h> diff --git a/lib/route/cls/ematch/container.c b/lib/route/cls/ematch/container.c index 6d73ab6..813391a 100644 --- a/lib/route/cls/ematch/container.c +++ b/lib/route/cls/ematch/container.c @@ -6,11 +6,11 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2008-2013 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/route/cls/ematch.h> diff --git a/lib/route/cls/ematch/meta.c b/lib/route/cls/ematch/meta.c index 11f87d6..44f11b9 100644 --- a/lib/route/cls/ematch/meta.c +++ b/lib/route/cls/ematch/meta.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2010-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -16,8 +16,8 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/route/cls/ematch.h> #include <netlink/route/cls/ematch/meta.h> diff --git a/lib/route/cls/ematch/nbyte.c b/lib/route/cls/ematch/nbyte.c index 25a9866..8852489 100644 --- a/lib/route/cls/ematch/nbyte.c +++ b/lib/route/cls/ematch/nbyte.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2010-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -16,8 +16,8 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/route/cls/ematch.h> #include <netlink/route/cls/ematch/nbyte.h> diff --git a/lib/route/cls/ematch/text.c b/lib/route/cls/ematch/text.c index 9d0241e..e8cdcae 100644 --- a/lib/route/cls/ematch/text.c +++ b/lib/route/cls/ematch/text.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2010-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -16,8 +16,8 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/route/cls/ematch.h> #include <netlink/route/cls/ematch/text.h> diff --git a/lib/route/cls/ematch_grammar.l b/lib/route/cls/ematch_grammar.l index 07e7e8c..96ef1a0 100644 --- a/lib/route/cls/ematch_grammar.l +++ b/lib/route/cls/ematch_grammar.l @@ -6,12 +6,12 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2010-2013 Thomas Graf <tgraf@suug.ch> */ %{ - #include <netlink-local.h> - #include <netlink-tc.h> + #include <netlink-private/netlink.h> + #include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/route/cls/ematch.h> #include <netlink/route/cls/ematch/cmp.h> diff --git a/lib/route/cls/ematch_syntax.y b/lib/route/cls/ematch_syntax.y index 39123be..da21039 100644 --- a/lib/route/cls/ematch_syntax.y +++ b/lib/route/cls/ematch_syntax.y @@ -6,12 +6,12 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2010-2013 Thomas Graf <tgraf@suug.ch> */ %{ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/pktloc.h> diff --git a/lib/route/cls/fw.c b/lib/route/cls/fw.c index d24779a..b569d4f 100644 --- a/lib/route/cls/fw.c +++ b/lib/route/cls/fw.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2006 Petr Gotthard <petr.gotthard@siemens.com> * Copyright (c) 2006 Siemens AG Oesterreich */ @@ -18,10 +18,10 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/classifier.h> #include <netlink/route/cls/fw.h> diff --git a/lib/route/cls/police.c b/lib/route/cls/police.c index d7ab26b..1f5d284 100644 --- a/lib/route/cls/police.c +++ b/lib/route/cls/police.c @@ -6,14 +6,14 @@ * 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-2013 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/classifier.h> #include <netlink/route/cls/police.h> diff --git a/lib/route/cls/u32.c b/lib/route/cls/u32.c index aa9eb77..c468ba7 100644 --- a/lib/route/cls/u32.c +++ b/lib/route/cls/u32.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2005-2006 Petr Gotthard <petr.gotthard@siemens.com> * Copyright (c) 2005-2006 Siemens AG Oesterreich */ @@ -18,12 +18,12 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/classifier.h> #include <netlink/route/cls/u32.h> diff --git a/lib/route/link.c b/lib/route/link.c index f817b3a..3171513 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -18,7 +18,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/utils.h> @@ -26,7 +26,7 @@ #include <netlink/hashtable.h> #include <netlink/route/rtnl.h> #include <netlink/route/link.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> /** @cond SKIP */ #define LINK_ATTR_MTU (1 << 0) diff --git a/lib/route/link/api.c b/lib/route/link/api.c index 392ded3..63ff99c 100644 --- a/lib/route/link/api.c +++ b/lib/route/link/api.c @@ -39,11 +39,11 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/link.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> static NL_LIST_HEAD(info_ops); diff --git a/lib/route/link/bonding.c b/lib/route/link/bonding.c index 5e78084..b060ee1 100644 --- a/lib/route/link/bonding.c +++ b/lib/route/link/bonding.c @@ -20,9 +20,9 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> /** * Create a new kernel bonding device diff --git a/lib/route/link/bridge.c b/lib/route/link/bridge.c index cd9f462..52beedd 100644 --- a/lib/route/link/bridge.c +++ b/lib/route/link/bridge.c @@ -9,11 +9,11 @@ * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/route/rtnl.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> #define BRIDGE_ATTR_PORT_STATE 0x0001 diff --git a/lib/route/link/can.c b/lib/route/link/can.c index 4b80d94..76bfa1a 100644 --- a/lib/route/link/can.c +++ b/lib/route/link/can.c @@ -22,13 +22,13 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/utils.h> #include <netlink/object.h> #include <netlink/route/rtnl.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> #include <netlink/route/link/can.h> #include <linux/can/netlink.h> diff --git a/lib/route/link/dummy.c b/lib/route/link/dummy.c index c7dabc1..1fd9f5a 100644 --- a/lib/route/link/dummy.c +++ b/lib/route/link/dummy.c @@ -19,9 +19,9 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> static struct rtnl_link_info_ops dummy_info_ops = { .io_name = "dummy", diff --git a/lib/route/link/inet.c b/lib/route/link/inet.c index a0e2318..e2c867d 100644 --- a/lib/route/link/inet.c +++ b/lib/route/link/inet.c @@ -57,11 +57,11 @@ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/route/rtnl.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> /** @cond SKIP */ struct inet_data diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c index 9ee8226..4c627bd 100644 --- a/lib/route/link/inet6.c +++ b/lib/route/link/inet6.c @@ -9,11 +9,11 @@ * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/route/rtnl.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> struct inet6_data { diff --git a/lib/route/link/vlan.c b/lib/route/link/vlan.c index a9bf955..4f44aa5 100644 --- a/lib/route/link/vlan.c +++ b/lib/route/link/vlan.c @@ -22,13 +22,13 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/attr.h> #include <netlink/utils.h> #include <netlink/object.h> #include <netlink/route/rtnl.h> -#include <netlink/route/link/api.h> +#include <netlink-private/route/link/api.h> #include <netlink/route/link/vlan.h> #include <linux/if_vlan.h> diff --git a/lib/route/neigh.c b/lib/route/neigh.c index 4a85a85..c0f80a2 100644 --- a/lib/route/neigh.c +++ b/lib/route/neigh.c @@ -148,7 +148,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/hashtable.h> diff --git a/lib/route/neightbl.c b/lib/route/neightbl.c index 509617b..f9c9c27 100644 --- a/lib/route/neightbl.c +++ b/lib/route/neightbl.c @@ -16,7 +16,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/rtnl.h> diff --git a/lib/route/nexthop.c b/lib/route/nexthop.c index 9990c51..d3ca499 100644 --- a/lib/route/nexthop.c +++ b/lib/route/nexthop.c @@ -15,7 +15,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/rtnl.h> diff --git a/lib/route/pktloc.c b/lib/route/pktloc.c index 70d552b..9fcf4a4 100644 --- a/lib/route/pktloc.c +++ b/lib/route/pktloc.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2008-2011 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2008-2013 Thomas Graf <tgraf@suug.ch> */ /** @@ -31,8 +31,8 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/pktloc.h> diff --git a/lib/route/pktloc_grammar.l b/lib/route/pktloc_grammar.l index 6b7a933..cbb42b3 100644 --- a/lib/route/pktloc_grammar.l +++ b/lib/route/pktloc_grammar.l @@ -1,6 +1,6 @@ %{ - #include <netlink-local.h> - #include <netlink-tc.h> + #include <netlink-private/netlink.h> + #include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/pktloc.h> diff --git a/lib/route/pktloc_syntax.y b/lib/route/pktloc_syntax.y index 4a2ce48..25d8710 100644 --- a/lib/route/pktloc_syntax.y +++ b/lib/route/pktloc_syntax.y @@ -1,6 +1,6 @@ %{ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/pktloc.h> diff --git a/lib/route/qdisc.c b/lib/route/qdisc.c index 3d618c6..250d191 100644 --- a/lib/route/qdisc.c +++ b/lib/route/qdisc.c @@ -15,12 +15,12 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/link.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/class.h> #include <netlink/route/classifier.h> diff --git a/lib/route/qdisc/blackhole.c b/lib/route/qdisc/blackhole.c index 06f5380..339cf78 100644 --- a/lib/route/qdisc/blackhole.c +++ b/lib/route/qdisc/blackhole.c @@ -15,9 +15,9 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> static struct rtnl_tc_ops blackhole_ops = { .to_kind = "blackhole", diff --git a/lib/route/qdisc/cbq.c b/lib/route/qdisc/cbq.c index e791a10..95f1761 100644 --- a/lib/route/qdisc/cbq.c +++ b/lib/route/qdisc/cbq.c @@ -9,11 +9,11 @@ * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/class.h> #include <netlink/route/link.h> diff --git a/lib/route/qdisc/dsmark.c b/lib/route/qdisc/dsmark.c index b5fd0d6..fd9553d 100644 --- a/lib/route/qdisc/dsmark.c +++ b/lib/route/qdisc/dsmark.c @@ -16,12 +16,12 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/qdisc.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/class.h> #include <netlink/route/qdisc/dsmark.h> diff --git a/lib/route/qdisc/fifo.c b/lib/route/qdisc/fifo.c index e87c79a..d94c007 100644 --- a/lib/route/qdisc/fifo.c +++ b/lib/route/qdisc/fifo.c @@ -29,10 +29,10 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/qdisc/fifo.h> #include <netlink/utils.h> diff --git a/lib/route/qdisc/htb.c b/lib/route/qdisc/htb.c index 9fb0bf6..5a61a4e 100644 --- a/lib/route/qdisc/htb.c +++ b/lib/route/qdisc/htb.c @@ -18,12 +18,12 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/class.h> #include <netlink/route/link.h> diff --git a/lib/route/qdisc/netem.c b/lib/route/qdisc/netem.c index ddd404d..06d9fe8 100644 --- a/lib/route/qdisc/netem.c +++ b/lib/route/qdisc/netem.c @@ -18,11 +18,11 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/qdisc/netem.h> diff --git a/lib/route/qdisc/plug.c b/lib/route/qdisc/plug.c index a99b9be..9f53637 100644 --- a/lib/route/qdisc/plug.c +++ b/lib/route/qdisc/plug.c @@ -60,11 +60,11 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc/plug.h> static int plug_msg_fill(struct rtnl_tc *tc, void *data, struct nl_msg *msg) diff --git a/lib/route/qdisc/prio.c b/lib/route/qdisc/prio.c index 2433c61..54a46f0 100644 --- a/lib/route/qdisc/prio.c +++ b/lib/route/qdisc/prio.c @@ -26,11 +26,11 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/qdisc/prio.h> diff --git a/lib/route/qdisc/red.c b/lib/route/qdisc/red.c index 0480282..f05626e 100644 --- a/lib/route/qdisc/red.c +++ b/lib/route/qdisc/red.c @@ -16,11 +16,11 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/qdisc/red.h> diff --git a/lib/route/qdisc/sfq.c b/lib/route/qdisc/sfq.c index 207140f..acbb4ef 100644 --- a/lib/route/qdisc/sfq.c +++ b/lib/route/qdisc/sfq.c @@ -23,11 +23,11 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/qdisc/sfq.h> diff --git a/lib/route/qdisc/tbf.c b/lib/route/qdisc/tbf.c index a115548..eb574d9 100644 --- a/lib/route/qdisc/tbf.c +++ b/lib/route/qdisc/tbf.c @@ -15,12 +15,12 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/utils.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> #include <netlink/route/qdisc.h> #include <netlink/route/class.h> #include <netlink/route/link.h> diff --git a/lib/route/route.c b/lib/route/route.c index 2218a60..2985187 100644 --- a/lib/route/route.c +++ b/lib/route/route.c @@ -16,7 +16,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/utils.h> diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index 0c472b7..8f1e515 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -30,7 +30,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/cache.h> #include <netlink/utils.h> diff --git a/lib/route/route_utils.c b/lib/route/route_utils.c index 8b73f2b..a5b3966 100644 --- a/lib/route/route_utils.c +++ b/lib/route/route_utils.c @@ -37,7 +37,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/rtnl.h> diff --git a/lib/route/rtnl.c b/lib/route/rtnl.c index 12a7e97..82397e9 100644 --- a/lib/route/rtnl.c +++ b/lib/route/rtnl.c @@ -14,7 +14,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/rtnl.h> diff --git a/lib/route/rule.c b/lib/route/rule.c index 076ca51..b2161a2 100644 --- a/lib/route/rule.c +++ b/lib/route/rule.c @@ -16,7 +16,7 @@ * @{ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/rtnl.h> diff --git a/lib/route/tc.c b/lib/route/tc.c index 5a0b783..29954fd 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -15,14 +15,14 @@ * @{ */ -#include <netlink-local.h> -#include <netlink-tc.h> +#include <netlink-private/netlink.h> +#include <netlink-private/tc.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/route/rtnl.h> #include <netlink/route/link.h> #include <netlink/route/tc.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> /** @cond SKIP */ diff --git a/lib/socket.c b/lib/socket.c index b30058b..d3e636e 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -29,7 +29,7 @@ #include "defs.h" -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <netlink/handlers.h> diff --git a/lib/utils.c b/lib/utils.c index 5511189..3bfa604 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -24,7 +24,7 @@ * ~~~~ */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/netlink.h> #include <netlink/utils.h> #include <linux/socket.h> diff --git a/src/lib/tc.c b/src/lib/tc.c index 26124f1..dde729f 100644 --- a/src/lib/tc.c +++ b/src/lib/tc.c @@ -11,7 +11,7 @@ #include <netlink/cli/utils.h> #include <netlink/cli/tc.h> -#include <netlink/route/tc-api.h> +#include <netlink-private/route/tc-api.h> /** * @ingroup cli diff --git a/src/nl-class-add.c b/src/nl-class-add.c index 9698f0d..b9a17dc 100644 --- a/src/nl-class-add.c +++ b/src/nl-class-add.c @@ -15,6 +15,8 @@ #include <netlink/cli/class.h> #include <netlink/cli/link.h> +#include <netlink-private/route/tc-api.h> + static int quiet = 0; static void print_usage(void) diff --git a/src/nl-cls-add.c b/src/nl-cls-add.c index 054bab3..6acb320 100644 --- a/src/nl-cls-add.c +++ b/src/nl-cls-add.c @@ -13,6 +13,8 @@ #include <netlink/cli/cls.h> #include <netlink/cli/link.h> +#include <netlink-private/route/tc-api.h> + static int quiet = 0; static void print_usage(void) diff --git a/src/nl-list-caches.c b/src/nl-list-caches.c index 14cbab1..853d8a4 100644 --- a/src/nl-list-caches.c +++ b/src/nl-list-caches.c @@ -9,7 +9,7 @@ * Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch> */ -#include <netlink-local.h> +#include <netlink-private/netlink.h> #include <netlink/cli/utils.h> static void print_usage(void) diff --git a/src/nl-qdisc-add.c b/src/nl-qdisc-add.c index dd2ed2b..c2a7c9f 100644 --- a/src/nl-qdisc-add.c +++ b/src/nl-qdisc-add.c @@ -14,6 +14,8 @@ #include <netlink/cli/qdisc.h> #include <netlink/cli/link.h> +#include <netlink-private/route/tc-api.h> + static int quiet = 0; static void print_usage(void) diff --git a/tests/test-cache-mngr.c b/tests/test-cache-mngr.c index da17018..8999e58 100644 --- a/tests/test-cache-mngr.c +++ b/tests/test-cache-mngr.c @@ -3,6 +3,8 @@ #include <netlink/cli/utils.h> #include <signal.h> +#include <netlink-private/cache-api.h> + static int quit = 0; static struct nl_dump_params dp = { |