- Timestamp:
- Jan 30, 2006 6:40:05 PM (19 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 7 added
- 5 deleted
- 42 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj++/list.hpp
r65 r127 64 64 const_iterator operator++() 65 65 { 66 return const_iterator( node_->next);66 return const_iterator((const List_Node *)node_->next); 67 67 } 68 68 bool operator==(const const_iterator &rhs) … … 100 100 iterator operator++() 101 101 { 102 return iterator( node_->next);102 return iterator((List_Node*)node_->next); 103 103 } 104 104 bool operator==(const iterator &rhs) … … 122 122 123 123 // 124 // You can cast Pj_List to pj_list 125 // 126 operator pj_list&() 127 { 128 return (pj_list&)root_; 129 } 130 operator const pj_list&() 131 { 132 return (const pj_list&)root_; 133 } 134 135 // 136 // You can cast Pj_List to pj_list* too 137 // 138 operator pj_list*() 139 { 140 return (pj_list*)&root_; 141 } 142 operator const pj_list*() 143 { 144 return (const pj_list*)&root_; 145 } 146 147 // 124 148 // Check if list is empty. 125 149 // … … 319 343 // it's because List_Node is not derived from Pj_List_Node. 320 344 List_Node *n = (List_Node*)0; 321 n = n->next; n =n->prev;345 n = (List_Node *)n->next; n = (List_Node *)n->prev; 322 346 } 323 347 }; -
pjproject/trunk/pjlib/include/pj++/pool.hpp
r65 r127 124 124 125 125 // 126 // You can cast Pj_Pool to pj_pool_t* 127 // 128 operator pj_pool_t*() 129 { 130 return p_; 131 } 132 133 // 126 134 // Get pjlib compatible pool object. 127 135 // -
pjproject/trunk/pjlib/include/pj++/string.hpp
r122 r127 41 41 42 42 // 43 // Construct the buffer from a char* .44 // 45 explicitPj_String(char *str)43 // Construct the buffer from a char* (use with care) 44 // 45 Pj_String(char *str) 46 46 { 47 47 set(str); … … 51 51 // Construct from a const char*. 52 52 // 53 Pj_String(Pj_Pool *pool, const char *src)53 Pj_String(Pj_Pool &pool, const char *src) 54 54 { 55 55 set(pool, src); … … 57 57 58 58 // 59 // Construct from pj_str_t*. 60 // 61 explicit Pj_String(pj_str_t *s) 62 { 63 set(s); 59 // Construct from pj_str_t&. 60 // 61 explicit Pj_String(pj_str_t &s) 62 { 63 ptr = s.ptr; 64 slen = s.slen; 65 } 66 67 // 68 // Construct from const pj_str_t& (use with care!). 69 // 70 explicit Pj_String(const pj_str_t &s) 71 { 72 ptr = (char*)s.ptr; 73 slen = s.slen; 64 74 } 65 75 … … 67 77 // Construct by copying from const pj_str_t*. 68 78 // 69 Pj_String(Pj_Pool *pool, const pj_str_t *s)79 Pj_String(Pj_Pool &pool, const pj_str_t *s) 70 80 { 71 81 set(pool, s); … … 73 83 74 84 // 75 // Construct from another Pj_String76 //77 explicit Pj_String(Pj_String &rhs)78 {79 set(rhs);80 }81 82 //83 85 // Construct by copying from Pj_String 84 86 // 85 Pj_String(Pj_Pool *pool, const Pj_String &rhs)87 Pj_String(Pj_Pool &pool, const Pj_String &rhs) 86 88 { 87 89 set(pool, rhs); … … 89 91 90 92 // 93 // Construct from another Pj_String, use with care! 94 // 95 explicit Pj_String(const Pj_String &rhs) 96 { 97 ptr = rhs.ptr; 98 slen = rhs.slen; 99 } 100 101 // 91 102 // Construct from a char* and a length. 92 103 // … … 105 116 106 117 // 118 // You can cast Pj_String to pj_str_t* 119 // 120 operator pj_str_t*() 121 { 122 return this; 123 } 124 125 // 126 // You can cast const Pj_String to const pj_str_t* 127 // 128 operator const pj_str_t*() const 129 { 130 return this; 131 } 132 133 // 107 134 // Get the length of the string. 108 135 // … … 139 166 // Initialize by copying from a const char*. 140 167 // 141 void set(Pj_Pool *pool, const char *s)142 { 143 pj_strdup2(pool ->pool_(), this, s);168 void set(Pj_Pool &pool, const char *s) 169 { 170 pj_strdup2(pool, this, s); 144 171 } 145 172 … … 155 182 // Initialize by copying from const pj_str_t*. 156 183 // 157 void set(Pj_Pool *pool, const pj_str_t *s)158 { 159 pj_strdup(pool ->pool_(), this, s);184 void set(Pj_Pool &pool, const pj_str_t *s) 185 { 186 pj_strdup(pool, this, s); 160 187 } 161 188 … … 187 214 // Initialize by copying from a Pj_String*. 188 215 // 189 void set(Pj_Pool *pool, const Pj_String *s)190 { 191 pj_strdup(pool ->pool_(), this, s);216 void set(Pj_Pool &pool, const Pj_String *s) 217 { 218 pj_strdup(pool, this, s); 192 219 } 193 220 … … 195 222 // Initialize by copying from other Pj_String. 196 223 // 197 void set(Pj_Pool *pool, const Pj_String &s)198 { 199 pj_strdup(pool ->pool_(), this, &s);224 void set(Pj_Pool &pool, const Pj_String &s) 225 { 226 pj_strdup(pool, this, &s); 200 227 } 201 228 … … 354 381 355 382 /// 356 // Assign from another Pj_String 357 // 358 Pj_String& operator=(Pj_String &rhs) 359 { 360 set(rhs); 383 // Assign from another Pj_String, use with care! 384 // 385 Pj_String& operator=(const Pj_String &rhs) 386 { 387 ptr = rhs.ptr; 388 slen = rhs.slen; 361 389 return *this; 362 390 } -
pjproject/trunk/pjlib/include/pj++/types.hpp
r65 r127 157 157 }; 158 158 159 // 160 // Macro to declare common object comparison operators. 161 // 162 #define PJ_DECLARE_OPERATORS(rhs_type) \ 163 bool operator!=(rhs_type rhs) const { \ 164 return !operator==(rhs); } \ 165 bool operator<=(rhs_type rhs) const { \ 166 return operator<(rhs) || operator==(rhs); } \ 167 bool operator>(rhs_type rhs) const { \ 168 return !operator<=(rhs); } \ 169 bool operator>=(rhs_type rhs) const { \ 170 return !operator<(rhs); } 171 172 159 173 #endif /* __PJPP_TYPES_HPP__ */ 160 174 -
pjproject/trunk/pjlib/include/pj/assert.h
r106 r127 50 50 /** 51 51 * @hideinitializer 52 * If #PJ_ENABLE_EXTRA_CHECK is declared and non-zero, then52 * If #PJ_ENABLE_EXTRA_CHECK is declared and the value is non-zero, then 53 53 * #PJ_ASSERT_RETURN macro will evaluate the expression in @a expr during 54 54 * run-time. If the expression yields false, assertion will be triggered -
pjproject/trunk/pjlib/include/pj/hash.h
r66 r127 46 46 47 47 /** 48 * This indicates the size of of each hash entry. 49 */ 50 #define PJ_HASH_ENTRY_SIZE (3*sizeof(void*) + 2*sizeof(pj_uint32_t)) 51 52 /** 48 53 * This is the function that is used by the hash table to calculate hash value 49 54 * of the specified key. … … 93 98 * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the 94 99 * string length of the key. 100 * @param hval if this argument is not NULL and the value is not zero, 101 * the value will be used as the computed hash value. If 102 * the argument is not NULL and the value is zero, it will 103 * be filled with the computed hash upon return. 95 104 * 96 105 * @return the value associated with the key, or NULL if the key is not found. 97 106 */ 98 107 PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht, 99 const void *key, unsigned keylen ); 100 101 102 /** 103 * Associate/disassociate a value with the specified key. 108 const void *key, unsigned keylen, 109 pj_uint32_t *hval ); 110 111 112 /** 113 * Associate/disassociate a value with the specified key. If value is not 114 * NULL and entry already exists, the entry's value will be overwritten. 115 * If value is not NULL and entry does not exist, a new one will be created 116 * with the specified pool. Otherwise if value is NULL, entry will be 117 * deleted if it exists. 104 118 * 105 119 * @param pool the pool to allocate the new entry if a new entry has to be … … 109 123 * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the 110 124 * string length of the key. 125 * @param hval if the value is not zero, then the hash table will use 126 * this value to search the entry's index, otherwise it will 127 * compute the key. This value can be obtained when calling 128 * #pj_hash_get(). 111 129 * @param value value to be associated, or NULL to delete the entry with 112 130 * the specified key. 113 131 */ 114 132 PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 115 const void *key, unsigned keylen, 133 const void *key, unsigned keylen, pj_uint32_t hval, 116 134 void *value ); 135 136 137 /** 138 * Associate/disassociate a value with the specified key. This function works 139 * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no 140 * pool suffix). If new entry needs to be allocated, it will use the entry_buf. 141 * 142 * @param ht the hash table. 143 * @param key the key. 144 * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the 145 * string length of the key. 146 * @param hval if the value is not zero, then the hash table will use 147 * this value to search the entry's index, otherwise it will 148 * compute the key. This value can be obtained when calling 149 * #pj_hash_get(). 150 * @param entry_buf Pointer to buffer which will be used for the new entry, 151 * when one needs to be created. The buffer must be at least 152 * PJ_HASH_ENTRY_SIZE long, and the first PJ_HASH_ENTRY_SIZE 153 * bytes of the buffer will be used by the hash table. 154 * Application may use the remaining portion of the buffer 155 * for its own purpose. 156 * @param value value to be associated, or NULL to delete the entry with 157 * the specified key. 158 */ 159 PJ_DECL(void) pj_hash_set_np(pj_hash_table_t *ht, 160 const void *key, unsigned keylen, 161 pj_uint32_t hval, void *entry_buf, void *value); 117 162 118 163 /** -
pjproject/trunk/pjlib/src/pj/hash.c
r108 r127 23 23 #include <pj/os.h> 24 24 #include <pj/ctype.h> 25 #include <pj/assert.h> 25 26 26 27 /** … … 58 59 hash = hash * PJ_HASH_MULTIPLIER + *p; 59 60 } 60 keylen = p - (const unsigned char*)key;61 61 } else { 62 62 const unsigned char *p = key, … … 89 89 unsigned table_size; 90 90 91 /* Check that PJ_HASH_ENTRY_SIZE is correct. */ 92 PJ_ASSERT_RETURN(sizeof(pj_hash_entry)==PJ_HASH_ENTRY_SIZE, NULL); 93 91 94 h = pj_pool_alloc(pool, sizeof(pj_hash_table_t)); 92 95 h->count = 0; … … 111 114 static pj_hash_entry **find_entry( pj_pool_t *pool, pj_hash_table_t *ht, 112 115 const void *key, unsigned keylen, 113 void *val) 116 void *val, pj_uint32_t *hval, 117 void *entry_buf) 114 118 { 115 119 pj_uint32_t hash; 116 120 pj_hash_entry **p_entry, *entry; 117 121 118 hash=0; 119 if (keylen==PJ_HASH_KEY_STRING) { 120 const unsigned char *p = key; 121 for ( ; *p; ++p ) { 122 hash = hash * PJ_HASH_MULTIPLIER + *p; 123 } 124 keylen = p - (const unsigned char*)key; 122 if (hval && *hval != 0) { 123 hash = *hval; 125 124 } else { 126 const unsigned char *p = key, 127 *end = p + keylen; 128 for ( ; p!=end; ++p) { 129 hash = hash * PJ_HASH_MULTIPLIER + *p; 130 } 125 /* This slightly differs with pj_hash_calc() because we need 126 * to get the keylen when keylen is PJ_HASH_KEY_STRING. 127 */ 128 hash=0; 129 if (keylen==PJ_HASH_KEY_STRING) { 130 const unsigned char *p = key; 131 for ( ; *p; ++p ) { 132 hash = hash * PJ_HASH_MULTIPLIER + *p; 133 } 134 keylen = p - (const unsigned char*)key; 135 } else { 136 const unsigned char *p = key, 137 *end = p + keylen; 138 for ( ; p!=end; ++p) { 139 hash = hash * PJ_HASH_MULTIPLIER + *p; 140 } 141 } 142 143 /* Report back the computed hash. */ 144 if (hval) 145 *hval = hash; 131 146 } 132 147 … … 137 152 { 138 153 if (entry->hash==hash && entry->keylen==keylen && 139 memcmp(entry->key, key, keylen)==0)154 pj_memcmp(entry->key, key, keylen)==0) 140 155 { 141 156 break; … … 146 161 return p_entry; 147 162 148 /* create a new entry */ 149 entry = pj_pool_alloc(pool, sizeof(pj_hash_entry)); 150 PJ_LOG(6, ("hashtbl", "%p: New p_entry %p created, pool used=%u, cap=%u", ht, entry, 151 pj_pool_get_used_size(pool), pj_pool_get_capacity(pool))); 163 /* Entry not found, create a new one. 164 * If entry_buf is specified, use it. Otherwise allocate from pool. 165 */ 166 if (entry_buf) { 167 entry = entry_buf; 168 } else { 169 /* Pool must be specified! */ 170 PJ_ASSERT_RETURN(pool != NULL, NULL); 171 172 entry = pj_pool_alloc(pool, sizeof(pj_hash_entry)); 173 PJ_LOG(6, ("hashtbl", 174 "%p: New p_entry %p created, pool used=%u, cap=%u", 175 ht, entry, pj_pool_get_used_size(pool), 176 pj_pool_get_capacity(pool))); 177 } 152 178 entry->next = NULL; 153 179 entry->hash = hash; … … 163 189 164 190 PJ_DEF(void *) pj_hash_get( pj_hash_table_t *ht, 165 const void *key, unsigned keylen ) 191 const void *key, unsigned keylen, 192 pj_uint32_t *hval) 166 193 { 167 194 pj_hash_entry *entry; 168 entry = *find_entry( NULL, ht, key, keylen, NULL); 195 196 if (hval) *hval = 0; 197 entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL); 169 198 return entry ? entry->value : NULL; 170 199 } 171 200 172 201 PJ_DEF(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 173 const void *key, unsigned keylen, 202 const void *key, unsigned keylen, pj_uint32_t hval, 174 203 void *value ) 175 204 { 176 205 pj_hash_entry **p_entry; 177 206 178 p_entry = find_entry( pool, ht, key, keylen, value 207 p_entry = find_entry( pool, ht, key, keylen, value, &hval, NULL); 179 208 if (*p_entry) { 180 209 if (value == NULL) { … … 187 216 /* overwrite */ 188 217 (*p_entry)->value = value; 189 PJ_LOG(6, ("hashtbl", "%p: p_entry %p value set to %p", ht, *p_entry, value)); 218 PJ_LOG(6, ("hashtbl", "%p: p_entry %p value set to %p", ht, 219 *p_entry, value)); 220 } 221 } 222 } 223 224 PJ_DEF(void) pj_hash_set_np( pj_hash_table_t *ht, 225 const void *key, unsigned keylen, 226 pj_uint32_t hval, void *entry_buf, void *value) 227 { 228 pj_hash_entry **p_entry; 229 230 p_entry = find_entry( NULL, ht, key, keylen, value, &hval, entry_buf ); 231 if (*p_entry) { 232 if (value == NULL) { 233 /* delete entry */ 234 PJ_LOG(6, ("hashtbl", "%p: p_entry %p deleted", ht, *p_entry)); 235 *p_entry = (*p_entry)->next; 236 --ht->count; 237 238 } else { 239 /* overwrite */ 240 (*p_entry)->value = value; 241 PJ_LOG(6, ("hashtbl", "%p: p_entry %p value set to %p", ht, 242 *p_entry, value)); 190 243 } 191 244 } -
pjproject/trunk/pjsip/build/pjsip.dsw
r65 r127 5 5 6 6 Project: "pjlib"=..\..\pjlib\build\pjlib.dsp - Package Owner=<4> 7 8 Package=<5> 9 {{{ 10 }}} 11 12 Package=<4> 13 {{{ 14 }}} 15 16 ############################################################################### 17 18 Project: "pjlib++"="..\..\pjlib\build\pjlib++.dsp" - Package Owner=<4> 7 19 8 20 Package=<5> … … 29 41 30 42 Project: "pjmedia"=..\..\pjmedia\build\pjmedia.dsp - Package Owner=<4> 43 44 Package=<5> 45 {{{ 46 }}} 47 48 Package=<4> 49 {{{ 50 }}} 51 52 ############################################################################### 53 54 Project: "pjsip++"=".\pjsip++.dsp" - Package Owner=<4> 31 55 32 56 Package=<5> -
pjproject/trunk/pjsip/build/pjsip_core.dsp
r123 r127 86 86 87 87 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 88 # Begin Group "Base (.c)" 89 90 # PROP Default_Filter "" 91 # Begin Source File 92 93 SOURCE=..\src\pjsip\sip_errno.c 94 # End Source File 95 # End Group 96 # Begin Group "Messaging and Parsing (.c)" 97 98 # PROP Default_Filter "" 99 # Begin Source File 100 101 SOURCE=..\src\pjsip\sip_msg.c 102 # End Source File 103 # Begin Source File 104 105 SOURCE=..\src\pjsip\sip_parser.c 106 # End Source File 107 # Begin Source File 108 109 SOURCE=..\src\pjsip\sip_tel_uri.c 110 # End Source File 111 # Begin Source File 112 113 SOURCE=..\src\pjsip\sip_uri.c 114 # End Source File 115 # End Group 116 # Begin Group "Core (.c)" 117 118 # PROP Default_Filter "" 119 # Begin Source File 120 121 SOURCE=..\src\pjsip\sip_endpoint.c 122 # End Source File 123 # Begin Source File 124 125 SOURCE=..\src\pjsip\sip_util.c 126 # End Source File 127 # Begin Source File 128 129 SOURCE=..\src\pjsip\sip_util_proxy.c 130 # End Source File 131 # End Group 132 # Begin Group "Transport Layer (.c)" 133 134 # PROP Default_Filter "" 135 # Begin Source File 136 137 SOURCE=..\src\pjsip\sip_resolve.c 138 # End Source File 139 # Begin Source File 140 141 SOURCE=..\src\pjsip\sip_transport.c 142 # End Source File 143 # Begin Source File 144 145 SOURCE=..\src\pjsip\sip_transport_loop.c 146 # End Source File 147 # Begin Source File 148 149 SOURCE=..\src\pjsip\sip_transport_udp.c 150 # End Source File 151 # End Group 152 # Begin Group "Authentication (.c)" 153 154 # PROP Default_Filter "" 88 155 # Begin Source File 89 156 … … 102 169 SOURCE=..\src\pjsip\sip_auth_server.c 103 170 # End Source File 104 # Begin Source File 105 106 SOURCE=..\src\pjsip\sip_endpoint.c 107 # End Source File 108 # Begin Source File 109 110 SOURCE=..\src\pjsip\sip_errno.c 111 # End Source File 112 # Begin Source File 113 114 SOURCE=..\src\pjsip\sip_msg.c 115 # End Source File 116 # Begin Source File 117 118 SOURCE=..\src\pjsip\sip_parser.c 119 # End Source File 120 # Begin Source File 121 122 SOURCE=..\src\pjsip\sip_resolve.c 123 # End Source File 124 # Begin Source File 125 126 SOURCE=..\src\pjsip\sip_tel_uri.c 127 # End Source File 171 # End Group 172 # Begin Group "Transaction Layer (.c)" 173 174 # PROP Default_Filter "" 128 175 # Begin Source File 129 176 130 177 SOURCE=..\src\pjsip\sip_transaction.c 131 # End Source File132 # Begin Source File133 134 SOURCE=..\src\pjsip\sip_transport.c135 # End Source File136 # Begin Source File137 138 SOURCE=..\src\pjsip\sip_transport_loop.c139 # End Source File140 # Begin Source File141 142 SOURCE=..\src\pjsip\sip_transport_udp.c143 # End Source File144 # Begin Source File145 146 SOURCE=..\src\pjsip\sip_uri.c147 # End Source File148 # Begin Source File149 150 SOURCE=..\src\pjsip\sip_util.c151 # End Source File152 # Begin Source File153 154 SOURCE=..\src\pjsip\sip_util_proxy.c155 178 # End Source File 156 179 # Begin Source File … … 160 183 # End Source File 161 184 # End Group 185 # Begin Group "UA Layer (.c)" 186 187 # PROP Default_Filter "" 188 # Begin Source File 189 190 SOURCE=..\src\pjsip\sip_dialog.c 191 # End Source File 192 # Begin Source File 193 194 SOURCE=..\src\pjsip\sip_ua_layer.c 195 # End Source File 196 # End Group 197 # End Group 162 198 # Begin Group "Header Files" 163 199 164 200 # PROP Default_Filter "h;hpp;hxx;hm;inl" 165 # Begin Source File 166 167 SOURCE=..\include\pjsip_core.h 168 # End Source File 201 # Begin Group "Base Types (.h)" 202 203 # PROP Default_Filter "" 204 # Begin Source File 205 206 SOURCE=..\include\pjsip\sip_config.h 207 # End Source File 208 # Begin Source File 209 210 SOURCE=..\include\pjsip\sip_errno.h 211 # End Source File 212 # Begin Source File 213 214 SOURCE=..\include\pjsip\sip_private.h 215 # End Source File 216 # Begin Source File 217 218 SOURCE=..\include\pjsip\sip_types.h 219 # End Source File 220 # End Group 221 # Begin Group "Messaging and Parsing (.h)" 222 223 # PROP Default_Filter "" 169 224 # Begin Source File 170 225 … … 173 228 # Begin Source File 174 229 230 SOURCE=..\include\pjsip\sip_msg.h 231 # End Source File 232 # Begin Source File 233 234 SOURCE=..\include\pjsip\sip_parser.h 235 # End Source File 236 # Begin Source File 237 238 SOURCE=..\include\pjsip\sip_tel_uri.h 239 # End Source File 240 # Begin Source File 241 242 SOURCE=..\include\pjsip\sip_uri.h 243 # End Source File 244 # End Group 245 # Begin Group "Core (.h)" 246 247 # PROP Default_Filter "" 248 # Begin Source File 249 250 SOURCE=..\include\pjsip\sip_endpoint.h 251 # End Source File 252 # Begin Source File 253 254 SOURCE=..\include\pjsip\sip_event.h 255 # End Source File 256 # Begin Source File 257 258 SOURCE=..\include\pjsip\sip_module.h 259 # End Source File 260 # Begin Source File 261 262 SOURCE=..\include\pjsip\sip_util.h 263 # End Source File 264 # End Group 265 # Begin Group "Transport Layer (.h)" 266 267 # PROP Default_Filter "" 268 # Begin Source File 269 270 SOURCE=..\include\pjsip\sip_resolve.h 271 # End Source File 272 # Begin Source File 273 274 SOURCE=..\include\pjsip\sip_transport.h 275 # End Source File 276 # Begin Source File 277 278 SOURCE=..\include\pjsip\sip_transport_loop.h 279 # End Source File 280 # Begin Source File 281 282 SOURCE=..\include\pjsip\sip_transport_udp.h 283 # End Source File 284 # End Group 285 # Begin Group "Authentication (.h)" 286 287 # PROP Default_Filter "" 288 # Begin Source File 289 175 290 SOURCE=..\include\pjsip\sip_auth.h 176 291 # End Source File … … 183 298 SOURCE=..\include\pjsip\sip_auth_parser.h 184 299 # End Source File 185 # Begin Source File 186 187 SOURCE=..\include\pjsip\sip_config.h 188 # End Source File 189 # Begin Source File 190 191 SOURCE=..\include\pjsip\sip_endpoint.h 192 # End Source File 193 # Begin Source File 194 195 SOURCE=..\include\pjsip\sip_errno.h 196 # End Source File 197 # Begin Source File 198 199 SOURCE=..\include\pjsip\sip_event.h 200 # End Source File 201 # Begin Source File 202 203 SOURCE=..\include\pjsip\sip_module.h 204 # End Source File 205 # Begin Source File 206 207 SOURCE=..\include\pjsip\sip_msg.h 208 # End Source File 209 # Begin Source File 210 211 SOURCE=..\include\pjsip\sip_parser.h 212 # End Source File 213 # Begin Source File 214 215 SOURCE=..\include\pjsip\sip_private.h 216 # End Source File 217 # Begin Source File 218 219 SOURCE=..\include\pjsip\sip_resolve.h 220 # End Source File 221 # Begin Source File 222 223 SOURCE=..\include\pjsip\sip_tel_uri.h 224 # End Source File 300 # End Group 301 # Begin Group "Transaction Layer (.h)" 302 303 # PROP Default_Filter "" 225 304 # Begin Source File 226 305 227 306 SOURCE=..\include\pjsip\sip_transaction.h 228 307 # End Source File 229 # Begin Source File 230 231 SOURCE=..\include\pjsip\sip_transport.h 232 # End Source File 233 # Begin Source File 234 235 SOURCE=..\include\pjsip\sip_transport_loop.h 236 # End Source File 237 # Begin Source File 238 239 SOURCE=..\include\pjsip\sip_transport_udp.h 240 # End Source File 241 # Begin Source File 242 243 SOURCE=..\include\pjsip\sip_types.h 244 # End Source File 245 # Begin Source File 246 247 SOURCE=..\include\pjsip\sip_uri.h 248 # End Source File 249 # Begin Source File 250 251 SOURCE=..\include\pjsip\sip_util.h 308 # End Group 309 # Begin Group "UA Layer (.h)" 310 311 # PROP Default_Filter "" 312 # Begin Source File 313 314 SOURCE=..\include\pjsip\sip_dialog.h 315 # End Source File 316 # Begin Source File 317 318 SOURCE=..\include\pjsip\sip_ua_layer.h 319 # End Source File 320 # End Group 321 # Begin Source File 322 323 SOURCE=..\include\pjsip.h 252 324 # End Source File 253 325 # End Group -
pjproject/trunk/pjsip/build/pjsip_ua.dsp
r123 r127 88 88 # Begin Source File 89 89 90 SOURCE="..\src\pjsip-ua\sip_dialog.c" 91 # End Source File 92 # Begin Source File 90 SOURCE="..\src\pjsip-ua\sip_reg.c" 93 91 94 SOURCE="..\src\pjsip-ua\sip_reg.c" 95 # End Source File 96 # Begin Source File 92 !IF "$(CFG)" == "pjsip_ua - Win32 Release" 97 93 98 SOURCE="..\src\pjsip-ua\sip_ua.c" 99 # End Source File 100 # Begin Source File 94 !ELSEIF "$(CFG)" == "pjsip_ua - Win32 Debug" 101 95 102 SOURCE="..\src\pjsip-ua\sip_ua_private.h" 96 # PROP Exclude_From_Build 1 97 98 !ENDIF 99 103 100 # End Source File 104 101 # End Group … … 108 105 # Begin Source File 109 106 110 SOURCE="..\include\pjsip-ua\sip_dialog.h"111 # End Source File112 # Begin Source File113 114 107 SOURCE="..\include\pjsip-ua\sip_regc.h" 115 # End Source File116 # Begin Source File117 118 SOURCE="..\include\pjsip-ua\sip_ua.h"119 108 # End Source File 120 109 # End Group -
pjproject/trunk/pjsip/build/test_pjsip.dsp
r117 r127 90 90 # Begin Source File 91 91 92 SOURCE="..\src\test-pjsip\dlg_core_test.c" 93 # End Source File 94 # Begin Source File 95 92 96 SOURCE="..\src\test-pjsip\main.c" 93 97 # End Source File -
pjproject/trunk/pjsip/include/pjsip.h
r112 r127 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #ifndef __PJSIP_ CORE_H__20 #define __PJSIP_ CORE_H__19 #ifndef __PJSIP_H__ 20 #define __PJSIP_H__ 21 21 22 /* Base types. */ 22 23 #include <pjsip/sip_types.h> 23 #include <pjsip/sip_auth.h>24 #include <pjsip/sip_endpoint.h>25 24 #include <pjsip/sip_errno.h> 25 26 /* Messaging and parsing. */ 27 #include <pjsip/sip_uri.h> 28 #include <pjsip/sip_tel_uri.h> 29 #include <pjsip/sip_msg.h> 30 #include <pjsip/sip_parser.h> 31 32 /* Core */ 26 33 #include <pjsip/sip_event.h> 27 34 #include <pjsip/sip_module.h> 28 #include <pjsip/sip_msg.h> 29 #include <pjsip/sip_parser.h> 30 #include <pjsip/sip_resolve.h> 31 #include <pjsip/sip_tel_uri.h> 32 #include <pjsip/sip_transaction.h> 35 #include <pjsip/sip_endpoint.h> 36 #include <pjsip/sip_util.h> 37 38 /* Transport layer */ 33 39 #include <pjsip/sip_transport.h> 34 40 #include <pjsip/sip_transport_udp.h> 35 41 #include <pjsip/sip_transport_loop.h> 36 #include <pjsip/sip_uri.h> 37 #include <pjsip/sip_util.h> 42 #include <pjsip/sip_resolve.h> 38 43 39 #endif /* __PJSIP_CORE_H__ */ 44 /* Authentication. */ 45 #include <pjsip/sip_auth.h> 40 46 47 /* Transaction layer. */ 48 #include <pjsip/sip_transaction.h> 49 50 /* UA Layer. */ 51 #include <pjsip/sip_ua_layer.h> 52 #include <pjsip/sip_dialog.h> 53 54 55 #endif /* __PJSIP_H__ */ 56 -
pjproject/trunk/pjsip/include/pjsip/sip_auth.h
r123 r127 188 188 189 189 190 /** 191 * Clone client initialization session. 192 * 193 * @param pool Pool to use. 194 * @param sess Structure to put the duplicated session. 195 * @param rhs The client session to be cloned. 196 * 197 * @return PJ_SUCCESS on success; 198 */ 199 PJ_DECL(pj_status_t) pjsip_auth_clt_clone( pj_pool_t *pool, 200 pjsip_auth_clt_sess *sess, 201 const pjsip_auth_clt_sess *rhs); 190 202 191 203 /** -
pjproject/trunk/pjsip/include/pjsip/sip_config.h
r107 r127 53 53 #define PJSIP_POOL_TSX_INC 256 54 54 #define PJSIP_MAX_TSX_KEY_LEN (PJSIP_MAX_URL_SIZE*2) 55 56 /* User agent. */ 57 #define PJSIP_POOL_LEN_USER_AGENT 1024 58 #define PJSIP_POOL_INC_USER_AGENT 1024 55 59 56 60 /* Message/URL related constants. */ -
pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h
r107 r127 229 229 230 230 /** 231 * Find transaction in endpoint's transaction table by the transaction's key. 232 * This function normally is only used by modules. The key for a transaction 233 * can be created by calling #pjsip_tsx_create_key. 234 * 235 * @param endpt The endpoint instance. 236 * @param key Transaction key, as created with #pjsip_tsx_create_key. 237 * 238 * @return The transaction, or NULL if it's not found. 239 */ 240 PJ_DECL(pjsip_transaction*) pjsip_endpt_find_tsx( pjsip_endpoint *endpt, 241 const pj_str_t *key ); 242 243 /** 231 244 * Register the transaction to the endpoint's transaction table. 232 245 * Before the transaction is registered, it must have been initialized as … … 317 330 pjsip_transport **p_transport); 318 331 319 /** 320 * Get additional headers to be put in outgoing request message. 321 * This function is normally called by transaction layer when sending outgoing 322 * requests. 323 * 324 * @param endpt The endpoint. 325 * 326 * @return List of additional headers to be put in outgoing requests. 327 */ 328 PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_request_headers(pjsip_endpoint *endpt); 329 330 /** 331 * Get "Allow" header from endpoint. The endpoint builds the "Allow" header 332 * from the list of methods supported by modules. 333 * 334 * @param endpt The endpoint. 335 * 336 * @return "Allow" header, or NULL if endpoint doesn't have "Allow" header. 337 */ 338 PJ_DECL(const pjsip_allow_hdr*) pjsip_endpt_get_allow_hdr( pjsip_endpoint *endpt ); 339 340 341 /** 342 * Find transaction in endpoint's transaction table by the transaction's key. 343 * This function normally is only used by modules. The key for a transaction 344 * can be created by calling #pjsip_tsx_create_key. 345 * 346 * @param endpt The endpoint instance. 347 * @param key Transaction key, as created with #pjsip_tsx_create_key. 348 * 349 * @return The transaction, or NULL if it's not found. 350 */ 351 PJ_DECL(pjsip_transaction*) pjsip_endpt_find_tsx( pjsip_endpoint *endpt, 352 const pj_str_t *key ); 332 333 /***************************************************************************** 334 * 335 * Capabilities Management 336 * 337 * Modules may implement new capabilities to the stack. These capabilities 338 * are indicated by the appropriate SIP header fields, such as Accept, 339 * Accept-Encoding, Accept-Language, Allow, Supported, etc. 340 * 341 * When a module provides new capabilities to the stack, it registers these 342 * capabilities to the endpoint by supplying new tags (strings) to the 343 * appropriate header fields. Application (or other modules) can then query 344 * these header fields to get the list of supported capabilities, and may 345 * include these headers in the outgoing message. 346 ***************************************************************************** 347 */ 348 349 /** 350 * Get the value of the specified capability header field. 351 * 352 * @param endpt The endpoint. 353 * @param htype The header type to be retrieved, which value may be: 354 * - PJSIP_H_ACCEPT 355 * - PJSIP_H_ALLOW 356 * - PJSIP_H_SUPPORTED 357 * @param hname If htype specifies PJSIP_H_OTHER, then the header name 358 * must be supplied in this argument. Otherwise the value 359 * must be set to NULL. 360 * 361 * @return The appropriate header, or NULL if the header is not 362 * available. 363 */ 364 PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_capability( pjsip_endpoint *endpt, 365 int htype, 366 const pj_str_t *hname); 367 368 369 /** 370 * Add or register new capabilities as indicated by the tags to the 371 * appropriate header fields in the endpoint. 372 * 373 * @param endpt The endpoint. 374 * @param mod The module which registers the capability. 375 * @param htype The header type to be set, which value may be: 376 * - PJSIP_H_ACCEPT 377 * - PJSIP_H_ALLOW 378 * - PJSIP_H_SUPPORTED 379 * @param hname If htype specifies PJSIP_H_OTHER, then the header name 380 * must be supplied in this argument. Otherwise the value 381 * must be set to NULL. 382 * @param count The number of tags in the array. 383 * @param tags Array of tags describing the capabilities or extensions 384 * to be added to the appropriate header. 385 * 386 * @return PJ_SUCCESS on success. 387 */ 388 PJ_DECL(pj_status_t) pjsip_endpt_add_capability( pjsip_endpoint *endpt, 389 pjsip_module *mod, 390 int htype, 391 const pj_str_t *hname, 392 unsigned count, 393 const pj_str_t tags[]); 394 395 /** 396 * Get list of additional headers to be put in outgoing request message. 397 * 398 * @param e The endpoint. 399 * 400 * @return List of headers. 401 */ 402 PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_request_headers(pjsip_endpoint *e); 403 353 404 354 405 /** -
pjproject/trunk/pjsip/include/pjsip/sip_errno.h
r123 r127 141 141 /** 142 142 * @hideinitializer 143 * General Invalid URI error. 144 */ 145 #define PJSIP_EINVALIDURI (PJSIP_ERRNO_START_PJSIP + 39) /* 171039 */ 146 /** 147 * @hideinitializer 143 148 * Unsupported URL scheme. 144 149 */ … … 348 353 349 354 355 /************************************************************ 356 * UA AND DIALOG ERRORS 357 ***********************************************************/ 358 /** 359 * @hideinitializer 360 * Missing From/To tag. 361 */ 362 #define PJSIP_EMISSINGTAG (PJSIP_ERRNO_START_PJSIP+120) /* 171120 */ 363 364 365 350 366 PJ_END_DECL 351 367 -
pjproject/trunk/pjsip/include/pjsip/sip_module.h
r109 r127 25 25 */ 26 26 #include <pjsip/sip_types.h> 27 #include <pj/list.h> 27 28 28 29 PJ_BEGIN_DECL … … 67 68 */ 68 69 void *user_data; 69 70 /**71 * Number of methods supported by this module.72 */73 int method_cnt;74 75 /**76 * Array of methods supported by this module.77 */78 const pjsip_method *methods[8];79 70 80 71 /** -
pjproject/trunk/pjsip/include/pjsip/sip_msg.h
r119 r127 174 174 */ 175 175 PJSIP_H_ACCEPT, 176 PJSIP_H_ACCEPT_ENCODING_UNIMP, 177 PJSIP_H_ACCEPT_LANGUAGE_UNIMP, 178 PJSIP_H_ALERT_INFO_UNIMP, 176 PJSIP_H_ACCEPT_ENCODING_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 177 PJSIP_H_ACCEPT_LANGUAGE_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 178 PJSIP_H_ALERT_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 179 179 PJSIP_H_ALLOW, 180 PJSIP_H_AUTHENTICATION_INFO_UNIMP, 180 PJSIP_H_AUTHENTICATION_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 181 181 PJSIP_H_AUTHORIZATION, 182 182 PJSIP_H_CALL_ID, 183 PJSIP_H_CALL_INFO_UNIMP, 183 PJSIP_H_CALL_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 184 184 PJSIP_H_CONTACT, 185 PJSIP_H_CONTENT_DISPOSITION_UNIMP, 186 PJSIP_H_CONTENT_ENCODING_UNIMP, 187 PJSIP_H_CONTENT_LANGUAGE_UNIMP, 185 PJSIP_H_CONTENT_DISPOSITION_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 186 PJSIP_H_CONTENT_ENCODING_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 187 PJSIP_H_CONTENT_LANGUAGE_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 188 188 PJSIP_H_CONTENT_LENGTH, 189 189 PJSIP_H_CONTENT_TYPE, 190 190 PJSIP_H_CSEQ, 191 PJSIP_H_DATE_UNIMP, 192 PJSIP_H_ERROR_INFO_UNIMP, 191 PJSIP_H_DATE_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 192 PJSIP_H_ERROR_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 193 193 PJSIP_H_EXPIRES, 194 194 PJSIP_H_FROM, 195 PJSIP_H_IN_REPLY_TO_UNIMP, 195 PJSIP_H_IN_REPLY_TO_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 196 196 PJSIP_H_MAX_FORWARDS, 197 PJSIP_H_MIME_VERSION_UNIMP, 197 PJSIP_H_MIME_VERSION_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 198 198 PJSIP_H_MIN_EXPIRES, 199 PJSIP_H_ORGANIZATION_UNIMP, 200 PJSIP_H_PRIORITY_UNIMP, 199 PJSIP_H_ORGANIZATION_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 200 PJSIP_H_PRIORITY_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 201 201 PJSIP_H_PROXY_AUTHENTICATE, 202 202 PJSIP_H_PROXY_AUTHORIZATION, 203 PJSIP_H_PROXY_REQUIRE_UNIMP, 203 PJSIP_H_PROXY_REQUIRE_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 204 204 PJSIP_H_RECORD_ROUTE, 205 PJSIP_H_REPLY_TO_UNIMP, 205 PJSIP_H_REPLY_TO_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 206 206 PJSIP_H_REQUIRE, 207 207 PJSIP_H_RETRY_AFTER, 208 208 PJSIP_H_ROUTE, 209 PJSIP_H_SERVER_UNIMP, 210 PJSIP_H_SUBJECT_UNIMP, 209 PJSIP_H_SERVER_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 210 PJSIP_H_SUBJECT_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 211 211 PJSIP_H_SUPPORTED, 212 PJSIP_H_TIMESTAMP_UNIMP, 212 PJSIP_H_TIMESTAMP_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 213 213 PJSIP_H_TO, 214 214 PJSIP_H_UNSUPPORTED, 215 PJSIP_H_USER_AGENT_UNIMP, 215 PJSIP_H_USER_AGENT_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 216 216 PJSIP_H_VIA, 217 PJSIP_H_WARNING_UNIMP, 217 PJSIP_H_WARNING_UNIMP, /* N/A, use pjsip_generic_string_hdr */ 218 218 PJSIP_H_WWW_AUTHENTICATE, 219 219 … … 749 749 char *buf, pj_size_t size); 750 750 751 752 /* 753 * Some usefull macros to find common headers. 754 */ 755 756 757 /** 758 * Find Call-ID header. 759 * 760 * @param msg The message. 761 * @return Call-ID header instance. 762 */ 763 #define PJSIP_MSG_CID_HDR(msg) \ 764 ((pjsip_cid_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CALL_ID, NULL)) 765 766 /** 767 * Find CSeq header. 768 * 769 * @param msg The message. 770 * @return CSeq header instance. 771 */ 772 #define PJSIP_MSG_CSEQ_HDR(msg) \ 773 ((pjsip_cseq_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL)) 774 775 /** 776 * Find From header. 777 * 778 * @param msg The message. 779 * @return From header instance. 780 */ 781 #define PJSIP_MSG_FROM_HDR(msg) \ 782 ((pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL)) 783 784 /** 785 * Find To header. 786 * 787 * @param msg The message. 788 * @return To header instance. 789 */ 790 #define PJSIP_MSG_TO_HDR(msg) \ 791 ((pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL)) 792 793 751 794 /** 752 795 * @} … … 767 810 typedef struct pjsip_generic_string_hdr 768 811 { 769 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_string_hdr); /**< Standard header field. */ 770 pj_str_t hvalue; /**< hvalue */ 812 /** Standard header field. */ 813 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_string_hdr); 814 /** hvalue */ 815 pj_str_t hvalue; 771 816 } pjsip_generic_string_hdr; 772 817 … … 779 824 * @param hname The header name to be assigned to the header, or NULL to 780 825 * assign the header name with some string. 826 * @param hvalue Optional string to be assigned as the value. 781 827 * 782 828 * @return The header, or THROW exception. 783 829 */ 784 PJ_DECL(pjsip_generic_string_hdr*) pjsip_generic_string_hdr_create( pj_pool_t *pool,785 const pj_str_t *hname );786 787 /**788 * Create a generic header along with the text content.789 *790 * @param pool The pool.791 * @param hname The header name.792 * @param hvalue The header text content.793 *794 * @return The header instance.795 */796 830 PJ_DECL(pjsip_generic_string_hdr*) 797 pjsip_generic_string_hdr_create_with_text( pj_pool_t *pool, 798 const pj_str_t *hname, 799 const pj_str_t *hvalue); 831 pjsip_generic_string_hdr_create( pj_pool_t *pool, 832 const pj_str_t *hname, 833 const pj_str_t *hvalue); 834 835 /** 836 * Initialize a preallocated memory with the header structure. This function 837 * should only be called when application uses its own memory allocation to 838 * allocate memory block for the specified header (e.g. in C++, when the 839 * header is allocated with "new" operator). 840 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 841 * which allocates memory and initialize it in one go. 842 * 843 * @param pool Pool for additional memory allocation if required. 844 * @param mem Pre-allocated memory to be initialized as the header. 845 * @param hname The header name to be assigned to the header, or NULL to 846 * assign the header name with some string later. 847 * @param hvalue Optional string to be assigned as the value. 848 * 849 * @return The header instance, which points to the same memory 850 * location as the mem argument. 851 */ 852 PJ_DECL(pjsip_generic_string_hdr*) 853 pjsip_generic_string_hdr_init( pj_pool_t *pool, 854 void *mem, 855 const pj_str_t *hname, 856 const pj_str_t *hvalue); 857 800 858 801 859 /** … … 828 886 * @param hname The header name to be assigned to the header, or NULL to 829 887 * assign the header name with some string. 888 * @param hvalue The value to be assigned to the header. 830 889 * 831 890 * @return The header, or THROW exception. 832 891 */ 833 PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool, 834 const pj_str_t *hname ); 835 836 /** 837 * Create a generic header along with the value. 838 * 839 * @param pool The pool. 840 * @param hname The header name. 841 * @param value The header value content. 842 * 843 * @return The header instance. 844 */ 845 PJ_DECL(pjsip_generic_int_hdr*) 846 pjsip_generic_int_hdr_create_with_value( pj_pool_t *pool, 847 const pj_str_t *hname, 848 int value); 892 PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool, 893 const pj_str_t *hname, 894 int hvalue ); 895 896 897 /** 898 * Initialize a preallocated memory with the header structure. This function 899 * should only be called when application uses its own memory allocation to 900 * allocate memory block for the specified header (e.g. in C++, when the 901 * header is allocated with "new" operator). 902 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 903 * which allocates memory and initialize it in one go. 904 * 905 * @param pool Pool for additional memory allocation if required. 906 * @param mem Pre-allocated memory to be initialized as the header. 907 * @param hname The header name to be assigned to the header, or NULL to 908 * assign the header name with some string later. 909 * @param value Value to be assigned to the header. 910 * 911 * @return The header instance, which points to the same memory 912 * location as the mem argument. 913 */ 914 PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_init( pj_pool_t *pool, 915 void *mem, 916 const pj_str_t *hname, 917 int value ); 849 918 850 919 /** … … 874 943 * 875 944 * @param pool Pool to allocate memory from. 945 * @param hname Header name. 876 946 * 877 947 * @return New generic array header. 878 948 */ 879 PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_create(pj_pool_t *pool, 880 const pj_str_t *hnames); 949 PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_create(pj_pool_t *pool, 950 const pj_str_t *hname); 951 952 /** 953 * Initialize a preallocated memory with the header structure. This function 954 * should only be called when application uses its own memory allocation to 955 * allocate memory block for the specified header (e.g. in C++, when the 956 * header is allocated with "new" operator). 957 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 958 * which allocates memory and initialize it in one go. 959 * 960 * @param pool Pool for additional memory allocation if required. 961 * @param mem Pre-allocated memory to be initialized as the header. 962 * @param hname The header name to be assigned to the header, or NULL to 963 * assign the header name with some string later. 964 * 965 * @return The header instance, which points to the same memory 966 * location as the mem argument. 967 */ 968 PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_init(pj_pool_t *pool, 969 void *mem, 970 const pj_str_t *hname); 971 881 972 882 973 /** … … 906 997 PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool); 907 998 999 /** 1000 * Initialize a preallocated memory with the header structure. This function 1001 * should only be called when application uses its own memory allocation to 1002 * allocate memory block for the specified header (e.g. in C++, when the 1003 * header is allocated with "new" operator). 1004 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1005 * which allocates memory and initialize it in one go. 1006 * 1007 * @param pool Pool for additional memory allocation if required. 1008 * @param mem Pre-allocated memory to be initialized as the header. 1009 * 1010 * @return The header instance, which points to the same memory 1011 * location as the mem argument. 1012 */ 1013 PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_init( pj_pool_t *pool, 1014 void *mem ); 908 1015 909 1016 /** … … 929 1036 PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool); 930 1037 1038 1039 1040 /** 1041 * Initialize a preallocated memory with the header structure. This function 1042 * should only be called when application uses its own memory allocation to 1043 * allocate memory block for the specified header (e.g. in C++, when the 1044 * header is allocated with "new" operator). 1045 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1046 * which allocates memory and initialize it in one go. 1047 * 1048 * @param pool Pool for additional memory allocation if required. 1049 * @param mem Pre-allocated memory to be initialized as the header. 1050 * 1051 * @return The header instance, which points to the same memory 1052 * location as the mem argument. 1053 */ 1054 PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_init( pj_pool_t *pool, 1055 void *mem ); 931 1056 932 1057 /** … … 962 1087 963 1088 /** 1089 * Initialize a preallocated memory with the header structure. This function 1090 * should only be called when application uses its own memory allocation to 1091 * allocate memory block for the specified header (e.g. in C++, when the 1092 * header is allocated with "new" operator). 1093 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1094 * which allocates memory and initialize it in one go. 1095 * 1096 * @param pool Pool for additional memory allocation if required. 1097 * @param mem Pre-allocated memory to be initialized as the header. 1098 * 1099 * @return The header instance, which points to the same memory 1100 * location as the mem argument. 1101 */ 1102 PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_init( pj_pool_t *pool, 1103 void *mem ); 1104 1105 1106 /** 964 1107 * @} 965 1108 */ … … 988 1131 */ 989 1132 PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_create( pj_pool_t *pool ); 1133 1134 /** 1135 * Initialize a preallocated memory with the header structure. This function 1136 * should only be called when application uses its own memory allocation to 1137 * allocate memory block for the specified header (e.g. in C++, when the 1138 * header is allocated with "new" operator). 1139 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1140 * which allocates memory and initialize it in one go. 1141 * 1142 * @param pool Pool for additional memory allocation if required. 1143 * @param mem Pre-allocated memory to be initialized as the header. 1144 * 1145 * @return The header instance, which points to the same memory 1146 * location as the mem argument. 1147 */ 1148 PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_init( pj_pool_t *pool, 1149 void *mem ); 1150 990 1151 991 1152 /** … … 1017 1178 */ 1018 1179 PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_create( pj_pool_t *pool ); 1180 1181 /** 1182 * Initialize a preallocated memory with the header structure. This function 1183 * should only be called when application uses its own memory allocation to 1184 * allocate memory block for the specified header (e.g. in C++, when the 1185 * header is allocated with "new" operator). 1186 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1187 * which allocates memory and initialize it in one go. 1188 * 1189 * @param pool Pool for additional memory allocation if required. 1190 * @param mem Pre-allocated memory to be initialized as the header. 1191 * 1192 * @return The header instance, which points to the same memory 1193 * location as the mem argument. 1194 */ 1195 PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_init( pj_pool_t *pool, 1196 void *mem ); 1019 1197 1020 1198 /** … … 1055 1233 1056 1234 /** 1235 * Initialize a preallocated memory with the header structure. This function 1236 * should only be called when application uses its own memory allocation to 1237 * allocate memory block for the specified header (e.g. in C++, when the 1238 * header is allocated with "new" operator). 1239 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1240 * which allocates memory and initialize it in one go. 1241 * 1242 * @param pool Pool for additional memory allocation if required. 1243 * @param mem Pre-allocated memory to be initialized as the header. 1244 * 1245 * @return The header instance, which points to the same memory 1246 * location as the mem argument. 1247 */ 1248 PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_init( pj_pool_t *pool, 1249 void *mem ); 1250 1251 /** 1057 1252 * @} 1058 1253 */ … … 1084 1279 1085 1280 /** 1281 * Initialize a preallocated memory with the header structure. This function 1282 * should only be called when application uses its own memory allocation to 1283 * allocate memory block for the specified header (e.g. in C++, when the 1284 * header is allocated with "new" operator). 1285 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1286 * which allocates memory and initialize it in one go. 1287 * 1288 * @param pool Pool for additional memory allocation if required. 1289 * @param mem Pre-allocated memory to be initialized as the header. 1290 * 1291 * @return The header instance, which points to the same memory 1292 * location as the mem argument. 1293 */ 1294 PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_init( pj_pool_t *pool, 1295 void *mem ); 1296 1297 /** 1086 1298 * @} 1087 1299 */ … … 1100 1312 * Create a new Expires header. 1101 1313 * 1102 * @param pool The pool. 1103 * @return A new Expires header. 1104 */ 1105 PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool ); 1314 * @param pool The pool. 1315 * @param value The expiration value. 1316 * 1317 * @return A new Expires header. 1318 */ 1319 PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool, 1320 int value); 1321 1322 /** 1323 * Initialize a preallocated memory with the header structure. This function 1324 * should only be called when application uses its own memory allocation to 1325 * allocate memory block for the specified header (e.g. in C++, when the 1326 * header is allocated with "new" operator). 1327 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1328 * which allocates memory and initialize it in one go. 1329 * 1330 * @param pool Pool for additional memory allocation if required. 1331 * @param mem Pre-allocated memory to be initialized as the header. 1332 * @param value The expiration value. 1333 * 1334 * @return The header instance, which points to the same memory 1335 * location as the mem argument. 1336 */ 1337 PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool, 1338 void *mem, 1339 int value ); 1340 1106 1341 1107 1342 /** … … 1142 1377 1143 1378 /** 1379 * Initialize a preallocated memory with the header structure. This function 1380 * should only be called when application uses its own memory allocation to 1381 * allocate memory block for the specified header (e.g. in C++, when the 1382 * header is allocated with "new" operator). 1383 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1384 * which allocates memory and initialize it in one go. 1385 * 1386 * @param pool Pool for additional memory allocation if required. 1387 * @param mem Pre-allocated memory to be initialized as the header. 1388 * 1389 * @return The header instance, which points to the same memory 1390 * location as the mem argument. 1391 */ 1392 PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_init( pj_pool_t *pool, 1393 void *mem ); 1394 1395 /** 1144 1396 * Create a To header. 1145 1397 * … … 1150 1402 1151 1403 /** 1404 * Initialize a preallocated memory with the header structure. This function 1405 * should only be called when application uses its own memory allocation to 1406 * allocate memory block for the specified header (e.g. in C++, when the 1407 * header is allocated with "new" operator). 1408 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1409 * which allocates memory and initialize it in one go. 1410 * 1411 * @param pool Pool for additional memory allocation if required. 1412 * @param mem Pre-allocated memory to be initialized as the header. 1413 * 1414 * @return The header instance, which points to the same memory 1415 * location as the mem argument. 1416 */ 1417 PJ_DECL(pjsip_to_hdr*) pjsip_to_hdr_init( pj_pool_t *pool, 1418 void *mem ); 1419 1420 /** 1152 1421 * Convert the header to a From header. 1153 1422 * … … 1155 1424 * @return "From" header. 1156 1425 */ 1157 PJ_DECL(pjsip_from_hdr*) pjsip_fromto_ set_from( pjsip_fromto_hdr *hdr );1426 PJ_DECL(pjsip_from_hdr*) pjsip_fromto_hdr_set_from( pjsip_fromto_hdr *hdr ); 1158 1427 1159 1428 /** … … 1163 1432 * @return "To" header. 1164 1433 */ 1165 PJ_DECL(pjsip_to_hdr*) pjsip_fromto_ set_to( pjsip_fromto_hdr *hdr );1434 PJ_DECL(pjsip_to_hdr*) pjsip_fromto_hdr_set_to( pjsip_fromto_hdr *hdr ); 1166 1435 1167 1436 /** … … 1177 1446 * @{ 1178 1447 */ 1179 typedef pjsip_generic_int_hdr pjsip_max_f orwards_hdr;1448 typedef pjsip_generic_int_hdr pjsip_max_fwd_hdr; 1180 1449 1181 1450 /** … … 1183 1452 * 1184 1453 * @param pool The pool. 1454 * @param value The Max-Forwards value. 1185 1455 * 1186 1456 * @return New Max-Forwards header instance. 1187 1457 */ 1188 PJ_DECL(pjsip_max_forwards_hdr*) pjsip_max_forwards_hdr_create(pj_pool_t *pool); 1189 1458 PJ_DECL(pjsip_max_fwd_hdr*) 1459 pjsip_max_fwd_hdr_create(pj_pool_t *pool, int value); 1460 1461 1462 /** 1463 * Initialize a preallocated memory with the header structure. This function 1464 * should only be called when application uses its own memory allocation to 1465 * allocate memory block for the specified header (e.g. in C++, when the 1466 * header is allocated with "new" operator). 1467 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1468 * which allocates memory and initialize it in one go. 1469 * 1470 * @param pool Pool for additional memory allocation if required. 1471 * @param mem Pre-allocated memory to be initialized as the header. 1472 * @param value The Max-Forwards value. 1473 * 1474 * @return The header instance, which points to the same memory 1475 * location as the mem argument. 1476 */ 1477 PJ_DECL(pjsip_max_fwd_hdr*) 1478 pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, int value ); 1190 1479 1191 1480 /** … … 1204 1493 1205 1494 /** 1206 * Create new M ax-Forwards header instance.1495 * Create new Min-Expires header instance. 1207 1496 * 1208 1497 * @param pool The pool. 1209 * 1210 * @return New Max-Forwards header instance. 1211 */ 1212 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool); 1213 1498 * @param value The Min-Expires value. 1499 * 1500 * @return New Min-Expires header instance. 1501 */ 1502 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool, 1503 int value); 1504 1505 1506 /** 1507 * Initialize a preallocated memory with the header structure. This function 1508 * should only be called when application uses its own memory allocation to 1509 * allocate memory block for the specified header (e.g. in C++, when the 1510 * header is allocated with "new" operator). 1511 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1512 * which allocates memory and initialize it in one go. 1513 * 1514 * @param pool Pool for additional memory allocation if required. 1515 * @param mem Pre-allocated memory to be initialized as the header. 1516 * @param value The Min-Expires value. 1517 * 1518 * @return The header instance, which points to the same memory 1519 * location as the mem argument. 1520 */ 1521 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool, 1522 void *mem, 1523 int value ); 1214 1524 1215 1525 /** … … 1250 1560 PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_create( pj_pool_t *pool ); 1251 1561 1562 /** 1563 * Initialize a preallocated memory with the header structure. This function 1564 * should only be called when application uses its own memory allocation to 1565 * allocate memory block for the specified header (e.g. in C++, when the 1566 * header is allocated with "new" operator). 1567 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1568 * which allocates memory and initialize it in one go. 1569 * 1570 * @param pool Pool for additional memory allocation if required. 1571 * @param mem Pre-allocated memory to be initialized as the header. 1572 * 1573 * @return The header instance, which points to the same memory 1574 * location as the mem argument. 1575 */ 1576 PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_init( pj_pool_t *pool, 1577 void *mem ); 1578 1252 1579 /** 1253 1580 * Create new Route header from the pool. … … 1258 1585 PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_create( pj_pool_t *pool ); 1259 1586 1587 /** 1588 * Initialize a preallocated memory with the header structure. This function 1589 * should only be called when application uses its own memory allocation to 1590 * allocate memory block for the specified header (e.g. in C++, when the 1591 * header is allocated with "new" operator). 1592 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1593 * which allocates memory and initialize it in one go. 1594 * 1595 * @param pool Pool for additional memory allocation if required. 1596 * @param mem Pre-allocated memory to be initialized as the header. 1597 * 1598 * @return The header instance, which points to the same memory 1599 * location as the mem argument. 1600 */ 1601 PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_init( pj_pool_t *pool, 1602 void *mem ); 1603 1260 1604 /** 1261 1605 * Convert generic routing header to Record-Route header. … … 1296 1640 PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_create(pj_pool_t *pool); 1297 1641 1642 /** 1643 * Initialize a preallocated memory with the header structure. This function 1644 * should only be called when application uses its own memory allocation to 1645 * allocate memory block for the specified header (e.g. in C++, when the 1646 * header is allocated with "new" operator). 1647 * For normal applications, they should use pjsip_xxx_hdr_create() instead, 1648 * which allocates memory and initialize it in one go. 1649 * 1650 * @param pool Pool for additional memory allocation if required. 1651 * @param mem Pre-allocated memory to be initialized as the header. 1652 * 1653 * @return The header instance, which points to the same memory 1654 * location as the mem argument. 1655 */ 1656 PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_init( pj_pool_t *pool, 1657 void *mem ); 1298 1658 1299 1659 /** … … 1315 1675 * 1316 1676 * @param pool The pool. 1677 * @param value The Retry-After value. 1317 1678 * 1318 1679 * @return New Retry-After header instance. 1319 1680 */ 1320 PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool); 1681 PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool, 1682 int value); 1683 1684 /** 1685 * Initialize a preallocated memory with the header structure. 1686 * 1687 * @param pool Pool for additional memory allocation if required. 1688 * @param mem Pre-allocated memory to be initialized as the header. 1689 * @param value The Retry-After value. 1690 * 1691 * @return The header instance, which points to the same memory 1692 * location as the mem argument. 1693 */ 1694 PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_init( pj_pool_t *pool, 1695 void *mem, 1696 int value ); 1321 1697 1322 1698 … … 1343 1719 PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool); 1344 1720 1721 /** 1722 * Initialize a preallocated memory with the header structure. 1723 * 1724 * @param pool Pool for additional memory allocation if required. 1725 * @param mem Pre-allocated memory to be initialized as the header. 1726 * 1727 * @return The header instance, which points to the same memory 1728 * location as the mem argument. 1729 */ 1730 PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_init( pj_pool_t *pool, 1731 void *mem ); 1345 1732 1346 1733 /** … … 1366 1753 PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_create(pj_pool_t *pool); 1367 1754 1755 /** 1756 * Initialize a preallocated memory with the header structure. 1757 * 1758 * @param pool Pool for additional memory allocation if required. 1759 * @param mem Pre-allocated memory to be initialized as the header. 1760 * 1761 * @return The header instance, which points to the same memory 1762 * location as the mem argument. 1763 */ 1764 PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_init( pj_pool_t *pool, 1765 void *mem ); 1368 1766 1369 1767 /** … … 1409 1807 1410 1808 /** 1809 * Initialize a preallocated memory with the header structure. 1810 * 1811 * @param pool Pool for additional memory allocation if required. 1812 * @param mem Pre-allocated memory to be initialized as the header. 1813 * 1814 * @return The header instance, which points to the same memory 1815 * location as the mem argument. 1816 */ 1817 PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_init( pj_pool_t *pool, 1818 void *mem ); 1819 1820 /** 1411 1821 * @} 1412 1822 */ -
pjproject/trunk/pjsip/include/pjsip/sip_transaction.h
r115 r127 76 76 int cseq; /**< The CSeq */ 77 77 pj_str_t transaction_key;/**< Hash table key. */ 78 pj_uint32_t hashed_key; /**< Key's hashed value. */ 78 79 pj_str_t branch; /**< The branch Id. */ 79 80 -
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
r123 r127 68 68 69 69 /** 70 * Check if transport tp is secure. 71 */ 72 #define PJSIP_TRANSPORT_IS_SECURE(tp) \ 73 ((tp)->flag & PJSIP_TRANSPORT_SECURE) 74 75 /** 70 76 * Get the transport type from the transport name. 71 77 * … … 234 240 235 241 /** Max forwards header. */ 236 pjsip_max_f orwards_hdr *max_fwd;242 pjsip_max_fwd_hdr *max_fwd; 237 243 238 244 /** The first route header. */ -
pjproject/trunk/pjsip/include/pjsip/sip_types.h
r107 r127 103 103 104 104 /** 105 * Forward declaration for SIP method (sip_msg.h) 106 */ 107 typedef struct pjsip_method pjsip_method; 108 109 /** 105 110 * Opaque data type for the resolver engine (sip_resolve.h). 106 111 */ … … 117 122 */ 118 123 typedef struct pjsip_module pjsip_module; 124 125 126 /** 127 * Forward declaration for user agent type (sip_ua_layer.h). 128 */ 129 typedef pjsip_module pjsip_user_agent; 130 131 /** 132 * Forward declaration for dialog (sip_dialog.h). 133 */ 134 typedef struct pjsip_dialog pjsip_dialog; 135 119 136 120 137 /** -
pjproject/trunk/pjsip/include/pjsip/sip_uri.h
r119 r127 162 162 * @return the length printed. 163 163 */ 164 int(*p_print)(pjsip_uri_context_e context,165 166 char *buf, pj_size_t size);164 pj_ssize_t (*p_print)(pjsip_uri_context_e context, 165 const void *uri, 166 char *buf, pj_size_t size); 167 167 168 168 /** … … 333 333 * @return SIP URL. 334 334 */ 335 PJ_DECL(pjsip_sip_uri*) pjsip_ url_create( pj_pool_t *pool, int secure );335 PJ_DECL(pjsip_sip_uri*) pjsip_sip_uri_create( pj_pool_t *pool, int secure ); 336 336 337 337 /** … … 340 340 * @return SIPS URL. 341 341 */ 342 PJ_DECL(pjsip_sip_uri*) pjsip s_url_create( pj_pool_t *pool );342 PJ_DECL(pjsip_sip_uri*) pjsip_sips_uri_create( pj_pool_t *pool ); 343 343 344 344 /** … … 346 346 * @param url The URL. 347 347 */ 348 PJ_DECL(void) pjsip_ url_init(pjsip_sip_uri *url, int secure);348 PJ_DECL(void) pjsip_sip_uri_init(pjsip_sip_uri *url, int secure); 349 349 350 350 /** … … 354 354 * @param rhs The source URL. 355 355 */ 356 PJ_DECL(void) pjsip_ url_assign(pj_pool_t *pool, pjsip_sip_uri *url,357 const pjsip_sip_uri *rhs);356 PJ_DECL(void) pjsip_sip_uri_assign(pj_pool_t *pool, pjsip_sip_uri *url, 357 const pjsip_sip_uri *rhs); 358 358 359 359 /** -
pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c
r123 r127 349 349 sess->cred_info = NULL; 350 350 pj_list_init(&sess->cached_auth); 351 352 return PJ_SUCCESS; 353 } 354 355 356 /* Clone session. */ 357 PJ_DEF(pj_status_t) pjsip_auth_clt_clone( pj_pool_t *pool, 358 pjsip_auth_clt_sess *sess, 359 const pjsip_auth_clt_sess *rhs ) 360 { 361 unsigned i; 362 363 PJ_ASSERT_RETURN(pool && sess && rhs, PJ_EINVAL); 364 365 sess->pool = pool; 366 sess->endpt = (pjsip_endpoint*)rhs->endpt; 367 sess->cred_cnt = rhs->cred_cnt; 368 sess->cred_info = pj_pool_alloc(pool, 369 sess->cred_cnt*sizeof(pjsip_cred_info)); 370 for (i=0; i<rhs->cred_cnt; ++i) { 371 pj_strdup(pool, &sess->cred_info[i].realm, &rhs->cred_info[i].realm); 372 pj_strdup(pool, &sess->cred_info[i].scheme, &rhs->cred_info[i].scheme); 373 pj_strdup(pool, &sess->cred_info[i].username, 374 &rhs->cred_info[i].username); 375 sess->cred_info[i].data_type = rhs->cred_info[i].data_type; 376 pj_strdup(pool, &sess->cred_info[i].data, &rhs->cred_info[i].data); 377 } 378 379 /* TODO note: 380 * Cloning the full authentication client is quite a big task. 381 * We do only the necessary bits here, i.e. cloning the credentials. 382 * The drawback of this basic approach is, a forked dialog will have to 383 * re-authenticate itself on the next request because it has lost the 384 * cached authentication headers. 385 */ 386 PJ_TODO(FULL_CLONE_OF_AUTH_CLIENT_SESSION); 351 387 352 388 return PJ_SUCCESS; -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
r116 r127 78 78 pjsip_module module_list; 79 79 80 /** Number of supported methods. */81 unsigned method_cnt;82 83 /** Array of supported methods. */84 const pjsip_method *methods[MAX_METHODS];85 86 /** Allow header. */87 pjsip_allow_hdr *allow_hdr;88 89 80 /** Route header list. */ 90 81 pjsip_route_hdr route_hdr_list; 82 83 /** Capability header list. */ 84 pjsip_hdr cap_hdr; 91 85 92 86 /** Additional request headers. */ … … 197 191 198 192 /* Done. */ 199 PJ_TODO(BUILD_ALLOW_HEADER_BASED_ON_MODULES_SUPPORTED_METHODS);200 193 201 194 on_return: … … 249 242 status = PJ_SUCCESS; 250 243 251 PJ_TODO(REMOVE_METHODS_FROM_ALLOW_HEADER_WHEN_MODULE_IS_UNREGISTERED);252 253 244 on_return: 254 245 pj_rwmutex_unlock_write(endpt->mod_mutex); … … 256 247 } 257 248 258 /* 259 * Get "Allow" header. 260 */ 261 PJ_DEF(const pjsip_allow_hdr*) pjsip_endpt_get_allow_hdr( pjsip_endpoint *endpt ) 262 { 263 return endpt->allow_hdr; 249 250 /* 251 * Get the value of the specified capability header field. 252 */ 253 PJ_DEF(const pjsip_hdr*) pjsip_endpt_get_capability( pjsip_endpoint *endpt, 254 int htype, 255 const pj_str_t *hname) 256 { 257 pjsip_hdr *hdr = endpt->cap_hdr.next; 258 259 /* Check arguments. */ 260 PJ_ASSERT_RETURN(endpt != NULL, NULL); 261 PJ_ASSERT_RETURN(htype != PJSIP_H_OTHER || hname, NULL); 262 263 if (htype != PJSIP_H_OTHER) { 264 while (hdr != &endpt->cap_hdr) { 265 if (hdr->type == htype) 266 return hdr; 267 hdr = hdr->next; 268 } 269 } 270 return NULL; 271 } 272 273 274 /* 275 * Add or register new capabilities as indicated by the tags to the 276 * appropriate header fields in the endpoint. 277 */ 278 PJ_DEF(pj_status_t) pjsip_endpt_add_capability( pjsip_endpoint *endpt, 279 pjsip_module *mod, 280 int htype, 281 const pj_str_t *hname, 282 unsigned count, 283 const pj_str_t tags[]) 284 { 285 pjsip_generic_array_hdr *hdr; 286 unsigned i; 287 288 /* Check arguments. */ 289 PJ_ASSERT_RETURN(endpt!=NULL && mod!=NULL && count>0 && tags, PJ_EINVAL); 290 PJ_ASSERT_RETURN(htype==PJSIP_H_ACCEPT || 291 htype==PJSIP_H_ALLOW || 292 htype==PJSIP_H_SUPPORTED, 293 PJ_EINVAL); 294 295 /* Find the header. */ 296 hdr = (pjsip_generic_array_hdr*) pjsip_endpt_get_capability(endpt, 297 htype, hname); 298 299 /* Create the header when it's not present */ 300 if (hdr == NULL) { 301 switch (htype) { 302 case PJSIP_H_ACCEPT: 303 hdr = pjsip_accept_hdr_create(endpt->pool); 304 break; 305 case PJSIP_H_ALLOW: 306 hdr = pjsip_allow_hdr_create(endpt->pool); 307 break; 308 case PJSIP_H_SUPPORTED: 309 hdr = pjsip_supported_hdr_create(endpt->pool); 310 break; 311 default: 312 return PJ_EINVAL; 313 } 314 } 315 316 /* Add the tags to the header. */ 317 for (i=0; i<count; ++i) { 318 pj_strdup(endpt->pool, &hdr->values[hdr->count], &tags[i]); 319 ++hdr->count; 320 } 321 322 /* Done. */ 323 return PJ_SUCCESS; 264 324 } 265 325 … … 326 386 pj_pool_t *pool; 327 387 pjsip_endpoint *endpt; 328 pjsip_max_f orwards_hdr *mf_hdr;388 pjsip_max_fwd_hdr *mf_hdr; 329 389 pj_lock_t *lock = NULL; 330 390 … … 420 480 421 481 /* Add "Max-Forwards" for request header. */ 422 mf_hdr = pjsip_max_f orwards_hdr_create(endpt->pool);423 mf_hdr->ivalue = PJSIP_MAX_FORWARDS_VALUE;482 mf_hdr = pjsip_max_fwd_hdr_create(endpt->pool, 483 PJSIP_MAX_FORWARDS_VALUE); 424 484 pj_list_insert_before( &endpt->req_hdr, mf_hdr); 485 486 /* Initialize capability header list. */ 487 pj_list_init(&endpt->cap_hdr); 425 488 426 489 /* Done. */ -
pjproject/trunk/pjsip/src/pjsip/sip_errno.c
r123 r127 46 46 { PJSIP_EINVALIDSTATUS, "Invalid status code"}, 47 47 48 { PJSIP_EINVALIDURI, "Invalid URI" }, 48 49 { PJSIP_EINVALIDSCHEME, "Invalid URI scheme" }, 49 50 { PJSIP_EMISSINGREQURI, "Missing Request-URI" }, … … 78 79 { PJSIP_EAUTHACCDISABLED, "Account or credential is disabled" }, 79 80 { PJSIP_EAUTHINVALIDREALM, "Invalid authorization realm"}, 80 { PJSIP_EAUTHINVALIDDIGEST, "Invalid authorization digest" } 81 { PJSIP_EAUTHINVALIDDIGEST, "Invalid authorization digest" }, 82 83 /* UA/dialog layer. */ 84 { PJSIP_EMISSINGTAG, "Missing From/To tag parameter" } 81 85 }; 82 86 -
pjproject/trunk/pjsip/src/pjsip/sip_msg.c
r119 r127 499 499 }; 500 500 501 PJ_DEF(pjsip_generic_string_hdr*) pjsip_generic_string_hdr_create( pj_pool_t *pool, 502 const pj_str_t *hnames ) 503 { 504 pjsip_generic_string_hdr *hdr = pj_pool_alloc(pool, sizeof(pjsip_generic_string_hdr)); 501 PJ_DEF(pjsip_generic_string_hdr*) 502 pjsip_generic_string_hdr_init( pj_pool_t *pool, 503 void *mem, 504 const pj_str_t *hnames, 505 const pj_str_t *hvalue) 506 { 507 pjsip_generic_string_hdr *hdr = mem; 508 505 509 init_hdr(hdr, PJSIP_H_OTHER, &generic_hdr_vptr); 506 510 if (hnames) { … … 508 512 hdr->sname = hdr->name; 509 513 } 510 hdr->hvalue.ptr = NULL; 511 hdr->hvalue.slen = 0; 512 return hdr; 513 } 514 515 PJ_DEF(pjsip_generic_string_hdr*) pjsip_generic_string_hdr_create_with_text( pj_pool_t *pool, 516 const pj_str_t *hname, 517 const pj_str_t *hvalue) 518 { 519 pjsip_generic_string_hdr *hdr = pjsip_generic_string_hdr_create(pool, hname); 520 pj_strdup(pool, &hdr->hvalue, hvalue); 521 return hdr; 522 } 523 524 static int pjsip_generic_string_hdr_print( pjsip_generic_string_hdr *hdr, 525 char *buf, pj_size_t size) 514 if (hvalue) { 515 pj_strdup(pool, &hdr->hvalue, hvalue); 516 } else { 517 hdr->hvalue.ptr = NULL; 518 hdr->hvalue.slen = 0; 519 } 520 521 return hdr; 522 } 523 524 PJ_DEF(pjsip_generic_string_hdr*) 525 pjsip_generic_string_hdr_create( pj_pool_t *pool, 526 const pj_str_t *hnames, 527 const pj_str_t *hvalue) 528 { 529 void *mem = pj_pool_alloc(pool, sizeof(pjsip_generic_string_hdr)); 530 return pjsip_generic_string_hdr_init(pool, mem, hnames, hvalue); 531 } 532 533 static int pjsip_generic_string_hdr_print( pjsip_generic_string_hdr *hdr, 534 char *buf, pj_size_t size) 526 535 { 527 536 char *p = buf; … … 544 553 const pjsip_generic_string_hdr *rhs) 545 554 { 546 pjsip_generic_string_hdr *hdr = pjsip_generic_string_hdr_create(pool, &rhs->name); 555 pjsip_generic_string_hdr *hdr; 556 557 hdr = pjsip_generic_string_hdr_create(pool, &rhs->name, &rhs->hvalue); 547 558 548 559 hdr->type = rhs->type; 549 560 hdr->sname = hdr->name; 550 pj_strdup( pool, &hdr->hvalue, &rhs->hvalue);551 561 return hdr; 552 562 } … … 579 589 }; 580 590 581 PJ_DEF(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool, 582 const pj_str_t *hnames ) 583 { 584 pjsip_generic_int_hdr *hdr = pj_pool_alloc(pool, sizeof(pjsip_generic_int_hdr)); 591 PJ_DEF(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_init( pj_pool_t *pool, 592 void *mem, 593 const pj_str_t *hnames, 594 int value) 595 { 596 pjsip_generic_int_hdr *hdr = mem; 597 585 598 init_hdr(hdr, PJSIP_H_OTHER, &generic_int_hdr_vptr); 586 599 if (hnames) { … … 588 601 hdr->sname = hdr->name; 589 602 } 590 hdr->ivalue = 0;591 return hdr;592 }593 594 PJ_DEF(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create_with_value( pj_pool_t *pool,595 const pj_str_t *hname,596 int value)597 {598 pjsip_generic_int_hdr *hdr = pjsip_generic_int_hdr_create(pool, hname);599 603 hdr->ivalue = value; 600 604 return hdr; 605 } 606 607 PJ_DEF(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool, 608 const pj_str_t *hnames, 609 int value) 610 { 611 void *mem = pj_pool_alloc(pool, sizeof(pjsip_generic_int_hdr)); 612 return pjsip_generic_int_hdr_init(pool, mem, hnames, value); 601 613 } 602 614 … … 652 664 }; 653 665 654 PJ_DEF(pjsip_generic_array_hdr*) pjsip_generic_array_create( pj_pool_t *pool, 655 const pj_str_t *hnames) 656 { 657 pjsip_generic_array_hdr *hdr = pj_pool_alloc(pool, sizeof(pjsip_generic_array_hdr)); 666 667 PJ_DEF(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_init( pj_pool_t *pool, 668 void *mem, 669 const pj_str_t *hnames) 670 { 671 pjsip_generic_array_hdr *hdr = mem; 672 658 673 init_hdr(hdr, PJSIP_H_OTHER, &generic_array_hdr_vptr); 659 674 if (hnames) { … … 663 678 hdr->count = 0; 664 679 return hdr; 680 } 681 682 PJ_DEF(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_create( pj_pool_t *pool, 683 const pj_str_t *hnames) 684 { 685 void *mem = pj_pool_alloc(pool, sizeof(pjsip_generic_array_hdr)); 686 return pjsip_generic_array_hdr_init(pool, mem, hnames); 665 687 666 688 } … … 714 736 * Accept header. 715 737 */ 716 PJ_DEF(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool) 717 { 718 pjsip_accept_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 738 PJ_DEF(pjsip_accept_hdr*) pjsip_accept_hdr_init( pj_pool_t *pool, 739 void *mem ) 740 { 741 pjsip_accept_hdr *hdr = mem; 742 743 PJ_UNUSED_ARG(pool); 744 719 745 init_hdr(hdr, PJSIP_H_ACCEPT, &generic_array_hdr_vptr); 720 746 hdr->count = 0; … … 722 748 } 723 749 750 PJ_DEF(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool) 751 { 752 void *mem = pj_pool_alloc(pool, sizeof(pjsip_accept_hdr)); 753 return pjsip_accept_hdr_init(pool, mem); 754 } 755 724 756 725 757 /////////////////////////////////////////////////////////////////////////////// … … 728 760 */ 729 761 730 PJ_DEF(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool) 731 { 732 pjsip_allow_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 762 PJ_DEF(pjsip_allow_hdr*) pjsip_allow_hdr_init( pj_pool_t *pool, 763 void *mem ) 764 { 765 pjsip_allow_hdr *hdr = mem; 766 767 PJ_UNUSED_ARG(pool); 768 733 769 init_hdr(hdr, PJSIP_H_ALLOW, &generic_array_hdr_vptr); 734 770 hdr->count = 0; … … 736 772 } 737 773 774 PJ_DEF(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool) 775 { 776 void *mem = pj_pool_alloc(pool, sizeof(pjsip_allow_hdr)); 777 return pjsip_allow_hdr_init(pool, mem); 778 } 779 738 780 /////////////////////////////////////////////////////////////////////////////// 739 781 /* … … 741 783 */ 742 784 785 PJ_DEF(pjsip_cid_hdr*) pjsip_cid_hdr_init( pj_pool_t *pool, 786 void *mem ) 787 { 788 pjsip_cid_hdr *hdr = mem; 789 790 PJ_UNUSED_ARG(pool); 791 792 init_hdr(hdr, PJSIP_H_CALL_ID, &generic_hdr_vptr); 793 return hdr; 794 795 } 796 743 797 PJ_DEF(pjsip_cid_hdr*) pjsip_cid_hdr_create( pj_pool_t *pool ) 744 798 { 745 pjsip_cid_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 746 init_hdr(hdr, PJSIP_H_CALL_ID, &generic_hdr_vptr); 747 return hdr; 799 void *mem = pj_pool_alloc(pool, sizeof(pjsip_cid_hdr)); 800 return pjsip_cid_hdr_init(pool, mem); 748 801 } 749 802 … … 764 817 }; 765 818 766 PJ_DEF(pjsip_clen_hdr*) pjsip_clen_hdr_create( pj_pool_t *pool ) 767 { 768 pjsip_clen_hdr *hdr = pj_pool_alloc(pool, sizeof(pjsip_clen_hdr)); 819 PJ_DEF(pjsip_clen_hdr*) pjsip_clen_hdr_init( pj_pool_t *pool, 820 void *mem ) 821 { 822 pjsip_clen_hdr *hdr = mem; 823 824 PJ_UNUSED_ARG(pool); 825 769 826 init_hdr(hdr, PJSIP_H_CONTENT_LENGTH, &clen_hdr_vptr); 770 827 hdr->len = 0; 771 828 return hdr; 829 } 830 831 PJ_DEF(pjsip_clen_hdr*) pjsip_clen_hdr_create( pj_pool_t *pool ) 832 { 833 void *mem = pj_pool_alloc(pool, sizeof(pjsip_clen_hdr)); 834 return pjsip_clen_hdr_init(pool, mem); 772 835 } 773 836 … … 816 879 }; 817 880 818 PJ_DEF(pjsip_cseq_hdr*) pjsip_cseq_hdr_create( pj_pool_t *pool ) 819 { 820 pjsip_cseq_hdr *hdr = pj_pool_alloc(pool, sizeof(pjsip_cseq_hdr)); 881 PJ_DEF(pjsip_cseq_hdr*) pjsip_cseq_hdr_init( pj_pool_t *pool, 882 void *mem ) 883 { 884 pjsip_cseq_hdr *hdr = mem; 885 886 PJ_UNUSED_ARG(pool); 887 821 888 init_hdr(hdr, PJSIP_H_CSEQ, &cseq_hdr_vptr); 822 889 hdr->cseq = 0; … … 827 894 } 828 895 896 PJ_DEF(pjsip_cseq_hdr*) pjsip_cseq_hdr_create( pj_pool_t *pool ) 897 { 898 void *mem = pj_pool_alloc(pool, sizeof(pjsip_cseq_hdr)); 899 return pjsip_cseq_hdr_init(pool, mem); 900 } 901 829 902 static int pjsip_cseq_hdr_print( pjsip_cseq_hdr *hdr, char *buf, pj_size_t size) 830 903 { … … 885 958 }; 886 959 887 PJ_DEF(pjsip_contact_hdr*) pjsip_contact_hdr_create( pj_pool_t *pool ) 888 { 889 pjsip_contact_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 960 PJ_DEF(pjsip_contact_hdr*) pjsip_contact_hdr_init( pj_pool_t *pool, 961 void *mem ) 962 { 963 pjsip_contact_hdr *hdr = mem; 964 965 PJ_UNUSED_ARG(pool); 966 967 pj_memset(mem, 0, sizeof(pjsip_contact_hdr)); 890 968 init_hdr(hdr, PJSIP_H_CONTACT, &contact_hdr_vptr); 891 969 hdr->expires = -1; 892 970 pj_list_init(&hdr->other_param); 893 971 return hdr; 972 } 973 974 PJ_DEF(pjsip_contact_hdr*) pjsip_contact_hdr_create( pj_pool_t *pool ) 975 { 976 void *mem = pj_pool_alloc(pool, sizeof(pjsip_contact_hdr)); 977 return pjsip_contact_hdr_init(pool, mem); 894 978 } 895 979 … … 1003 1087 }; 1004 1088 1089 PJ_DEF(pjsip_ctype_hdr*) pjsip_ctype_hdr_init( pj_pool_t *pool, 1090 void *mem ) 1091 { 1092 pjsip_ctype_hdr *hdr = mem; 1093 1094 PJ_UNUSED_ARG(pool); 1095 1096 pj_memset(mem, 0, sizeof(pjsip_ctype_hdr)); 1097 init_hdr(hdr, PJSIP_H_CONTENT_TYPE, &ctype_hdr_vptr); 1098 return hdr; 1099 1100 } 1101 1005 1102 PJ_DEF(pjsip_ctype_hdr*) pjsip_ctype_hdr_create( pj_pool_t *pool ) 1006 1103 { 1007 pjsip_ctype_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1008 init_hdr(hdr, PJSIP_H_CONTENT_TYPE, &ctype_hdr_vptr); 1009 return hdr; 1104 void *mem = pj_pool_alloc(pool, sizeof(pjsip_ctype_hdr)); 1105 return pjsip_ctype_hdr_init(pool, mem); 1010 1106 } 1011 1107 … … 1067 1163 * Expires header. 1068 1164 */ 1069 PJ_DEF(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool ) 1070 { 1071 pjsip_expires_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1165 PJ_DEF(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool, 1166 void *mem, 1167 int value) 1168 { 1169 pjsip_expires_hdr *hdr = mem; 1170 1171 PJ_UNUSED_ARG(pool); 1172 1072 1173 init_hdr(hdr, PJSIP_H_EXPIRES, &generic_int_hdr_vptr); 1073 hdr->ivalue = 0; 1074 return hdr; 1174 hdr->ivalue = value; 1175 return hdr; 1176 1177 } 1178 1179 PJ_DEF(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool, 1180 int value ) 1181 { 1182 void *mem = pj_pool_alloc(pool, sizeof(pjsip_expires_hdr)); 1183 return pjsip_expires_hdr_init(pool, mem, value); 1075 1184 } 1076 1185 … … 1094 1203 }; 1095 1204 1096 PJ_DEF(pjsip_from_hdr*) pjsip_from_hdr_create( pj_pool_t *pool ) 1097 { 1098 pjsip_from_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1205 PJ_DEF(pjsip_from_hdr*) pjsip_from_hdr_init( pj_pool_t *pool, 1206 void *mem ) 1207 { 1208 pjsip_from_hdr *hdr = mem; 1209 1210 PJ_UNUSED_ARG(pool); 1211 1212 pj_memset(mem, 0, sizeof(pjsip_from_hdr)); 1099 1213 init_hdr(hdr, PJSIP_H_FROM, &fromto_hdr_vptr); 1100 1214 pj_list_init(&hdr->other_param); … … 1102 1216 } 1103 1217 1104 PJ_DEF(pjsip_to_hdr*) pjsip_to_hdr_create( pj_pool_t *pool ) 1105 { 1106 pjsip_to_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1218 PJ_DEF(pjsip_from_hdr*) pjsip_from_hdr_create( pj_pool_t *pool ) 1219 { 1220 void *mem = pj_pool_alloc(pool, sizeof(pjsip_from_hdr)); 1221 return pjsip_from_hdr_init(pool, mem); 1222 } 1223 1224 PJ_DEF(pjsip_to_hdr*) pjsip_to_hdr_init( pj_pool_t *pool, 1225 void *mem ) 1226 { 1227 pjsip_to_hdr *hdr = mem; 1228 1229 PJ_UNUSED_ARG(pool); 1230 1231 pj_memset(mem, 0, sizeof(pjsip_to_hdr)); 1107 1232 init_hdr(hdr, PJSIP_H_TO, &fromto_hdr_vptr); 1108 1233 pj_list_init(&hdr->other_param); 1109 1234 return hdr; 1110 } 1111 1112 PJ_DEF(pjsip_from_hdr*) pjsip_fromto_set_from( pjsip_fromto_hdr *hdr ) 1235 1236 } 1237 1238 PJ_DEF(pjsip_to_hdr*) pjsip_to_hdr_create( pj_pool_t *pool ) 1239 { 1240 void *mem = pj_pool_alloc(pool, sizeof(pjsip_to_hdr)); 1241 return pjsip_to_hdr_init(pool, mem); 1242 } 1243 1244 PJ_DEF(pjsip_from_hdr*) pjsip_fromto_hdr_set_from( pjsip_fromto_hdr *hdr ) 1113 1245 { 1114 1246 hdr->type = PJSIP_H_FROM; … … 1117 1249 } 1118 1250 1119 PJ_DEF(pjsip_to_hdr*) pjsip_fromto_ set_to( pjsip_fromto_hdr *hdr )1251 PJ_DEF(pjsip_to_hdr*) pjsip_fromto_hdr_set_to( pjsip_fromto_hdr *hdr ) 1120 1252 { 1121 1253 hdr->type = PJSIP_H_TO; … … 1184 1316 * Max-Forwards header. 1185 1317 */ 1186 PJ_DEF(pjsip_max_forwards_hdr*) pjsip_max_forwards_hdr_create(pj_pool_t *pool) 1187 { 1188 pjsip_max_forwards_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1318 PJ_DEF(pjsip_max_fwd_hdr*) pjsip_max_fwd_hdr_init( pj_pool_t *pool, 1319 void *mem, 1320 int value) 1321 { 1322 pjsip_max_fwd_hdr *hdr = mem; 1323 1324 PJ_UNUSED_ARG(pool); 1325 1189 1326 init_hdr(hdr, PJSIP_H_MAX_FORWARDS, &generic_int_hdr_vptr); 1190 hdr->ivalue = 0; 1191 return hdr; 1327 hdr->ivalue = value; 1328 return hdr; 1329 1330 } 1331 1332 PJ_DEF(pjsip_max_fwd_hdr*) pjsip_max_fwd_hdr_create(pj_pool_t *pool, 1333 int value) 1334 { 1335 void *mem = pj_pool_alloc(pool, sizeof(pjsip_max_fwd_hdr)); 1336 return pjsip_max_fwd_hdr_init(pool, mem, value); 1192 1337 } 1193 1338 … … 1197 1342 * Min-Expires header. 1198 1343 */ 1199 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool) 1200 { 1201 pjsip_min_expires_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1344 PJ_DEF(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool, 1345 void *mem, 1346 int value ) 1347 { 1348 pjsip_min_expires_hdr *hdr = mem; 1349 1350 PJ_UNUSED_ARG(pool); 1351 1202 1352 init_hdr(hdr, PJSIP_H_MIN_EXPIRES, &generic_int_hdr_vptr); 1203 hdr->ivalue = 0; 1204 return hdr; 1353 hdr->ivalue = value; 1354 return hdr; 1355 } 1356 1357 PJ_DEF(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool, 1358 int value ) 1359 { 1360 void *mem = pj_pool_alloc(pool, sizeof(pjsip_min_expires_hdr)); 1361 return pjsip_min_expires_hdr_init(pool, mem, value ); 1205 1362 } 1206 1363 … … 1220 1377 }; 1221 1378 1222 PJ_DEF(pjsip_rr_hdr*) pjsip_rr_hdr_create( pj_pool_t *pool ) 1223 { 1224 pjsip_rr_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1379 PJ_DEF(pjsip_rr_hdr*) pjsip_rr_hdr_init( pj_pool_t *pool, 1380 void *mem ) 1381 { 1382 pjsip_rr_hdr *hdr = mem; 1383 1384 PJ_UNUSED_ARG(pool); 1385 1225 1386 init_hdr(hdr, PJSIP_H_RECORD_ROUTE, &routing_hdr_vptr); 1226 1387 pjsip_name_addr_init(&hdr->name_addr); 1227 1388 pj_list_init(&hdr->other_param); 1228 1389 return hdr; 1229 } 1230 1231 PJ_DEF(pjsip_route_hdr*) pjsip_route_hdr_create( pj_pool_t *pool ) 1232 { 1233 pjsip_route_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1390 1391 } 1392 1393 PJ_DEF(pjsip_rr_hdr*) pjsip_rr_hdr_create( pj_pool_t *pool ) 1394 { 1395 void *mem = pj_pool_alloc(pool, sizeof(pjsip_rr_hdr)); 1396 return pjsip_rr_hdr_init(pool, mem); 1397 } 1398 1399 PJ_DEF(pjsip_route_hdr*) pjsip_route_hdr_init( pj_pool_t *pool, 1400 void *mem ) 1401 { 1402 pjsip_route_hdr *hdr = mem; 1403 1404 PJ_UNUSED_ARG(pool); 1405 1234 1406 init_hdr(hdr, PJSIP_H_ROUTE, &routing_hdr_vptr); 1235 1407 pjsip_name_addr_init(&hdr->name_addr); 1236 1408 pj_list_init(&hdr->other_param); 1237 1409 return hdr; 1410 } 1411 1412 PJ_DEF(pjsip_route_hdr*) pjsip_route_hdr_create( pj_pool_t *pool ) 1413 { 1414 void *mem = pj_pool_alloc(pool, sizeof(pjsip_route_hdr)); 1415 return pjsip_route_hdr_init(pool, mem); 1238 1416 } 1239 1417 … … 1305 1483 * Require header. 1306 1484 */ 1307 PJ_DEF(pjsip_require_hdr*) pjsip_require_hdr_create(pj_pool_t *pool) 1308 { 1309 pjsip_require_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1485 PJ_DEF(pjsip_require_hdr*) pjsip_require_hdr_init( pj_pool_t *pool, 1486 void *mem ) 1487 { 1488 pjsip_require_hdr *hdr = mem; 1489 1490 PJ_UNUSED_ARG(pool); 1491 1310 1492 init_hdr(hdr, PJSIP_H_REQUIRE, &generic_array_hdr_vptr); 1311 1493 hdr->count = 0; … … 1313 1495 } 1314 1496 1497 PJ_DEF(pjsip_require_hdr*) pjsip_require_hdr_create(pj_pool_t *pool) 1498 { 1499 void *mem = pj_pool_alloc(pool, sizeof(pjsip_require_hdr)); 1500 return pjsip_require_hdr_init(pool, mem); 1501 } 1502 1315 1503 /////////////////////////////////////////////////////////////////////////////// 1316 1504 /* 1317 1505 * Retry-After header. 1318 1506 */ 1319 PJ_DEF(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool) 1320 { 1321 pjsip_retry_after_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1507 PJ_DEF(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_init( pj_pool_t *pool, 1508 void *mem, 1509 int value ) 1510 { 1511 pjsip_retry_after_hdr *hdr = mem; 1512 1513 PJ_UNUSED_ARG(pool); 1514 1322 1515 init_hdr(hdr, PJSIP_H_RETRY_AFTER, &generic_int_hdr_vptr); 1323 hdr->ivalue = 0; 1324 return hdr; 1516 hdr->ivalue = value; 1517 return hdr; 1518 } 1519 1520 PJ_DEF(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool, 1521 int value ) 1522 { 1523 void *mem = pj_pool_alloc(pool, sizeof(pjsip_retry_after_hdr)); 1524 return pjsip_retry_after_hdr_init(pool, mem, value ); 1325 1525 } 1326 1526 … … 1330 1530 * Supported header. 1331 1531 */ 1332 PJ_DEF(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool) 1333 { 1334 pjsip_supported_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1532 PJ_DEF(pjsip_supported_hdr*) pjsip_supported_hdr_init( pj_pool_t *pool, 1533 void *mem ) 1534 { 1535 pjsip_supported_hdr *hdr = mem; 1536 1537 PJ_UNUSED_ARG(pool); 1335 1538 init_hdr(hdr, PJSIP_H_SUPPORTED, &generic_array_hdr_vptr); 1336 1539 hdr->count = 0; … … 1338 1541 } 1339 1542 1543 PJ_DEF(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool) 1544 { 1545 void *mem = pj_pool_alloc(pool, sizeof(pjsip_supported_hdr)); 1546 return pjsip_supported_hdr_init(pool, mem); 1547 } 1548 1340 1549 1341 1550 /////////////////////////////////////////////////////////////////////////////// … … 1343 1552 * Unsupported header. 1344 1553 */ 1345 PJ_DEF(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_create(pj_pool_t *pool) 1346 { 1347 pjsip_unsupported_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1554 PJ_DEF(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_init( pj_pool_t *pool, 1555 void *mem ) 1556 { 1557 pjsip_unsupported_hdr *hdr = mem; 1558 1559 PJ_UNUSED_ARG(pool); 1560 1348 1561 init_hdr(hdr, PJSIP_H_UNSUPPORTED, &generic_array_hdr_vptr); 1349 1562 hdr->count = 0; 1350 1563 return hdr; 1564 } 1565 1566 PJ_DEF(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_create(pj_pool_t *pool) 1567 { 1568 void *mem = pj_pool_alloc(pool, sizeof(pjsip_unsupported_hdr)); 1569 return pjsip_unsupported_hdr_init(pool, mem); 1351 1570 } 1352 1571 … … 1366 1585 }; 1367 1586 1368 PJ_DEF(pjsip_via_hdr*) pjsip_via_hdr_create( pj_pool_t *pool ) 1369 { 1370 pjsip_via_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1587 PJ_DEF(pjsip_via_hdr*) pjsip_via_hdr_init( pj_pool_t *pool, 1588 void *mem ) 1589 { 1590 pjsip_via_hdr *hdr = mem; 1591 1592 PJ_UNUSED_ARG(pool); 1593 1594 pj_memset(mem, 0, sizeof(pjsip_via_hdr)); 1371 1595 init_hdr(hdr, PJSIP_H_VIA, &via_hdr_vptr); 1372 //hdr->sent_by.port = 5060;1373 1596 hdr->ttl_param = -1; 1374 1597 hdr->rport_param = -1; 1375 1598 pj_list_init(&hdr->other_param); 1376 1599 return hdr; 1600 1601 } 1602 1603 PJ_DEF(pjsip_via_hdr*) pjsip_via_hdr_create( pj_pool_t *pool ) 1604 { 1605 void *mem = pj_pool_alloc(pool, sizeof(pjsip_via_hdr)); 1606 return pjsip_via_hdr_init(pool, mem); 1377 1607 } 1378 1608 -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r123 r127 1168 1168 1169 1169 if (parser_stricmp(scheme, pjsip_SIP_STR)==0) { 1170 url = pjsip_ url_create(pool, 0);1170 url = pjsip_sip_uri_create(pool, 0); 1171 1171 1172 1172 } else if (parser_stricmp(scheme, pjsip_SIPS_STR)==0) { 1173 url = pjsip_ url_create(pool, 1);1173 url = pjsip_sip_uri_create(pool, 1); 1174 1174 1175 1175 } else { … … 1542 1542 static pjsip_hdr* parse_hdr_expires(pjsip_parse_ctx *ctx) 1543 1543 { 1544 pjsip_expires_hdr *hdr = pjsip_expires_hdr_create(ctx->pool );1544 pjsip_expires_hdr *hdr = pjsip_expires_hdr_create(ctx->pool, 0); 1545 1545 parse_generic_int_hdr(hdr, ctx->scanner); 1546 1546 return (pjsip_hdr*)hdr; … … 1602 1602 { 1603 1603 pjsip_retry_after_hdr *hdr; 1604 hdr = pjsip_retry_after_hdr_create(ctx->pool );1604 hdr = pjsip_retry_after_hdr_create(ctx->pool, 0); 1605 1605 parse_generic_int_hdr(hdr, ctx->scanner); 1606 1606 return (pjsip_hdr*)hdr; … … 1674 1674 static pjsip_hdr* parse_hdr_max_forwards( pjsip_parse_ctx *ctx ) 1675 1675 { 1676 pjsip_max_f orwards_hdr *hdr;1677 hdr = pjsip_max_f orwards_hdr_create(ctx->pool);1676 pjsip_max_fwd_hdr *hdr; 1677 hdr = pjsip_max_fwd_hdr_create(ctx->pool, 0); 1678 1678 parse_generic_int_hdr(hdr, ctx->scanner); 1679 1679 … … 1688 1688 { 1689 1689 pjsip_min_expires_hdr *hdr; 1690 hdr = pjsip_min_expires_hdr_create(ctx->pool );1690 hdr = pjsip_min_expires_hdr_create(ctx->pool, 0); 1691 1691 parse_generic_int_hdr(hdr, ctx->scanner); 1692 1692 return (pjsip_hdr*)hdr; … … 1821 1821 pjsip_generic_string_hdr *hdr; 1822 1822 1823 hdr = pjsip_generic_string_hdr_create(ctx->pool, NULL );1823 hdr = pjsip_generic_string_hdr_create(ctx->pool, NULL, NULL); 1824 1824 parse_generic_string_hdr(hdr, ctx->scanner); 1825 1825 return (pjsip_hdr*)hdr; -
pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c
r82 r127 65 65 static const pj_str_t *tel_uri_get_scheme( const pjsip_tel_uri* ); 66 66 static void *tel_uri_get_uri( pjsip_tel_uri* ); 67 static int tel_uri_print( pjsip_uri_context_e context,68 69 67 static pj_ssize_t tel_uri_print( pjsip_uri_context_e context, 68 const pjsip_tel_uri *url, 69 char *buf, pj_size_t size); 70 70 static int tel_uri_cmp( pjsip_uri_context_e context, 71 71 const pjsip_tel_uri *url1, const pjsip_tel_uri *url2); … … 165 165 166 166 /* Print tel: URI */ 167 static int tel_uri_print( pjsip_uri_context_e context,168 169 167 static pj_ssize_t tel_uri_print( pjsip_uri_context_e context, 168 const pjsip_tel_uri *uri, 169 char *buf, pj_size_t size) 170 170 { 171 171 int printed; -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r123 r127 62 62 PJSIP_MOD_PRIORITY_TSX_LAYER, /* Priority. */ 63 63 NULL, /* User_data. */ 64 0, /* Methods count. */65 { NULL }, /* Array of methods. */66 64 mod_tsx_layer_load, /* load(). */ 67 65 mod_tsx_layer_start, /* start() */ … … 508 506 509 507 /* Check if no transaction with the same key exists. */ 510 if (pj_hash_get( mod_tsx_layer.htable, &tsx->transaction_key.ptr, 511 tsx->transaction_key.slen) != NULL) 512 { 513 pj_mutex_unlock(mod_tsx_layer.mutex); 514 return PJ_EEXISTS; 515 } 508 PJ_ASSERT_ON_FAIL(pj_hash_get( mod_tsx_layer.htable, 509 &tsx->transaction_key.ptr, 510 tsx->transaction_key.slen, 511 &tsx->hashed_key) == NULL, 512 { 513 pj_mutex_unlock(mod_tsx_layer.mutex); 514 return PJ_EEXISTS; 515 } 516 ); 516 517 517 518 /* Register the transaction to the hash table. */ 518 519 pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr, 519 tsx->transaction_key.slen, tsx );520 tsx->transaction_key.slen, tsx->hashed_key, tsx); 520 521 521 522 /* Unlock mutex. */ … … 539 540 /* Register the transaction to the hash table. */ 540 541 pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, 541 tsx->transaction_key.slen, NULL);542 tsx->transaction_key.slen, tsx->hashed_key, NULL); 542 543 543 544 /* Unlock mutex. */ … … 555 556 556 557 pj_mutex_lock(mod_tsx_layer.mutex); 557 tsx = pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen );558 tsx = pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen, NULL ); 558 559 pj_mutex_unlock(mod_tsx_layer.mutex); 559 560 … … 649 650 pj_mutex_lock( mod_tsx_layer.mutex ); 650 651 651 tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen );652 tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, NULL ); 652 653 653 654 if (tsx == NULL || tsx->state == PJSIP_TSX_STATE_TERMINATED) { … … 690 691 pj_mutex_lock( mod_tsx_layer.mutex ); 691 692 692 tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen );693 tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, NULL ); 693 694 694 695 if (tsx == NULL || tsx->state == PJSIP_TSX_STATE_TERMINATED) { … … 1036 1037 &via->branch_param); 1037 1038 1039 /* Calculate hashed key value. */ 1040 tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 1041 tsx->transaction_key.slen); 1042 1038 1043 PJ_LOG(6, (tsx->obj_name, "tsx_key=%.*s", tsx->transaction_key.slen, 1039 1044 tsx->transaction_key.ptr)); … … 1141 1146 } 1142 1147 1148 /* Calculate hashed key value. */ 1149 tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 1150 tsx->transaction_key.slen); 1151 1143 1152 /* Duplicate branch parameter for transaction. */ 1144 1153 branch = &rdata->msg_info.via->branch_param; … … 1179 1188 return status; 1180 1189 } 1190 1191 /* Put this transaction in rdata's mod_data. */ 1192 rdata->endpt_info.mod_data[mod_tsx_layer.mod.id] = tsx; 1181 1193 1182 1194 /* Unlock transaction and return. */ -
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r123 r127 44 44 static pjsip_module mod_msg_print = 45 45 { 46 NULL, NULL, /* prev and next */ 47 { "mod-msg-print", 13}, /* Name. */ 48 -1, /* Id */ 49 PJSIP_MOD_PRIORITY_TRANSPORT_LAYER, /* Priority */ 50 NULL, /* User data. */ 51 0, /* Number of methods supported (=0). */ 52 { 0 }, /* Array of methods (none) */ 53 NULL, /* load() */ 54 NULL, /* start() */ 55 NULL, /* stop() */ 56 NULL, /* unload() */ 57 NULL, /* on_rx_request() */ 58 NULL, /* on_rx_response() */ 59 &mod_on_tx_msg, /* on_tx_request() */ 60 &mod_on_tx_msg, /* on_tx_response() */ 61 NULL, /* on_tsx_state() */ 46 NULL, NULL, /* prev and next */ 47 { "mod-msg-print", 13}, /* Name. */ 48 -1, /* Id */ 49 PJSIP_MOD_PRIORITY_TRANSPORT_LAYER, /* Priority */ 50 NULL, /* User data. */ 51 NULL, /* load() */ 52 NULL, /* start() */ 53 NULL, /* stop() */ 54 NULL, /* unload() */ 55 NULL, /* on_rx_request() */ 56 NULL, /* on_rx_response() */ 57 &mod_on_tx_msg, /* on_tx_request() */ 58 &mod_on_tx_msg, /* on_tx_response() */ 59 NULL, /* on_tsx_state() */ 62 60 }; 63 61 … … 349 347 350 348 if (tdata==NULL || tdata->msg==NULL) 351 return " INVALID MSG";349 return "NULL"; 352 350 353 351 if (tdata->info) … … 590 588 key_len = sizeof(tp->key.type) + tp->addr_len; 591 589 pj_lock_acquire(mgr->lock); 592 pj_hash_set(tp->pool, mgr->table, &tp->key, key_len, tp);590 pj_hash_set(tp->pool, mgr->table, &tp->key, key_len, 0, tp); 593 591 pj_lock_release(mgr->lock); 594 592 … … 618 616 */ 619 617 key_len = sizeof(tp->key.type) + tp->addr_len; 620 pj_hash_set(tp->pool, mgr->table, &tp->key, key_len, NULL);618 pj_hash_set(tp->pool, mgr->table, &tp->key, key_len, 0, NULL); 621 619 622 620 pj_lock_release(mgr->lock); … … 879 877 880 878 /* Perform basic header checking. */ 881 if (rdata->msg_info.cid->id.ptr == NULL || 879 if (rdata->msg_info.cid == NULL || 880 rdata->msg_info.cid->id.slen == 0 || 882 881 rdata->msg_info.from == NULL || 883 882 rdata->msg_info.to == NULL || … … 962 961 pj_memcpy(&key.addr, remote, addr_len); 963 962 964 transport = pj_hash_get(mgr->table, &key, key_len );963 transport = pj_hash_get(mgr->table, &key, key_len, NULL); 965 964 if (transport == NULL) { 966 965 unsigned flag = pjsip_transport_get_flag_from_type(type); … … 975 974 pj_memset(addr, 0, sizeof(pj_sockaddr_in)); 976 975 key_len = sizeof(key.type) + sizeof(pj_sockaddr_in); 977 transport = pj_hash_get(mgr->table, &key, key_len );976 transport = pj_hash_get(mgr->table, &key, key_len, NULL); 978 977 } 979 978 /* For datagram INET transports, try lookup with zero address. … … 988 987 989 988 key_len = sizeof(key.type) + sizeof(pj_sockaddr_in); 990 transport = pj_hash_get(mgr->table, &key, key_len );989 transport = pj_hash_get(mgr->table, &key, key_len, NULL); 991 990 } 992 991 } -
pjproject/trunk/pjsip/src/pjsip/sip_uri.c
r119 r127 141 141 static pjsip_name_addr* pjsip_name_addr_clone( pj_pool_t *pool, 142 142 const pjsip_name_addr *rhs); 143 static int pjsip_name_addr_print(pjsip_uri_context_e context,144 145 143 static pj_ssize_t pjsip_name_addr_print(pjsip_uri_context_e context, 144 const pjsip_name_addr *name, 145 char *buf, pj_size_t size); 146 146 static int pjsip_name_addr_compare( pjsip_uri_context_e context, 147 147 const pjsip_name_addr *naddr1, 148 148 const pjsip_name_addr *naddr2); 149 static int pjsip_url_print( pjsip_uri_context_e context,150 151 149 static pj_ssize_t pjsip_url_print( pjsip_uri_context_e context, 150 const pjsip_sip_uri *url, 151 char *buf, pj_size_t size); 152 152 static int pjsip_url_compare( pjsip_uri_context_e context, 153 153 const pjsip_sip_uri *url1, … … 205 205 } 206 206 207 PJ_DEF(void) pjsip_ url_init(pjsip_sip_uri *url, int secure)207 PJ_DEF(void) pjsip_sip_uri_init(pjsip_sip_uri *url, int secure) 208 208 { 209 209 pj_memset(url, 0, sizeof(*url)); … … 214 214 } 215 215 216 PJ_DEF(pjsip_sip_uri*) pjsip_ url_create( pj_pool_t *pool, int secure )216 PJ_DEF(pjsip_sip_uri*) pjsip_sip_uri_create( pj_pool_t *pool, int secure ) 217 217 { 218 218 pjsip_sip_uri *url = pj_pool_alloc(pool, sizeof(pjsip_sip_uri)); 219 pjsip_ url_init(url, secure);219 pjsip_sip_uri_init(url, secure); 220 220 return url; 221 221 } 222 222 223 static int pjsip_url_print( pjsip_uri_context_e context,224 225 223 static pj_ssize_t pjsip_url_print( pjsip_uri_context_e context, 224 const pjsip_sip_uri *url, 225 char *buf, pj_size_t size) 226 226 { 227 227 int printed; … … 466 466 467 467 468 PJ_DEF(void) pjsip_ url_assign(pj_pool_t *pool, pjsip_sip_uri *url,469 468 PJ_DEF(void) pjsip_sip_uri_assign(pj_pool_t *pool, pjsip_sip_uri *url, 469 const pjsip_sip_uri *rhs) 470 470 { 471 471 pj_strdup( pool, &url->user, &rhs->user); … … 489 489 return NULL; 490 490 491 pjsip_ url_init(url, IS_SIPS(rhs));492 pjsip_ url_assign(pool, url, rhs);491 pjsip_sip_uri_init(url, IS_SIPS(rhs)); 492 pjsip_sip_uri_assign(pool, url, rhs); 493 493 return url; 494 494 } … … 514 514 } 515 515 516 static int pjsip_name_addr_print(pjsip_uri_context_e context,517 518 516 static pj_ssize_t pjsip_name_addr_print(pjsip_uri_context_e context, 517 const pjsip_name_addr *name, 518 char *buf, pj_size_t size) 519 519 { 520 520 int printed; -
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r123 r127 129 129 pjsip_generic_string_hdr *hdr; 130 130 131 hdr = pjsip_generic_string_hdr_create _with_text(tdata->pool,132 133 131 hdr = pjsip_generic_string_hdr_create(tdata->pool, 132 &hparam->name, 133 &hparam->value); 134 134 pjsip_msg_add_hdr(msg, (pjsip_hdr*)hdr); 135 135 hparam = hparam->next; … … 303 303 target = pjsip_uri_clone(tdata->pool, param_target); 304 304 from = pjsip_hdr_clone(tdata->pool, param_from); 305 pjsip_fromto_ set_from(from);305 pjsip_fromto_hdr_set_from(from); 306 306 to = pjsip_hdr_clone(tdata->pool, param_to); 307 pjsip_fromto_ set_to(to);307 pjsip_fromto_hdr_set_to(to); 308 308 if (param_contact) 309 309 contact = pjsip_hdr_clone(tdata->pool, param_contact); -
pjproject/trunk/pjsip/src/test-pjsip/msg_logger.c
r109 r127 18 18 */ 19 19 #include "test.h" 20 #include <pjsip _core.h>20 #include <pjsip.h> 21 21 #include <pjlib.h> 22 22 … … 65 65 PJSIP_MOD_PRIORITY_TRANSPORT_LAYER-1,/* Priority */ 66 66 NULL, /* User data. */ 67 0, /* Number of methods supported (=0). */68 { 0 }, /* Array of methods (none) */69 67 NULL, /* load() */ 70 68 NULL, /* start() */ -
pjproject/trunk/pjsip/src/test-pjsip/msg_test.c
r119 r127 18 18 */ 19 19 #include "test.h" 20 #include <pjsip _core.h>20 #include <pjsip.h> 21 21 #include <pjlib.h> 22 22 … … 349 349 /* "INVITE sip:user@foo SIP/2.0\n" */ 350 350 pjsip_method_set(&msg->line.req.method, PJSIP_INVITE_METHOD); 351 url = pjsip_ url_create(pool, 0);351 url = pjsip_sip_uri_create(pool, 0); 352 352 msg->line.req.uri = (pjsip_uri*)url; 353 353 pj_strdup2(pool, &url->user, "user"); … … 361 361 fromto->uri = (pjsip_uri*)name_addr; 362 362 pj_strdup2(pool, &name_addr->display, "Hi I'm Joe"); 363 url = pjsip_ url_create(pool, 0);363 url = pjsip_sip_uri_create(pool, 0); 364 364 name_addr->uri = (pjsip_uri*)url; 365 365 pj_strdup2(pool, &url->user, "joe.user"); … … 372 372 fromto->uri = (pjsip_uri*)name_addr; 373 373 pj_strdup2(pool, &name_addr->display, "Fellow User"); 374 url = pjsip_ url_create(pool, 0);374 url = pjsip_sip_uri_create(pool, 0); 375 375 name_addr->uri = (pjsip_uri*)url; 376 376 pj_strdup2(pool, &url->user, "user"); … … 400 400 name_addr = pjsip_name_addr_create(pool); 401 401 contact->uri = (pjsip_uri*)name_addr; 402 url = pjsip_ url_create(pool, 0);402 url = pjsip_sip_uri_create(pool, 0); 403 403 name_addr->uri = (pjsip_uri*)url; 404 404 pj_strdup2(pool, &url->user, "joe"); … … 411 411 name_addr = pjsip_name_addr_create(pool); 412 412 contact->uri = (pjsip_uri*)name_addr; 413 url = pjsip_ url_create(pool, 0);413 url = pjsip_sip_uri_create(pool, 0); 414 414 name_addr->uri = (pjsip_uri*)url; 415 415 pj_strdup2(pool, &url->user, "user"); … … 421 421 name_addr = pjsip_name_addr_create(pool); 422 422 contact->uri = (pjsip_uri*)name_addr; 423 url = pjsip_ url_create(pool, 0);423 url = pjsip_sip_uri_create(pool, 0); 424 424 name_addr->uri = (pjsip_uri*)url; 425 425 pj_strdup2(pool, &url->user, "user2"); … … 436 436 routing = pjsip_route_hdr_create(pool); 437 437 pjsip_msg_add_hdr(msg, (pjsip_hdr*)routing); 438 url = pjsip_ url_create(pool, 0);438 url = pjsip_sip_uri_create(pool, 0); 439 439 routing->name_addr.uri = (pjsip_uri*)url; 440 440 pj_strdup2(pool, &url->host, "bigbox3.site3.atlanta.com"); … … 444 444 routing = pjsip_route_hdr_create(pool); 445 445 pjsip_msg_add_hdr(msg, (pjsip_hdr*)routing); 446 url = pjsip_ url_create(pool, 0);446 url = pjsip_sip_uri_create(pool, 0); 447 447 routing->name_addr.uri = (pjsip_uri*)url; 448 448 pj_strdup2(pool, &url->host, "server10.biloxi.com"); … … 452 452 routing = pjsip_rr_hdr_create(pool); 453 453 pjsip_msg_add_hdr(msg, (pjsip_hdr*)routing); 454 url = pjsip_ url_create(pool, 0);454 url = pjsip_sip_uri_create(pool, 0); 455 455 routing->name_addr.uri = (pjsip_uri*)url; 456 456 pj_strdup2(pool, &url->host, "server10.biloxi.com"); … … 460 460 routing = pjsip_rr_hdr_create(pool); 461 461 pjsip_msg_add_hdr(msg, (pjsip_hdr*)routing); 462 url = pjsip_ url_create(pool, 0);462 url = pjsip_sip_uri_create(pool, 0); 463 463 routing->name_addr.uri = (pjsip_uri*)url; 464 464 pj_strdup2(pool, &url->host, "bigbox3.site3.atlanta.com"); … … 498 498 str.ptr = "Organization"; 499 499 str.slen = 12; 500 generic = pjsip_generic_string_hdr_create(pool, &str );500 generic = pjsip_generic_string_hdr_create(pool, &str, NULL); 501 501 pjsip_msg_add_hdr(msg, (pjsip_hdr*)generic); 502 502 generic->hvalue.ptr = NULL; … … 506 506 str.ptr = "Max-Forwards"; 507 507 str.slen = 12; 508 generic = pjsip_generic_string_hdr_create(pool, &str );508 generic = pjsip_generic_string_hdr_create(pool, &str, NULL); 509 509 pjsip_msg_add_hdr(msg, (pjsip_hdr*)generic); 510 510 str.ptr = "70"; … … 515 515 str.ptr = "X-Header"; 516 516 str.slen = 8; 517 generic = pjsip_generic_string_hdr_create(pool, &str );517 generic = pjsip_generic_string_hdr_create(pool, &str, NULL); 518 518 pjsip_msg_add_hdr(msg, (pjsip_hdr*)generic); 519 519 str.ptr = NULL; … … 524 524 str.ptr = "P-Associated-URI"; 525 525 str.slen = 16; 526 generic = pjsip_generic_string_hdr_create(pool, &str );526 generic = pjsip_generic_string_hdr_create(pool, &str, NULL); 527 527 pjsip_msg_add_hdr(msg, (pjsip_hdr*)generic); 528 528 str.ptr = NULL; … … 539 539 pjsip_name_addr *name_addr; 540 540 pjsip_sip_uri *url; 541 pjsip_max_f orwards_hdr *max_fwd;541 pjsip_max_fwd_hdr *max_fwd; 542 542 pjsip_to_hdr *to; 543 543 pjsip_from_hdr *from; … … 582 582 route = pjsip_route_hdr_create(pool); 583 583 pjsip_msg_add_hdr(msg, (pjsip_hdr*)route); 584 url = pjsip_ url_create(pool, PJ_FALSE);584 url = pjsip_sip_uri_create(pool, PJ_FALSE); 585 585 route->name_addr.uri = (pjsip_uri*)url; 586 586 url->host = pj_str("proxy.sipprovider.com"); … … 589 589 route = pjsip_route_hdr_create(pool); 590 590 pjsip_msg_add_hdr(msg, (pjsip_hdr*)route); 591 url = pjsip_ url_create(pool, PJ_FALSE);591 url = pjsip_sip_uri_create(pool, PJ_FALSE); 592 592 route->name_addr.uri = (pjsip_uri*)url; 593 593 url->host = pj_str("proxy.supersip.com"); … … 595 595 596 596 //"Max-Forwards: 70\r\n" 597 max_fwd = pjsip_max_f orwards_hdr_create(pool);597 max_fwd = pjsip_max_fwd_hdr_create(pool, 70); 598 598 pjsip_msg_add_hdr(msg, (pjsip_hdr*)max_fwd); 599 max_fwd->ivalue = 70;600 599 601 600 //"To: Bob <sip:bob@biloxi.com>;tag=a6c85cf\r\n" … … 605 604 name_addr->display = pj_str("Bob"); 606 605 to->uri = (pjsip_uri*)name_addr; 607 url = pjsip_ url_create(pool, PJ_FALSE);606 url = pjsip_sip_uri_create(pool, PJ_FALSE); 608 607 name_addr->uri = (pjsip_uri*)url; 609 608 url->user = pj_str("bob"); … … 617 616 name_addr->display = pj_str("Alice"); 618 617 from->uri = (pjsip_uri*)name_addr; 619 url = pjsip_ url_create(pool, PJ_FALSE);618 url = pjsip_sip_uri_create(pool, PJ_FALSE); 620 619 name_addr->uri = (pjsip_uri*)url; 621 620 url->user = pj_str("alice"); … … 639 638 name_addr = pjsip_name_addr_create(pool); 640 639 contact->uri = (pjsip_uri*)name_addr; 641 url = pjsip_ url_create(pool, PJ_TRUE);640 url = pjsip_sip_uri_create(pool, PJ_TRUE); 642 641 name_addr->uri = (pjsip_uri*)url; 643 642 url->user = pj_str("bob"); -
pjproject/trunk/pjsip/src/test-pjsip/test.c
r117 r127 21 21 #include "test.h" 22 22 #include <pjlib.h> 23 #include <pjsip _core.h>23 #include <pjsip.h> 24 24 25 25 #define THIS_FILE "test.c" -
pjproject/trunk/pjsip/src/test-pjsip/transport_loop_test.c
r109 r127 19 19 20 20 #include "test.h" 21 #include <pjsip _core.h>21 #include <pjsip.h> 22 22 #include <pjlib.h> 23 23 -
pjproject/trunk/pjsip/src/test-pjsip/transport_test.c
r123 r127 19 19 20 20 #include "test.h" 21 #include <pjsip _core.h>21 #include <pjsip.h> 22 22 #include <pjlib.h> 23 23 … … 102 102 PJSIP_MOD_PRIORITY_TSX_LAYER-1, /* Priority */ 103 103 NULL, /* User data. */ 104 0, /* Number of methods supported (=0). */105 { 0 }, /* Array of methods (none) */106 104 NULL, /* load() */ 107 105 NULL, /* start() */ … … 306 304 PJSIP_MOD_PRIORITY_TSX_LAYER-1, /* Priority */ 307 305 NULL, /* User data. */ 308 0, /* Number of methods supported (=0). */309 { 0 }, /* Array of methods (none) */310 306 NULL, /* load() */ 311 307 NULL, /* start() */ -
pjproject/trunk/pjsip/src/test-pjsip/transport_udp_test.c
r109 r127 19 19 20 20 #include "test.h" 21 #include <pjsip _core.h>21 #include <pjsip.h> 22 22 #include <pjlib.h> 23 23 -
pjproject/trunk/pjsip/src/test-pjsip/tsx_basic_test.c
r109 r127 19 19 20 20 #include "test.h" 21 #include <pjsip _core.h>21 #include <pjsip.h> 22 22 #include <pjlib.h> 23 23 -
pjproject/trunk/pjsip/src/test-pjsip/tsx_uac_test.c
r123 r127 19 19 20 20 #include "test.h" 21 #include <pjsip _core.h>21 #include <pjsip.h> 22 22 #include <pjlib.h> 23 23 … … 104 104 PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ 105 105 NULL, /* User data. */ 106 0, /* Number of methods supported (=0). */107 { 0 }, /* Array of methods (none) */108 106 NULL, /* load() */ 109 107 NULL, /* start() */ … … 125 123 PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ 126 124 NULL, /* User data. */ 127 0, /* Number of methods supported (=0). */128 { 0 }, /* Array of methods (none) */129 125 NULL, /* load() */ 130 126 NULL, /* start() */ -
pjproject/trunk/pjsip/src/test-pjsip/tsx_uas_test.c
r123 r127 19 19 20 20 #include "test.h" 21 #include <pjsip _core.h>21 #include <pjsip.h> 22 22 #include <pjlib.h> 23 23 … … 143 143 PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ 144 144 NULL, /* User data. */ 145 0, /* Number of methods supported (=0). */146 { 0 }, /* Array of methods (none) */147 145 NULL, /* load() */ 148 146 NULL, /* start() */ … … 164 162 PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ 165 163 NULL, /* User data. */ 166 0, /* Number of methods supported (=0). */167 { 0 }, /* Array of methods (none) */168 164 NULL, /* load() */ 169 165 NULL, /* start() */ -
pjproject/trunk/pjsip/src/test-pjsip/txdata_test.c
r123 r127 19 19 20 20 #include "test.h" 21 #include <pjsip _core.h>21 #include <pjsip.h> 22 22 #include <pjlib.h> 23 23 -
pjproject/trunk/pjsip/src/test-pjsip/uri_test.c
r119 r127 18 18 */ 19 19 #include "test.h" 20 #include <pjsip _core.h>20 #include <pjsip.h> 21 21 #include <pjlib.h> 22 22 … … 318 318 { 319 319 /* "sip:localhost" */ 320 pjsip_sip_uri *url = pjsip_ url_create(pool, 0);320 pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 0); 321 321 322 322 pj_strdup2(pool, &url->host, "localhost"); … … 327 327 { 328 328 /* "sip:user@localhost" */ 329 pjsip_sip_uri *url = pjsip_ url_create(pool, 0);329 pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 0); 330 330 331 331 pj_strdup2( pool, &url->user, "user"); … … 338 338 { 339 339 /* "sip:user:password@localhost:5060" */ 340 pjsip_sip_uri *url = pjsip_ url_create(pool, 0);340 pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 0); 341 341 342 342 pj_strdup2( pool, &url->user, "user"); … … 351 351 { 352 352 /* Like: "sip:localhost:5060", but without the port. */ 353 pjsip_sip_uri *url = pjsip_ url_create(pool, 0);353 pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 0); 354 354 355 355 pj_strdup2(pool, &url->host, "localhost"); … … 360 360 { 361 361 /* "sip:localhost;transport=tcp;user=ip;ttl=255;lr;maddr=127.0.0.1;method=ACK" */ 362 pjsip_sip_uri *url = pjsip_ url_create(pool, 0);362 pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 0); 363 363 364 364 pj_strdup2(pool, &url->host, "localhost"); … … 387 387 "?Subject=Hello%20There&Server=SIP%20Server" 388 388 */ 389 pjsip_sip_uri *url = pjsip_ url_create(pool, 0);389 pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 0); 390 390 391 391 pj_strdup2(pool, &url->host, "localhost"); … … 406 406 { 407 407 /* "sips:localhost" */ 408 pjsip_sip_uri *url = pjsip_ url_create(pool, 1);408 pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 1); 409 409 410 410 pj_strdup2(pool, &url->host, "localhost"); … … 418 418 pjsip_sip_uri *url; 419 419 420 url = pjsip_ url_create(pool, 0);420 url = pjsip_sip_uri_create(pool, 0); 421 421 name_addr->uri = (pjsip_uri*) url; 422 422 … … 431 431 pjsip_sip_uri *url; 432 432 433 url = pjsip_ url_create(pool, 1);433 url = pjsip_sip_uri_create(pool, 1); 434 434 name_addr->uri = (pjsip_uri*) url; 435 435 … … 445 445 pjsip_sip_uri *url; 446 446 447 url = pjsip_ url_create(pool, 0);447 url = pjsip_sip_uri_create(pool, 0); 448 448 name_addr->uri = (pjsip_uri*) url; 449 449 … … 461 461 pjsip_sip_uri *url; 462 462 463 url = pjsip_ url_create(pool, 0);463 url = pjsip_sip_uri_create(pool, 0); 464 464 name_addr->uri = (pjsip_uri*) url; 465 465 … … 475 475 pjsip_sip_uri *url; 476 476 477 url = pjsip_ url_create(pool, 0);477 url = pjsip_sip_uri_create(pool, 0); 478 478 name_addr->uri = (pjsip_uri*) url; 479 479 … … 489 489 pjsip_sip_uri *url; 490 490 491 url = pjsip_ url_create(pool, 0);491 url = pjsip_sip_uri_create(pool, 0); 492 492 name_addr->uri = (pjsip_uri*) url; 493 493 … … 501 501 /* "sip:localhost;pvalue=\"hello world\"" */ 502 502 pjsip_sip_uri *url; 503 url = pjsip_ url_create(pool, 0);503 url = pjsip_sip_uri_create(pool, 0); 504 504 pj_strdup2(pool, &url->host, "localhost"); 505 505 //pj_strdup2(pool, &url->other_param, ";pvalue=\"hello world\""); … … 514 514 pjsip_sip_uri *url; 515 515 516 url = pjsip_ url_create(pool, 0);516 url = pjsip_sip_uri_create(pool, 0); 517 517 name_addr->uri = (pjsip_uri*) url; 518 518 … … 529 529 /* "sip:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.com" */ 530 530 pjsip_sip_uri *url; 531 url = pjsip_ url_create(pool, 0);531 url = pjsip_sip_uri_create(pool, 0); 532 532 pj_strdup2(pool, &url->host, ALPHANUM "-_.com"); 533 533 return (pjsip_uri*)url; … … 538 538 /* "sip:" USER_CHAR ":" PASS_CHAR "@host" */ 539 539 pjsip_sip_uri *url; 540 url = pjsip_ url_create(pool, 0);540 url = pjsip_sip_uri_create(pool, 0); 541 541 pj_strdup2(pool, &url->user, USER_CHAR); 542 542 pj_strdup2(pool, &url->passwd, PASS_CHAR); … … 549 549 /* "sip:host;user=ip;" PARAM_CHAR "%21=" PARAM_CHAR "%21;lr;other=1;transport=sctp;other2" */ 550 550 pjsip_sip_uri *url; 551 url = pjsip_ url_create(pool, 0);551 url = pjsip_sip_uri_create(pool, 0); 552 552 pj_strdup2(pool, &url->host, "host"); 553 553 pj_strdup2(pool, &url->user_param, "ip");
Note: See TracChangeset
for help on using the changeset viewer.