MT#55283 convert endpoint_parse_any_getaddrinfo_full to bool

Change-Id: I74dbdcb6798203306652078997b74bdaacfb8526
pull/1910/head
Richard Fuchs 1 year ago
parent fbcdaaee4a
commit 5f418146c4

@ -478,7 +478,7 @@ static int redis_ep_parse(endpoint_t *ep, int *db, char **hostname, char **auth,
else
*hostname = g_strdup(s);
if (endpoint_parse_any_getaddrinfo_full(ep, s))
if (!endpoint_parse_any_getaddrinfo_full(ep, s))
return -1;
return 0;
}
@ -962,15 +962,16 @@ static void options(int *argc, char ***argv, charp_ht templates) {
die("Missing option --listen-tcp, --listen-udp, --listen-ng, --listen-tcp-ng, "
"--listen-http, or --listen-https");
if (graphitep) {if (endpoint_parse_any_getaddrinfo_full(&rtpe_config.graphite_ep, graphitep))
die("Invalid IP or port '%s' (--graphite)", graphitep);
if (graphitep) {
if (!endpoint_parse_any_getaddrinfo_full(&rtpe_config.graphite_ep, graphitep))
die("Invalid IP or port '%s' (--graphite)", graphitep);
}
if (graphite_prefix_s)
set_prefix(graphite_prefix_s);
if (homerp) {
if (endpoint_parse_any_getaddrinfo_full(&rtpe_config.homer_ep, homerp))
if (!endpoint_parse_any_getaddrinfo_full(&rtpe_config.homer_ep, homerp))
die("Invalid IP or port '%s' (--homer)", homerp);
}
if (homerproto) {
@ -1077,7 +1078,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
rtpe_config.common.log_levels[log_level_index_srtp] = LOG_DEBUG;
if (dtmf_udp_ep) {
if (endpoint_parse_any_getaddrinfo_full(&rtpe_config.dtmf_udp_ep, dtmf_udp_ep))
if (!endpoint_parse_any_getaddrinfo_full(&rtpe_config.dtmf_udp_ep, dtmf_udp_ep))
die("Invalid IP or port '%s' (--dtmf-log-dest)", dtmf_udp_ep);
}

@ -315,25 +315,15 @@ INLINE bool endpoint_parse_port_any(endpoint_t *e, const char *p, unsigned int p
e->port = port;
return sockaddr_parse_any(&e->address, p);
}
// address (ip) required
INLINE int endpoint_parse_any_full(endpoint_t *d, const char *s) {
int ret;
ret = endpoint_parse_any(d, s) ? 0 : -1;
if (ret)
return ret;
if (is_addr_unspecified(&d->address))
return -1;
return 0;
}
// address (ip or hostname) required
INLINE int endpoint_parse_any_getaddrinfo_full(endpoint_t *d, const char *s) {
int ret;
ret = endpoint_parse_any_getaddrinfo(d, s) ? 0 : 1;
if (ret)
INLINE bool endpoint_parse_any_getaddrinfo_full(endpoint_t *d, const char *s) {
bool ret;
ret = endpoint_parse_any_getaddrinfo(d, s);
if (!ret)
return ret;
if (is_addr_unspecified(&d->address))
return -1;
return 0;
return false;
return true;
}
INLINE int sockaddr_getaddrinfo(sockaddr_t *a, const char *s) {
return sockaddr_getaddrinfo_alt(a, NULL, s) ? 0 : 1;

@ -257,7 +257,7 @@ static void options(int *argc, char ***argv) {
}
if (tls_send_to) {
if (endpoint_parse_any_getaddrinfo_full(&tls_send_to_ep, tls_send_to))
if (!endpoint_parse_any_getaddrinfo_full(&tls_send_to_ep, tls_send_to))
die("Failed to parse 'tcp-send-to' or 'tls-send-to' option");
}

Loading…
Cancel
Save