[sr-dev] [tracker] Task opened: get_body_part2 (parse_body) (Attachment added)

sip-router admin at sip-router.org
Fri Oct 28 18:57:15 CEST 2011


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - Luis Martin (lmartin) 

Attached to Project - sip-router
Summary - get_body_part2 (parse_body)
Task Type - Improvement
Category - Core
Status - Assigned
Assigned To - Andrei Pelinescu-Onciul
Operating System - All
Severity - Low
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - I made a new function for the "parser/parse_body.c" module : get_body_part2

--------------------

get_body_part,
char *get_body_part(struct sip_msg *msg, unsigned short type, unsigned short subtype, int *len)

get_body_part allows you to pick the first multipart part of the SIP message which matches TYPE/SUBTYPE. It will return a pointer to the multipart structure as well as its length. The code it is not easy-readable but this function is working great. The point is, what if I would like to search a multipart part within a SIP message that matches TYPE/SUBTYPE but also the Content-ID header or the Content-Length header?

--------------------
New function:

get_body_part2,
char *get_body_part_strict(struct sip_msg *msg, unsigned short content_type, unsigned short content_subtype, char *content_id, char *content_length, int *len)

It returns the first multipart part of the SIP message which matches "TYPE/SUBTYPE" and/or the "Content-ID" and/or the "Content-Length", and its length. If you want to be less restrictive, you can unflag the parameter by:
- setting 0/0 in case of the TYPE/SUBTYPE.
- setting NULL in case of the Content-ID and the Content-Length.

So setting Content-Length == NULL will make the function to skip the Content-Length from its filter and will give you back the first part which matches the TYPE/SUBTYPE and Content-ID, and its length.

--------------------


Already tested and working fine.

See patch attached.

Luis Martin Gil

One or more files have been attached.

More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=170

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.



More information about the sr-dev mailing list