Trying to read a single packet inside oai ue
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include <pthread.h>
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
static char nfapi_str_mode[6][24] = {"MONOLITHIC","PNF","VNF","UE_STUB_PNF","UE_STUB_OFFNET","<UNKNOWN NFAPI MODE>"};
|
||||
static char nfapi_str_mode[6][24] = {"MONOLITHIC","PNF","VNF","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF","<UNKNOWN NFAPI MODE>"};
|
||||
|
||||
typedef struct {
|
||||
nfapi_mode_t nfapi_mode;
|
||||
|
||||
@@ -70,8 +70,8 @@ typedef enum {
|
||||
NFAPI_MODE_VNF,
|
||||
NFAPI_UE_STUB_PNF,
|
||||
NFAPI_UE_STUB_OFFNET,
|
||||
NFAPI_MODE_UNKNOWN,
|
||||
NFAPI_MODE_STANDALONE_PNF
|
||||
NFAPI_MODE_STANDALONE_PNF,
|
||||
NFAPI_MODE_UNKNOWN
|
||||
} nfapi_mode_t;
|
||||
|
||||
char *nfapi_get_strmode(void);
|
||||
|
||||
@@ -882,7 +882,7 @@ void hi_dci0_req_UE_MAC(int sfn,
|
||||
|
||||
// The following set of memcpy functions should be getting called as callback
|
||||
// functions from pnf_p7_subframe_ind.
|
||||
int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
|
||||
int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
|
||||
nfapi_pnf_p7_config_t *pnf_p7,
|
||||
nfapi_dl_config_request_t *req) {
|
||||
dl_config_req = (nfapi_dl_config_request_t *)malloc(sizeof(nfapi_dl_config_request_t));
|
||||
@@ -959,8 +959,8 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
|
||||
nfapi_pnf_p7_config_t* pnf_p7,
|
||||
int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
|
||||
nfapi_pnf_p7_config_t* pnf_p7,
|
||||
nfapi_hi_dci0_request_t* req) {
|
||||
hi_dci0_req = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t));
|
||||
//if(req!=0){
|
||||
@@ -1044,9 +1044,32 @@ void UE_config_stub_pnf(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void UE_init_socket(void) {
|
||||
int ue_init_standalone_socket(const char *addr, int port)
|
||||
{
|
||||
|
||||
// scpt socket creation and memcpy function calls here
|
||||
struct sockaddr_in server_address;
|
||||
int addr_len = sizeof(server_address);
|
||||
memset(&server_address, 0, addr_len);
|
||||
server_address.sin_family = AF_INET;
|
||||
server_address.sin_port = htons(port);
|
||||
|
||||
int sd = socket(address.sin_family, SOCK_STREAM, IPPROTO_SCTP);
|
||||
if (sd < 0) {
|
||||
LOG_E(MAC, "Socket creation error standalone PNF");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0) {
|
||||
LOG_E(MAC, "Invalid standalone PNF Address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (connect(socket, (struct sockaddr *)&server_address, addr_len) < 0) {
|
||||
LOG_E(MAC, "Connection to standalone PNF failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sd;
|
||||
}
|
||||
|
||||
/* Dummy functions*/
|
||||
|
||||
@@ -131,6 +131,9 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfa
|
||||
|
||||
void UE_config_stub_pnf(void);
|
||||
|
||||
// This function is used to open an SCTP socket with a standalone PNF module
|
||||
int ue_init_standalone_socket(const char *addr, int port);
|
||||
|
||||
|
||||
|
||||
#endif /* PHY_STUB_UE_H_ */
|
||||
|
||||
@@ -631,7 +631,7 @@ int main( int argc, char **argv ) {
|
||||
|
||||
NB_INST=1;
|
||||
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) { // || NFAPI_MODE_STANDALONE_PNF
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE_STANDALONE_PNF) { // || NFAPI_MODE_STANDALONE_PNF
|
||||
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE **)*NB_UE_INST);
|
||||
|
||||
for (int i=0; i<NB_UE_INST; i++) {
|
||||
@@ -704,11 +704,31 @@ int main( int argc, char **argv ) {
|
||||
exit(-1); // need a softer mode
|
||||
}
|
||||
|
||||
nfapi_setmode(NFAPI_MODE_STANDALONE_PNF); // make sure to hammer out this nfapi mode crap
|
||||
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) { // UE-STUB-PNF
|
||||
UE_config_stub_pnf();
|
||||
}
|
||||
|
||||
// add socket here and call corresponding memcpys - Andrew
|
||||
// hard-coding address and port for now fix later
|
||||
int sd = -1;
|
||||
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
|
||||
const char *standalone_addr = "127.0.0.1";
|
||||
int standalone_port = 3289;
|
||||
char buffy[1024];
|
||||
|
||||
sd = ue_init_standalone_socket(standalone_addr, standalone_port);
|
||||
ssize_t len = read(sd, buffy, sizeof(buffy));
|
||||
if (len == -1) {
|
||||
printf("reading from standalone pnf sctp socket failed \n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
nfapi_p7_message_header_t header_t;
|
||||
if (nfapi_p7_message_header_unpack((void *)buffy, len, &header_t, sizeof(header_t), NULL) != 0) {
|
||||
printf("unpacking p7 message failed from standalone pnf\n");
|
||||
printf("Bruins header_t.message_id: %u", header_t.message_id);
|
||||
}
|
||||
}
|
||||
|
||||
printf("ITTI tasks created\n");
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
@@ -723,13 +743,7 @@ int main( int argc, char **argv ) {
|
||||
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
|
||||
} else if (NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
|
||||
// init thread and open socket
|
||||
|
||||
/*
|
||||
need to do this in thread
|
||||
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
|
||||
0,// cba_group_active
|
||||
0); // HO flag
|
||||
*/
|
||||
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user