dlg.h File Reference

TM :: Dialog handling. More...

#include <stdio.h>
#include "../../str.h"
#include "../../parser/parse_rr.h"
#include "../../parser/msg_parser.h"

Include dependency graph for dlg.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dlg
struct  dlg_hooks
struct  dlg_id
struct  dlg_seq

Typedefs

typedef int(* dlg_add_extra_f )(dlg_t *_d, str *_ldname, str *_rdname)
typedef struct dlg_hooks dlg_hooks_t
typedef struct dlg_id dlg_id_t
typedef int(* dlg_request_uas_f )(dlg_t *_d, struct sip_msg *_m)
typedef int(* dlg_response_uac_f )(dlg_t *_d, struct sip_msg *_m)
typedef struct dlg_seq dlg_seq_t
typedef enum dlg_state dlg_state_t
typedef struct dlg dlg_t
typedef void(* free_dlg_f )(dlg_t *_d)
typedef int(* new_dlg_uac_f )(str *_cid, str *_ltag, unsigned int _lseq, str *_luri, str *_ruri, dlg_t **_d)
typedef int(* new_dlg_uas_f )(struct sip_msg *_req, int _code, dlg_t **_d)
typedef void(* print_dlg_f )(FILE *out, dlg_t *_d)

Enumerations

enum  dlg_state { DLG_NEW = 0, DLG_EARLY, DLG_CONFIRMED, DLG_DESTROYED }

Functions

int calculate_routeset_length (dlg_t *_d)
 Calculate length of the route set.
int dlg_add_extra (dlg_t *_d, str *_ldname, str *_rdname)
 Store display names into a dialog.
int dlg_request_uas (dlg_t *_d, struct sip_msg *_m)
 UAS side - update a dialog from a request.
int dlg_response_uac (dlg_t *_d, struct sip_msg *_m)
 A response arrived, update dialog.
void free_dlg (dlg_t *_d)
 Destroy a dialog state.
int new_dlg_uac (str *_cid, str *_ltag, unsigned int _lseq, str *_luri, str *_ruri, dlg_t **_d)
 Create a new dialog.
int new_dlg_uas (struct sip_msg *_req, int _code, dlg_t **_d)
 Establishing a new dialog from the UAS side.
void print_dlg (FILE *out, dlg_t *_d)
 Print a dialog structure, just for debugging.
char * print_routeset (char *buf, dlg_t *_d)
 Print the route set.
int w_calculate_hooks (dlg_t *_d)
 Small wrapper to calculate_hooks.


Detailed Description

TM :: Dialog handling.

Definition in file dlg.h.


Typedef Documentation

typedef int(* dlg_add_extra_f)(dlg_t *_d, str *_ldname, str *_rdname)

Definition at line 119 of file dlg.h.

typedef struct dlg_hooks dlg_hooks_t

It is necessary to analyze the dialog data to find out what URI put into the Record-Route, where the message should be really sent and how to construct the route set of the message. This structure stores this information so we don't have to calculate each time we want to send a message within dialog

typedef struct dlg_id dlg_id_t

typedef int(* dlg_request_uas_f)(dlg_t *_d, struct sip_msg *_m)

Definition at line 138 of file dlg.h.

typedef int(* dlg_response_uac_f)(dlg_t *_d, struct sip_msg *_m)

Definition at line 125 of file dlg.h.

typedef struct dlg_seq dlg_seq_t

Dialog sequence

typedef enum dlg_state dlg_state_t

typedef struct dlg dlg_t

Structure representing dialog state

typedef void(* free_dlg_f)(dlg_t *_d)

Definition at line 145 of file dlg.h.

typedef int(* new_dlg_uac_f)(str *_cid, str *_ltag, unsigned int _lseq, str *_luri, str *_ruri, dlg_t **_d)

Definition at line 113 of file dlg.h.

typedef int(* new_dlg_uas_f)(struct sip_msg *_req, int _code, dlg_t **_d)

Definition at line 131 of file dlg.h.

typedef void(* print_dlg_f)(FILE *out, dlg_t *_d)

Definition at line 152 of file dlg.h.


Enumeration Type Documentation

enum dlg_state

Enumerator:
DLG_NEW  New dialog, no reply received yet
DLG_EARLY  Early dialog, provisional response received
DLG_CONFIRMED  Confirmed dialog, 2xx received
DLG_DESTROYED  Destroyed dialog

Definition at line 55 of file dlg.h.


Function Documentation

int calculate_routeset_length ( dlg_t _d  ) 

Calculate length of the route set.

