parse_param.c File Reference

Generic Parameter Parser. More...

#include <string.h>
#include "../str.h"
#include "../ut.h"
#include "../dprint.h"
#include "../trim.h"
#include "../mem/mem.h"
#include "../mem/shm_mem.h"
#include "parse_param.h"

Include dependency graph for parse_param.c:

Go to the source code of this file.

Functions

static int do_duplicate_params (param_t **_n, param_t *_p, int _shm)
static void do_free_params (param_t *_p, int _shm)
int duplicate_params (param_t **_n, param_t *_p)
void free_params (param_t *_p)
static void parse_contact_class (param_hooks_t *_h, param_t *_p)
static int parse_param_body (str *_s, param_t *_c)
static void parse_param_name (str *_s, pclass_t _c, param_hooks_t *_h, param_t *_p)
int parse_params (str *_s, pclass_t _c, param_hooks_t *_h, param_t **_p)
 Parse parameters.
static int parse_quoted_param (str *_s, str *_r)
static int parse_token_param (str *_s, str *_r)
static void parse_uri_class (param_hooks_t *_h, param_t *_p)
static void print_param (FILE *_o, param_t *_p)
void print_params (FILE *_o, param_t *_p)
int shm_duplicate_params (param_t **_n, param_t *_p)
void shm_free_params (param_t *_p)


Detailed Description

Generic Parameter Parser.

Definition in file parse_param.c.


Function Documentation

static int do_duplicate_params ( param_t **  _n,
param_t _p,
int  _shm 
) [inline, static]

Duplicate linked list of parameters

Definition at line 518 of file parse_param.c.

References do_free_params(), LM_ERR, param::next, pkg_malloc, and shm_malloc().

Referenced by duplicate_params(), and shm_duplicate_params().

static void do_free_params ( param_t _p,
int  _shm 
) [inline, static]

Free linked list of parameters

Definition at line 436 of file parse_param.c.

References param::next, pkg_free, and shm_free.

Referenced by do_duplicate_params(), free_params(), and shm_free_params().

int duplicate_params ( param_t **  _n,
param_t _p 
)

Duplicate linked list of parameters in pkg_mem

Definition at line 560 of file parse_param.c.

References do_duplicate_params().

Referenced by do_duplicate_rr().

void free_params ( param_t _p  ) 

Free linked list of parameters in pkg_mem

Definition at line 452 of file parse_param.c.

References do_free_params().

Referenced by build_path_vector(), do_free_rr(), free_contacts(), free_event(), parse_params(), path_rr_callback(), and uri_param_2().

static void parse_contact_class ( param_hooks_t _h,
param_t _p 
) [inline, static]

Try to find out parameter name, recognized parameters are q, expires and methods

Definition at line 43 of file parse_param.c.

References param_hooks::contact, contact_hooks::expires, _str::len, LM_ERR, contact_hooks::methods, param::name, P_EXPIRES, P_METHODS, P_Q, P_RECEIVED, contact_hooks::q, contact_hooks::received, _str::s, and param::type.

Referenced by parse_param_name().

static int parse_param_body ( str _s,
param_t _c 
) [inline, static]

Parse body of a parameter. It can be quoted string or a single token.

Definition at line 314 of file parse_param.c.

References param::body, LM_ERR, parse_quoted_param(), parse_token_param(), and _str::s.

Referenced by parse_params().

static void parse_param_name ( str _s,
pclass_t  _c,
param_hooks_t _h,
param_t _p 
) [inline, static]

Parse a parameter name

Definition at line 271 of file parse_param.c.

References CLASS_CONTACT, CLASS_URI, _str::len, LM_DBG, param::name, parse_contact_class(), parse_uri_class(), and _str::s.

Referenced by parse_digest_param(), and parse_params().

int parse_params ( str _s,
pclass_t  _c,
param_hooks_t _h,
param_t **  _p 
)

Parse parameters.

Parameters:
_s string containing parameters, it will be updated to point behind the parameters
_c class of parameters
_h structure that will be filled with pointer to well known parameters
_p linked list of parsed parameters will be stored in the variable _p is pointing to
Returns:
0 on success and negative number on an error

Definition at line 341 of file parse_param.c.

References to_body::error, free_params(), param::len, _str::len, LM_DBG, LM_ERR, param::name, param::next, parse_param_body(), parse_param_name(), pkg_free, pkg_malloc, _str::s, and trim_leading().

Referenced by assemble_msg(), build_path_vector(), cmp_str_params(), do_parse_rr_body(), event_parser(), parse_contacts(), path_rr_callback(), and uri_param_2().

static int parse_quoted_param ( str _s,
str _r 
) [inline, static]

Parse quoted string in a parameter body return the string without quotes in _r parameter and update _s to point behind the closing quote

Returns:
zero on success, negative result on error

Definition at line 165 of file parse_param.c.

References _str::len, and _str::s.

Referenced by parse_param_body().

static int parse_token_param ( str _s,
str _r 
) [inline, static]

Parse unquoted token in a parameter body let _r point to the token and update _s to point right behind the token

Definition at line 211 of file parse_param.c.

References _str::len, and _str::s.

Referenced by parse_param_body().

static void parse_uri_class ( param_hooks_t _h,
param_t _p 
) [inline, static]

Try to find out parameter name, recognized parameters are transport, lr, r2, maddr

Definition at line 93 of file parse_param.c.

References uri_hooks::dstip, uri_hooks::dstport, _str::len, LM_ERR, uri_hooks::lr, uri_hooks::maddr, param::name, P_DSTIP, P_DSTPORT, P_LR, P_MADDR, P_R2, P_TRANSPORT, P_TTL, uri_hooks::r2, _str::s, uri_hooks::transport, uri_hooks::ttl, param::type, and param_hooks::uri.

Referenced by parse_param_name().

static void print_param ( FILE *  _o,
param_t _p 
) [inline, static]

Print a parameter structure, just for debugging

Definition at line 470 of file parse_param.c.

References param::body, param::len, _str::len, param::name, P_DSTIP, P_DSTPORT, P_EXPIRES, P_LR, P_MADDR, P_METHODS, P_OTHER, P_Q, P_R2, P_RECEIVED, P_TRANSPORT, P_TTL, _str::s, and param::type.

Referenced by print_params().

void print_params ( FILE *  _o,
param_t _p 
)

Print linked list of parameters, just for debugging

Definition at line 503 of file parse_param.c.

References param::next, and print_param().

Referenced by print_contacts(), and print_rr().

int shm_duplicate_params ( param_t **  _n,
param_t _p 
)

Duplicate linked list of parameters in shm_mem

Definition at line 569 of file parse_param.c.

References do_duplicate_params().

Referenced by do_duplicate_rr().

void shm_free_params ( param_t _p  ) 

Free linked list of parameters in shm_mem

Definition at line 461 of file parse_param.c.

References do_free_params().

Referenced by do_free_rr().


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