forked from acouzens/open5gs
update it
This commit is contained in:
parent
145f5b5377
commit
c3d1807057
|
@ -20,7 +20,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/lib/core/include
|
||||
|
||||
AM_CFLAGS = \
|
||||
-Wall -Werror
|
||||
-Wall -Werror -Wno-unused
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
||||
|
|
|
@ -8,21 +8,116 @@
|
|||
|
||||
#include "s6a_message.h"
|
||||
|
||||
#if 0
|
||||
static struct session_handler *s6a_cli_reg = NULL;
|
||||
#endif
|
||||
|
||||
struct sess_state {
|
||||
c_int32_t randval; /* a random value to store in Test-AVP */
|
||||
struct timespec ts; /* Time of sending the message */
|
||||
} ;
|
||||
|
||||
/* Cb called when an Authentication-Information-Answe is received */
|
||||
static void s6a_aia_cb(void *data, struct msg **msg)
|
||||
{
|
||||
#if 0
|
||||
struct sess_state *mi = NULL;
|
||||
struct timespec ts;
|
||||
struct session *sess;
|
||||
struct avp *avp;
|
||||
struct avp_hdr *hdr;
|
||||
unsigned long dur;
|
||||
int error = 0;
|
||||
#endif
|
||||
|
||||
/* Now log content of the answer */
|
||||
d_info("Authentication-Information-Answer received!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Create a test message */
|
||||
void s6a_build_auth_info_req()
|
||||
{
|
||||
struct msg *req = NULL;
|
||||
struct avp *avp;
|
||||
union avp_value val;
|
||||
#if 0
|
||||
struct sess_state *mi = NULL, *svg;
|
||||
#endif
|
||||
struct session *sess = NULL;
|
||||
|
||||
/* Create the request */
|
||||
CHECK_FCT_DO(fd_msg_new(s6a_air, MSGFL_ALLOC_ETEID, &req), goto out);
|
||||
|
||||
/* Create a new session */
|
||||
#define S6A_APP_SID_OPT "app_s6a"
|
||||
CHECK_FCT_DO(fd_msg_new_session(req, (os0_t)S6A_APP_SID_OPT,
|
||||
CONSTSTRLEN(S6A_APP_SID_OPT)), goto out);
|
||||
CHECK_FCT_DO(fd_msg_sess_get(
|
||||
fd_g_config->cnf_dict, req, &sess, NULL), goto out);
|
||||
|
||||
/* Now set all AVPs values */
|
||||
|
||||
/* Set the Destination-Realm AVP */
|
||||
{
|
||||
CHECK_FCT_DO(fd_msg_avp_new(
|
||||
s6a_destination_realm, 0, &avp), goto out);
|
||||
val.os.data = (unsigned char *)(fd_g_config->cnf_diamrlm);
|
||||
val.os.len = strlen(fd_g_config->cnf_diamrlm);
|
||||
CHECK_FCT_DO(fd_msg_avp_setvalue(avp, &val), goto out);
|
||||
CHECK_FCT_DO(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out);
|
||||
}
|
||||
|
||||
/* Set the Destination-Host AVP if needed*/
|
||||
#if 0
|
||||
if (ta_conf->dest_host) {
|
||||
#endif
|
||||
{
|
||||
CHECK_FCT_DO(fd_msg_avp_new(
|
||||
s6a_destination_host, 0, &avp), goto out);
|
||||
val.os.data = (unsigned char *)(fd_g_config->cnf_diamid);
|
||||
val.os.len = strlen(fd_g_config->cnf_diamid);
|
||||
CHECK_FCT_DO(fd_msg_avp_setvalue(avp, &val), goto out);
|
||||
CHECK_FCT_DO(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out);
|
||||
}
|
||||
|
||||
/* Set Origin-Host & Origin-Realm */
|
||||
CHECK_FCT_DO(fd_msg_add_origin (req, 0), goto out);
|
||||
|
||||
/* Set the User-Name AVP if needed*/
|
||||
#if 0
|
||||
if (ta_conf->user_name) {
|
||||
#endif
|
||||
{
|
||||
CHECK_FCT_DO(fd_msg_avp_new(s6a_user_name, 0, &avp), goto out);
|
||||
#define S6A_IMSI "01045238277"
|
||||
val.os.data = (unsigned char *)(S6A_IMSI);
|
||||
val.os.len = strlen(S6A_IMSI);
|
||||
CHECK_FCT_DO(fd_msg_avp_setvalue(avp, &val), goto out);
|
||||
CHECK_FCT_DO(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp), goto out);
|
||||
}
|
||||
|
||||
/* Send the request */
|
||||
CHECK_FCT_DO(fd_msg_send(&req, s6a_aia_cb, NULL), goto out);
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
status_t s6a_client_start()
|
||||
{
|
||||
#if 0
|
||||
CHECK_FCT(fd_sess_handler_create(&s6a_cli_reg, (void *)free, NULL, NULL));
|
||||
#endif
|
||||
s6a_build_auth_info_req();
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
void s6a_client_stop()
|
||||
{
|
||||
#if 0
|
||||
CHECK_FCT_DO(fd_sess_handler_destroy(&s6a_cli_reg, NULL), /* continue */ );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ struct dict_object *s6a_pre_emption_capability;
|
|||
struct dict_object *s6a_pre_emption_vulnerability;
|
||||
struct dict_object *s6a_served_party_ip_addr;
|
||||
|
||||
status_t s6a_ext_init()
|
||||
status_t s6a_ext_load()
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -127,7 +127,7 @@ status_t s6a_dict_init()
|
|||
vendor_id_t vendor_3gpp = VENDOR_3GPP;
|
||||
application_id_t app_s6a = APP_S6A;
|
||||
|
||||
ret = s6a_ext_init();
|
||||
ret = s6a_ext_load();
|
||||
if (ret != 0)
|
||||
{
|
||||
return CORE_ERROR;
|
||||
|
|
|
@ -35,6 +35,14 @@ status_t s6a_initialize()
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
int fd_msg_init(void);
|
||||
ret = fd_msg_init();
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_msg_init() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = s6a_dict_init();
|
||||
if (ret != 0)
|
||||
{
|
||||
|
@ -80,6 +88,7 @@ void s6a_conf_show()
|
|||
char *buf = NULL;
|
||||
size_t len;
|
||||
|
||||
fd_g_debug_lvl = 0;
|
||||
if (g_trace_mask && TRACE_MODULE >= 1)
|
||||
{
|
||||
printf("%s\n", fd_conf_dump(&buf, &len, NULL));
|
||||
|
@ -112,6 +121,9 @@ status_t s6a_thread_start()
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
/* Advertise the support for the test application in the peer */
|
||||
CHECK_FCT(fd_disp_app_support(s6a_appli, s6a_vendor, 1, 0));
|
||||
|
||||
ret = s6a_client_start();
|
||||
if (ret != 0)
|
||||
{
|
||||
|
@ -119,9 +131,6 @@ status_t s6a_thread_start()
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
/* Advertise the support for the test application in the peer */
|
||||
CHECK_FCT(fd_disp_app_support(s6a_appli, s6a_vendor, 1, 0));
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ static int s6a_fb_cb( struct msg ** msg, struct avp * avp,
|
|||
return ENOTSUP;
|
||||
}
|
||||
|
||||
/* Callback for incoming Authentication-Information-Answer messages */
|
||||
/* Callback for incoming Authentication-Information-Request messages */
|
||||
static int s6a_air_cb( struct msg ** msg, struct avp * avp,
|
||||
struct session * sess, void * opaque, enum disp_action * act)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ static int s6a_air_cb( struct msg ** msg, struct avp * avp,
|
|||
struct avp * a;
|
||||
#endif
|
||||
|
||||
d_info("Authentication-Information-Answer received!");
|
||||
d_info("Authentication-Information-Request received!");
|
||||
|
||||
if (msg == NULL)
|
||||
return EINVAL;
|
||||
|
|
Loading…
Reference in New Issue