t_fifo.c File Reference

TM :: Transaction maintenance functions. More...

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/un.h>
#include <ctype.h>
#include "../../str.h"
#include "../../ut.h"
#include "../../dprint.h"
#include "../../pvar.h"
#include "../../mem/mem.h"
#include "../../parser/parser_f.h"
#include "../../parser/parse_from.h"
#include "../../parser/parse_rr.h"
#include "../../parser/contact/parse_contact.h"
#include "../../tsend.h"
#include "t_lookup.h"
#include "t_fwd.h"
#include "t_fifo.h"

Include dependency graph for t_fifo.c:

Go to the source code of this file.

Data Structures

struct  append_elem
struct  tw_append
struct  tw_info

Defines

#define AF_LOCAL   AF_UNIX
#define APPEND_BUFFER_MAX   4096
#define CMD_BUFFER_MAX   128
#define copy_route(s, len, rs, rlen)
#define eol_line(_i_)   ( lines_eol[2*(_i_)] )
#define IDBUF_LEN   128
#define PF_LOCAL   PF_UNIX
#define ROUTE_BUFFER_MAX   512
#define SUN_LEN(sa)
#define TWRITE_PARAMS   20
#define TWRITE_VERSION_LEN   (sizeof(TWRITE_VERSION_S)-1)
#define TWRITE_VERSION_S   "0.3"

Functions

static char * add2buf (char *buf, char *end, str *name, str *value)
static char * append2buf (char *buf, int len, struct sip_msg *req, struct append_elem *elem)
static int assemble_msg (struct sip_msg *msg, struct tw_info *twi)
 Assemble a message.
int fixup_t_write (void **param, int param_no)
int init_twrite_lines (void)
int init_twrite_sock (void)
int parse_tw_append (modparam_t type, void *val)
 tw_append syntax: tw_append = name:element[;element] element = (title=pseudo_variable) | msg(body)
static struct tw_appendsearch_tw_append (char *name, int len)
int t_write_req (struct sip_msg *msg, char *vm_fifo, char *info)
int t_write_unix (struct sip_msg *msg, char *socket, char *info)
static int write_to_fifo (char *fifo, int cnt)
static int write_to_unixsock (char *sockname, int cnt)

Variables

static str eol = {"\n",1}
static str lines_eol [2 *TWRITE_PARAMS]
static int sock
int tm_unix_tx_timeout = 2
static struct tw_appendtw_appends


Detailed Description

TM :: Transaction maintenance functions.

Definition in file t_fifo.c.


Define Documentation

#define AF_LOCAL   AF_UNIX

Definition at line 68 of file t_fifo.c.

#define APPEND_BUFFER_MAX   4096

Definition at line 90 of file t_fifo.c.

Referenced by assemble_msg().

#define CMD_BUFFER_MAX   128

Definition at line 91 of file t_fifo.c.

Referenced by assemble_msg().

#define copy_route ( s,
len,
rs,
rlen   ) 

Definition at line 93 of file t_fifo.c.

Referenced by assemble_msg().

#define eol_line ( _i_   )     ( lines_eol[2*(_i_)] )

Definition at line 86 of file t_fifo.c.

Referenced by assemble_msg(), and init_twrite_lines().

#define IDBUF_LEN   128

Definition at line 88 of file t_fifo.c.

Referenced by assemble_msg().

#define PF_LOCAL   PF_UNIX

Definition at line 71 of file t_fifo.c.

#define ROUTE_BUFFER_MAX   512

Definition at line 89 of file t_fifo.c.

Referenced by assemble_msg().

#define SUN_LEN ( sa   ) 

Value:

( strlen((sa)->sun_path) + \
                (size_t)(((struct sockaddr_un*)0)->sun_path) )

Definition at line 77 of file t_fifo.c.

#define TWRITE_PARAMS   20

Definition at line 83 of file t_fifo.c.

Referenced by init_twrite_lines(), t_write_req(), and t_write_unix().

#define TWRITE_VERSION_LEN   (sizeof(TWRITE_VERSION_S)-1)

Definition at line 85 of file t_fifo.c.

Referenced by init_twrite_lines().

#define TWRITE_VERSION_S   "0.3"

Definition at line 84 of file t_fifo.c.

Referenced by init_twrite_lines().


Function Documentation

static char* add2buf ( char *  buf,
char *  end,
str name,
str value 
) [inline, static]

Definition at line 421 of file t_fifo.c.

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

Referenced by append2buf().

static char* append2buf ( char *  buf,
int  len,
struct sip_msg req,
struct append_elem elem 
) [inline, static]

static int assemble_msg ( struct sip_msg msg,
struct tw_info twi 
) [static]

int fixup_t_write ( void **  param,
int  param_no 
)

int init_twrite_lines ( void   ) 

Definition at line 363 of file t_fifo.c.

References eol_line, _str::len, _str::s, TWRITE_PARAMS, TWRITE_VERSION_LEN, and TWRITE_VERSION_S.

Referenced by mod_init().

int init_twrite_sock ( void   ) 

Definition at line 334 of file t_fifo.c.

References LM_ERR, PF_LOCAL, and sock.

Referenced by mod_init().

int parse_tw_append ( modparam_t  type,
void *  val 
)

tw_append syntax: tw_append = name:element[;element] element = (title=pseudo_variable) | msg(body)

Definition at line 139 of file t_fifo.c.

References tw_append::add_body, tw_append::elems, _str::len, LM_ERR, append_elem::name, tw_append::name, append_elem::next, tw_append::next, pkg_malloc, pv_parse_spec(), PVT_MSG_BODY, _str::s, s, append_elem::spec, and _pv_spec::type.

static struct tw_append* search_tw_append ( char *  name,
int  len 
) [static, read]

Definition at line 282 of file t_fifo.c.

References _str::len, tw_append::name, tw_append::next, and _str::s.

Referenced by fixup_t_write().

int t_write_req ( struct sip_msg msg,
char *  vm_fifo,
char *  info 
)

Definition at line 762 of file t_fifo.c.

References add_blind_uac(), assemble_msg(), LM_ERR, TWRITE_PARAMS, and write_to_fifo().

int t_write_unix ( struct sip_msg msg,
char *  socket,
char *  info 
)

Definition at line 784 of file t_fifo.c.

References add_blind_uac(), assemble_msg(), LM_ERR, TWRITE_PARAMS, and write_to_unixsock().

static int write_to_fifo ( char *  fifo,
int  cnt 
) [inline, static]

Definition at line 383 of file t_fifo.c.

References LM_DBG, and LM_ERR.

Referenced by t_write_req().

static int write_to_unixsock ( char *  sockname,
int  cnt 
) [static]

Definition at line 710 of file t_fifo.c.

References E_UNSPEC, len, LM_ERR, PF_LOCAL, sock, SUN_LEN, tm_unix_tx_timeout, and tsend_dgram_ev().

Referenced by t_write_unix().


Variable Documentation

str eol = {"\n",1} [static]

Definition at line 109 of file t_fifo.c.

str lines_eol[2 *TWRITE_PARAMS] [static]

Definition at line 108 of file t_fifo.c.

int sock [static]

Default is 2 seconds

Definition at line 81 of file t_fifo.c.

Referenced by write_to_unixsock().

struct tw_append* tw_appends [static]

Definition at line 131 of file t_fifo.c.


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