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 = ( ...@@ -183,10 +183,15 @@ SSConfig = (
{ {
hostIp = "127.0.0.1"; #Host IP for System Simulator hostIp = "127.0.0.1"; #Host IP for System Simulator
Sys_port = 7777; #Port Number for System Simulator Sys Port 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_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_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_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_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 SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
} }
); );
......
...@@ -173,11 +173,17 @@ SSConfig = ( ...@@ -173,11 +173,17 @@ SSConfig = (
{ {
hostIp = "127.0.0.1"; #Host IP for System Simulator hostIp = "127.0.0.1"; #Host IP for System Simulator
Sys_port = 7777; #Port Number for System Simulator Sys Port 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_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_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_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_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_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 SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
} }
); );
......
...@@ -258,6 +258,7 @@ SSConfig = ( ...@@ -258,6 +258,7 @@ SSConfig = (
Srb_port = 7778; #Port Number for System Simulator Srb Port Srb_port = 7778; #Port Number for System Simulator Srb Port
Vng_port = 7779; #Port Number for System Simulator VNG Port Vng_port = 7779; #Port Number for System Simulator VNG Port
Vtp_port = 7780; #Port Number for System Simulator VTP 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 Drb_port = 7781; #Port Number for System Simulator DRB Port
SysInd_port = 7782; #Port Number for System Simulator SysIND 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 SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
......
...@@ -337,11 +337,17 @@ SSConfig = ( ...@@ -337,11 +337,17 @@ SSConfig = (
{ {
hostIp = "127.0.0.1"; #Host IP for System Simulator hostIp = "127.0.0.1"; #Host IP for System Simulator
Sys_port = 7777; #Port Number for System Simulator Sys Port 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_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_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_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_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_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 SSMode = 1; #SSMode: 0 - eNB , 1- SYS_PORT test , 2- Only SRB_PORT test
} }
); );
......
...@@ -173,11 +173,17 @@ void RCconfig_ssparam(void) { ...@@ -173,11 +173,17 @@ void RCconfig_ssparam(void) {
if ( SSConfig_ParamList.numelt > 0) { if ( SSConfig_ParamList.numelt > 0) {
RC.ss.hostIp = strdup(*(SSConfig_ParamList.paramarray[0][CONFIG_SS_HOSTIP_IDX].strptr)); 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.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.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.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.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.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.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); 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", LOG_A(ENB_APP,"SS_Config:SSMode %d, hostIp=%s, Sysport=%d, Srbport=%d Vngport=%d SysIndport=%d Drbport=%d\n",
......
...@@ -399,30 +399,48 @@ typedef enum { ...@@ -399,30 +399,48 @@ typedef enum {
#define CONFIG_SS "SSConfig" #define CONFIG_SS "SSConfig"
#define CONFIG_SS_HOSTIP "hostIp" #define CONFIG_SS_HOSTIP "hostIp"
#define CONFIG_SS_SYSPORT "Sys_port" #define CONFIG_SS_SYSPORT "Sys_port"
#define CONFIG_SS_SYSHOST "Sys_host"
#define CONFIG_SS_SRBPORT "Srb_port" #define CONFIG_SS_SRBPORT "Srb_port"
#define CONFIG_SS_SRBHOST "Srb_host"
#define CONFIG_SS_VNGPORT "Vng_port" #define CONFIG_SS_VNGPORT "Vng_port"
#define CONFIG_SS_VNGHOST "Vng_host"
#define CONFIG_SS_VTPPORT "Vtp_port" #define CONFIG_SS_VTPPORT "Vtp_port"
#define CONFIG_SS_VTPHOST "Vtp_host"
#define CONFIG_SS_SYSINDPORT "SysInd_port" #define CONFIG_SS_SYSINDPORT "SysInd_port"
#define CONFIG_SS_SYSINDHOST "SysInd_host"
#define CONFIG_SS_DRBPORT "Drb_port" #define CONFIG_SS_DRBPORT "Drb_port"
#define CONFIG_SS_DRBHOST "Drb_host"
#define CONFIG_SS_MODE "SSMode" #define CONFIG_SS_MODE "SSMode"
#define CONFIG_SS_HOSTIP_IDX 0 #define CONFIG_SS_HOSTIP_IDX 0
#define CONFIG_SS_SYSPORT_IDX 1 #define CONFIG_SS_SYSPORT_IDX 1
#define CONFIG_SS_SRBPORT_IDX 2 #define CONFIG_SS_SYSHOST_IDX 2
#define CONFIG_SS_VNGPORT_IDX 3 #define CONFIG_SS_SRBPORT_IDX 3
#define CONFIG_SS_VTPPORT_IDX 4 #define CONFIG_SS_SRBHOST_IDX 4
#define CONFIG_SS_SYSINDPORT_IDX 5 #define CONFIG_SS_VNGPORT_IDX 5
#define CONFIG_SS_DRBPORT_IDX 6 #define CONFIG_SS_VNGHOST_IDX 6
#define CONFIG_SS_MODE_IDX 7 #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 { \ #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_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_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_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_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_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_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}, \ {CONFIG_SS_MODE , NULL, 0, uptr:NULL, defintval:0000, TYPE_UINT, 0}, \
} }
......
...@@ -829,10 +829,15 @@ void RCconfig_nr_ssparam(void) { ...@@ -829,10 +829,15 @@ void RCconfig_nr_ssparam(void) {
if ( SSConfig_ParamList.numelt > 0) { if ( SSConfig_ParamList.numelt > 0) {
RC.ss.hostIp = strdup(*(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_HOSTIP_IDX].strptr)); RC.ss.hostIp = strdup(*(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_HOSTIP_IDX].strptr));
RC.ss.Sysport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SYSPORT_IDX].iptr); RC.ss.Sysport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SYSPORT_IDX].iptr);
RC.ss.SysHost = strdup(*(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SYSHOST_IDX].strptr));
RC.ss.Srbport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SRBPORT_IDX].iptr); RC.ss.Srbport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SRBPORT_IDX].iptr);
RC.ss.SrbHost = strdup(*(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SRBHOST_IDX].strptr));
RC.ss.Vngport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VNGPORT_IDX].iptr); RC.ss.Vngport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VNGPORT_IDX].iptr);
RC.ss.VngHost = strdup(*(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VNGHOST_IDX].strptr));
RC.ss.Vtpport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VTPPORT_IDX].iptr); RC.ss.Vtpport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VTPPORT_IDX].iptr);
RC.ss.VtpHost = strdup(*(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_VTPHOST_IDX].strptr));
RC.ss.Drbport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_DRBPORT_IDX].iptr); RC.ss.Drbport = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_DRBPORT_IDX].iptr);
RC.ss.DrbHost = strdup(*(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_DRBHOST_IDX].strptr));
RC.ss.mode = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_MODE_IDX].iptr); RC.ss.mode = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_MODE_IDX].iptr);
RC.ss.SysportNR = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SYSPORT_IDX].iptr); RC.ss.SysportNR = *(SSConfig_ParamList.paramarray[0][GNB_CONFIG_SS_SYSPORT_IDX].iptr);
} }
......
...@@ -253,27 +253,42 @@ typedef enum { ...@@ -253,27 +253,42 @@ typedef enum {
#define GNB_CONFIG_SS "SSConfig" #define GNB_CONFIG_SS "SSConfig"
#define GNB_CONFIG_SS_HOSTIP "hostIp" #define GNB_CONFIG_SS_HOSTIP "hostIp"
#define GNB_CONFIG_SS_SYSPORT "Sys_port" #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_SRBPORT "Srb_port"
#define GNB_CONFIG_SS_SRBHOST "Srb_host"
#define GNB_CONFIG_SS_VNGPORT "Vng_port" #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_VTPPORT "Vtp_port"
#define GNB_CONFIG_SS_VTPHOST "Vtp_host"
#define GNB_CONFIG_SS_DRBPORT "Drb_port" #define GNB_CONFIG_SS_DRBPORT "Drb_port"
#define GNB_CONFIG_SS_DRBHOST "Drb_host"
#define GNB_CONFIG_SS_MODE "SSMode" #define GNB_CONFIG_SS_MODE "SSMode"
#define GNB_CONFIG_SS_HOSTIP_IDX 0 #define GNB_CONFIG_SS_HOSTIP_IDX 0
#define GNB_CONFIG_SS_SYSPORT_IDX 1 #define GNB_CONFIG_SS_SYSPORT_IDX 1
#define GNB_CONFIG_SS_SRBPORT_IDX 2 #define GNB_CONFIG_SS_SYSHOST_IDX 2
#define GNB_CONFIG_SS_VNGPORT_IDX 3 #define GNB_CONFIG_SS_SRBPORT_IDX 3
#define GNB_CONFIG_SS_VTPPORT_IDX 4 #define GNB_CONFIG_SS_SRBHOST_IDX 4
#define GNB_CONFIG_SS_DRBPORT_IDX 5 #define GNB_CONFIG_SS_VNGPORT_IDX 5
#define GNB_CONFIG_SS_MODE_IDX 6 #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 { \ #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_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_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_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_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_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}, \ {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); ...@@ -179,42 +179,42 @@ int acpInitCtx(const struct acpMsgTable* msgTable, acpCtx_t* ctx);
* @param[in] aSize Arena size * @param[in] aSize Arena size
* @return 0 on success, or an error code on failure. * @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. /** Connects to server.
* Allocates the context with registering to requested notifications. * 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] port Server TCP port
* @param[in] msgTable Requested service responses/notifications to register, last element should be with name==NULL * @param[in] msgTable Requested service responses/notifications to register, last element should be with name==NULL
* @param[in] aSize Arena size * @param[in] aSize Arena size
* @param[out] ctx ACP Context * @param[out] ctx ACP Context
* @return 0 on success, or an error code on failure. * @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. /** Runs server.
* Context should be allocated with acpCreateCtx. * Context should be allocated with acpCreateCtx.
* *
* @param[in] ctx ACP Context * @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] port Server TCP port
* @param[in] aSize Arena size * @param[in] aSize Arena size
* @return 0 on success, or an error code on failure. * @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. /** Runs server.
* Allocates the context with registering to requested notifications. * 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] port Server TCP port
* @param[in] msgTable Requested service responses/notifications to register, last element should be with name==NULL * @param[in] msgTable Requested service responses/notifications to register, last element should be with name==NULL
* @param[in] aSize Arena size * @param[in] aSize Arena size
* @param[out] ctx ACP Context * @param[out] ctx ACP Context
* @return 0 on success, or an error code on failure. * @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, /** Closes the socket from the context,
* an ACP context is still valid after call. * an ACP context is still valid after call.
......
...@@ -57,6 +57,8 @@ struct acpCtx { ...@@ -57,6 +57,8 @@ struct acpCtx {
void* handle; void* handle;
/** ACP server handle. */ /** ACP server handle. */
void* sHandle; void* sHandle;
/** Socket type (AF_INET/AF_UNIX) */
int sockType;
/** Socket descriptor (on client side, or master socket on server side). */ /** Socket descriptor (on client side, or master socket on server side). */
int sock; int sock;
/** Peers socket descriptors on server side. */ /** Peers socket descriptors on server side. */
......
...@@ -32,19 +32,19 @@ SIDL_BEGIN_C_INTERFACE ...@@ -32,19 +32,19 @@ SIDL_BEGIN_C_INTERFACE
/** Connects to server. /** Connects to server.
* *
* @param[in] ipaddr Server ip address * @param[in] host Server ip address
* @param[in] port Server ip port * @param[in] port Server ip port
* @return socket fd, or negative number on failure * @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. /** Opens listening socket.
* *
* @param[in] ipaddr Server ip address * @param[in] host Server ip address / unixsocket file
* @param[in] port Server ip port * @param[in] port Server ip port
* @return socket fd, or negative number on failure * @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); int acpSocketSelect(int sock, MSec_t socketTimeout);
......
...@@ -419,7 +419,6 @@ int acpSendMsg(acpCtx_t ctx, size_t size, const unsigned char* buffer) ...@@ -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)); ACP_DEBUG_CLOG(ctx, "Sending message '%s'", acpGetMsgName(ACP_HEADER_SIZE, buffer));
#endif #endif
int ret;
int sock = ACP_CTX_CAST(ctx)->sock; int sock = ACP_CTX_CAST(ctx)->sock;
if (ACP_CTX_CAST(ctx)->isServer) { if (ACP_CTX_CAST(ctx)->isServer) {
...@@ -431,6 +430,8 @@ int acpSendMsg(acpCtx_t ctx, size_t size, const unsigned char* buffer) ...@@ -431,6 +430,8 @@ int acpSendMsg(acpCtx_t ctx, size_t size, const unsigned char* buffer)
} }
} }
int ret = 0;
/* Write SIDL message */ /* Write SIDL message */
if (kind != ACP_NTF) { if (kind != ACP_NTF) {
if (ACP_CTX_CAST(ctx)->isServer && !acpCtxPeerRespondsToService(ACP_CTX_CAST(ctx), sock, type)) { 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) ...@@ -507,7 +508,7 @@ int acpInitCtx(const struct acpMsgTable* msgTable, acpCtx_t* ctx)
return 0; 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); ACP_DEBUG_ENTER_CLOG(ctx);
...@@ -516,7 +517,7 @@ int acpClientInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize) ...@@ -516,7 +517,7 @@ int acpClientInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return -ACP_ERR_INVALID_CTX; return -ACP_ERR_INVALID_CTX;
} }
int sock = acpSocketConnect(ipaddr, port); int sock = acpSocketConnect(host, port);
if (sock < 0) { if (sock < 0) {
ACP_DEBUG_EXIT_CLOG(ctx, "ACP_ERR_SOCKCONN_ABORTED"); ACP_DEBUG_EXIT_CLOG(ctx, "ACP_ERR_SOCKCONN_ABORTED");
return -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) ...@@ -547,7 +548,7 @@ int acpClientInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return 0; 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); SIDL_ASSERT(ctx);
ACP_DEBUG_ENTER_LOG(); ACP_DEBUG_ENTER_LOG();
...@@ -559,7 +560,7 @@ int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable* ...@@ -559,7 +560,7 @@ int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable*
return ret; return ret;
} }
ret = acpClientInit(_ctx, ipaddr, port, aSize); ret = acpClientInit(_ctx, host, port, aSize);
if (ret < 0) { if (ret < 0) {
acpDeleteCtx(_ctx); acpDeleteCtx(_ctx);
...@@ -573,7 +574,7 @@ int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable* ...@@ -573,7 +574,7 @@ int acpClientInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable*
return 0; 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); ACP_DEBUG_ENTER_CLOG(ctx);
...@@ -582,7 +583,7 @@ int acpServerInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize) ...@@ -582,7 +583,7 @@ int acpServerInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return -ACP_ERR_INVALID_CTX; return -ACP_ERR_INVALID_CTX;
} }
int sock = acpSocketListen(ipaddr, port); int sock = acpSocketListen(host, port);
if (sock < 0) { if (sock < 0) {
ACP_DEBUG_EXIT_CLOG(ctx, "ACP_ERR_SOCKCONN_ABORTED"); ACP_DEBUG_EXIT_CLOG(ctx, "ACP_ERR_SOCKCONN_ABORTED");
return -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) ...@@ -598,10 +599,10 @@ int acpServerInit(acpCtx_t ctx, IpAddress_t ipaddr, int port, size_t aSize)
return 0; 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); SIDL_ASSERT(ctx);
ACP_DEBUG_ENTER_LOG(); ACP_DEBUG_ENTER_LOG();
acpCtx_t _ctx = NULL; acpCtx_t _ctx = NULL;
...@@ -611,7 +612,7 @@ int acpServerInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable* ...@@ -611,7 +612,7 @@ int acpServerInitWithCtx(IpAddress_t ipaddr, int port, const struct acpMsgTable*
return ret; return ret;
} }
ret = acpServerInit(_ctx, ipaddr, port, aSize); ret = acpServerInit(_ctx, host, port, aSize);
if (ret < 0) { if (ret < 0) {
acpDeleteCtx(_ctx); acpDeleteCtx(_ctx);
......
...@@ -24,12 +24,17 @@ ...@@ -24,12 +24,17 @@
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <sys/types.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <regex.h>
// Internal includes // Internal includes
#include "acpSocket.h" #include "acpSocket.h"
...@@ -91,28 +96,98 @@ static int acpSocketSetOpts(int sock, bool isServer) ...@@ -91,28 +96,98 @@ static int acpSocketSetOpts(int sock, bool isServer)
return 0; 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; reti = regexec(&regex, ip, 0, NULL, 0);
sin.sin_family = AF_INET; SIDL_ASSERT((reti == REG_NOERROR) || (reti == REG_NOMATCH));
sin.sin_port = htons(port); return reti;
sin.sin_addr.s_addr = ntohl(ipaddr.v.ipv4); }
int sock = socket(AF_INET, SOCK_STREAM, 0); 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) { if (sock < 0) {
acpFree(*sin);
ACP_DEBUG_EXIT_LOG(strerror(errno)); ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1; return -1;
} }
*sinsz = sizeof(struct sockaddr_in);
if (acpSocketSetOpts(sock, false) == -1) { if (acpSocketSetOpts(sock, false) == -1) {
close(sock); 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)); ACP_DEBUG_EXIT_LOG(strerror(errno));
acpFree(*sin);
umask(pre_umask);
return -1; return -1;
} }
if (connect(sock, (struct sockaddr*)&sin, sizeof(sin)) == -1) { *sinsz = sizeof(struct sockaddr_un);
}
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)) { if ((errno == EINPROGRESS) || (errno == EAGAIN)) {
fd_set fdset; fd_set fdset;
FD_ZERO(&fdset); FD_ZERO(&fdset);
...@@ -126,50 +201,44 @@ int acpSocketConnect(IpAddress_t ipaddr, int port) ...@@ -126,50 +201,44 @@ int acpSocketConnect(IpAddress_t ipaddr, int port)
int valopt; int valopt;
socklen_t optlen = sizeof(valopt); socklen_t optlen = sizeof(valopt);
if ((getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&valopt, &optlen) == -1) || valopt) { if ((getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&valopt, &optlen) == -1) || valopt) {
close(sock); goto err;
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
} else { } else {
close(sock); goto err;
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
} else { } else {
close(sock); goto err;
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
} }
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); ACP_DEBUG_EXIT_LOG(NULL);
return sock; 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(); ACP_DEBUG_ENTER_LOG();
struct sockaddr_in sin; int sock = -1;
sin.sin_family = AF_INET; struct sockaddr * sin = NULL;
sin.sin_port = htons(port); size_t sinsz = 0;
sin.sin_addr.s_addr = ntohl(ipaddr.v.ipv4);
int sock = socket(AF_INET, SOCK_STREAM, 0); if (acpIsIp(host)) {
if (sock < 0) { unlink(host);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
if (acpSocketSetOpts(sock, true) == -1) { sock = acpPrepareSocket(host, port, &sin, &sinsz);
close(sock); SIDL_ASSERT(sock >= 0);
ACP_DEBUG_EXIT_LOG(strerror(errno)); SIDL_ASSERT(sin);
return -1;
}
if (bind(sock, (struct sockaddr*)&sin, sizeof(sin)) == -1) { if (bind(sock, sin, sinsz) == -1) {
if ((errno == EINPROGRESS) || (errno == EAGAIN)) { if ((errno == EINPROGRESS) || (errno == EAGAIN)) {
fd_set fdset; fd_set fdset;
FD_ZERO(&fdset); FD_ZERO(&fdset);
...@@ -183,33 +252,30 @@ int acpSocketListen(IpAddress_t ipaddr, int port) ...@@ -183,33 +252,30 @@ int acpSocketListen(IpAddress_t ipaddr, int port)
int valopt; int valopt;
socklen_t optlen = sizeof(valopt); socklen_t optlen = sizeof(valopt);
if ((getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&valopt, &optlen) == -1) || valopt) { if ((getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&valopt, &optlen) == -1) || valopt) {
close(sock); goto err;
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
} else { } else {
close(sock); goto err;
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
} else { } else {
close(sock); goto err;
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
} }
const int backlog = 3; const int backlog = 3;
if (listen(sock, backlog) == -1) { if (listen(sock, backlog) == -1) {
close(sock); goto err;
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
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); ACP_DEBUG_EXIT_LOG(NULL);
return sock; return sock;
err:
acpFree(sin);
close(sock);
ACP_DEBUG_EXIT_LOG(strerror(errno));
return -1;
} }
int acpSocketSelect(int sock, MSec_t socketTimeout) int acpSocketSelect(int sock, MSec_t socketTimeout)
......
...@@ -347,13 +347,8 @@ void *ss_eNB_drb_process_itti_msg(void *notUsed) ...@@ -347,13 +347,8 @@ void *ss_eNB_drb_process_itti_msg(void *notUsed)
void ss_eNB_drb_init(void) void ss_eNB_drb_init(void)
{ {
IpAddress_t ipaddr;
LOG_A(ENB_SS_DRB_ACP, "[SS_DRB] Starting System Simulator DRB Thread \n"); 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 // Port number
int port = RC.ss.Drbport; int port = RC.ss.Drbport;
const struct acpMsgTable msgTable[] = { const struct acpMsgTable msgTable[] = {
...@@ -367,7 +362,7 @@ void ss_eNB_drb_init(void) ...@@ -367,7 +362,7 @@ void ss_eNB_drb_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(ENB_SS_DRB_ACP, "[SS_DRB] Connection failure err=%d\n", ret); LOG_A(ENB_SS_DRB_ACP, "[SS_DRB] Connection failure err=%d\n", ret);
......
...@@ -302,13 +302,8 @@ void ss_port_man_send_data( ...@@ -302,13 +302,8 @@ void ss_port_man_send_data(
*/ */
void ss_eNB_port_man_init(void) 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 // Port number
int port = RC.ss.Sysport; int port = RC.ss.Sysport;
...@@ -325,7 +320,7 @@ void ss_eNB_port_man_init(void) ...@@ -325,7 +320,7 @@ void ss_eNB_port_man_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(ENB_SS_PORTMAN_ACP, "Connection failure err=%d\n", ret); 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) ...@@ -378,10 +373,12 @@ static inline void ss_eNB_read_from_socket(acpCtx_t ctx)
acpGetMsgSidlStatus(msgSize, buffer, &sidlStatus); acpGetMsgSidlStatus(msgSize, buffer, &sidlStatus);
acpFree(buffer); 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"); 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"); LOG_A(ENB_SS_PORTMAN_ACP, " Peer connection established\n");
} }
else else
......
...@@ -404,13 +404,8 @@ ss_eNB_read_from_srb_socket(acpCtx_t ctx) ...@@ -404,13 +404,8 @@ ss_eNB_read_from_srb_socket(acpCtx_t ctx)
*/ */
void ss_eNB_srb_init(void) void ss_eNB_srb_init(void)
{ {
IpAddress_t ipaddr;
LOG_A(ENB_SS_SRB_ACP, "[SS_SRB] Starting System Simulator SRB Thread \n"); 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 // Port number
int port = RC.ss.Srbport; int port = RC.ss.Srbport;
...@@ -426,7 +421,7 @@ void ss_eNB_srb_init(void) ...@@ -426,7 +421,7 @@ void ss_eNB_srb_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(ENB_SS_SRB_ACP, "[SS_SRB] Connection failure err=%d\n", ret); LOG_A(ENB_SS_SRB_ACP, "[SS_SRB] Connection failure err=%d\n", ret);
......
...@@ -244,11 +244,8 @@ ss_eNB_read_from_sysind_socket(acpCtx_t ctx) ...@@ -244,11 +244,8 @@ ss_eNB_read_from_sysind_socket(acpCtx_t ctx)
*/ */
void ss_eNB_sysind_init(void) void ss_eNB_sysind_init(void)
{ {
IpAddress_t ipaddr;
LOG_A(ENB_SS_SYSIND_ACP, "[SS_SYSIND] Starting System Simulator SYSIND Thread \n"); 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 // Port number
int port = RC.ss.SysIndport; int port = RC.ss.SysIndport;
...@@ -263,7 +260,7 @@ void ss_eNB_sysind_init(void) ...@@ -263,7 +260,7 @@ void ss_eNB_sysind_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(ENB_SS_SYSIND_ACP, "[SS_SYSIND] Connection failure err=%d\n", ret); LOG_A(ENB_SS_SYSIND_ACP, "[SS_SYSIND] Connection failure err=%d\n", ret);
......
...@@ -304,17 +304,10 @@ void *ss_eNB_vng_process_itti_msg(void *notUsed) ...@@ -304,17 +304,10 @@ void *ss_eNB_vng_process_itti_msg(void *notUsed)
*/ */
void ss_eNB_vng_init(void) void ss_eNB_vng_init(void)
{ {
IpAddress_t ipaddr;
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number // Port number
int port = RC.ss.Vngport; 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); //acpInit(malloc, free, 1000);
const struct acpMsgTable msgTable[] = { const struct acpMsgTable msgTable[] = {
...@@ -329,7 +322,7 @@ void ss_eNB_vng_init(void) ...@@ -329,7 +322,7 @@ void ss_eNB_vng_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(ENB_SS_VNG, "[SS-VNG] Connection failure err=%d\n", ret); LOG_A(ENB_SS_VNG, "[SS-VNG] Connection failure err=%d\n", ret);
......
...@@ -48,6 +48,9 @@ enum MsgUserId ...@@ -48,6 +48,9 @@ enum MsgUserId
char *vtp_local_address = "127.0.0.1"; char *vtp_local_address = "127.0.0.1";
int vtp_proxy_send_port = 7776; int vtp_proxy_send_port = 7776;
int vtp_proxy_recv_port = 7777; int vtp_proxy_recv_port = 7777;
int ss_eNB_vtp_init(void);
/* /*
* Function : sys_send_init_udp * Function : sys_send_init_udp
* Description: Sends the UDP_INIT message to UDP_TASK to create the receiving socket * 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) ...@@ -347,33 +350,28 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int ss_eNB_vtp_init(void) 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 // Port number
int port = RC.ss.Vtpport; int port = RC.ss.Vtpport;
if (port == 0) if (port == 0)
{ {
port = 7780; 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); // acpInit(malloc, free, 1000);
const struct acpMsgTable msgTable[] = { const struct acpMsgTable msgTable[] = {
{"SysVTEnquireTimingAck", MSG_SysVTEnquireTimingAck_userId}, {"SysVTEnquireTimingAck", MSG_SysVTEnquireTimingAck_userId},
{"SysVTEnquireTimingUpd", MSG_SysVTEnquireTimingUpd_userId}, {"SysVTEnquireTimingUpd", MSG_SysVTEnquireTimingUpd_userId},
// The last element should be NULL // The last element should be NULL
{ {NULL, 0},
NULL, 0}}; };
// Arena size to decode received message // Arena size to decode received message
const size_t aSize = 32 * 1024; const size_t aSize = 32 * 1024;
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_E(ENB_SS_VTP, "[SS-VTP] Connection failure err=%d\n", ret); LOG_E(ENB_SS_VTP, "[SS-VTP] Connection failure err=%d\n", ret);
...@@ -390,8 +388,7 @@ int ss_eNB_vtp_init(void) ...@@ -390,8 +388,7 @@ int ss_eNB_vtp_init(void)
} }
static void ss_eNB_wait_first_msg(void) static void ss_eNB_wait_first_msg(void)
{ {
const size_t size = 16 * 1024; unsigned char *buffer = (unsigned char *)acpMalloc(16 * 1024);
unsigned char *buffer = (unsigned char *)acpMalloc(size);
assert(buffer); assert(buffer);
while (1) while (1)
{ {
......
...@@ -404,12 +404,12 @@ void *ss_gNB_drb_process_itti_msg(void *notUsed) ...@@ -404,12 +404,12 @@ void *ss_gNB_drb_process_itti_msg(void *notUsed)
void ss_gNB_drb_init(void) void ss_gNB_drb_init(void)
{ {
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS_DRB] Starting System Simulator DRB Thread\n"); LOG_A(GNB_APP, "[SS_DRB] Starting System Simulator DRB Thread\n");
char* host = RC.ss.DrbHost;
const char *hostIp; if (host == NULL) {
hostIp = RC.ss.hostIp; host = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr); }
// Port number // Port number
int port = RC.ss.Drbport; int port = RC.ss.Drbport;
...@@ -424,7 +424,7 @@ void ss_gNB_drb_init(void) ...@@ -424,7 +424,7 @@ void ss_gNB_drb_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(GNB_APP, "[SS_DRB] Connection failure err=%d\n", ret); LOG_A(GNB_APP, "[SS_DRB] Connection failure err=%d\n", ret);
......
...@@ -198,13 +198,8 @@ void ss_nr_port_man_send_data( ...@@ -198,13 +198,8 @@ void ss_nr_port_man_send_data(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ss_gNB_port_man_init(void) void ss_gNB_port_man_init(void)
{ {
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Starting GNB System Simulator Manager\n"); 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 // Port number
int port = RC.ss.SysportNR; int port = RC.ss.SysportNR;
...@@ -219,7 +214,7 @@ void ss_gNB_port_man_init(void) ...@@ -219,7 +214,7 @@ void ss_gNB_port_man_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Connection failure err=%d\n", ret); LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Connection failure err=%d\n", ret);
......
...@@ -385,13 +385,8 @@ ss_gNB_read_from_srb_socket(acpCtx_t ctx) ...@@ -385,13 +385,8 @@ ss_gNB_read_from_srb_socket(acpCtx_t ctx)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ss_gNB_srb_init(void) void ss_gNB_srb_init(void)
{ {
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS_SRB] Starting System Simulator SRB Thread \n"); LOG_A(GNB_APP, "[SS_SRB] Starting System Simulator SRB Thread \n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number // Port number
int port = RC.ss.Srbport; int port = RC.ss.Srbport;
if (RC.ss.mode == SS_SOFTMODEM_SRB) if (RC.ss.mode == SS_SOFTMODEM_SRB)
...@@ -413,7 +408,7 @@ void ss_gNB_srb_init(void) ...@@ -413,7 +408,7 @@ void ss_gNB_srb_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_A(GNB_APP, "[SS_SRB] Connection failure err=%d\n", ret); LOG_A(GNB_APP, "[SS_SRB] Connection failure err=%d\n", ret);
......
...@@ -414,16 +414,10 @@ uint8_t ss_gNB_vtp_process_itti_msg(void) ...@@ -414,16 +414,10 @@ uint8_t ss_gNB_vtp_process_itti_msg(void)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int ss_gNB_vtp_init(void) int ss_gNB_vtp_init(void)
{ {
IpAddress_t ipaddr;
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number // Port number
int port = RC.ss.Vtpport ? RC.ss.Vtpport : 7780; 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); // acpInit(malloc, free, 1000);
const struct acpMsgTable msgTable[] = { const struct acpMsgTable msgTable[] = {
{"SysVTEnquireTimingAck", MSG_SysVTEnquireTimingAck_userId}, {"SysVTEnquireTimingAck", MSG_SysVTEnquireTimingAck_userId},
...@@ -437,7 +431,8 @@ int ss_gNB_vtp_init(void) ...@@ -437,7 +431,8 @@ int ss_gNB_vtp_init(void)
// Start listening server and get ACP context, // Start listening server and get ACP context,
// after the connection is performed, we can use all services // 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) if (ret < 0)
{ {
LOG_E(GNB_APP, "[SS-VTP] Connection failure err=%d\n", ret); LOG_E(GNB_APP, "[SS-VTP] Connection failure err=%d\n", ret);
......
...@@ -67,16 +67,28 @@ typedef struct ss_config_s { ...@@ -67,16 +67,28 @@ typedef struct ss_config_s {
const char* hostIp; const char* hostIp;
/** SYS port number */ /** SYS port number */
int Sysport; int Sysport;
/**< Sys port host (could be unixsocket pipe)*/
const char* SysHost;
/** SRB port number */ /** SRB port number */
int Srbport; int Srbport;
/**< SRB port host (could be unixsocket pipe)*/
const char* SrbHost;
/** VNG port number */ /** VNG port number */
int Vngport; int Vngport;
/**< VNG port host (could be unixsocket pipe)*/
const char* VngHost;
/** VTP port number */ /** VTP port number */
int Vtpport; int Vtpport;
/**< VTP host (could be unixsocket pipe)*/
const char* VtpHost;
/** SYSIND port number */ /** SYSIND port number */
int SysIndport; int SysIndport;
/**< SYS-IND port host (could be unixsocket pipe)*/
const char* SysIndHost;
/** DRB port number */ /** DRB port number */
int Drbport; int Drbport;
/**< DRB port host (could be unixsocket pipe)*/
const char* DrbHost;
/** SYS Port NR number */ /** SYS Port NR number */
int SysportNR; int SysportNR;
uint8_t configured; 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