From c4851558e0c60e8a8929473631b825e1945f239b Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 12 Aug 2009 10:56:06 +0000 Subject: Ticket #935: new pj_sockaddr_parse2() API git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2863 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/include/pj/sock.h | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'pjlib/include/pj') 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. -- cgit v1.2.3