aboutsummaryrefslogtreecommitdiffstats
path: root/package/libnl-tiny/src/include/netlink/genl/family.h
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
commit5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch)
tree1229a11f725bfa58aa7c57a76898553bb5f6654a /package/libnl-tiny/src/include/netlink/genl/family.h
downloadopenwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz
openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/libnl-tiny/src/include/netlink/genl/family.h')
-rw-r--r--package/libnl-tiny/src/include/netlink/genl/family.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/package/libnl-tiny/src/include/netlink/genl/family.h b/package/libnl-tiny/src/include/netlink/genl/family.h
new file mode 100644
index 000000000..0257cbe27
--- /dev/null
+++ b/package/libnl-tiny/src/include/netlink/genl/family.h
@@ -0,0 +1,130 @@
+/*
+ * netlink/genl/family.h Generic Netlink Family
+ *
+ * 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>
+ */
+
+#ifndef NETLINK_GENL_FAMILY_H_
+#define NETLINK_GENL_FAMILY_H_
+
+#include <netlink/netlink.h>
+#include <netlink/cache.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @cond SKIP */
+#define FAMILY_ATTR_ID 0x01
+#define FAMILY_ATTR_NAME 0x02
+#define FAMILY_ATTR_VERSION 0x04
+#define FAMILY_ATTR_HDRSIZE 0x08
+#define FAMILY_ATTR_MAXATTR 0x10
+#define FAMILY_ATTR_OPS 0x20
+
+
+struct genl_family
+{
+ NLHDR_COMMON
+
+ uint16_t gf_id;
+ char gf_name[GENL_NAMSIZ];
+ uint32_t gf_version;
+ uint32_t gf_hdrsize;
+ uint32_t gf_maxattr;
+
+ struct nl_list_head gf_ops;
+};
+
+
+extern struct genl_family * genl_family_alloc(void);
+extern void genl_family_put(struct genl_family *);
+
+extern int genl_family_add_op(struct genl_family *,
+ int, int);
+
+/**
+ * @name Attributes
+ * @{
+ */
+
+static inline unsigned int genl_family_get_id(struct genl_family *family)
+{
+ if (family->ce_mask & FAMILY_ATTR_ID)
+ return family->gf_id;
+ else
+ return GENL_ID_GENERATE;
+}
+
+static inline void genl_family_set_id(struct genl_family *family, unsigned int id)
+{
+ family->gf_id = id;
+ family->ce_mask |= FAMILY_ATTR_ID;
+}
+
+static inline char *genl_family_get_name(struct genl_family *family)
+{
+ if (family->ce_mask & FAMILY_ATTR_NAME)
+ return family->gf_name;
+ else
+ return NULL;
+}
+
+static inline void genl_family_set_name(struct genl_family *family, const char *name)
+{
+ strncpy(family->gf_name, name, GENL_NAMSIZ-1);
+ family->ce_mask |= FAMILY_ATTR_NAME;
+}
+
+static inline uint8_t genl_family_get_version(struct genl_family *family)
+{
+ if (family->ce_mask & FAMILY_ATTR_VERSION)
+ return family->gf_version;
+ else
+ return 0;
+}
+
+static inline void genl_family_set_version(struct genl_family *family, uint8_t version)
+{
+ family->gf_version = version;
+ family->ce_mask |= FAMILY_ATTR_VERSION;
+}
+
+static inline uint32_t genl_family_get_hdrsize(struct genl_family *family)
+{
+ if (family->ce_mask & FAMILY_ATTR_HDRSIZE)
+ return family->gf_hdrsize;
+ else
+ return 0;
+}
+
+static inline void genl_family_set_hdrsize(struct genl_family *family, uint32_t hdrsize)
+{
+ family->gf_hdrsize = hdrsize;
+ family->ce_mask |= FAMILY_ATTR_HDRSIZE;
+}
+
+static inline uint32_t genl_family_get_maxattr(struct genl_family *family)
+{
+ if (family->ce_mask & FAMILY_ATTR_MAXATTR)
+ return family->gf_maxattr;
+ else
+ return family->gf_maxattr;
+}
+
+static inline void genl_family_set_maxattr(struct genl_family *family, uint32_t maxattr)
+{
+ family->gf_maxattr = maxattr;
+ family->ce_mask |= FAMILY_ATTR_MAXATTR;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif