modules/tm/t_lookup.h
caf80ae6
 /*
  * $Id$
7dd0b342
  *
84d8e165
  * Copyright (C) 2001-2003 FhG Fokus
7dd0b342
  *
  * This file is part of ser, a free SIP server.
  *
  * ser is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version
  *
  * For a license to use the ser software under conditions
  * other than those described here, or to purchase support for this
  * software, please contact iptel.org by e-mail at the following addresses:
  *    info@iptel.org
  *
  * ser is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
caf80ae6
  */
1ea91058
 /*
  * History:
  * --------
  *  2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
  *               nameser_compat.h (andrei)
c2ea965c
  *  2004-02-11  FIFO/CANCEL + alignments (hash=f(callid,cseq)) (uli+jiri)
57857a94
  *  2005-12-09  added t_set_fr()  (andrei)
1ea91058
  */
caf80ae6
 
 
7dd0b342
 
caf80ae6
 #ifndef _T_LOOKUP_H
 #define _T_LOOKUP_H
 
ff979952
 #include "defs.h"
 
 
caf80ae6
 #include "config.h"
 #include "t_funcs.h"
 
 #define T_UNDEFINED  ( (struct cell*) -1 )
1ea91058
 #define T_NULL_CELL       ( (struct cell*) 0 )
caf80ae6
 
 extern unsigned int     global_msg_id;
 
b4a4494d
 
 
caf80ae6
 void init_t();
 int init_rb( struct retr_buf *rb, struct sip_msg *msg );
b1f1656e
 struct cell* t_lookupOriginalT( struct sip_msg* p_msg );
caf80ae6
 int t_reply_matching( struct sip_msg* , int* );
ec76200f
 int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked,
 						int* canceled);
caf80ae6
 int t_newtran( struct sip_msg* p_msg );
 
 int _add_branch_label( struct cell *trans,
     char *str, int *len, int branch );
 int add_branch_label( struct cell *trans, 
 	struct sip_msg *p_msg, int branch );
 
 /* releases T-context */
 int t_unref( struct sip_msg *p_msg);
04436036
 typedef int (*tunref_f)( struct sip_msg *p_msg);
caf80ae6
 
 /* function returns:
  *      -1 - transaction wasn't found
  *       1 - transaction found
  */
 int t_check( struct sip_msg* , int *branch );
 
f2377e06
 typedef struct cell * (*tgett_f)(void);
caf80ae6
 struct cell *get_t();
 
8ba9c567
 /* use carefully or better not at all -- current transaction is 
  * primarily set by lookup functions */
 void set_t(struct cell *t);
 
96dd9e9f
 
 #define T_GET_TI       "t_get_trans_ident"
 #define T_LOOKUP_IDENT "t_lookup_ident"
 #define T_IS_LOCAL     "t_is_local"
 
 typedef int (*tislocal_f)(struct sip_msg*);
b24f1ec7
 typedef int (*tnewtran_f)(struct sip_msg*);
96dd9e9f
 typedef int (*tget_ti_f)(struct sip_msg*, unsigned int*, unsigned int*);
fde02f64
 typedef int (*tlookup_ident_f)(struct cell**, unsigned int, unsigned int);
04436036
 typedef int (*trelease_f)(struct sip_msg*);
96dd9e9f
 
 int t_is_local(struct sip_msg*);
 int t_get_trans_ident(struct sip_msg* p_msg, unsigned int* hash_index, unsigned int* label);
fde02f64
 int t_lookup_ident(struct cell** trans, unsigned int hash_index, unsigned int label);
c2ea965c
 /* lookup a transaction by callid and cseq */
 int t_lookup_callid(struct cell** trans, str callid, str cseq);
caf80ae6
 
57857a94
 int t_set_fr(struct sip_msg* msg, unsigned int fr_inv_to, unsigned int fr_to );
16daadfd
 int t_reset_fr();
c0ff60b6
 #ifdef TM_DIFF_RT_TIMEOUT
 int t_set_retr(struct sip_msg* msg, unsigned int t1_to, unsigned int t2_to);
16daadfd
 int t_reset_retr();
caf80ae6
 #endif
c0ff60b6
 int t_set_max_lifetime(struct sip_msg* msg, unsigned int eol_inv,
 											unsigned int eol_noninv);
16daadfd
 int t_reset_max_lifetime();
caf80ae6
 
2b5e5254
 #ifdef WITH_AS_SUPPORT
 /**
  * Returns the hash coordinates of the transaction current CANCEL is targeting.
  */
 int t_get_canceled_ident(struct sip_msg *msg, unsigned int *hash_index, 
 		unsigned int *label);
 typedef int (*t_get_canceled_ident_f)(struct sip_msg *msg, 
 		unsigned int *hash_index, unsigned int *label);
 #endif /* WITH_AS_SUPPORT */
 
c0ff60b6
 #endif