- Timestamp:
- Nov 20, 2005 7:58:10 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 1 added
- 24 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/build/pjsip.dsw
r60 r64 58 58 ############################################################################### 59 59 60 Project: "test_pjsip"=.\test_pjsip.dsp - Package Owner=<4>61 62 Package=<5>63 {{{64 }}}65 66 Package=<4>67 {{{68 }}}69 70 ###############################################################################71 72 60 Project: "pjsip_ua"=.\pjsip_ua.dsp - Package Owner=<4> 73 61 … … 109 97 ############################################################################### 110 98 99 Project: "test_pjsip"=.\test_pjsip.dsp - Package Owner=<4> 100 101 Package=<5> 102 {{{ 103 }}} 104 105 Package=<4> 106 {{{ 107 Begin Project Dependency 108 Project_Dep_Name pjlib 109 End Project Dependency 110 Begin Project Dependency 111 Project_Dep_Name pjsip_core 112 End Project Dependency 113 }}} 114 115 ############################################################################### 116 111 117 Global: 112 118 -
pjproject/trunk/pjsip/build/pjsip_core.dsp
r58 r64 104 104 # Begin Source File 105 105 106 SOURCE=..\src\pjsip\sip_ misc.c106 SOURCE=..\src\pjsip\sip_errno.c 107 107 # End Source File 108 108 # Begin Source File … … 133 133 134 134 SOURCE=..\src\pjsip\sip_uri.c 135 # End Source File 136 # Begin Source File 137 138 SOURCE=..\src\pjsip\sip_util.c 135 139 # End Source File 136 140 # End Group … … 176 180 # Begin Source File 177 181 178 SOURCE=..\include\pjsip\sip_misc.h179 # End Source File180 # Begin Source File181 182 182 SOURCE=..\include\pjsip\sip_module.h 183 183 # End Source File … … 217 217 218 218 SOURCE=..\include\pjsip\sip_uri.h 219 # End Source File 220 # Begin Source File 221 222 SOURCE=..\include\pjsip\sip_util.h 219 223 # End Source File 220 224 # End Group -
pjproject/trunk/pjsip/build/test_pjsip.dsp
r60 r64 52 52 LINK32=link.exe 53 53 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 54 # ADD LINK32 wsock32.lib kernel32.lib netapi32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /profile /map /debug /machine:I386 /out:"..\bin\test-pjsip-i386-win32-vc6-release.exe"54 # ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib netapi32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /profile /map /debug /machine:I386 /out:"..\bin\test-pjsip-i386-win32-vc6-release.exe" 55 55 56 56 !ELSEIF "$(CFG)" == "test_pjsip - Win32 Debug" … … 77 77 LINK32=link.exe 78 78 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept 79 # ADD LINK32 wsock32.lib kernel32.lib netapi32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\test-pjsip-i386-win32-vc6-debug.exe" /pdbtype:sept79 # ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib netapi32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\test-pjsip-i386-win32-vc6-debug.exe" /pdbtype:sept 80 80 81 81 !ENDIF … … 94 94 # Begin Source File 95 95 96 SOURCE="..\src\test-pjsip\ test_msg.c"96 SOURCE="..\src\test-pjsip\msg.c" 97 97 # End Source File 98 98 # Begin Source File 99 99 100 SOURCE="..\src\test-pjsip\test_uri.c" 100 SOURCE="..\src\test-pjsip\test.c" 101 # End Source File 102 # Begin Source File 103 104 SOURCE="..\src\test-pjsip\uri.c" 101 105 # End Source File 102 106 # End Group -
pjproject/trunk/pjsip/include/pjsip/print_util.h
r60 r64 20 20 #define __PJSIP_PRINT_H__ 21 21 22 /* Minimum space left in the buffer */ 23 #define MIN_SPACE 10 24 22 25 #define copy_advance_check(buf,str) \ 23 26 do { \ 24 if ((str).slen+ 10>= (endbuf-buf)) return -1; \27 if ((str).slen+MIN_SPACE >= (endbuf-buf)) return -1; \ 25 28 pj_memcpy(buf, (str).ptr, (str).slen); \ 26 29 buf += (str).slen; \ … … 32 35 if (str2->slen) { 33 36 int printed = len1+str2->slen; 34 if (printed+ 10>= (endbuf-buf)) return NULL;37 if (printed+MIN_SPACE >= (endbuf-buf)) return NULL; 35 38 pj_memcpy(buf,str1,len1); 36 39 pj_memcpy(buf+len1, str2->ptr, str2->slen); … … 45 48 if (str2.slen) { \ 46 49 printed = len1+str2.slen; \ 47 if (printed+ 10>= (endbuf-buf)) return -1; \50 if (printed+MIN_SPACE >= (endbuf-buf)) return -1; \ 48 51 pj_memcpy(buf,str1,len1); \ 49 52 pj_memcpy(buf+len1, str2.ptr, str2.slen); \ … … 63 66 if (str2.slen) { \ 64 67 printed = len1+str2.slen+2; \ 65 if (printed+ 10>= (endbuf-buf)) return -1; \68 if (printed+MIN_SPACE >= (endbuf-buf)) return -1; \ 66 69 pj_memcpy(buf,str1,len1); \ 67 70 *(buf+len1)=quotebegin; \ … … 72 75 } while (0) 73 76 77 #define copy_advance_pair_escape(buf,str1,len1,str2,unres) \ 78 do { \ 79 if (str2.slen) { \ 80 pj_ssize_t esc_len; \ 81 if (len1+str2.slen+MIN_SPACE >= (endbuf-buf)) return -1; \ 82 pj_memcpy(buf,str1,len1); \ 83 buf += len1; \ 84 esc_len=pj_strncpy2_escape(buf, &str2, (endbuf-buf), &unres); \ 85 if (esc_len < 0) return -1; \ 86 buf += esc_len; \ 87 if (endbuf-buf < MIN_SPACE) return -1; \ 88 } \ 89 } while (0) 90 91 74 92 #define copy_advance_no_check(buf,str) \ 75 pj_memcpy(buf, (str).ptr, (str).slen); \ 76 buf += (str).slen; 93 do { \ 94 pj_memcpy(buf, (str).ptr, (str).slen); \ 95 buf += (str).slen; \ 96 } while (0) 97 98 #define copy_advance_escape(buf,str,unres) \ 99 do { \ 100 pj_ssize_t len = \ 101 pj_strncpy2_escape(buf, &(str), (endbuf-buf), &(unres)); \ 102 if (len < 0) return -1; \ 103 buf += len; \ 104 if (endbuf-buf < MIN_SPACE) return -1; \ 105 } while (0) 77 106 78 107 #define copy_advance_pair_no_check(buf,str1,len1,str2) \ -
pjproject/trunk/pjsip/include/pjsip/sip_errno.h
r60 r64 22 22 #include <pj/errno.h> 23 23 24 PJ_BEGIN_DECL 25 26 /* 27 * PJSIP error codes occupies 170000 - 219000, and mapped as follows: 28 * - 170100 - 170799: mapped to SIP status code in response msg. 29 * - 171000 - 171999: mapped to errors generated from PJSIP core. 30 */ 31 32 /** 33 * Get error message for the specified error code. 34 * 35 * @param status The error code. 36 * @param buffer The buffer where to put the error message. 37 * @param bufsize Size of the buffer. 38 * 39 * @return The error message as NULL terminated string, 40 * wrapped with pj_str_t. 41 */ 42 PJ_DECL(pj_str_t) pjsip_strerror( pj_status_t status, char *buffer, 43 pj_size_t bufsize); 44 24 45 /** 25 46 * Start of error code relative to PJ_ERRNO_START_USER. 26 47 */ 27 #define PJSIP_ERRNO_START (PJ_ERRNO_START_USER +10000)48 #define PJSIP_ERRNO_START (PJ_ERRNO_START_USER) 28 49 29 50 /** … … 44 65 #define PJSIP_ERRNO_TO_SIP_STATUS(status) \ 45 66 ((status>=PJSIP_ERRNO_FROM_SIP_STATUS(100) && \ 46 status<PJSIP_ERRNO_FROM_SIP_STATUS( 999)) ? \67 status<PJSIP_ERRNO_FROM_SIP_STATUS(800)) ? \ 47 68 status-PJSIP_ERRNO_FROM_SIP_STATUS(0) : 599) 48 69 … … 51 72 * Start of PJSIP generated error code values. 52 73 */ 53 #define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 10000) 54 74 #define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000) 75 76 /************************************************************ 77 * GENERIC SIP ERRORS 78 ***********************************************************/ 79 /** 80 * @hideinitializer 81 * SIP object is busy. 82 */ 83 #define PJSIP_EBUSY (PJSIP_ERRNO_START_PJSIP + 1) /* 171001 */ 84 /** 85 * @hideinitializer 86 * SIP object with the same type already exists. 87 */ 88 #define PJSIP_ETYPEEXISTS (PJSIP_ERRNO_START_PJSIP + 2) /* 171002 */ 89 90 91 /************************************************************ 92 * MESSAGING ERRORS 93 ***********************************************************/ 55 94 /** 56 95 * @hideinitializer 57 96 * Invalid message (syntax error) 58 97 */ 59 #define PJSIP_EINVALIDMSG (PJSIP_ERRNO_START_PJSIP + 0) 98 #define PJSIP_EINVALIDMSG (PJSIP_ERRNO_START_PJSIP + 20) /* 171020 */ 99 /** 100 * @hideinitializer 101 * Unsupported URL scheme. 102 */ 103 #define PJSIP_EINVALIDSCHEME (PJSIP_ERRNO_START_PJSIP + 21) /* 171021 */ 104 /** 105 * @hideinitializer 106 * Message too long. See also PJSIP_ERXOVERFLOW. 107 */ 108 #define PJSIP_EMSGTOOLONG (PJSIP_ERRNO_START_PJSIP + 22) /* 171022 */ 109 /** 110 * @hideinitializer 111 * Message not completely received. 112 */ 113 #define PJSIP_EPARTIALMSG (PJSIP_ERRNO_START_PJSIP + 23) /* 171023 */ 60 114 /** 61 115 * @hideinitializer 62 116 * Missing required header(s). 63 117 */ 64 #define PJSIP_EMISSINGHDR (PJSIP_ERRNO_START_PJSIP + 1) 65 /** 66 * @hideinitializer 67 * Unsupported URL scheme. 68 */ 69 #define PJSIP_EINVALIDSCHEME (PJSIP_ERRNO_START_PJSIP + 2) 118 #define PJSIP_EMISSINGHDR (PJSIP_ERRNO_START_PJSIP + 24) /* 171024 */ 119 /** 120 * @hideinitializer 121 * Invalid Via header in response (sent-by, etc). 122 */ 123 #define PJSIP_EINVALIDVIA (PJSIP_ERRNO_START_PJSIP + 25) /* 171025 */ 124 /** 125 * @hideinitializer 126 * Multiple Via headers in response. 127 */ 128 #define PJSIP_EMULTIPLEVIA (PJSIP_ERRNO_START_PJSIP + 26) /* 171026 */ 129 130 /************************************************************ 131 * TRANSPORT ERRORS 132 ***********************************************************/ 133 /** 134 * @hideinitializer 135 * Unsupported transport type. 136 */ 137 #define PJSIP_EUNSUPTRANSPORT (PJSIP_ERRNO_START_PJSIP + 40) /* 171040 */ 138 /** 139 * @hideinitializer 140 * Buffer is being sent, operation still pending. 141 */ 142 #define PJSIP_EPENDINGTX (PJSIP_ERRNO_START_PJSIP + 41) /* 171041 */ 143 /** 144 * @hideinitializer 145 * Rx buffer overflow. See also PJSIP_EMSGTOOLONG. 146 */ 147 #define PJSIP_ERXOVERFLOW (PJSIP_ERRNO_START_PJSIP + 42)/* 171042 */ 148 149 150 /************************************************************ 151 * TRANSACTION ERRORS 152 ***********************************************************/ 70 153 /** 71 154 * @hideinitializer 72 155 * Transaction has just been destroyed. 73 156 */ 74 #define PJSIP_ETSXDESTROYED (PJSIP_ERRNO_START_PJSIP + 3) 75 /** 76 * @hideinitializer 77 * Buffer overflow. See also PJSIP_EMSGTOOLONG. 78 */ 79 #define PJSIP_EOVERFLOW (PJSIP_ERRNO_START_PJSIP + 4) 80 /** 81 * @hideinitializer 82 * Message not completely received. 83 */ 84 #define PJSIP_EPARTIALMSG (PJSIP_ERRNO_START_PJSIP + 5) 85 /** 86 * @hideinitializer 87 * Message too long. See also PJSIP_EOVERFLOW. 88 */ 89 #define PJSIP_EMSGTOOLONG (PJSIP_ERRNO_START_PJSIP + 6) 90 /** 91 * @hideinitializer 92 * Buffer is being sent, operation still pending. 93 */ 94 #define PJSIP_EPENDINGTX (PJSIP_ERRNO_START_PJSIP + 7) 95 /** 96 * @hideinitializer 97 * Unsupported transport type. 98 */ 99 #define PJSIP_EUNSUPTRANSPORT (PJSIP_ERRNO_START_PJSIP + 8) 100 /** 101 * @hideinitializer 102 * Invalid Via header in response (sent-by, etc). 103 */ 104 #define PJSIP_EINVALIDVIA (PJSIP_ERRNO_START_PJSIP + 9) 105 /** 106 * @hideinitializer 107 * Multiple Via headers in response. 108 */ 109 #define PJSIP_EMULTIPLEVIA (PJSIP_ERRNO_START_PJSIP + 9) 110 /** 111 * @hideinitializer 112 * SIP object is busy. 113 */ 114 #define PJSIP_EBUSY (PJSIP_ERRNO_START_PJSIP + 10) 115 /** 116 * @hideinitializer 117 * SIP object with the same type already exists. 118 */ 119 #define PJSIP_ETYPEEXISTS (PJSIP_ERRNO_START_PJSIP + 11) 120 121 157 #define PJSIP_ETSXDESTROYED (PJSIP_ERRNO_START_PJSIP + 60) /* 171060 */ 158 159 160 /************************************************************ 161 * URI COMPARISON RESULTS 162 ***********************************************************/ 163 /** 164 * @hideinitializer 165 * Scheme mismatch. 166 */ 167 #define PJSIP_ECMPSCHEME (PJSIP_ERRNO_START_PJSIP + 80) /* 171080 */ 168 /** 169 * @hideinitializer 170 * User part mismatch. 171 */ 172 #define PJSIP_ECMPUSER (PJSIP_ERRNO_START_PJSIP + 81) /* 171081 */ 173 /** 174 * @hideinitializer 175 * Password part mismatch. 176 */ 177 #define PJSIP_ECMPPASSWD (PJSIP_ERRNO_START_PJSIP + 82) /* 171082 */ 178 /** 179 * @hideinitializer 180 * Host part mismatch. 181 */ 182 #define PJSIP_ECMPHOST (PJSIP_ERRNO_START_PJSIP + 83) /* 171083 */ 183 /** 184 * @hideinitializer 185 * Port part mismatch. 186 */ 187 #define PJSIP_ECMPPORT (PJSIP_ERRNO_START_PJSIP + 84) /* 171084 */ 188 /** 189 * @hideinitializer 190 * Transport parameter part mismatch. 191 */ 192 #define PJSIP_ECMPTRANSPORTPRM (PJSIP_ERRNO_START_PJSIP + 85) /* 171085 */ 193 /** 194 * @hideinitializer 195 * TTL parameter part mismatch. 196 */ 197 #define PJSIP_ECMPTTLPARAM (PJSIP_ERRNO_START_PJSIP + 86) /* 171086 */ 198 /** 199 * @hideinitializer 200 * User parameter part mismatch. 201 */ 202 #define PJSIP_ECMPUSERPARAM (PJSIP_ERRNO_START_PJSIP + 87) /* 171087 */ 203 /** 204 * @hideinitializer 205 * Method parameter part mismatch. 206 */ 207 #define PJSIP_ECMPMETHODPARAM (PJSIP_ERRNO_START_PJSIP + 88) /* 171088 */ 208 /** 209 * @hideinitializer 210 * Maddr parameter part mismatch. 211 */ 212 #define PJSIP_ECMPMADDRPARAM (PJSIP_ERRNO_START_PJSIP + 89) /* 171089 */ 213 /** 214 * @hideinitializer 215 * Parameter part in other_param mismatch. 216 */ 217 #define PJSIP_ECMPOTHERPARAM (PJSIP_ERRNO_START_PJSIP + 90) /* 171090 */ 218 /** 219 * @hideinitializer 220 * Parameter part in header_param mismatch. 221 */ 222 #define PJSIP_ECMPHEADERPARAM (PJSIP_ERRNO_START_PJSIP + 91) /* 171091 */ 223 224 225 226 PJ_END_DECL 122 227 123 228 #endif /* __PJSIP_SIP_ERRNO_H__ */ -
pjproject/trunk/pjsip/include/pjsip/sip_event.h
r60 r64 298 298 * Get the event string from the event ID. 299 299 * @param e the event ID. 300 * @notes defined in sip_ misc.c300 * @notes defined in sip_util.c 301 301 */ 302 302 PJ_DEF(const char *) pjsip_event_str(pjsip_event_id_e e); -
pjproject/trunk/pjsip/include/pjsip/sip_parser.h
r60 r64 295 295 * parsers. 296 296 */ 297 extern 298 pj_cis_t pjsip_HOST_SPEC, /* For scanning host part. */ 299 pjsip_DIGIT_SPEC, /* Decimal digits */ 300 pjsip_ALPHA_SPEC, /* Alpha (A-Z, a-z) */ 301 pjsip_ALNUM_SPEC, /* Decimal + Alpha. */ 302 pjsip_TOKEN_SPEC, /* Token. */ 303 pjsip_HEX_SPEC, /* Hexadecimal digits. */ 304 pjsip_PARAM_CHAR_SPEC, /* For scanning pname (or pvalue when it's not quoted.) */ 305 pjsip_PROBE_USER_HOST_SPEC, /* Hostname characters. */ 306 pjsip_PASSWD_SPEC, /* Password. */ 307 pjsip_USER_SPEC, /* User */ 308 pjsip_NEWLINE_OR_EOF_SPEC, /* For eating up header.*/ 309 pjsip_DISPLAY_SCAN_SPEC; /* Used when searching for display name in URL. */ 297 extern pj_cis_t 298 pjsip_HOST_SPEC, /**< For scanning host part. */ 299 pjsip_DIGIT_SPEC, /**< Decimal digits */ 300 pjsip_ALPHA_SPEC, /**< Alpha (A-Z, a-z) */ 301 pjsip_ALNUM_SPEC, /**< Decimal + Alpha. */ 302 pjsip_TOKEN_SPEC, /**< Token. */ 303 pjsip_HEX_SPEC, /**< Hexadecimal digits. */ 304 pjsip_PARAM_CHAR_SPEC, /**< For scanning pname (or pvalue when it's 305 not quoted.) */ 306 pjsip_HDR_CHAR_SPEC, /**< Chars in hname/havalue in URL. */ 307 pjsip_PROBE_USER_HOST_SPEC, /**< Hostname characters. */ 308 pjsip_PASSWD_SPEC, /**< Password. */ 309 pjsip_USER_SPEC, /**< User */ 310 pjsip_NEWLINE_OR_EOF_SPEC, /**< For eating up header.*/ 311 pjsip_DISPLAY_SCAN_SPEC; /**< Used when searching for display name. */ 310 312 311 313 /* -
pjproject/trunk/pjsip/include/pjsip/sip_transaction.h
r60 r64 130 130 131 131 132 /** 133 * Create new transaction. Application would normally use 134 * #pjsip_endpt_create_tsx rather than this function. 135 * 136 * @param pool Pool to use by the transaction. 137 * @param endpt Endpoint. 138 * @param p_tsx Pointer to return the transaction. 139 * 140 * @return PJ_SUCCESS or the appropriate error code. 141 * 142 * @see pjsip_endpt_create_tsx 143 * 144 */ 145 PJ_DEF(pj_status_t) pjsip_tsx_create( pj_pool_t *pool, 146 pjsip_endpoint *endpt, 147 pjsip_transaction **p_tsx); 148 132 149 /** 133 150 * Init transaction as UAC from the specified transmit data (\c tdata). -
pjproject/trunk/pjsip/include/pjsip/sip_uri.h
r60 r64 27 27 #include <pjsip/sip_types.h> 28 28 #include <pjsip/sip_config.h> 29 #include <pj/list.h> 29 30 30 31 PJ_BEGIN_DECL … … 37 38 * @{ 38 39 */ 40 41 /** 42 * Generic parameter, normally used in other_param or header_param. 43 */ 44 typedef 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 */ 61 PJ_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 */ 74 PJ_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 */ 85 PJ_DECL(void) pjsip_param_clone(pj_pool_t *pool, pjsip_param *dst_list, 86 const pjsip_param *src_list); 39 87 40 88 /** … … 90 138 * @param uri1 the first URI (self). 91 139 * @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); 96 145 97 146 /** … … 138 187 #define PJSIP_URI_SCHEME_IS_TEL(url) \ 139 188 (pj_strnicmp2(pjsip_uri_get_scheme(url), "tel", 3)==0) 140 141 189 142 190 … … 157 205 int lr_param; /**< Optional loose routing param, or zero */ 158 206 pj_str_t maddr_param; /**< Optional maddr param */ 159 pj _str_tother_param; /**< Other parameters grouped together. */160 pj _str_theader_param; /**< Optional header parameter. */207 pjsip_param other_param; /**< Other parameters grouped together. */ 208 pjsip_param header_param; /**< Optional header parameter. */ 161 209 } pjsip_url; 162 210 … … 208 256 * @param uri1 The first URI. 209 257 * @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 */ 261 PJ_INLINE(pj_status_t) pjsip_uri_cmp(pjsip_uri_context_e context, 262 const void *uri1, const void *uri2) 214 263 { 215 264 return (*((const pjsip_uri*)uri1)->vptr->p_compare)(context, uri1, uri2); -
pjproject/trunk/pjsip/include/pjsip_core.h
r51 r64 21 21 22 22 #include <pjsip/sip_types.h> 23 #include <pjsip/sip_auth.h> 23 24 #include <pjsip/sip_endpoint.h> 25 #include <pjsip/sip_errno.h> 24 26 #include <pjsip/sip_event.h> 25 #include <pjsip/sip_misc.h>26 27 #include <pjsip/sip_module.h> 27 28 #include <pjsip/sip_msg.h> … … 31 32 #include <pjsip/sip_transport.h> 32 33 #include <pjsip/sip_uri.h> 33 #include <pjsip/sip_ auth.h>34 #include <pjsip/sip_util.h> 34 35 35 36 #endif /* __PJSIP_CORE_H__ */ -
pjproject/trunk/pjsip/src/pjsip-simple/event_notify.c
r51 r64 19 19 #include <pjsip_simple/event_notify.h> 20 20 #include <pjsip/sip_msg.h> 21 #include <pjsip/sip_ misc.h>21 #include <pjsip/sip_util.h> 22 22 #include <pjsip/sip_endpoint.h> 23 23 #include <pjsip/sip_module.h> -
pjproject/trunk/pjsip/src/pjsip-simple/messaging.c
r51 r64 23 23 #include <pjsip/sip_event.h> 24 24 #include <pjsip/sip_module.h> 25 #include <pjsip/sip_ misc.h>25 #include <pjsip/sip_util.h> 26 26 #include <pj/string.h> 27 27 #include <pj/pool.h> -
pjproject/trunk/pjsip/src/pjsip-ua/sip_dialog.c
r54 r64 25 25 #include <pjsip/sip_endpoint.h> 26 26 #include <pjsip/sip_uri.h> 27 #include <pjsip/sip_ misc.h>27 #include <pjsip/sip_util.h> 28 28 #include <pjsip/sip_module.h> 29 29 #include <pjsip/sip_event.h> -
pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
r51 r64 23 23 #include <pjsip/sip_transaction.h> 24 24 #include <pjsip/sip_event.h> 25 #include <pjsip/sip_ misc.h>25 #include <pjsip/sip_util.h> 26 26 #include <pjsip/sip_auth_msg.h> 27 27 #include <pj/pool.h> -
pjproject/trunk/pjsip/src/pjsip-ua/sip_ua.c
r51 r64 22 22 #include <pjsip/sip_module.h> 23 23 #include <pjsip/sip_event.h> 24 #include <pjsip/sip_ misc.h>24 #include <pjsip/sip_util.h> 25 25 #include <pjsip/sip_endpoint.h> 26 26 #include <pjsip/sip_transaction.h> -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
r57 r64 23 23 #include <pjsip/sip_resolve.h> 24 24 #include <pjsip/sip_module.h> 25 #include <pjsip/sip_ misc.h>25 #include <pjsip/sip_util.h> 26 26 #include <pjsip/sip_errno.h> 27 27 #include <pj/except.h> … … 107 107 108 108 /* 109 * Create transaction.110 * Defined in sip_transaction.c111 */112 pj_status_t pjsip_tsx_create( pj_pool_t *pool, pjsip_endpoint *endpt,113 pjsip_transaction **tsx );114 115 /*116 109 * This is the global handler for memory allocation failure, for pools that 117 110 * are created by the endpoint (by default, all pools ARE allocated by … … 295 288 * Get "Allow" header. 296 289 */ 297 PJ_DE CL(const pjsip_allow_hdr*) pjsip_endpt_get_allow_hdr( pjsip_endpoint *endpt )290 PJ_DEF(const pjsip_allow_hdr*) pjsip_endpt_get_allow_hdr( pjsip_endpoint *endpt ) 298 291 { 299 292 return endpt->allow_hdr; … … 672 665 * Find transaction by the key. 673 666 */ 674 PJ_DE CL(pjsip_transaction*) pjsip_endpt_find_tsx( pjsip_endpoint *endpt,667 PJ_DEF(pjsip_transaction*) pjsip_endpt_find_tsx( pjsip_endpoint *endpt, 675 668 const pj_str_t *key ) 676 669 { … … 981 974 * Find/create transport. 982 975 */ 983 PJ_DE CL(pj_status_t) pjsip_endpt_alloc_transport( pjsip_endpoint *endpt,976 PJ_DEF(pj_status_t) pjsip_endpt_alloc_transport( pjsip_endpoint *endpt, 984 977 pjsip_transport_type_e type, 985 978 const pj_sockaddr_in *remote, … … 992 985 993 986 987 /* 988 * Report error. 989 */ 990 PJ_DEF(void) pjsip_endpt_log_error( pjsip_endpoint *endpt, 991 const char *sender, 992 pj_status_t error_code, 993 const char *format, 994 ... ) 995 { 996 char newformat[256]; 997 int len; 998 va_list marker; 999 1000 va_start(marker, format); 1001 1002 PJ_UNUSED_ARG(endpt); 1003 1004 len = pj_native_strlen(format); 1005 if (len < sizeof(newformat)-30) { 1006 pj_str_t errstr; 1007 1008 pj_native_strcpy(newformat, format); 1009 pj_snprintf(newformat+len, sizeof(newformat)-len-1, 1010 ": [err %d] ", error_code); 1011 len += pj_native_strlen(newformat+len); 1012 1013 errstr = pjsip_strerror(error_code, newformat+len, 1014 sizeof(newformat)-len-1); 1015 1016 len += errstr.slen; 1017 newformat[len] = '\0'; 1018 1019 pj_log(sender, 1, newformat, marker); 1020 } else { 1021 pj_log(sender, 1, format, marker); 1022 } 1023 1024 va_end(marker); 1025 } 1026 1027 1028 /* 1029 * Dump endpoint. 1030 */ 994 1031 PJ_DEF(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail ) 995 1032 { -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r54 r64 24 24 #include <pjsip/sip_transport.h> /* rdata structure */ 25 25 #include <pjlib-util/scanner.h> 26 #include <pjlib-util/string.h> 26 27 #include <pj/except.h> 27 28 #include <pj/log.h> … … 33 34 #include <pj/assert.h> 34 35 35 #define RESERVED ";/?:@&=+$," 36 #define MARK "-_.!~*'()" 37 #define ESCAPED "%" 38 #define USER "&=+$,;?/" 39 #define PASS "&=+$," 40 #define TOKEN "-.!%*_=`'~+" /* '+' is because of application/pidf+xml 41 * in Content-Type! */ 42 #define HOST "_-." 43 #define HEX_DIGIT "abcdefABCDEF" 44 #define PARAM_CHAR "[]/:&+$" MARK "%" 36 #define ALNUM 37 #define RESERVED ";/?:@&=+$," 38 #define MARK "-_.!~*'()" 39 #define UNRESERVED ALNUM MARK 40 #define ESCAPED "%" 41 #define USER_UNRESERVED "&=+$,;?/" 42 #define PASS "&=+$," 43 #define TOKEN "-.!%*_=`'~+" /* '+' is because of app/pidf+xml 44 * in Content-Type! */ 45 #define HOST "_-." 46 #define HEX_DIGIT "abcdefABCDEF" 47 #define PARAM_CHAR "[]/:&+$" UNRESERVED ESCAPED 48 #define HNV_UNRESERVED "[]/?:+$" 49 #define HDR_CHAR HNV_UNRESERVED UNRESERVED ESCAPED 45 50 46 51 #define PJSIP_VERSION "SIP/2.0" … … 93 98 pjsip_PARAM_CHAR_SPEC, /* For scanning pname (or pvalue when 94 99 * it's not quoted.) */ 100 pjsip_HDR_CHAR_SPEC, /* Chars in hname or hvalue */ 95 101 pjsip_PROBE_USER_HOST_SPEC, /* Hostname characters. */ 96 102 pjsip_PASSWD_SPEC, /* Password. */ … … 110 116 pj_str_t *pname, 111 117 pj_str_t *pvalue); 118 static void int_parse_hparam( pj_scanner *scanner, 119 pj_str_t *hname, 120 pj_str_t *hvalue ); 112 121 static void int_parse_req_line( pj_scanner *scanner, 113 122 pj_pool_t *pool, … … 272 281 pj_cis_add_str(&pjsip_PARAM_CHAR_SPEC, PARAM_CHAR); 273 282 283 status = pj_cis_dup(&pjsip_HDR_CHAR_SPEC, &pjsip_ALNUM_SPEC); 284 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 285 pj_cis_add_str(&pjsip_HDR_CHAR_SPEC, HDR_CHAR); 286 274 287 status = pj_cis_dup(&pjsip_USER_SPEC, &pjsip_ALNUM_SPEC); 275 288 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 276 pj_cis_add_str( &pjsip_USER_SPEC, MARK ESCAPED USER);289 pj_cis_add_str( &pjsip_USER_SPEC, ESCAPED USER_UNRESERVED ); 277 290 278 291 status = pj_cis_dup(&pjsip_PASSWD_SPEC, &pjsip_ALNUM_SPEC); … … 859 872 /* pname */ 860 873 pj_scan_get(scanner, &pjsip_PARAM_CHAR_SPEC, pname); 874 pj_str_unescape(pname); 861 875 862 876 /* pvalue, if any */ … … 872 886 } else { 873 887 pj_scan_get(scanner, &pjsip_PARAM_CHAR_SPEC, pvalue); 888 pj_str_unescape(pvalue); 874 889 } 875 890 } else { … … 890 905 } 891 906 907 /* Parse header parameter. */ 908 static void int_parse_hparam( pj_scanner *scanner, 909 pj_str_t *hname, pj_str_t *hvalue ) 910 { 911 /* Get '?' or '&' character. */ 912 pj_scan_get_char(scanner); 913 914 /* hname */ 915 pj_scan_get(scanner, &pjsip_HDR_CHAR_SPEC, hname); 916 pj_str_unescape(hname); 917 918 /* pvalue, if any */ 919 if (*scanner->curptr == '=') { 920 pj_scan_get_char(scanner); 921 pj_scan_get(scanner, &pjsip_HDR_CHAR_SPEC, hvalue); 922 pj_str_unescape(hvalue); 923 } else { 924 hvalue->ptr = NULL; 925 hvalue->slen = 0; 926 } 927 } 928 892 929 /* Parse host:port in URI. */ 893 930 static void int_parse_uri_host_port( pj_scanner *scanner, … … 895 932 { 896 933 pj_scan_get( scanner, &pjsip_HOST_SPEC, host); 934 /* RFC3261 section 19.1.2: host don't need to be unescaped */ 897 935 if (*scanner->curptr == ':') { 898 936 pj_str_t port; 899 937 pj_scan_get_char(scanner); 900 938 pj_scan_get(scanner, &pjsip_DIGIT_SPEC, &port); 939 pj_str_unescape(&port); 901 940 *p_port = pj_strtoul(&port); 902 941 } else { … … 927 966 { 928 967 pj_scan_get( scanner, &pjsip_USER_SPEC, user); 968 pj_str_unescape(user); 969 929 970 if ( *scanner->curptr == ':') { 930 971 pj_scan_get_char( scanner ); 931 972 pj_scan_get( scanner, &pjsip_PASSWD_SPEC, pass); 973 pj_str_unescape(pass); 932 974 } else { 933 975 pass->ptr = NULL; … … 945 987 pjsip_uri *uri; 946 988 int is_name_addr = 0; 989 990 /* Exhaust any whitespaces. */ 991 pj_scan_skip_whitespace(scanner); 947 992 948 993 if (*scanner->curptr=='"' || *scanner->curptr=='<') { … … 1035 1080 int colon; 1036 1081 int skip_ws = scanner->skip_ws; 1082 int hsep = '?'; 1037 1083 scanner->skip_ws = 0; 1038 1084 … … 1090 1136 1091 1137 } else { 1092 concat_param(&url->other_param, pool, &pname, &pvalue); 1138 pjsip_param *p = pj_pool_alloc(pool, sizeof(pjsip_param)); 1139 p->name = pname; 1140 p->value = pvalue; 1141 pj_list_insert_before(&url->other_param, p); 1093 1142 } 1094 1143 } 1095 1144 1096 1145 /* Get header params. */ 1097 if (parse_params && *scanner->curptr == '?') { 1098 pj_scan_get_until(scanner, &pjsip_NEWLINE_OR_EOF_SPEC, 1099 &url->header_param); 1146 while (parse_params && *scanner->curptr == hsep) { 1147 pjsip_param *param; 1148 param = pj_pool_alloc(pool, sizeof(pjsip_param)); 1149 int_parse_hparam(scanner, ¶m->name, ¶m->value); 1150 pj_list_insert_before(&url->header_param, param); 1151 hsep = '&'; 1100 1152 } 1101 1153 -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r58 r64 20 20 #include <pjsip/sip_transport.h> 21 21 #include <pjsip/sip_config.h> 22 #include <pjsip/sip_ misc.h>22 #include <pjsip/sip_util.h> 23 23 #include <pjsip/sip_event.h> 24 24 #include <pjsip/sip_endpoint.h> … … 346 346 * Create new transaction. 347 347 */ 348 pj_status_tpjsip_tsx_create( pj_pool_t *pool,349 pjsip_endpoint *endpt,350 348 PJ_DEF(pj_status_t) pjsip_tsx_create( pj_pool_t *pool, 349 pjsip_endpoint *endpt, 350 pjsip_transaction **p_tsx) 351 351 { 352 352 pjsip_transaction *tsx; -
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r58 r64 648 648 if (msg_status != PJ_SUCCESS) { 649 649 if (remaining_len == PJSIP_MAX_PKT_LEN) { 650 mgr->msg_cb(mgr->endpt, PJSIP_E OVERFLOW, rdata);650 mgr->msg_cb(mgr->endpt, PJSIP_ERXOVERFLOW, rdata); 651 651 /* Exhaust all data. */ 652 652 return rdata->pkt_info.len; -
pjproject/trunk/pjsip/src/pjsip/sip_uri.c
r51 r64 19 19 #include <pjsip/sip_uri.h> 20 20 #include <pjsip/sip_msg.h> 21 #include <pjsip/sip_parser.h> 21 22 #include <pjsip/print_util.h> 23 #include <pjsip/sip_errno.h> 24 #include <pjlib-util/string.h> 22 25 #include <pj/string.h> 23 26 #include <pj/pool.h> 24 27 #include <pj/assert.h> 25 28 29 /* 30 * Generic parameter manipulation. 31 */ 32 PJ_DEF(pjsip_param*) pjsip_param_find( pjsip_param *param_list, 33 const pj_str_t *name ) 34 { 35 pjsip_param *p = param_list->next; 36 while (p != param_list) { 37 if (pj_stricmp(&p->name, name)==0) 38 return p; 39 p = p->next; 40 } 41 return NULL; 42 } 43 44 PJ_DEF(const pjsip_param*) pjsip_param_cfind( const pjsip_param *param_list, 45 const pj_str_t *name ) 46 { 47 const pjsip_param *p = param_list->next; 48 while (p != param_list) { 49 if (pj_stricmp(&p->name, name)==0) 50 return p; 51 p = p->next; 52 } 53 return NULL; 54 } 55 56 PJ_DEF(void) pjsip_param_clone( pj_pool_t *pool, pjsip_param *dst_list, 57 const pjsip_param *src_list) 58 { 59 const pjsip_param *p = src_list->next; 60 61 pj_list_init(dst_list); 62 while (p != src_list) { 63 pjsip_param *new_param = pj_pool_alloc(pool, sizeof(pjsip_param)); 64 pj_strdup(pool, &new_param->name, &p->name); 65 pj_strdup(pool, &new_param->value, &p->value); 66 pj_list_insert_before(dst_list, new_param); 67 p = p->next; 68 } 69 } 70 71 /* 72 * URI stuffs 73 */ 26 74 #define IS_SIPS(url) ((url)->vptr==&sips_url_vptr) 27 75 … … 110 158 url->ttl_param = -1; 111 159 url->vptr = secure ? &sips_url_vptr : &sip_url_vptr; 160 pj_list_init(&url->other_param); 161 pj_list_init(&url->header_param); 112 162 } 113 163 … … 124 174 { 125 175 int printed; 126 pj_size_t size_required;127 176 char *startbuf = buf; 177 char *endbuf = buf+size; 128 178 const pj_str_t *scheme; 179 pjsip_param *param; 180 char hparam_char = '?'; 181 129 182 *buf = '\0'; 130 131 /* Check the buffer length. */132 size_required = 6 + url->host.slen + 10 +133 url->user.slen + url->passwd.slen + 2 +134 url->user_param.slen + 6 +135 url->method_param.slen + 8 +136 url->transport_param.slen + 11 +137 9 + 5 +138 url->maddr_param.slen + 7 +139 3 +140 url->other_param.slen +141 url->header_param.slen;142 if (size < size_required) {143 return -1;144 }145 183 146 184 /* Print scheme ("sip:" or "sips:") */ 147 185 scheme = pjsip_uri_get_scheme(url); 148 copy_advance_ no_check(buf, *scheme);186 copy_advance_check(buf, *scheme); 149 187 *buf++ = ':'; 150 188 151 189 /* Print "user:password@", if any. */ 152 190 if (url->user.slen) { 153 copy_advance_ no_check(buf, url->user);191 copy_advance_escape(buf, url->user, pjsip_USER_SPEC); 154 192 if (url->passwd.slen) { 155 193 *buf++ = ':'; 156 copy_advance_ no_check(buf, url->passwd);194 copy_advance_escape(buf, url->passwd, pjsip_PASSWD_SPEC); 157 195 } 158 196 … … 162 200 /* Print host. */ 163 201 pj_assert(url->host.slen != 0); 164 copy_advance_ no_check(buf, url->host);202 copy_advance_check(buf, url->host); 165 203 166 204 /* Only print port if it is explicitly specified. … … 171 209 * UA has sent us port, so we'll just send the port indiscrimately 172 210 */ 173 PJ_TODO(SHOULD_DISALLOW_URI_PORT_IN_FROM_TO_HEADER)174 if (url->port /*&& context != PJSIP_URI_IN_FROMTO_HDR*/) {211 //PJ_TODO(SHOULD_DISALLOW_URI_PORT_IN_FROM_TO_HEADER) 212 if (url->port && context != PJSIP_URI_IN_FROMTO_HDR) { 175 213 *buf++ = ':'; 176 214 printed = pj_utoa(url->port, buf); … … 179 217 180 218 /* User param is allowed in all contexes */ 181 copy_advance_pair_ no_check(buf, ";user=", 6, url->user_param);219 copy_advance_pair_check(buf, ";user=", 6, url->user_param); 182 220 183 221 /* Method param is only allowed in external/other context. */ 184 222 if (context == PJSIP_URI_IN_OTHER) { 185 copy_advance_pair_no_check(buf, ";method=", 8, url->method_param); 223 copy_advance_pair_escape(buf, ";method=", 8, url->method_param, 224 pjsip_PARAM_CHAR_SPEC); 186 225 } 187 226 188 227 /* Transport is not allowed in From/To header. */ 189 228 if (context != PJSIP_URI_IN_FROMTO_HDR) { 190 copy_advance_pair_no_check(buf, ";transport=", 11, url->transport_param); 229 copy_advance_pair_escape(buf, ";transport=", 11, url->transport_param, 230 pjsip_PARAM_CHAR_SPEC); 191 231 } 192 232 193 233 /* TTL param is not allowed in From, To, Route, and Record-Route header. */ 194 234 if (url->ttl_param >= 0 && context != PJSIP_URI_IN_FROMTO_HDR && 195 context != PJSIP_URI_IN_ROUTING_HDR )235 context != PJSIP_URI_IN_ROUTING_HDR && (endbuf-buf) > 15) 196 236 { 197 237 pj_memcpy(buf, ";ttl=", 5); … … 202 242 /* maddr param is not allowed in From and To header. */ 203 243 if (context != PJSIP_URI_IN_FROMTO_HDR) { 204 copy_advance_pair_no_check(buf, ";maddr=", 7, url->maddr_param); 244 copy_advance_pair_escape(buf, ";maddr=", 7, url->maddr_param, 245 pjsip_PARAM_CHAR_SPEC); 205 246 } 206 247 … … 210 251 { 211 252 pj_str_t lr = { ";lr", 3 }; 212 copy_advance_ no_check(buf, lr);253 copy_advance_check(buf, lr); 213 254 } 214 255 215 256 /* Other param. */ 216 if (url->other_param.slen) { 217 copy_advance_no_check(buf, url->other_param); 257 param = url->other_param.next; 258 while (param != &url->other_param) { 259 *buf++ = ';'; 260 copy_advance_escape(buf, param->name, pjsip_PARAM_CHAR_SPEC); 261 if (param->value.slen) { 262 *buf++ = '='; 263 copy_advance_escape(buf, param->value, pjsip_PARAM_CHAR_SPEC); 264 } 265 param = param->next; 218 266 } 219 267 220 268 /* Header param. */ 221 if (url->header_param.slen) { 222 copy_advance_no_check(buf, url->header_param); 269 param = url->header_param.next; 270 while (param != &url->header_param) { 271 *buf++ = hparam_char; 272 copy_advance_escape(buf, param->name, pjsip_HDR_CHAR_SPEC); 273 if (param->value.slen) { 274 *buf++ = '='; 275 copy_advance_escape(buf, param->value, pjsip_HDR_CHAR_SPEC); 276 } 277 param = param->next; 278 hparam_char = '&'; 223 279 } 224 280 … … 227 283 } 228 284 229 static int pjsip_url_compare( pjsip_uri_context_e context, 230 const pjsip_url *url1, const pjsip_url *url2) 231 { 232 /* The easiest (and probably the most efficient) way to compare two URLs 233 are to print them, and compare them bytes per bytes. This technique 234 works quite well with RFC3261, as the RFC (unlike RFC2543) defines that 235 components specified in one URL does NOT match its default value if 236 it is not specified in the second URL. For example, parameter "user=ip" 237 does NOT match if it is omited in second URL. 238 239 HOWEVER, THE SAME CAN NOT BE APPLIED FOR other-param NOR header-param. 240 For these, each of the parameters must be compared one by one. Parameter 241 that exists in one URL will match the comparison. But parameter that 242 exists in both URLs and doesn't match wont match the URL comparison. 243 244 The solution for this is to compare 'standard' URL components with 245 bytes-to-bytes comparison, and compare other-param and header-param with 246 more intelligent comparison. 247 */ 248 char str_url1[PJSIP_MAX_URL_SIZE]; 249 char str_url2[PJSIP_MAX_URL_SIZE]; 250 int len1, len2; 251 252 /* Must compare scheme first, as the second URI may not be SIP URL. */ 253 if (pj_stricmp(pjsip_uri_get_scheme(url1), pjsip_uri_get_scheme(url2))) 254 return -1; 255 256 len1 = pjsip_url_print(context, url1, str_url1, sizeof(str_url1)); 257 if (len1 < 1) { 258 pj_assert(0); 259 return -1; 260 } 261 len2 = pjsip_url_print(context, url2, str_url2, sizeof(str_url2)); 262 if (len2 < 1) { 263 pj_assert(0); 264 return -1; 265 } 266 267 if (len1 != len2) { 268 /* Not equal. */ 269 return -1; 270 } 271 272 if (pj_native_strcmp(str_url1, str_url2)) { 273 /* Not equal */ 274 return -1; 275 } 276 277 /* TODO: compare other-param and header-param in more intelligent manner. */ 278 PJ_TODO(HPARAM_AND_OTHER_PARAM_COMPARISON_IN_URL_COMPARISON) 279 280 if (pj_strcmp(&url1->other_param, &url2->other_param)) { 281 /* Not equal. */ 282 return -1; 283 } 284 if (pj_strcmp(&url1->header_param, &url2->header_param)) { 285 /* Not equal. */ 286 return -1; 287 } 288 289 /* Seems to be equal, isn't it. */ 290 return 0; 285 static pj_status_t pjsip_url_compare( pjsip_uri_context_e context, 286 const pjsip_url *url1, 287 const pjsip_url *url2) 288 { 289 const pjsip_param *p1; 290 291 /* 292 * Compare two SIP URL's according to Section 19.1.4 of RFC 3261. 293 */ 294 295 /* SIP and SIPS URI are never equivalent. 296 * Note: just compare the vptr to avoid string comparison. 297 * Pretty neat huh!! 298 */ 299 if (url1->vptr != url2->vptr) 300 return PJSIP_ECMPSCHEME; 301 302 /* Comparison of the userinfo of SIP and SIPS URIs is case-sensitive. 303 * This includes userinfo containing passwords or formatted as 304 * telephone-subscribers. 305 */ 306 if (pj_strcmp(&url1->user, &url2->user) != 0) 307 return PJSIP_ECMPUSER; 308 if (pj_strcmp(&url1->passwd, &url2->passwd) != 0) 309 return PJSIP_ECMPPASSWD; 291 310 311 /* Comparison of all other components of the URI is 312 * case-insensitive unless explicitly defined otherwise. 313 */ 314 315 /* The ordering of parameters and header fields is not significant 316 * in comparing SIP and SIPS URIs. 317 */ 318 319 /* Characters other than those in the reserved set (see RFC 2396 [5]) 320 * are equivalent to their encoding. 321 */ 322 323 /* An IP address that is the result of a DNS lookup of a host name 324 * does not match that host name. 325 */ 326 if (pj_stricmp(&url1->host, &url2->host) != 0) 327 return PJSIP_ECMPHOST; 328 329 /* A URI omitting any component with a default value will not match a URI 330 * explicitly containing that component with its default value. 331 * For instance, a URI omitting the optional port component will not match 332 * a URI explicitly declaring port 5060. 333 * The same is true for the transport-parameter, ttl-parameter, 334 * user-parameter, and method components. 335 */ 336 337 /* Port is not allowed in To and From header. 338 */ 339 if (context != PJSIP_URI_IN_FROMTO_HDR) { 340 if (url1->port != url2->port) 341 return PJSIP_ECMPPORT; 342 } 343 /* Transport is not allowed in From/To header. */ 344 if (context != PJSIP_URI_IN_FROMTO_HDR) { 345 if (pj_stricmp(&url1->transport_param, &url2->transport_param) != 0) 346 return PJSIP_ECMPTRANSPORTPRM; 347 } 348 /* TTL param is not allowed in From, To, Route, and Record-Route header. */ 349 if (context != PJSIP_URI_IN_FROMTO_HDR && 350 context != PJSIP_URI_IN_ROUTING_HDR) 351 { 352 if (url1->ttl_param != url2->ttl_param) 353 return PJSIP_ECMPTTLPARAM; 354 } 355 /* User param is allowed in all contexes */ 356 if (pj_stricmp(&url1->user_param, &url2->user_param) != 0) 357 return PJSIP_ECMPUSERPARAM; 358 /* Method param is only allowed in external/other context. */ 359 if (context == PJSIP_URI_IN_OTHER) { 360 if (pj_stricmp(&url1->method_param, &url2->method_param) != 0) 361 return PJSIP_ECMPMETHODPARAM; 362 } 363 /* maddr param is not allowed in From and To header. */ 364 if (context != PJSIP_URI_IN_FROMTO_HDR) { 365 if (pj_stricmp(&url1->maddr_param, &url2->maddr_param) != 0) 366 return PJSIP_ECMPMADDRPARAM; 367 } 368 369 /* lr parameter is ignored (?) */ 370 /* lr param is not allowed in From, To, and Contact header. */ 371 372 373 /* All other uri-parameters appearing in only one URI are ignored when 374 * comparing the URIs. 375 */ 376 p1 = url1->other_param.next; 377 while (p1 != &url1->other_param) { 378 const pjsip_param *p2; 379 p2 = pjsip_param_cfind(&url2->other_param, &p1->name); 380 if (p2 ) { 381 if (pj_stricmp(&p1->value, &p2->value) != 0) 382 return PJSIP_ECMPOTHERPARAM; 383 } 384 385 p1 = p1->next; 386 } 387 388 /* URI header components are never ignored. Any present header component 389 * MUST be present in both URIs and match for the URIs to match. 390 * The matching rules are defined for each header field in Section 20. 391 */ 392 p1 = url1->header_param.next; 393 while (p1 != &url1->header_param) { 394 const pjsip_param *p2; 395 p2 = pjsip_param_cfind(&url2->header_param, &p1->name); 396 if (p2) { 397 /* It seems too much to compare two header params according to 398 * the rule of each header. We'll just compare them string to 399 * string.. 400 */ 401 PJ_TODO(MORE_COMPLIANT_HEADER_PARAM_COMPARISON_IN_URL); 402 403 if (pj_stricmp(&p1->value, &p2->value) != 0) 404 return PJSIP_ECMPHEADERPARAM; 405 } else { 406 return PJSIP_ECMPHEADERPARAM; 407 } 408 p1 = p1->next; 409 } 410 411 /* Equal!! Pheuww.. */ 412 return PJ_SUCCESS; 292 413 } 293 414 … … 305 426 url->ttl_param = rhs->ttl_param; 306 427 pj_strdup( pool, &url->maddr_param, &rhs->maddr_param); 307 pj _strdup(pool, &url->other_param, &rhs->other_param);308 pj _strdup(pool, &url->header_param, &rhs->header_param);428 pjsip_param_clone(pool, &url->other_param, &rhs->other_param); 429 pjsip_param_clone(pool, &url->header_param, &rhs->header_param); 309 430 url->lr_param = rhs->lr_param; 310 431 } -
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r58 r64 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #include <pjsip/sip_ misc.h>19 #include <pjsip/sip_util.h> 20 20 #include <pjsip/sip_transport.h> 21 21 #include <pjsip/sip_msg.h> -
pjproject/trunk/pjsip/src/test-pjsip/main.c
r61 r64 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #include "test.h" 20 21 int main(void) 22 { 23 return test_main(); 24 } -
pjproject/trunk/pjsip/src/test-pjsip/msg.c
r61 r64 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #include <pjsip/sip_msg.h>20 #include <pjsip/sip_parser.h>21 #include <pj/os.h>22 #include <pj/pool.h>23 #include <pj/string.h>24 #include <stdlib.h>25 #include <stdio.h>26 19 #include "test.h" 27 28 #define ERR_SYNTAX_ERR (-2) 29 #define ERR_NOT_EQUAL (-3) 30 #define ERR_SYSTEM (-4) 31 20 #include <pjsip_core.h> 21 #include <pjlib.h> 32 22 33 23 static pjsip_msg *create_msg0(pj_pool_t *pool); … … 67 57 }; 68 58 69 static pj_caching_pool cp;70 static pj_pool_factory *pf = &cp.factory;71 59 static pj_uint32_t parse_len, parse_time, print_time; 72 60 73 static void pool_error(pj_pool_t *pool, pj_size_t sz) 74 { 75 PJ_UNUSED_ARG(pool) 76 PJ_UNUSED_ARG(sz) 77 78 pj_assert(0); 79 exit(1); 80 } 81 82 static const char *STATUS_STR(pj_status_t status) 83 { 84 switch (status) { 85 case 0: return "OK"; 86 case ERR_SYNTAX_ERR: return "Syntax Error"; 87 case ERR_NOT_EQUAL: return "Not Equal"; 88 case ERR_SYSTEM: return "System Error"; 89 } 90 return "???"; 91 } 92 93 static pj_status_t test_entry( struct test_msg *entry ) 61 static pj_status_t test_entry( pj_pool_t *pool, struct test_msg *entry ) 94 62 { 95 63 pjsip_msg *parsed_msg, *ref_msg; 96 pj_pool_t *pool;97 64 pj_status_t status = PJ_SUCCESS; 98 65 int len; 99 66 pj_str_t str1, str2; 100 67 pjsip_hdr *hdr1, *hdr2; 101 pj_ hr_timestamp t1, t2;68 pj_timestamp t1, t2; 102 69 char *msgbuf; 103 70 104 71 enum { BUFLEN = 512 }; 105 72 106 pool = pj_pool_create( pf, "",107 PJSIP_POOL_LEN_RDATA*2, PJSIP_POOL_INC_RDATA,108 &pool_error);109 110 if (entry->len == 0) {111 entry->len = strlen(entry->msg);112 }113 114 73 /* Parse message. */ 115 74 parse_len += entry->len; 116 pj_ hr_gettimestamp(&t1);75 pj_get_timestamp(&t1); 117 76 parsed_msg = pjsip_parse_msg(pool, entry->msg, entry->len, NULL); 118 77 if (parsed_msg == NULL) { 119 status = ERR_SYNTAX_ERR;120 goto on_return; 121 } 122 pj_ hr_gettimestamp(&t2);78 status = -10; 79 goto on_return; 80 } 81 pj_get_timestamp(&t2); 123 82 parse_time += t2.u32.lo - t1.u32.lo; 124 125 #if IS_PROFILING126 goto print_msg;127 #endif128 83 129 84 /* Create reference message. */ … … 136 91 /* Compare message type. */ 137 92 if (parsed_msg->type != ref_msg->type) { 138 status = ERR_NOT_EQUAL;93 status = -20; 139 94 goto on_return; 140 95 } … … 146 101 147 102 if (m1->id != m2->id || pj_strcmp(&m1->name, &m2->name)) { 148 status = ERR_NOT_EQUAL;103 status = -30; 149 104 goto on_return; 150 105 } … … 160 115 len = hdr1->vptr->print_on(hdr1, str1.ptr, BUFLEN); 161 116 if (len < 1) { 162 status = ERR_SYSTEM;117 status = -40; 163 118 goto on_return; 164 119 } … … 167 122 len = hdr2->vptr->print_on(hdr2, str2.ptr, BUFLEN); 168 123 if (len < 1) { 169 status = ERR_SYSTEM;124 status = -50; 170 125 goto on_return; 171 126 } 172 127 str2.slen = len; 173 128 174 if (!SILENT) {175 printf("hdr1='%.*s'\n"176 "hdr2='%.*s'\n\n",177 str1.slen, str1.ptr,178 str2.slen, str2.ptr);179 }180 129 if (pj_strcmp(&str1, &str2) != 0) { 181 status = ERR_NOT_EQUAL;130 status = -60; 182 131 goto on_return; 183 132 } … … 188 137 189 138 if (hdr1 != &parsed_msg->hdr || hdr2 != &ref_msg->hdr) { 190 status = ERR_NOT_EQUAL;139 status = -70; 191 140 goto on_return; 192 141 } 193 142 194 143 /* Print message. */ 195 #if IS_PROFILING196 print_msg:197 #endif198 144 msgbuf = pj_pool_alloc(pool, PJSIP_MAX_PKT_LEN); 199 145 if (msgbuf == NULL) { 200 status = ERR_SYSTEM;201 goto on_return; 202 } 203 pj_ hr_gettimestamp(&t1);146 status = -80; 147 goto on_return; 148 } 149 pj_get_timestamp(&t1); 204 150 len = pjsip_msg_print(parsed_msg, msgbuf, PJSIP_MAX_PKT_LEN); 205 151 if (len < 1) { 206 status = ERR_SYSTEM;207 goto on_return; 208 } 209 pj_ hr_gettimestamp(&t2);152 status = -90; 153 goto on_return; 154 } 155 pj_get_timestamp(&t2); 210 156 print_time += t2.u32.lo - t1.u32.lo; 211 157 status = PJ_SUCCESS; 212 158 213 159 on_return: 214 pj_pool_release(pool);215 160 return status; 216 161 } 217 162 218 static void warm_up() 219 { 163 164 pj_status_t msg_test(void) 165 { 166 pj_status_t status; 220 167 pj_pool_t *pool; 221 pool = pj_pool_create( pf, "", 222 PJSIP_POOL_LEN_RDATA*2, PJSIP_POOL_INC_RDATA, 223 &pool_error); 224 pj_pool_release(pool); 225 } 226 227 228 pj_status_t test_msg(void) 229 { 230 pj_status_t status; 231 unsigned i; 232 233 pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0); 234 warm_up(); 235 236 for (i=0; i<LOOP; ++i) { 237 status = test_entry( &test_array[0] ); 238 } 239 printf("%s\n", STATUS_STR(status)); 240 241 printf("Total bytes: %u, parse time=%f/char, print time=%f/char\n", 242 parse_len, 243 parse_time*1.0/parse_len, 244 print_time*1.0/parse_len); 245 return PJ_SUCCESS; 168 169 pool = pjsip_endpt_create_pool(endpt, NULL, 4000, 4000); 170 171 status = test_entry( pool, &test_array[0] ); 172 173 pjsip_endpt_destroy(endpt); 174 return status; 246 175 } 247 176 -
pjproject/trunk/pjsip/src/test-pjsip/test.c
- Property svn:keyword set to Id
r61 r64 47 47 } 48 48 49 pj_status_t register_static_modules(pj_size_t *count, pjsip_module **modules) 50 { 51 *count = 0; 52 return PJ_SUCCESS; 53 } 49 54 50 51 int main() 55 int test_main(void) 52 56 { 53 57 pj_status_t rc; 58 pj_caching_pool caching_pool; 59 const char *filename; 60 int line; 61 62 pj_log_set_level(3); 63 pj_log_set_decor(PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_TIME | 64 PJ_LOG_HAS_MICRO_SEC); 54 65 55 66 if ((rc=pj_init()) != PJ_SUCCESS) { 56 67 app_perror("pj_init", rc); 68 return rc; 57 69 } 58 70 59 DO_TEST(parse_uri()); 60 DO_TEST(parse_msg()); 71 pj_dump_config(); 72 73 pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, 0 ); 74 75 rc = pjsip_endpt_create(&caching_pool.factory, "endpt", &endpt); 76 if (rc != PJ_SUCCESS) { 77 app_perror("pjsip_endpt_create", rc); 78 pj_caching_pool_destroy(&caching_pool); 79 return rc; 80 } 81 82 PJ_LOG(3,("","")); 83 84 DO_TEST(uri_test()); 61 85 62 86 on_return: 87 88 pjsip_endpt_destroy(endpt); 89 pj_caching_pool_destroy(&caching_pool); 90 91 PJ_LOG(3,("test", "")); 92 93 pj_thread_get_stack_info(pj_thread_this(), &filename, &line); 94 PJ_LOG(3,("test", "Stack max usage: %u, deepest: %s:%u", 95 pj_thread_get_stack_max_usage(pj_thread_this()), 96 filename, line)); 97 if (rc == 0) 98 PJ_LOG(3,("test", "Looks like everything is okay!..")); 99 else 100 PJ_LOG(3,("test", "Test completed with error(s)")); 101 63 102 return 0; 64 103 } -
pjproject/trunk/pjsip/src/test-pjsip/test.h
r61 r64 22 22 #include <pjsip/sip_types.h> 23 23 24 #define SILENT 125 #define IS_PROFILING 126 #define LOOP 200027 28 24 extern pjsip_endpoint *endpt; 29 25 30 pj_status_t parse_uri(void);31 pj_status_t parse_msg(void);26 pj_status_t uri_test(void); 27 pj_status_t msg_test(void); 32 28 29 int test_main(void); 33 30 void app_perror(const char *msg, pj_status_t status); 34 31 -
pjproject/trunk/pjsip/src/test-pjsip/uri.c
r61 r64 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #include <pjsip/sip_parser.h>20 #include <pjsip/sip_uri.h>21 #include <pj/os.h>22 #include <pj/pool.h>23 #include <pj/string.h>24 #include <stdlib.h>25 #include <stdio.h>26 19 #include "test.h" 27 28 # define ERR_SYNTAX_ERR (-2)29 #define ERR_NOT_EQUAL (-3) 20 #include <pjsip_core.h> 21 #include <pjlib.h> 22 30 23 31 24 #define ALPHANUM "abcdefghijklmnopqrstuvwxyz" \ … … 39 32 #define POOL_SIZE 4096 40 33 41 static const char *STATUS_STR(pj_status_t status)42 {43 switch (status) {44 case 0: return "OK";45 case ERR_SYNTAX_ERR: return "Syntax Error";46 case ERR_NOT_EQUAL: return "Not Equal";47 }48 return "???";49 }50 51 34 static pj_uint32_t parse_len, parse_time, print_time; 52 static pj_caching_pool cp;53 35 54 36 … … 75 57 static pjsip_uri *create_dummy( pj_pool_t *pool ); 76 58 59 #define ERR_NOT_EQUAL -1001 60 #define ERR_SYNTAX_ERR -1002 61 77 62 struct uri_test 78 63 { … … 240 225 "", 241 226 &create_dummy, 242 }, 243 { 244 PJ_SUCCESS, 245 "", 246 NULL, 247 }, 227 } 248 228 }; 249 229 … … 477 457 static pjsip_uri *create_dummy(pj_pool_t *pool) 478 458 { 479 PJ_UNUSED_ARG(pool) 459 PJ_UNUSED_ARG(pool); 480 460 return NULL; 481 461 } 482 462 483 463 /*****************************************************************************/ 484 485 static void pool_error(pj_pool_t *pool, pj_size_t sz)486 {487 PJ_UNUSED_ARG(pool)488 PJ_UNUSED_ARG(sz)489 490 pj_assert(0);491 exit(1);492 }493 464 494 465 /* 495 466 * Test one test entry. 496 467 */ 497 static pj_status_t test_entry(struct uri_test *entry)468 static pj_status_t do_uri_test(pj_pool_t *pool, struct uri_test *entry) 498 469 { 499 470 pj_status_t status; 500 pj_pool_t *pool;501 471 int len; 502 472 pjsip_uri *parsed_uri, *ref_uri; 503 473 pj_str_t s1 = {NULL, 0}, s2 = {NULL, 0}; 504 pj_ hr_timestamp t1, t2;505 506 pool = (*cp.factory.create_pool)( &cp.factory, "", POOL_SIZE, 0, &pool_error);474 pj_timestamp t1, t2; 475 476 entry->len = pj_native_strlen(entry->str); 507 477 508 478 /* Parse URI text. */ 509 pj_ hr_gettimestamp(&t1);479 pj_get_timestamp(&t1); 510 480 parse_len += entry->len; 511 481 parsed_uri = pjsip_parse_uri(pool, entry->str, entry->len, 0); … … 514 484 * return OK. 515 485 */ 516 status = entry->status==ERR_SYNTAX_ERR ? PJ_SUCCESS : ERR_SYNTAX_ERR;486 status = entry->status==ERR_SYNTAX_ERR ? PJ_SUCCESS : -10; 517 487 goto on_return; 518 488 } 519 pj_ hr_gettimestamp(&t2);489 pj_get_timestamp(&t2); 520 490 parse_time += t2.u32.lo - t1.u32.lo; 521 491 … … 527 497 s2.ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); 528 498 529 pj_ hr_gettimestamp(&t1);499 pj_get_timestamp(&t1); 530 500 len = pjsip_uri_print( PJSIP_URI_IN_OTHER, parsed_uri, s1.ptr, PJSIP_MAX_URL_SIZE); 531 501 if (len < 1) { 532 status = - 1;502 status = -20; 533 503 goto on_return; 534 504 } … … 537 507 len = pjsip_uri_print( PJSIP_URI_IN_OTHER, ref_uri, s2.ptr, PJSIP_MAX_URL_SIZE); 538 508 if (len < 1) { 539 status = - 1;509 status = -30; 540 510 goto on_return; 541 511 } 542 512 s2.slen = len; 543 pj_ hr_gettimestamp(&t2);513 pj_get_timestamp(&t2); 544 514 print_time += t2.u32.lo - t1.u32.lo; 545 515 … … 547 517 if (pjsip_uri_cmp(PJSIP_URI_IN_OTHER, parsed_uri, ref_uri) != 0) { 548 518 /* Not equal. See if this is the expected status. */ 549 status = entry->status==ERR_NOT_EQUAL ? PJ_SUCCESS : ERR_NOT_EQUAL;519 status = entry->status==ERR_NOT_EQUAL ? PJ_SUCCESS : -40; 550 520 goto on_return; 551 521 552 522 } else { 553 523 /* Equal. See if this is the expected status. */ 554 status = entry->status==PJ_SUCCESS ? PJ_SUCCESS : - 1;524 status = entry->status==PJ_SUCCESS ? PJ_SUCCESS : -50; 555 525 if (status != PJ_SUCCESS) { 556 526 goto on_return; … … 561 531 if (pj_strcmp(&s1, &s2) != 0) { 562 532 /* Not equal. */ 563 status = ERR_NOT_EQUAL;533 status = -60; 564 534 } 565 535 566 536 on_return: 567 if (!SILENT) {568 printf("%.2d %s (expected status=%s)\n"569 " str=%s\n"570 " uri=%.*s\n"571 " ref=%.*s\n\n",572 entry-uri_test_array,573 STATUS_STR(status),574 STATUS_STR(entry->status),575 entry->str,576 (int)s1.slen, s1.ptr, (int)s2.slen, s2.ptr);577 }578 579 pj_pool_release(pool);580 537 return status; 581 538 } 582 539 583 static void warm_up(pj_pool_factory *pf) 584 { 540 pj_status_t uri_test() 541 { 542 unsigned i; 585 543 pj_pool_t *pool; 586 struct uri_test *entry;587 588 pool = pj_pool_create(pf, "", POOL_SIZE, 0, &pool_error);589 pjsip_parse_uri(pool, "sip:host", 8, 0);590 entry = &uri_test_array[0];591 while (entry->creator) {592 entry->len = strlen(entry->str);593 ++entry;594 }595 pj_pool_release(pool);596 }597 598 //#if !IS_PROFILING599 #if 1600 pj_status_t test_uri()601 {602 struct uri_test *entry;603 int i=0, err=0;604 544 pj_status_t status; 605 pj_hr_timestamp t1, t2; 606 pj_uint32_t total_time; 607 608 pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0); 609 warm_up(&cp.factory); 610 611 pj_hr_gettimestamp(&t1); 612 for (i=0; i<LOOP; ++i) { 613 entry = &uri_test_array[0]; 614 while (entry->creator) { 615 status = test_entry(entry); 616 if (status != PJ_SUCCESS) { 617 ++err; 618 } 619 ++entry; 545 546 pool = pjsip_endpt_create_pool(endpt, "", 4000, 4000); 547 548 for (i=0; i<PJ_ARRAY_SIZE(uri_test_array); ++i) { 549 status = do_uri_test(pool, &uri_test_array[i]); 550 if (status != PJ_SUCCESS) { 551 PJ_LOG(3,("uri_test", " error %d when testing entry %d", 552 status, i)); 553 break; 620 554 } 621 555 } 622 pj_hr_gettimestamp(&t2); 623 total_time = t2.u32.lo - t1.u32.lo; 624 625 printf("Error=%d\n", err); 626 printf("Total parse len: %u bytes\n", parse_len); 627 printf("Total parse time: %u (%f/char), print time: %u (%f/char)\n", 628 parse_time, parse_time*1.0/parse_len, 629 print_time, print_time*1.0/parse_len); 630 printf("Total time: %u (%f/char)\n", total_time, total_time*1.0/parse_len); 631 return err; 632 } 633 634 #else 635 636 pj_status_t test_uri() 637 { 638 struct uri_test *entry; 639 unsigned i; 640 641 warm_up(); 642 pj_caching_pool_init(&cp, 1024*1024); 643 644 for (i=0; i<LOOP; ++i) { 645 entry = &uri_test_array[0]; 646 while (entry->creator) { 647 pj_pool_t *pool; 648 pjsip_uri *uri1, *uri2; 649 650 pool = pj_pool_create( &cp.factory, "", POOL_SIZE, 0, &pool_error); 651 uri1 = pjsip_parse_uri(pool, entry->str, strlen(entry->str)); 652 pj_pool_release(pool); 653 ++entry; 654 } 655 } 656 657 return 0; 658 } 659 660 #endif 556 557 pjsip_endpt_destroy_pool(endpt, pool); 558 return status; 559 } 560
Note: See TracChangeset
for help on using the changeset viewer.