dset.c File Reference

Destination set handling functions. More...

#include <string.h>
#include "dprint.h"
#include "config.h"
#include "parser/parser_f.h"
#include "parser/msg_parser.h"
#include "ut.h"
#include "hash_func.h"
#include "error.h"
#include "dset.h"
#include "mem/mem.h"
#include "ip_addr.h"

Include dependency graph for dset.c:

Go to the source code of this file.

Data Structures

struct  branch

Defines

#define CONTACT   "Contact: "
#define CONTACT_DELIM   ", "
#define CONTACT_DELIM_LEN   (sizeof(CONTACT_DELIM) - 1)
#define CONTACT_LEN   (sizeof(CONTACT) - 1)
#define Q_PARAM   ">;q="
#define Q_PARAM_LEN   (sizeof(Q_PARAM) - 1)

Functions

int append_branch (struct sip_msg *msg, str *uri, str *dst_uri, str *path, qvalue_t q, unsigned int flags, struct socket_info *force_socket)
 Add a new branch to current transaction.
int branch_uri2dset (str *new_uri)
 moves the uri to destination for all branches and all uris are set to given uri
void clear_branches (void)
 Empty the dset array.
char * get_branch (unsigned int idx, int *len, qvalue_t *q, str *dst_uri, str *path, unsigned int *flags, struct socket_info **force_socket)
 Find the next brand from the destination set.
static unsigned int * get_ptr_bflags (unsigned int b_idx)
int get_request_uri (struct sip_msg *_m, str *_u)
 Get actual Request-URI.
qvalue_t get_ruri_q (void)
 Return the q value of the Request-URI.
unsigned int getb0flags (void)
 Get the per branch flags for RURI.
int isbflagset (unsigned int b_idx, unsigned int mask)
 Tests the per branch flags.
char * print_dset (struct sip_msg *msg, int *len)
 Create a Contact header field from the dset array.
int resetbflag (unsigned int b_idx, unsigned int mask)
 Resets the per branch flags.
int rewrite_uri (struct sip_msg *_m, str *_s)
 Rewrite Request-URI.
void set_ruri_q (qvalue_t q)
 Sets the q parameter of the Request-URI.
unsigned int setb0flags (unsigned int flags)
int setbflag (unsigned int b_idx, unsigned int mask)
 Set the per branch flag.

Variables

