aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/addr.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-13 15:17:45 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-13 15:17:45 +0100
commit9370ea45e1a9b745cec61cd0e90389ee37f4853a (patch)
treed70d4da3d8bfa5e3dd5d0ac99fa6a2ad63ef5c0c /src/libutil/addr.h
parent1ccfaf0523b69bda6f34e33faaf2dc9f321abfa9 (diff)
downloadrspamd-9370ea45e1a9b745cec61cd0e90389ee37f4853a.tar.gz
rspamd-9370ea45e1a9b745cec61cd0e90389ee37f4853a.zip
Fix parsing of fixed length IP addresses.
Diffstat (limited to 'src/libutil/addr.h')
-rw-r--r--src/libutil/addr.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/libutil/addr.h b/src/libutil/addr.h
index affd87158..d686fa52a 100644
--- a/src/libutil/addr.h
+++ b/src/libutil/addr.h
@@ -64,13 +64,36 @@ rspamd_inet_addr_t * rspamd_inet_address_from_sa (const struct sockaddr *sa,
socklen_t slen);
/**
+ * Parse string with ipv6 address of length `len` to `target` which should be
+ * at least sizeof (in6_addr_t)
+ * @param text input string
+ * @param len lenth of `text` (if 0, then `text` must be zero terminated)
+ * @param target target structure
+ * @return TRUE if the address has been parsed, otherwise `target` content is undefined
+ */
+gboolean rspamd_parse_inet_address_ip6 (const guchar *text, gsize len,
+ gpointer target);
+
+/**
+ * Parse string with ipv4 address of length `len` to `target` which should be
+ * at least sizeof (in4_addr_t)
+ * @param text input string
+ * @param len lenth of `text` (if 0, then `text` must be zero terminated)
+ * @param target target structure
+ * @return TRUE if the address has been parsed, otherwise `target` content is undefined
+ */
+gboolean rspamd_parse_inet_address_ip4 (const guchar *text, gsize len,
+ gpointer target);
+
+/**
* Try to parse address from string
* @param target target to fill
* @param src IP string representation
* @return TRUE if addr has been parsed
*/
gboolean rspamd_parse_inet_address (rspamd_inet_addr_t **target,
- const char *src);
+ const char *src,
+ gsize srclen);
/**
* Returns string representation of inet address