diff options
| author | Guillaume Nault <g.nault@alphalink.fr> | 2018-12-07 17:37:43 +0100 |
|---|---|---|
| committer | Dmitry Kozlov <xeb@mail.ru> | 2018-12-08 07:51:36 +0300 |
| commit | 093baccac54573eed54fa2650c19ecaeed3065a5 (patch) | |
| tree | ace1fae4b87bcb29104b9cb11671d2bed5f8e4ab /accel-pppd/utils.h | |
| parent | 0f2f775d644c4cd9007b5816c2cfa9e8d933ef6d (diff) | |
| download | accel-ppp-093baccac54573eed54fa2650c19ecaeed3065a5.tar.gz accel-ppp-093baccac54573eed54fa2650c19ecaeed3065a5.zip | |
utils: add IPv4 string parsing helpers
Define the IPv4 counterparts of u_ip6str() and u_parse_ip6cidr().
Also add the special u_parse_ip4range() which will be useful for
parsing the [client-ip-range] section of accel-ppp.conf.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/utils.h')
| -rw-r--r-- | accel-pppd/utils.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/accel-pppd/utils.h b/accel-pppd/utils.h index a7c3897..06859a6 100644 --- a/accel-pppd/utils.h +++ b/accel-pppd/utils.h @@ -5,6 +5,7 @@ #include <stdint.h> char *u_ip6str(const struct in6_addr *addr, char *buf); +char *u_ip4str(const struct in_addr *addr, char *buf); void u_inet_ntoa(in_addr_t, char *str); int u_readlong(long int *dst, const char *src, long int min, long int max); @@ -20,6 +21,8 @@ size_t u_parse_ip6addr(const char *str, struct in6_addr *addr); size_t u_parse_ip4addr(const char *str, struct in_addr *addr); size_t u_parse_ip6cidr(const char *str, struct in6_addr *netp, uint8_t *plen); +size_t u_parse_ip4cidr(const char *str, struct in_addr *netp, uint8_t *plen); +size_t u_parse_ip4range(const char *str, struct in_addr *base_ip, uint8_t *max); int u_randbuf(void *buf, size_t buf_len, int *err); |
