osmo-epdg: utils: add get_imsi_ike() to get the imsi of an ike_sa_t object

This commit is contained in:
Alexander Couzens 2024-02-16 21:08:22 +01:00
parent f22c728a4c
commit 2dfe87749f
2 changed files with 12 additions and 0 deletions

View File

@ -43,6 +43,17 @@ struct msgb *chunk_to_msgb(chunk_t *chunk)
return msg;
}
int get_imsi_ike(ike_sa_t *ike_sa, char *imsi, size_t imsi_len)
{
identification_t *imsi_id = ike_sa->get_other_id(ike_sa);
if (!imsi_id)
{
return -1;
}
return get_imsi(imsi_id, imsi, imsi_len);
}
int get_imsi(identification_t *id, char *imsi, size_t imsi_len)
{
chunk_t nai = id->get_encoding(id);

View File

@ -58,6 +58,7 @@ typedef struct osmo_epdg_ue osmo_epdg_ue_t;
struct msgb *chunk_to_msgb(chunk_t *chunk);
int get_imsi(identification_t *id, char *imsi, size_t imsi_len);
int get_imsi_ike(ike_sa_t *ike_sa, char *imsi, size_t imsi_len);
int get_apn(ike_sa_t *sa, char *apn, size_t apn_len);
#endif /* OSMO_EPDG_UTILS_H_ */