2
* netlink/handlers.c default netlink message handlers
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_HANDLERS_H_
13
#define NETLINK_HANDLERS_H_
17
#include <sys/types.h>
18
#include <netlink/netlink-compat.h>
19
#include <netlink/netlink-kernel.h>
31
* @name Callback Typedefs
36
* nl_recvmsgs() callback for message processing customization
38
* @arg msg netlink message being processed
39
* @arg arg argument passwd on through caller
41
typedef int (*nl_recvmsg_msg_cb_t)(struct nl_msg *msg, void *arg);
44
* nl_recvmsgs() callback for error message processing customization
46
* @arg nla netlink address of the peer
47
* @arg nlerr netlink error message being processed
48
* @arg arg argument passed on through caller
50
typedef int (*nl_recvmsg_err_cb_t)(struct sockaddr_nl *nla,
51
struct nlmsgerr *nlerr, void *arg);
60
/** Proceed with wathever would come next */
62
/** Skip this message */
64
/** Stop parsing altogether and discard remaining messages */
73
/** Default handlers (quiet) */
75
/** Verbose default handlers (error messages printed) */
77
/** Debug handlers for debugging */
79
/** Customized handler specified by the user */
84
#define NL_CB_KIND_MAX (__NL_CB_KIND_MAX - 1)
91
/** Message is valid */
93
/** Last message in a series of multi part messages received */
95
/** Report received that data was lost */
97
/** Message wants to be skipped */
99
/** Message is an acknowledge */
101
/** Called for every message received */
103
/** Called for every message sent out except for nl_sendto() */
105
/** Message is malformed and invalid */
107
/** Called instead of internal sequence number checking */
109
/** Sending of an acknowledge message has been requested */
114
#define NL_CB_TYPE_MAX (__NL_CB_TYPE_MAX - 1)
116
extern struct nl_cb * nl_cb_alloc(enum nl_cb_kind);
117
extern struct nl_cb * nl_cb_clone(struct nl_cb *);
118
extern struct nl_cb * nl_cb_get(struct nl_cb *);
119
extern void nl_cb_put(struct nl_cb *);
121
extern int nl_cb_set(struct nl_cb *, enum nl_cb_type, enum nl_cb_kind,
122
nl_recvmsg_msg_cb_t, void *);
123
extern int nl_cb_set_all(struct nl_cb *, enum nl_cb_kind,
124
nl_recvmsg_msg_cb_t, void *);
125
extern int nl_cb_err(struct nl_cb *, enum nl_cb_kind, nl_recvmsg_err_cb_t,
128
extern void nl_cb_overwrite_recvmsgs(struct nl_cb *,
129
int (*func)(struct nl_sock *,
131
extern void nl_cb_overwrite_recv(struct nl_cb *,
132
int (*func)(struct nl_sock *,
133
struct sockaddr_nl *,
136
extern void nl_cb_overwrite_send(struct nl_cb *,
137
int (*func)(struct nl_sock *,