summaryrefslogtreecommitdiff
path: root/lib/tsocket/tsocket.h
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-04-27 10:34:15 +0200
committerStefan Metzmacher <metze@samba.org>2010-04-27 13:00:24 +0200
commite1596bbf27ee636d8ab47e39eda21c64ef49b671 (patch)
tree1ffe8c48bfb3b537680b3e27aba48bc6d5aaf719 /lib/tsocket/tsocket.h
parent3dd50b29228994c8dd5162cb300d234316126586 (diff)
downloadsamba-e1596bbf27ee636d8ab47e39eda21c64ef49b671.tar.gz
lib/tsocket: add tsocket_address_is_inet() function
metze
Diffstat (limited to 'lib/tsocket/tsocket.h')
-rw-r--r--lib/tsocket/tsocket.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tsocket/tsocket.h b/lib/tsocket/tsocket.h
index d983325c454..a008fd8232f 100644
--- a/lib/tsocket/tsocket.h
+++ b/lib/tsocket/tsocket.h
@@ -101,6 +101,7 @@ struct iovec;
*
* @return The address as a string representation, NULL on error.
*
+ * @see tsocket_address_is_inet()
* @see tsocket_address_inet_addr_string()
* @see tsocket_address_inet_port()
*/
@@ -486,6 +487,20 @@ int tstream_disconnect_recv(struct tevent_req *req,
* @{
*/
+/**
+ * @brief Find out if the tsocket_address represents an ipv4 or ipv6 endpoint.
+ *
+ * @param[in] addr The tsocket_address pointer
+ *
+ * @param[in] fam The family can be can be "ipv4", "ipv6" or "ip". With
+ * "ip" is autodetects "ipv4" or "ipv6" based on the
+ * addr.
+ *
+ * @return true if addr represents an address of the given family,
+ * otherwise false.
+ */
+bool tsocket_address_is_inet(const struct tsocket_address *addr, const char *fam);
+
#if DOXYGEN
/**
* @brief Create a tsocket_address for ipv4 and ipv6 endpoint addresses.
@@ -533,6 +548,8 @@ int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
*
* @return A newly allocated string of the address, NULL on error
* with errno set.
+ *
+ * @see tsocket_address_is_inet()
*/
char *tsocket_address_inet_addr_string(const struct tsocket_address *addr,
TALLOC_CTX *mem_ctx);