Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros
genetlink.h File Reference
#include <linux/genetlink.h>
#include <net/netlink.h>
#include <net/net_namespace.h>

Go to the source code of this file.

Data Structures

struct  genl_multicast_group
 
struct  genl_family
 
struct  genl_info
 
struct  genl_ops
 

Macros

#define GENLMSG_DEFAULT_SIZE   (NLMSG_DEFAULT_SIZE - GENL_HDRLEN)
 

Functions

: name of family

struct genl_family - generic netlink family : protocol family idenfitier : length of user specific header in bytes

Version
: protocol version : maximum number of attributes supported : set to true if the family can handle network namespaces and should be presented in all of them : called before an operation's doit callback, it may do additional, common, filtering and return an error : called after an operation's doit callback, it may undo operations done by pre_doit, for example release locks : buffer to store parsed attributes : list of all assigned operations : family list : multicast groups list
int genl_register_family (struct genl_family *family)
 
int genl_register_family_with_ops (struct genl_family *family, struct genl_ops *ops, size_t n_ops)
 
int genl_unregister_family (struct genl_family *family)
 
int genl_register_ops (struct genl_family *, struct genl_ops *ops)
 
int genl_unregister_ops (struct genl_family *, struct genl_ops *ops)
 
int genl_register_mc_group (struct genl_family *family, struct genl_multicast_group *grp)
 
void genl_unregister_mc_group (struct genl_family *family, struct genl_multicast_group *grp)
 
void genl_notify (struct sk_buff *skb, struct net *net, u32 portid, u32 group, struct nlmsghdr *nlh, gfp_t flags)
 
voidgenlmsg_put (struct sk_buff *skb, u32 portid, u32 seq, struct genl_family *family, int flags, u8 cmd)
 
int genlmsg_multicast_allns (struct sk_buff *skb, u32 portid, unsigned int group, gfp_t flags)
 

Macro Definition Documentation

#define GENLMSG_DEFAULT_SIZE   (NLMSG_DEFAULT_SIZE - GENL_HDRLEN)

Definition at line 8 of file genetlink.h.

Function Documentation

void genl_notify ( struct sk_buff skb,
struct net net,
u32  portid,
u32  group,
struct nlmsghdr nlh,
gfp_t  flags 
)

Definition at line 1010 of file genetlink.c.

int genl_register_family ( struct genl_family family)

genl_register_family - register a generic netlink family : generic netlink family

Registers the specified family after validating it first. Only one family may be registered with the same family name or identifier. The family id may equal GENL_ID_GENERATE causing an unique id to be automatically generated and assigned.

Return 0 on success or a negative error code.

Definition at line 362 of file genetlink.c.

int genl_register_family_with_ops ( struct genl_family family,
struct genl_ops ops,
size_t  n_ops 
)

genl_register_family_with_ops - register a generic netlink family : generic netlink family : operations to be registered : number of elements to register

Registers the specified family and operations from the specified table. Only one family may be registered with the same family name or identifier.

The family id may equal GENL_ID_GENERATE causing an unique id to be automatically generated and assigned.

Either a doit or dumpit callback must be specified for every registered operation or the function will fail. Only one operation structure per command identifier may be registered.

See include/net/genetlink.h for more documenation on the operations structure.

This is equivalent to calling genl_register_family() followed by genl_register_ops() for every operation entry in the table taking care to unregister the family on error path.

Return 0 on success or a negative error code.

Definition at line 445 of file genetlink.c.

int genl_register_mc_group ( struct genl_family family,
struct genl_multicast_group grp 
)

genl_register_mc_group - register a multicast group

Registers the specified multicast group and notifies userspace about the new group.

Returns 0 on success or a negative error code.

: The generic netlink family the group shall be registered for. : The group to register, must have a name.

Definition at line 137 of file genetlink.c.

int genl_register_ops ( struct genl_family family,
struct genl_ops ops 
)

genl_register_ops - register generic netlink operations : generic netlink family : operations to be registered

Registers the specified operations and assigns them to the specified family. Either a doit or dumpit callback must be specified or the operation will fail. Only one operation structure per command identifier may be registered.

See include/net/genetlink.h for more documenation on the operations structure.

Returns 0 on success or a negative error code.

Definition at line 286 of file genetlink.c.

int genl_unregister_family ( struct genl_family family)

genl_unregister_family - unregister generic netlink family : generic netlink family

Unregisters the specified family.

Returns 0 on success or a negative error code.

Definition at line 474 of file genetlink.c.

void genl_unregister_mc_group ( struct genl_family family,
struct genl_multicast_group grp 
)

genl_unregister_mc_group - unregister a multicast group

Unregisters the specified multicast group and notifies userspace about it. All current listeners on the group are removed.

Note: It is not necessary to unregister all multicast groups before unregistering the family, unregistering the family will cause all assigned multicast groups to be unregistered automatically.

: Generic netlink family the group belongs to. : The group to unregister, must have been registered successfully previously.

Definition at line 254 of file genetlink.c.

int genl_unregister_ops ( struct genl_family family,
struct genl_ops ops 
)

genl_unregister_ops - unregister generic netlink operations : generic netlink family : operations to be unregistered

Unregisters the specified operations and unassigns them from the specified family. The operation blocks until the current message processing has finished and doesn't start again until the unregister process has finished.

Note: It is not necessary to unregister all operations before unregistering the family, unregistering the family will cause all assigned operations to be unregistered automatically.

Returns 0 on success or a negative error code.

Definition at line 332 of file genetlink.c.

int genlmsg_multicast_allns ( struct sk_buff skb,
u32  portid,
unsigned int  group,
gfp_t  flags 
)

genlmsg_multicast_allns - multicast a netlink message to all net namespaces : netlink message as socket buffer : own netlink portid to avoid sending to yourself : multicast group id : allocation flags

This function must hold the RTNL or rcu_read_lock().

Definition at line 1003 of file genetlink.c.

void* genlmsg_put ( struct sk_buff skb,
u32  portid,
u32  seq,
struct genl_family family,
int  flags,
u8  cmd 
)

genlmsg_put - Add generic netlink header to netlink message : socket buffer holding the message : netlink portid the message is addressed to : sequence number (usually the one of the sender) : generic netlink family : netlink message flags : generic netlink command

Returns pointer to user specific header

Definition at line 512 of file genetlink.c.