Changeset 754 for pjproject/trunk


Ignore:
Timestamp:
Oct 8, 2006 1:56:07 PM (18 years ago)
Author:
bennylp
Message:

Added pjlib-util/config.h and pjlib-util/types.h to put
together common settings, and updated Doxygen documentation
for PJLIB-UTIL.

Location:
pjproject/trunk/pjlib-util
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/build/pjlib_util.dsp

    r753 r754  
    8989 
    9090SOURCE="..\src\pjlib-util\dns.c" 
    91  
    92 !IF  "$(CFG)" == "pjlib_util - Win32 Release" 
    93  
    94 !ELSEIF  "$(CFG)" == "pjlib_util - Win32 Debug" 
    95  
    96 !ENDIF  
    97  
    9891# End Source File 
    9992# Begin Source File 
    10093 
    10194SOURCE="..\src\pjlib-util\dns_dump.c" 
    102  
    103 !IF  "$(CFG)" == "pjlib_util - Win32 Release" 
    104  
    105 !ELSEIF  "$(CFG)" == "pjlib_util - Win32 Debug" 
    106  
    107 !ENDIF  
    108  
    10995# End Source File 
    11096# Begin Source File 
     
    123109 
    124110SOURCE="..\src\pjlib-util\resolver.c" 
    125  
    126 !IF  "$(CFG)" == "pjlib_util - Win32 Release" 
    127  
    128 !ELSEIF  "$(CFG)" == "pjlib_util - Win32 Debug" 
    129  
    130 !ENDIF  
    131  
    132111# End Source File 
    133112# Begin Source File 
     
    171150# Begin Source File 
    172151 
     152SOURCE="..\include\pjlib-util\config.h" 
     153# End Source File 
     154# Begin Source File 
     155 
    173156SOURCE="..\include\pjlib-util\dns.h" 
    174157# End Source File 
     
    212195 
    213196SOURCE="..\include\pjlib-util\stun.h" 
     197# End Source File 
     198# Begin Source File 
     199 
     200SOURCE="..\include\pjlib-util\types.h" 
    214201# End Source File 
    215202# Begin Source File 
  • pjproject/trunk/pjlib-util/docs/doxygen.cfg

    r32 r754  
    1818# by quotes) that should identify the project. 
    1919 
    20 PROJECT_NAME           =  PJLIB-UTIL 
     20PROJECT_NAME           =  "PJLIB-UTIL Reference" 
    2121 
    2222# The PROJECT_NUMBER tag can be used to enter a project or revision number.  
     
    495495# doxygen will generate files with .html extension. 
    496496 
    497 HTML_FILE_EXTENSION    = .html 
     497HTML_FILE_EXTENSION    = .htm 
    498498 
    499499# 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>&nbsp;</p> 
     2<hr><center> 
     3PJLIB-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 
    310</BODY> 
    411</HTML> 
  • pjproject/trunk/pjlib-util/docs/header.html

    r32 r754  
    11<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    22<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"> 
    55</head><body> 
    6 <A HREF="/">&lt;-- HOME</A><HR> 
     6        <!--#include virtual="/header.html" --> 
     7        <p><A HREF="/">Home</A> --&gt; <A HREF="/docs.htm">Documentations</A> --&gt; PJLIB Reference</p> 
    78 
    8 <TABLE border="0"> 
    9   <TR><TD width="600" align="left"> 
    109 
  • pjproject/trunk/pjlib-util/include/pjlib-util.h

    r753 r754  
    2020#define __PJLIB_UTIL_H__ 
    2121 
     22/** 
     23 * @file pjlib-util.h 
     24 * @brief pjlib-util.h 
     25 */ 
     26 
    2227#include <pjlib-util/dns.h> 
    2328#include <pjlib-util/errno.h> 
     
    2934#include <pjlib-util/xml.h> 
    3035 
     36 
     37/** 
     38 * @addtogroup PJLIB_UTIL 
     39 * @{ 
     40 */ 
    3141 
    3242PJ_BEGIN_DECL 
     
    4050 
    4151 
     52/** 
     53 * @} 
     54 */ 
     55 
    4256PJ_END_DECL 
    4357 
  • pjproject/trunk/pjlib-util/include/pjlib-util/dns.h

    r753 r754  
    2525 * @brief Low level DNS message parsing and packetization. 
    2626 */ 
    27 #include <pj/types.h> 
     27#include <pjlib-util/types.h> 
    2828 
    2929 
    3030PJ_BEGIN_DECL 
    3131 
    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 
    3640 * @{ 
    3741 * 
     
    200204 
    201205/** 
    202  * This constant specifies the maximum names to keep in the temporary name 
    203  * table when performing name compression scheme when duplicating DNS packet 
    204  * (the #pj_dns_packet_dup() function). 
    205  * 
    206  * Generally name compression is desired, since it saves some memory (see 
    207  * PJ_DNS_RESOLVER_RES_BUF_SIZE setting). However it comes at the expense of  
    208  * a little processing overhead to perform name scanning and also a little 
    209  * bit more stack usage (8 bytes per entry on 32bit platform). 
    210  * 
    211  * Default: 16 
    212  */ 
    213 #ifndef PJ_DNS_MAX_NAMES_IN_NAMETABLE 
    214 #   define PJ_DNS_MAX_NAMES_IN_NAMETABLE        16 
    215 #endif 
    216  
    217  
    218 /** 
    219206 * This structure describes a DNS query record. 
    220207 */ 
     
    345332 * @param pool          The pool to allocate memory for the duplicated packet. 
    346333 * @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. 
    348335 */ 
    349336PJ_DECL(void) pj_dns_packet_dup(pj_pool_t *pool, 
  • pjproject/trunk/pjlib-util/include/pjlib-util/errno.h

    r753 r754  
    2323#include <pj/errno.h> 
    2424 
     25/** 
     26 * @defgroup PJLIB_UTIL_ERROR PJLIB-UTIL Error Codes 
     27 * @ingroup PJLIB_UTIL 
     28 * @{ 
     29 */ 
    2530 
    2631/** 
     
    241246 
    242247 
     248/** 
     249 * @} 
     250 */ 
     251 
    243252#endif  /* __PJLIB_UTIL_ERRNO_H__ */ 
  • pjproject/trunk/pjlib-util/include/pjlib-util/getopt.h

    r405 r754  
    2222#ifndef __PJ_GETOPT_H__ 
    2323#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 */ 
    2435 
    2536#ifdef  __cplusplus 
     
    128139#endif 
    129140 
     141/** 
     142 * @} 
     143 */ 
     144 
    130145#endif /* pj_getopt.h */ 
    131146 
  • pjproject/trunk/pjlib-util/include/pjlib-util/md5.h

    r65 r754  
    2020#define __PJLIB_UTIL_MD5_H__ 
    2121 
     22/** 
     23 * @file md5.h 
     24 * @brief MD5 Functions 
     25 */ 
     26 
    2227#include <pj/types.h> 
    2328 
    2429PJ_BEGIN_DECL 
     30 
     31/** 
     32 * @defgroup PJLIB_UTIL_MD5 MD5 Functions 
     33 * @ingroup PJLIB_UTIL 
     34 * @{ 
     35 */ 
     36 
    2537 
    2638/** MD5 context. */ 
     
    5163PJ_DECL(void) pj_md5_final(pj_md5_context *pms, pj_uint8_t digest[16]); 
    5264 
     65 
     66/** 
     67 * @} 
     68 */ 
     69 
    5370PJ_END_DECL 
    5471 
     72 
    5573#endif  /* __PJLIB_UTIL_MD5_H__ */ 
  • pjproject/trunk/pjlib-util/include/pjlib-util/resolver.h

    r753 r754  
    3131 
    3232/** 
    33  * @defgroup PJ_DNS_RESOLVER Asynchronous DNS Server Resolution 
    34  * @ingroup PJLIB_UTIL 
     33 * @defgroup PJ_DNS_RESOLVER DNS Asynchronous/Caching Resolution Engine 
     34 * @ingroup PJ_DNS 
    3535 * @{ 
    3636 * 
     
    133133 * 
    134134 * 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).  
    136137 * 
    137138 * Application can work around this problem by doing one of these: 
     
    149150 * The PJLIB-UTIL resolver was built from the information in the following 
    150151 * 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 */ 
    268158 
    269159 
  • pjproject/trunk/pjlib-util/include/pjlib-util/scanner.h

    r622 r754  
    2525 */ 
    2626 
    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> 
    3828 
    3929PJ_BEGIN_DECL 
    4030 
    4131/** 
    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. 
    4637 * 
    4738 * @{ 
  • pjproject/trunk/pjlib-util/include/pjlib-util/string.h

    r67 r754  
    2727#include <pj/types.h> 
    2828#include <pjlib-util/scanner.h> 
     29 
     30/** 
     31 * @defgroup PJLIB_UTIL_STRING String Escaping Utilities 
     32 * @ingroup PJLIB_UTIL 
     33 * @{ 
     34 */ 
    2935 
    3036PJ_BEGIN_DECL 
     
    8894PJ_END_DECL 
    8995 
     96 
     97/** 
     98 * @} 
     99 */ 
     100 
    90101#endif  /* __PJLIB_UTIL_STRING_H__ */ 
  • pjproject/trunk/pjlib-util/include/pjlib-util/stun.h

    r217 r754  
    2020#define __PJ_STUN_H__ 
    2121 
    22 #include <pj/types.h> 
     22/** 
     23 * @file stun.h 
     24 * @brief STUN client. 
     25 */ 
     26 
     27#include <pjlib-util/types.h> 
    2328#include <pj/sock.h> 
    2429 
     30/** 
     31 * @defgroup PJLIB_UTIL_STUN_CLIENT Mini/Tiny STUN Client 
     32 * @ingroup PJLIB_UTIL 
     33 * @{ 
     34 */ 
     35 
    2536PJ_BEGIN_DECL 
    2637 
    27 #define PJ_STUN_MAX_ATTR    16 
    28  
     38/** 
     39 * This enumeration describes STUN message types. 
     40 */ 
    2941typedef enum pj_stun_msg_type 
    3042{ 
     
    3749} pj_stun_msg_type; 
    3850 
     51 
     52/** 
     53 * This enumeration describes STUN attribute types. 
     54 */ 
    3955typedef enum pj_stun_attr_type 
    4056{ 
     
    5268} pj_stun_attr_type; 
    5369 
     70 
     71/** 
     72 * This structre describes STUN message header. 
     73 */ 
    5474typedef struct pj_stun_msg_hdr 
    5575{ 
     
    5979} pj_stun_msg_hdr; 
    6080 
     81 
     82/** 
     83 * This structre describes STUN attribute header. 
     84 */ 
    6185typedef struct pj_stun_attr_hdr 
    6286{ 
     
    6589} pj_stun_attr_hdr; 
    6690 
     91 
     92/** 
     93 * This structre describes STUN MAPPED-ADDR attribute. 
     94 */ 
    6795typedef struct pj_stun_mapped_addr_attr 
    6896{ 
     
    119147PJ_DECL(void*) pj_stun_msg_find_attr( pj_stun_msg *msg, pj_stun_attr_type t); 
    120148 
     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 */ 
    121188PJ_DECL(pj_status_t) pj_stun_get_mapped_addr( pj_pool_factory *pf, 
    122189                                              int sock_cnt, pj_sock_t sock[], 
     
    127194PJ_END_DECL 
    128195 
     196/** 
     197 * @} 
     198 */ 
     199 
    129200#endif  /* __PJ_STUN_H__ */ 
    130201 
  • pjproject/trunk/pjlib-util/include/pjlib-util/xml.h

    r194 r754  
    3131 
    3232/** 
    33  * @defgroup PJ_XML XML Parser/Helper. 
    34  * @ingroup PJ 
     33 * @defgroup PJ_TINY_XML Mini/Tiny XML Parser/Helper 
     34 * @ingroup PJLIB_UTIL 
    3535 * @{ 
    3636 */ 
  • pjproject/trunk/pjlib-util/src/pjlib-util/dns.c

    r753 r754  
    456456                                      sizeof(pj_dns_parsed_query)); 
    457457        for (i=0; i<res->hdr.qdcount; ++i) { 
    458             int parsed_len; 
     458            int parsed_len = 0; 
    459459             
    460460            status = parse_query(&res->q[i], pool, packet, start, end, 
  • pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c

    r753 r754  
    949949    /* Calculate expiration time. */ 
    950950    if (set_expiry) { 
    951         if (pkt->hdr.anscount == 0) { 
     951        if (pkt->hdr.anscount == 0 || status != PJ_SUCCESS) { 
    952952            /* If we don't have answers for the name, then give a different 
    953953             * ttl value (note: PJ_DNS_RESOLVER_INVALID_TTL may be zero,  
Note: See TracChangeset for help on using the changeset viewer.