Browse code

core: socket info - function to get socket by listen or advertise

Daniel-Constantin Mierla authored on 13/05/2022 13:51:51
Showing 2 changed files
... ...
@@ -946,6 +946,19 @@ socket_info_t* ksr_get_socket_by_index(int idx)
946 946
 	return NULL;
947 947
 }
948 948
 
949
+socket_info_t* ksr_get_socket_by_address(str *sockstr)
950
+{
951
+	socket_info_t *si = NULL;
952
+
953
+	si = ksr_get_socket_by_listen(sockstr);
954
+
955
+	if(si!=NULL) {
956
+		return si;
957
+	}
958
+
959
+	return ksr_get_socket_by_advertise(sockstr);
960
+}
961
+
949 962
 /* checks if the proto:port is one of the ports we listen on
950 963
  * and returns the corresponding socket_info structure.
951 964
  * if proto==0 (PROTO_NONE) the protocol is ignored
... ...
@@ -107,6 +107,7 @@ socket_info_t* ksr_get_socket_by_name(str *sockname);
107 107
 socket_info_t* ksr_get_socket_by_listen(str *sockstr);
108 108
 socket_info_t* ksr_get_socket_by_advertise(str *sockstr);
109 109
 socket_info_t* ksr_get_socket_by_index(int idx);
110
+socket_info_t* ksr_get_socket_by_address(str *sockstr);
110 111
 
111 112
 struct socket_info** get_sock_info_list(unsigned short proto);
112 113