|
Packit |
6c4009 |
/* Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _NETLINKACCESS_H
|
|
Packit |
6c4009 |
#define _NETLINKACCESS_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <stdint.h>
|
|
Packit |
6c4009 |
#include <sys/types.h>
|
|
Packit |
6c4009 |
#include <asm/types.h>
|
|
Packit |
6c4009 |
#include <linux/netlink.h>
|
|
Packit |
6c4009 |
#include <linux/rtnetlink.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct netlink_res
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
struct netlink_res *next;
|
|
Packit |
6c4009 |
struct nlmsghdr *nlh;
|
|
Packit |
6c4009 |
size_t size; /* Size of response. */
|
|
Packit |
6c4009 |
uint32_t seq; /* sequential number we used. */
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct netlink_handle
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int fd; /* Netlink file descriptor. */
|
|
Packit |
6c4009 |
pid_t pid; /* Process ID. */
|
|
Packit |
6c4009 |
uint32_t seq; /* The sequence number we use currently. */
|
|
Packit |
6c4009 |
struct netlink_res *nlm_list; /* Pointer to list of responses. */
|
|
Packit |
6c4009 |
struct netlink_res *end_ptr; /* For faster append of new entries. */
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
|
|
Packit |
6c4009 |
extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
|
|
Packit |
6c4009 |
extern void __netlink_free_handle (struct netlink_handle *h)
|
|
Packit |
6c4009 |
attribute_hidden;
|
|
Packit |
6c4009 |
extern int __netlink_request (struct netlink_handle *h, int type)
|
|
Packit |
6c4009 |
attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Terminate the process if RESULT is an invalid recvmsg result for
|
|
Packit |
6c4009 |
the netlink socket FD. */
|
|
Packit |
6c4009 |
void __netlink_assert_response (int fd, ssize_t result);
|
|
Packit |
6c4009 |
libc_hidden_proto (__netlink_assert_response)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* netlinkaccess.h */
|