Commit af91004e authored by Vaibhav Shrivastava's avatar Vaibhav Shrivastava

Merge branch '3GPP_TTCN_System_Simulator' into 3GPP_5G_Rebased_with_W11

parents 99ae5a61 69ac5265
......@@ -183,10 +183,15 @@ SSConfig = (
{
hostIp = "127.0.0.1"; #Host IP for System Simulator
Sys_port = 7777; #Port Number for System Simulator Sys Port
Sys_host = "127.0.0.1"; #Host for System Simulator SYS Port
Srb_port = 7778; #Port Number for System Simulator Srb Port
Srb_host = "127.0.0.1"; #Host for System Simulator SRB Port
Vng_port = 7779; #Port Number for System Simulator VNG Port
Vng_host = "127.0.0.1"; #Host for System Simulator VNG Port
Vtp_port = 7780; #Port Number for System Simulator VTP Port
Vtp_host = "/tmp/eNBVT.pipe"; #Host for System Simulator VTP Port
Drb_port = 7781; #Port Number for System Simulator DRB Port
Drb_host = "127.0.0.1"; #Host for System Simulator DRB Port
SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
}
);
......
......@@ -173,11 +173,17 @@ SSConfig = (
{
hostIp = "127.0.0.1"; #Host IP for System Simulator
Sys_port = 7777; #Port Number for System Simulator Sys Port
Sys_host = "/tmp/eNBSys.pipe"; #Host for System Simulator SYS Port
Srb_port = 7778; #Port Number for System Simulator Srb Port
Srb_host = "/tmp/eNBSrb.pipe"; #Host for System Simulator SRB Port
Vng_port = 7779; #Port Number for System Simulator VNG Port
Vng_host = "/tmp/eNBVng.pipe"; #Host for System Simulator VNG Port
Vtp_port = 7780; #Port Number for System Simulator VTP Port
Vtp_host = "/tmp/eNBVT.pipe"; #Host for System Simulator VTP Port
Drb_port = 7781; #Port Number for System Simulator DRB Port
Drb_host = "/tmp/eNBDrb.pipe"; #Host for System Simulator DRB Port
SysInd_port = 7782; #Port Number for System Simulator SysIND Port
SysInd_host = "/tmp/eNBSysInd.pipe"; #Host for System Simulator DRB Port
SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
}
);
......
......@@ -17,7 +17,7 @@ eNBs =
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } );
tr_s_preference = "local_mac"
......@@ -258,6 +258,7 @@ SSConfig = (
Srb_port = 7778; #Port Number for System Simulator Srb Port
Vng_port = 7779; #Port Number for System Simulator VNG Port
Vtp_port = 7780; #Port Number for System Simulator VTP Port
Vtp_host = "127.0.0.1"; #Host for System Simulator VTP Port
Drb_port = 7781; #Port Number for System Simulator DRB Port
SysInd_port = 7782; #Port Number for System Simulator SysIND Port
SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
......@@ -277,7 +278,7 @@ MACRLCs = (
tr_s_preference = "nfapi";
tr_n_preference = "local_RRC";
#scheduler_mode = "fairRR";
}
}
);
THREAD_STRUCT = (
......
......@@ -17,7 +17,7 @@ eNBs =
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } );
tr_s_preference = "local_mac"
......@@ -337,11 +337,17 @@ SSConfig = (
{
hostIp = "127.0.0.1"; #Host IP for System Simulator
Sys_port = 7777; #Port Number for System Simulator Sys Port
Sys_host = "/tmp/eNBSys.pipe"; #Host for System Simulator SYS Port
Srb_port = 7778; #Port Number for System Simulator Srb Port
Srb_host = "/tmp/eNBSrb.pipe"; #Host for System Simulator SRB Port
Vng_port = 7779; #Port Number for System Simulator VNG Port
Vng_host = "/tmp/eNBVng.pipe"; #Host for System Simulator VNG Port
Vtp_port = 7780; #Port Number for System Simulator VTP Port
Vtp_host = "/tmp/eNBVT.pipe"; #Host for System Simulator VTP Port
Drb_port = 7781; #Port Number for System Simulator DRB Port
Drb_host = "/tmp/eNBDrb.pipe"; #Host for System Simulator DRB Port
SysInd_port = 7782; #Port Number for System Simulator SysIND Port
SysInd_host = "/tmp/eNBSysInd.pipe"; #Host for System Simulator DRB Port
SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
}
);
......@@ -359,7 +365,7 @@ MACRLCs = (
tr_s_preference = "nfapi";
tr_n_preference = "local_RRC";
#scheduler_mode = "fairRR";
}
}
);
THREAD_STRUCT = (
......
......@@ -173,11 +173,17 @@ void RCconfig_ssparam(void) {
if ( SSConfig_ParamList.numelt > 0) {
RC.ss.hostIp = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_HOSTIP_IDX].strptr));
RC.ss.Sysport = *(SSConfig_ParamList.paramarray[0][CONFIG_SS_SYSPORT_IDX].iptr);
RC.ss.SysHost = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_SYSHOST_IDX].strptr));
RC.ss.Srbport = *(SSConfig_ParamList.paramarray[0][CONFIG_SS_SRBPORT_IDX].iptr);
RC.ss.SrbHost = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_SRBHOST_IDX].strptr));
RC.ss.Vngport = *(SSConfig_ParamList.paramarray[0][CONFIG_SS_VNGPORT_IDX].iptr);
RC.ss.VngHost = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_VNGHOST_IDX].strptr));
RC.ss.Vtpport = *(SSConfig_ParamList.paramarray[0][CONFIG_SS_VTPPORT_IDX].iptr);
RC.ss.VtpHost = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_VTPHOST_IDX].strptr));
RC.ss.SysIndport = *(SSConfig_ParamList.paramarray[0][CONFIG_SS_SYSINDPORT_IDX].iptr);
RC.ss.SysIndHost = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_SYSINDHOST_IDX].strptr));
RC.ss.Drbport = *(SSConfig_ParamList.paramarray[0][CONFIG_SS_DRBPORT_IDX].iptr);
RC.ss.DrbHost = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_DRBHOST_IDX].strptr));
RC.ss.mode = *(SSConfig_ParamList.paramarray[0][CONFIG_SS_MODE_IDX].iptr);
}
LOG_A(ENB_APP,"SS_Config:SSMode %d, hostIp=%s, Sysport=%d, Srbport=%d Vngport=%d SysIndport=%d Drbport=%d\n",
......@@ -2260,7 +2266,7 @@ int RCconfig_S1(
}
else
{
LOG_E(S1AP,
LOG_E(S1AP,
"s1setup_rsp_timer value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_S1SETUP_RSP_TIMER_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).s1_setuprsp_wait_timer = 5;
......@@ -2272,7 +2278,7 @@ int RCconfig_S1(
}
else
{
LOG_E(S1AP,
LOG_E(S1AP,
"s1setup_req_timer value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_TIMER_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_wait_timer = 5;
......@@ -2284,7 +2290,7 @@ int RCconfig_S1(
}
else
{
LOG_E(S1AP,
LOG_E(S1AP,
"s1setup_req_count value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_COUNT_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_count = 0xffff;
......@@ -2296,7 +2302,7 @@ int RCconfig_S1(
}
else
{
LOG_E(S1AP,
LOG_E(S1AP,
"sctp_req_timer value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_SCTP_REQ_TIMER_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_timer = 180;
......@@ -2308,7 +2314,7 @@ int RCconfig_S1(
}
else
{
LOG_E(S1AP,
LOG_E(S1AP,
"sctp_req_count value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_count = 0xffff;
......
......@@ -153,8 +153,8 @@ typedef enum {
#define RU_IF_FREQ_OFFSET 27
#define RU_DO_PRECODING 28
#define RU_SF_AHEAD 29
#define RU_SL_AHEAD 30
#define RU_NR_FLAG 31
#define RU_SL_AHEAD 30
#define RU_NR_FLAG 31
#define RU_NR_SCS_FOR_RASTER 32
#define RU_TX_SUBDEV 33
#define RU_RX_SUBDEV 34
......@@ -399,30 +399,48 @@ typedef enum {
#define CONFIG_SS "SSConfig"
#define CONFIG_SS_HOSTIP "hostIp"
#define CONFIG_SS_SYSPORT "Sys_port"
#define CONFIG_SS_SYSHOST "Sys_host"
#define CONFIG_SS_SRBPORT "Srb_port"
#define CONFIG_SS_SRBHOST "Srb_host"
#define CONFIG_SS_VNGPORT "Vng_port"
#define CONFIG_SS_VNGHOST "Vng_host"
#define CONFIG_SS_VTPPORT "Vtp_port"
#define CONFIG_SS_VTPHOST "Vtp_host"
#define CONFIG_SS_SYSINDPORT "SysInd_port"
#define CONFIG_SS_SYSINDHOST "SysInd_host"
#define CONFIG_SS_DRBPORT "Drb_port"
#define CONFIG_SS_DRBHOST "Drb_host"
#define CONFIG_SS_MODE "SSMode"
#define CONFIG_SS_HOSTIP_IDX 0
#define CONFIG_SS_SYSPORT_IDX 1
#define CONFIG_SS_SRBPORT_IDX 2
#define CONFIG_SS_VNGPORT_IDX 3
#define CONFIG_SS_VTPPORT_IDX 4
#define CONFIG_SS_SYSINDPORT_IDX 5
#define CONFIG_SS_DRBPORT_IDX 6
#define CONFIG_SS_MODE_IDX 7
#define CONFIG_SS_SYSHOST_IDX 2
#define CONFIG_SS_SRBPORT_IDX 3
#define CONFIG_SS_SRBHOST_IDX 4
#define CONFIG_SS_VNGPORT_IDX 5
#define CONFIG_SS_VNGHOST_IDX 6
#define CONFIG_SS_VTPPORT_IDX 7
#define CONFIG_SS_VTPHOST_IDX 8
#define CONFIG_SS_SYSINDPORT_IDX 9
#define CONFIG_SS_SYSINDHOST_IDX 10
#define CONFIG_SS_DRBPORT_IDX 11
#define CONFIG_SS_DRBHOST_IDX 12
#define CONFIG_SS_MODE_IDX 13
#define SSPARAMS_DESC { \
{CONFIG_SS_HOSTIP , NULL, 0, uptr:NULL, defstrval:"0.0.0.0", TYPE_STRING, 0}, \
{CONFIG_SS_HOSTIP , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_SS_SYSPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{CONFIG_SS_SYSHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_SS_SRBPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{CONFIG_SS_SRBHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_SS_VNGPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{CONFIG_SS_VNGHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_SS_VTPPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{CONFIG_SS_VTPHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_SS_SYSINDPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{CONFIG_SS_SYSINDHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_SS_DRBPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{CONFIG_SS_DRBHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_SS_MODE , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
}
......
This diff is collapsed.
......@@ -20,7 +20,7 @@
*/
/*! \file openair2/GNB_APP/gnb_paramdef.f
* \brief definition of configuration parameters for all gNodeB modules
* \brief definition of configuration parameters for all gNodeB modules
* \author Francois TABURET, WEI-TAI CHEN
* \date 2018
* \version 0.1
......@@ -39,8 +39,8 @@
#define GNB_CONFIG_STRING_CC_NODE_FUNCTION "node_function"
#define GNB_CONFIG_STRING_CC_NODE_TIMING "node_timing"
#define GNB_CONFIG_STRING_CC_NODE_SYNCH_REF "node_synch_ref"
#define GNB_CONFIG_STRING_CC_NODE_TIMING "node_timing"
#define GNB_CONFIG_STRING_CC_NODE_SYNCH_REF "node_synch_ref"
// OTG config per GNB-UE DL
......@@ -215,7 +215,7 @@ typedef enum {
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/* PLMN ID configuration */
......@@ -253,27 +253,42 @@ typedef enum {
#define GNB_CONFIG_SS "SSConfig"
#define GNB_CONFIG_SS_HOSTIP "hostIp"
#define GNB_CONFIG_SS_SYSPORT "Sys_port"
#define GNB_CONFIG_SS_SYSHOST "Sys_host"
#define GNB_CONFIG_SS_SRBPORT "Srb_port"
#define GNB_CONFIG_SS_SRBHOST "Srb_host"
#define GNB_CONFIG_SS_VNGPORT "Vng_port"
#define GNB_CONFIG_SS_VNGHOST "Vng_host"
#define GNB_CONFIG_SS_VTPPORT "Vtp_port"
#define GNB_CONFIG_SS_VTPHOST "Vtp_host"
#define GNB_CONFIG_SS_DRBPORT "Drb_port"
#define GNB_CONFIG_SS_DRBHOST "Drb_host"
#define GNB_CONFIG_SS_MODE "SSMode"
#define GNB_CONFIG_SS_HOSTIP_IDX 0
#define GNB_CONFIG_SS_SYSPORT_IDX 1
#define GNB_CONFIG_SS_SRBPORT_IDX 2
#define GNB_CONFIG_SS_VNGPORT_IDX 3
#define GNB_CONFIG_SS_VTPPORT_IDX 4
#define GNB_CONFIG_SS_DRBPORT_IDX 5
#define GNB_CONFIG_SS_MODE_IDX 6
#define GNB_CONFIG_SS_SYSHOST_IDX 2
#define GNB_CONFIG_SS_SRBPORT_IDX 3
#define GNB_CONFIG_SS_SRBHOST_IDX 4
#define GNB_CONFIG_SS_VNGPORT_IDX 5
#define GNB_CONFIG_SS_VNGHOST_IDX 6
#define GNB_CONFIG_SS_VTPPORT_IDX 7
#define GNB_CONFIG_SS_VTPHOST_IDX 8
#define GNB_CONFIG_SS_DRBPORT_IDX 9
#define GNB_CONFIG_SS_DRBHOST_IDX 10
#define GNB_CONFIG_SS_MODE_IDX 11
#define GNB_SSPARAMS_DESC { \
{GNB_CONFIG_SS_HOSTIP , NULL, 0, uptr:NULL, defstrval:"0.0.0.0", TYPE_STRING, 0}, \
{GNB_CONFIG_SS_HOSTIP , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_SS_SYSPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_SYSHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_SS_SRBPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_SRBHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_SS_VNGPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_VNGHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_SS_VTPPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_VTPHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_SS_DRBPORT , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
{GNB_CONFIG_SS_DRBHOST , NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_SS_MODE , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
}
......
......@@ -179,42 +179,42 @@ int acpInitCtx(const struct acpMsgTable* msgTable, acpCtx_t* ctx);
* @param[in] aSize Arena size
* @return 0 on success, or an error code on failure.
*/
int acpClientInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize);
int acpClientInit(acpCtx_t ctx, const char* host, int port, size_t aSize);
/** Connects to server.
* Allocates the context with registering to requested notifications.
*
* @param[in] ipaddr Server ip address
* @param[in] host Server ip address
* @param[in] port Server TCP port
* @param[in] msgTable Requested service responses/notifications to register, last element should be with name==NULL
* @param[in] aSize Arena size
* @param[out] ctx ACP Context
* @return 0 on success, or an error code on failure.
*/
int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx);
int acpClientInitWithCtx(const char* host, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx);
/** Runs server.
* Context should be allocated with acpCreateCtx.
*
* @param[in] ctx ACP Context
* @param[in] ipaddr Server ip address
* @param[in] host Server ip address / unixsocket pipe file
* @param[in] port Server TCP port
* @param[in] aSize Arena size
* @return 0 on success, or an error code on failure.
*/
int acpServerInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize);
int acpServerInit(acpCtx_t ctx, const char* host, int port, size_t aSize);
/** Runs server.
* Allocates the context with registering to requested notifications.
*
* @param[in] ipaddr Server ip address
* @param[in] host Server ip address / unixsocket pipe path
* @param[in] port Server TCP port
* @param[in] msgTable Requested service responses/notifications to register, last element should be with name==NULL
* @param[in] aSize Arena size
* @param[out] ctx ACP Context
* @return 0 on success, or an error code on failure.
*/
int acpServerInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx);
int acpServerInitWithCtx(const char* host, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx);
/** Closes the socket from the context,
* an ACP context is still valid after call.
......
......@@ -57,6 +57,8 @@ struct acpCtx {
void* handle;
/** ACP server handle. */
void* sHandle;
/** Socket type (AF_INET/AF_UNIX) */
int sockType;
/** Socket descriptor (on client side, or master socket on server side). */
int sock;
/** Peers socket descriptors on server side. */
......
......@@ -32,19 +32,19 @@ SIDL_BEGIN_C_INTERFACE
/** Connects to server.
*
* @param[in] ipaddr Server ip address
* @param[in] host Server ip address
* @param[in] port Server ip port
* @return socket fd, or negative number on failure
*/
int acpSocketConnect(IpAddress_t ipaddr, int port);
int acpSocketConnect(const char* host, int port);
/** Opens listening socket.
*
* @param[in] ipaddr Server ip address
* @param[in] host Server ip address / unixsocket file
* @param[in] port Server ip port
* @return socket fd, or negative number on failure
*/
int acpSocketListen(IpAddress_t ipaddr, int port);
int acpSocketListen(const char* host, int port);
int acpSocketSelect(int sock, MSec_t socketTimeout);
......
......@@ -419,7 +419,6 @@ int acpSendMsg(acpCtx_t ctx, size_t size, const unsigned char* buffer)
ACP_DEBUG_CLOG(ctx, "Sending message '%s'", acpGetMsgName(ACP_HEADER_SIZE, buffer));
#endif
int ret;
int sock = ACP_CTX_CAST(ctx)->sock;
if (ACP_CTX_CAST(ctx)->isServer) {
......@@ -431,6 +430,8 @@ int acpSendMsg(acpCtx_t ctx, size_t size, const unsigned char* buffer)
}
}
int ret = 0;
/* Write SIDL message */
if (kind != ACP_NTF) {
if (ACP_CTX_CAST(ctx)->isServer && !acpCtxPeerRespondsToService(ACP_CTX_CAST(ctx), sock, type)) {
......@@ -507,7 +508,7 @@ int acpInitCtx(const struct acpMsgTable* msgTable, acpCtx_t* ctx)
return 0;
}
int acpClientInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
int acpClientInit(acpCtx_t ctx, const char* host, int port, size_t aSize)
{
ACP_DEBUG_ENTER_CLOG(ctx);
......@@ -516,7 +517,7 @@ int acpClientInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return -ACP_ERR_INVALID_CTX;
}
int sock = acpSocketConnect(ipaddr, port);
int sock = acpSocketConnect(host, port);
if (sock < 0) {
ACP_DEBUG_EXIT_CLOG(ctx, "ACP_ERR_SOCKCONN_ABORTED");
return -ACP_ERR_SOCKCONN_ABORTED;
......@@ -547,7 +548,7 @@ int acpClientInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return 0;
}
int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx)
int acpClientInitWithCtx(const char* host, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx)
{
SIDL_ASSERT(ctx);
ACP_DEBUG_ENTER_LOG();
......@@ -559,7 +560,7 @@ int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable*
return ret;
}
ret = acpClientInit(_ctx, ipaddr, port, aSize);
ret = acpClientInit(_ctx, host, port, aSize);
if (ret < 0) {
acpDeleteCtx(_ctx);
......@@ -573,7 +574,7 @@ int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable*
return 0;
}
int acpServerInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
int acpServerInit(acpCtx_t ctx, const char* host, int port, size_t aSize)
{
ACP_DEBUG_ENTER_CLOG(ctx);
......@@ -582,7 +583,7 @@ int acpServerInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return -ACP_ERR_INVALID_CTX;
}
int sock = acpSocketListen(ipaddr, port);
int sock = acpSocketListen(host, port);
if (sock < 0) {
ACP_DEBUG_EXIT_CLOG(ctx, "ACP_ERR_SOCKCONN_ABORTED");
return -ACP_ERR_SOCKCONN_ABORTED;
......@@ -598,10 +599,10 @@ int acpServerInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return 0;
}
int acpServerInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx)
int acpServerInitWithCtx(const char* host, int port, const struct acpMsgTable* msgTable, size_t aSize, acpCtx_t* ctx)
{
SIDL_ASSERT(host);
SIDL_ASSERT(ctx);
ACP_DEBUG_ENTER_LOG();
acpCtx_t _ctx = NULL;
......@@ -611,7 +612,7 @@ int acpServerInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable*
return ret;
}
ret = acpServerInit(_ctx, ipaddr, port, aSize);
ret = acpServerInit(_ctx, host, port, aSize);
if (ret < 0) {
acpDeleteCtx(_ctx);
......
......@@ -24,12 +24,17 @@
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <regex.h>
// Internal includes
#include "acpSocket.h"
......@@ -91,28 +96,98 @@ static int acpSocketSetOpts(int sock, bool isServer)
return 0;
}
int acpSocketConnect(IpAddress_t ipaddr, int port)
static int acpIsIp(const char* ip)
{
ACP_DEBUG_ENTER_LOG();
regex_t regex;
int reti = regcomp(&regex, "^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$", REG_NEWLINE | REG_ICASE | REG_EXTENDED);
SIDL_ASSERT(reti == REG_NOERROR);
struct sockaddr_in sin;
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = ntohl(ipaddr.v.ipv4);
reti = regexec(&regex, ip, 0, NULL, 0);
SIDL_ASSERT((reti == REG_NOERROR) || (reti == REG_NOMATCH));
return reti;
}
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
}
static int acpPrepareSocket(const char* host, int port, struct sockaddr ** sin, size_t* sinsz)
{
int sock = -1;
uint8_t isUnixSocket = acpIsIp(host);
if (!isUnixSocket) {
IpAddress_t ipaddr;
acpConvertIp(host, &ipaddr);
*sin = (struct sockaddr*)acpMalloc(sizeof(struct sockaddr_in));
SIDL_ASSERT(*sin);
((struct sockaddr_in*)*sin)->sin_family = AF_INET;
((struct sockaddr_in*)*sin)->sin_port = htons(port);
((struct sockaddr_in*)*sin)->sin_addr.s_addr = ntohl(ipaddr.v.ipv4);
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
acpFree(*sin);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
}
if (acpSocketSetOpts(sock, false) == -1) {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
*sinsz = sizeof(struct sockaddr_in);
if (acpSocketSetOpts(sock, false) == -1) {
acpFree(*sin);
return -1;
}
} else {
mode_t pre_umask = umask(0);
*sin = (struct sockaddr*)acpMalloc(sizeof(struct sockaddr_un));
SIDL_ASSERT(*sin);
memset(*sin, 0, sizeof(struct sockaddr_un));
((struct sockaddr_un*)*sin)->sun_family = AF_UNIX;
strcpy(((struct sockaddr_un*)*sin)->sun_path, host);
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0) {
ACP_DEBUG_EXIT_LOG(strerror(errno));
acpFree(*sin);
umask(pre_umask);
return -1;
}
int arg = fcntl(sock, F_GETFL, NULL);
if (arg == -1) {
ACP_DEBUG_EXIT_LOG(strerror(errno));
acpFree(*sin);
umask(pre_umask);
return -1;
}
arg |= O_NONBLOCK;
if (fcntl(sock, F_SETFL, arg) == -1) {
ACP_DEBUG_EXIT_LOG(strerror(errno));
acpFree(*sin);
umask(pre_umask);
return -1;
}
*sinsz = sizeof(struct sockaddr_un);
}
if (connect(sock, (struct sockaddr*)&sin, sizeof(sin)) == -1) {
return sock;
}
int acpSocketConnect(const char* host, int port)
{
ACP_DEBUG_ENTER_LOG();
int sock = -1;
struct sockaddr * sin = NULL;
size_t sinsz = 0;
sock = acpPrepareSocket(host, port, &sin, &sinsz);
SIDL_ASSERT(sock >= 0);
SIDL_ASSERT(sin);
if (connect(sock, sin, sinsz) == -1) {
if ((errno == EINPROGRESS) || (errno == EAGAIN)) {
fd_set fdset;
FD_ZERO(&fdset);
......@@ -126,50 +201,44 @@ int acpSocketConnect(IpAddress_t ipaddr, int port)
int valopt;
socklen_t optlen = sizeof(valopt);
if ((getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&valopt, &optlen) == -1) || valopt) {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
goto err;
}
} else {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
goto err;
}
} else {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
goto err;
}
}
ACP_DEBUG_LOG("Connected to server %s:%d", inet_ntoa(sin.sin_addr), port);
acpFree(sin);
ACP_DEBUG_LOG("Connected to server %s:%d", host, port);
ACP_DEBUG_EXIT_LOG(NULL);
return sock;
err:
acpFree(sin);
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
}
int acpSocketListen(IpAddress_t ipaddr, int port)
int acpSocketListen(const char* host, int port)
{
ACP_DEBUG_ENTER_LOG();
struct sockaddr_in sin;
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = ntohl(ipaddr.v.ipv4);
int sock = -1;
struct sockaddr * sin = NULL;
size_t sinsz = 0;
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
if (acpIsIp(host)) {
unlink(host);
}
if (acpSocketSetOpts(sock, true) == -1) {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
}
sock = acpPrepareSocket(host, port, &sin, &sinsz);
SIDL_ASSERT(sock >= 0);
SIDL_ASSERT(sin);
if (bind(sock, (struct sockaddr*)&sin, sizeof(sin)) == -1) {
if (bind(sock, sin, sinsz) == -1) {
if ((errno == EINPROGRESS) || (errno == EAGAIN)) {
fd_set fdset;
FD_ZERO(&fdset);
......@@ -183,33 +252,30 @@ int acpSocketListen(IpAddress_t ipaddr, int port)
int valopt;
socklen_t optlen = sizeof(valopt);
if ((getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&valopt, &optlen) == -1) || valopt) {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
goto err;
}
} else {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
goto err;
}
} else {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
goto err;
}
}
const int backlog = 3;
if (listen(sock, backlog) == -1) {
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
goto err;
}
ACP_DEBUG_LOG("Created listening server %s:%d", inet_ntoa(sin.sin_addr), port);
acpFree(sin);
ACP_DEBUG_LOG("Created listening server %s:%d", host, port);
ACP_DEBUG_EXIT_LOG(NULL);
return sock;
err:
acpFree(sin);
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
}
int acpSocketSelect(int sock, MSec_t socketTimeout)
......
......@@ -93,7 +93,7 @@ static void ss_send_drb_data(ss_drb_pdu_ind_t *pdu_ind, int cell_index){
ind.Common.TimingInfo.d = TimingInfo_Type_SubFrame;
ind.Common.TimingInfo.v.SubFrame.SFN.d = SystemFrameNumberInfo_Type_Number;
ind.Common.TimingInfo.v.SubFrame.SFN.v.Number = pdu_ind->frame;
ind.Common.TimingInfo.v.SubFrame.Subframe.d = SubFrameInfo_Type_Number;
ind.Common.TimingInfo.v.SubFrame.Subframe.v.Number = pdu_ind->subframe;
......@@ -120,7 +120,7 @@ static void ss_send_drb_data(ss_drb_pdu_ind_t *pdu_ind, int cell_index){
DevAssert(ind.U_Plane.SubframeData.PduSduList.v.PdcpSdu.v != NULL);
ind.U_Plane.SubframeData.PduSduList.v.PdcpSdu.v[i].d = pdu_ind->sdu_size;
ind.U_Plane.SubframeData.PduSduList.v.PdcpSdu.v[i].v = CALLOC(1,ind.U_Plane.SubframeData.PduSduList.v.PdcpSdu.v[i].d);
memcpy(ind.U_Plane.SubframeData.PduSduList.v.PdcpSdu.v[i].v, pdu_ind->sdu, pdu_ind->sdu_size);
memcpy(ind.U_Plane.SubframeData.PduSduList.v.PdcpSdu.v[i].v, pdu_ind->sdu, pdu_ind->sdu_size);
}
//Encode Message
......@@ -226,10 +226,10 @@ ss_eNB_read_from_drb_socket(acpCtx_t ctx){
}
else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS_DRB] Peer ordered shutdown\n");
}
}
else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS_DRB] Peer connection established\n");
}
}
else
{
LOG_A(ENB_SS_DRB_ACP, "[SS_DRB] Invalid userId: %d \n", userId);
......@@ -286,7 +286,7 @@ void *ss_eNB_drb_process_itti_msg(void *notUsed)
MessageDef *received_msg = NULL;
int result = 0;
itti_receive_msg(TASK_SS_DRB, &received_msg);
/* Check if there is a packet to handle */
if (received_msg != NULL)
......@@ -303,15 +303,15 @@ void *ss_eNB_drb_process_itti_msg(void *notUsed)
}
task_id_t origin_task = ITTI_MSG_ORIGIN_ID(received_msg);
if (origin_task == TASK_SS_PORTMAN)
{
if (origin_task == TASK_SS_PORTMAN)
{
LOG_D(ENB_SS_DRB, "[SS_DRB] DUMMY WAKEUP recevied from PORTMAN state %d \n", SS_context.SSCell_list[cell_index].State);
}
}
else
{
{
LOG_A(ENB_SS_DRB, "[SS_DRB] Received SS_DRB_PDU_IND from RRC PDCP\n");
if (SS_context.SSCell_list[cell_index].State >= SS_STATE_CELL_ACTIVE)
{
{
instance_g = ITTI_MSG_DESTINATION_INSTANCE(received_msg);
ss_send_drb_data(&received_msg->ittiMsg.ss_drb_pdu_ind,cell_index);
}
......@@ -335,7 +335,7 @@ void *ss_eNB_drb_process_itti_msg(void *notUsed)
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
}
}
}
else
{
......@@ -347,13 +347,8 @@ void *ss_eNB_drb_process_itti_msg(void *notUsed)
void ss_eNB_drb_init(void)
{
IpAddress_t ipaddr;
LOG_A(ENB_SS_DRB_ACP, "[SS_DRB] Starting System Simulator DRB Thread \n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Drbport;
const struct acpMsgTable msgTable[] = {
......@@ -367,7 +362,7 @@ void ss_eNB_drb_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_drb_g);
int ret = acpServerInitWithCtx(RC.ss.DrbHost ? RC.ss.DrbHost : "127.0.0.1", port, msgTable, aSize, &ctx_drb_g);
if (ret < 0)
{
LOG_A(ENB_SS_DRB_ACP, "[SS_DRB] Connection failure err=%d\n", ret);
......
......@@ -302,13 +302,8 @@ void ss_port_man_send_data(
*/
void ss_eNB_port_man_init(void)
{
IpAddress_t ipaddr;
LOG_A(ENB_SS_PORTMAN_ACP, "Starting System Simulator Manager\n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
LOG_A(ENB_SS_PORTMAN_ACP, "[SS-PORTMAN] Starting System Simulator Manager\n");
// Port number
int port = RC.ss.Sysport;
......@@ -325,7 +320,7 @@ void ss_eNB_port_man_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_g);
int ret = acpServerInitWithCtx(RC.ss.SysHost ? RC.ss.SysHost : "127.0.0.1", port, msgTable, aSize, &ctx_g);
if (ret < 0)
{
LOG_A(ENB_SS_PORTMAN_ACP, "Connection failure err=%d\n", ret);
......@@ -378,10 +373,12 @@ static inline void ss_eNB_read_from_socket(acpCtx_t ctx)
acpGetMsgSidlStatus(msgSize, buffer, &sidlStatus);
acpFree(buffer);
}
else if (userId == -ACP_PEER_DISCONNECTED){
else if (userId == -ACP_PEER_DISCONNECTED)
{
LOG_E(ENB_SS_PORTMAN_ACP, "Error: Peer ordered shutdown\n");
}
else if (userId == -ACP_PEER_CONNECTED){
else if (userId == -ACP_PEER_CONNECTED)
{
LOG_A(ENB_SS_PORTMAN_ACP, " Peer connection established\n");
}
else
......
......@@ -279,7 +279,7 @@ static void ss_task_handle_rrc_pdu_req(struct EUTRA_RRC_PDU_REQ *req)
}
else
timer_tinfo.sf--;
msg_queued = vt_timer_setup(timer_tinfo, TASK_RRC_ENB, instance_g,message_p);
LOG_A(ENB_SS_SRB_ACP, "RRC_PDU Queued as the scheduled SFN is %d SF: %d and curr SFN %d , SF %d",
tinfo.sfn,tinfo.sf, SS_context.sfn,SS_context.sf);
......@@ -339,11 +339,11 @@ ss_eNB_read_from_srb_socket(acpCtx_t ctx)
else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer ordered shutdown\n");
isConnected = false;
}
}
else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer connection established\n");
isConnected = true;
}
}
else
{
LOG_A(ENB_SS_SRB_ACP, "[SS_SRB] Invalid userId: %d \n", userId);
......@@ -404,13 +404,8 @@ ss_eNB_read_from_srb_socket(acpCtx_t ctx)
*/
void ss_eNB_srb_init(void)
{
IpAddress_t ipaddr;
LOG_A(ENB_SS_SRB_ACP, "[SS_SRB] Starting System Simulator SRB Thread \n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Srbport;
......@@ -426,7 +421,7 @@ void ss_eNB_srb_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_srb_g);
int ret = acpServerInitWithCtx(RC.ss.SrbHost ? RC.ss.SrbHost : "127.0.0.1", port, msgTable, aSize, &ctx_srb_g);
if (ret < 0)
{
LOG_A(ENB_SS_SRB_ACP, "[SS_SRB] Connection failure err=%d\n", ret);
......
......@@ -77,9 +77,9 @@ static void ss_send_sysind_data(ss_system_ind_t *p_ind,int cell_index)
{
struct SYSTEM_IND ind = {};
uint32_t status = 0;
DevAssert(p_ind != NULL);
size_t msgSize = size;
size_t msgSize = size;
memset(&ind, 0, sizeof(ind));
ind.Common.CellId = SS_context.SSCell_list[cell_index].eutra_cellId;
......@@ -244,11 +244,8 @@ ss_eNB_read_from_sysind_socket(acpCtx_t ctx)
*/
void ss_eNB_sysind_init(void)
{
IpAddress_t ipaddr;
LOG_A(ENB_SS_SYSIND_ACP, "[SS_SYSIND] Starting System Simulator SYSIND Thread \n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.SysIndport;
......@@ -257,13 +254,13 @@ void ss_eNB_sysind_init(void)
{"SysIndProcessToSS", MSG_SysIndProcessToSS_userId},
// The last element should be NULL
{NULL, 0}};
// Arena size to decode received message
const size_t aSize = 32 * 1024;
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_sysind_g);
int ret = acpServerInitWithCtx(RC.ss.SysIndHost ? RC.ss.SysIndHost : "127.0.0.1", port, msgTable, aSize, &ctx_sysind_g);
if (ret < 0)
{
LOG_A(ENB_SS_SYSIND_ACP, "[SS_SYSIND] Connection failure err=%d\n", ret);
......
......@@ -175,10 +175,10 @@ ss_eNB_read_from_vng_socket(acpCtx_t ctx)
}
else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer ordered shutdown\n");
}
}
else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer connection established\n");
}
}
else
{
LOG_A(ENB_SS_VNG, "[SS-VNG] Invalid userId: %d \n", userId);
......@@ -304,17 +304,10 @@ void *ss_eNB_vng_process_itti_msg(void *notUsed)
*/
void ss_eNB_vng_init(void)
{
IpAddress_t ipaddr;
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Vngport;
LOG_A(ENB_SS_VNG, "[SS-VNG] Initializing VNG Port %s:%d\n", hostIp, port);
LOG_A(ENB_SS_VNG, "[SS-VNG] Initializing VNG Port %s:%d\n", RC.ss.VngHost, port);
//acpInit(malloc, free, 1000);
const struct acpMsgTable msgTable[] = {
......@@ -329,7 +322,7 @@ void ss_eNB_vng_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_vng_g);
int ret = acpServerInitWithCtx(RC.ss.VngHost ? RC.ss.VngHost : "127.0.0.1", port, msgTable, aSize, &ctx_vng_g);
if (ret < 0)
{
LOG_A(ENB_SS_VNG, "[SS-VNG] Connection failure err=%d\n", ret);
......
......@@ -48,6 +48,9 @@ enum MsgUserId
char *vtp_local_address = "127.0.0.1";
int vtp_proxy_send_port = 7776;
int vtp_proxy_recv_port = 7777;
int ss_eNB_vtp_init(void);
/*
* Function : sys_send_init_udp
* Description: Sends the UDP_INIT message to UDP_TASK to create the receiving socket
......@@ -347,33 +350,28 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
//------------------------------------------------------------------------------
int ss_eNB_vtp_init(void)
{
IpAddress_t ipaddr;
const char *hostIp;
hostIp = RC.ss.hostIp ? RC.ss.hostIp : "127.0.0.1";
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Vtpport;
if (port == 0)
{
port = 7780;
}
LOG_A(ENB_SS_VTP, "[SS-VTP] Initializing VTP Port %s:%d\n", hostIp, port);
LOG_A(ENB_SS_VTP, "[SS-VTP] Initializing VTP Port %s:%d\n", RC.ss.VtpHost, port);
// acpInit(malloc, free, 1000);
const struct acpMsgTable msgTable[] = {
{"SysVTEnquireTimingAck", MSG_SysVTEnquireTimingAck_userId},
{"SysVTEnquireTimingUpd", MSG_SysVTEnquireTimingUpd_userId},
// The last element should be NULL
{
NULL, 0}};
{NULL, 0},
};
// Arena size to decode received message
const size_t aSize = 32 * 1024;
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_vtp_g);
int ret = acpServerInitWithCtx(RC.ss.VtpHost, port, msgTable, aSize, &ctx_vtp_g);
if (ret < 0)
{
LOG_E(ENB_SS_VTP, "[SS-VTP] Connection failure err=%d\n", ret);
......@@ -390,8 +388,7 @@ int ss_eNB_vtp_init(void)
}
static void ss_eNB_wait_first_msg(void)
{
const size_t size = 16 * 1024;
unsigned char *buffer = (unsigned char *)acpMalloc(size);
unsigned char *buffer = (unsigned char *)acpMalloc(16 * 1024);
assert(buffer);
while (1)
{
......
......@@ -404,12 +404,12 @@ void *ss_gNB_drb_process_itti_msg(void *notUsed)
void ss_gNB_drb_init(void)
{
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS_DRB] Starting System Simulator DRB Thread\n");
char* host = RC.ss.DrbHost;
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
if (host == NULL) {
host = RC.ss.hostIp;
}
// Port number
int port = RC.ss.Drbport;
......@@ -424,7 +424,7 @@ void ss_gNB_drb_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_drb_g);
int ret = acpServerInitWithCtx(host, port, msgTable, aSize, &ctx_drb_g);
if (ret < 0)
{
LOG_A(GNB_APP, "[SS_DRB] Connection failure err=%d\n", ret);
......
......@@ -57,9 +57,9 @@ void ss_nr_port_man_send_cnf(struct NR_SYSTEM_CTRL_CNF recvCnf)
struct NR_SYSTEM_CTRL_CNF cnf;
const size_t size = 16 * 1024;
uint32_t status;
unsigned char *buffer = (unsigned char *)acpMalloc(size);
size_t msgSize = size;
memset(&cnf, 0, sizeof(cnf));
cnf.Common.CellId = recvCnf.Common.CellId;
......@@ -198,13 +198,8 @@ void ss_nr_port_man_send_data(
//------------------------------------------------------------------------------
void ss_gNB_port_man_init(void)
{
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Starting GNB System Simulator Manager\n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.SysportNR;
......@@ -219,7 +214,7 @@ void ss_gNB_port_man_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &nrctx_g);
int ret = acpServerInitWithCtx(RC.ss.SysHost, port, msgTable, aSize, &nrctx_g);
if (ret < 0)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Connection failure err=%d\n", ret);
......@@ -266,10 +261,10 @@ static inline void ss_gNB_read_from_socket(acpCtx_t ctx)
}
else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Peer ordered shutdown\n");
}
}
else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Peer connection established\n");
}
}
else
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s line:%d\n", __FUNCTION__, __LINE__);
......
......@@ -158,26 +158,26 @@ static void ss_send_srb_data(ss_nrrrc_pdu_ind_t *pdu_ind)
#define RESCMPLT_NASINFO c1->choice.rrcResumeComplete->criticalExtensions.choice.rrcResumeComplete->dedicatedNAS_Message
#define UL_NASINFO c1->choice.ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete)
{
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete)
{
if (UL_DCCH.c1->choice.rrcSetupComplete->criticalExtensions.present ==
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete)
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", UL_DCCH.SETCMPLT_NASINFO.buf, UL_DCCH.SETCMPLT_NASINFO.size);
}
}
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcResumeComplete)
{
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcResumeComplete)
{
if (UL_DCCH.c1->choice.rrcResumeComplete->criticalExtensions.present ==
NR_RRCResumeComplete__criticalExtensions_PR_rrcResumeComplete)
NR_RRCResumeComplete__criticalExtensions_PR_rrcResumeComplete)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", UL_DCCH.RESCMPLT_NASINFO->buf, UL_DCCH.RESCMPLT_NASINFO->size);
}
}
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer)
{
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer)
{
if (UL_DCCH.c1->choice.ulInformationTransfer->criticalExtensions.present ==
NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer)
NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", UL_DCCH.UL_NASINFO->buf, UL_DCCH.UL_NASINFO->size);
}
......@@ -256,22 +256,22 @@ static void ss_task_handle_rrc_pdu_req(struct NR_RRC_PDU_REQ *req)
xer_fprint(stdout,&asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg);
if(DL_DCCH.c1->present == NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer)
{
if (DL_DCCH.c1->choice.dlInformationTransfer->criticalExtensions.present
== NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer)
if(DL_DCCH.c1->present == NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer)
{
if (DL_DCCH.c1->choice.dlInformationTransfer->criticalExtensions.present
== NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", DL_DCCH.DL_NASINFO->buf, DL_DCCH.DL_NASINFO->size);
}
}
if(DL_DCCH.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration)
{
if (DL_DCCH.c1->choice.rrcReconfiguration->criticalExtensions.present
== NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration)
if(DL_DCCH.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration)
{
if (DL_DCCH.c1->choice.rrcReconfiguration->criticalExtensions.present
== NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration)
{
int nas_list_cnt;
for (nas_list_cnt = 0; nas_list_cnt < DL_DCCH.RECNFG_NASINFO->list.count; nas_list_cnt++)
for (nas_list_cnt = 0; nas_list_cnt < DL_DCCH.RECNFG_NASINFO->list.count; nas_list_cnt++)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", DL_DCCH.RECNFG_NASINFO->list.array[nas_list_cnt]->buf, DL_DCCH.RECNFG_NASINFO->list.array[nas_list_cnt]->size);
}
......@@ -300,7 +300,7 @@ static void ss_task_handle_rrc_pdu_req(struct NR_RRC_PDU_REQ *req)
//------------------------------------------------------------------------------
static bool isConnected = false;
static bool isConnected = false;
static inline void
ss_gNB_read_from_srb_socket(acpCtx_t ctx)
......@@ -329,11 +329,11 @@ ss_gNB_read_from_srb_socket(acpCtx_t ctx)
} else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer ordered shutdown\n");
isConnected = false;
}
}
else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer connection established\n");
isConnected = true;
}
}
else
{
LOG_A(GNB_APP, "[SS_SRB] Invalid userId: %d \n", userId);
......@@ -349,7 +349,7 @@ ss_gNB_read_from_srb_socket(acpCtx_t ctx)
}
else
LOG_A(GNB_APP, "[SS_SRB] Connection stopped isConnected:false\n)");
}
else if (MSG_NrSysSrbProcessFromSS_userId == userId)
{
......@@ -385,13 +385,8 @@ ss_gNB_read_from_srb_socket(acpCtx_t ctx)
//------------------------------------------------------------------------------
void ss_gNB_srb_init(void)
{
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS_SRB] Starting System Simulator SRB Thread \n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Srbport;
if (RC.ss.mode == SS_SOFTMODEM_SRB)
......@@ -413,7 +408,7 @@ void ss_gNB_srb_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_srb_g);
int ret = acpServerInitWithCtx(RC.ss.SrbHost, port, msgTable, aSize, &ctx_srb_g);
if (ret < 0)
{
LOG_A(GNB_APP, "[SS_SRB] Connection failure err=%d\n", ret);
......
......@@ -76,7 +76,7 @@ static void _ss_log_vt(struct VirtualTimeInfo_Type* virtualTime, const char* pre
case SlotOffset_Type_Numerology1:
_msg_end += snprintf(_msg_end, sizeof(_msg) - (_msg_end - _msg), "slot(1): %d", virtualTime->TimingInfo.Slot.v.SlotOffset.v.Numerology1);
break;
case SlotOffset_Type_Numerology2:
case SlotOffset_Type_Numerology2:
_msg_end += snprintf(_msg_end, sizeof(_msg) - (_msg_end - _msg), "slot(2): %d", virtualTime->TimingInfo.Slot.v.SlotOffset.v.Numerology2);
break;
case SlotOffset_Type_Numerology3:
......@@ -85,7 +85,7 @@ static void _ss_log_vt(struct VirtualTimeInfo_Type* virtualTime, const char* pre
case SlotOffset_Type_Numerology4:
_msg_end += snprintf(_msg_end, sizeof(_msg) - (_msg_end - _msg), "slot(4): %d", virtualTime->TimingInfo.Slot.v.SlotOffset.v.Numerology4);
break;
default:
default:
LOG_E(GNB_APP, "Wrong MU\r\n");
break;
}
......@@ -144,7 +144,7 @@ void ss_vtp_send_tinfo(
case SlotOffset_Type_Numerology1:
virtualTime.TimingInfo.Slot.v.SlotOffset.v.Numerology1 = tinfo->slot;
break;
case SlotOffset_Type_Numerology2:
case SlotOffset_Type_Numerology2:
virtualTime.TimingInfo.Slot.v.SlotOffset.v.Numerology2 = tinfo->slot;
break;
case SlotOffset_Type_Numerology3:
......@@ -153,7 +153,7 @@ void ss_vtp_send_tinfo(
case SlotOffset_Type_Numerology4:
virtualTime.TimingInfo.Slot.v.SlotOffset.v.Numerology4 = tinfo->slot;
break;;
default:
default:
virtualTime.TimingInfo.Slot.d = SlotTimingInfo_Type_UNBOUND_VALUE;
break;;
}
......@@ -267,7 +267,7 @@ static void ss_send_vtp_resp(struct VirtualTimeInfo_Type *virtualTime)
case SlotOffset_Type_Numerology1:
req->tinfo.slot = virtualTime->TimingInfo.Slot.v.SlotOffset.v.Numerology1;
break;
case SlotOffset_Type_Numerology2:
case SlotOffset_Type_Numerology2:
req->tinfo.slot = virtualTime->TimingInfo.Slot.v.SlotOffset.v.Numerology2;
break;
case SlotOffset_Type_Numerology3:
......@@ -276,7 +276,7 @@ static void ss_send_vtp_resp(struct VirtualTimeInfo_Type *virtualTime)
case SlotOffset_Type_Numerology4:
req->tinfo.slot = virtualTime->TimingInfo.Slot.v.SlotOffset.v.Numerology4;
break;
default:
default:
req->tinfo.mu = -1;
break;
}
......@@ -285,7 +285,7 @@ static void ss_send_vtp_resp(struct VirtualTimeInfo_Type *virtualTime)
req->tinfo.sfn = virtualTime->TimingInfo.SFN.v.Number;
req->tinfo.sf = virtualTime->TimingInfo.Subframe.v.Number;
LOG_A(GNB_APP, "VTP_ACK Command to proxy sent for cell_id: %d SFN: %d SF: %d mu: %d slot: %d\n",
req->header.cell_id,req->tinfo.sfn ,req->tinfo.sf, req->tinfo.mu, req->tinfo.slot);
......@@ -327,10 +327,10 @@ static inline uint8_t ss_gNB_read_from_vtp_socket(acpCtx_t ctx)
else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer ordered shutdown\n");
return 1;
}
}
else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer connection established\n");
}
}
}
if (userId == 0)
......@@ -386,7 +386,7 @@ uint8_t ss_gNB_vtp_process_itti_msg(void)
tinfo.mu = 1;
tinfo.sf = SS_NRUPD_TIM_INFO(received_msg).slot / 2;
tinfo.sfn = SS_NRUPD_TIM_INFO(received_msg).sfn;
if (SS_context.vtp_enabled == 1) {
ss_vtp_send_tinfo(TASK_VTP, &tinfo);
}
......@@ -407,23 +407,17 @@ uint8_t ss_gNB_vtp_process_itti_msg(void)
received_msg = NULL;
}
return ss_gNB_read_from_vtp_socket(ctx_vtp_g);
}
//------------------------------------------------------------------------------
int ss_gNB_vtp_init(void)
{
IpAddress_t ipaddr;
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Vtpport ? RC.ss.Vtpport : 7780;
LOG_A(GNB_APP, "[SS-VTP] Initializing VTP Port %s:%d\n", hostIp, port);
LOG_A(GNB_APP, "[SS-VTP] Initializing VTP Port %s:%d\n", RC.ss.hostIp, port);
// acpInit(malloc, free, 1000);
const struct acpMsgTable msgTable[] = {
{"SysVTEnquireTimingAck", MSG_SysVTEnquireTimingAck_userId},
......@@ -437,7 +431,8 @@ int ss_gNB_vtp_init(void)
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_vtp_g);
LOG_W(GNB_APP, "[SS-VTP] Connecting to %s\n", RC.ss.VtpHost);
int ret = acpServerInitWithCtx(RC.ss.VtpHost, port, msgTable, aSize, &ctx_vtp_g);
if (ret < 0)
{
LOG_E(GNB_APP, "[SS-VTP] Connection failure err=%d\n", ret);
......
......@@ -67,16 +67,28 @@ typedef struct ss_config_s {
const char* hostIp;
/** SYS port number */
int Sysport;
/**< Sys port host (could be unixsocket pipe)*/
const char* SysHost;
/** SRB port number */
int Srbport;
/**< SRB port host (could be unixsocket pipe)*/
const char* SrbHost;
/** VNG port number */
int Vngport;
/**< VNG port host (could be unixsocket pipe)*/
const char* VngHost;
/** VTP port number */
int Vtpport;
/**< VTP host (could be unixsocket pipe)*/
const char* VtpHost;
/** SYSIND port number */
int SysIndport;
/**< SYS-IND port host (could be unixsocket pipe)*/
const char* SysIndHost;
/** DRB port number */
int Drbport;
/**< DRB port host (could be unixsocket pipe)*/
const char* DrbHost;
/** SYS Port NR number */
int SysportNR;
uint8_t configured;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment