From 4a4ff2f073debbe1b5967121fc4e1782bd004ed6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 28 Oct 2014 14:03:46 +0000 Subject: Rework host/port/priority parsing. --- src/libutil/addr.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/libutil/addr.h') diff --git a/src/libutil/addr.h b/src/libutil/addr.h index 049cc88c3..706f2bf87 100644 --- a/src/libutil/addr.h +++ b/src/libutil/addr.h @@ -95,4 +95,27 @@ gboolean rspamd_ip_is_valid (rspamd_inet_addr_t *addr); */ gint rspamd_accept_from_socket (gint sock, rspamd_inet_addr_t *addr); +gboolean rspamd_parse_host_port_priority_strv (gchar **tokens, + rspamd_inet_addr_t *addr, guint *priority, guint default_port); + +/** + * Parse host[:port[:priority]] line + * @param ina host address + * @param port port + * @param priority priority + * @return TRUE if string was parsed + */ +gboolean rspamd_parse_host_port_priority (const gchar *str, + rspamd_inet_addr_t *addr, guint *priority, guint default_port); + +/** + * Parse host:port line + * @param ina host address + * @param port port + * @return TRUE if string was parsed + */ +gboolean rspamd_parse_host_port (const gchar *str, + rspamd_inet_addr_t *addr, guint default_port); + + #endif /* ADDR_H_ */ -- cgit v1.2.3