ws_frame.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2012 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #ifndef _WS_FRAME_H
  24. #define _WS_FRAME_H
  25. #include "../../config.h"
  26. #include "../../sr_module.h"
  27. #include "../../str.h"
  28. #include "../../lib/kmi/tree.h"
  29. #include "ws_conn.h"
  30. typedef enum
  31. {
  32. LOCAL_CLOSE = 0,
  33. REMOTE_CLOSE
  34. } ws_close_type_t;
  35. #define DEFAULT_KEEPALIVE_TIMEOUT 180 /* seconds */
  36. extern int ws_keepalive_timeout;
  37. enum
  38. {
  39. KEEPALIVE_MECHANISM_NONE = 0,
  40. KEEPALIVE_MECHANISM_PING = 1,
  41. KEEPALIVE_MECHANISM_PONG = 2
  42. };
  43. #define DEFAULT_KEEPALIVE_MECHANISM KEEPALIVE_MECHANISM_PING
  44. extern int ws_keepalive_mechanism;
  45. extern str ws_ping_application_data;
  46. #define DEFAULT_PING_APPLICATION_DATA SERVER_HDR
  47. #define DEFAULT_PING_APPLICATION_DATA_LEN SERVER_HDR_LEN
  48. extern stat_var *ws_failed_connections;
  49. extern stat_var *ws_local_closed_connections;
  50. extern stat_var *ws_received_frames;
  51. extern stat_var *ws_remote_closed_connections;
  52. extern stat_var *ws_transmitted_frames;
  53. int ws_frame_receive(void *data);
  54. int ws_frame_transmit(void *data);
  55. struct mi_root *ws_mi_close(struct mi_root *cmd, void *param);
  56. struct mi_root *ws_mi_ping(struct mi_root *cmd, void *param);
  57. struct mi_root *ws_mi_pong(struct mi_root *cmd, void *param);
  58. void ws_keepalive(unsigned int ticks, void *param);
  59. #endif /* _WS_FRAME_H */