summaryrefslogtreecommitdiff
path: root/include/asterisk/netsock2.h
diff options
context:
space:
mode:
authorMichael L. Young <elgueromexicano@gmail.com>2013-10-04 21:41:58 +0000
committerMichael L. Young <elgueromexicano@gmail.com>2013-10-04 21:41:58 +0000
commit2af53640c88464bb338753120945159e8e1a9cb9 (patch)
tree65951c78f0d8b20bb58808b5fa12444b4de38154 /include/asterisk/netsock2.h
parent21902bf9647823049358cdf386150d4b9b15e75e (diff)
Add IPv6 Support To chan_iax2
This patch adds IPv6 support to chan_iax2. Yay! (closes issue ASTERISK-22025) Patches: iax2-ipv6-v5-reviewboard.diff by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2660/ ........ Merged revisions 400567 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400568 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/netsock2.h')
-rw-r--r--include/asterisk/netsock2.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/asterisk/netsock2.h b/include/asterisk/netsock2.h
index a039d1bc6..90122f6c0 100644
--- a/include/asterisk/netsock2.h
+++ b/include/asterisk/netsock2.h
@@ -51,6 +51,18 @@ enum ast_transport {
};
/*!
+ * \brief
+ * Isolate a 32-bit section of an IPv6 address
+ *
+ * An IPv6 address can be divided into 4 32-bit chunks. This gives
+ * easy access to one of these chunks.
+ *
+ * \param sin6 A pointer to a struct sockaddr_in6
+ * \param index Which 32-bit chunk to operate on. Must be in the range 0-3.
+ */
+#define V6_WORD(sin6, index) ((uint32_t *)&((sin6)->sin6_addr))[(index)]
+
+/*!
* \brief Socket address structure.
*
* \details
@@ -400,6 +412,23 @@ int ast_sockaddr_resolve(struct ast_sockaddr **addrs, const char *str,
int flags, int family);
/*!
+ * \brief
+ * Apply a netmask to an address and store the result in a separate structure.
+ *
+ * When dealing with IPv6 addresses, one cannot apply a netmask with a simple
+ * logical AND operation. Futhermore, the incoming address may be an IPv4
+ * address and needs to be mapped properly before attempting to apply a rule.
+ *
+ * \param addr The IP address to apply the mask to.
+ * \param netmask The netmask configured in the host access rule.
+ * \param result The resultant address after applying the netmask to the given address
+ * \retval 0 Successfully applied netmask
+ * \retval -1 Failed to apply netmask
+ */
+int ast_sockaddr_apply_netmask(const struct ast_sockaddr *addr, const struct ast_sockaddr *netmask,
+ struct ast_sockaddr *result);
+
+/*!
* \since 1.8
*
* \brief