How to find the size of Content-Length field

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

 



Guru Prakash Pulipati wrote:
> Hi All
>  
> I am planning to write pack/unpack functions for sip messages,
> but I am stuck with some fields as I dont know there size.
>  
> for example,
> "Content-Length" which specifies the size of the SIP message body,
> but where can I get the size of the Content-Length field.

I hope I understand you question correctly.

If you have the pjsip_rx_data, then you can get the Content-Length 
header of the incoming message from:

    pjsip_clen_hdr *clen = rdata->msg_info.clen;
    if (clen) {
       printf("Content length is %d\n", clen->len);
    }

If you don't have pjsip_rx_data, you can find Content-Length header 
from a message using:

   pjsip_clen_hdr *clen = (pjsip_clen_hdr*)
                          pjsip_msg_find_hdr(msg,
                                             PJSIP_H_CONTENT_LENGTH,
                                             NULL);

HTH,
  -benny




[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