aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-10-11 11:21:31 -0400
committerNick Mathewson <nickm@torproject.org>2011-10-11 11:30:12 -0400
commit00b2b69add373f168e8729e99f349ec5a3753db3 (patch)
tree1752d1b14be442831174faadcbfce9afd83181bb /src/common/address.h
parent69921837a743d551576b3b157657623a0bb96308 (diff)
downloadtor-00b2b69add373f168e8729e99f349ec5a3753db3.tar
tor-00b2b69add373f168e8729e99f349ec5a3753db3.tar.gz
Fix names of functions that convert strings to addrs
Now let's have "lookup" indicate that there can be a hostname resolution, and "parse" indicate that there wasn't. Previously, we had one "lookup" function that did resolution; four "parse" functions, half of which did resolution; and a "from_str()" function that didn't do resolution. That's confusing and error-prone! The code changes in this commit are exactly the result of this perl script, run under "perl -p -i.bak" : s/tor_addr_port_parse/tor_addr_port_lookup/g; s/parse_addr_port(?=[^_])/addr_port_lookup/g; s/tor_addr_from_str/tor_addr_parse/g; This patch leaves aton and pton alone: their naming convention and behavior is is determined by the sockets API. More renaming may be needed.
Diffstat (limited to 'src/common/address.h')
-rw-r--r--src/common/address.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/address.h b/src/common/address.h
index e41e4c2ba..877062e2b 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -159,14 +159,14 @@ int tor_addr_to_reverse_lookup_name(char *out, size_t outlen,
int tor_addr_parse_reverse_lookup_name(tor_addr_t *result, const char *address,
int family, int accept_regular);
-int tor_addr_port_parse(const char *s, tor_addr_t *addr_out,
+int tor_addr_port_lookup(const char *s, tor_addr_t *addr_out,
uint16_t *port_out);
int tor_addr_parse_mask_ports(const char *s,
tor_addr_t *addr_out, maskbits_t *mask_out,
uint16_t *port_min_out, uint16_t *port_max_out);
const char * tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len,
int decorate);
-int tor_addr_from_str(tor_addr_t *addr, const char *src);
+int tor_addr_parse(tor_addr_t *addr, const char *src);
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src);
void tor_addr_from_ipv4n(tor_addr_t *dest, uint32_t v4addr);
/** Set <b>dest</b> to the IPv4 address encoded in <b>v4addr</b> in host
@@ -183,7 +183,7 @@ int tor_addr_is_loopback(const tor_addr_t *addr);
/* IPv4 helpers */
int is_internal_IP(uint32_t ip, int for_listening) ATTR_PURE;
-int parse_addr_port(int severity, const char *addrport, char **address,
+int addr_port_lookup(int severity, const char *addrport, char **address,
uint32_t *addr, uint16_t *port_out);
int parse_port_range(const char *port, uint16_t *port_min_out,
uint16_t *port_max_out);