Callbacks/Customization
[Core Netlink API]


Detailed Description

Customization via callbacks.


Callback Typedefs

typedef int(*) nl_recvmsg_msg_cb_t (struct nl_msg *msg, void *arg)
 nl_recvmsgs() callback for message processing customization
typedef int(*) nl_recvmsg_err_cb_t (struct sockaddr_nl *nla, struct nlmsgerr *nlerr, void *arg)
 nl_recvmsgs() callback for error message processing customization

Callback Handle Management

nl_cb * nl_cb_new (enum nl_cb_kind kind)
 Allocate a new callback handle.
void nl_cb_destroy (struct nl_cb *cb)
 Destroy a callback handle.
nl_cb * nl_cb_clone (struct nl_cb *orig)
 Clone an existing callback handle.

Callback Setup

int nl_cb_set (struct nl_cb *cb, enum nl_cb_type type, enum nl_cb_kind kind, nl_recvmsg_msg_cb_t func, void *arg)
 Set up a callback.
int nl_cb_set_all (struct nl_cb *cb, enum nl_cb_kind kind, nl_recvmsg_msg_cb_t func, void *arg)
 Set up a all callbacks.
int nl_cb_err (struct nl_cb *cb, enum nl_cb_kind kind, nl_recvmsg_err_cb_t func, void *arg)
 Set up an error callback.
void nl_cb_overwrite_recvmsgs (struct nl_cb *cb, int(*func)(struct nl_handle *, struct nl_cb *))
 Overwrite internal calls to nl_recvmsgs().
void nl_cb_overwrite_recv (struct nl_cb *cb, int(*func)(struct nl_handle *, struct sockaddr_nl *, unsigned char **, struct ucred **))
 Overwrite internal calls to nl_recv().
void nl_cb_overwrite_send (struct nl_cb *cb, int(*func)(struct nl_handle *, struct nl_msg *))
 Overwrite internal calls to nl_send().

Enumerations

enum  nl_cb_action { NL_PROCEED, NL_SKIP, NL_EXIT }
 Callback actions. More...
enum  nl_cb_kind {
  NL_CB_DEFAULT, NL_CB_VERBOSE, NL_CB_DEBUG, NL_CB_CUSTOM,
  __NL_CB_KIND_MAX
}
 Callback kinds. More...
enum  nl_cb_type {
  NL_CB_VALID, NL_CB_FINISH, NL_CB_OVERRUN, NL_CB_SKIPPED,
  NL_CB_ACK, NL_CB_MSG_IN, NL_CB_MSG_OUT, NL_CB_INVALID,
  NL_CB_SEQ_CHECK, NL_CB_SEND_ACK, __NL_CB_TYPE_MAX
}
 Callback types. More...


Typedef Documentation

typedef int(*) nl_recvmsg_msg_cb_t(struct nl_msg *msg, void *arg)

nl_recvmsgs() callback for message processing customization

Parameters:
msg netlink message being processed
arg argument passwd on through caller

Definition at line 36 of file handlers.h.

typedef int(*) nl_recvmsg_err_cb_t(struct sockaddr_nl *nla, struct nlmsgerr *nlerr, void *arg)

nl_recvmsgs() callback for error message processing customization

Parameters:
nla netlink address of the peer
nlerr netlink error message being processed
arg argument passed on through caller

Definition at line 45 of file handlers.h.


Enumeration Type Documentation

enum nl_cb_action

Callback actions.

Enumerator:
NL_PROCEED  Proceed with wathever would come next.
NL_SKIP  Skip this message.
NL_EXIT  Stop parsing altogether and discard remaining messages.

Definition at line 54 of file handlers.h.

enum nl_cb_kind

Callback kinds.

Enumerator:
NL_CB_DEFAULT  Default handlers (quiet).
NL_CB_VERBOSE  Verbose default handlers (error messages printed).
NL_CB_DEBUG  Debug handlers for debugging.
NL_CB_CUSTOM  Customized handler specified by the user.

Definition at line 67 of file handlers.h.

enum nl_cb_type

Callback types.

