summaryrefslogtreecommitdiff
path: root/pjlib/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-08-12 10:56:06 +0000
committerBenny Prijono <bennylp@teluu.com>2009-08-12 10:56:06 +0000
commitc4851558e0c60e8a8929473631b825e1945f239b (patch)
treecd207024bb6c437d6f89b282bd9a231ee379c7a4 /pjlib/include
parent83f6a10353edf15f1c4a0d0c1b67f37d21696d98 (diff)
Ticket #935: new pj_sockaddr_parse2() API
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2863 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include')
-rw-r--r--pjlib/include/pj/sock.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h
index b8ddb02d..ecc23691 100644
--- a/pjlib/include/pj/sock.h
+++ b/pjlib/include/pj/sock.h
@@ -979,18 +979,55 @@ PJ_DECL(void) pj_sockaddr_in_set_port(pj_sockaddr_in *addr,
*
* @param af Optionally specify the address family to be used. If the
* address family is to be deducted from the input, specify
- * pj_AF_UNSPEC() here.
+ * pj_AF_UNSPEC() here. Other supported values are
+ * #pj_AF_INET() and #pj_AF_INET6()
* @param options Additional options to assist the parsing, must be zero
* for now.
* @param str The input string to be parsed.
* @param addr Pointer to store the result.
*
* @return PJ_SUCCESS if the parsing is successful.
+ *
+ * @see pj_sockaddr_parse2()
*/
PJ_DECL(pj_status_t) pj_sockaddr_parse(int af, unsigned options,
const pj_str_t *str,
pj_sockaddr *addr);
+/**
+ * This function is similar to #pj_sockaddr_parse(), except that it will not
+ * convert the hostpart into IP address (thus possibly resolving the hostname
+ * into a #pj_sockaddr.
+ *
+ * Unlike #pj_sockaddr_parse(), this function has a limitation that if port
+ * number is specified in an IPv6 input string, the IP part of the IPv6 socket
+ * address MUST be enclosed in square brackets, otherwise the port number will
+ * be considered as part of the IPv6 IP address.
+ *
+ * @param af Optionally specify the address family to be used. If the
+ * address family is to be deducted from the input, specify
+ * #pj_AF_UNSPEC() here. Other supported values are
+ * #pj_AF_INET() and #pj_AF_INET6()
+ * @param options Additional options to assist the parsing, must be zero
+ * for now.
+ * @param str The input string to be parsed.
+ * @param hostpart Optional pointer to store the host part of the socket
+ * address, with any brackets removed.
+ * @param port Optional pointer to store the port number. If port number
+ * is not found, this will be set to zero upon return.
+ * @param raf Optional pointer to store the detected address family of
+ * the input address.
+ *
+ * @return PJ_SUCCESS if the parsing is successful.
+ *
+ * @see pj_sockaddr_parse()
+ */
+PJ_DECL(pj_status_t) pj_sockaddr_parse2(int af, unsigned options,
+ const pj_str_t *str,
+ pj_str_t *hostpart,
+ pj_uint16_t *port,
+ int *raf);
+
/*****************************************************************************
*
* HOST NAME AND ADDRESS.