step of epdge db

This commit is contained in:
Alexander Couzens 2023-03-28 21:23:25 +02:00
parent 8074d68e57
commit 9852101624
3 changed files with 49 additions and 3 deletions

View File

@ -35,7 +35,25 @@ struct private_osmo_epdg_db_t {
*/
osmo_epdg_db_t public;
/**
* GSUP client
*/
osmo_epdg_gsup_client_t *gsup;
/**
* subscriber hash by ID
*/
hashtable_t *subscribers;
/**
* subscriber hash by imsi (how to handle multiple?)
*/
hashtable_t *subscribers_imsi;
/**
* subscriber by ike_sa
*/
hashtable_t *subscribers_ike_sa_t;
};
METHOD(osmo_epdg_db_t, create_subscriber_imsi, osmo_epdg_ue_t *,
@ -57,12 +75,24 @@ METHOD(osmo_epdg_db_t, get_subscriber_id, osmo_epdg_ue_t *,
return NULL;
}
METHOD(osmo_epdg_db_t, get_subscriber_ike, osmo_epdg_ue_t *,
private_osmo_epdg_db_t *this, ike_sa_t *ike_sa)
{
return NULL;
}
METHOD(osmo_epdg_db_t, destroy_subscriber_id, void,
private_osmo_epdg_db_t *this, uint32_t id)
{
return NULL;
}
METHOD(osmo_epdg_db_t, destroy_subscriber_ike, void,
private_osmo_epdg_db_t *this, ike_sa_t *ike_sa)
{
return NULL;
}
METHOD(osmo_epdg_db_t, destroy_subscriber, void,
private_osmo_epdg_db_t *this)
{
@ -84,10 +114,11 @@ osmo_epdg_db_t *osmo_epdg_db_create(osmo_epdg_gsup_client_t *gsup)
INIT(this,
.public = {
.create_subscriber_imsi = _create_subscriber_imsi,
.create_subscriber = _create_subscriber,
.create_subscriber = _create_subscriber_imsi,
.get_subscriber_id = _get_subscriber_id,
.get_subscriber_imsi = _get_subscriber_imsi,
.get_subscriber_ike = _get_subscriber_ike,
.destroy_subscriber_ike = _destroy_subscriber_ike,
.destroy_subscriber_id = _destroy_subscriber_id,
.destroy_subscriber = _destroy_subscriber,
.destroy = _destroy,

View File

@ -38,18 +38,28 @@ struct osmo_epdg_db_t {
/**
* Create new subscriber by imsi, before sending authentication
*/
osmo_epdg_ue_t *(*create_subscriber_imsi)(osmo_epdg_db_t *this, ike_sa_t *ike_sa, char *imsi);
osmo_epdg_ue_t *(*create_subscriber)(osmo_epdg_db_t *this, ike_sa_t *ike_sa, char *imsi);
/**
* Get subscriber by imsi, there might be multiple UE by this IMSI
*/
osmo_epdg_ue_t *(*get_subscriber_imsi)(osmo_epdg_db_t *this, char *imsi, int offset);
/**
* Get subscriber by ike
*/
osmo_epdg_ue_t *(*get_subscriber_ike)(osmo_epdg_db_t *this, ike_sa_t *ike_sa);
/**
* Get subscriber by id
*/
osmo_epdg_ue_t *(*get_subscriber_id)(osmo_epdg_db_t *this, uint32_t id);
/**
* Destroy subscriber by imsi
*/
void (*destroy_subscriber_ike)(osmo_epdg_db_t *this, ike_sa_t *ike_sa);
/**
* Destroy subscriber by imsi
*/

View File

@ -35,6 +35,9 @@ enum ue_state state {
UE_WAIT_TUNNEL,
/* Everything ready, data can flow */
UE_CONNECTED,
/* Notify the osmo-epdg about destruction, wait for an answer */
UE_DISCONNECTING,
UE_DESTROYED,
};
/* TODO: how to clean up/garbage collect */
@ -44,7 +47,9 @@ struct osmo_epdg_ue {
/* imsi should be uniq, need protected against fake UE */
char *imsi;
enum ue_state state;
/* TODO: missing strongswan session pointer */
ike_sa_t *ike_sa;
};
typedef struct osmo_epdg_ue osmo_epdg_ue_t;