l2tp_data: add l2tpd_cc_find_by_sockaddr()

This commit is contained in:
Alexander Couzens 2016-10-23 16:28:52 +02:00 committed by Harald Welte
parent a3ea0eef15
commit 486b7acbfc
2 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/socket.h>
#include "l2tpd.h"
#include "l2tpd_data.h"
@ -20,6 +21,18 @@ l2tpd_cc_find_by_l_cc_id(struct l2tpd_instance *inst, uint32_t l_cc_id)
return NULL;
}
struct l2tpd_connection *
l2tpd_cc_find_by_sockaddr(struct l2tpd_instance *inst, struct sockaddr *ss);
{
struct l2tpd_connection *l2c;
llist_for_each_entry(l2c, &inst->connections, list) {
if (sockaddr_equal(ss, &l2c->remote.ss))
return l2c;
}
return NULL;
}
struct l2tpd_connection *
l2tpd_cc_alloc(struct l2tpd_instance *inst)
{

View File

@ -2,12 +2,19 @@
#include "l2tpd.h"
struct sockaddr;
/* l2tp connection */
struct l2tpd_connection *
l2tpd_cc_find_by_sockaddr(struct l2tpd_instance *inst, struct sockaddr *ss);
struct l2tpd_connection *
l2tpd_cc_find_by_l_cc_id(struct l2tpd_instance *inst, uint32_t l_cc_id);
struct l2tpd_connection *
l2tpd_cc_alloc(struct l2tpd_instance *inst);
/* l2tp session */
struct l2tpd_session *
l2tpd_sess_alloc(struct l2tpd_connection *conn);