summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-11-16 15:07:27 +0100
committerThomas Graf <tgraf@suug.ch>2010-11-16 15:07:27 +0100
commit01bc3c58c23c97f5d1a407a212e7ab3cbd3b6fb7 (patch)
tree985d30d3a2be096dbda1454bd2a7bd8b22cdcb70
parentee57cc716f9277fd71669fb148c8fb8580e0180a (diff)
downloadlibnl-01bc3c58c23c97f5d1a407a212e7ab3cbd3b6fb7.tar.gz
link/inet: documentation: add examples
-rw-r--r--lib/route/link/inet.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/route/link/inet.c b/lib/route/link/inet.c
index 6f8955a..9de3c94 100644
--- a/lib/route/link/inet.c
+++ b/lib/route/link/inet.c
@@ -9,17 +9,67 @@
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
+/**
+ * @ingroup link_API
+ * @defgroup link_inet IPv4 Link Module
+ * @brief Implementation of IPv4 specific link attributes
+ *
+ *
+ *
+ * @par Example: Reading the value of IPV4_DEVCONF_FORWARDING
+ * @code
+ * struct nl_cache *cache;
+ * struct rtnl_link *link;
+ * uint32_t value;
+ *
+ * // Allocate a link cache
+ * rtnl_link_alloc_cache(sock, AF_UNSPEC, &cache);
+ *
+ * // Search for the link we wish to see the value from
+ * link = rtnl_link_get_by_name(cache, "eth0");
+ *
+ * // Read the value of the setting IPV4_DEVCONF_FORWARDING
+ * if (rtnl_link_inet_get_conf(link, IPV4_DEVCONF_FORWARDING, &value) < 0)
+ * // Error: Unable to read config setting
+ *
+ * printf("forwarding is %s\n", value ? "enabled" : "disabled");
+ * @endcode
+ *
+ * @par Example: Changing the value of IPV4_DEVCONF_FOWARDING
+ * @code
+ * //
+ * // ... Continueing from the previous example ...
+ * //
+ *
+ * struct rtnl_link *new;
+ *
+ * // Allocate a new link to store the changes we wish to make.
+ * new = rtnl_link_alloc();
+ *
+ * // Set IPV4_DEVCONF_FORWARDING to '1'
+ * rtnl_link_inet_set_conf(new, IPV4_DEVCONF_FORWARDING, 1);
+ *
+ * // Send the change request to the kernel.
+ * rtnl_link_change(sock, link, new, 0);
+ * @endcode
+ *
+ * @{
+ */
+
+
#include <netlink-local.h>
#include <netlink/netlink.h>
#include <netlink/attr.h>
#include <netlink/route/rtnl.h>
#include <netlink/route/link/api.h>
+/** @cond SKIP */
struct inet_data
{
uint8_t i_confset[IPV4_DEVCONF_MAX];
uint32_t i_conf[IPV4_DEVCONF_MAX];
};
+/** @endcond */
static void *inet_alloc(struct rtnl_link *link)
{
@@ -226,3 +276,5 @@ static void __exit inet_exit(void)
{
rtnl_link_af_unregister(&inet_ops);
}
+
+/** @} */