t_reply.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 Fhg Fokus
  5. *
  6. * This file is part of ser, a free SIP server.
  7. *
  8. * ser is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * For a license to use the ser software under conditions
  14. * other than those described here, or to purchase support for this
  15. * software, please contact iptel.org by e-mail at the following addresses:
  16. * [email protected]
  17. *
  18. * ser is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26. */
  27. #ifndef _T_REPLY_H
  28. #define _T_REPLY_H
  29. #include "h_table.h"
  30. /* reply processing status */
  31. enum rps {
  32. /* something bad happened */
  33. RPS_ERROR=0,
  34. /* transaction completed but we still accept the reply */
  35. RPS_PUSHED_AFTER_COMPLETION,
  36. /* reply dscarded */
  37. RPS_DISCARDED,
  38. /* reply stored for later processing */
  39. RPS_STORE,
  40. /* transaction completed */
  41. RPS_COMPLETED,
  42. /* provisional reply not affecting transaction state */
  43. RPS_PROVISIONAL
  44. };
  45. /* branch bitmap type */
  46. typedef unsigned int branch_bm_t;
  47. /* reply export types */
  48. typedef int (*treply_f)( struct sip_msg* p_msg,
  49. unsigned int code, char * text );
  50. #define LOCK_REPLIES(_t) lock(&(_t)->reply_mutex )
  51. #define UNLOCK_REPLIES(_t) unlock(&(_t)->reply_mutex )
  52. /* This function is called whenever a reply for our module is received;
  53. * we need to register this function on module initialization;
  54. * Returns : 0 - core router stops
  55. * 1 - core router relay statelessly
  56. */
  57. int t_on_reply( struct sip_msg *p_msg ) ;
  58. /* Retransmits the last sent inbound reply.
  59. * Returns -1 - error
  60. * 1 - OK
  61. */
  62. int t_retransmit_reply( /* struct sip_msg * */ );
  63. /* send a UAS reply
  64. * returns 1 if everything was OK or -1 for erro
  65. */
  66. int t_reply( struct cell *t, struct sip_msg * , unsigned int , char * );
  67. /* the same as t_reply, except it does not claim
  68. REPLY_LOCK -- useful to be called within reply
  69. processing
  70. */
  71. int t_reply_unsafe( struct cell *t, struct sip_msg * , unsigned int , char * );
  72. enum rps t_should_relay_response( struct cell *Trans, int new_code,
  73. int branch, int *should_store, int *should_relay,
  74. branch_bm_t *cancel_bitmap );
  75. void cleanup_after_final( struct s_table *h_table, struct cell *t,
  76. unsigned int status );
  77. enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
  78. unsigned int msg_status, branch_bm_t *cancel_bitmap );
  79. enum rps local_reply( struct cell *t, struct sip_msg *p_msg, int branch,
  80. unsigned int msg_status, branch_bm_t *cancel_bitmap );
  81. int store_reply( struct cell *trans, int branch, struct sip_msg *rpl);
  82. void set_final_timer( /* struct s_table *h_table,*/ struct cell *t );
  83. void cleanup_uac_timers( struct cell *t );
  84. char *build_ack( struct sip_msg* rpl, struct cell *trans, int branch ,
  85. int *ret_len);
  86. void on_negative_reply( struct cell* t, struct sip_msg* msg,
  87. int code, void *param );
  88. /* set which 'reply' structure to take if only negative
  89. replies arrive
  90. */
  91. int t_on_negative( unsigned int go_to );
  92. unsigned int get_on_negative();
  93. int t_retransmit_reply( struct cell *t );
  94. #endif