Skip to content
Permalink
Browse files

core: kemi - corresponding functions to check af==ipv4/ipv6

  • Loading branch information...
miconda committed Mar 8, 2019
1 parent d33d60e commit 61795123af0a2d2cb261c36ac78a4833f03a3321
Showing with 32 additions and 0 deletions.
  1. +32 −0 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 } }
};

0 comments on commit 6179512

Please sign in to comment.
You can’t perform that action at this time.