pj_str_t, char*, and ptr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx [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: 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 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux