#include <unistd.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <sys/types.h>#include <netinet/in.h>#include <arpa/inet.h>#include <errno.h>#include <assert.h>#include <linux/netdevice.h>#include <libnfnetlink/libnfnetlink.h>#include "rtnl.h"#include "linux_list.h"
Data Structures | |
| struct | ifindex_node |
| struct | nlif_handle |
Functions | |
| int | nlif_index2name (struct nlif_handle *h, unsigned int index, char *name) |
| Get the name for an ifindex. More... | |
| int | nlif_get_ifflags (const struct nlif_handle *h, unsigned int index, unsigned int *flags) |
| Get the flags for an ifindex. More... | |
| struct nlif_handle * | nlif_open (void) |
| Initialize interface table. More... | |
| void | nlif_close (struct nlif_handle *h) |
| Destructor of interface table. More... | |
| int | nlif_catch (struct nlif_handle *h) |
| Receive message from netlink and update interface table. More... | |
| int | nlif_query (struct nlif_handle *h) |
| nlif_query - request a dump of interfaces available in the system : pointer to a valid nlif_handler More... | |
| int | nlif_fd (struct nlif_handle *h) |
| Returns socket descriptor for the netlink socket. More... | |
| int nlif_catch | ( | struct nlif_handle * | h | ) |
Receive message from netlink and update interface table.
| nlif_handle | A pointer to a nlif_handle created |
References NULL, nlif_handle::rtnl_handle, and rtnl_receive().

| void nlif_close | ( | struct nlif_handle * | h | ) |
Destructor of interface table.
| nlif_handle | A pointer to a nlif_handle created via nlif_open() |
References ifindex_node::head, nlif_handle::ifadd_handler, nlif_handle::ifdel_handler, nlif_handle::ifindex_hash, list_for_each_entry_safe, NULL, rtnl_close(), nlif_handle::rtnl_handle, and rtnl_handler_unregister().
Referenced by main().


| int nlif_fd | ( | struct nlif_handle * | h | ) |
Returns socket descriptor for the netlink socket.
| nlif_handle | A pointer to a nlif_handle created |
References NULL, rtnl_handle::rtnl_fd, and nlif_handle::rtnl_handle.
Referenced by nl_init_interface_handler().

| int nlif_get_ifflags | ( | const struct nlif_handle * | h, |
| unsigned int | index, | ||
| unsigned int * | flags | ||
| ) |
Get the flags for an ifindex.
| nlif_handle | A pointer to a nlif_handle created |
| index | ifindex to be resolved |
| flags | pointer to variable used to store the interface flags |
References flags, ifindex_node::head, nlif_handle::ifindex_hash, list_for_each_entry, and NULL.
Referenced by main().

| int nlif_index2name | ( | struct nlif_handle * | h, |
| unsigned int | index, | ||
| char * | name | ||
| ) |
Get the name for an ifindex.
| nlif_handle | A pointer to a nlif_handle created |
| index | ifindex to be resolved |
| name | interface name, pass a buffer of IFNAMSIZ size |
References ifindex_node::head, nlif_handle::ifindex_hash, list_for_each_entry, and NULL.
Referenced by main(), nfq_get_indev_name(), nfq_get_outdev_name(), nfq_get_physindev_name(), and nfq_get_physoutdev_name().

| struct nlif_handle* nlif_open | ( | void | ) |
Initialize interface table.
Initialize rtnl interface and interface table Call this before any nlif_* function
References rtnl_handler::arg, rtnl_handler::handlefn, nlif_handle::ifadd_handler, nlif_handle::ifdel_handler, nlif_handle::ifindex_hash, INIT_LIST_HEAD, rtnl_handler::nlmsg_type, NULL, RTM_DELLINK, RTM_NEWLINK, rtnl_close(), nlif_handle::rtnl_handle, rtnl_handler_register(), rtnl_handler_unregister(), and rtnl_open().
Referenced by main(), and nl_init_interface_handler().


| int nlif_query | ( | struct nlif_handle * | h | ) |
nlif_query - request a dump of interfaces available in the system : pointer to a valid nlif_handler
References NULL, RTM_GETLINK, rtnl_dump_type(), and nlif_handle::rtnl_handle.
Referenced by main(), and nl_init_interface_handler().

