Browse code

websocket: use signature macro instead of offsetting inside server hdr define

- pass rcv info structure by address
- remove function name from logs

Daniel-Constantin Mierla authored on 16/05/2020 13:21:43
Showing 1 changed files
... ...
@@ -49,8 +49,8 @@ extern int ws_keepalive_mechanism;
49 49
 #define DEFAULT_KEEPALIVE_TIMEOUT 180 /* seconds */
50 50
 
51 51
 extern str ws_ping_application_data;
52
-#define DEFAULT_PING_APPLICATION_DATA SERVER_HDR
53
-#define DEFAULT_PING_APPLICATION_DATA_LEN SERVER_HDR_LEN
52
+#define DEFAULT_PING_APPLICATION_DATA SRVAPP_SIGNATURE
53
+#define DEFAULT_PING_APPLICATION_DATA_LEN SRVAPP_SIGNATURE_LEN
54 54
 
55 55
 extern stat_var *ws_failed_connections;
56 56
 extern stat_var *ws_local_closed_connections;
Browse code

websocket: added check mechanism based on tcp connection

- type 3 (KEEPALIVE_MECHANISM_CONCHECK)
- based on GH #1892

Daniel-Constantin Mierla authored on 08/04/2019 08:33:22
Showing 1 changed files
... ...
@@ -40,7 +40,8 @@ enum
40 40
 {
41 41
 	KEEPALIVE_MECHANISM_NONE = 0,
42 42
 	KEEPALIVE_MECHANISM_PING = 1,
43
-	KEEPALIVE_MECHANISM_PONG = 2
43
+	KEEPALIVE_MECHANISM_PONG = 2,
44
+	KEEPALIVE_MECHANISM_CONCHECK = 3
44 45
 };
45 46
 #define DEFAULT_KEEPALIVE_MECHANISM KEEPALIVE_MECHANISM_PING
46 47
 extern int ws_keepalive_mechanism;
Browse code

websocket: clang format the code

Daniel-Constantin Mierla authored on 31/12/2017 09:47:16
Showing 1 changed files
... ...
@@ -34,11 +34,7 @@
34 34
 #include "../../core/rpc.h"
35 35
 #include "ws_conn.h"
36 36
 
37
-typedef enum
38
-{
39
-	LOCAL_CLOSE = 0,
40
-	REMOTE_CLOSE
41
-} ws_close_type_t;
37
+typedef enum { LOCAL_CLOSE = 0, REMOTE_CLOSE } ws_close_type_t;
42 38
 
43 39
 enum
44 40
 {
... ...
@@ -46,14 +42,14 @@ enum
46 42
 	KEEPALIVE_MECHANISM_PING = 1,
47 43
 	KEEPALIVE_MECHANISM_PONG = 2
48 44
 };
49
-#define DEFAULT_KEEPALIVE_MECHANISM		KEEPALIVE_MECHANISM_PING
45
+#define DEFAULT_KEEPALIVE_MECHANISM KEEPALIVE_MECHANISM_PING
50 46
 extern int ws_keepalive_mechanism;
51 47
 
52
-#define DEFAULT_KEEPALIVE_TIMEOUT		180 /* seconds */
48
+#define DEFAULT_KEEPALIVE_TIMEOUT 180 /* seconds */
53 49
 
54 50
 extern str ws_ping_application_data;
55
-#define DEFAULT_PING_APPLICATION_DATA		SERVER_HDR
56
-#define DEFAULT_PING_APPLICATION_DATA_LEN	SERVER_HDR_LEN
51
+#define DEFAULT_PING_APPLICATION_DATA SERVER_HDR
52
+#define DEFAULT_PING_APPLICATION_DATA_LEN SERVER_HDR_LEN
57 53
 
58 54
 extern stat_var *ws_failed_connections;
59 55
 extern stat_var *ws_local_closed_connections;
... ...
@@ -82,8 +78,8 @@ int w_ws_close2(sip_msg_t *msg, char *_status, char *_reason);
82 78
 int ws_close3(sip_msg_t *msg, int status, str *reason, int con);
83 79
 int w_ws_close3(sip_msg_t *msg, char *_status, char *_reason, char *_con);
84 80
 
