sst_handlers.h File Reference

Session timer handling

Module: SIP Session Timers module. More...

#include "../../pvar.h"
#include "../../parser/msg_parser.h"
#include "../dialog/dlg_load.h"

Include dependency graph for sst_handlers.h:

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

Go to the source code of this file.

Data Structures

struct  sst_info_st
 The local state required to figure out if and who supports SST and if and who will be the refresher. More...

Typedefs

typedef struct sst_info_st sst_info_t
 The local state required to figure out if and who supports SST and if and who will be the refresher.

Enumerations

enum  sst_flags {
  SST_UNDF = 0, SST_UAC = 1, SST_UAS = 2, SST_PXY = 4,
  SST_NSUP = 8
}
 Fag values used in the sst_info_t See below. More...

Functions

int sst_check_min (struct sip_msg *msg, char *str1, char *str2)
 The script function.
void sst_dialog_created_CB (struct dlg_cell *did, int type, struct dlg_cb_params *params)
 The static (opening) callback function for all dialog creations.
void sst_handler_init (pv_spec_t *timeout_avp, unsigned int minSE, int flag, unsigned int reject)
 The handlers initializer function.


Detailed Description

Session timer handling

Module: SIP Session Timers module.

Definition in file sst_handlers.h.


Typedef Documentation

typedef struct sst_info_st sst_info_t

The local state required to figure out if and who supports SST and if and who will be the refresher.


Enumeration Type Documentation

enum sst_flags

Fag values used in the sst_info_t See below.

Enumerator:
SST_UNDF 
SST_UAC 
SST_UAS 
SST_PXY 
SST_NSUP 

Definition at line 48 of file sst_handlers.h.


Function Documentation

int sst_check_min ( struct sip_msg msg,
char *  flag,
char *  str2 
)

The script function.

The sstCheckMin() script command handler. Return 1 (true) if the MIN-SE: of the message is too small compared to the sst_min_se value. This will allow the script to reply to this INVITE with a "422 Session Timer Too Small" response. if sst_min_se was never set the recommended value of 1800 seconds will be used.

If the flag (str1) is set to 1, the 422 reply will be sent with the sst MIN_SE value in the header. If the flag is not set or is NULL, no reply is sent.

Parameters:
msg - The sip message from the script (INVITE only)
flag - Reply mode Flag. 0/NULL do not send reply, 1 send 422 reply if Session-Expires is to small with the MIN-SE header in the reply
str2 - Not used.
Returns:
1 if the MIN-SE is too small, -1 if it is OK, or It could not be checked.
NOTE: returning 0 == drop message, 1 == true, -1 == false in the script.

Definition at line 610 of file sst_handlers.c.

References sip_msg::first_line, session_expires::interval, _str::len, LM_DBG, LM_ERR, METHOD_INVITE, MIN, parse_min_se(), parse_session_expires(), parse_sst_header_not_found, parse_sst_success, msg_start::request, _str::s, send_response(), SIP_REQUEST, sst_build_minse_hdr(), sst_min_se, msg_start::type, and msg_start::u.

void sst_dialog_created_CB ( struct dlg_cell did,
int  type,
struct dlg_cb_params params 
)

The static (opening) callback function for all dialog creations.

Every time a new dialog is created (from a new INVITE) the dialog module will call this callback function. We need to track the dialogs lifespan from this point forward until it is terminated with a BYE, CANCEL, etc. In the process, we will see if either or both ends of the conversation supports SIP Session Timers and setup the dialog timeout to expire at the session timer expire time. Each time the new re-INVITE is seen to update the SST, we will reset the life span of the dialog to match it.

This function will setup the other types of dialog callbacks required to track the lifespan of the dialog. It will also start the state tracking to figure out if and who supports SST.

As per RFC4028: Request handling:

  • The proxy may insert a SE header if none found.
  • The SE value can be anything >= Min-SE (if found)
  • The proxy MUST NOT add a refresher parameter to the SE.

  • If SE is already there, the Proxy can reduce its value but no lower then the Min-SE value if present.
  • If the SE value is >= Min-SE the proxy MUST NOT increase it!
  • If the SE value is < Min-SE (settable by the proxy) the proxy MUST increase the SE value to >= the new Min-SE.
  • The proxy MUST NOT insert or change the refresher parameter.

  • If the supported=timer is found, the proxy may reject the request with a 422 if the SE value is smaller then the local policy. The 422 MUST hold the proxies Min-SE value >= 90.
  • If support=timer is NOT indecated, the proxy can't reject with a 422 but can include/increase the MIN-SE: to be = to local policy. and increase the SE to match the new Min-SE value.
  • the proxy MUST NOT insert/change the Min-SE header if supported=timer is present. (DoS attacks)

Parameters:
did - The dialog ID
type - The trigger event type (CREATED)
params - The pointer to nothing. As we did not attach anything to this callback in the dialog module.

Definition at line 248 of file sst_handlers.c.

References append_header(), sip_msg::first_line, sip_msg::flags, sst_info_st::interval, LM_DBG, LM_ERR, LM_WARN, MAX, METHOD_INVITE, sst_msg_info_st::min_se, dlg_cb_params::msg, NULL, parse_msg_for_sst_info(), remove_header(), msg_start::request, sst_info_st::requester, _str::s, sst_msg_info_st::se, send_reject(), set_timeout_avp(), setup_dialog_callbacks(), shm_free, shm_malloc(), SIP_REQUEST, sst_build_minse_hdr(), sst_build_se_hdr(), sst_flag, sst_min_se, SST_PXY, sst_reject, SST_UAC, SST_UNDF, sst_msg_info_st::supported, sst_info_st::supported, msg_start::type, and msg_start::u.

Referenced by mod_init().

void sst_handler_init ( pv_spec_t timeout_avp_p,
unsigned int  min_se,
int  flag,
unsigned int  reject 
)

The handlers initializer function.

This is not a public API. This function is called when the module is loaded from the mod_init() function in sst.c to initialize the callback handlers and local variables.

Parameters:
timeout_avp_p - The pointer to the dialog modules timeout AVP.
min_se - The minimum session expire value allowed by this PROXY.
flag - sst flag
reject - reject state

Definition at line 198 of file sst_handlers.c.

References sst_flag, sst_min_se, and sst_reject.

Referenced by mod_init().


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