static struct branch branches [MAX_BRANCHES-1]
 Where we store URIs of additional transaction branches (-1 because of the default branch, #0).
unsigned int nr_branches = 0
static unsigned int ruri_bflags = 0
static qvalue_t ruri_q = Q_UNSPECIFIED


Detailed Description

Destination set handling functions.

Definition in file dset.c.


Define Documentation

#define CONTACT   "Contact: "

Definition at line 41 of file dset.c.

Referenced by print_dset().

#define CONTACT_DELIM   ", "

Definition at line 44 of file dset.c.

Referenced by print_dset().

#define CONTACT_DELIM_LEN   (sizeof(CONTACT_DELIM) - 1)

Definition at line 45 of file dset.c.

Referenced by print_dset().

#define CONTACT_LEN   (sizeof(CONTACT) - 1)

Definition at line 42 of file dset.c.

Referenced by print_dset().

#define Q_PARAM   ">;q="

Definition at line 47 of file dset.c.

Referenced by build_contact(), and print_dset().

#define Q_PARAM_LEN   (sizeof(Q_PARAM) - 1)

Definition at line 48 of file dset.c.

Referenced by build_contact(), calc_buf_len(), and print_dset().


Function Documentation

int append_branch ( struct sip_msg msg,
str uri,
str dst_uri,
str path,
qvalue_t  q,
unsigned int  flags,
struct socket_info force_socket 
)

int branch_uri2dset ( str new_uri  ) 

moves the uri to destination for all branches and all uris are set to given uri

Definition at line 494 of file dset.c.

References branches, branch::dst_uri, branch::dst_uri_len, branch::len, len, _str::len, LM_ERR, MAX_URI_SIZE, nr_branches, _str::s, and branch::uri.

Referenced by t_replicate().

void clear_branches ( void   ) 

Empty the dset array.

Empty the array of branches.

Definition at line 246 of file dset.c.

References nr_branches, Q_UNSPECIFIED, ruri_bflags, and ruri_q.

Referenced by faked_msg_next(), receive_msg(), t_forward_nonack(), and t_load_contacts().

char* get_branch ( unsigned int  idx,
int *  len,
qvalue_t q,
str dst_uri,
str path,
unsigned int *  flags,
struct socket_info **  force_socket 
)

Find the next brand from the destination set.

Get the next branch in the current transaction.

Returns:
Return the next branch from the dset array, 0 is returned if there are no more branches

Definition at line 208 of file dset.c.

References branches, branch::dst_uri_len, branch::flags, branch::force_send_socket, _str::len, branch::len, nr_branches, branch::path_len, branch::q, Q_UNSPECIFIED, _str::s, and branch::uri.

Referenced by check_routing(), is_uri_host_local(), print_dset(), t_forward_nonack(), and t_load_contacts().

static unsigned int* get_ptr_bflags ( unsigned int  b_idx  )  [inline, static]

Definition at line 91 of file dset.c.

References branches, branch::flags, nr_branches, and ruri_bflags.

Referenced by isbflagset(), resetbflag(), and setbflag().

int get_request_uri ( struct sip_msg _m,
str _u 
)

Get actual Request-URI.

Definition at line 448 of file dset.c.

References sip_msg::first_line, _str::len, sip_msg::new_uri, msg_start::request, _str::s, and msg_start::u.

qvalue_t get_ruri_q ( void   ) 

Return the q value of the Request-URI.

Get the q value of the Request-URI.

Definition at line 438 of file dset.c.

References ruri_q.

Referenced by t_load_contacts().

unsigned int getb0flags ( void   ) 

Get the per branch flags for RURI.

Get/set the per branch flags for the RURI (branch 0).

Definition at line 108 of file dset.c.

References ruri_bflags.

Referenced by add_uac(), do_action(), pack_ci(), reply_received(), t_forward_nonack(), and t_load_contacts().

int isbflagset ( unsigned int  b_idx,
unsigned int  mask 
)

Tests the per branch flags.

Test the per branch flag.

Definition at line 137 of file dset.c.

References get_ptr_bflags().

Referenced by do_action().

char* print_dset ( struct sip_msg msg,
int *  len 
)

Create a Contact header field from the dset array.

Create a Contact header field from the list of current branches.

Definition at line 338 of file dset.c.

References CONTACT, CONTACT_DELIM, CONTACT_DELIM_LEN, CONTACT_LEN, CRLF, CRLF_LEN, get_branch(), _str::len, len_q(), LM_ERR, MAX_REDIRECTION_LEN, sip_msg::new_uri, branch::q, q2str(), Q_PARAM, Q_PARAM_LEN, Q_UNSPECIFIED, ruri_q, _str::s, and branch::uri.

Referenced by _reply(), and sl_send_reply_helper().

int resetbflag ( unsigned int  b_idx,
unsigned int  mask 
)

Resets the per branch flags.

Reset the per branch flag.

Definition at line 152 of file dset.c.

References get_ptr_bflags().

Referenced by do_action().

int rewrite_uri ( struct sip_msg _m,
str _s 
)

void set_ruri_q ( qvalue_t  q  ) 

Sets the q parameter of the Request-URI.

Set the q value of the Request-URI.

Definition at line 429 of file dset.c.

References ruri_q.

Referenced by do_query(), enum_pv_query_3(), and lookup().

unsigned int setb0flags ( unsigned int  flags  ) 

Definition at line 114 of file dset.c.

References ruri_bflags.

Referenced by do_action(), fake_req(), reply_received(), t_forward_nonack(), and t_next_contacts().

int setbflag ( unsigned int  b_idx,
unsigned int  mask 
)

Set the per branch flag.

Definition at line 121 of file dset.c.

References get_ptr_bflags().

Referenced by cpl_proxy_to_loc_set(), do_action(), and lookup().


Variable Documentation

struct branch branches[MAX_BRANCHES-1] [static]

Where we store URIs of additional transaction branches (-1 because of the default branch, #0).

Definition at line 73 of file dset.c.

Referenced by append_branch(), branch_uri2dset(), get_branch(), and get_ptr_bflags().

unsigned int nr_branches = 0

how many of them we have

Definition at line 80 of file dset.c.

Referenced by append_branch(), branch_uri2dset(), clear_branches(), get_branch(), get_ptr_bflags(), and t_load_contacts().

unsigned int ruri_bflags = 0 [static]

Branch flags of the Request-URI

Definition at line 87 of file dset.c.

Referenced by clear_branches(), get_ptr_bflags(), getb0flags(), and setb0flags().

qvalue_t ruri_q = Q_UNSPECIFIED [static]

The q parameter of the Request-URI

Definition at line 83 of file dset.c.

Referenced by clear_branches(), get_ruri_q(), print_dset(), and set_ruri_q().


Generated on Tue May 22 16:00:39 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6