85
-void ws_rpc_close(rpc_t* rpc, void* ctx);
86
-void ws_rpc_ping(rpc_t* rpc, void* ctx);
87
-void ws_rpc_pong(rpc_t* rpc, void* ctx);
81
+void ws_rpc_close(rpc_t *rpc, void *ctx);
82
+void ws_rpc_ping(rpc_t *rpc, void *ctx);
83
+void ws_rpc_pong(rpc_t *rpc, void *ctx);
88 84
 
89 85
 #endif /* _WS_FRAME_H */
Browse code

websocket: updates for core events API changes

Daniel-Constantin Mierla authored on 14/06/2017 11:28:48
Showing 1 changed files
... ...
@@ -30,6 +30,7 @@
30 30
 #include "../../core/config.h"
31 31
 #include "../../core/sr_module.h"
32 32
 #include "../../core/str.h"
33
+#include "../../core/events.h"
33 34
 #include "../../core/rpc.h"
34 35
 #include "ws_conn.h"
35 36
 
... ...
@@ -70,8 +71,8 @@ extern stat_var *ws_msrp_received_frames;
70 71
 extern stat_var *ws_msrp_remote_closed_connections;
71 72
 extern stat_var *ws_msrp_transmitted_frames;
72 73
 
73
-int ws_frame_receive(void *data);
74
-int ws_frame_transmit(void *data);
74
+int ws_frame_receive(sr_event_param_t *evp);
75
+int ws_frame_transmit(sr_event_param_t *evp);
75 76
 void ws_keepalive(unsigned int ticks, void *param);
76 77
 
77 78
 int ws_close(sip_msg_t *msg);
Browse code

websocket: exported functions to kemi framework

Daniel-Constantin Mierla authored on 16/04/2017 07:42:18
Showing 1 changed files
... ...
@@ -73,9 +73,13 @@ extern stat_var *ws_msrp_transmitted_frames;
73 73
 int ws_frame_receive(void *data);
74 74
 int ws_frame_transmit(void *data);
75 75
 void ws_keepalive(unsigned int ticks, void *param);
76
+
76 77
 int ws_close(sip_msg_t *msg);
77
-int ws_close2(sip_msg_t *msg, char *_status, char *_reason);
78
-int ws_close3(sip_msg_t *msg, char *_status, char *_reason, char *_con);
78
+int w_ws_close0(sip_msg_t *msg, char *p1, char *p2);
79
+int ws_close2(sip_msg_t *msg, int status, str *reason);
80
+int w_ws_close2(sip_msg_t *msg, char *_status, char *_reason);
81
+int ws_close3(sip_msg_t *msg, int status, str *reason, int con);
82
+int w_ws_close3(sip_msg_t *msg, char *_status, char *_reason, char *_con);
79 83
 
80 84
 void ws_rpc_close(rpc_t* rpc, void* ctx);
81 85
 void ws_rpc_ping(rpc_t* rpc, void* ctx);
Browse code

websocket: removed mi commands

- corresponding rpc commands can be used

Daniel-Constantin Mierla authored on 30/12/2016 08:29:51
Showing 1 changed files
... ...
@@ -13,8 +13,8 @@
13 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
  * GNU General Public License for more details.
15 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 
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 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 19
  *
20 20
  * Exception: permission to copy, modify, propagate, and distribute a work
... ...
@@ -31,7 +31,6 @@
31 31
 #include "../../core/sr_module.h"
32 32
 #include "../../core/str.h"
33 33
 #include "../../core/rpc.h"
34
-#include "../../lib/kmi/tree.h"
35 34
 #include "ws_conn.h"
36 35
 
37 36
 typedef enum
... ...
@@ -73,9 +72,6 @@ extern stat_var *ws_msrp_transmitted_frames;
73 72
 
74 73
 int ws_frame_receive(void *data);
75 74
 int ws_frame_transmit(void *data);
76
-struct mi_root *ws_mi_close(struct mi_root *cmd, void *param);
77
-struct mi_root *ws_mi_ping(struct mi_root *cmd, void *param);
78
-struct mi_root *ws_mi_pong(struct mi_root *cmd, void *param);
79 75
 void ws_keepalive(unsigned int ticks, void *param);
80 76
 int ws_close(sip_msg_t *msg);
81 77
 int ws_close2(sip_msg_t *msg, char *_status, char *_reason);
Browse code

websocket: implemented ws.ping and ws.pong rpc commands

