t_reply.h

Go to the documentation of this file.
00001 /*
00002  * $Id: t_reply.h 5718 2009-03-18 01:07:46Z ibc_sf $
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 
00023 /*! \file
00024  * \brief TM :: Reply handling
00025  *
00026  * \ingroup tm
00027  * - Module: \ref tm
00028  * - \ref t_reply.c
00029  */
00030 
00031 #ifndef _T_REPLY_H
00032 #define _T_REPLY_H
00033 
00034 #include "../../tags.h"
00035 
00036 #include "h_table.h"
00037 
00038 
00039 extern int restart_fr_on_each_reply;
00040 extern int onreply_avp_mode;
00041 extern int drop_stateless_replies;
00042 
00043 /*! reply processing status */
00044 enum rps {
00045    /*! something bad happened */
00046    RPS_ERROR=0,   
00047    /*! transaction completed but we still accept the reply */
00048    RPS_PUSHED_AFTER_COMPLETION,
00049    /*! reply discarded */
00050    RPS_DISCARDED,
00051    /*! reply stored for later processing */
00052    RPS_STORE,
00053    /*! transaction completed */
00054    RPS_COMPLETED,
00055    /*! provisional reply not affecting transaction state */
00056    RPS_PROVISIONAL
00057 };
00058 
00059 extern char tm_tags[TOTAG_VALUE_LEN];
00060 extern char *tm_tag_suffix;
00061 
00062 extern int disable_6xx_block;
00063 
00064 /*! has this to-tag been never seen in previous 200/INVs? */
00065 int unmatched_totag(struct cell *t, struct sip_msg *ack);
00066 
00067 /*! branch bitmap type */
00068 typedef unsigned int branch_bm_t;
00069 
00070 /* reply export types */
00071 typedef int (*treply_f)(struct sip_msg * , unsigned int , str * );
00072 typedef int (*treply_wb_f)( struct cell* trans, unsigned int code, str *text,
00073    str *body, str *new_header, str *to_tag);
00074 typedef int (*tget_reply_totag_f)(struct sip_msg *, str *);
00075 
00076 int t_get_reply_totag(struct sip_msg *msg, str *totag);
00077 
00078 #define LOCK_REPLIES(_t) lock(&(_t)->reply_mutex )
00079 #define UNLOCK_REPLIES(_t) unlock(&(_t)->reply_mutex )
00080 
00081 /* This function is called whenever a reply for our module is received;
00082  * we need to register this function on module initialization;
00083  * Returns :   0 - core router stops
00084  *             1 - core router relay statelessly
00085  */
00086 int reply_received( struct sip_msg  *p_msg ) ;
00087 
00088 
00089 int t_reply_with_body( struct cell *trans, unsigned int code, 
00090              str *text, str *body, str *new_header, str *to_tag );
00091 
00092 
00093 /* send a UAS reply
00094  * returns 1 if everything was OK or -1 for error
00095  */
00096 int t_reply( struct cell *t, struct sip_msg * , unsigned int , str * );
00097 /* the same as t_reply, except it does not claim
00098    REPLY_LOCK -- useful to be called within reply
00099    processing
00100 */
00101 int t_reply_unsafe( struct cell *t, struct sip_msg * , unsigned int , str * );
00102 
00103 
00104 enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, 
00105    unsigned int msg_status, branch_bm_t *cancel_bitmap );
00106 
00107 enum rps local_reply( struct cell *t, struct sip_msg *p_msg, int branch,
00108     unsigned int msg_status, branch_bm_t *cancel_bitmap );
00109 
00110 void set_final_timer( /* struct s_table *h_table,*/ struct cell *t );
00111 
00112 void cleanup_uac_timers( struct cell *t );
00113 
00114 void on_negative_reply( struct cell* t, struct sip_msg* msg,
00115    int code, void *param  );
00116 
00117 typedef int (*tget_picked_f)(void);
00118 
00119 int t_get_picked_branch(void);
00120 
00121 /* set which 'reply' structure to take if only negative
00122    replies arrive 
00123 */
00124 void t_on_negative( unsigned int go_to );
00125 unsigned int get_on_negative(void);
00126 void t_on_reply( unsigned int go_to );
00127 unsigned int get_on_reply(void);
00128 
00129 /* Retransmits the last sent inbound reply.
00130  * \param t
00131  * \return  -1 - error,  1 - OK
00132  */
00133 int t_retransmit_reply( struct cell *t );
00134 
00135 void tm_init_tags(void);
00136 
00137 int unixsock_t_reply(str* msg);
00138 
00139 #endif
00140 

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