diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-09-17 19:04:51 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-09-21 18:16:26 +0200 |
commit | 4106aea8e46d41af66d78b326260dddcf99316c7 (patch) | |
tree | 31dc6ef47046403ee1939ed0cdf3714a3b29eadc /src/libhydra/kernel/kernel_net.h | |
parent | 308ec0b7df3bd61c664b1814b5442bd97a04f17d (diff) | |
download | strongswan-4106aea8e46d41af66d78b326260dddcf99316c7.tar.bz2 strongswan-4106aea8e46d41af66d78b326260dddcf99316c7.tar.xz |
Made IP address enumeration more flexible
Also added an option to enumerate addresses on ignored interfaces.
Diffstat (limited to 'src/libhydra/kernel/kernel_net.h')
-rw-r--r-- | src/libhydra/kernel/kernel_net.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/libhydra/kernel/kernel_net.h b/src/libhydra/kernel/kernel_net.h index 1f56bf8ab..10350d644 100644 --- a/src/libhydra/kernel/kernel_net.h +++ b/src/libhydra/kernel/kernel_net.h @@ -23,12 +23,31 @@ #define KERNEL_NET_H_ typedef struct kernel_net_t kernel_net_t; +typedef enum kernel_address_type_t kernel_address_type_t; #include <utils/enumerator.h> #include <utils/host.h> #include <plugins/plugin.h> /** + * Type of addresses (e.g. when enumerating them) + */ +enum kernel_address_type_t { + /** normal addresses (on regular, up, non-ignored) interfaces */ + ADDR_TYPE_REGULAR = 0, + /** addresses on down interfaces */ + ADDR_TYPE_DOWN = (1 << 0), + /** addresses on ignored interfaces */ + ADDR_TYPE_IGNORED = (1 << 1), + /** addresses on loopback interfaces */ + ADDR_TYPE_LOOPBACK = (1 << 2), + /** virtual IP addresses */ + ADDR_TYPE_VIRTUAL = (1 << 3), + /** to enumerate all available addresses */ + ADDR_TYPE_ALL = (1 << 4) - 1, +}; + +/** * Interface to the network subsystem of the kernel. * * The kernel network interface handles the communication with the kernel @@ -81,14 +100,11 @@ struct kernel_net_t { * enumerator gets destroyed. * The hosts are read-only, do not modify of free. * - * @param include_down_ifaces TRUE to enumerate addresses from down interfaces - * @param include_virtual_ips TRUE to enumerate virtual IP addresses - * @param include_loopback TRUE to enumerate addresses on loopback interfaces - * @return enumerator over host_t's + * @param which a combination of address types to enumerate + * @return enumerator over host_t's */ enumerator_t *(*create_address_enumerator) (kernel_net_t *this, - bool include_down_ifaces, bool include_virtual_ips, - bool include_loopback); + kernel_address_type_t which); /** * Add a virtual IP to an interface. |