sctp configuration update

This commit is contained in:
Sukchan Lee 2019-05-31 11:34:49 +09:00
parent 34e2b4d44a
commit d597912abb
6 changed files with 20 additions and 17 deletions

@ -1 +1 @@
Subproject commit 81ab6c834a9580c26a9efc43d004e5b100faf52e
Subproject commit 38d47a768e767a2cb59ce391f5307a048ce49888

View File

@ -130,8 +130,6 @@ int context_setup_log_module()
static int context_prepare()
{
self.config.parameter.sctp_streams = DEFAULT_SCTP_STREAMS;
return OGS_OK;
}

View File

@ -37,9 +37,7 @@ int mme_initialize()
if (rv != OGS_OK) return OGS_ERROR;
#define USRSCTP_LOCAL_UDP_PORT 9899
rv = s1ap_init(
context_self()->config.parameter.sctp_streams,
USRSCTP_LOCAL_UDP_PORT);
rv = s1ap_init(USRSCTP_LOCAL_UDP_PORT);
if (rv != OGS_OK) return rv;
thread = ogs_thread_create(mme_main, NULL);

View File

@ -30,17 +30,20 @@ static int set_initmsg(ogs_sock_t *sock,
uint32_t sinit_num_ostreams, uint32_t sinit_max_instreams,
uint32_t sinit_max_attempts, uint32_t sinit_max_init_timeo);
static int sctp_num_ostreams = -1;
void ogs_sctp_set_num_ostreams(int sctp_streams)
{
sctp_num_ostreams = sctp_streams;
}
ogs_sock_t *ogs_sctp_socket(int family, int type, ogs_socknode_t *node)
{
ogs_sock_t *new = NULL;
int rv;
#define DEFAULT_SCTP_MAX_NUM_OF_OSTREAMS 30
uint16_t max_num_of_ostreams = DEFAULT_SCTP_MAX_NUM_OF_OSTREAMS;
if (node) {
if (node->sctp.max_num_of_ostreams) {
max_num_of_ostreams = node->sctp.max_num_of_ostreams;
ogs_info("SCTP: Maximum number of output streams[%d]",
max_num_of_ostreams);
}
}
new = ogs_sock_socket(family, type, IPPROTO_SCTP);
ogs_assert(new);
@ -69,7 +72,7 @@ ogs_sock_t *ogs_sctp_socket(int family, int type, ogs_socknode_t *node)
* max attemtps : 4
* max initial timeout : 8 secs
*/
rv = set_initmsg(new, sctp_num_ostreams, 65535, 4, 8000);
rv = set_initmsg(new, max_num_of_ostreams, 65535, 4, 8000);
ogs_assert(rv == OGS_OK);
return new;

View File

@ -1,14 +1,14 @@
#include "ogs-sctp.h"
#include "app/context.h"
#include "mme_event.h"
#include "s1ap_path.h"
static void accept_handler(short when, ogs_socket_t fd, void *data);
int s1ap_init(int sctp_streams, uint16_t port)
int s1ap_init(uint16_t port)
{
ogs_sctp_set_num_ostreams(sctp_streams);
return OGS_OK;
}
@ -23,6 +23,10 @@ void s1ap_server(ogs_socknode_t *snode, int type)
ogs_assert(snode);
if (context_self()->config.parameter.sctp_streams)
ogs_socknode_set_sctp_max_num_of_ostreams(snode,
context_self()->config.parameter.sctp_streams);
ogs_sctp_server(type, snode);
ogs_assert(snode->sock);

View File

@ -10,7 +10,7 @@ extern "C" {
#define S1AP_NON_UE_SIGNALLING 0
int s1ap_init(int sctp_streams, uint16_t port);
int s1ap_init(uint16_t port);
int s1ap_final();
int s1ap_open();