Skip to content

Commit

Permalink
lcr: updated kemi exports with new functions having port parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Aug 28, 2021
1 parent 615b538 commit e2106d4
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions src/modules/lcr/lcr_mod.c
Expand Up @@ -3067,7 +3067,7 @@ static int from_gw_1(struct sip_msg *_m, char *_lcr_id, char *_s2)
* Checks if request comes from ip address of a gateway taking source
* address, transport protocol and source port from parameters.
*/
static int ki_from_gw_addr(
static int ki_from_gw_addr_port(
sip_msg_t *_m, int lcr_id, str *addr_str, int transport, unsigned int src_port)
{
struct ip_addr src_addr;
Expand Down Expand Up @@ -3103,6 +3103,16 @@ static int ki_from_gw_addr(
return do_from_gw(_m, lcr_id, &src_addr, transport, src_port);
}

/*
* Checks if request comes from ip address of a gateway taking source
* address and transport protocol from parameters.
*/
static int ki_from_gw_addr(
sip_msg_t *_m, int lcr_id, str *addr_str, int transport)
{
return ki_from_gw_addr_port(_m, lcr_id, addr_str, transport, 0);
}

static int from_gw_3(
struct sip_msg *_m, char *_lcr_id, char *_addr, char *_transport)
{
Expand All @@ -3127,7 +3137,7 @@ static int from_gw_3(
return -1;
}

return ki_from_gw_addr(_m, lcr_id, &addr_str, transport, 0);
return ki_from_gw_addr_port(_m, lcr_id, &addr_str, transport, 0);
}

static int from_gw_4(
Expand Down Expand Up @@ -3161,7 +3171,7 @@ static int from_gw_4(
return -1;
}

return ki_from_gw_addr(_m, lcr_id, &addr_str, transport, src_port);
return ki_from_gw_addr_port(_m, lcr_id, &addr_str, transport, src_port);
}

/*
Expand Down Expand Up @@ -3195,7 +3205,8 @@ static int from_any_gw_0(struct sip_msg *_m, char *_s1, char *_s2)
* Checks if request comes from ip address of a a gateway taking source
* IP address, transport protocol and source port from parameters.
*/
static int ki_from_any_gw_addr(sip_msg_t *_m, str *addr_str, int transport, unsigned int src_port)
static int ki_from_any_gw_addr_port(sip_msg_t *_m, str *addr_str, int transport,
unsigned int src_port)
{
unsigned int i;
struct ip_addr *ip, src_addr;
Expand Down Expand Up @@ -3230,6 +3241,15 @@ static int ki_from_any_gw_addr(sip_msg_t *_m, str *addr_str, int transport, unsi
return -1;
}

/*
* Checks if request comes from ip address of a a gateway taking source
* IP address, transport protocol and source port from parameters.
*/
static int ki_from_any_gw_addr(sip_msg_t *_m, str *addr_str, int transport)
{
return ki_from_any_gw_addr_port(_m, addr_str, transport, 0);
}

static int from_any_gw_2(struct sip_msg *_m, char *_addr, char *_transport)
{
str addr_str;
Expand All @@ -3246,7 +3266,7 @@ static int from_any_gw_2(struct sip_msg *_m, char *_addr, char *_transport)
return -1;
}

return ki_from_any_gw_addr(_m, &addr_str, transport, 0);
return ki_from_any_gw_addr_port(_m, &addr_str, transport, 0);
}

static int from_any_gw_3(struct sip_msg *_m, char *_addr, char *_transport, char *_src_port)
Expand All @@ -3272,7 +3292,7 @@ static int from_any_gw_3(struct sip_msg *_m, char *_addr, char *_transport, char
return -1;
}

return ki_from_any_gw_addr(_m, &addr_str, transport, src_port);
return ki_from_any_gw_addr_port(_m, &addr_str, transport, src_port);
}

/*
Expand Down Expand Up @@ -3566,6 +3586,11 @@ static sr_kemi_t sr_kemi_lcr_exports[] = {
{ SR_KEMIP_INT, SR_KEMIP_STR, SR_KEMIP_INT,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("lcr"), str_init("from_gw_addr_port"),
SR_KEMIP_INT, ki_from_gw_addr_port,
{ SR_KEMIP_INT, SR_KEMIP_STR, SR_KEMIP_INT,
SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("lcr"), str_init("from_any_gw"),
SR_KEMIP_INT, ki_from_any_gw,
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
Expand All @@ -3576,6 +3601,11 @@ static sr_kemi_t sr_kemi_lcr_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("lcr"), str_init("from_any_gw_addr_port"),
SR_KEMIP_INT, ki_from_any_gw_addr_port,
{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_INT,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("lcr"), str_init("to_gw"),
SR_KEMIP_INT, ki_to_gw,
{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
Expand Down

0 comments on commit e2106d4

Please sign in to comment.