Skip to content

Commit

Permalink
ims_ipsec_pcscf: extend get_pcontact with the new parameter.
Browse files Browse the repository at this point in the history
- added a new bitwise value for _cflags in ipsec_forward.
- performing a reverse search for a contact in ipsec_forward
  if the new flag IPSEC_REVERSE_SEARCH is set.
  • Loading branch information
alexyosifov authored and henningw committed Aug 12, 2020
1 parent 45ebf8b commit e10dc0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/modules/ims_ipsec_pcscf/cmd.c
Expand Up @@ -76,6 +76,7 @@ extern usrloc_api_t ul;
extern struct tm_binds tmb;

#define IPSEC_SEND_FORCE_SOCKET 0x01 /* if set - set send force socket for request messages */
#define IPSEC_REVERSE_SEARCH 0x02 /* if set - start seraching from the last element */

int bind_ipsec_pcscf(ipsec_pcscf_api_t* api) {
if(!api){
Expand Down Expand Up @@ -663,7 +664,7 @@ int ipsec_create(struct sip_msg* m, udomain_t* d)

ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);

if (ul.get_pcontact(d, &ci, &pcontact) != 0) {
if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0) {
LM_ERR("Contact doesn't exist\n");
goto cleanup;
}
Expand Down Expand Up @@ -802,7 +803,7 @@ int ipsec_forward(struct sip_msg* m, udomain_t* d, int _cflags)

ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);

if (ul.get_pcontact(d, &ci, &pcontact) != 0) {
if (ul.get_pcontact(d, &ci, &pcontact, _cflags & IPSEC_REVERSE_SEARCH) != 0) {
LM_ERR("Contact doesn't exist\n");
goto cleanup;
}
Expand Down Expand Up @@ -946,7 +947,7 @@ int ipsec_destroy(struct sip_msg* m, udomain_t* d)

ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);

if (ul.get_pcontact(d, &ci, &pcontact) != 0) {
if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0) {
LM_ERR("Contact doesn't exist\n");
goto cleanup;
}
Expand Down
5 changes: 3 additions & 2 deletions src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml
Expand Up @@ -243,8 +243,9 @@ ipsec_create("location");
stores the contacts.
</para>
<para>
<emphasis>flags</emphasis> - Set send force socket for request messages.
If 1 - set force socket for request messages. Useful for ipsec and TCP.
<emphasis>flags</emphasis> - bitwise flag:
0x01 - set force socket for request messages. Useful for ipsec and TCP.
0x02 - reverse search for a contact in the memory. Useful when contact alias is disabled.
This is an optional parameter, default value - 0.
</para>
</listitem>
Expand Down

0 comments on commit e10dc0d

Please sign in to comment.