From 82be444eb99b51f42e717bf883a981ae9cd7d77e Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 28 Oct 2014 18:14:29 +0100 Subject: host: Add function to create two hosts from a range definition --- src/libstrongswan/networking/host.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/libstrongswan/networking/host.h') diff --git a/src/libstrongswan/networking/host.h b/src/libstrongswan/networking/host.h index 9c9b5035f..3670768c4 100644 --- a/src/libstrongswan/networking/host.h +++ b/src/libstrongswan/networking/host.h @@ -180,6 +180,19 @@ host_t *host_create_from_chunk(int family, chunk_t address, u_int16_t port); */ host_t *host_create_from_sockaddr(sockaddr_t *sockaddr); +/** + * Parse a range definition (1.2.3.0-1.2.3.5), return the two hosts. + * + * The two hosts are not ordered, from is simply the first, to is the second, + * from is not necessarily smaller. + * + * @param string string to parse + * @param from returns the first address (out) + * @param to returns the second address (out) + * @return TRUE if parsed successfully, FALSE otherwise + */ +bool host_create_from_range(char *string, host_t **from, host_t **to); + /** * Create a host from a CIDR subnet definition (1.2.3.0/24), return bits. * -- cgit v1.2.3