|
EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the implementation of the interface mapper 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 "allocs.h"#include "iface_mapper.h"#include "ifaceu.h"#include "log.h"#include "net.h"#include "os.h"Functions | |
| int | get_if_mapper (hmap_if_conn *const *hmap, in_addr_t subnet, char ifname[static IF_NAMESIZE]) |
| Get the interface name corresponding to an IP address of the subnet. More... | |
| bool | put_if_mapper (hmap_if_conn **hmap, in_addr_t subnet, const char *ifname) |
| Inserts an interface and subnet IP value into the interface connection mapper. More... | |
| void | free_if_mapper (hmap_if_conn **hmap) |
| Frees the interface connection mapper object. More... | |
| int | get_vlan_mapper (hmap_vlan_conn *const *hmap, int vlanid, struct vlan_conn *conn) |
| Get the vlan connection structure corresponding to a VLAN ID. More... | |
| int | copy_vlan_mapper (hmap_vlan_conn *const *hmap, hmap_vlan_conn **copy) |
| Makes a copy of the VLAn mapper structure. More... | |
| bool | put_vlan_mapper (hmap_vlan_conn **hmap, const struct vlan_conn *conn) |
| Inserts a vlan connection structure and VLAN ID value into the interface connection mapper. More... | |
| void | free_vlan_mapper (hmap_vlan_conn **hmap) |
| Frees the VLAN ID to interface connection mapper object. More... | |
| int | find_ifinfo (const UT_array *config_ifinfo_array, const char *ip, config_ifinfo_t *ifinfo) |
| int | get_brname_from_ip (const UT_array *config_ifinfo_array, const char *ip_addr, char brname[static IF_NAMESIZE]) |
| Get the bridge name from an IP string. More... | |
| int | get_ifname_from_ip (const UT_array *config_ifinfo_array, const char *ip_addr, char ifname[static IF_NAMESIZE]) |
| Get the interface name from an IP string. More... | |
| bool | create_if_mapper (const UT_array *config_ifinfo_array, hmap_if_conn **hmap) |
| Create the subnet to interface mapper. More... | |
| int | create_vlan_mapper (const UT_array *config_ifinfo_array, hmap_vlan_conn **hmap) |
| Create the VLAN ID to interface mapper. More... | |
| int | init_ifbridge_names (UT_array *config_ifinfo_array, const char *ifname, const char *brname) |
| Initialise the interface names. More... | |
File containing the implementation of the interface mapper utilities.
| int copy_vlan_mapper | ( | hmap_vlan_conn *const * | hmap, |
| hmap_vlan_conn ** | copy | ||
| ) |
Makes a copy of the VLAn mapper structure.
| [in] | hmap | The VLAN ID to vlan connection mapper object |
| [in,out] | copy | The copied VLAN mapper. |
| bool create_if_mapper | ( | const UT_array * | config_ifinfo_array, |
| hmap_if_conn ** | hmap | ||
| ) |
Create the subnet to interface mapper.
| [in] | config_ifinfo_array | The connection info array |
| [in,out] | hmap | The subnet to interface mapper |
| int create_vlan_mapper | ( | const UT_array * | config_ifinfo_array, |
| hmap_vlan_conn ** | hmap | ||
| ) |
Create the VLAN ID to interface mapper.
| [in] | config_ifinfo_array | The connection info array |
| [in,out] | hmap | The VLAN ID to interface mapper |
| int find_ifinfo | ( | const UT_array * | config_ifinfo_array, |
| const char * | ip, | ||
| config_ifinfo_t * | ifinfo | ||
| ) |
| void free_if_mapper | ( | hmap_if_conn ** | hmap | ) |
Frees the interface connection mapper object.
| hmap | The interface connection mapper object |
| void free_vlan_mapper | ( | hmap_vlan_conn ** | hmap | ) |
Frees the VLAN ID to interface connection mapper object.
| hmap | The VLAN ID to interface connection mapper object |
| int get_brname_from_ip | ( | const UT_array * | config_ifinfo_array, |
| const char * | ip_addr, | ||
| char | brname[static IF_NAMESIZE] | ||
| ) |
Get the bridge name from an IP string.
| [in] | config_ifinfo_array | The list of IP subnets |
| [in] | ip_addr | The input IP address |
| [out] | brname | The returned bridge name (buffer has to be preallocated to at least the size of config_ifinfo_t::brname). |
| int get_if_mapper | ( | hmap_if_conn *const * | hmap, |
| in_addr_t | subnet, | ||
| char | ifname[static IF_NAMESIZE] | ||
| ) |
Get the interface name corresponding to an IP address of the subnet.
| [in] | hmap | The interface connection mapper object |
| [in] | subnet | The IP address of the subnet |
| [out] | ifname | The buffer to store the returned interface name. Must be at least IF_NAMESIZE large. |
| int get_ifname_from_ip | ( | const UT_array * | config_ifinfo_array, |
| const char * | ip, | ||
| char | ifname[static IF_NAMESIZE] | ||
| ) |
Get the interface name from an IP string.
| [in] | config_ifinfo_array | The list of IP subnets |
| [in] | ip | The input IP address |
| [out] | ifname | The returned interface name (buffer has to be preallocated at least the size of config_ifinfo_t::ifname) |
| int get_vlan_mapper | ( | hmap_vlan_conn *const * | hmap, |
| int | vlanid, | ||
| struct vlan_conn * | conn | ||
| ) |
Get the vlan connection structure corresponding to a VLAN ID.
| [in] | hmap | The VLAN ID to vlan connection mapper object |
| [in] | vlanid | The VLAN ID |
| [out] | conn | The returned VLAN connection structure |
| int init_ifbridge_names | ( | UT_array * | config_ifinfo_array, |
| const char * | ifname, | ||
| const char * | brname | ||
| ) |
Initialise the interface names.
| [in,out] | config_ifinfo_array | The connection info array |
| [in] | ifname | The interface name prefix |
| [in] | brname | The bridge name prefix |
| bool put_if_mapper | ( | hmap_if_conn ** | hmap, |
| in_addr_t | subnet, | ||
| const char * | ifname | ||
| ) |
Inserts an interface and subnet IP value into the interface connection mapper.
| [in,out] | hmap | The interface connection mapper object |
| [in] | subnet | The IP address of the subnet |
| [in] | ifname | The interface name |
| bool put_vlan_mapper | ( | hmap_vlan_conn ** | hmap, |
| const struct vlan_conn * | conn | ||
| ) |
Inserts a vlan connection structure and VLAN ID value into the interface connection mapper.
| [in,out] | hmap | The VLAN ID to interface connection mapper object |
| [in] | conn | The VLAN connection structure |