|
EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the implementation of the network interface utilities. More...
#include <stdbool.h>#include <stdio.h>#include <stdlib.h>#include <arpa/inet.h>#include <errno.h>#include <fcntl.h>#include <fnmatch.h>#include <string.h>#include <sys/stat.h>#include <unistd.h>#include <sys/socket.h>#include <ifaddrs.h>#include <netdb.h>#include "allocs.h"#include "iface.h"#include "iface_mapper.h"#include "ifaceu.h"#include "log.h"#include "net.h"#include "os.h"Macros | |
| #define | _GNU_SOURCE /* To get defns of NI_MAXSERV and NI_MAXHOST */ |
Functions | |
| void | iface_free_context (struct iface_context *ctx) |
| Initialises the interface context. More... | |
| struct iface_context * | iface_init_context (void *params) |
| Initialises the interface context. More... | |
| UT_array * | iface_get (const char *ifname) |
Get the array of struct netif_info_t for each available interface. More... | |
| UT_array * | iface_get_ip4 (const struct iface_context *ctx, const char *brname, const char *ifname) |
| Get the IP4 addresses for a given interface. More... | |
| char * | iface_get_vlan (char if_buf[static IF_NAMESIZE]) |
| Returns an exisiting WiFi interface name that supports VLAN. More... | |
| int | reset_interface (const struct iface_context *ctx, const char *ifname) |
| Resets an interface. More... | |
| int | iface_create (const struct iface_context *ctx, const char *brname, const char *ifname, const char *type, const char *ip_addr, const char *brd_addr, const char *subnet_mask) |
| Creates and interface and assigns an IP. More... | |
| int | iface_set_ip4 (const struct iface_context *ctx, const char *brname, const char *ifname, const char *ip_addr, const char *brd_addr, const char *subnet_mask) |
| Sets the IP4 for a given interface. More... | |
| int | iface_commit (const struct iface_context *ctx) |
| Commits the interface changes. More... | |
File containing the implementation of the network interface utilities.
| #define _GNU_SOURCE /* To get defns of NI_MAXSERV and NI_MAXHOST */ |
| int iface_commit | ( | const struct iface_context * | context | ) |
Commits the interface changes.
| context | The interface context |
| int iface_create | ( | const struct iface_context * | context, |
| const char * | brname, | ||
| const char * | ifname, | ||
| const char * | type, | ||
| const char * | ip_addr, | ||
| const char * | brd_addr, | ||
| const char * | subnet_mask | ||
| ) |
Creates and interface and assigns an IP.
| context | The interface context |
| brname | The bridge name |
| ifname | The interface name |
| type | The interface type |
| ip_addr | The interface IP4 address |
| brd_addr | The interface IP4 broadcast address |
| subnet_mask | The interface IP4 subnet mask |
| void iface_free_context | ( | struct iface_context * | context | ) |
Initialises the interface context.
| context | The interface context |
| UT_array* iface_get | ( | const char * | ifname | ) |
Get the array of struct netif_info_t for each available interface.
| [in] | ifname | The interface name, if NULL return all interfaces |
struct netif_info_t. Must be freed with utarray_free() when done. | UT_array* iface_get_ip4 | ( | const struct iface_context * | context, |
| const char * | brname, | ||
| const char * | ifname | ||
| ) |
Get the IP4 addresses for a given interface.
| context | The interface context | |
| [in] | brname | The bridge name |
| [in] | ifname | The interface name |
| char* iface_get_vlan | ( | char | if_buf[static IF_NAMESIZE] | ) |
Returns an exisiting WiFi interface name that supports VLAN.
| [out] | if_buf | Interface working buffer of at least size IF_NAMESIZE. |
if_buf param), or NULL on error. | struct iface_context* iface_init_context | ( | void * | params | ) |
Initialises the interface context.
| params | The parameters for interface context |
| int iface_set_ip4 | ( | const struct iface_context * | context, |
| const char * | brname, | ||
| const char * | ifname, | ||
| const char * | ip_addr, | ||
| const char * | brd_addr, | ||
| const char * | subnet_mask | ||
| ) |
Sets the IP4 for a given interface.
| context | The interface context |
| brname | The bridge name |
| ifname | The interface name |
| ip_addr | The interface IP4 address |
| brd_addr | The interface IP4 broadcast address |
| subnet_mask | The interface IP4 subnet mask |
| int reset_interface | ( | const struct iface_context * | context, |
| const char * | ifname | ||
| ) |
Resets an interface.
| context | The interface context |
| ifname | The interface name |