Commit 4753f92b authored by laurent's avatar laurent

remove more files, add a LOG_E() for UE not developped use case

parent 80ac9ece
#ifndef _TIME_UTILS_H_
#define _TIME_UTILS_H_
#include <time.h>
#include <stdint.h>
static inline int64_t clock_difftime_ns(struct timespec start, struct timespec end)
{
struct timespec temp;
int64_t temp_ns;
if ((end.tv_nsec-start.tv_nsec)<0) {
temp.tv_sec = end.tv_sec-start.tv_sec-1;
temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
} else {
temp.tv_sec = end.tv_sec-start.tv_sec;
temp.tv_nsec = end.tv_nsec-start.tv_nsec;
}
temp_ns = (int64_t)(temp.tv_sec) * (int64_t)1000000000 + (temp.tv_nsec);
return temp_ns;
}
#endif /* _TIME_UTILS_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
unsigned char scrambling_sequence[1024] = {
208,
127,
52,
95,
204,
135,
48,
31,
248,
32,
208,
135,
192,
232,
63,
175,
4,
212,
119,
24,
169,
162,
101,
144,
75,
109,
75,
29,
91,
191,
165,
246,
177,
71,
16,
92,
68,
80,
132,
4,
248,
251,
32,
65,
125,
56,
94,
86,
152,
11,
201,
134,
39,
250,
19,
162,
25,
190,
62,
3,
190,
18,
188,
215,
97,
239,
72,
11,
0,
26,
57,
211,
146,
37,
205,
121,
204,
83,
13,
206,
53,
27,
214,
32,
54,
214,
82,
125,
226,
108,
169,
102,
247,
255,
32,
171,
201,
112,
20,
253,
65,
192,
38,
78,
114,
40,
95,
32,
70,
194,
242,
153,
207,
63,
61,
117,
122,
32,
73,
60,
160,
140,
99,
235,
118,
176,
75,
102,
254,
5,
67,
194,
122,
62,
226,
56,
69,
123,
213,
179,
119,
221,
23,
63,
26,
160,
233,
166,
179,
243,
169,
190,
183,
146,
169,
185,
216,
214,
158,
86,
139,
214,
143,
181,
0,
9,
147,
254,
105,
138,
213,
118,
14,
74,
153,
110,
41,
47,
172,
91,
216,
117,
156,
62,
56,
75,
113,
6,
123,
178,
118,
97,
82,
75,
96,
21,
148,
170,
120,
227,
0,
245,
25,
147,
243,
185,
203,
135,
48,
104,
89,
38,
71,
30,
74,
219,
130,
107,
75,
244,
138,
8,
8,
248,
175,
65,
234,
35,
125,
138,
0,
95,
23,
171,
177,
166,
196,
173,
235,
244,
124,
20,
22,
78,
32,
207,
173,
103,
232,
84,
18,
227,
246,
127,
136,
28,
188,
39,
132,
79,
14,
62,
80,
248,
171,
21,
160,
188,
110,
125,
55,
198,
139,
185,
28,
127,
239,
246,
223,
47,
55,
63,
63,
129,
253,
175,
122,
182,
139,
52,
163,
164,
177,
6,
187,
220,
159,
76,
36,
164,
108,
218,
189,
250,
148,
201,
45,
207,
174,
81,
195,
108,
96,
203,
132,
210,
34,
142,
247,
238,
139,
84,
84,
194,
168,
46,
9,
238,
29,
135,
115,
95,
12,
218,
18,
134,
110,
83,
110,
44,
80,
80,
216,
126,
160,
65,
142,
142,
209,
69,
234,
200,
184,
171,
248,
185,
148,
203,
90,
143,
231,
29,
47,
214,
151,
154,
137,
152,
228,
192,
182,
108,
200,
226,
204,
82,
170,
110,
197,
143,
169,
230,
75,
204,
177,
222,
142,
1,
104,
130,
224,
201,
29,
223,
246,
132,
173,
42,
33,
165,
147,
208,
124,
208,
198,
51,
78,
76,
216,
164,
250,
186,
214,
57,
52,
52,
199,
37,
3,
242,
120,
179,
26,
233,
51,
42,
11,
108,
26,
41,
192,
41,
221,
71,
16,
67,
131,
90,
226,
181,
0,
244,
183,
31,
78,
241,
221,
173,
248,
146,
23,
244,
102,
194,
201,
16,
25,
155,
110,
146,
54,
246,
40,
5,
78,
94,
47,
135,
60,
103,
29,
175,
142,
9,
213,
70,
159,
168,
176,
217,
91,
13,
1,
254,
104,
135,
20,
135,
147,
23,
141,
8,
115,
180,
201,
50,
246,
4,
12,
72,
59,
166,
22,
61,
77,
140,
183,
150,
255,
55,
31,
71,
215,
83,
75,
169,
137,
104,
237,
88,
118,
146,
247,
95,
182,
241,
29,
98,
243,
152,
52,
230,
114,
27,
247,
116,
78,
152,
202,
96,
15,
112,
196,
245,
148,
9,
228,
111,
131,
179,
198,
243,
35,
140,
234,
248,
8,
197,
218,
35,
246,
172,
207,
93,
62,
157,
196,
149,
199,
136,
30,
70,
13,
116,
63,
171,
207,
254,
51,
18,
126,
246,
195,
218,
222,
204,
105,
132,
150,
123,
136,
24,
23,
143,
162,
175,
185,
148,
104,
135,
118,
44,
126,
59,
67,
114,
157,
194,
201,
231,
40,
80,
42,
195,
50,
133,
186,
43,
134,
234,
170,
96,
177,
67,
61,
121,
31,
171,
120,
208,
74,
84,
33,
148,
199,
59,
171,
244,
243,
114,
92,
90,
99,
89,
181,
25,
224,
39,
149,
209,
40,
151,
1,
171,
106,
75,
126,
134,
35,
187,
12,
31,
114,
240,
229,
182,
48,
86,
192,
247,
109,
78,
111,
74,
207,
72,
232,
177,
126,
167,
213,
139,
124,
122,
18,
108,
35,
213,
86,
218,
226,
143,
169,
11,
165,
137,
241,
146,
115,
208,
178,
197,
0,
119,
147,
29,
144,
167,
236,
133,
233,
23,
140,
30,
186,
159,
76,
6,
150,
13,
72,
34,
240,
114,
192,
238,
72,
42,
177,
15,
33,
162,
170,
167,
64,
169,
78,
162,
226,
229,
191,
209,
140,
213,
161,
23,
147,
249,
103,
56,
153,
108,
105,
148,
177,
245,
168,
201,
101,
103,
5,
104,
90,
171,
155,
153,
121,
130,
35,
112,
242,
140,
206,
125,
225,
79,
154,
161,
143,
71,
45,
145,
15,
95,
105,
202,
158,
11,
119,
124,
66,
60,
86,
118,
120,
101,
209,
58,
211,
184,
42,
142,
66,
201,
147,
149,
26,
213,
168,
108,
93,
237,
168,
152,
128,
44,
87,
140,
248,
218,
189,
93,
25,
76,
249,
103,
187,
167,
31,
194,
133,
247,
148,
20,
169,
141,
166,
118,
102,
208,
187,
177,
71,
70,
182,
55,
205,
174,
20,
234,
146,
78,
115,
199,
104,
89,
254,
232,
246,
208,
127,
242,
221,
200,
198,
66,
153,
12,
25,
184,
78,
203,
45,
233,
51,
253,
169,
30,
5,
65,
188,
226,
167,
236,
17,
173,
193,
123,
249,
117,
107,
140,
56,
91,
180,
19,
79,
5,
204,
185,
109,
37,
187,
147,
197,
58,
100,
40,
11,
22,
248,
236,
189,
218,
3,
109,
243,
153,
247,
142,
35,
59,
228,
102,
130,
141,
200,
201,
101,
139,
129,
21,
246,
111,
143,
95,
249,
7,
196,
85,
133,
175,
59,
130,
214,
255,
36,
49,
209,
144,
168,
20,
126,
19,
198,
119,
221,
229,
245,
173,
218,
244,
14,
53,
221,
252,
107,
213,
65,
129,
23,
187,
196,
118,
77,
205,
9,
75,
179,
23,
176,
49,
41,
84,
163,
182,
156,
167,
247,
95,
212,
43,
183,
152,
63,
252,
67,
21,
224,
128,
201,
251,
136,
117,
214,
96,
226,
157,
79,
154,
98,
120,
65,
134,
130,
138,
197,
64,
171,
85,
144,
120,
179,
180
};
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
......@@ -4783,7 +4783,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
if (msg_p != NULL) {
switch (ITTI_MSG_ID(msg_p)) {
case PHY_FIND_CELL_REQ:
LOG_I(PHY, "[UE %d] Received %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p));
LOG_E(PHY, "[UE %d] Received PLMN doesn't match SIM data, but not developped further processing %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p));
/* TODO process the message */
break;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*!
*******************************************************************************
\file rrc_2_rrm_msg.c
\brief data formating for sending message over socket between RRC and RRM
\author BURLOT Pascal
\date 16/07/08
\par Historique:
P.BURLOT 2009-01-20
bug fix (memeory leak)
Macro changed :
RRM_CALLOC() by RRM_CALLOC2() in msg_rrc_sensing_meas_ind()
*******************************************************************************
*/
#ifdef RRC_EMUL
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "L3_rrc_defs.h"
#include "rrm_sock.h"
#include "L3_rrc_interface.h"
#include "rrc_rrm_msg.h"
#include "rrm_util.h"
#else
#include "defs.h"
#endif
#ifdef TRACE
//! Macro creant la chaine a partir du nom de la variable
#define STRINGIZER(x) #x
//! Tableau pour le mode trace faisant la translation entre le numero et le nom du message
const char *Str_msg_rrc_rrm[NB_MSG_RRC_RRM] = {
STRINGIZER(RRM_RB_ESTABLISH_REQ ),
STRINGIZER(RRC_RB_ESTABLISH_RESP ),
STRINGIZER(RRC_RB_ESTABLISH_CFM ),
STRINGIZER(RRM_RB_MODIFY_REQ ),
STRINGIZER(RRC_RB_MODIFY_RESP ),
STRINGIZER(RRC_RB_MODIFY_CFM ),
STRINGIZER(RRM_RB_RELEASE_REQ ),
STRINGIZER(RRC_RB_RELEASE_RESP ),
STRINGIZER(RRC_MR_ATTACH_IND ),
STRINGIZER(RRM_SENSING_MEAS_REQ ),
STRINGIZER(RRC_SENSING_MEAS_RESP ),
STRINGIZER(RRC_CX_ESTABLISH_IND ),
STRINGIZER(RRC_PHY_SYNCH_TO_MR_IND ),
STRINGIZER(RRC_PHY_SYNCH_TO_CH_IND ),
STRINGIZER(RRCI_CX_ESTABLISH_RESP ),
STRINGIZER(RRC_SENSING_MEAS_IND ),
STRINGIZER(RRM_SENSING_MEAS_RESP ),
STRINGIZER(RRC_RB_MEAS_IND ),
STRINGIZER(RRM_RB_MEAS_RESP ),
STRINGIZER(RRM_INIT_CH_REQ ),
STRINGIZER(RRCI_INIT_MR_REQ )
} ;
#endif
/*!
*******************************************************************************
\brief This function initialize the message header
\return any return value
*/
static void init_rrc_msg_head(
msg_head_t *msg_head , //!< message header to initialize
Instance_t inst , //!< Instance ID
MSG_RRC_RRM_T msg_type , //!< type of message to initialize
unsigned int size , //!< size of message
Transaction_t Trans_id //!< transaction id associated to this message
)
{
if ( msg_head != NULL ) {
msg_head->start = START_MSG ;
msg_head->msg_type = 0xFF & msg_type ;
msg_head->inst = inst ;
msg_head->Trans_id = Trans_id ;
msg_head->size = size;
}
}
/*!
*******************************************************************************
\brief La fonction formate en un message generique de reponse pour les
fonctions :
- rrc_rb_establish_resp(),rrc_rb_modify_resp(),rrc_rb_modify_resp(),
- rrc_rb_release_resp() et rrc_sensing_meas_resp() .
\return message formate
*/
msg_t mesg;
msg_t *msg_rrc_generic_resp(
Instance_t inst , //!< Instance ID
MSG_RRC_RRM_T msg_type , //!< type of message
Transaction_t Trans_id //!< Transaction ID
)
{
init_rrc_msg_head(&(mesg.head),inst, msg_type, 0 , Trans_id);
mesg.data = NULL ;
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_rb_establish_resp().
\return message formate
*/
msg_t *msg_rrc_rb_establish_resp(
Instance_t inst , //!< Instance ID
Transaction_t Trans_id //!< Transaction ID
)
{
return msg_rrc_generic_resp( inst, RRC_RB_ESTABLISH_RESP, Trans_id) ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_rb_establish_cfm().
\return message formate
*/
rrc_rb_establish_cfm_t P_rb_est_cfm ;//= RRM_CALLOC(rrc_rb_establish_cfm_t , 1 ) ;
msg_t *msg_rrc_rb_establish_cfm(
Instance_t inst , //!< Instance ID
RB_ID Rb_id , //!< Radio Bearer ID used by RRC
RB_TYPE RB_type , //!< Radio Bearer Type
Transaction_t Trans_id //!< Transaction ID
)
{
// msg_t mesg;
init_rrc_msg_head(&(mesg.head),inst,RRC_RB_ESTABLISH_CFM, sizeof( rrc_rb_establish_cfm_t ) ,Trans_id);
P_rb_est_cfm.Rb_id = Rb_id ;
P_rb_est_cfm.RB_type = RB_type ;
mesg.data = (char *) &P_rb_est_cfm ;
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_rb_modify_resp().
\return message formate
*/
msg_t *msg_rrc_rb_modify_resp(
Instance_t inst , //!< Instance ID
Transaction_t Trans_id //!< Transaction ID
)
{
return msg_rrc_generic_resp( inst,RRC_RB_MODIFY_RESP, Trans_id) ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_rb_modify_cfm().
\return message formate
*/
rrc_rb_modify_cfm_t P_rb_md_cfm;
msg_t *msg_rrc_rb_modify_cfm(
Instance_t inst , //!< Instance ID
RB_ID Rb_id , //!< Radio Bearer ID used by RRC
Transaction_t Trans_id //!< Transaction ID
)
{
// msg_t mesg;
init_rrc_msg_head(&(mesg.head),inst,RRC_RB_MODIFY_CFM, sizeof( rrc_rb_modify_cfm_t ) ,Trans_id);
P_rb_md_cfm.Rb_id = Rb_id ;
mesg.data = (char *) &P_rb_md_cfm ;
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_rb_release_resp().
\return message formate
*/
msg_t *msg_rrc_rb_release_resp(
Instance_t inst , //!< Instance ID
Transaction_t Trans_id //!< Transaction ID
)
{
return msg_rrc_generic_resp( inst,RRC_RB_RELEASE_RESP, Trans_id) ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_MR_attach_ind().
\return message formate
*/
rrc_MR_attach_ind_t P_att_ind;
msg_t * msg_rrc_MR_attach_ind(
Instance_t inst , //!< Instance ID
L2_ID L2_id
)
{
// msg_t mesg;
init_rrc_msg_head(&(mesg.head),inst,RRC_MR_ATTACH_IND, sizeof( rrc_MR_attach_ind_t ) ,0);
memcpy( P_att_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ;
mesg.data = (char *) &P_att_ind ;
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_sensing_meas_resp().
\return message formate
*/
msg_t *msg_rrc_sensing_meas_resp(
Instance_t inst , //!< Instance ID
Transaction_t Trans_id //!< Transaction ID
)
{
return msg_rrc_generic_resp( inst,RRC_SENSING_MEAS_RESP, Trans_id) ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_cx_establish_ind().
\return message formate
*/
rrc_cx_establish_ind_t P_cx_est_ind;
msg_t * msg_rrc_cx_establish_ind(
Instance_t inst , //!< Instance ID
L2_ID L2_id , //!< Layer 2 (MAC) ID
Transaction_t Trans_id , //!< Transaction ID
unsigned char *L3_info , //!< Optional L3 Information
L3_INFO_T L3_info_t , //!< Type of L3 Information
RB_ID DTCH_B_id , //!< RBID of broadcast IP service (MR only)
RB_ID DTCH_id //!< RBID of default IP service (MR only)
)
{
//msg_t mesg;
init_rrc_msg_head(&(mesg.head),inst,RRC_CX_ESTABLISH_IND, sizeof( rrc_cx_establish_ind_t ) ,Trans_id);
memcpy( P_cx_est_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ;
P_cx_est_ind.DTCH_B_id = DTCH_B_id ;
P_cx_est_ind.DTCH_id = DTCH_id ;
P_cx_est_ind.L3_info_t = L3_info_t ;
if ( L3_info_t == IPv4_ADDR ) {
memcpy( P_cx_est_ind.L3_info, L3_info, 4 );
} else if ( L3_info_t == IPv6_ADDR ) {
memcpy( P_cx_est_ind.L3_info, L3_info, 16 );
}
mesg.data = (char *) &P_cx_est_ind ;
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_phy_synch_to_MR_ind().
\return message formate
*/
rrc_phy_synch_to_MR_ind_t P_snc_mr;
msg_t * msg_rrc_phy_synch_to_MR_ind(
Instance_t inst , //!< Instance ID
L2_ID L2_id
)
{
//msg_t smsg;
init_rrc_msg_head(&(mesg.head),inst,RRC_PHY_SYNCH_TO_MR_IND, sizeof( rrc_phy_synch_to_MR_ind_t ) ,0);
memcpy(&P_snc_mr.L2_id,(L2_ID*)&L2_id,sizeof(L2_ID));
mesg.data = (char *)&P_snc_mr ;
msg("[msg_rrc_phy_synch_to_MR_ind] from Inst :%d\n",mesg.head.inst);
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_phy_synch_to_CH_ind().
\return message formate
*/
rrc_phy_synch_to_CH_ind_t P_snc_ch;
msg_t * msg_rrc_phy_synch_to_CH_ind(
Instance_t inst , //!< Instance ID
unsigned int Ch_index , //!< Clusterhead index
L2_ID L2_id
)
{
// msg_t smsg;
init_rrc_msg_head(&(mesg.head),inst, RRC_PHY_SYNCH_TO_CH_IND, sizeof( rrc_phy_synch_to_CH_ind_t ) ,0);
P_snc_ch.Ch_index = Ch_index ;
memcpy(&P_snc_ch.L2_id,(L2_ID*)&L2_id,sizeof(L2_ID));
mesg.data = (char *) &P_snc_ch;
msg("[msg_rrc_phy_synch_to_CH_ind] from Inst :%d\n",mesg.head.inst);
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_sensing_meas_ind().
\return message formate
*/
rrc_sensing_meas_ind_t P_sens_ind;
msg_t * msg_rrc_sensing_meas_ind(
Instance_t inst , //!< Instance ID
L2_ID L2_id , //!< Layer 2 ID (MAC) of sensing node
unsigned int NB_meas , //!< Layer 2 ID (MAC) of sensing node
SENSING_MEAS_T *Sensing_meas , //!< Sensing Information
Transaction_t Trans_id //!< Transaction ID
)
{
// msg_t mesg;
unsigned int size = sizeof( rrc_sensing_meas_ind_t ) + (NB_meas-1) * sizeof(SENSING_MEAS_T) ;
// Note : (NB_meas-1) car la première est incorporé dans rrc_sensing_meas_ind_t
init_rrc_msg_head(&(mesg.head),inst, RRC_SENSING_MEAS_IND, size ,Trans_id);
memcpy( P_sens_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ;
if ( NB_meas > 0 ) {
memcpy( P_sens_ind.Sensing_meas , Sensing_meas, NB_meas * sizeof(SENSING_MEAS_T) ) ;
}
P_sens_ind.NB_meas = NB_meas ;
mesg.data = (char *) &P_sens_ind ;
return &mesg ;
}
/*!
*******************************************************************************
\brief La fonction formate en un message les parametres de la fonction
rrc_rb_meas_ind().
\return message formate
*/
rrc_rb_meas_ind_t P_rb_meas;
msg_t * msg_rrc_rb_meas_ind(
Instance_t inst , //!< Instance ID
RB_ID Rb_id , //!< Radio Bearer ID
L2_ID L2_id , //!< Layer 2 (MAC) IDs for link
MEAS_MODE Meas_mode , //!< Measurement mode (periodic or event-driven)
MAC_RLC_MEAS_T *Mac_rlc_meas , //!< MAC/RLC measurements
Transaction_t Trans_id //!< Transaction ID
)
{
//msg_t mesg;
init_rrc_msg_head(&(mesg.head),inst, RRC_RB_MEAS_IND, sizeof( rrc_rb_meas_ind_t ) ,Trans_id);
memcpy( P_rb_meas.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ;
memcpy( &(P_rb_meas.Mac_rlc_meas), Mac_rlc_meas, sizeof(L2_ID) ) ;
P_rb_meas.Rb_id = Rb_id ;
P_rb_meas.Meas_mode = Meas_mode ;
mesg.data = (char *) &P_rb_meas;
return &mesg ;
}
/*****************************************************************************/
rrc_init_scan_req_t P_init_scan;
msg_t * msg_rrc_init_scan_req(
Instance_t inst , //!< Instance ID
L2_ID L2_id , //!< Layer 2 (MAC) IDs for link
unsigned int Interv
)
{
//msg_t mesg;
msg("RRCI: inst %d sendind rrc_init_scan_req from FC %d %d\n",inst,L2_id.L2_id[0],L2_id.L2_id[7]);
init_rrc_msg_head(&(mesg.head),inst, RRC_INIT_SCAN_REQ, sizeof( rrc_init_scan_req_t ) ,0);
memcpy( &P_init_scan.L2_id.L2_id[0], &L2_id.L2_id[0], sizeof(L2_ID) ) ;
P_init_scan.interv=Interv;
return &mesg ;
}
/*****************************************************************************/
rrc_update_sens_t P_update_sens;
msg_t * msg_rrc_update_sens(
Instance_t inst , //!< Instance ID
Sens_ch_t *Sens,
L2_ID L2_id,
unsigned char NB_info
)
{
//msg_t mesg;
init_rrc_msg_head(&(mesg.head),inst, RRC_UPDATE_SENS, sizeof( rrc_update_sens_t ) ,0);
memcpy( &P_update_sens.L2_id.L2_id[0], &L2_id.L2_id[0], sizeof(L2_ID) ) ;
memcpy( &P_update_sens.Sens_meas[0], (rrc_update_sens_t *)Sens, NB_info*sizeof(Sens_ch_t) ) ;
P_update_sens.NB_info=NB_info;
return &mesg ;
}
/*****************************************************************************/
rrc_end_scan_req_t P_end_scan;
msg_t * msg_rrc_end_scan_req(
Instance_t inst , //!< Instance ID
unsigned char CH_index
)
{
//msg_t mesg;
msg("RRC: send END_SCAN_REQ, INST %d\n",inst);
init_rrc_msg_head(&(mesg.head),inst, RRC_END_SCAN_REQ, sizeof( rrc_end_scan_req_t ) ,0);
P_update_sens.L2_id.L2_id[0]=CH_index;
return &mesg ;
}
......@@ -3301,6 +3301,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ);
itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p);
LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n");
}
}
#endif
......@@ -4718,7 +4719,6 @@ void *rrc_ue_task( void *args_p )
break;
case MESSAGE_TEST:
LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break;
/* MAC messages */
......@@ -5113,6 +5113,7 @@ void *rrc_ue_task( void *args_p )
break; // PHY_FIND_CELL_IND
case PHY_MEAS_REPORT_IND: {
LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND);
......@@ -5130,6 +5131,7 @@ void *rrc_ue_task( void *args_p )
}
case RRC_RAL_CONFIGURE_THRESHOLD_REQ:
LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
rrc_ue_ral_handle_configure_threshold_request(ue_mod_id, msg_p);
break;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*****************************************************************************
Source as_message.h
Version 0.1
Date 2012/10/18
Product NAS stack
Subsystem Application Programming Interface
Author Frederic Maurel
Description Defines the messages supported by the Access Stratum sublayer
protocol (usually RRC and S1AP for E-UTRAN) and functions used
to encode and decode
*****************************************************************************/
#ifndef __AS_MESSAGE_H__
#define __AS_MESSAGE_H__
#include "commonDef.h"
#include "networkDef.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/* Access Stratum Message types */
#define AS_REQUEST 0x0100
#define AS_RESPONSE 0x0200
#define AS_INDICATION 0x0400
#define AS_CONFIRM 0x0800
/*
* Access Stratum Message identifiers
* ----------------------------------
*/
/* Cell information relevant for cell selection processing */
#define AS_CELL_INFO 0x01
#define AS_CELL_INFO_REQ (AS_CELL_INFO | AS_REQUEST)
#define AS_CELL_INFO_RSP (AS_CELL_INFO | AS_RESPONSE)
#define AS_CELL_INFO_IND (AS_CELL_INFO | AS_INDICATION)
/* Security mode control */
#define AS_SECURITY 0x02
#define AS_SECURITY_REQ (AS_SECURITY | AS_REQUEST)
#define AS_SECURITY_RSP (AS_SECURITY | AS_RESPONSE)
/* Paging information */
#define AS_PAGING 0x03
#define AS_PAGING_IND (AS_PAGING | AS_INDICATION)
/* NAS signalling connection establishment */
#define AS_NAS_ESTABLISH 0x04
#define AS_NAS_ESTABLISH_REQ (AS_NAS_ESTABLISH | AS_REQUEST)
#define AS_NAS_ESTABLISH_RSP (AS_NAS_ESTABLISH | AS_RESPONSE)
/* NAS signalling connection release */
#define AS_NAS_RELEASE 0x05
#define AS_NAS_RELEASE_REQ (AS_NAS_RELEASE | AS_REQUEST)
#define AS_NAS_RELEASE_IND (AS_NAS_RELEASE | AS_INDICATION)
/* NAS information transfer */
#define AS_INFO_TRANSFER 0x10
#define AS_UL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_REQUEST)
#define AS_DL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_INDICATION)
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* --------------------------------------------------------------------------
* Available PLMNs and cell Information
* --------------------------------------------------------------------------
*/
/* Radio access technologies supported by the network */
#define AS_GSM (1 << NET_ACCESS_GSM)
#define AS_COMPACT (1 << NET_ACCESS_COMPACT)
#define AS_UTRAN (1 << NET_ACCESS_UTRAN)
#define AS_EGPRS (1 << NET_ACCESS_EGPRS)
#define AS_HSDPA (1 << NET_ACCESS_HSDPA)
#define AS_HSUPA (1 << NET_ACCESS_HSUPA)
#define AS_HSDUPA (1 << NET_ACCESS_HSDUPA)
#define AS_EUTRAN (1 << NET_ACCESS_EUTRAN)
/*
* NAS->AS -K_eNB refresh request
* NAS request AS to refresh its KeNB key
*/
typedef struct kenb_refresh_req_s {
Byte_t kenb[32];
} kenb_refresh_req_t;
/*
* NAS->AS - Cell Information request
* NAS request AS to search for a suitable cell belonging to the selected
* PLMN to camp on.
*/
typedef struct {
plmn_t plmnID; /* PLMN identifier */
Byte_t rat; /* Bitmap - set of radio access technologies */
} cell_info_req_t;
/*
* AS->NAS - Cell Information response
* AS search for a suitable cell and respond to NAS. If found, the cell
* is selected to camp on.
*/
typedef struct {
plmn_t plmnID; /* PLMN identifier */
TAC_t tac; /* identifies a tracking area the PLMN belongs to */
CI_t cellID; /* identifies a cell within a PLMN */
AcT_t rat; /* radio access technology supported by the cell */
} cell_info_rsp_t;
/*
* AS->NAS - Cell Information indication
* AS Reports available PLMNs with associated Radio Access Technologies
* to NAS on request from NAS or autonomously.
*/
typedef struct {
#define PLMN_LIST_MAX_SIZE 6
PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */
Byte_t rat[PLMN_LIST_MAX_SIZE]; /* Radio access technologies */
TAC_t tac; /* identifies a tracking area within a scope of PLMNs */
CI_t cellID; /* identifies a cell within a PLMN */
} cell_info_ind_t;
/*
* --------------------------------------------------------------------------
* Security mode control
* --------------------------------------------------------------------------
*/
/*
* TODO: NAS->AS - Security command request
*/
typedef struct {} security_req_t;
/*
* TODO: AS->NAS - Security command response
*/
typedef struct {} security_rsp_t;
/*
* --------------------------------------------------------------------------
* Paging information
* --------------------------------------------------------------------------
*/
/*
* TODO: AS->NAS - Paging Information indication
*/
typedef struct {} paging_ind_t;
/*
* --------------------------------------------------------------------------
* NAS signalling connection establishment
* --------------------------------------------------------------------------
*/
/* Cause of RRC connection establishment */
#define AS_CAUSE_EMERGENCY (NET_ESTABLISH_CAUSE_EMERGENCY)
#define AS_CAUSE_HIGH_PRIO (NET_ESTABLISH_CAUSE_HIGH_PRIO)
#define AS_CAUSE_MT_ACCESS (NET_ESTABLISH_CAUSE_MT_ACCESS)
#define AS_CAUSE_MO_SIGNAL (NET_ESTABLISH_CAUSE_MO_SIGNAL)
#define AS_CAUSE_MO_DATA (NET_ESTABLISH_CAUSE_MO_DATA)
#define AS_CAUSE_V1020 (NET_ESTABLISH_CAUSE_V1020)
/* Type of the call associated to the RRC connection establishment */
#define AS_TYPE_ORIGINATING_SIGNAL (NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL)
#define AS_TYPE_EMERGENCY_CALLS (NET_ESTABLISH_TYPE_EMERGENCY_CALLS)
#define AS_TYPE_ORIGINATING_CALLS (NET_ESTABLISH_TYPE_ORIGINATING_CALLS)
#define AS_TYPE_TERMINATING_CALLS (NET_ESTABLISH_TYPE_TERMINATING_CALLS)
#define AS_TYPE_MO_CS_FALLBACK (NET_ESTABLISH_TYPE_MO_CS_FALLBACK)
/* Structure of the SAE Temporary Mobile Subscriber Identity */
typedef struct {
uint8_t MMEcode; /* MME code that allocated the GUTI */
uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
} as_stmsi_t;
/* Structure of the dedicated NAS information */
typedef struct {
uint32_t length; /* Length of the NAS information data */
Byte_t* data; /* Dedicated NAS information data container */
} as_nas_info_t;
/*
* NAS->AS - NAS signalling connection establishment request
* NAS request AS to perform the RRC connection establishment procedure
* to transfer initial NAS message to the network while UE is in IDLE mode.
*/
typedef struct {
uint8_t cause; /* Connection establishment cause */
uint8_t type; /* Associated call type */
plmn_t plmnID; /* Identifier of the selected PLMN */
as_stmsi_t s_tmsi; /* SAE Temporary Mobile Subscriber Identity */
as_nas_info_t initialNasMsg;/* Initial NAS message to transfer */
} nas_establish_req_t;
/*
* TODO: AS->NAS - NAS signalling connection establishment response
*/
typedef struct {} nas_establish_rsp_t;
/*
* --------------------------------------------------------------------------
* NAS signalling connection release
* --------------------------------------------------------------------------
*/
/*
* TODO: NAS->AS - NAS signalling connection release request
*/
typedef struct {} nas_release_req_t;
/*
* TODO: AS->NAS - NAS signalling connection release indication
*/
typedef struct {} nas_release_ind_t;
/*
* --------------------------------------------------------------------------
* NAS information transfer
* --------------------------------------------------------------------------
*/
/*
* AS->NAS - Downlink data transfer
* AS notifies upper layer that NAS or non-3GPP dedicated downlink information
* has to be transfered to NAS.
*/
typedef as_nas_info_t dl_info_transfer_t;
/*
* NAS->AS - Uplink data transfer request
* NAS requests under layer to transfer NAS or non-3GPP dedicated uplink
* information to AS.
*/
typedef as_nas_info_t ul_info_transfer_t;
/*
* --------------------------------------------------------------------------
* Structure of the AS messages handled by the network sublayer
* --------------------------------------------------------------------------
*/
typedef struct {
uint16_t msgID;
union {
cell_info_req_t cell_info_req;
cell_info_rsp_t cell_info_rsp;
cell_info_ind_t cell_info_ind;
security_req_t security_req;
security_rsp_t security_rsp;
paging_ind_t paging_ind;
nas_establish_req_t nas_establish_req;
nas_establish_rsp_t nas_establish_rsp;
nas_release_req_t nas_release_req;
nas_release_ind_t nas_release_ind;
ul_info_transfer_t ul_info_transfer;
dl_info_transfer_t dl_info_transfer;
} __attribute__((__packed__)) msg;
} as_message_t;
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
int as_message_decode(const char* buffer, int length, as_message_t* msg);
int as_message_encode(char* buffer, int length, const as_message_t* msg);
/* Implemented in the network_api.c body file */
int as_message_send(as_message_t* as_msg, const void* nas_msg);
#endif /* __AS_MESSAGE_H__*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*****************************************************************************
Source network.h
Version 0.1
Date 2013/03/26
Product USIM data generator
Subsystem PLMN network operators
Author Frederic Maurel
Description Defines a list of PLMN network operators
*****************************************************************************/
#ifndef __NETWORK_H__
#define __NETWORK_H__
#include "commonDef.h"
#include "networkDef.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/*
* PLMN network operator record index
*/
#define TEST1 0
#define SFR1 1
#define SFR2 2
#define SFR3 3
#define OAI_LTEBOX 4
#define TM1 5
#define FCT1 6
#define VDF1 7
#define VDF2 8
#define VDF3 9
#define VDF4 10
#define VDF5 11
#define SELECTED_PLMN TEST1 //SFR1
#define TEST_PLMN {0,0,0x0f,1,1,0} // 00101
#define SFR_PLMN_1 {0,2,0x0f,8,0,1} // 20810
#define SFR_PLMN_2 {0,2,0x0f,8,1,1} // 20811
#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813
#define OAI_LTEBOX_PLMN {0,2,0x0f,8,3,9} //20893
#define TM_PLMN_1 {1,3,0,0,8,2} // 310280
#define FCT_PLMN_1 {1,3,8,0,2,0} // 310028
#define VDF_PLMN_1 {2,2,0x0f,2,0,1} // 22210
#define VDF_PLMN_2 {1,2,0x0f,4,0x0f,1} // 2141
#define VDF_PLMN_3 {1,2,0x0f,4,0x0f,6} // 2146
#define VDF_PLMN_4 {6,2,0x0f,2,0x0f,2} // 2622
#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* PLMN network operator record
*/
typedef struct {
unsigned int num;
plmn_t plmn;
char fullname[NET_FORMAT_LONG_SIZE + 1];
char shortname[NET_FORMAT_SHORT_SIZE + 1];
tac_t tac_start;
tac_t tac_end;
} network_record_t;
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
/*
* The list of PLMN network operator records
*/
network_record_t network_records[] = {
{00101, TEST_PLMN, "Test network", "OAI4G", 0x0001, 0xfffd},
{20810, SFR_PLMN_1, "SFR France", "SFR", 0x0001, 0xfffd},
{20811, SFR_PLMN_2, "SFR France", "SFR", 0x0001, 0xfffd},
{20813, SFR_PLMN_3, "SFR France", "SFR", 0x0001, 0xfffd},
{20893, OAI_LTEBOX_PLMN, "OAI LTEBOX", "OAIALU", 0x0001, 0xfffd},
{310280,TM_PLMN_1, "T-Mobile USA", "T-Mobile", 0x0001, 0xfffd},
{310028,FCT_PLMN_1, "FICTITIOUS USA", "FICTITIO", 0x0001, 0xfffd},
{22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0001, 0xfffd},
{2141, VDF_PLMN_2, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd},
{2146, VDF_PLMN_3, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd},
{2622, VDF_PLMN_4, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd},
{2624, VDF_PLMN_5, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd},
};
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
#endif /* __NETWORK_H__*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <libconfig.h>
#include <arpa/inet.h> /* To provide inet_addr */
#include "intertask_interface.h"
#include "assertions.h"
#include "msc.h"
#include "mme_config.h"
#include "spgw_config.h"
#include "intertask_interface_conf.h"
mme_config_t mme_config;
int mme_config_find_mnc_length(const char mcc_digit1P,
const char mcc_digit2P,
const char mcc_digit3P,
const char mnc_digit1P,
const char mnc_digit2P,
const char mnc_digit3P)
{
uint16_t mcc = 100*mcc_digit1P + 10*mcc_digit2P + mcc_digit3P;
uint16_t mnc3= 100*mnc_digit1P + 10*mnc_digit2P + mnc_digit3P;
uint16_t mnc2= 10*mnc_digit1P + mnc_digit2P;
int plmn_index = 0;
AssertFatal((mcc_digit1P >= 0) && (mcc_digit1P <= 9)
&& (mcc_digit2P >= 0) && (mcc_digit2P <= 9)
&& (mcc_digit3P >= 0) && (mcc_digit3P <= 9) ,
"BAD MCC PARAMETER (%d%d%d)!\n",
mcc_digit1P, mcc_digit2P, mcc_digit3P);
AssertFatal((mnc_digit2P >= 0) && (mnc_digit2P <= 9)
&& (mnc_digit1P >= 0) && (mnc_digit1P <= 9) ,
"BAD MNC PARAMETER (%d.%d.%d)!\n",
mnc_digit1P, mnc_digit2P, mnc_digit3P);
while (plmn_index < mme_config.gummei.nb_plmns) {
if (mme_config.gummei.plmn_mcc[plmn_index] == mcc) {
if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc2) &&
(mme_config.gummei.plmn_mnc_len[plmn_index] == 2)) {
return 2;
} else if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc3) &&
(mme_config.gummei.plmn_mnc_len[plmn_index] == 3)) {
return 3;
}
}
plmn_index += 1;
}
return 0;
}
static
void mme_config_init(mme_config_t *mme_config_p)
{
memset(mme_config_p, 0, sizeof(mme_config_t));
pthread_rwlock_init(&mme_config_p->rw_lock, NULL);
mme_config_p->verbosity_level = 0;
mme_config_p->config_file = NULL;
mme_config_p->max_eNBs = MAX_NUMBER_OF_ENB;
mme_config_p->max_ues = MAX_NUMBER_OF_UE;
mme_config_p->emergency_attach_supported = 0;
mme_config_p->unauthenticated_imsi_supported = 0;
/* Timer configuration */
mme_config_p->gtpv1u_config.port_number = GTPV1_U_PORT_NUMBER;
mme_config_p->s1ap_config.port_number = S1AP_PORT_NUMBER;
/* IP configuration */
mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up = inet_addr(DEFAULT_SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP);
mme_config_p->ipv4.mme_interface_name_for_S1_MME = DEFAULT_MME_INTERFACE_NAME_FOR_S1_MME;
mme_config_p->ipv4.mme_ip_address_for_S1_MME = inet_addr(DEFAULT_MME_IP_ADDRESS_FOR_S1_MME);
mme_config_p->ipv4.mme_interface_name_for_S11 = DEFAULT_MME_INTERFACE_NAME_FOR_S11;
mme_config_p->ipv4.mme_ip_address_for_S11 = inet_addr(DEFAULT_MME_IP_ADDRESS_FOR_S11);
mme_config_p->ipv4.sgw_ip_address_for_S11 = inet_addr(DEFAULT_SGW_IP_ADDRESS_FOR_S11);
mme_config_p->s6a_config.conf_file = S6A_CONF_FILE;
mme_config_p->itti_config.queue_size = ITTI_QUEUE_MAX_ELEMENTS;
mme_config_p->itti_config.log_file = NULL;
mme_config_p->sctp_config.in_streams = SCTP_IN_STREAMS;
mme_config_p->sctp_config.out_streams = SCTP_OUT_STREAMS;
mme_config_p->relative_capacity = RELATIVE_CAPACITY;
mme_config_p->mme_statistic_timer = MME_STATISTIC_TIMER_S;
mme_config_p->gummei.nb_mme_gid = 1;
mme_config_p->gummei.mme_gid = calloc(1, sizeof(*mme_config_p->gummei.mme_gid));
mme_config_p->gummei.mme_gid[0] = MMEGID;
mme_config_p->gummei.nb_mmec = 1;
mme_config_p->gummei.mmec = calloc(1, sizeof(*mme_config_p->gummei.mmec));
mme_config_p->gummei.mmec[0] = MMEC;
/* Set the TAI */
mme_config_p->gummei.nb_plmns = 1;
mme_config_p->gummei.plmn_mcc = calloc(1, sizeof(*mme_config_p->gummei.plmn_mcc));
mme_config_p->gummei.plmn_mnc = calloc(1, sizeof(*mme_config_p->gummei.plmn_mnc));
mme_config_p->gummei.plmn_mnc_len = calloc(1, sizeof(*mme_config_p->gummei.plmn_mnc_len));
mme_config_p->gummei.plmn_tac = calloc(1, sizeof(*mme_config_p->gummei.plmn_tac));
mme_config_p->gummei.plmn_mcc[0] = PLMN_MCC;
mme_config_p->gummei.plmn_mnc[0] = PLMN_MNC;
mme_config_p->gummei.plmn_mnc_len[0] = PLMN_MNC_LEN;
mme_config_p->gummei.plmn_tac[0] = PLMN_TAC;
mme_config_p->s1ap_config.outcome_drop_timer_sec = S1AP_OUTCOME_TIMER_DEFAULT;
}
int mme_system(char *command_pP, int abort_on_errorP)
{
int ret = -1;
if (command_pP) {
fprintf(stdout, "system command: %s\n",command_pP);
ret = system(command_pP);
if (ret < 0) {
fprintf(stderr, "ERROR in system command %s: %d\n",
command_pP,ret);
if (abort_on_errorP) {
exit(-1); // may be not exit
}
}
}
return ret;
}
static int config_parse_file(mme_config_t *mme_config_p)
{
config_t cfg;
config_setting_t *setting_mme = NULL;
config_setting_t *setting = NULL;
config_setting_t *subsetting = NULL;
config_setting_t *sub2setting = NULL;
long int alongint;
int i, num;
char *astring = NULL;
char *address = NULL;
char *cidr = NULL;
const char* tac = NULL;
const char* mcc = NULL;
const char* mnc = NULL;
char *sgw_ip_address_for_S1u_S12_S4_up = NULL;
char *mme_interface_name_for_S1_MME = NULL;
char *mme_ip_address_for_S1_MME = NULL;
char *mme_interface_name_for_S11 = NULL;
char *mme_ip_address_for_S11 = NULL;
char *sgw_ip_address_for_S11 = NULL;
char system_cmd[256];
config_init(&cfg);
if(mme_config_p->config_file != NULL) {
/* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&cfg, mme_config_p->config_file)) {
fprintf(stdout, "ERROR: %s:%d - %s\n", mme_config_p->config_file, config_error_line(&cfg), config_error_text(&cfg));
config_destroy(&cfg);
AssertFatal (1 == 0, "Failed to parse MME configuration file %s!\n", mme_config_p->config_file);
}
} else {
fprintf(stdout, "ERROR No MME configuration file provided!\n");
config_destroy(&cfg);
AssertFatal (0, "No MME configuration file provided!\n");
}
setting_mme = config_lookup(&cfg, MME_CONFIG_STRING_MME_CONFIG);
if(setting_mme != NULL) {
// GENERAL MME SETTINGS
if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_REALM, (const char **)&astring) )) {
mme_config_p->realm = strdup(astring);
mme_config_p->realm_length = strlen(mme_config_p->realm);
}
if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_MAXENB, &alongint) )) {
mme_config_p->max_eNBs = (uint32_t)alongint;
}
if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_MAXUE, &alongint) )) {
mme_config_p->max_ues = (uint32_t)alongint;
}
if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_RELATIVE_CAPACITY, &alongint) )) {
mme_config_p->relative_capacity = (uint8_t)alongint;
}
if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_STATISTIC_TIMER, &alongint) )) {
mme_config_p->mme_statistic_timer = (uint32_t)alongint;
}
if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_EMERGENCY_ATTACH_SUPPORTED, (const char **)&astring) )) {
if (strcasecmp(astring , "yes") == 0)
mme_config_p->emergency_attach_supported = 1;
else
mme_config_p->emergency_attach_supported = 0;
}
if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_UNAUTHENTICATED_IMSI_SUPPORTED, (const char **)&astring) )) {
if (strcasecmp(astring , "yes") == 0)
mme_config_p->unauthenticated_imsi_supported = 1;
else
mme_config_p->unauthenticated_imsi_supported = 0;
}
if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_ASN1_VERBOSITY, (const char **)&astring) )) {
if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0)
mme_config_p->verbosity_level = 0;
else if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0)
mme_config_p->verbosity_level = 2;
else if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0)
mme_config_p->verbosity_level = 1;
else
mme_config_p->verbosity_level = 0;
}
// ITTI SETTING
setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_INTERTASK_INTERFACE_CONFIG);
if (setting != NULL) {
if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_INTERTASK_INTERFACE_QUEUE_SIZE, &alongint) )) {
mme_config_p->itti_config.queue_size = (uint32_t)alongint;
}
}
// S6A SETTING
setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_S6A_CONFIG);
if (setting != NULL) {
if( (config_setting_lookup_string( setting, MME_CONFIG_STRING_S6A_CONF_FILE_PATH, (const char **)&astring) )) {
if (astring != NULL)
mme_config_p->s6a_config.conf_file = strdup(astring);
}
if( (config_setting_lookup_string( setting, MME_CONFIG_STRING_S6A_HSS_HOSTNAME, (const char **)&astring) )) {
if (astring != NULL)
mme_config_p->s6a_config.hss_host_name = strdup(astring);
else
AssertFatal (1 == 0,
"You have to provide a valid HSS hostname %s=...\n",
MME_CONFIG_STRING_S6A_HSS_HOSTNAME);
}
}
// SCTP SETTING
setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_SCTP_CONFIG);
if (setting != NULL) {
if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_SCTP_INSTREAMS, &alongint) )) {
mme_config_p->sctp_config.in_streams = (uint16_t)alongint;
}
if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_SCTP_OUTSTREAMS, &alongint) )) {
mme_config_p->sctp_config.out_streams = (uint16_t)alongint;
}
}
// S1AP SETTING
setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_S1AP_CONFIG);
if (setting != NULL) {
if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_S1AP_OUTCOME_TIMER, &alongint) )) {
mme_config_p->s1ap_config.outcome_drop_timer_sec = (uint8_t)alongint;
}
if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_S1AP_PORT, &alongint) )) {
mme_config_p->s1ap_config.port_number = (uint16_t)alongint;
}
}
// GUMMEI SETTING
setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_GUMMEI_CONFIG);
if (setting != NULL) {
subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_MME_CODE);
if (subsetting != NULL) {
num = config_setting_length(subsetting);
if (mme_config_p->gummei.nb_mmec != num) {
if (mme_config_p->gummei.mmec != NULL) {
free(mme_config_p->gummei.mmec);
}
mme_config_p->gummei.mmec = calloc(num, sizeof(*mme_config_p->gummei.mmec));
}
mme_config_p->gummei.nb_mmec = num;
for (i = 0; i < num; i++) {
mme_config_p->gummei.mmec[i] = config_setting_get_int_elem(subsetting, i);
}
}
subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_MME_GID);
if (subsetting != NULL) {
num = config_setting_length(subsetting);
if (mme_config_p->gummei.nb_mme_gid != num) {
if (mme_config_p->gummei.mme_gid != NULL) {
free(mme_config_p->gummei.mme_gid);
}
mme_config_p->gummei.mme_gid = calloc(num, sizeof(*mme_config_p->gummei.mme_gid));
}
mme_config_p->gummei.nb_mme_gid = num;
for (i = 0; i < num; i++) {
mme_config_p->gummei.mme_gid[i] = config_setting_get_int_elem(subsetting, i);
}
}
subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_TAI_LIST);
if (subsetting != NULL) {
num = config_setting_length(subsetting);
if (mme_config_p->gummei.nb_plmns != num) {
if (mme_config_p->gummei.plmn_mcc != NULL) free(mme_config_p->gummei.plmn_mcc);
if (mme_config_p->gummei.plmn_mnc != NULL) free(mme_config_p->gummei.plmn_mnc);
if (mme_config_p->gummei.plmn_mnc_len != NULL) free(mme_config_p->gummei.plmn_mnc_len);
if (mme_config_p->gummei.plmn_tac != NULL) free(mme_config_p->gummei.plmn_tac);
mme_config_p->gummei.plmn_mcc = calloc(num, sizeof(*mme_config_p->gummei.plmn_mcc));
mme_config_p->gummei.plmn_mnc = calloc(num, sizeof(*mme_config_p->gummei.plmn_mnc));
mme_config_p->gummei.plmn_mnc_len = calloc(num, sizeof(*mme_config_p->gummei.plmn_mnc_len));
mme_config_p->gummei.plmn_tac = calloc(num, sizeof(*mme_config_p->gummei.plmn_tac));
}
mme_config_p->gummei.nb_plmns = num;
for (i = 0; i < num; i++) {
sub2setting = config_setting_get_elem(subsetting, i);
if (sub2setting != NULL) {
if( (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_MCC, &mcc) )) {
mme_config_p->gummei.plmn_mcc[i] = (uint16_t)atoi(mcc);
}
if( (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_MNC, &mnc) )) {
mme_config_p->gummei.plmn_mnc[i] = (uint16_t)atoi(mnc);
mme_config_p->gummei.plmn_mnc_len[i] = strlen(mnc);
AssertFatal((mme_config_p->gummei.plmn_mnc_len[i] == 2) || (mme_config_p->gummei.plmn_mnc_len[i] == 3),
"Bad MNC length %u, must be 2 or 3", mme_config_p->gummei.plmn_mnc_len[i]);
}
if( (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_TAC, &tac) )) {
mme_config_p->gummei.plmn_tac[i] = (uint16_t)atoi(tac);
AssertFatal(mme_config_p->gummei.plmn_tac[i] != 0,
"TAC must not be 0");
}
}
}
}
}
// NETWORK INTERFACE SETTING
setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
if(setting != NULL) {
if( (
config_setting_lookup_string( setting, MME_CONFIG_STRING_INTERFACE_NAME_FOR_S1_MME,
(const char **)&mme_interface_name_for_S1_MME)
&& config_setting_lookup_string( setting, MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S1_MME,
(const char **)&mme_ip_address_for_S1_MME)
&& config_setting_lookup_string( setting, MME_CONFIG_STRING_INTERFACE_NAME_FOR_S11_MME,
(const char **)&mme_interface_name_for_S11)
&& config_setting_lookup_string( setting, MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S11_MME,
(const char **)&mme_ip_address_for_S11)
)
) {
mme_config_p->ipv4.mme_interface_name_for_S1_MME = strdup(mme_interface_name_for_S1_MME);
cidr = strdup(mme_ip_address_for_S1_MME);
address = strtok(cidr, "/");
IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.mme_ip_address_for_S1_MME, "BAD IP ADDRESS FORMAT FOR MME S1_MME !\n" )
free(cidr);
mme_config_p->ipv4.mme_interface_name_for_S11 = strdup(mme_interface_name_for_S11);
cidr = strdup(mme_ip_address_for_S11);
address = strtok(cidr, "/");
IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.mme_ip_address_for_S11, "BAD IP ADDRESS FORMAT FOR MME S11 !\n" )
free(cidr);
if (strncasecmp("tun",mme_config_p->ipv4.mme_interface_name_for_S1_MME, strlen("tun")) == 0) {
if (snprintf(system_cmd, 256,
"ip link set %s down ;openvpn --rmtun --dev %s",
mme_config_p->ipv4.mme_interface_name_for_S1_MME,
mme_config_p->ipv4.mme_interface_name_for_S1_MME
) > 0) {
mme_system(system_cmd, 1);
} else {
fprintf(stderr, "Del %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
}
if (snprintf(system_cmd, 256,
"openvpn --mktun --dev %s;sync;ifconfig %s up;sync",
mme_config_p->ipv4.mme_interface_name_for_S1_MME,
mme_config_p->ipv4.mme_interface_name_for_S1_MME) > 0) {
mme_system(system_cmd, 1);
} else {
fprintf(stderr, "Create %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
}
if (snprintf(system_cmd, 256,
"ip -4 addr add %s dev %s",
mme_ip_address_for_S1_MME,
mme_config_p->ipv4.mme_interface_name_for_S1_MME) > 0) {
mme_system(system_cmd, 1);
} else {
fprintf(stderr, "Set IPv4 address on %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
}
}
}
}
// NAS SETTING
setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_NAS_CONFIG);
if (setting != NULL) {
subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_NAS_SUPPORTED_INTEGRITY_ALGORITHM_LIST);
if (subsetting != NULL) {
num = config_setting_length(subsetting);
if (num <= 8) {
for (i = 0; i < num; i++) {
astring = config_setting_get_string_elem(subsetting, i);
if (strcmp("EIA0", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
else if (strcmp("EIA1", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA1;
else if (strcmp("EIA2", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA2;
else if (strcmp("EIA3", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
else if (strcmp("EIA4", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
else if (strcmp("EIA5", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
else if (strcmp("EIA6", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
else if (strcmp("EIA7", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
}
for (i = num; i < 8; i++) {
mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
}
}
}
subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_NAS_SUPPORTED_CIPHERING_ALGORITHM_LIST);
if (subsetting != NULL) {
num = config_setting_length(subsetting);
if (num <= 8) {
for (i = 0; i < num; i++) {
astring = config_setting_get_string_elem(subsetting, i);
if (strcmp("EEA0", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
else if (strcmp("EEA1", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA1;
else if (strcmp("EEA2", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA2;
else if (strcmp("EEA3", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
else if (strcmp("EEA4", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
else if (strcmp("EEA5", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
else if (strcmp("EEA6", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
else if (strcmp("EEA7", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
}
for (i = num; i < 8; i++) {
mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
}
}
}
}
}
setting = config_lookup(&cfg, SGW_CONFIG_STRING_SGW_CONFIG);
if(setting != NULL) {
subsetting = config_setting_get_member (setting, SGW_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
if(subsetting != NULL) {
if( (
config_setting_lookup_string( subsetting, SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP,
(const char **)&sgw_ip_address_for_S1u_S12_S4_up)
&& config_setting_lookup_string( subsetting, SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S11,
(const char **)&sgw_ip_address_for_S11)
&& config_setting_lookup_int( subsetting, SGW_CONFIG_STRING_SGW_PORT_FOR_S1U_S12_S4_UP, &alongint)
)
) {
cidr = strdup(sgw_ip_address_for_S1u_S12_S4_up);
address = strtok(cidr, "/");
IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR SGW S1u_S12_S4 !\n" )
free(cidr);
cidr = strdup(sgw_ip_address_for_S11);
address = strtok(cidr, "/");
IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.sgw_ip_address_for_S11, "BAD IP ADDRESS FORMAT FOR SGW S11 !\n" )
free(cidr);
mme_config_p->gtpv1u_config.port_number = (uint16_t) alongint;
}
}
}
return 0;
}
#define DISPLAY_ARRAY(size, format, args...) \
do { \
int i; \
for (i = 0; i < size; i++) { \
fprintf(stdout, format, args); \
if ((i != (size - 1)) && ((i + 1) % 10 == 0)) \
{ \
fprintf(stdout, "\n "); \
} \
} \
if (i > 0) \
fprintf(stdout, "\n"); \
} while(0)
static void config_display(mme_config_t *mme_config_p)
{
int j;
fprintf(stdout, "==== EURECOM %s v%s ====\n", PACKAGE_NAME, PACKAGE_VERSION);
fprintf(stdout, "Configuration:\n");
fprintf(stdout, "- File ...............: %s\n", mme_config_p->config_file);
fprintf(stdout, "- Verbosity level ....: %d\n", mme_config_p->verbosity_level);
fprintf(stdout, "- Realm ..............: %s\n", mme_config_p->realm);
fprintf(stdout, "- Max eNBs ...........: %u\n", mme_config_p->max_eNBs);
fprintf(stdout, "- Max UEs ............: %u\n", mme_config_p->max_ues);
fprintf(stdout, "- Emergency support ..: %s\n", mme_config_p->emergency_attach_supported == 0 ? "FALSE" : "TRUE");
fprintf(stdout, "- Unauth IMSI support : %s\n", mme_config_p->unauthenticated_imsi_supported == 0 ? "FALSE" : "TRUE");
fprintf(stdout, "- Relative capa ......: %u\n\n", mme_config_p->relative_capacity);
fprintf(stdout, "- Statistics timer ...: %u (seconds)\n\n", mme_config_p->mme_statistic_timer);
fprintf(stdout, "- S1-U:\n");
fprintf(stdout, " port number ......: %d\n", mme_config_p->gtpv1u_config.port_number);
fprintf(stdout, "- S1-MME:\n");
fprintf(stdout, " port number ......: %d\n", mme_config_p->s1ap_config.port_number);
fprintf(stdout, "- IP:\n");
//fprintf(stdout, " s1-u iface .......: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S1u_S12_S4_up);
fprintf(stdout, " s1-u ip ..........: %s\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up)));
//fprintf(stdout, " sgi iface ........: %s\n", mme_config_p->ipv4.pgw_interface_name_for_SGI);
//fprintf(stdout, " sgi ip ...........: %s/%d\n",
// inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.pgw_ip_addr_for_SGI)),
// mme_config_p->ipv4.pgw_ip_netmask_for_SGI);
fprintf(stdout, " s1-MME iface .....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
fprintf(stdout, " s1-MME ip ........: %s\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S1_MME)));
//fprintf(stdout, " s11 S-GW iface ...: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S11);
//fprintf(stdout, " s11 S-GW ip ......: %s/%d\n",
// inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S11)),
// mme_config_p->ipv4.sgw_ip_netmask_for_S11);
fprintf(stdout, " s11 MME iface ....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S11);
fprintf(stdout, " s11 S-GW ip ......: %s\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S11)));
fprintf(stdout, "- ITTI:\n");
fprintf(stdout, " queue size .......: %u (bytes)\n", mme_config_p->itti_config.queue_size);
fprintf(stdout, " log file .........: %s\n", mme_config_p->itti_config.log_file);
fprintf(stdout, "- SCTP:\n");
fprintf(stdout, " in streams .......: %u\n", mme_config_p->sctp_config.in_streams);
fprintf(stdout, " out streams ......: %u\n", mme_config_p->sctp_config.out_streams);
fprintf(stdout, "- GUMMEI:\n");
fprintf(stdout, " mme group ids ....:\n ");
DISPLAY_ARRAY(mme_config_p->gummei.nb_mme_gid, "| %u ", mme_config_p->gummei.mme_gid[i]);
fprintf(stdout, " mme codes ........:\n ");
DISPLAY_ARRAY(mme_config_p->gummei.nb_mmec, "| %u ", mme_config_p->gummei.mmec[i]);
fprintf(stdout, " plmns ............: (mcc.mnc:tac)\n");
for (j= 0; j < mme_config_p->gummei.nb_plmns; j++) {
if (mme_config_p->gummei.plmn_mnc_len[j] ==2 ) {
fprintf(stdout, " %3u.%3u:%u\n",
mme_config_p->gummei.plmn_mcc[j],
mme_config_p->gummei.plmn_mnc[j],
mme_config_p->gummei.plmn_tac[j]);
} else {
fprintf(stdout, " %3u.%03u:%u\n",
mme_config_p->gummei.plmn_mcc[j],
mme_config_p->gummei.plmn_mnc[j],
mme_config_p->gummei.plmn_tac[j]);
}
}
fprintf(stdout, "- S6A:\n");
fprintf(stdout, " conf file ........: %s\n", mme_config_p->s6a_config.conf_file);
}
static void usage(void)
{
fprintf(stdout, "==== EURECOM %s v%s ====\n", PACKAGE_NAME, PACKAGE_VERSION);
fprintf(stdout, "Please report any bug to: %s\n\n", PACKAGE_BUGREPORT);
fprintf(stdout, "Usage: oaisim_mme [options]\n\n");
fprintf(stdout, "Available options:\n");
fprintf(stdout, "-h Print this help and return\n");
fprintf(stdout, "-c<path>\n");
fprintf(stdout, " Set the configuration file for mme\n");
fprintf(stdout, " See template in UTILS/CONF\n");
fprintf(stdout, "-K<file>\n");
fprintf(stdout, " Output intertask messages to provided file\n");
fprintf(stdout, "-V Print %s version and return\n", PACKAGE_NAME);
fprintf(stdout, "-v[1-2] Debug level:\n");
fprintf(stdout, " 1 -> ASN1 XER printf on and ASN1 debug off\n");
fprintf(stdout, " 2 -> ASN1 XER printf on and ASN1 debug on\n");
}
extern void
nwGtpv1uDisplayBanner(void);
int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config_p)
{
int c;
mme_config_init(mme_config_p);
/* Parsing command line */
while ((c = getopt (argc, argv, "O:c:hi:K:v:V")) != -1) {
switch (c) {
case 'O':
case 'c': {
/* Store the given configuration file. If no file is given,
* then the default values will be used.
*/
int config_file_len = 0;
config_file_len = strlen(optarg);
mme_config_p->config_file = malloc(sizeof(char) * (config_file_len + 1));
memcpy(mme_config_p->config_file, optarg, config_file_len);
mme_config_p->config_file[config_file_len] = '\0';
}
break;
case 'v': {
mme_config_p->verbosity_level = atoi(optarg);
}
break;
case 'V': {
fprintf(stdout, "==== EURECOM %s v%s ====\n"
"Please report any bug to: %s\n", PACKAGE_NAME, PACKAGE_VERSION,
PACKAGE_BUGREPORT);
exit(0);
nwGtpv1uDisplayBanner();
}
break;
case 'K':
mme_config_p->itti_config.log_file = strdup(optarg);
break;
case 'h': /* Fall through */
default:
usage();
exit(0);
}
}
/* Parse the configuration file using libconfig */
if (config_parse_file(mme_config_p) != 0) {
return -1;
}
/* Display the configuration */
config_display(mme_config_p);
return 0;
}
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