rtpproxy.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* $Id: nathelper.c 1808 2007-03-10 17:36:19Z bogdan_iancu $
  2. *
  3. * Copyright (C) 2003 Porta Software Ltd
  4. *
  5. * This file is part of Kamailio, a free SIP server.
  6. *
  7. * Kamailio is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version
  11. *
  12. * Kamailio is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * History:
  22. * ---------
  23. * 2007-04-13 splitted from nathelper.c (ancuta)
  24. */
  25. #ifndef _RTPPROXY_H
  26. #define _RTPPROXY_H
  27. #include <sys/uio.h>
  28. #include "../../str.h"
  29. /* Handy macros */
  30. #define STR2IOVEC(sx, ix) do {(ix).iov_base = (sx).s; (ix).iov_len = (sx).len;} while(0)
  31. #define SZ2IOVEC(sx, ix) do {(ix).iov_base = (sx); (ix).iov_len = strlen(sx);} while(0)
  32. struct rtpp_node {
  33. unsigned int idx; /* overall index */
  34. str rn_url; /* unparsed, deletable */
  35. int rn_umode;
  36. char *rn_address; /* substring of rn_url */
  37. int rn_disabled; /* found unaccessible? */
  38. unsigned rn_weight; /* for load balancing */
  39. unsigned int rn_recheck_ticks;
  40. int rn_rep_supported;
  41. int rn_ptl_supported;
  42. struct rtpp_node *rn_next;
  43. };
  44. struct rtpp_set{
  45. unsigned int id_set;
  46. unsigned weight_sum;
  47. unsigned int rtpp_node_count;
  48. int set_disabled;
  49. unsigned int set_recheck_ticks;
  50. struct rtpp_node *rn_first;
  51. struct rtpp_node *rn_last;
  52. struct rtpp_set *rset_next;
  53. };
  54. struct rtpp_set_head{
  55. struct rtpp_set *rset_first;
  56. struct rtpp_set *rset_last;
  57. };
  58. /* Functions from nathelper */
  59. struct rtpp_node *select_rtpp_node(str, int);
  60. char *send_rtpp_command(struct rtpp_node *, struct iovec *, int);
  61. struct rtpp_set *get_rtpp_set(str *set_name);
  62. int insert_rtpp_node(struct rtpp_set *const rtpp_list, const str *const url, const int weight, const int disabled);
  63. int set_rtp_inst_pvar(struct sip_msg *msg, const str * const uri);
  64. int init_rtpproxy_db(void);
  65. extern str rtpp_db_url;
  66. extern str rtpp_table_name;
  67. #endif