diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-12-02 15:36:46 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-12-02 15:36:46 +0000 |
commit | b49338ee972a66fb6e5ece4b97440d0c3cfa642b (patch) | |
tree | 0a3df788f90101bd04b667021eac514355f22b1f /pjlib/include/pj/sock.h | |
parent | ea951533e9d970b9fd9d98b34081f568679d9bfc (diff) |
More ticket #415: Added pj_sockaddr_get_len() and pj_inet_ntop2(), and fixed Symbian combilation warnings with gcce
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1608 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include/pj/sock.h')
-rw-r--r-- | pjlib/include/pj/sock.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h index 1d3b035c..4adfbd65 100644 --- a/pjlib/include/pj/sock.h +++ b/pjlib/include/pj/sock.h @@ -608,12 +608,32 @@ PJ_DECL(pj_status_t) pj_inet_pton(int af, const pj_str_t *src, void *dst); * enough to hold the text string (PJ_INET_ADDRSTRLEN characters * for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6). * - * @return PJ_SUCCESS if conversion was successful.. + * @return PJ_SUCCESS if conversion was successful. */ PJ_DECL(pj_status_t) pj_inet_ntop(int af, const void *src, char *dst, int size); /** + * Converts numeric address into its text string representation. + * + * @param af Specify the family of the address. This can be PJ_AF_INET + * or PJ_AF_INET6. + * @param src Points to a buffer holding an IPv4 address if the af argument + * is PJ_AF_INET, or an IPv6 address if the af argument is + * PJ_AF_INET6; the address must be in network byte order. + * @param dst Points to a buffer where the function stores the resulting + * text string; it shall not be NULL. + * @param size Specifies the size of this buffer, which shall be large + * enough to hold the text string (PJ_INET_ADDRSTRLEN characters + * for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6). + * + * @return The address string or NULL if failed. + */ +PJ_DECL(char*) pj_inet_ntop2(int af, const void *src, + char *dst, int size); + + +/** * Convert address string with numbers and dots to binary IP address. * * @param cp The IP address in numbers and dots notation. @@ -707,11 +727,22 @@ PJ_DECL(pj_bool_t) pj_sockaddr_has_addr(const pj_sockaddr_t *addr); * * @param addr Socket address. * - * @return Port number, in host byte order. + * @return Length in bytes. */ PJ_DECL(unsigned) pj_sockaddr_get_addr_len(const pj_sockaddr_t *addr); /** + * Get the socket address length, based on its address + * family. For PJ_AF_INET, the length will be sizeof(pj_sockaddr_in), and + * for PJ_AF_INET6, the length will be sizeof(pj_sockaddr_in6). + * + * @param addr Socket address. + * + * @return Length in bytes. + */ +PJ_DECL(unsigned) pj_sockaddr_get_len(const pj_sockaddr_t *addr); + +/** * Get the IP address of an IPv4 socket address. * The address is returned as 32bit value in host byte order. * |