2 * netlink/genl/family.h Generic Netlink Family
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
12 #ifndef NETLINK_GENL_FAMILY_H_
13 #define NETLINK_GENL_FAMILY_H_
15 #include <netlink/netlink.h>
16 #include <netlink/cache.h>
23 #define FAMILY_ATTR_ID 0x01
24 #define FAMILY_ATTR_NAME 0x02
25 #define FAMILY_ATTR_VERSION 0x04
26 #define FAMILY_ATTR_HDRSIZE 0x08
27 #define FAMILY_ATTR_MAXATTR 0x10
28 #define FAMILY_ATTR_OPS 0x20
36 char gf_name
[GENL_NAMSIZ
];
41 struct nl_list_head gf_ops
;
45 extern struct genl_family
* genl_family_alloc(void);
46 extern void genl_family_put(struct genl_family
*);
48 extern int genl_family_add_op(struct genl_family
*,
56 static inline unsigned int genl_family_get_id(struct genl_family
*family
)
58 if (family
->ce_mask
& FAMILY_ATTR_ID
)
61 return GENL_ID_GENERATE
;
64 static inline void genl_family_set_id(struct genl_family
*family
, unsigned int id
)
67 family
->ce_mask
|= FAMILY_ATTR_ID
;
70 static inline char *genl_family_get_name(struct genl_family
*family
)
72 if (family
->ce_mask
& FAMILY_ATTR_NAME
)
73 return family
->gf_name
;
78 static inline void genl_family_set_name(struct genl_family
*family
, const char *name
)
80 strncpy(family
->gf_name
, name
, GENL_NAMSIZ
-1);
81 family
->ce_mask
|= FAMILY_ATTR_NAME
;
84 static inline uint8_t genl_family_get_version(struct genl_family
*family
)
86 if (family
->ce_mask
& FAMILY_ATTR_VERSION
)
87 return family
->gf_version
;
92 static inline void genl_family_set_version(struct genl_family
*family
, uint8_t version
)
94 family
->gf_version
= version
;
95 family
->ce_mask
|= FAMILY_ATTR_VERSION
;
98 static inline uint32_t genl_family_get_hdrsize(struct genl_family
*family
)
100 if (family
->ce_mask
& FAMILY_ATTR_HDRSIZE
)
101 return family
->gf_hdrsize
;
106 static inline void genl_family_set_hdrsize(struct genl_family
*family
, uint32_t hdrsize
)
108 family
->gf_hdrsize
= hdrsize
;
109 family
->ce_mask
|= FAMILY_ATTR_HDRSIZE
;
112 static inline uint32_t genl_family_get_maxattr(struct genl_family
*family
)
114 if (family
->ce_mask
& FAMILY_ATTR_MAXATTR
)
115 return family
->gf_maxattr
;
117 return family
->gf_maxattr
;
120 static inline void genl_family_set_maxattr(struct genl_family
*family
, uint32_t maxattr
)
122 family
->gf_maxattr
= maxattr
;
123 family
->ce_mask
|= FAMILY_ATTR_MAXATTR
;
This page took 0.056499 seconds and 5 git commands to generate.