Module: kamailio
Branch: master
Commit: 61795123af0a2d2cb261c36ac78a4833f03a3321
URL:
https://github.com/kamailio/kamailio/commit/61795123af0a2d2cb261c36ac78a483…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-03-08T08:40:09+01:00
core: kemi - corresponding functions to check af==ipv4/ipv6
---
Modified: src/core/kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/61795123af0a2d2cb261c36ac78a483…
Patch:
https://github.com/kamailio/kamailio/commit/61795123af0a2d2cb261c36ac78a483…
---
diff --git a/src/core/kemi.c b/src/core/kemi.c
index 5480405f24..c7268e58f6 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -1041,6 +1041,28 @@ static int sr_kemi_core_is_proto_sctp(sip_msg_t *msg)
return (msg->rcv.proto == PROTO_SCTP)?SR_KEMI_TRUE:SR_KEMI_FALSE;
}
+/**
+ *
+ */
+static int sr_kemi_core_is_af_ipv4(sip_msg_t *msg)
+{
+ if(msg==NULL || msg->rcv.bind_address==NULL) {
+ return SR_KEMI_FALSE;
+ }
+ return (msg->rcv.bind_address->address.af==AF_INET)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
+
+/**
+ *
+ */
+static int sr_kemi_core_is_af_ipv6(sip_msg_t *msg)
+{
+ if(msg==NULL || msg->rcv.bind_address==NULL) {
+ return SR_KEMI_FALSE;
+ }
+ return (msg->rcv.bind_address->address.af==AF_INET6)?SR_KEMI_TRUE:SR_KEMI_FALSE;
+}
+
/**
*
*/
@@ -1589,6 +1611,16 @@ 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("is_IPv4"),
+ SR_KEMIP_BOOL, sr_kemi_core_is_af_ipv4,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init(""), str_init("is_IPv6"),
+ SR_KEMIP_BOOL, sr_kemi_core_is_af_ipv6,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};