Ignore:
Timestamp:
Nov 20, 2005 7:58:10 PM (18 years ago)
Author:
bennylp
Message:

More compliant URI parser, comparison, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_uri.h

    r60 r64  
    2727#include <pjsip/sip_types.h> 
    2828#include <pjsip/sip_config.h> 
     29#include <pj/list.h> 
    2930 
    3031PJ_BEGIN_DECL 
     
    3738 * @{ 
    3839 */ 
     40 
     41/** 
     42 * Generic parameter, normally used in other_param or header_param. 
     43 */ 
     44typedef struct pjsip_param 
     45{ 
     46    PJ_DECL_LIST_MEMBER(struct pjsip_param);    /**< Generic list member.   */ 
     47    pj_str_t        name;                       /**< Param/header name.     */ 
     48    pj_str_t        value;                      /**< Param/header value.    */ 
     49} pjsip_param; 
     50 
     51 
     52/** 
     53 * Find the specified parameter name in the list. The name will be compared 
     54 * in case-insensitive comparison. 
     55 * 
     56 * @param param_list    List of parameters to find. 
     57 * @param name          Parameter/header name to find. 
     58 * 
     59 * @return              The parameter if found, or NULL. 
     60 */ 
     61PJ_DECL(pjsip_param*) pjsip_param_find( pjsip_param *param_list, 
     62                                        const pj_str_t *name ); 
     63 
     64 
     65/** 
     66 * Find the specified parameter name in the list. The name will be compared 
     67 * in case-insensitive comparison. 
     68 * 
     69 * @param param_list    List of parameters to find. 
     70 * @param name          Parameter/header name to find. 
     71 * 
     72 * @return              The parameter if found, or NULL. 
     73 */ 
     74PJ_DECL(const pjsip_param*) pjsip_param_cfind(const pjsip_param *param_list, 
     75                                              const pj_str_t *name ); 
     76 
     77 
     78/** 
     79 * Duplicate the parameters. 
     80 * 
     81 * @param pool          Pool to allocate memory from. 
     82 * @param dst_list      Destination list. 
     83 * @param src_list      Source list. 
     84 */ 
     85PJ_DECL(void) pjsip_param_clone(pj_pool_t *pool, pjsip_param *dst_list, 
     86                                const pjsip_param *src_list); 
    3987 
    4088/** 
     
    90138     * @param uri1 the first URI (self). 
    91139     * @param uri2 the second URI. 
    92      * @return zero if equal. 
    93      */ 
    94     int (*p_compare)(pjsip_uri_context_e context,  
    95                      const void *uri1, const void *uri2); 
     140     * @return PJ_SUCCESS if equal, or otherwise the error status which 
     141     *              should point to the mismatch part. 
     142     */ 
     143    pj_status_t (*p_compare)(pjsip_uri_context_e context,  
     144                             const void *uri1, const void *uri2); 
    96145 
    97146    /**  
     
    138187#define PJSIP_URI_SCHEME_IS_TEL(url)    \ 
    139188    (pj_strnicmp2(pjsip_uri_get_scheme(url), "tel", 3)==0) 
    140  
    141189 
    142190 
     
    157205    int             lr_param;           /**< Optional loose routing param, or zero */ 
    158206    pj_str_t        maddr_param;        /**< Optional maddr param */ 
    159     pj_str_t        other_param;        /**< Other parameters grouped together. */ 
    160     pj_str_t        header_param;       /**< Optional header parameter. */ 
     207    pjsip_param     other_param;        /**< Other parameters grouped together. */ 
     208    pjsip_param     header_param;       /**< Optional header parameter. */ 
    161209} pjsip_url; 
    162210 
     
    208256 * @param uri1      The first URI. 
    209257 * @param uri2      The second URI. 
    210  * @return          Zero if equal. 
    211  */ 
    212 PJ_INLINE(int) pjsip_uri_cmp(pjsip_uri_context_e context,  
    213                              const void *uri1, const void *uri2) 
     258 * @return          PJ_SUCCESS if equal, or otherwise the error status which 
     259 *                  should point to the mismatch part. 
     260 */ 
     261PJ_INLINE(pj_status_t) pjsip_uri_cmp(pjsip_uri_context_e context,  
     262                                     const void *uri1, const void *uri2) 
    214263{ 
    215264    return (*((const pjsip_uri*)uri1)->vptr->p_compare)(context, uri1, uri2); 
Note: See TracChangeset for help on using the changeset viewer.