Changeset 3337 for pjproject/trunk
- Timestamp:
- Oct 12, 2010 11:35:55 AM (14 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip-simple/presence.h
r2762 r3337 329 329 * 330 330 * @return PJ_SUCCESS on success. 331 * 332 * @see pjsip_pres_parse_pidf2() 331 333 */ 332 334 PJ_DECL(pj_status_t) pjsip_pres_parse_pidf(pjsip_rx_data *rdata, … … 334 336 pjsip_pres_status *status); 335 337 338 /** 339 * This is a utility function to parse PIDF body into PJSIP presence status. 340 * 341 * @param body Text body, with one extra space at the end to place 342 * NULL character temporarily during parsing. 343 * @param body_len Length of the body, not including the NULL termination 344 * character. 345 * @param pool Pool to allocate memory to copy the strings into 346 * the presence status structure. 347 * @param status The presence status to be initialized. 348 * 349 * @return PJ_SUCCESS on success. 350 * 351 * @see pjsip_pres_parse_pidf() 352 */ 353 PJ_DECL(pj_status_t) pjsip_pres_parse_pidf2(char *body, unsigned body_len, 354 pj_pool_t *pool, 355 pjsip_pres_status *status); 336 356 337 357 … … 345 365 * 346 366 * @return PJ_SUCCESS on success. 367 * 368 * @see pjsip_pres_parse_xpidf2() 347 369 */ 348 370 PJ_DECL(pj_status_t) pjsip_pres_parse_xpidf(pjsip_rx_data *rdata, … … 351 373 352 374 375 /** 376 * This is a utility function to parse X-PIDF body into PJSIP presence status. 377 * 378 * @param body Text body, with one extra space at the end to place 379 * NULL character temporarily during parsing. 380 * @param body_len Length of the body, not including the NULL termination 381 * character. 382 * @param pool Pool to allocate memory to copy the strings into 383 * the presence status structure. 384 * @param status The presence status to be initialized. 385 * 386 * @return PJ_SUCCESS on success. 387 * 388 * @see pjsip_pres_parse_xpidf() 389 */ 390 PJ_DECL(pj_status_t) pjsip_pres_parse_xpidf2(char *body, unsigned body_len, 391 pj_pool_t *pool, 392 pjsip_pres_status *status); 393 394 353 395 354 396 /** -
pjproject/trunk/pjsip/src/pjsip-simple/presence.c
r2762 r3337 22 22 #include <pjsip-simple/evsub_msg.h> 23 23 #include <pjsip/sip_module.h> 24 #include <pjsip/sip_multipart.h> 24 25 #include <pjsip/sip_endpoint.h> 25 26 #include <pjsip/sip_dialog.h> … … 683 684 pjsip_hdr *res_hdr) 684 685 { 686 const pj_str_t STR_MULTIPART = { "multipart", 9 }; 685 687 pjsip_ctype_hdr *ctype_hdr; 686 688 pj_status_t status; … … 708 710 709 711 /* Parse content. */ 710 712 if (pj_stricmp(&ctype_hdr->media.type, &STR_MULTIPART)==0) { 713 pjsip_multipart_part *mpart; 714 pjsip_media_type ctype; 715 716 pjsip_media_type_init(&ctype, (pj_str_t*)&STR_APPLICATION, 717 (pj_str_t*)&STR_PIDF_XML); 718 mpart = pjsip_multipart_find_part(rdata->msg_info.msg->body, 719 &ctype, NULL); 720 if (mpart) { 721 status = pjsip_pres_parse_pidf2((char*)mpart->body->data, 722 mpart->body->len, pres->tmp_pool, 723 &pres->tmp_status); 724 } 725 726 if (mpart==NULL) { 727 pjsip_media_type_init(&ctype, (pj_str_t*)&STR_APPLICATION, 728 (pj_str_t*)&STR_XPIDF_XML); 729 mpart = pjsip_multipart_find_part(rdata->msg_info.msg->body, 730 &ctype, NULL); 731 if (mpart) { 732 status = pjsip_pres_parse_xpidf2((char*)mpart->body->data, 733 mpart->body->len, 734 pres->tmp_pool, 735 &pres->tmp_status); 736 } else { 737 status = PJSIP_SIMPLE_EBADCONTENT; 738 } 739 } 740 } 741 else 711 742 if (pj_stricmp(&ctype_hdr->media.type, &STR_APPLICATION)==0 && 712 743 pj_stricmp(&ctype_hdr->media.subtype, &STR_PIDF_XML)==0) -
pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c
r3255 r3337 200 200 pjsip_pres_status *pres_status) 201 201 { 202 return pjsip_pres_parse_pidf2((char*)rdata->msg_info.msg->body->data, 203 rdata->msg_info.msg->body->len, 204 pool, pres_status); 205 } 206 207 PJ_DEF(pj_status_t) pjsip_pres_parse_pidf2(char *body, unsigned body_len, 208 pj_pool_t *pool, 209 pjsip_pres_status *pres_status) 210 { 202 211 pjpidf_pres *pidf; 203 212 pjpidf_tuple *pidf_tuple; 204 213 205 pidf = pjpidf_parse(rdata->tp_info.pool, 206 (char*)rdata->msg_info.msg->body->data, 207 rdata->msg_info.msg->body->len); 214 pidf = pjpidf_parse(pool, body, body_len); 208 215 if (pidf == NULL) 209 216 return PJSIP_SIMPLE_EBADPIDF; … … 252 259 pjsip_pres_status *pres_status) 253 260 { 261 return pjsip_pres_parse_xpidf2((char*)rdata->msg_info.msg->body->data, 262 rdata->msg_info.msg->body->len, 263 pool, pres_status); 264 } 265 266 PJ_DEF(pj_status_t) pjsip_pres_parse_xpidf2(char *body, unsigned body_len, 267 pj_pool_t *pool, 268 pjsip_pres_status *pres_status) 269 { 254 270 pjxpidf_pres *xpidf; 255 271 256 xpidf = pjxpidf_parse(rdata->tp_info.pool, 257 (char*)rdata->msg_info.msg->body->data, 258 rdata->msg_info.msg->body->len); 272 xpidf = pjxpidf_parse(pool, body, body_len); 259 273 if (xpidf == NULL) 260 274 return PJSIP_SIMPLE_EBADXPIDF;
Note: See TracChangeset
for help on using the changeset viewer.