@@ -63,20 +63,18 @@ void S1apStateManager::init(uint32_t max_ues, uint32_t max_enbs,
6363 is_initialized = true ;
6464}
6565
66- s1ap_state_t * create_s1ap_state (void ) {
67- bstring ht_name ;
66+ S1apState * create_s1ap_state (void ) {
67+ map_uint32_enb_description_t enb_map ;
6868
69- s1ap_state_t * state_cache_p = new s1ap_state_t ();
70- state_cache_p->enbs .map =
71- new google::protobuf::Map<unsigned int , oai::EnbDescription*>();
72- state_cache_p->enbs .set_name (S1AP_ENB_COLL);
73- state_cache_p->enbs .bind_callback (free_enb_description);
69+ S1apState* state_cache_p = new S1apState ();
70+ enb_map.map = state_cache_p->mutable_enbs ();
71+ enb_map.set_name (S1AP_ENB_COLL);
72+ enb_map.bind_callback (free_enb_description);
7473
75- state_cache_p-> mmeid2associd . map =
76- new google::protobuf::Map< uint32_t , uint32_t > ();
77- state_cache_p-> mmeid2associd .set_name (S1AP_MME_ID2ASSOC_ID_COLL);
74+ magma:: proto_map_uint32_uint32_t mmeid2associd;
75+ mmeid2associd. map = state_cache_p-> mutable_mmeid2associd ();
76+ mmeid2associd.set_name (S1AP_MME_ID2ASSOC_ID_COLL);
7877
79- state_cache_p->num_enbs = 0 ;
8078 return state_cache_p;
8179}
8280
@@ -98,21 +96,23 @@ void S1apStateManager::create_state() {
9896 create_s1ap_imsi_map ();
9997}
10098
101- void free_s1ap_state (s1ap_state_t * state_cache_p) {
99+ void free_s1ap_state (S1apState * state_cache_p) {
102100 AssertFatal (state_cache_p,
103- " s1ap_state_t passed to free_s1ap_state must not be null" );
101+ " S1apState passed to free_s1ap_state must not be null" );
104102
105103 int i;
106104 hashtable_rc_t ht_rc;
107105 hashtable_key_array_t * keys;
108106 sctp_assoc_id_t assoc_id;
109107 oai::EnbDescription* enb;
108+ map_uint32_enb_description_t enb_map;
109+ enb_map.map = state_cache_p->mutable_enbs ();
110110
111- if (state_cache_p-> enbs .isEmpty ()) {
111+ if (enb_map .isEmpty ()) {
112112 OAILOG_DEBUG (LOG_S1AP, " No keys in the enb hashtable" );
113113 } else {
114- for (auto itr = state_cache_p-> enbs .map -> begin ();
115- itr != state_cache_p-> enbs . map -> end (); itr ++) {
114+ for (auto itr = enb_map. map -> begin (); itr != enb_map .map . map -> end ();
115+ itr++) {
116116 enb = itr->second ;
117117 if (!enb) {
118118 OAILOG_ERROR (LOG_S1AP, " eNB entry not found in eNB S1AP state" );
@@ -121,10 +121,13 @@ void free_s1ap_state(s1ap_state_t* state_cache_p) {
121121 }
122122 }
123123 }
124- if (state_cache_p-> enbs .destroy_map () != PROTO_MAP_OK) {
124+ if (enb_map .destroy_map () != PROTO_MAP_OK) {
125125 OAILOG_ERROR (LOG_S1AP, " An error occurred while destroying s1 eNB map" );
126126 }
127- if ((state_cache_p->mmeid2associd .destroy_map ()) != magma::PROTO_MAP_OK) {
127+
128+ magma::proto_map_uint32_uint32_t mmeid2associd;
129+ mmeid2associd.map = state_cache_p->mutable_mmeid2associd ();
130+ if ((mmeid2associd.destroy_map ()) != magma::PROTO_MAP_OK) {
128131 OAILOG_ERROR (LOG_S1AP,
129132 " An error occurred while destroying mmeid2associd map" );
130133 }
0 commit comments