Commit 3d1faefa authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'feature-127-protocol-split' of...

Merge branch 'feature-127-protocol-split' of https://gitlab.eurecom.fr/oai/openairinterface5g into feature-127-protocol-split
parents 0b816634 144a0a37
...@@ -103,8 +103,6 @@ typedef struct { ...@@ -103,8 +103,6 @@ typedef struct {
pthread_mutex_t ru_mutex; pthread_mutex_t ru_mutex;
/// condition variable for signaling setup completion of an RU /// condition variable for signaling setup completion of an RU
pthread_cond_t ru_cond; pthread_cond_t ru_cond;
struct cudu_params_s cudu;
} RAN_CONTEXT_t; } RAN_CONTEXT_t;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#ifndef BACKTRACE_H_ #ifndef BACKTRACE_H_
#define BACKTRACE_H_ #define BACKTRACE_H_
void display_backtrace(void); void display_backtrace();
void backtrace_handle_signal(siginfo_t *info); void backtrace_handle_signal(siginfo_t *info);
......
...@@ -39,6 +39,7 @@ MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_r ...@@ -39,6 +39,7 @@ MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_r
/* RRC -> F1AP messages */ /* RRC -> F1AP messages */
MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message ) MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message )
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req )
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_req)
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#ifndef F1AP_MESSAGES_TYPES_H_ #ifndef F1AP_MESSAGES_TYPES_H_
#define F1AP_MESSAGES_TYPES_H_ #define F1AP_MESSAGES_TYPES_H_
#include "rlc.h"
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Defines to access message fields. // Defines to access message fields.
...@@ -33,6 +35,7 @@ ...@@ -33,6 +35,7 @@
#define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message #define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message
#define F1AP_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ul_rrc_message #define F1AP_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ul_rrc_message
#define F1AP_UE_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_req
#define F1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_resp #define F1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_resp
#define F1AP_UE_CONTEXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_resp #define F1AP_UE_CONTEXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_resp
#define F1AP_UE_CONTEXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_fail #define F1AP_UE_CONTEXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_fail
...@@ -249,8 +252,31 @@ typedef struct f1ap_ul_rrc_message_s { ...@@ -249,8 +252,31 @@ typedef struct f1ap_ul_rrc_message_s {
int rrc_container_length; int rrc_container_length;
} f1ap_ul_rrc_message_t; } f1ap_ul_rrc_message_t;
/*typedef struct f1ap_ue_context_setup_req_s { typedef struct f1ap_up_tnl_s {
in_addr_t tl_address; // currently only IPv4 supported
} f1ap_ue_context_setup_req_t;*/ uint32_t gtp_teid;
} f1ap_up_tnl_t;
typedef struct f1ap_drb_to_be_setup_s {
uint8_t drb_id;
f1ap_up_tnl_t up_ul_tnl[2];
uint8_t up_ul_tnl_length;
rlc_mode_t rlc_mode;
} f1ap_drb_to_be_setup_t;
typedef struct f1ap_ue_context_setup_req_s {
uint32_t gNB_CU_ue_id;
uint32_t *gNB_DU_ue_id;
// SpCell Info
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
uint64_t nr_cellid;
uint32_t servCellId;
uint8_t *cu_to_du_rrc_information;
uint8_t cu_to_du_rrc_information_length;
f1ap_drb_to_be_setup_t *drbs_to_be_setup;
uint8_t drbs_to_be_setup_length;
} f1ap_ue_context_setup_req_t;
#endif /* F1AP_MESSAGES_TYPES_H_ */ #endif /* F1AP_MESSAGES_TYPES_H_ */
...@@ -416,132 +416,6 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) { ...@@ -416,132 +416,6 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) {
} }
void RCconfig_cudu() {
int j;
char *transport_type;
char *du_type;
char *balancing;
pthread_t myid = pthread_self();
printf("CONFIG my id is %u\n", myid);
paramdef_t DU_Params[] = DUPARAMS_DESC;
paramdef_t CU_Params[] = CUPARAMS_DESC;
paramlist_def_t DU_ParamList = {CONFIG_STRING_DU_LIST,NULL,0};
paramlist_def_t CU_ParamList = {CONFIG_STRING_CU_LIST,NULL,0};
config_getlist( &DU_ParamList,DU_Params,sizeof(DU_Params)/sizeof(paramdef_t), NULL);
config_getlist( &CU_ParamList,CU_Params,sizeof(CU_Params)/sizeof(paramdef_t), NULL);
paramdef_t CU_Bal[] = CU_BAL_DESC;
paramlist_def_t CU_BalList = {CONFIG_STRING_CU_BALANCING, NULL, 0};
config_get(&CU_Bal, sizeof(CU_Bal)/sizeof(paramdef_t),NULL);
//printf("%s\n", strdup(*(CU_Bal[0].strptr)));
balancing = strdup(*(CU_Bal[0].strptr));
if (strcmp(balancing, "ALL") == 0)
{
RC.cudu.cu_balancing = CU_BALANCING_ALL;
}
else if (strcmp(balancing, "ROUND_ROBIN") == 0)
{
RC.cudu.cu_balancing = CU_BALANCING_ROUND_ROBIN;
}
else
{
RC.cudu.cu_balancing = atoi(balancing) - 1;
}
// DU Parameters
RC.cudu.local_du.du_interface = strdup(*(DU_ParamList.paramarray[0][DU_INTERFACE_F1U].strptr));
RC.cudu.local_du.du_ipv4_address = strdup(*(DU_ParamList.paramarray[0][DU_ADDRESS_F1U].strptr));
RC.cudu.local_du.du_port = *(DU_ParamList.paramarray[0][DU_PORT_F1U].iptr);
transport_type = strdup(*(DU_ParamList.paramarray[0][DU_TYPE_F1U].strptr));
if (strcmp(transport_type, "TCP") == 0)
{
RC.cudu.local_du.tcp = 1;
RC.cudu.local_du.udp = 0;
RC.cudu.local_du.sctp = 0;
}
else if (strcmp(transport_type, "UDP") == 0)
{
RC.cudu.local_du.tcp = 0;
RC.cudu.local_du.udp = 1;
RC.cudu.local_du.sctp = 0;
}
else if (strcmp(transport_type, "SCTP") == 0)
{
RC.cudu.local_du.tcp = 0;
RC.cudu.local_du.udp = 0;
RC.cudu.local_du.sctp = 1;
}
else
{
RC.cudu.local_du.tcp = 1;
RC.cudu.local_du.udp = 0;
RC.cudu.local_du.sctp = 0;
}
//CU Parameters
j = CU_ParamList.numelt;
RC.cudu.serving_dus = j;
for (int k=0; k<j; k++)
{
RC.cudu.cu[k].cu_interface = strdup(*(CU_ParamList.paramarray[k][CU_INTERFACE_F1U].strptr));
RC.cudu.cu[k].cu_ipv4_address = strdup(*(CU_ParamList.paramarray[k][CU_ADDRESS_F1U].strptr));
RC.cudu.cu[k].cu_port = *(CU_ParamList.paramarray[k][CU_PORT_F1U].iptr);
RC.cudu.cu[k].cu_id = k;
du_type = strdup(*(CU_ParamList.paramarray[k][DU_TECH].strptr));
transport_type = strdup(*(CU_ParamList.paramarray[k][CU_TYPE_F1U].strptr));
if (strcmp(transport_type, "TCP") == 0)
{
RC.cudu.cu[k].tcp = 1;
RC.cudu.cu[k].udp = 0;
RC.cudu.cu[k].sctp = 0;
}
else if (strcmp(transport_type, "UDP") == 0)
{
RC.cudu.cu[k].tcp = 0;
RC.cudu.cu[k].udp = 1;
RC.cudu.cu[k].sctp = 0;
}
else if (strcmp(transport_type, "SCTP") == 0)
{
RC.cudu.cu[k].tcp = 0;
RC.cudu.cu[k].udp = 0;
RC.cudu.cu[k].sctp = 1;
}
else
{
RC.cudu.cu[k].tcp = 1;
RC.cudu.cu[k].udp = 0;
RC.cudu.cu[k].sctp = 0;
}
if (strcmp(du_type, "LTE") == 0)
{
RC.cudu.cu[k].du_type = DU_TYPE_LTE;
}
else if (strcmp(du_type, "WiFi") == 0)
{
RC.cudu.cu[k].du_type = DU_TYPE_WIFI;
}
else
{
RC.cudu.cu[k].du_type = DU_TYPE_LTE;
}
}
}
cudu_params_t *get_cudu_config()
{
return &(RC.cudu);
}
int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
int num_enbs = 0; int num_enbs = 0;
...@@ -2828,8 +2702,6 @@ void RCConfig(void) { ...@@ -2828,8 +2702,6 @@ void RCConfig(void) {
char aprefix[MAX_OPTNAME_SIZE*2 + 8]; char aprefix[MAX_OPTNAME_SIZE*2 + 8];
// RCconfig_cudu();
/* get global parameters, defined outside any section in the config file */ /* get global parameters, defined outside any section in the config file */
printf("Getting ENBSParams\n"); printf("Getting ENBSParams\n");
......
...@@ -82,37 +82,16 @@ typedef struct mme_ip_address_s { ...@@ -82,37 +82,16 @@ typedef struct mme_ip_address_s {
typedef struct du_interfaces { typedef struct du_params {
char *du_interface; const char *remote_ipv4_address;
char *du_ipv4_address; const int16_t remote_port;
uint16_t du_port; } du_params_t;
typedef struct cu_params {
unsigned tcp:1; const char *local_interface;
unsigned udp:1; const char *local_ipv4_address;
unsigned sctp:1; const uint16_t local_port;
} cu_params_t;
}du_interfaces_t;
typedef struct cu_interfaces {
char *cu_interface;
char *cu_ipv4_address;
uint16_t cu_port;
uint8_t du_type;
uint8_t cu_id;
unsigned tcp:1;
unsigned udp:1;
unsigned sctp:1;
}cu_interfaces_t;
typedef struct cudu_params_s {
du_interfaces_t local_du;
cu_interfaces_t cu[MAX_DU];
uint8_t serving_dus;
uint8_t cu_balancing;
}cudu_params_t;
typedef struct ru_config_s { typedef struct ru_config_s {
// indicates if local or remote rf is used (1 == LOCAL) // indicates if local or remote rf is used (1 == LOCAL)
...@@ -145,11 +124,7 @@ void ru_config_display(void); ...@@ -145,11 +124,7 @@ void ru_config_display(void);
int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc); int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc);
int RCconfig_S1(MessageDef *msg_p, uint32_t i); int RCconfig_S1(MessageDef *msg_p, uint32_t i);
int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i);
int RCconfig_CU_F1(uint32_t i);
void RCconfig_cudu(void);
cudu_params_t *get_cudu_config(void);
void read_config_and_init(void); void read_config_and_init(void);
int RCconfig_X2(MessageDef *msg_p, uint32_t i); int RCconfig_X2(MessageDef *msg_p, uint32_t i);
......
...@@ -633,12 +633,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ ...@@ -633,12 +633,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_
F1AP_CP_TransportLayerAddress_t transportLayerAddress; F1AP_CP_TransportLayerAddress_t transportLayerAddress;
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
// TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress; gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
...@@ -680,12 +680,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ ...@@ -680,12 +680,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_
F1AP_CP_TransportLayerAddress_t transportLayerAddress; F1AP_CP_TransportLayerAddress_t transportLayerAddress;
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
// TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
...@@ -722,12 +722,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ ...@@ -722,12 +722,12 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_
F1AP_CP_TransportLayerAddress_t transportLayerAddress; F1AP_CP_TransportLayerAddress_t transportLayerAddress;
memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address;
TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address);
// memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t));
// transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port;
// transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t));
// TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address);
gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress;
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
/* /*
* UE Context Setup * UE Context Setup
*/ */
int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance); int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req);
int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
......
...@@ -41,8 +41,91 @@ extern f1ap_setup_req_t *f1ap_du_data; ...@@ -41,8 +41,91 @@ extern f1ap_setup_req_t *f1ap_du_data;
int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
F1AP_F1AP_PDU_t *pdu) { F1AP_F1AP_PDU_t *pdu)
AssertFatal(1==0,"Not implemented yet\n"); {
MessageDef *msg_p; // message to RRC
F1AP_UEContextSetupRequest_t *container;
F1AP_UEContextSetupRequestIEs_t *ie;
int i;
DevAssert(pdu);
msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ);
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req;
f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p);
container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, false);
if (ie) {
f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t));
if (f1ap_ue_context_setup_req->gNB_DU_ue_id)
*f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
} else {
f1ap_ue_context_setup_req->gNB_DU_ue_id = NULL;
}
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_SpCell_ID, true);
PLMNID_TO_MCC_MNC(&ie->value.choice.NRCGI.pLMN_Identity,
f1ap_ue_context_setup_req->mcc,
f1ap_ue_context_setup_req->mnc,
f1ap_ue_context_setup_req->mnc_digit_length);
BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid);
/* TODO: decode candidate SpCell */
/* TODO: decode CUtoDURRCInformation */
/* TODO: Candidate_SpCell_List */
/* TODO: SCell_ToBeSetup_List */
/* TODO: SRBs_ToBeSetup_List */
/* Decode DRBs_ToBeSetup_List */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true);
f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count;
f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length,
sizeof(f1ap_drb_to_be_setup_t));
AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup,
"could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n");
for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) {
f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i];
F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p;
drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item;
drb_p->drb_id = drbs_tobesetup_item_p->dRBID;
/* TODO in the following, assume only one UP UL TNL is present.
* this matches/assumes OAI CU implementation, can be up to 2! */
drb_p->up_ul_tnl_length = 1;
AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0,
"no UL UP TNL Information in DRBs to be Setup list\n");
F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0];
F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel;
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address);
OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid);
switch (drbs_tobesetup_item_p->rLCMode) {
case F1AP_RLCMode_rlc_am:
drb_p->rlc_mode = RLC_MODE_AM;
break;
default:
drb_p->rlc_mode = RLC_MODE_TM;
break;
}
}
AssertFatal(0, "check configuration, send to appropriate handler\n");
return 0;
} }
//void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { //void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) {
...@@ -153,7 +236,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { ...@@ -153,7 +236,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
// *transportLayerAddress.buf = 123; // *transportLayerAddress.buf = 123;
// dLUPTNLInformation_ToBeSetup_Item.dL_GTP_Tunnel_EndPoint.transportLayerAddress = transportLayerAddress; // dLUPTNLInformation_ToBeSetup_Item.dL_GTP_Tunnel_EndPoint.transportLayerAddress = transportLayerAddress;
TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress);
OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204",
strlen("1204")); strlen("1204"));
...@@ -441,7 +524,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { ...@@ -441,7 +524,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) {
dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel;
F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t));
TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress);
OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204",
strlen("1204")); strlen("1204"));
...@@ -495,7 +578,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { ...@@ -495,7 +578,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) {
dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel;
F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t));
TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress);
OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204",
strlen("1204")); strlen("1204"));
......
...@@ -375,50 +375,23 @@ boolean_t pdcp_data_req( ...@@ -375,50 +375,23 @@ boolean_t pdcp_data_req(
LOG_F(PDCP,"\n"); LOG_F(PDCP,"\n");
#ifndef UETARGET #ifndef UETARGET
static cudu_params_t *cudu = NULL;
if (ctxt_pP->enb_flag == 1)
{
if (cudu == NULL)
{
cudu = get_cudu_config();
}
static int agent_started = 1;
if (agent_started == 1)
{
for (int k =0; k<cudu->serving_dus; k++)
{
proto_agent_start(0, cudu->cu[k].cu_id, cudu->cu[k].du_type, cudu);
}
agent_started = 0;
}
}
if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1))
{ {
if (cudu->cu_balancing == CU_BALANCING_ALL)
{ {
for (int j =0; j<cudu->serving_dus; j++) LOG_E(PDCP, "proto_agent_send_rlc_data_req()\n");
{ {
proto_agent_send_rlc_data_req(0,cudu->cu[j].du_type, ctxt_pP, srb_flagP, MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); //proto_agent_send_rlc_data_req(0,cudu->cu[j].du_type, ctxt_pP, srb_flagP,
} //MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p }
//rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,sourceL2Id //,sourceL2Id
,destinationL2Id //,destinationL2Id
#endif #endif
); //);
} }
else if (cudu->cu_balancing == CU_BALANCING_ROUND_ROBIN)
{
int selected_du = select_du(cudu->serving_dus);
proto_agent_send_rlc_data_req(cudu->cu[selected_du].cu_id,cudu->cu[selected_du].du_type,ctxt_pP, srb_flagP, MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
}
else
{
int index = cudu->cu_balancing;
proto_agent_send_rlc_data_req(cudu->cu[index].cu_id,cudu->cu[index].du_type,ctxt_pP, srb_flagP, MBMS_FLAG_NO,rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
}
free_mem_block(pdcp_pdu_p, __FUNCTION__); free_mem_block(pdcp_pdu_p, __FUNCTION__);
rlc_status = ack_result; rlc_status = ack_result;
......
This diff is collapsed.
...@@ -45,24 +45,17 @@ void * proto_server_init(void *args); ...@@ -45,24 +45,17 @@ void * proto_server_init(void *args);
void * proto_server_receive(void *args); void * proto_server_receive(void *args);
void * proto_client_receive(void *args); void * proto_client_receive(void *args);
int proto_agent_start(uint8_t enb_id, mod_id_t mod_id, uint8_t type_id, cudu_params_t *cudu); int proto_agent_start(mod_id_t mod_id, const du_params_t *du);
int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu); int proto_server_start(mod_id_t mod_id, const cu_params_t* cu);
int proto_agent_stop(mod_id_t mod_id); int proto_agent_stop(mod_id_t mod_id);
void *proto_agent_task(void *args); void *proto_agent_task(void *args);
uint8_t select_du(uint8_t max_dus); void proto_agent_send_rlc_data_req( const protocol_ctxt_t* const ctxt_pP,
typedef struct const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
{ const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP,
mod_id_t mod_id; sdu_size_t sdu_sizeP, mem_block_t *sdu_pP);
uint8_t type_id;
}proto_recv_t;
void proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id,
const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP,
confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP);
void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
......
...@@ -34,61 +34,35 @@ ...@@ -34,61 +34,35 @@
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
uint16_t proto_udp = 0; proto_agent_async_channel_t *
uint16_t proto_tcp = 0; proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t port)
uint16_t proto_sctp = 0; {
LOG_E(PROTO_AGENT, "does not bind to specific address at the moment, ignoring %s\n", ip);
proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) {
proto_agent_async_channel_t *channel; proto_agent_async_channel_t *channel;
channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); channel = malloc(sizeof(proto_agent_channel_t));
channel->port = dst_port;
channel->peer_addr = NULL;
if (channel == NULL) if (channel == NULL)
goto error; goto error;
channel->port = port;
channel->peer_addr = NULL;
channel->enb_id = mod_id; channel->enb_id = mod_id;
/*Create a socket*/ channel->link = new_link_udp_server(port);
if (strcmp(type, "TCP") == 0)
{
proto_tcp = 1;
printf("PROTO_AGENT: sTARTING TCP SERVER\n");
channel->link = new_link_server(dst_port);
channel->type = 0;
}
else if (strcmp(type, "UDP") == 0)
{
proto_udp = 1;
//channel->link = new_udp_link_server(dst_port);
channel->link = new_link_udp_server(dst_port);
channel->type = 1;
channel->peer_addr = peer_addr;
}
else if (strcmp(type, "SCTP") == 0)
{
proto_sctp = 1;
//channel->link = new_sctp_link_server(dst_port);
channel->link = new_link_sctp_server(dst_port);
channel->type = 2;
}
if (channel->link == NULL) goto error; if (channel->link == NULL) goto error;
/*
* create a message queue
*/
channel->send_queue = new_message_queue(); channel->send_queue = new_message_queue();
if (channel->send_queue == NULL) goto error; if (channel->send_queue == NULL) goto error;
channel->receive_queue = new_message_queue(); channel->receive_queue = new_message_queue();
if (channel->receive_queue == NULL) goto error; if (channel->receive_queue == NULL) goto error;
/* channel->manager = create_link_manager(channel->send_queue,
* create a link manager channel->receive_queue,
*/ channel->link,
channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port); CHANNEL_UDP,
channel->peer_addr,
channel->port);
if (channel->manager == NULL) goto error; if (channel->manager == NULL) goto error;
return channel; return channel;
...@@ -99,55 +73,34 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, c ...@@ -99,55 +73,34 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, c
} }
proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) { proto_agent_async_channel_t *
proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port)
{
proto_agent_async_channel_t *channel; proto_agent_async_channel_t *channel;
channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t)); channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t));
channel->port = dst_port;
channel->peer_addr = NULL;
if (channel == NULL) if (channel == NULL)
goto error; goto error;
channel->port = dst_port;
channel->peer_addr = dst_ip;
channel->enb_id = mod_id; channel->enb_id = mod_id;
/*Create a socket*/ channel->link = new_link_udp_client(channel->peer_addr, channel->port);
if (strcmp(type, "TCP") == 0)
{
proto_tcp = 1;
channel->link = new_link_client(dst_ip, dst_port);
channel->type = 0;
}
else if (strcmp(type, "UDP") == 0)
{
proto_udp = 1;
channel->link = new_link_udp_client(dst_ip, dst_port);
channel->type = 1;
channel->peer_addr = peer_addr;
}
else if (strcmp(type, "SCTP") == 0)
{
proto_sctp = 1;
channel->link = new_link_sctp_client(dst_ip, dst_port);;
channel->type = 2;
}
if (channel->link == NULL) goto error; if (channel->link == NULL) goto error;
/*
* create a message queue
*/
channel->send_queue = new_message_queue(); channel->send_queue = new_message_queue();
if (channel->send_queue == NULL) goto error; if (channel->send_queue == NULL) goto error;
channel->receive_queue = new_message_queue(); channel->receive_queue = new_message_queue();
if (channel->receive_queue == NULL) goto error; if (channel->receive_queue == NULL) goto error;
/* channel->manager = create_link_manager(channel->send_queue,
* create a link manager channel->receive_queue,
*/ channel->link,
channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port); CHANNEL_UDP,
channel->peer_addr,
channel->port);
if (channel->manager == NULL) goto error; if (channel->manager == NULL) goto error;
return channel; return channel;
...@@ -157,28 +110,20 @@ proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, ch ...@@ -157,28 +110,20 @@ proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, ch
return NULL; return NULL;
} }
int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info)
{
proto_agent_async_channel_t *channel = channel_info; proto_agent_async_channel_t *channel = channel_info;
return message_put(channel->send_queue, data, size, priority); return message_put(channel->send_queue, data, size, priority);
} }
int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info)
proto_agent_async_channel_t *channel; {
channel = (proto_agent_async_channel_t *)channel_info; proto_agent_async_channel_t *channel = channel_info;
return message_get(channel->receive_queue, data, size, priority);
if (channel == NULL)
return 0;
else if (channel->type < 0)
return 0;
else if (channel->receive_queue == NULL)
return 0;
else
return message_get(channel->receive_queue, data, size, priority);
} }
void proto_agent_async_release(proto_agent_channel_t *channel) { void proto_agent_async_release(proto_agent_channel_t *channel)
{
proto_agent_async_channel_t *channel_info; proto_agent_async_channel_t *channel_info;
channel_info = (proto_agent_async_channel_t *) channel->channel_info; channel_info = (proto_agent_async_channel_t *) channel->channel_info;
......
...@@ -39,10 +39,9 @@ ...@@ -39,10 +39,9 @@
#include "proto_agent_net_comm.h" #include "proto_agent_net_comm.h"
typedef struct { typedef struct proto_agent_async_channel_s {
mod_id_t enb_id; mod_id_t enb_id;
uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP const char *peer_addr;
char *peer_addr;
int port; int port;
socket_link_t *link; socket_link_t *link;
message_queue_t *send_queue; message_queue_t *send_queue;
...@@ -50,8 +49,8 @@ typedef struct { ...@@ -50,8 +49,8 @@ typedef struct {
link_manager_t *manager; link_manager_t *manager;
} proto_agent_async_channel_t; } proto_agent_async_channel_t;
proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr); proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port);
proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr); proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t _port);
int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info); int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info);
......
...@@ -45,11 +45,6 @@ ...@@ -45,11 +45,6 @@
#include "RRC/LTE/rrc_extern.h" #include "RRC/LTE/rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "rrc_eNB_UE_context.h" #include "rrc_eNB_UE_context.h"
//#include "LAYER2/PDCP_v10.1.0/pdcp_primitives.h"
void * enb[NUM_MAX_ENB];
void * enb_ue[NUM_MAX_ENB];
void * enb_rrc[NUM_MAX_ENB];
/* /*
* message primitives * message primitives
......
...@@ -98,9 +98,9 @@ typedef enum { ...@@ -98,9 +98,9 @@ typedef enum {
typedef uint8_t xid_t; typedef uint8_t xid_t;
typedef uint8_t mod_id_t; // module or enb id typedef uint8_t mod_id_t; // module or enb id
typedef uint8_t lcid_t; typedef uint8_t lcid_t;
typedef int32_t err_code_t; typedef int32_t err_code_t;
#define CHANNEL_UDP 1
typedef struct { typedef struct {
/* general info */ /* general info */
...@@ -113,12 +113,16 @@ typedef struct { ...@@ -113,12 +113,16 @@ typedef struct {
uint32_t rx_msg[NUM_MAX_ENB]; uint32_t rx_msg[NUM_MAX_ENB];
uint32_t tx_msg[NUM_MAX_ENB]; uint32_t tx_msg[NUM_MAX_ENB];
}proto_agent_info_t; } proto_agent_info_t;
typedef struct { /* forward declaration */
mod_id_t enb_id; struct proto_agent_channel_s;
typedef struct proto_agent_instance_s {
mod_id_t mod_id;
proto_agent_info_t agent_info; proto_agent_info_t agent_info;
struct proto_agent_channel_s *channel;
}proto_agent_instance_t; pthread_t recv_thread;
} proto_agent_instance_t;
#endif #endif
...@@ -41,16 +41,18 @@ ...@@ -41,16 +41,18 @@
#include "tree.h" #include "tree.h"
#define ENB_AGENT_MAX 9 #define ENB_AGENT_MAX 9
/* forward declaration */
struct proto_agent_async_channel_s;
/*Channel related information used for Tx/Rx of protocol messages*/ /*Channel related information used for Tx/Rx of protocol messages*/
typedef struct proto_agent_channel_s { typedef struct proto_agent_channel_s {
RB_ENTRY(proto_agent_channel_s) entry; RB_ENTRY(proto_agent_channel_s) entry;
int channel_id; int channel_id;
void *channel_info; struct proto_agent_async_channel_s *channel_info;
uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP /*Callbacks for channel message Tx and Rx*/
/*Callbacks for channel message Tx and Rx*/ int (*msg_send)(void *data, int size, int priority, void *channel_info);
int (*msg_send)(void *data, int size, int priority, void *channel_info); int (*msg_recv)(void **data, int *size, int *priority, void *channel_info);
int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); void (*release)(struct proto_agent_channel_s *channel);
void (*release)(struct proto_agent_channel_s *channel);
} proto_agent_channel_t; } proto_agent_channel_t;
typedef struct proto_agent_channel_instance_s{ typedef struct proto_agent_channel_instance_s{
......
...@@ -63,17 +63,18 @@ async_server_thread_init (void) ...@@ -63,17 +63,18 @@ async_server_thread_init (void)
//create log_list //create log_list
//log_list_init(&log_list); //log_list_init(&log_list);
AssertFatal(0, "this should not be reached!\n");
async_server_shutdown = 0; async_server_shutdown = 0;
if ((pthread_mutex_init (&async_server_lock, NULL) != 0) if ((pthread_mutex_init (&async_server_lock, NULL) != 0)
|| (pthread_cond_init (&async_server_notify, NULL) != 0)) { || (pthread_cond_init (&async_server_notify, NULL) != 0)) {
return; return;
} }
if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL) //if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL)
!= 0) { // != 0) {
async_server_thread_finalize(); // async_server_thread_finalize();
return; // return;
} //}
} }
......
...@@ -97,7 +97,7 @@ link_manager_t *create_link_manager( ...@@ -97,7 +97,7 @@ link_manager_t *create_link_manager(
message_queue_t *receive_queue, message_queue_t *receive_queue,
socket_link_t *link, socket_link_t *link,
uint16_t type, uint16_t type,
char *peer_addr, const char *peer_addr,
int port ) int port )
{ {
link_manager_t *ret = NULL; link_manager_t *ret = NULL;
......
...@@ -58,7 +58,7 @@ link_manager_t *create_link_manager( ...@@ -58,7 +58,7 @@ link_manager_t *create_link_manager(
message_queue_t *receive_queue, message_queue_t *receive_queue,
socket_link_t *link, socket_link_t *link,
uint16_t type, uint16_t type,
char *peer_addr, const char *peer_addr,
int port); int port);
void destroy_link_manager(link_manager_t *); void destroy_link_manager(link_manager_t *);
......
...@@ -115,7 +115,7 @@ error: ...@@ -115,7 +115,7 @@ error:
return NULL; return NULL;
} }
socket_link_t *new_link_client(char *server, int port) socket_link_t *new_link_client(const char *server, int port)
{ {
socket_link_t *ret = NULL; socket_link_t *ret = NULL;
struct sockaddr_in addr; struct sockaddr_in addr;
...@@ -208,7 +208,7 @@ error: ...@@ -208,7 +208,7 @@ error:
} }
socket_link_t *new_link_udp_client(char *server, int port){ socket_link_t *new_link_udp_client(const char *server, int port){
socket_link_t *ret = NULL; socket_link_t *ret = NULL;
ret = calloc(1, sizeof(socket_link_t)); ret = calloc(1, sizeof(socket_link_t));
...@@ -307,7 +307,7 @@ error: ...@@ -307,7 +307,7 @@ error:
return NULL; return NULL;
} }
socket_link_t *new_link_sctp_client(char *server, int port) socket_link_t *new_link_sctp_client(const char *server, int port)
{ {
socket_link_t *ret = NULL; socket_link_t *ret = NULL;
......
...@@ -47,11 +47,11 @@ typedef struct { ...@@ -47,11 +47,11 @@ typedef struct {
} socket_link_t; } socket_link_t;
socket_link_t *new_link_server(int port); socket_link_t *new_link_server(int port);
socket_link_t *new_link_client(char *server, int port); socket_link_t *new_link_client(const char *server, int port);
socket_link_t *new_link_udp_server(int port); socket_link_t *new_link_udp_server(int port);
socket_link_t *new_link_udp_client(char *server, int port); socket_link_t *new_link_udp_client(const char *server, int port);
socket_link_t *new_link_sctp_server(int port); socket_link_t *new_link_sctp_server(int port);
socket_link_t *new_link_sctp_client(char *server, int port); socket_link_t *new_link_sctp_client(const char *server, int port);
int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port); int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port);
int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type, char *peer_addr, int port); int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type, char *peer_addr, int port);
int close_link(socket_link_t *link); int close_link(socket_link_t *link);
......
...@@ -196,6 +196,17 @@ do { \ ...@@ -196,6 +196,17 @@ do { \
(oCTETsTRING)->size = 3; \ (oCTETsTRING)->size = 3; \
} while(0) } while(0)
#define PLMNID_TO_MCC_MNC(oCTETsTRING, mCC, mNC, mNCdIGITlENGTH) \
do { \
mCC = ((oCTETsTRING)->buf[0] & 0x0F) * 100 + \
((oCTETsTRING)->buf[0] >> 4 & 0x0F) * 10 + \
((oCTETsTRING)->buf[1] & 0x0F); \
mNCdIGITlENGTH = ((oCTETsTRING)->buf[1] >> 4 & 0x0F) == 0xF ? 2 : 3; \
mNC = (mNCdIGITlENGTH == 2 ? 0 : ((oCTETsTRING)->buf[1] >> 4 & 0x0F) * 100) + \
((oCTETsTRING)->buf[2] & 0x0F) * 10 + \
((oCTETsTRING)->buf[2] >> 4 & 0x0F); \
} while (0)
#define MCC_MNC_TO_TBCD(mCC, mNC, mNCdIGITlENGTH, tBCDsTRING) \ #define MCC_MNC_TO_TBCD(mCC, mNC, mNCdIGITlENGTH, tBCDsTRING) \
do { \ do { \
char _buf[3]; \ char _buf[3]; \
...@@ -260,7 +271,7 @@ do { \ ...@@ -260,7 +271,7 @@ do { \
/* TS 38.473 v15.2.1 section 9.3.1.32: /* TS 38.473 v15.2.1 section 9.3.1.32:
* C RNTI * C RNTI is BIT_STRING(16)
*/ */
#define C_RNTI_TO_BIT_STRING(mACRO, bITsTRING) \ #define C_RNTI_TO_BIT_STRING(mACRO, bITsTRING) \
do { \ do { \
...@@ -272,21 +283,31 @@ do { \ ...@@ -272,21 +283,31 @@ do { \
} while(0) } while(0)
/* TS 38.473 v15.1.1 section 9.3.2.1: /* TS 38.473 v15.1.1 section 9.3.2.3:
* TRANSPORT LAYER ADDRESS * TRANSPORT LAYER ADDRESS for IPv4 is 32bit (TS 38.414)
*/ */
#define TRANSPORT_LAYER_ADDRESS_TO_BIT_STRING(mACRO, bITsTRING) \ #define TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(mACRO, bITsTRING) \
do { \ do { \
(bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \ (bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = (mACRO) >> 28; \ (bITsTRING)->buf[0] = (mACRO) >> 24 & 0xFF; \
(bITsTRING)->buf[1] = (mACRO) >> 20; \ (bITsTRING)->buf[1] = (mACRO) >> 16 & 0xFF; \
(bITsTRING)->buf[2] = (mACRO) >> 12; \ (bITsTRING)->buf[2] = (mACRO) >> 8 & 0xFF; \
(bITsTRING)->buf[3] = (mACRO) >> 4; \ (bITsTRING)->buf[3] = (mACRO) >> 4 & 0xFF; \
(bITsTRING)->buf[4] = ((mACRO) & 0x0f) << 4; \ (bITsTRING)->size = 4; \
(bITsTRING)->size = 5; \ (bITsTRING)->bits_unused = 0; \
(bITsTRING)->bits_unused = 4; \
} while(0) } while(0)
#define BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(bITsTRING, mACRO) \
do { \
DevCheck((bITsTRING)->size == 4, (bITsTRING)->size, 4, 0); \
DevCheck((bITsTRING)->bits_unused == 0, (bITsTRING)->bits_unused, 0, 0); \
mACRO = ((bITsTRING)->buf[0] << 24) + \
((bITsTRING)->buf[1] << 16) + \
((bITsTRING)->buf[2] << 8) + \
((bITsTRING)->buf[3]); \
} while (0)
/* TS 38.473 v15.1.1 section 9.3.1.12: /* TS 38.473 v15.1.1 section 9.3.1.12:
* NR CELL ID * NR CELL ID
*/ */
......
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