LAN interface scanning to determine IPs in LAN. More...
Go to the source code of this file.
Data Structures | |
struct | NT_Network |
We keep a list of our local networks so we can answer LAN vs. More... | |
struct | GNUNET_NT_InterfaceScanner |
Handle to the interface scanner. More... | |
Macros | |
#define | INTERFACE_PROCESSING_INTERVAL |
How frequently do we scan the interfaces for changes to the addresses? More... | |
Functions | |
const char * | GNUNET_NT_to_string (enum GNUNET_NetworkType net) |
Convert a enum GNUNET_NetworkType to a string. More... | |
static void | delete_networks (struct GNUNET_NT_InterfaceScanner *is) |
Delete all entries from the current network list. More... | |
static int | interface_proc (void *cls, const char *name, int isDefault, const struct sockaddr *addr, const struct sockaddr *broadcast_addr, const struct sockaddr *netmask, socklen_t addrlen) |
Function invoked for each interface found. More... | |
static void | get_addresses (void *cls) |
Periodically get list of network addresses from our interfaces. More... | |
enum GNUNET_NetworkType | GNUNET_NT_scanner_get_type (struct GNUNET_NT_InterfaceScanner *is, const struct sockaddr *addr, socklen_t addrlen) |
Returns where the address is located: LAN or WAN or ... More... | |
struct GNUNET_NT_InterfaceScanner * | GNUNET_NT_scanner_init () |
Initialize the interface scanner. More... | |
void | GNUNET_NT_scanner_done (struct GNUNET_NT_InterfaceScanner *is) |
Client is done with the interface scanner, release resources. More... | |
LAN interface scanning to determine IPs in LAN.
Definition in file nt.c.
#define INTERFACE_PROCESSING_INTERVAL |
How frequently do we scan the interfaces for changes to the addresses?
|
static |
Delete all entries from the current network list.
is | scanner to clean up |
Definition at line 128 of file nt.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_free, and is.
Referenced by get_addresses(), and GNUNET_NT_scanner_done().
|
static |
Function invoked for each interface found.
Adds the interface's network addresses to the respective DLL, so we can distinguish between LAN and WAN.
cls | closure with the struct GNUNET_NT_InterfaceScanner |
name | name of the interface (can be NULL for unknown) |
isDefault | is this presumably the default interface |
addr | address of this interface (can be NULL for unknown or unassigned) |
broadcast_addr | the broadcast address (can be NULL for unknown or unassigned) |
netmask | the network mask (can be NULL for unknown or unassigned) |
addrlen | length of the address |
Definition at line 157 of file nt.c.
References GNUNET_a2s(), GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log_from, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_strdup, is, name, NT_Network::netmask, and NT_Network::network.
Referenced by get_addresses(), and GNUNET_NT_scanner_init().
|
static |
Periodically get list of network addresses from our interfaces.
cls | closure |
Definition at line 285 of file nt.c.
References delete_networks(), get_addresses(), GNUNET_OS_network_interfaces_list(), GNUNET_SCHEDULER_add_delayed(), interface_proc(), INTERFACE_PROCESSING_INTERVAL, and is.
Referenced by get_addresses(), and GNUNET_NT_scanner_init().