Enumerator:
NL_CB_VALID  Message is valid.
NL_CB_FINISH  Last message in a series of multi part messages received.
NL_CB_OVERRUN  Report received that data was lost.
NL_CB_SKIPPED  Message wants to be skipped.
NL_CB_ACK  Message is an acknowledge.
NL_CB_MSG_IN  Called for every message received.
NL_CB_MSG_OUT  Called for every message sent out except for nl_sendto().
NL_CB_INVALID  Message is malformed and invalid.
NL_CB_SEQ_CHECK  Called instead of internal sequence number checking.
NL_CB_SEND_ACK  Sending of an acknowledge message has been requested.

Definition at line 85 of file handlers.h.


Function Documentation

struct nl_cb* nl_cb_new ( enum nl_cb_kind  kind  ) 

Allocate a new callback handle.

Parameters:
kind callback kind to be used for initialization
Returns:
Newly allocated callback handle or NULL

Definition at line 411 of file handlers.c.

References nl_cb_err(), and nl_cb_set().

Referenced by nl_cb_clone(), and nl_handle_alloc_nondefault().

void nl_cb_destroy ( struct nl_cb *  cb  ) 

Destroy a callback handle.

Parameters:
cb callback handle

Definition at line 437 of file handlers.c.

Referenced by nl_cache_pickup(), nl_handle_destroy(), and nl_wait_for_ack().

struct nl_cb* nl_cb_clone ( struct nl_cb *  orig  ) 

Clone an existing callback handle.

Parameters:
orig original callback handle
Returns:
Newly allocated callback handle being a duplicate of orig or NULL

Definition at line 448 of file handlers.c.

References NL_CB_DEFAULT, and nl_cb_new().

Referenced by nl_cache_pickup(), and nl_wait_for_ack().

int nl_cb_set ( struct nl_cb *  cb,
enum nl_cb_type  type,
enum nl_cb_kind  kind,
nl_recvmsg_msg_cb_t  func,
void *  arg 
)

Set up a callback.

Parameters:
cb callback configuration
type which type callback to set
kind kind of callback
func callback function
arg argument to be passwd to callback function
Returns:
0 on success or a negative error code

Definition at line 478 of file handlers.c.

References NL_CB_CUSTOM.

Referenced by nl_cache_pickup(), nl_cb_new(), nl_cb_set_all(), nl_disable_sequence_check(), and nl_wait_for_ack().

int nl_cb_set_all ( struct nl_cb *  cb,
enum nl_cb_kind  kind,
nl_recvmsg_msg_cb_t  func,
void *  arg 
)

Set up a all callbacks.

Parameters:
cb callback configuration
kind kind of callback
func callback function
arg argument to be passwd to callback function
Returns:
0 on success or a negative error code

Definition at line 507 of file handlers.c.

References nl_cb_set().

int nl_cb_err ( struct nl_cb *  cb,
enum nl_cb_kind  kind,
nl_recvmsg_err_cb_t  func,
void *  arg 
)

Set up an error callback.

Parameters:
cb callback configuration
kind kind of callback
func callback function
arg argument to be passed to callback function

Definition at line 528 of file handlers.c.

References NL_CB_CUSTOM.

Referenced by nl_cb_new().

void nl_cb_overwrite_recvmsgs ( struct nl_cb *  cb,
int(*)(struct nl_handle *, struct nl_cb *)  func 
)

Overwrite internal calls to nl_recvmsgs().

Parameters:
cb callback configuration
func replacement callback for nl_recvmsgs()

Definition at line 550 of file handlers.c.

void nl_cb_overwrite_recv ( struct nl_cb *  cb,
int(*)(struct nl_handle *, struct sockaddr_nl *, unsigned char **, struct ucred **)  func 
)

Overwrite internal calls to nl_recv().

Parameters:
cb callback configuration
func replacement callback for nl_recv()

Definition at line 561 of file handlers.c.

void nl_cb_overwrite_send ( struct nl_cb *  cb,
int(*)(struct nl_handle *, struct nl_msg *)  func 
)

Overwrite internal calls to nl_send().

Parameters:
cb callback configuration
func replacement callback for nl_send()

Definition at line 573 of file handlers.c.


Generated on Fri Mar 16 11:21:33 2007 for libnl by  doxygen 1.5.1