aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-31 20:50:56 -0400
committerNick Mathewson <nickm@torproject.org>2012-11-14 23:16:23 -0500
commit898f9c8bcca04320d64963a87ea3bca81113bf6f (patch)
treea127d64080a7b9fbe1071631cb58de92a4dc0fbb /src/common
parentcac5335195d3bb9a39af77886992ffa98b8c7817 (diff)
downloadtor-898f9c8bcca04320d64963a87ea3bca81113bf6f.tar
tor-898f9c8bcca04320d64963a87ea3bca81113bf6f.tar.gz
Add a function to set a tor_addr_t to a null address
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.c8
-rw-r--r--src/common/address.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c
index 3f00c1e61..7a2ce6eef 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -181,6 +181,14 @@ tor_addr_make_unspec(tor_addr_t *a)
a->family = AF_UNSPEC;
}
+/** DOCDOC */
+void
+tor_addr_make_null(tor_addr_t *a, sa_family_t family)
+{
+ memset(a, 0, sizeof(*a));
+ a->family = family;
+}
+
/** Similar behavior to Unix gethostbyname: resolve <b>name</b>, and set
* *<b>addr</b> to the proper IP address and family. The <b>family</b>
* argument (which must be AF_INET, AF_INET6, or AF_UNSPEC) declares a
diff --git a/src/common/address.h b/src/common/address.h
index 6bf94610c..9c0df6c24 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -55,6 +55,7 @@ socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port,
int tor_addr_from_sockaddr(tor_addr_t *a, const struct sockaddr *sa,
uint16_t *port_out);
void tor_addr_make_unspec(tor_addr_t *a);
+void tor_addr_make_null(tor_addr_t *a, sa_family_t family);
char *tor_sockaddr_to_str(const struct sockaddr *sa);
/** Return an in6_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not