From 63817407a4ecab7e97afec6d33fd2243dbd69e2e Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Wed, 23 Jun 2021 07:46:05 +0200 Subject: [PATCH] sa: add sa_pton() --- include/re_sa.h | 1 + src/sa/sa.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/re_sa.h b/include/re_sa.h index 1a74f68c0..f17ce0b20 100644 --- a/include/re_sa.h +++ b/include/re_sa.h @@ -48,6 +48,7 @@ int sa_af(const struct sa *sa); uint32_t sa_in(const struct sa *sa); void sa_in6(const struct sa *sa, uint8_t *addr); int sa_ntop(const struct sa *sa, char *buf, int size); +int sa_pton(const char *addr, struct sa *sa); uint16_t sa_port(const struct sa *sa); bool sa_isset(const struct sa *sa, int flag); uint32_t sa_hash(const struct sa *sa, int flag); diff --git a/src/sa/sa.c b/src/sa/sa.c index a50e66c1c..b2b20663e 100644 --- a/src/sa/sa.c +++ b/src/sa/sa.c @@ -66,7 +66,7 @@ int sa_set(struct sa *sa, const struct pl *addr, uint16_t port) * * @return 0 if success, otherwise errorcode */ -static int net_inet_pton(const char *addr, struct sa *sa) +int sa_pton(const char *addr, struct sa *sa) { if (!addr) return EINVAL; @@ -111,7 +111,7 @@ int sa_set_str(struct sa *sa, const char *addr, uint16_t port) if (!sa || !addr) return EINVAL; - err = net_inet_pton(addr, sa); + err = sa_pton(addr, sa); if (err) return err;