[sr-dev] git:master:2f933b39: core: kemi - added to_TCP/TLS/SCTP/WS/WSS/WSX()

Daniel-Constantin Mierla miconda at gmail.com
Tue Jun 15 09:18:04 CEST 2021


Module: kamailio
Branch: master
Commit: 2f933b39410029a8dfd7ce7180a6c470e51b2452
URL: https://github.com/kamailio/kamailio/commit/2f933b39410029a8dfd7ce7180a6c470e51b2452

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-15T09:17:50+02:00

core: kemi - added to_TCP/TLS/SCTP/WS/WSS/WSX()

---

Modified: src/core/kemi.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2f933b39410029a8dfd7ce7180a6c470e51b2452.diff
Patch: https://github.com/kamailio/kamailio/commit/2f933b39410029a8dfd7ce7180a6c470e51b2452.patch

---

diff --git a/src/core/kemi.c b/src/core/kemi.c
index 76bfdbcc29..63be6bb0fc 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -1586,6 +1586,72 @@ static int sr_kemi_core_to_proto_udp(sip_msg_t *msg)
 	return (proto == PROTO_UDP)?SR_KEMI_TRUE:SR_KEMI_FALSE;
 }
 
+/**
+ *
+ */
+static int sr_kemi_core_to_proto_tcp(sip_msg_t *msg)
+{
+	int proto;
+
+	proto = sr_kemi_core_to_proto_helper(msg);
+	return (proto == PROTO_TCP)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_to_proto_tls(sip_msg_t *msg)
+{
+	int proto;
+
+	proto = sr_kemi_core_to_proto_helper(msg);
+	return (proto == PROTO_TLS)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_to_proto_sctp(sip_msg_t *msg)
+{
+	int proto;
+
+	proto = sr_kemi_core_to_proto_helper(msg);
+	return (proto == PROTO_SCTP)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_to_proto_ws(sip_msg_t *msg)
+{
+	int proto;
+
+	proto = sr_kemi_core_to_proto_helper(msg);
+	return (proto == PROTO_WS)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_to_proto_wss(sip_msg_t *msg)
+{
+	int proto;
+
+	proto = sr_kemi_core_to_proto_helper(msg);
+	return (proto == PROTO_WSS)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_to_proto_wsx(sip_msg_t *msg)
+{
+	int proto;
+
+	proto = sr_kemi_core_to_proto_helper(msg);
+	if (proto == PROTO_WSS) { return SR_KEMI_TRUE; }
+	return (proto == PROTO_WS)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
 
 /**
  *
@@ -1976,8 +2042,33 @@ static sr_kemi_t _sr_kemi_core[] = {
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
-	{ str_init(""), str_init("to_UDP"),
-		SR_KEMIP_BOOL, sr_kemi_core_to_proto_udp,
+	{ str_init(""), str_init("to_TCP"),
+		SR_KEMIP_BOOL, sr_kemi_core_to_proto_tcp,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init(""), str_init("to_TLS"),
+		SR_KEMIP_BOOL, sr_kemi_core_to_proto_tls,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init(""), str_init("to_SCTP"),
+		SR_KEMIP_BOOL, sr_kemi_core_to_proto_sctp,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init(""), str_init("to_WS"),
+		SR_KEMIP_BOOL, sr_kemi_core_to_proto_ws,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init(""), str_init("to_WSS"),
+		SR_KEMIP_BOOL, sr_kemi_core_to_proto_wss,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init(""), str_init("to_WSX"),
+		SR_KEMIP_BOOL, sr_kemi_core_to_proto_wsx,
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},




More information about the sr-dev mailing list