Daniel-Constantin Mierla authored on 22/12/2016 15:12:41
Showing 1 changed files
... ...
@@ -30,6 +30,7 @@
30 30
 #include "../../core/config.h"
31 31
 #include "../../core/sr_module.h"
32 32
 #include "../../core/str.h"
33
+#include "../../core/rpc.h"
33 34
 #include "../../lib/kmi/tree.h"
34 35
 #include "ws_conn.h"
35 36
 
... ...
@@ -80,4 +81,8 @@ int ws_close(sip_msg_t *msg);
80 81
 int ws_close2(sip_msg_t *msg, char *_status, char *_reason);
81 82
 int ws_close3(sip_msg_t *msg, char *_status, char *_reason, char *_con);
82 83
 
84
+void ws_rpc_close(rpc_t* rpc, void* ctx);
85
+void ws_rpc_ping(rpc_t* rpc, void* ctx);
86
+void ws_rpc_pong(rpc_t* rpc, void* ctx);
87
+
83 88
 #endif /* _WS_FRAME_H */
Browse code

core, lib, modules: updated include paths for header files

Daniel-Constantin Mierla authored on 07/12/2016 11:07:22
Showing 1 changed files
... ...
@@ -27,9 +27,9 @@
27 27
 #ifndef _WS_FRAME_H
28 28
 #define _WS_FRAME_H
29 29
 
30
-#include "../../config.h"
31
-#include "../../sr_module.h"
32
-#include "../../str.h"
30
+#include "../../core/config.h"
31
+#include "../../core/sr_module.h"
32
+#include "../../core/str.h"
33 33
 #include "../../lib/kmi/tree.h"
34 34
 #include "ws_conn.h"
35 35
 
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,83 @@
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
+
27
+#ifndef _WS_FRAME_H
28
+#define _WS_FRAME_H
29
+
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
+
36
+typedef enum
37
+{
38
+	LOCAL_CLOSE = 0,
39
+	REMOTE_CLOSE
40
+} ws_close_type_t;
41
+
42
+enum
43
+{
44
+	KEEPALIVE_MECHANISM_NONE = 0,
45
+	KEEPALIVE_MECHANISM_PING = 1,
46
+	KEEPALIVE_MECHANISM_PONG = 2
47
+};
48
+#define DEFAULT_KEEPALIVE_MECHANISM		KEEPALIVE_MECHANISM_PING
49
+extern int ws_keepalive_mechanism;
50
+
51
+#define DEFAULT_KEEPALIVE_TIMEOUT		180 /* seconds */
52
+
53
+extern str ws_ping_application_data;
54
+#define DEFAULT_PING_APPLICATION_DATA		SERVER_HDR
55
+#define DEFAULT_PING_APPLICATION_DATA_LEN	SERVER_HDR_LEN
56
+
57
+extern stat_var *ws_failed_connections;
58
+extern stat_var *ws_local_closed_connections;
59
+extern stat_var *ws_received_frames;
60
+extern stat_var *ws_remote_closed_connections;
61
+extern stat_var *ws_transmitted_frames;
62
+extern stat_var *ws_sip_failed_connections;
63
+extern stat_var *ws_sip_local_closed_connections;
64
+extern stat_var *ws_sip_received_frames;
65
+extern stat_var *ws_sip_remote_closed_connections;
66
+extern stat_var *ws_sip_transmitted_frames;
67
+extern stat_var *ws_msrp_failed_connections;
68
+extern stat_var *ws_msrp_local_closed_connections;
69
+extern stat_var *ws_msrp_received_frames;
70
+extern stat_var *ws_msrp_remote_closed_connections;
71
+extern stat_var *ws_msrp_transmitted_frames;
72
+
73
+int ws_frame_receive(void *data);
74
+int ws_frame_transmit(void *data);
75
+struct mi_root *ws_mi_close(struct mi_root *cmd, void *param);
76
+struct mi_root *ws_mi_ping(struct mi_root *cmd, void *param);
77
+struct mi_root *ws_mi_pong(struct mi_root *cmd, void *param);
78
+void ws_keepalive(unsigned int ticks, void *param);
79
+int ws_close(sip_msg_t *msg);
80
+int ws_close2(sip_msg_t *msg, char *_status, char *_reason);
81
+int ws_close3(sip_msg_t *msg, char *_status, char *_reason, char *_con);
82
+
83
+#endif /* _WS_FRAME_H */