intermediate
This commit is contained in:
parent
740b3c39e7
commit
c69ade505c
|
@ -12,9 +12,8 @@
|
|||
static void s6a_gnutls_log_func(int level, const char *str);
|
||||
static void s6a_fd_logger(int printlevel, const char *format, va_list ap);
|
||||
|
||||
static status_t s6a_conf_init();
|
||||
static status_t s6a_fd_ext_init();
|
||||
static status_t s6a_dict_objs_init();
|
||||
static status_t s6a_ext_init();
|
||||
static status_t s6a_dict_init();
|
||||
|
||||
status_t s6a_initialize()
|
||||
{
|
||||
|
@ -39,26 +38,87 @@ status_t s6a_initialize()
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = s6a_conf_init();
|
||||
ret = s6a_ext_init();
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("s6a_ext_init() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = s6a_dict_init();
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("s6a_conf_init() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = s6a_fd_ext_init();
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_ext_init()
|
||||
{
|
||||
int ret;
|
||||
|
||||
int fd_ext_init_dnr_entry(int major, int minor, char *conffile);
|
||||
int fd_ext_init_dict_dcca_entry(int major, int minor, char *conffile);
|
||||
int fd_ext_init_dict_dcca_3gpp_entry(int major, int minor, char *conffile);
|
||||
|
||||
ret = fd_ext_init_dnr_entry(
|
||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("s6a_fd_ext_init() failed");
|
||||
d_error("fd_ext_init_dnr_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
ret = fd_ext_init_dict_dcca_entry(
|
||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dict_dcca_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
ret = fd_ext_init_dict_dcca_3gpp_entry(
|
||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dict_dcca_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
ret = s6a_dict_objs_init();
|
||||
if (ret != 0)
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_dict_init()
|
||||
{
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_conf_handle(s6a_conf_t *conf)
|
||||
{
|
||||
int ret;
|
||||
fd_g_config->cnf_diamid = conf->identity;
|
||||
|
||||
ret = fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamid,
|
||||
&fd_g_config->cnf_diamid_len, 1);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("s6a_conf_init() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
fd_g_config->cnf_diamrlm = conf->realm;
|
||||
|
||||
ret = fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamrlm,
|
||||
&fd_g_config->cnf_diamrlm_len, 1);
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
fd_g_config->cnf_flags.no_fwd = 1;
|
||||
fd_g_config->cnf_flags.no_ip6 = 1;
|
||||
fd_g_config->cnf_flags.no_sctp = 1;
|
||||
fd_g_config->cnf_flags.pr_tcp = 1;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
@ -101,6 +161,18 @@ void s6a_thread_stop()
|
|||
}
|
||||
}
|
||||
|
||||
void s6a_conf_show()
|
||||
{
|
||||
char *buf = NULL;
|
||||
size_t len;
|
||||
|
||||
if (g_trace_mask && TRACE_MODULE >= 1)
|
||||
{
|
||||
printf("%s\n", fd_conf_dump(&buf, &len, NULL));
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void s6a_gnutls_log_func(int level, const char *str)
|
||||
{
|
||||
d_trace(level, "gnutls[%d]: %s", level, str);
|
||||
|
@ -148,78 +220,3 @@ static void s6a_fd_logger(int printlevel, const char *format, va_list ap)
|
|||
}
|
||||
|
||||
|
||||
status_t s6a_conf_init()
|
||||
{
|
||||
fd_g_config->cnf_flags.no_fwd = 1;
|
||||
fd_g_config->cnf_flags.no_ip6 = 1;
|
||||
fd_g_config->cnf_flags.no_sctp = 1;
|
||||
fd_g_config->cnf_flags.pr_tcp = 1;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_conf_set_identity(char *identity)
|
||||
{
|
||||
fd_g_config->cnf_diamid = identity;
|
||||
|
||||
return fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamid,
|
||||
&fd_g_config->cnf_diamid_len, 1);
|
||||
}
|
||||
|
||||
status_t s6a_conf_set_realm(char *realm)
|
||||
{
|
||||
fd_g_config->cnf_diamrlm = realm;
|
||||
|
||||
return fd_os_validate_DiameterIdentity(&fd_g_config->cnf_diamrlm,
|
||||
&fd_g_config->cnf_diamrlm_len, 1);
|
||||
}
|
||||
|
||||
void s6a_conf_show()
|
||||
{
|
||||
char *buf = NULL;
|
||||
size_t len;
|
||||
|
||||
if (g_trace_mask && TRACE_MODULE >= 1)
|
||||
{
|
||||
printf("%s\n", fd_conf_dump(&buf, &len, NULL));
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
status_t s6a_fd_ext_init()
|
||||
{
|
||||
int ret;
|
||||
|
||||
int fd_ext_init_dnr_entry(int major, int minor, char *conffile);
|
||||
int fd_ext_init_dict_dcca_entry(int major, int minor, char *conffile);
|
||||
int fd_ext_init_dict_dcca_3gpp_entry(int major, int minor, char *conffile);
|
||||
|
||||
ret = fd_ext_init_dnr_entry(
|
||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dnr_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
ret = fd_ext_init_dict_dcca_entry(
|
||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dict_dcca_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
ret = fd_ext_init_dict_dcca_3gpp_entry(
|
||||
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
d_error("fd_ext_init_dict_dcca_entry() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s6a_dict_objs_init()
|
||||
{
|
||||
return CORE_OK;
|
||||
}
|
||||
|
|
|
@ -9,13 +9,17 @@ extern "C" {
|
|||
|
||||
#define S6A_SDU_SIZE 2048
|
||||
|
||||
typedef struct _s6a_conf_t {
|
||||
char *identity;
|
||||
char *realm;
|
||||
} s6a_conf_t;
|
||||
|
||||
CORE_DECLARE(status_t) s6a_initialize();
|
||||
CORE_DECLARE(status_t) s6a_conf_handle(s6a_conf_t *conf);
|
||||
|
||||
CORE_DECLARE(status_t) s6a_thread_start();
|
||||
CORE_DECLARE(void) s6a_thread_stop();
|
||||
|
||||
CORE_DECLARE(status_t) s6a_conf_set_identity(char *identity);
|
||||
CORE_DECLARE(status_t) s6a_conf_set_realm(char *realm);
|
||||
CORE_DECLARE(void) s6a_conf_show();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -20,6 +20,7 @@ static thread_id mme_net_thread;
|
|||
status_t cellwire_initialize(char *config_path)
|
||||
{
|
||||
status_t rv;
|
||||
s6a_conf_t conf;
|
||||
|
||||
srand(time(NULL)*getpid());
|
||||
|
||||
|
@ -30,9 +31,11 @@ status_t cellwire_initialize(char *config_path)
|
|||
rv = s6a_initialize();
|
||||
if (rv != CORE_OK)
|
||||
return rv;
|
||||
|
||||
conf.identity = "hss.cellwire.com";
|
||||
conf.realm = "cellwire.com";
|
||||
|
||||
s6a_conf_set_identity("hss.cellwire.com");
|
||||
s6a_conf_set_realm("cellwire.com");
|
||||
rv = s6a_conf_handle(&conf);
|
||||
s6a_conf_show();
|
||||
|
||||
return CORE_OK;
|
||||
|
|
Loading…
Reference in New Issue