destination set / branches support.
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"
Go to the source code of this file.
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 the current transaction.
-
void clear_branches (void)
- Empty the array of branches.
- int drop_sip_branch (int idx)
- Drop branch[idx].
- char * get_branch (unsigned int i, int *len, qvalue_t *q, str *dst_uri, str *path, unsigned int *flags, struct socket_info **force_socket)
- Get a branch from the destination set.
- int get_branch_iterator (void)
- return the value of current branch iterator
-
qvalue_t get_ruri_q (void)
- Get the q value of the Request-URI.
- branch_t * get_sip_branch (int idx)
- Return pointer to branch[idx] structure.
- int getbflagsval (unsigned int branch, flag_t *res)
- Get the value of all branch flags for a branch.
-
void init_branch_iterator (void)
- Init the index to iterate through the list of transaction branches.
- int isbflagset (unsigned int branch, flag_t flag)
- Determine if a branch flag is set.
- char * next_branch (int *len, qvalue_t *q, str *dst_uri, str *path, unsigned int *flags, struct socket_info **force_socket)
- Return the next branch from the dset array.
-
char * print_dset (struct sip_msg *msg, int *len)
- Create a Contact header field from the list of current branches.
- int resetbflag (unsigned int branch, flag_t flag)
- Reset a per-branch flag value to 0.
- void set_branch_iterator (int n)
- set the value of current branch interator
-
void set_ruri_q (qvalue_t q)
- Set the q value of the Request-URI.
- int setbflag (unsigned int branch, flag_t flag)
- Set a per-branch flag to 1.
- int setbflagsval (unsigned int branch, flag_t val)
- Set the value of all branch flags at once for a given branch.
Detailed Description
Module: SIP-router core
Definition in file dset.c.
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 | |
|
) |
| | |
Add a new branch to current transaction.
- Parameters:
-
| msg | - sip message, used for getting the uri if not specified (0). |
| uri | - uri, can be 0 (in which case the uri is taken from msg) |
| dst_uri | - destination uri, can be 0. |
| path | - path vector (passed in a string), can be 0. |
| q | - q value. |
| flags | - per branch flags. |
| force_socket | - socket that should be used when sending. |
- Returns:
- <0 (-1) on failure, 1 on success (script convention).
Definition at line 297 of file dset.c.
References sip_msg::first_line, _str::len, MAX_BRANCHES, MAX_PATH_SIZE, MAX_URI_SIZE, sip_msg::new_uri, and _str::s.
Referenced by ser_append_branch().
| int drop_sip_branch |
( |
int |
idx |
) |
|
- Parameters:
-
- Returns:
- 0 on success, -1 on error
Definition at line 107 of file dset.c.
| char* get_branch |
( |
unsigned int |
i, |
|
|
int * |
len, |
|
|
qvalue_t * |
q, |
|
|
str * |
dst_uri, |
|
|
str * |
path, |
|
|
unsigned int * |
flags, |
|
|
struct socket_info ** |
force_socket | |
|
) |
| | |
- Returns:
- Return the 'i' branch from the dset array, 0 is returned if there are no more branches
Definition at line 216 of file dset.c.
References _str::len, and _str::s.
Referenced by next_branch().
| int get_branch_iterator |
( |
void |
|
) |
|
- Parameters:
-
- Returns:
- pointer to branch or NULL if invalid branch
Definition at line 86 of file dset.c.
| int getbflagsval |
( |
unsigned int |
branch, |
|
|
flag_t * |
res | |
|
) |
| | |
This function returns the value of all branch flags combined in a single variable.
- Parameters:
-
| branch | Number of the branch (0 for the main Request-URI branch) |
| res | A pointer to a variable to store the result |
- Returns:
- 1 on success, -1 on failure
Definition at line 165 of file dset.c.
Referenced by lookup(), and pack_ci().
| int isbflagset |
( |
unsigned int |
branch, |
|
|
flag_t |
flag | |
|
) |
| | |
This function tests the value of one particular per-branch flag.
- Parameters:
-
| branch | Number of the branch (0 for the main Request-URI branch) |
| flag | Number of the flag to be tested (starting with 0) |
- Returns:
- 1 if the branch flag is set, -1 if not or on failure.
Definition at line 146 of file dset.c.
| char* next_branch |
( |
int * |
len, |
|
|
qvalue_t * |
q, |
|
|
str * |
dst_uri, |
|
|
str * |
path, |
|
|
unsigned int * |
flags, |
|
|
struct socket_info ** |
force_socket | |
|
) |
| | |
Get the next branch in the current transaction.
0 is returned if there are no more branches
Definition at line 260 of file dset.c.
References get_branch().
Referenced by print_dset().
| int resetbflag |
( |
unsigned int |
branch, |
|
|
flag_t |
flag | |
|
) |
| | |
This function resets the value of one particular branch flag to 0.
- Parameters:
-
| branch | Number of the branch (0 for the main Request-URI branch) |
| flag | Number of the flag to be reset (starting with 0) |
- Returns:
- 1 on success, -1 on failure.
Definition at line 155 of file dset.c.
| void set_branch_iterator |
( |
int |
n |
) |
|
| int setbflag |
( |
unsigned int |
branch, |
|
|
flag_t |
flag | |
|
) |
| | |
This function sets the value of one particular branch flag to 1.
- Parameters:
-
| branch | Number of the branch (0 for the main Request-URI branch) |
| flag | Number of the flag to be set (starting with 0) |
- Returns:
- 1 on success, -1 on failure.
Definition at line 136 of file dset.c.
| int setbflagsval |
( |
unsigned int |
branch, |
|
|
flag_t |
val | |
|
) |
| | |
This function sets the value of all branch flags for a given branch at once.
- Parameters:
-
| branch | Number of the branch (0 for the main Request-URI branch) |
| val | All branch flags combined into a single variable |
- Returns:
- 1 on success, -1 on failure
Definition at line 175 of file dset.c.
Referenced by lookup().