2007-09-15 01:28:01 +02:00
|
|
|
/*
|
|
|
|
* netlink/netlink.h Netlink Interface
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2013-02-14 12:37:10 +01:00
|
|
|
* Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
|
2007-09-15 01:28:01 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NETLINK_NETLINK_H_
|
|
|
|
#define NETLINK_NETLINK_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2014-09-01 12:38:10 +02:00
|
|
|
#include <poll.h>
|
2007-09-15 01:28:01 +02:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/time.h>
|
2008-06-17 02:09:38 +02:00
|
|
|
#include <netdb.h>
|
2007-09-15 01:28:01 +02:00
|
|
|
#include <netlink/netlink-compat.h>
|
|
|
|
#include <linux/netlink.h>
|
|
|
|
#include <linux/rtnetlink.h>
|
|
|
|
#include <linux/genetlink.h>
|
|
|
|
#include <linux/netfilter/nfnetlink.h>
|
2013-07-03 18:40:58 -07:00
|
|
|
#include <netinet/tcp.h>
|
2008-04-30 15:43:42 +02:00
|
|
|
#include <netlink/version.h>
|
2008-05-14 17:49:44 +02:00
|
|
|
#include <netlink/errno.h>
|
2007-09-15 01:28:01 +02:00
|
|
|
#include <netlink/types.h>
|
|
|
|
#include <netlink/handlers.h>
|
|
|
|
#include <netlink/socket.h>
|
2011-04-11 12:34:01 +02:00
|
|
|
#include <netlink/object.h>
|
2007-09-15 01:28:01 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-07-06 15:13:28 -04:00
|
|
|
struct ucred;
|
2013-01-23 13:17:43 +01:00
|
|
|
struct nl_cache_ops;
|
|
|
|
struct nl_parser_param;
|
2013-02-14 12:37:10 +01:00
|
|
|
struct nl_object;
|
|
|
|
struct nl_sock;
|
2009-07-06 15:13:28 -04:00
|
|
|
|
2007-09-15 01:28:01 +02:00
|
|
|
extern int nl_debug;
|
|
|
|
extern struct nl_dump_params nl_debug_dp;
|
|
|
|
|
|
|
|
/* Connection Management */
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_connect(struct nl_sock *, int);
|
|
|
|
extern void nl_close(struct nl_sock *);
|
2007-09-15 01:28:01 +02:00
|
|
|
|
|
|
|
/* Send */
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_sendto(struct nl_sock *, void *, size_t);
|
|
|
|
extern int nl_sendmsg(struct nl_sock *, struct nl_msg *,
|
2007-09-15 01:28:01 +02:00
|
|
|
struct msghdr *);
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_send(struct nl_sock *, struct nl_msg *);
|
2010-02-24 21:29:13 +01:00
|
|
|
extern int nl_send_iovec(struct nl_sock *, struct nl_msg *,
|
2010-07-03 15:14:13 +02:00
|
|
|
struct iovec *, unsigned);
|
2010-11-18 14:13:49 +01:00
|
|
|
extern void nl_complete_msg(struct nl_sock *,
|
|
|
|
struct nl_msg *);
|
2010-02-24 21:29:13 +01:00
|
|
|
extern void nl_auto_complete(struct nl_sock *,
|
2010-11-18 14:13:49 +01:00
|
|
|
struct nl_msg *);
|
|
|
|
extern int nl_send_auto(struct nl_sock *, struct nl_msg *);
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_send_auto_complete(struct nl_sock *,
|
2007-09-15 01:28:01 +02:00
|
|
|
struct nl_msg *);
|
2011-03-25 18:11:52 +01:00
|
|
|
extern int nl_send_sync(struct nl_sock *, struct nl_msg *);
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_send_simple(struct nl_sock *, int, int,
|
2007-09-15 01:28:01 +02:00
|
|
|
void *, size_t);
|
|
|
|
|
|
|
|
/* Receive */
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_recv(struct nl_sock *,
|
2007-09-15 01:28:01 +02:00
|
|
|
struct sockaddr_nl *, unsigned char **,
|
|
|
|
struct ucred **);
|
|
|
|
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *);
|
2012-05-08 22:48:00 +02:00
|
|
|
extern int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *);
|
2007-09-15 01:28:01 +02:00
|
|
|
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_recvmsgs_default(struct nl_sock *);
|
2007-09-15 01:28:01 +02:00
|
|
|
|
2008-05-15 13:26:32 +02:00
|
|
|
extern int nl_wait_for_ack(struct nl_sock *);
|
2007-09-15 01:28:01 +02:00
|
|
|
|
2011-04-11 12:34:01 +02:00
|
|
|
extern int nl_pickup(struct nl_sock *,
|
|
|
|
int (*parser)(struct nl_cache_ops *,
|
|
|
|
struct sockaddr_nl *,
|
|
|
|
struct nlmsghdr *,
|
|
|
|
struct nl_parser_param *),
|
|
|
|
struct nl_object **);
|
2014-11-26 18:13:37 +01:00
|
|
|
extern int nl_pickup_keep_syserr(struct nl_sock *sk,
|
|
|
|
int (*parser)(struct nl_cache_ops *, struct sockaddr_nl *,
|
|
|
|
struct nlmsghdr *, struct nl_parser_param *),
|
|
|
|
struct nl_object **result,
|
|
|
|
int *syserror);
|
2007-09-15 01:28:01 +02:00
|
|
|
/* Netlink Family Translations */
|
|
|
|
extern char * nl_nlfamily2str(int, char *, size_t);
|
|
|
|
extern int nl_str2nlfamily(const char *);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|