Changeset 754
- Timestamp:
- Oct 8, 2006 1:56:07 PM (18 years ago)
- Location:
- pjproject/trunk/pjlib-util
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/build/pjlib_util.dsp
r753 r754 89 89 90 90 SOURCE="..\src\pjlib-util\dns.c" 91 92 !IF "$(CFG)" == "pjlib_util - Win32 Release"93 94 !ELSEIF "$(CFG)" == "pjlib_util - Win32 Debug"95 96 !ENDIF97 98 91 # End Source File 99 92 # Begin Source File 100 93 101 94 SOURCE="..\src\pjlib-util\dns_dump.c" 102 103 !IF "$(CFG)" == "pjlib_util - Win32 Release"104 105 !ELSEIF "$(CFG)" == "pjlib_util - Win32 Debug"106 107 !ENDIF108 109 95 # End Source File 110 96 # Begin Source File … … 123 109 124 110 SOURCE="..\src\pjlib-util\resolver.c" 125 126 !IF "$(CFG)" == "pjlib_util - Win32 Release"127 128 !ELSEIF "$(CFG)" == "pjlib_util - Win32 Debug"129 130 !ENDIF131 132 111 # End Source File 133 112 # Begin Source File … … 171 150 # Begin Source File 172 151 152 SOURCE="..\include\pjlib-util\config.h" 153 # End Source File 154 # Begin Source File 155 173 156 SOURCE="..\include\pjlib-util\dns.h" 174 157 # End Source File … … 212 195 213 196 SOURCE="..\include\pjlib-util\stun.h" 197 # End Source File 198 # Begin Source File 199 200 SOURCE="..\include\pjlib-util\types.h" 214 201 # End Source File 215 202 # Begin Source File -
pjproject/trunk/pjlib-util/docs/doxygen.cfg
r32 r754 18 18 # by quotes) that should identify the project. 19 19 20 PROJECT_NAME = PJLIB-UTIL20 PROJECT_NAME = "PJLIB-UTIL Reference" 21 21 22 22 # The PROJECT_NUMBER tag can be used to enter a project or revision number. … … 495 495 # doxygen will generate files with .html extension. 496 496 497 HTML_FILE_EXTENSION = .htm l497 HTML_FILE_EXTENSION = .htm 498 498 499 499 # The HTML_HEADER tag can be used to specify a personal HTML header for -
pjproject/trunk/pjlib-util/docs/footer.html
r32 r754 1 </TD></TR> 2 </TABLE> 1 <p> </p> 2 <hr><center> 3 PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library<br> 4 (C)2001-2006 Benny Prijono 5 </center> 6 7 8 <!--#include virtual="/footer.html" --> 9 3 10 </BODY> 4 11 </HTML> -
pjproject/trunk/pjlib-util/docs/header.html
r32 r754 1 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3 <title> PJLIB Documentation</title>4 <link href=" doxygen.css" rel="stylesheet" type="text/css">3 <title>$title</title> 4 <link href="/style/style.css" rel="stylesheet" type="text/css"> 5 5 </head><body> 6 <A HREF="/"><-- HOME</A><HR> 6 <!--#include virtual="/header.html" --> 7 <p><A HREF="/">Home</A> --> <A HREF="/docs.htm">Documentations</A> --> PJLIB Reference</p> 7 8 8 <TABLE border="0">9 <TR><TD width="600" align="left">10 9 -
pjproject/trunk/pjlib-util/include/pjlib-util.h
r753 r754 20 20 #define __PJLIB_UTIL_H__ 21 21 22 /** 23 * @file pjlib-util.h 24 * @brief pjlib-util.h 25 */ 26 22 27 #include <pjlib-util/dns.h> 23 28 #include <pjlib-util/errno.h> … … 29 34 #include <pjlib-util/xml.h> 30 35 36 37 /** 38 * @addtogroup PJLIB_UTIL 39 * @{ 40 */ 31 41 32 42 PJ_BEGIN_DECL … … 40 50 41 51 52 /** 53 * @} 54 */ 55 42 56 PJ_END_DECL 43 57 -
pjproject/trunk/pjlib-util/include/pjlib-util/dns.h
r753 r754 25 25 * @brief Low level DNS message parsing and packetization. 26 26 */ 27 #include <pj /types.h>27 #include <pjlib-util/types.h> 28 28 29 29 30 30 PJ_BEGIN_DECL 31 31 32 33 /** 34 * @defgroup PJ_DNS Low-level DNS message parsing and packetization 35 * @ingroup PJ 32 /** 33 * @defgroup PJ_DNS DNS and Asynchronous DNS Resolver 34 * @ingroup PJLIB_UTIL 35 */ 36 37 /** 38 * @defgroup PJ_DNS_PARSING Low-level DNS Message Parsing and Packetization 39 * @ingroup PJ_DNS 36 40 * @{ 37 41 * … … 200 204 201 205 /** 202 * This constant specifies the maximum names to keep in the temporary name203 * table when performing name compression scheme when duplicating DNS packet204 * (the #pj_dns_packet_dup() function).205 *206 * Generally name compression is desired, since it saves some memory (see207 * PJ_DNS_RESOLVER_RES_BUF_SIZE setting). However it comes at the expense of208 * a little processing overhead to perform name scanning and also a little209 * bit more stack usage (8 bytes per entry on 32bit platform).210 *211 * Default: 16212 */213 #ifndef PJ_DNS_MAX_NAMES_IN_NAMETABLE214 # define PJ_DNS_MAX_NAMES_IN_NAMETABLE 16215 #endif216 217 218 /**219 206 * This structure describes a DNS query record. 220 207 */ … … 345 332 * @param pool The pool to allocate memory for the duplicated packet. 346 333 * @param p The DNS packet to be cloned. 347 * @p _dst Pointer to store the cloned DNS packet.334 * @param p_dst Pointer to store the cloned DNS packet. 348 335 */ 349 336 PJ_DECL(void) pj_dns_packet_dup(pj_pool_t *pool, -
pjproject/trunk/pjlib-util/include/pjlib-util/errno.h
r753 r754 23 23 #include <pj/errno.h> 24 24 25 /** 26 * @defgroup PJLIB_UTIL_ERROR PJLIB-UTIL Error Codes 27 * @ingroup PJLIB_UTIL 28 * @{ 29 */ 25 30 26 31 /** … … 241 246 242 247 248 /** 249 * @} 250 */ 251 243 252 #endif /* __PJLIB_UTIL_ERRNO_H__ */ -
pjproject/trunk/pjlib-util/include/pjlib-util/getopt.h
r405 r754 22 22 #ifndef __PJ_GETOPT_H__ 23 23 #define __PJ_GETOPT_H__ 1 24 25 /** 26 * @file getopt.h 27 * @brief Compile time settings 28 */ 29 30 /** 31 * @defgroup PJLIB_UTIL_GETOPT Getopt 32 * @ingroup PJLIB_UTIL 33 * @{ 34 */ 24 35 25 36 #ifdef __cplusplus … … 128 139 #endif 129 140 141 /** 142 * @} 143 */ 144 130 145 #endif /* pj_getopt.h */ 131 146 -
pjproject/trunk/pjlib-util/include/pjlib-util/md5.h
r65 r754 20 20 #define __PJLIB_UTIL_MD5_H__ 21 21 22 /** 23 * @file md5.h 24 * @brief MD5 Functions 25 */ 26 22 27 #include <pj/types.h> 23 28 24 29 PJ_BEGIN_DECL 30 31 /** 32 * @defgroup PJLIB_UTIL_MD5 MD5 Functions 33 * @ingroup PJLIB_UTIL 34 * @{ 35 */ 36 25 37 26 38 /** MD5 context. */ … … 51 63 PJ_DECL(void) pj_md5_final(pj_md5_context *pms, pj_uint8_t digest[16]); 52 64 65 66 /** 67 * @} 68 */ 69 53 70 PJ_END_DECL 54 71 72 55 73 #endif /* __PJLIB_UTIL_MD5_H__ */ -
pjproject/trunk/pjlib-util/include/pjlib-util/resolver.h
r753 r754 31 31 32 32 /** 33 * @defgroup PJ_DNS_RESOLVER Asynchronous DNS Server Resolution34 * @ingroup PJ LIB_UTIL33 * @defgroup PJ_DNS_RESOLVER DNS Asynchronous/Caching Resolution Engine 34 * @ingroup PJ_DNS 35 35 * @{ 36 36 * … … 133 133 * 134 134 * Note that a single response entry will occupy about 600-700 bytes of 135 * pool memory. 135 * pool memory (the PJ_DNS_RESOLVER_RES_BUF_SIZE value plus internal 136 * structure). 136 137 * 137 138 * Application can work around this problem by doing one of these: … … 149 150 * The PJLIB-UTIL resolver was built from the information in the following 150 151 * standards: 151 * - RFC 1035: "Domain names - implementation and specification" 152 * - RFC 2782: "A DNS RR for specifying the location of services (DNS SRV)" 153 */ 154 155 156 /* 157 * CONFIGURATIONS 158 */ 159 160 /** 161 * Maximum numbers of DNS nameservers that can be configured in resolver. 162 */ 163 #ifndef PJ_DNS_RESOLVER_MAX_NS 164 # define PJ_DNS_RESOLVER_MAX_NS 16 165 #endif 166 167 168 /** 169 * Default retransmission delay, in miliseconds. The combination of 170 * retransmission delay and count determines the query timeout. 171 * 172 * Default: 2000 (2 seconds, according to RFC 1035) 173 */ 174 #ifndef PJ_DNS_RESOLVER_QUERY_RETRANSMIT_DELAY 175 # define PJ_DNS_RESOLVER_QUERY_RETRANSMIT_DELAY 2000 176 #endif 177 178 179 /** 180 * Maximum number of transmissions before timeout is declared for 181 * the query. 182 * 183 * Default: 2 184 */ 185 #ifndef PJ_DNS_RESOLVER_QUERY_RETRANSMIT_COUNT 186 # define PJ_DNS_RESOLVER_QUERY_RETRANSMIT_COUNT 5 187 #endif 188 189 190 /** 191 * Maximum life-time of DNS response in the resolver response cache, 192 * in seconds. If the value is zero, then DNS response caching will be 193 * disabled. 194 * 195 * Default is 300 seconds (5 minutes). 196 * 197 * @see PJ_DNS_RESOLVER_INVALID_TTL 198 */ 199 #ifndef PJ_DNS_RESOLVER_MAX_TTL 200 # define PJ_DNS_RESOLVER_MAX_TTL (5*60) 201 #endif 202 203 /** 204 * The life-time of invalid DNS response in the resolver response cache. 205 * An invalid DNS response is a response without an answer. These 206 * responses can be put in the cache too to minimize message round-trip. 207 * 208 * Default: 0 (which means, invalid DNS response will not be cached). 209 * 210 * @see PJ_DNS_RESOLVER_MAX_TTL 211 */ 212 #ifndef PJ_DNS_RESOLVER_INVALID_TTL 213 # define PJ_DNS_RESOLVER_INVALID_TTL 60 214 #endif 215 216 /** 217 * The interval on which nameservers which are known to be good to be 218 * probed again to determine whether they are still good. Note that 219 * this applies to both active nameserver (the one currently being used) 220 * and idle nameservers (good nameservers that are not currently selected). 221 * The probing to query the "goodness" of nameservers involves sending 222 * the same query to multiple servers, so it's probably not a good idea 223 * to send this probing too often. 224 * 225 * Default: 600 (ten minutes) 226 * 227 * @see PJ_DNS_RESOLVER_BAD_NS_TTL 228 */ 229 #ifndef PJ_DNS_RESOLVER_GOOD_NS_TTL 230 # define PJ_DNS_RESOLVER_GOOD_NS_TTL (10*60) 231 #endif 232 233 /** 234 * The interval on which nameservers which known to be bad to be probed 235 * again to determine whether it is still bad. 236 * 237 * Default: 600 (ten minutes) 238 * 239 * @see PJ_DNS_RESOLVER_GOOD_NS_TTL 240 */ 241 #ifndef PJ_DNS_RESOLVER_BAD_NS_TTL 242 # define PJ_DNS_RESOLVER_BAD_NS_TTL (1*60) 243 #endif 244 245 246 /** 247 * Maximum size of UDP packet. RFC 1035 states that maximum size of 248 * DNS packet carried over UDP is 512 bytes. 249 * 250 * Default: 512 byes 251 */ 252 #ifndef PJ_DNS_RESOLVER_MAX_UDP_SIZE 253 # define PJ_DNS_RESOLVER_MAX_UDP_SIZE 512 254 #endif 255 256 257 /** 258 * Size of memory pool allocated for each individual DNS response cache. 259 * This value here should be more or less the same as maximum UDP packet 260 * size (PJ_DNS_RESOLVER_MAX_UDP_SIZE), since the DNS replicator function 261 * (#pj_dns_packet_dup()) is also capable of performing name compressions. 262 * 263 * Default: 512 (as a broad guidance, 400 is good for 4 SRV entries). 264 */ 265 #ifndef PJ_DNS_RESOLVER_RES_BUF_SIZE 266 # define PJ_DNS_RESOLVER_RES_BUF_SIZE 512 267 #endif 152 * - <A HREF="http://www.faqs.org/rfcs/rfc1035.html"> 153 * RFC 1035: "Domain names - implementation and specification"</A> 154 * - <A HREF="http://www.faqs.org/rfcs/rfc2782.html"> 155 * RFC 2782: "A DNS RR for specifying the location of services (DNS SRV)" 156 * </A> 157 */ 268 158 269 159 -
pjproject/trunk/pjlib-util/include/pjlib-util/scanner.h
r622 r754 25 25 */ 26 26 27 #include <pj/types.h> 28 29 /** 30 * Macro PJ_SCANNER_USE_BITWISE is defined and non-zero (by default yes) 31 * will enable the use of bitwise for character input specification (cis). 32 * This would save several kilobytes of .bss memory in the SIP parser. 33 */ 34 #ifndef PJ_SCANNER_USE_BITWISE 35 # define PJ_SCANNER_USE_BITWISE 1 36 #endif 37 27 #include <pjlib-util/types.h> 38 28 39 29 PJ_BEGIN_DECL 40 30 41 31 /** 42 * @defgroup PJ_SCAN Text Scanning 43 * @ingroup PJ_MISC 44 * @brief 45 * Text scanning utility. 32 * @defgroup PJ_SCAN Fast Text Scanning 33 * @ingroup PJLIB_UTIL 34 * @brief Text scanning utility. 35 * 36 * This module describes a fast text scanning functions. 46 37 * 47 38 * @{ -
pjproject/trunk/pjlib-util/include/pjlib-util/string.h
r67 r754 27 27 #include <pj/types.h> 28 28 #include <pjlib-util/scanner.h> 29 30 /** 31 * @defgroup PJLIB_UTIL_STRING String Escaping Utilities 32 * @ingroup PJLIB_UTIL 33 * @{ 34 */ 29 35 30 36 PJ_BEGIN_DECL … … 88 94 PJ_END_DECL 89 95 96 97 /** 98 * @} 99 */ 100 90 101 #endif /* __PJLIB_UTIL_STRING_H__ */ -
pjproject/trunk/pjlib-util/include/pjlib-util/stun.h
r217 r754 20 20 #define __PJ_STUN_H__ 21 21 22 #include <pj/types.h> 22 /** 23 * @file stun.h 24 * @brief STUN client. 25 */ 26 27 #include <pjlib-util/types.h> 23 28 #include <pj/sock.h> 24 29 30 /** 31 * @defgroup PJLIB_UTIL_STUN_CLIENT Mini/Tiny STUN Client 32 * @ingroup PJLIB_UTIL 33 * @{ 34 */ 35 25 36 PJ_BEGIN_DECL 26 37 27 #define PJ_STUN_MAX_ATTR 16 28 38 /** 39 * This enumeration describes STUN message types. 40 */ 29 41 typedef enum pj_stun_msg_type 30 42 { … … 37 49 } pj_stun_msg_type; 38 50 51 52 /** 53 * This enumeration describes STUN attribute types. 54 */ 39 55 typedef enum pj_stun_attr_type 40 56 { … … 52 68 } pj_stun_attr_type; 53 69 70 71 /** 72 * This structre describes STUN message header. 73 */ 54 74 typedef struct pj_stun_msg_hdr 55 75 { … … 59 79 } pj_stun_msg_hdr; 60 80 81 82 /** 83 * This structre describes STUN attribute header. 84 */ 61 85 typedef struct pj_stun_attr_hdr 62 86 { … … 65 89 } pj_stun_attr_hdr; 66 90 91 92 /** 93 * This structre describes STUN MAPPED-ADDR attribute. 94 */ 67 95 typedef struct pj_stun_mapped_addr_attr 68 96 { … … 119 147 PJ_DECL(void*) pj_stun_msg_find_attr( pj_stun_msg *msg, pj_stun_attr_type t); 120 148 149 150 /** 151 * This is the main function to request the mapped address of local sockets 152 * to multiple STUN servers. This function is able to find the mapped 153 * addresses of multiple sockets simultaneously, and for each socket, two 154 * requests will be sent to two different STUN servers to see if both servers 155 * get the same public address for the same socket. (Note that application can 156 * specify the same address for the two servers, but still two requests will 157 * be sent for each server). 158 * 159 * This function will perform necessary retransmissions of the requests if 160 * response is not received within a predetermined period. When all responses 161 * have been received, the function will compare the mapped addresses returned 162 * by the servers, and when both are equal, the address will be returned in 163 * \a mapped_addr argument. 164 * 165 * @param pf The pool factory where memory will be allocated from. 166 * @param sock_cnt Number of sockets in the socket array. 167 * @param sock Array of local UDP sockets which public addresses are 168 * to be queried from the STUN servers. 169 * @param srv1 Host name or IP address string of the first STUN 170 * server. 171 * @param port1 The port number of the first STUN server. 172 * @param srv2 Host name or IP address string of the second STUN 173 * server. 174 * @param port2 The port number of the second STUN server. 175 * @param mapped_addr Array to receive the mapped public address of the local 176 * UDP sockets, when the function returns PJ_SUCCESS. 177 * 178 * @return This functions returns PJ_SUCCESS if responses are 179 * received from all servers AND all servers returned the 180 * same mapped public address. Otherwise this function may 181 * return one of the following error codes: 182 * - PJLIB_UTIL_ESTUNNOTRESPOND: no respons from servers. 183 * - PJLIB_UTIL_ESTUNSYMMETRIC: different mapped addresses 184 * are returned by servers. 185 * - etc. 186 * 187 */ 121 188 PJ_DECL(pj_status_t) pj_stun_get_mapped_addr( pj_pool_factory *pf, 122 189 int sock_cnt, pj_sock_t sock[], … … 127 194 PJ_END_DECL 128 195 196 /** 197 * @} 198 */ 199 129 200 #endif /* __PJ_STUN_H__ */ 130 201 -
pjproject/trunk/pjlib-util/include/pjlib-util/xml.h
r194 r754 31 31 32 32 /** 33 * @defgroup PJ_ XML XML Parser/Helper.34 * @ingroup PJ 33 * @defgroup PJ_TINY_XML Mini/Tiny XML Parser/Helper 34 * @ingroup PJLIB_UTIL 35 35 * @{ 36 36 */ -
pjproject/trunk/pjlib-util/src/pjlib-util/dns.c
r753 r754 456 456 sizeof(pj_dns_parsed_query)); 457 457 for (i=0; i<res->hdr.qdcount; ++i) { 458 int parsed_len ;458 int parsed_len = 0; 459 459 460 460 status = parse_query(&res->q[i], pool, packet, start, end, -
pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
r753 r754 949 949 /* Calculate expiration time. */ 950 950 if (set_expiry) { 951 if (pkt->hdr.anscount == 0 ) {951 if (pkt->hdr.anscount == 0 || status != PJ_SUCCESS) { 952 952 /* If we don't have answers for the name, then give a different 953 953 * ttl value (note: PJ_DNS_RESOLVER_INVALID_TTL may be zero,
Note: See TracChangeset
for help on using the changeset viewer.