Parameters:
_d dialog set
Returns:
the length of the route set, can be 0

Definition at line 896 of file dlg.c.

References CRLF_LEN, dlg_hooks::first_route, dlg::hooks, dlg_hooks::last_route, _str::len, rr::len, len, rr::next, ROUTE_PREFIX_LEN, and ROUTE_SEPARATOR_LEN.

Referenced by build_uac_req().

int dlg_add_extra ( dlg_t _d,
str _ldname,
str _rdname 
)

Store display names into a dialog.

Parameters:
_d dialog state
_ldname local display name
_rdname remote display name
Returns:
0 on success, negative on error

Definition at line 211 of file dlg.c.

References LM_ERR, dlg::loc_dname, dlg::rem_dname, and shm_str_dup().

Referenced by load_tm().

int dlg_request_uas ( dlg_t _d,
struct sip_msg _m 
)

UAS side - update a dialog from a request.

Parameters:
_d dialog state
_m SIP request
Returns:
0 on success, negative on error

Definition at line 846 of file dlg.c.

References sip_msg::first_line, get_contact_uri(), get_cseq_value(), HDR_CONTACT_F, HDR_CSEQ_F, dlg_seq::is_set, _str::len, LM_ERR, METHOD_INVITE, parse_headers(), dlg::rem_seq, dlg::rem_target, msg_start::request, _str::s, shm_free, shm_str_dup(), msg_start::u, and dlg_seq::value.

Referenced by load_tm().

int dlg_response_uac ( dlg_t _d,
struct sip_msg _m 
)

A response arrived, update dialog.

Parameters:
_d dialog state
_m SIP message
Returns:
1 if the dialog was destroyed, negative on errors, 0 otherwise

Definition at line 605 of file dlg.c.

References DLG_CONFIRMED, dlg_confirmed_resp_uac(), DLG_DESTROYED, DLG_EARLY, dlg_early_resp_uac(), DLG_NEW, dlg_new_resp_uac(), LM_ERR, and dlg::state.

Referenced by load_tm(), and mi_print_uris().

void free_dlg ( dlg_t _d  ) 

int new_dlg_uac ( str _cid,
str _ltag,
unsigned int  _lseq,
str _luri,
str _ruri,
dlg_t **  _d 
)

Create a new dialog.

Parameters:
_cid Callid
_ltag local tag (usually From tag)
_lseq local sequence (usually CSeq)
_luri local URI (usually From)
_ruri remote URI (usually To)
_d dialog state
Returns:
0 on success, negative on errors

Definition at line 160 of file dlg.c.

References calculate_hooks(), dlg_id::call_id, dlg::id, dlg_seq::is_set, LM_ERR, dlg::loc_seq, dlg_id::loc_tag, dlg::loc_uri, dlg::rem_uri, shm_free, shm_malloc(), shm_str_dup(), and dlg_seq::value.

Referenced by load_tm(), req_outside(), and request().

int new_dlg_uas ( struct sip_msg _req,
int  _code,
dlg_t **  _d 
)

Establishing a new dialog from the UAS side.

Parameters:
_req SIP request
_code request code
_d dialog state
Returns:
0 on success, negative on error

Definition at line 791 of file dlg.c.

References calc_crc_suffix(), calculate_hooks(), DLG_CONFIRMED, free_dlg(), dlg::id, _str::len, LM_DBG, LM_ERR, dlg_id::loc_tag, request2dlg(), _str::s, shm_free, shm_malloc(), shm_str_dup(), dlg::state, tm_tag_suffix, tm_tags, and TOTAG_VALUE_LEN.

Referenced by load_tm().

void print_dlg ( FILE *  out,
dlg_t _d 
)

char* print_routeset ( char *  buf,
dlg_t _d 
)

Print the route set.

Parameters:
buf buffer
_d dialog state
Returns:
pointer to the buffer

Definition at line 930 of file dlg.c.

References CRLF, CRLF_LEN, dlg_hooks::first_route, dlg::hooks, dlg_hooks::last_route, _str::len, rr::len, name_addr::name, rr::nameaddr, rr::next, ROUTE_PREFIX, ROUTE_PREFIX_LEN, ROUTE_SEPARATOR, ROUTE_SEPARATOR_LEN, and _str::s.

Referenced by build_uac_req().

int w_calculate_hooks ( dlg_t _d  ) 

Small wrapper to calculate_hooks.

Parameters:
_d dialog state
Returns:
0 on success, -1 on error

Definition at line 144 of file dlg.c.

References calculate_hooks().

Referenced by request(), and t_uac().


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