parse_content.c File Reference

Content header parser. More...

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include "../mem/mem.h"
#include "../dprint.h"
#include "../str.h"
#include "../ut.h"
#include "parse_content.h"

Include dependency graph for parse_content.c:

Go to the source code of this file.

Data Structures

struct  type_node_s

Defines

#define is_char_equal(_c_, _cs_)   ( (isalpha((int)_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )
#define is_mime_char(_c_)   (isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.')

Typedefs

typedef struct type_node_s type_node_t

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 *length)
int parse_content_type_hdr (struct sip_msg *msg)

Variables

static type_node_t subtype_tree []
static type_node_t type_tree []


Detailed Description

Content header parser.

Definition in file parse_content.c.


Define Documentation

#define is_char_equal ( _c_,
_cs_   )     ( (isalpha((int)_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )

Definition at line 48 of file parse_content.c.

Referenced by decode_mime_type().

#define is_mime_char ( _c_   )     (isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.')

Definition at line 46 of file parse_content.c.

Referenced by decode_mime_type().


Typedef Documentation

typedef struct type_node_s type_node_t

Node of the type's tree; this tree contains all the known types;


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().


Variable Documentation

Definition at line 98 of file parse_content.c.

type_node_t type_tree[] [static]

Definition at line 64 of file parse_content.c.


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