ws_frame.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2012-2013 Crocodile RCS Ltd
  5. *
  6. * This file is part of Kamailio, a free SIP server.
  7. *
  8. * Kamailio 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. * Kamailio is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. * Exception: permission to copy, modify, propagate, and distribute a work
  23. * formed by combining OpenSSL toolkit software and the code in this file,
  24. * such as linking with software components and libraries released under
  25. * OpenSSL project license.
  26. *
  27. */
  28. #ifndef _WS_FRAME_H
  29. #define _WS_FRAME_H
  30. #include "../../config.h"
  31. #include "../../sr_module.h"
  32. #include "../../str.h"
  33. #include "../../lib/kmi/tree.h"
  34. #include "ws_conn.h"
  35. typedef enum
  36. {
  37. LOCAL_CLOSE = 0,
  38. REMOTE_CLOSE
  39. } ws_close_type_t;
  40. enum
  41. {
  42. KEEPALIVE_MECHANISM_NONE = 0,
  43. KEEPALIVE_MECHANISM_PING = 1,
  44. KEEPALIVE_MECHANISM_PONG = 2
  45. };
  46. #define DEFAULT_KEEPALIVE_MECHANISM KEEPALIVE_MECHANISM_PING
  47. extern int ws_keepalive_mechanism;
  48. #define DEFAULT_KEEPALIVE_TIMEOUT 180 /* seconds */
  49. extern str ws_ping_application_data;
  50. #define DEFAULT_PING_APPLICATION_DATA SERVER_HDR
  51. #define DEFAULT_PING_APPLICATION_DATA_LEN SERVER_HDR_LEN
  52. extern stat_var *ws_failed_connections;
  53. extern stat_var *ws_local_closed_connections;
  54. extern stat_var *ws_received_frames;
  55. extern stat_var *ws_remote_closed_connections;
  56. extern stat_var *ws_transmitted_frames;
  57. extern stat_var *ws_sip_failed_connections;
  58. extern stat_var *ws_sip_local_closed_connections;
  59. extern stat_var *ws_sip_received_frames;
  60. extern stat_var *ws_sip_remote_closed_connections;
  61. extern stat_var *ws_sip_transmitted_frames;
  62. extern stat_var *ws_msrp_failed_connections;
  63. extern stat_var *ws_msrp_local_closed_connections;
  64. extern stat_var *ws_msrp_received_frames;
  65. extern stat_var *ws_msrp_remote_closed_connections;
  66. extern stat_var *ws_msrp_transmitted_frames;
  67. int ws_frame_receive(void *data);
  68. int ws_frame_transmit(void *data);
  69. struct mi_root *ws_mi_close(struct mi_root *cmd, void *param);
  70. struct mi_root *ws_mi_ping(struct mi_root *cmd, void *param);
  71. struct mi_root *ws_mi_pong(struct mi_root *cmd, void *param);
  72. void ws_keepalive(unsigned int ticks, void *param);
  73. int ws_close(sip_msg_t *msg);
  74. int ws_close2(sip_msg_t *msg, char *_status, char *_reason);
  75. int ws_close3(sip_msg_t *msg, char *_status, char *_reason, char *_con);
  76. #endif /* _WS_FRAME_H */