diff options
| author | Daniil Baturin <daniil@baturin.org> | 2013-06-02 00:22:53 -0700 |
|---|---|---|
| committer | Daniil Baturin <daniil@baturin.org> | 2013-06-02 00:22:53 -0700 |
| commit | a64770739a28b05f6c5a033a3f2085959662b447 (patch) | |
| tree | f34816ebaef15ba889eab36e2a5f7bf3eb051607 /src/ipaddrcheck_functions.c | |
| parent | 4822c9800c332da8501de67a1732f9b1651dfe97 (diff) | |
| download | ipaddrcheck-a64770739a28b05f6c5a033a3f2085959662b447.tar.gz ipaddrcheck-a64770739a28b05f6c5a033a3f2085959662b447.zip | |
Add missing IPv6 and protocol-agnostic format validation functions.
Diffstat (limited to 'src/ipaddrcheck_functions.c')
| -rw-r--r-- | src/ipaddrcheck_functions.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ipaddrcheck_functions.c b/src/ipaddrcheck_functions.c index bb86ee7..dfcdcfb 100644 --- a/src/ipaddrcheck_functions.c +++ b/src/ipaddrcheck_functions.c @@ -145,6 +145,42 @@ int is_ipv6_single(char* address_str) return(result); } +/* Is it a CIDR-formatted IPv4 or IPv6 address? */ +int is_any_cidr(char* address_str) +{ + int result; + + if( (is_ipv4_cidr(address_str) == RESULT_SUCCESS) || + (is_ipv6_cidr(address_str) == RESULT_SUCCESS) ) + { + result = RESULT_SUCCESS; + } + else + { + result = RESULT_FAILURE; + } + + return(result); +} + +/* Is it a single IPv4 or IPv6 address? */ +int is_any_single(char* address_str) +{ + int result; + + if( (is_ipv4_single(address_str) == RESULT_SUCCESS) || + (is_ipv6_single(address_str) == RESULT_SUCCESS) ) + { + result = RESULT_SUCCESS; + } + else + { + result = RESULT_FAILURE; + } + + return(result); +} + /* * Address checking functions that rely on libcidr */ |
