ws_frame.h 2.8 KB

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