parse_content.h File Reference

Content header parser. More...

#include "msg_parser.h"

Include dependency graph for parse_content.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mime_type

Defines

#define get_accept(_msg_)   ((int*)((_msg_)->accept->parsed))
#define get_content_length(_msg_)   ((long)((_msg_)->content_length->parsed))
#define get_content_type(_msg_)   ((int)(long)((_msg_)->content_type->parsed))
#define MAX_MIMES_NR   128
#define SUBTYPE_ALL   0xfe
#define SUBTYPE_CPIM   2
#define SUBTYPE_CPLXML   4
#define SUBTYPE_EXTERNAL_BODY   11
#define SUBTYPE_LPIDFXML   8
#define SUBTYPE_MIXED   14
#define SUBTYPE_PIDFXML   5
#define SUBTYPE_PLAIN   1
#define SUBTYPE_RELATED   7
#define SUBTYPE_RLMIXML   6
#define SUBTYPE_SDP   3
#define SUBTYPE_SMS   13
#define SUBTYPE_UNKNOWN   0xff
#define SUBTYPE_WATCHERINFOXML   10
#define SUBTYPE_XML_MSRTC_PIDF   12
#define SUBTYPE_XPIDFXML   9
#define TYPE_ALL   0xfe
#define TYPE_APPLICATION   3
#define TYPE_MESSAGE   2
#define TYPE_MULTIPART   4
#define TYPE_TEXT   1
#define TYPE_UNKNOWN   0xff

Functions

char * decode_mime_type (char *start, char *end, unsigned int *mime_type)
int parse_accept_hdr (struct sip_msg *msg)
char * parse_content_length (char *buffer, char *end, int *len)
int parse_content_type_hdr (struct sip_msg *msg)


Detailed Description

Content header parser.

Definition in file parse_content.h.


Define Documentation

#define get_accept ( _msg_   )     ((int*)((_msg_)->accept->parsed))

returns the accept values of a sip_msg as an null-terminated array of integers

Definition at line 91 of file parse_content.h.

Referenced by cpl_process_register().

#define get_content_length ( _msg_   )     ((long)((_msg_)->content_length->parsed))

#define get_content_type ( _msg_   )     ((int)(long)((_msg_)->content_type->parsed))

returns the content-type value of a sip_msg as an integer

Definition at line 84 of file parse_content.h.

Referenced by handle_publish(), and parse_content_type_hdr().

#define MAX_MIMES_NR   128

Maximum number of mimes allowed in Accept header

Definition at line 73 of file parse_content.h.

Referenced by parse_accept_hdr().

#define SUBTYPE_ALL   0xfe

#define SUBTYPE_CPIM   2

#define SUBTYPE_CPLXML   4

Definition at line 55 of file parse_content.h.

Referenced by cpl_process_register(), and print_encoded_mime_type().

#define SUBTYPE_EXTERNAL_BODY   11

Definition at line 62 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define SUBTYPE_LPIDFXML   8

Definition at line 59 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define SUBTYPE_MIXED   14

Definition at line 65 of file parse_content.h.

#define SUBTYPE_PIDFXML   5

Definition at line 56 of file parse_content.h.

Referenced by handle_publish(), and print_encoded_mime_type().

#define SUBTYPE_PLAIN   1

#define SUBTYPE_RELATED   7

Definition at line 58 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define SUBTYPE_RLMIXML   6

Definition at line 57 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define SUBTYPE_SDP   3

Definition at line 54 of file parse_content.h.

Referenced by has_body_f(), and print_encoded_mime_type().

#define SUBTYPE_SMS   13

Definition at line 64 of file parse_content.h.

#define SUBTYPE_UNKNOWN   0xff

Definition at line 67 of file parse_content.h.

Referenced by decode_mime_type(), and print_encoded_mime_type().

#define SUBTYPE_WATCHERINFOXML   10

Definition at line 61 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define SUBTYPE_XML_MSRTC_PIDF   12

Definition at line 63 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define SUBTYPE_XPIDFXML   9

Definition at line 60 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define TYPE_ALL   0xfe

#define TYPE_APPLICATION   3

Definition at line 47 of file parse_content.h.

Referenced by cpl_process_register(), has_body_f(), and print_encoded_mime_type().

#define TYPE_MESSAGE   2

#define TYPE_MULTIPART   4

Definition at line 48 of file parse_content.h.

Referenced by print_encoded_mime_type().

#define TYPE_TEXT   1

#define TYPE_UNKNOWN   0xff

Definition at line 50 of file parse_content.h.

Referenced by decode_mime_type(), and print_encoded_mime_type().


Function Documentation

char* decode_mime_type ( char *  start,
char *  end,
unsigned int *  mime_type 
)

parse a string containing a mime description

Definition at line 269 of file parse_content.c.

References type_node_s::final, is_char_equal, is_mime_char, LM_ERR, type_node_s::next, SUBTYPE_ALL, SUBTYPE_UNKNOWN, TYPE_ALL, and TYPE_UNKNOWN.

Referenced by fixup_body_type(), parse_accept_hdr(), and parse_content_type_hdr().

int parse_accept_hdr ( struct sip_msg msg  ) 

parse the body of the Accept header. It's values are also converted as an null-terminated array of ints.

Returns:
1 for OK, 0 for hdr not found, -1 on errors (parse errors)

Definition at line 424 of file parse_content.c.

References sip_msg::accept, hdr_field::body, decode_mime_type(), HDR_ACCEPT_F, _str::len, LM_DBG, LM_ERR, MAX_MIMES_NR, parse_headers(), hdr_field::parsed, pkg_malloc, and _str::s.

Referenced by cpl_process_register(), and encode_header().

char* parse_content_length ( char *  buffer,
char *  end,
int *  len 
)

parse the body of a Content_-Length header. Also tries to recognize the type specified by this header (see th above defines).

Returns:
first chr after the end of the header.

Definition at line 227 of file parse_content.c.

References LM_ERR.

Referenced by encode_header(), and get_hdr_field().

int parse_content_type_hdr ( struct sip_msg msg  ) 

parse the body of the Content-Type header. It's value is also converted as int. Returns: n (n>0) : the found type 0 : hdr not found -1 : error (parse error )

Definition at line 376 of file parse_content.c.

References hdr_field::body, sip_msg::content_type, decode_mime_type(), get_content_type, HDR_CONTENTTYPE_F, _str::len, LM_DBG, LM_ERR, parse_headers(), hdr_field::parsed, _str::s, SUBTYPE_ALL, and TYPE_ALL.

Referenced by cmd_send_message(), cpl_process_register(), encode_header(), func_handle_publish(), func_send_message(), has_body_f(), m_store(), push_on_network(), and xjab_manage_sipmsg().


Generated on Thu May 24 00:00:40 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6