Module: kamailio
Branch: master
Commit: ae40acf61a5c666db5ff9c55f2ff9b0770418a52
URL:
https://github.com/kamailio/kamailio/commit/ae40acf61a5c666db5ff9c55f2ff9b0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-05-13T15:51:51+02:00
core: socket info - function to get socket by listen or advertise
---
Modified: src/core/socket_info.c
Modified: src/core/socket_info.h
---
Diff:
https://github.com/kamailio/kamailio/commit/ae40acf61a5c666db5ff9c55f2ff9b0…
Patch:
https://github.com/kamailio/kamailio/commit/ae40acf61a5c666db5ff9c55f2ff9b0…
---
diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index c9dd89118d..c263f9fcb9 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -946,6 +946,19 @@ socket_info_t* ksr_get_socket_by_index(int idx)
return NULL;
}
+socket_info_t* ksr_get_socket_by_address(str *sockstr)
+{
+ socket_info_t *si = NULL;
+
+ si = ksr_get_socket_by_listen(sockstr);
+
+ if(si!=NULL) {
+ return si;
+ }
+
+ return ksr_get_socket_by_advertise(sockstr);
+}
+
/* checks if the proto:port is one of the ports we listen on
* and returns the corresponding socket_info structure.
* if proto==0 (PROTO_NONE) the protocol is ignored
diff --git a/src/core/socket_info.h b/src/core/socket_info.h
index cbc630b9b8..134f2d47d8 100644
--- a/src/core/socket_info.h
+++ b/src/core/socket_info.h
@@ -107,6 +107,7 @@ socket_info_t* ksr_get_socket_by_name(str *sockname);
socket_info_t* ksr_get_socket_by_listen(str *sockstr);
socket_info_t* ksr_get_socket_by_advertise(str *sockstr);
socket_info_t* ksr_get_socket_by_index(int idx);
+socket_info_t* ksr_get_socket_by_address(str *sockstr);
struct socket_info** get_sock_info_list(unsigned short proto);