[pjsip] pj_str_t, char*, and ptr

Archie Rosenblum archie at bbsti.com
Fri Aug 29 11:44:34 EDT 2008


Cédric,

 

“tag” is of pj_str_t type.  The length of the string is located at
rdata->msg_info.to->tag.slen. You can use the ptr and slen to copy or
duplicate the string.  Here are some routines that work with pj_str_t
http://www.pjsip.org/pjlib/docs/html/group__PJ__PSTR.htm although none
create a null terminated string from a pj_str_t.

 

Take care,

Archie 

 

 

CHAR szBuffer[4000];  

ZeroMemory(szBuffer, sizeof(szBufffer));

memcpy(szBuffer, rdata->msg_info.to->tag.ptr, rdata->msg_info.to->tag.slen);

 

PCHAR pszBuffer;

pszBuffer = calloc(rdata->msg_info.to->tag.slen,1);

memcpy(pszBuffer, rdata->msg_info.to->tag.ptr,
rdata->msg_info.to->tag.slen);

 

 

 

 

 

 

 

 

  _____  

From: pjsip-bounces at lists.pjsip.org [mailto:pjsip-bounces at lists.pjsip.org]
On Behalf Of cedric leveque
Sent: Friday, August 29, 2008 9:43 AM
To: pjsip at lists.pjsip.org
Subject: [pjsip] pj_str_t, char*, and ptr

 

Hi,
 
I want to get some information on incoming request from
rdata(pjsip_rx_data).
 
When I use rdata->msg_info.to->tag.ptr, I obtain tag from the to but also
the rest of the message.
 
It is because of the "NOT null terminated" for the ptr, or a bug ?
 
Do you know how I can do this ?
 
Thanks by advance.
 
Cédric.

  _____  

Avec une webcam et Messenger partagez vos émotions en vidéo ! Téléchargez
<http://www.windowslive.fr/messenger/>  gratuitement !

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080829/46a071cd/attachment.html 


More information about the pjsip mailing list