Commit a196f81c authored by francescomani's avatar francescomani

Merge remote-tracking branch 'origin/develop' into NR_MAC_Multi_Rach_GlobalEdge

parents 1d9ce200 3b2d5037
This diff is collapsed.
...@@ -218,7 +218,7 @@ class HTMLManagement(): ...@@ -218,7 +218,7 @@ class HTMLManagement():
self.htmlFile.write(' <div id="build-tab" class="tab-pane fade">\n') self.htmlFile.write(' <div id="build-tab" class="tab-pane fade">\n')
self.htmlFile.write(' <table class="table" border = "1">\n') self.htmlFile.write(' <table class="table" border = "1">\n')
self.htmlFile.write(' <tr bgcolor = "#33CCFF" >\n') self.htmlFile.write(' <tr bgcolor = "#33CCFF" >\n')
self.htmlFile.write(' <th>Relative Time (ms)</th>\n') self.htmlFile.write(' <th>Relative Time (s)</th>\n')
self.htmlFile.write(' <th>Test Id</th>\n') self.htmlFile.write(' <th>Test Id</th>\n')
self.htmlFile.write(' <th>Test Desc</th>\n') self.htmlFile.write(' <th>Test Desc</th>\n')
self.htmlFile.write(' <th>Test Options</th>\n') self.htmlFile.write(' <th>Test Options</th>\n')
...@@ -399,6 +399,53 @@ class HTMLManagement(): ...@@ -399,6 +399,53 @@ class HTMLManagement():
self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </tr>\n')
self.htmlFile.close() self.htmlFile.close()
def CreateHtmlNextTabHeaderTestRow(self, collectInfo, allImagesSize, machine='eNB'):
if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):
return
self.htmlFile = open('test_results.html', 'a')
if bool(collectInfo) == False:
self.htmlFile.write(' <tr bgcolor = "red" >\n')
self.htmlFile.write(' <td colspan=' + str(5+self.htmlUEConnected) + '><b> ----IMAGES BUILDING FAILED - Unable to recover the image logs ---- </b></td>\n')
self.htmlFile.write(' </tr>\n')
else:
for image in collectInfo:
files = collectInfo[image]
# TabHeader for image logs on built shared and target images
self.htmlFile.write(' <tr bgcolor = "#F0F0F0" >\n')
self.htmlFile.write(' <td colspan=' + str(5+self.htmlUEConnected) + '><b> ---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + ' </b></td>\n')
self.htmlFile.write(' </tr>\n')
self.htmlFile.write(' <tr bgcolor = "#33CCFF" >\n')
self.htmlFile.write(' <th colspan="2">Element</th>\n')
self.htmlFile.write(' <th>Nb Errors</th>\n')
self.htmlFile.write(' <th>Nb Warnings</th>\n')
self.htmlFile.write(' <th colspan=' + str(1+self.htmlUEConnected) + '>Status</th>\n')
self.htmlFile.write(' </tr>\n')
for fil in files:
parameters = files[fil]
# TestRow for image logs on built shared and target images
self.htmlFile.write(' <tr>\n')
self.htmlFile.write(' <td colspan="2" bgcolor = "lightcyan" >' + fil + ' </td>\n')
if (parameters['errors'] == 0):
self.htmlFile.write(' <td bgcolor = "green" >' + str(parameters['errors']) + '</td>\n')
else:
self.htmlFile.write(' <td bgcolor = "red" >' + str(parameters['errors']) + '</td>\n')
if (parameters['warnings'] == 0):
self.htmlFile.write(' <td bgcolor = "green" >' + str(parameters['warnings']) + '</td>\n')
elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)):
self.htmlFile.write(' <td bgcolor = "orange" >' + str(parameters['warnings']) + '</td>\n')
else:
self.htmlFile.write(' <td bgcolor = "red" >' + str(parameters['warnings']) + '</td>\n')
if (parameters['errors'] == 0) and (parameters['warnings'] == 0):
self.htmlFile.write(' <th colspan=' + str(1+self.htmlUEConnected) + ' bgcolor = "green" ><font color="white">OK </font></th>\n')
elif (parameters['errors'] == 0) and ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)):
self.htmlFile.write(' <th colspan=' + str(1+self.htmlUEConnected) + ' bgcolor = "orange" ><font color="white">OK </font></th>\n')
else:
self.htmlFile.write(' <th colspan=' + str(1+self.htmlUEConnected) + ' bgcolor = "red" > NOT OK </th>\n')
self.htmlFile.write(' </tr>\n')
self.htmlFile.close()
def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue): def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue):
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
self.htmlFile = open('test_results.html', 'a') self.htmlFile = open('test_results.html', 'a')
......
...@@ -52,13 +52,11 @@ class SSHConnection(): ...@@ -52,13 +52,11 @@ class SSHConnection():
self.picocom_closure = True self.picocom_closure = True
def open(self, ipaddress, username, password): def open(self, ipaddress, username, password):
extraSshOptions = ''
count = 0 count = 0
connect_status = False connect_status = False
if ipaddress == '192.168.18.197':
extraSshOptions = ' -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
while count < 4: while count < 4:
self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress + extraSshOptions], timeout = 5) self.ssh = pexpect.spawn('ssh -o PubkeyAuthentication=no {}@{}'.format(username,ipaddress))
self.ssh.timeout = 5
self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT]) self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0: if self.sshresponse == 0:
self.ssh.sendline('yes') self.ssh.sendline('yes')
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<testCase id="090102"> <testCase id="090102">
<class>Initialize_OAI_UE</class> <class>Initialize_OAI_UE</class>
<desc>Initialize NR UE USRP</desc> <desc>Initialize NR UE USRP</desc>
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path .</Initialize_OAI_UE_args> <Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . --dlsch-parallel 4 </Initialize_OAI_UE_args>
<air_interface>NR</air_interface> <air_interface>NR</air_interface>
</testCase> </testCase>
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<testCase id="090104"> <testCase id="090104">
<class>Initialize_OAI_UE</class> <class>Initialize_OAI_UE</class>
<desc>Initialize NR UE USRP</desc> <desc>Initialize NR UE USRP</desc>
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path .</Initialize_OAI_UE_args> <Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . --dlsch-parallel 4 </Initialize_OAI_UE_args>
<air_interface>NR</air_interface> <air_interface>NR</air_interface>
</testCase> </testCase>
......
...@@ -1758,6 +1758,7 @@ set(PHY_SRC_UE ...@@ -1758,6 +1758,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_prach.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_prach.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_csi_rs.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_csi_rs.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
...@@ -3069,7 +3070,7 @@ target_link_libraries (ocp-gnb ...@@ -3069,7 +3070,7 @@ target_link_libraries (ocp-gnb
-Wl,--start-group -Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON
-Wl,--end-group z dl) -Wl,--end-group z dl)
......
...@@ -1289,7 +1289,10 @@ ...@@ -1289,7 +1289,10 @@
(Test5: MCS 9 273 PRBs), (Test5: MCS 9 273 PRBs),
(Test6: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols), (Test6: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols),
(Test7: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols), (Test7: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols),
(Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols)</desc> (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
(Test9: SC-FDMA, 50 PRBs),
(Test10: SC-FDMA, 75 PRBs),
(Test11: SC-FDMA, 3 DMRS)</desc>
<pre_compile_prog></pre_compile_prog> <pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog> <compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args> --phy_simulators -c </compile_prog_args> <compile_prog_args> --phy_simulators -c </compile_prog_args>
...@@ -1303,8 +1306,11 @@ ...@@ -1303,8 +1306,11 @@
-n100 -m9 -R273 -r273 -s5 -n100 -m9 -R273 -r273 -s5
-n100 -s5 -T 2 1 2 -U 2 0 2 -n100 -s5 -T 2 1 2 -U 2 0 2
-n100 -s5 -T 2 2 2 -U 2 1 2 -n100 -s5 -T 2 2 2 -U 2 1 2
-n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3</main_exec_args> -n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3
<tags>nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8</tags> -n100 -s20 -Z
-n100 -s20 -Z -r75
-n100 -s20 -Z -U 2 0 2</main_exec_args>
<tags>nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11</tags>
<search_expr_true>PUSCH test OK</search_expr_true> <search_expr_true>PUSCH test OK</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
<nruns>3</nruns> <nruns>3</nruns>
......
...@@ -129,7 +129,7 @@ ID = ENB_MAC_UE_DL_PDU_WITH_DATA ...@@ -129,7 +129,7 @@ ID = ENB_MAC_UE_DL_PDU_WITH_DATA
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
ID = ENB_MAC_SCHEDULING_REQUEST ID = ENB_MAC_SCHEDULING_REQUEST
DESC = MAC scheduling request detected for an UE DESC = MAC scheduling request detected for an UE
GROUP = ALL:MAC:ENB GROUP = ALL:MAC:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti
ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA
DESC = MAC downlink PDU for an UE DESC = MAC downlink PDU for an UE
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define DEFAULT_LIVE_PORT 2021 #define DEFAULT_LIVE_PORT 2021
#define NO_PREAMBLE -1 #define NO_PREAMBLE -1
#define NO_SR_RNTI -1
typedef struct { typedef struct {
int socket; int socket;
...@@ -48,6 +49,10 @@ typedef struct { ...@@ -48,6 +49,10 @@ typedef struct {
int rar_frame; int rar_frame;
int rar_subframe; int rar_subframe;
int rar_data; int rar_data;
/* SR */
int sr_rnti;
int sr_frame;
int sr_subframe;
/* NR traces */ /* NR traces */
/* NR ul */ /* NR ul */
...@@ -80,6 +85,15 @@ typedef struct { ...@@ -80,6 +85,15 @@ typedef struct {
/* runtime vars */ /* runtime vars */
int cur_mib; int cur_mib;
int cur_sib; int cur_sib;
/* hack to report UE id:
* each time we see a rnti, we allocate the next ue_id
* (two separate versions for lte and nr)
*/
int lte_rnti_to_ueid[65536];
int lte_next_ue_id;
int nr_rnti_to_ueid[65536];
int nr_next_ue_id;
} ev_data; } ev_data;
/****************************************************************************/ /****************************************************************************/
...@@ -87,7 +101,8 @@ typedef struct { ...@@ -87,7 +101,8 @@ typedef struct {
/****************************************************************************/ /****************************************************************************/
void trace_lte(ev_data *d, int direction, int rnti_type, int rnti, void trace_lte(ev_data *d, int direction, int rnti_type, int rnti,
int frame, int subframe, void *buf, int bufsize, int preamble) int frame, int subframe, void *buf, int bufsize, int preamble,
int sr_rnti)
{ {
ssize_t ret; ssize_t ret;
int fsf; int fsf;
...@@ -102,6 +117,18 @@ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti, ...@@ -102,6 +117,18 @@ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti,
PUTC(&d->buf, MAC_LTE_RNTI_TAG); PUTC(&d->buf, MAC_LTE_RNTI_TAG);
PUTC(&d->buf, (rnti>>8) & 255); PUTC(&d->buf, (rnti>>8) & 255);
PUTC(&d->buf, rnti & 255); PUTC(&d->buf, rnti & 255);
/* put UE id */
if (rnti < 0 || rnti > 65535) { printf("bad rnti!\n"); exit(1); }
/* if no UE id allocated for this rnti then allocate the next one */
if (d->lte_rnti_to_ueid[rnti] == -1) {
d->lte_rnti_to_ueid[rnti] = d->lte_next_ue_id;
d->lte_next_ue_id++;
}
PUTC(&d->buf, MAC_LTE_UEID_TAG);
PUTC(&d->buf, (d->lte_rnti_to_ueid[rnti]>>8) & 255);
PUTC(&d->buf, d->lte_rnti_to_ueid[rnti] & 255);
} }
/* for newer version of wireshark? */ /* for newer version of wireshark? */
...@@ -118,6 +145,25 @@ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti, ...@@ -118,6 +145,25 @@ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti,
PUTC(&d->buf, 0); /* rach attempt - always 0 for us (not sure of this) */ PUTC(&d->buf, 0); /* rach attempt - always 0 for us (not sure of this) */
} }
if (sr_rnti != NO_SR_RNTI) {
PUTC(&d->buf, MAC_LTE_SR_TAG);
PUTC(&d->buf, 0); /* number of items byte 1 */
PUTC(&d->buf, 1); /* number of items byte 2 */
/* put UE id */
if (sr_rnti < 0 || sr_rnti > 65535) { printf("bad sr rnti!\n"); exit(1); }
/* if no UE id allocated for this rnti then allocate the next one */
if (d->lte_rnti_to_ueid[sr_rnti] == -1) {
d->lte_rnti_to_ueid[sr_rnti] = d->lte_next_ue_id;
d->lte_next_ue_id++;
}
PUTC(&d->buf, (d->lte_rnti_to_ueid[sr_rnti]>>8) & 255);
PUTC(&d->buf, d->lte_rnti_to_ueid[sr_rnti] & 255);
PUTC(&d->buf, (sr_rnti>>8) & 255);
PUTC(&d->buf, sr_rnti & 255);
}
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG); PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
for (i = 0; i < bufsize; i++) for (i = 0; i < bufsize; i++)
...@@ -135,7 +181,7 @@ void ul(void *_d, event e) ...@@ -135,7 +181,7 @@ void ul(void *_d, event e)
trace_lte(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i, trace_lte(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i,
e.e[d->ul_frame].i, e.e[d->ul_subframe].i, e.e[d->ul_frame].i, e.e[d->ul_subframe].i,
e.e[d->ul_data].b, e.e[d->ul_data].bsize, e.e[d->ul_data].b, e.e[d->ul_data].bsize,
NO_PREAMBLE); NO_PREAMBLE, NO_SR_RNTI);
} }
void dl(void *_d, event e) void dl(void *_d, event e)
...@@ -154,7 +200,7 @@ void dl(void *_d, event e) ...@@ -154,7 +200,7 @@ void dl(void *_d, event e)
e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i, e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i,
e.e[d->dl_frame].i, e.e[d->dl_subframe].i, e.e[d->dl_frame].i, e.e[d->dl_subframe].i,
e.e[d->dl_data].b, e.e[d->dl_data].bsize, e.e[d->dl_data].b, e.e[d->dl_data].bsize,
NO_PREAMBLE); NO_PREAMBLE, NO_SR_RNTI);
} }
void mib(void *_d, event e) void mib(void *_d, event e)
...@@ -169,7 +215,7 @@ void mib(void *_d, event e) ...@@ -169,7 +215,7 @@ void mib(void *_d, event e)
trace_lte(d, DIRECTION_DOWNLINK, NO_RNTI, 0, trace_lte(d, DIRECTION_DOWNLINK, NO_RNTI, 0,
e.e[d->mib_frame].i, e.e[d->mib_subframe].i, e.e[d->mib_frame].i, e.e[d->mib_subframe].i,
e.e[d->mib_data].b, e.e[d->mib_data].bsize, e.e[d->mib_data].b, e.e[d->mib_data].bsize,
NO_PREAMBLE); NO_PREAMBLE, NO_SR_RNTI);
} }
void preamble(void *_d, event e) void preamble(void *_d, event e)
...@@ -178,7 +224,7 @@ void preamble(void *_d, event e) ...@@ -178,7 +224,7 @@ void preamble(void *_d, event e)
trace_lte(d, DIRECTION_UPLINK, NO_RNTI, 0, trace_lte(d, DIRECTION_UPLINK, NO_RNTI, 0,
e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i, e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i,
NULL, 0, NULL, 0,
e.e[d->preamble_preamble].i); e.e[d->preamble_preamble].i, NO_SR_RNTI);
} }
void rar(void *_d, event e) void rar(void *_d, event e)
...@@ -187,7 +233,16 @@ void rar(void *_d, event e) ...@@ -187,7 +233,16 @@ void rar(void *_d, event e)
trace_lte(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i, trace_lte(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i,
e.e[d->rar_frame].i, e.e[d->rar_subframe].i, e.e[d->rar_frame].i, e.e[d->rar_subframe].i,
e.e[d->rar_data].b, e.e[d->rar_data].bsize, e.e[d->rar_data].b, e.e[d->rar_data].bsize,
NO_PREAMBLE); NO_PREAMBLE, NO_SR_RNTI);
}
void sr(void *_d, event e)
{
ev_data *d = _d;
trace_lte(d, DIRECTION_UPLINK, NO_RNTI, 0,
e.e[d->sr_frame].i, e.e[d->sr_subframe].i,
NULL, 0,
NO_PREAMBLE, e.e[d->sr_rnti].i);
} }
/****************************************************************************/ /****************************************************************************/
...@@ -198,6 +253,7 @@ void rar(void *_d, event e) ...@@ -198,6 +253,7 @@ void rar(void *_d, event e)
#define MAC_NR_PAYLOAD_TAG 0x01 #define MAC_NR_PAYLOAD_TAG 0x01
#define MAC_NR_RNTI_TAG 0x02 #define MAC_NR_RNTI_TAG 0x02
#define MAC_NR_UEID_TAG 0x03
#define MAC_NR_FRAME_SLOT_TAG 0x07 #define MAC_NR_FRAME_SLOT_TAG 0x07
#define NR_FDD_RADIO 1 #define NR_FDD_RADIO 1
...@@ -225,6 +281,18 @@ void trace_nr(ev_data *d, int direction, int rnti_type, int rnti, ...@@ -225,6 +281,18 @@ void trace_nr(ev_data *d, int direction, int rnti_type, int rnti,
PUTC(&d->buf, MAC_NR_RNTI_TAG); PUTC(&d->buf, MAC_NR_RNTI_TAG);
PUTC(&d->buf, (rnti>>8) & 255); PUTC(&d->buf, (rnti>>8) & 255);
PUTC(&d->buf, rnti & 255); PUTC(&d->buf, rnti & 255);
/* put UE id */
if (rnti < 0 || rnti > 65535) { printf("bad rnti!\n"); exit(1); }
/* if no UE id allocated for this rnti then allocate the next one */
if (d->nr_rnti_to_ueid[rnti] == -1) {
d->nr_rnti_to_ueid[rnti] = d->nr_next_ue_id;
d->nr_next_ue_id++;
}
PUTC(&d->buf, MAC_NR_UEID_TAG);
PUTC(&d->buf, (d->nr_rnti_to_ueid[rnti]>>8) & 255);
PUTC(&d->buf, d->nr_rnti_to_ueid[rnti] & 255);
} }
#if 0 #if 0
...@@ -298,7 +366,7 @@ void nr_rar(void *_d, event e) ...@@ -298,7 +366,7 @@ void nr_rar(void *_d, event e)
/****************************************************************************/ /****************************************************************************/
void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
int preamble_id, int rar_id, int preamble_id, int rar_id, int sr_id,
int nr_ul_id, int nr_dl_id, int nr_mib_id, int nr_rar_id) int nr_ul_id, int nr_dl_id, int nr_mib_id, int nr_rar_id)
{ {
database_event_format f; database_event_format f;
...@@ -321,6 +389,9 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, ...@@ -321,6 +389,9 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
d->rar_frame = -1; d->rar_frame = -1;
d->rar_subframe = -1; d->rar_subframe = -1;
d->rar_data = -1; d->rar_data = -1;
d->sr_rnti = -1;
d->sr_frame = -1;
d->sr_subframe = -1;
d->nr_ul_rnti = -1; d->nr_ul_rnti = -1;
d->nr_ul_frame = -1; d->nr_ul_frame = -1;
...@@ -407,6 +478,18 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, ...@@ -407,6 +478,18 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 || if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 ||
d->rar_data == -1) goto error; d->rar_data == -1) goto error;
/* sr: rnti, frame, subframe */
f = get_format(database, sr_id);
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->sr_rnti);
G("frame", "int", d->sr_frame);
G("subframe", "int", d->sr_subframe);
}
if (d->sr_rnti == -1 || d->sr_frame == -1 || d->sr_subframe == -1)
goto error;
/* NR ul: rnti, frame, slot, data */ /* NR ul: rnti, frame, slot, data */
f = get_format(database, nr_ul_id); f = get_format(database, nr_ul_id);
...@@ -530,6 +613,7 @@ int main(int n, char **v) ...@@ -530,6 +613,7 @@ int main(int n, char **v)
int i; int i;
int ul_id, dl_id, mib_id, preamble_id, rar_id; int ul_id, dl_id, mib_id, preamble_id, rar_id;
int nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id; int nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id;
int sr_id;
ev_data d; ev_data d;
char *ip = DEFAULT_IP; char *ip = DEFAULT_IP;
int port = DEFAULT_PORT; int port = DEFAULT_PORT;
...@@ -538,6 +622,11 @@ int main(int n, char **v) ...@@ -538,6 +622,11 @@ int main(int n, char **v)
int live = 0; int live = 0;
memset(&d, 0, sizeof(ev_data)); memset(&d, 0, sizeof(ev_data));
for (i = 0; i < 65536; i++) {
d.lte_rnti_to_ueid[i] = -1;
d.nr_rnti_to_ueid[i] = -1;
}
for (i = 1; i < n; i++) { for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
if (!strcmp(v[i], "-d")) { if(i>n-2)usage(); database_filename = v[++i]; continue; } if (!strcmp(v[i], "-d")) { if(i>n-2)usage(); database_filename = v[++i]; continue; }
...@@ -599,6 +688,7 @@ int main(int n, char **v) ...@@ -599,6 +688,7 @@ int main(int n, char **v)
on_off(database, "ENB_PHY_MIB", is_on, 1); on_off(database, "ENB_PHY_MIB", is_on, 1);
on_off(database, "ENB_PHY_INITIATE_RA_PROCEDURE", is_on, 1); on_off(database, "ENB_PHY_INITIATE_RA_PROCEDURE", is_on, 1);
on_off(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA", is_on, 1); on_off(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA", is_on, 1);
on_off(database, "ENB_MAC_SCHEDULING_REQUEST", is_on, 1);
on_off(database, "GNB_MAC_UL_PDU_WITH_DATA", is_on, 1); on_off(database, "GNB_MAC_UL_PDU_WITH_DATA", is_on, 1);
on_off(database, "GNB_MAC_DL_PDU_WITH_DATA", is_on, 1); on_off(database, "GNB_MAC_DL_PDU_WITH_DATA", is_on, 1);
...@@ -621,13 +711,14 @@ int main(int n, char **v) ...@@ -621,13 +711,14 @@ int main(int n, char **v)
mib_id = event_id_from_name(database, "ENB_PHY_MIB"); mib_id = event_id_from_name(database, "ENB_PHY_MIB");
preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE"); preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE");
rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA"); rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA");
sr_id = event_id_from_name(database, "ENB_MAC_SCHEDULING_REQUEST");
nr_ul_id = event_id_from_name(database, "GNB_MAC_UL_PDU_WITH_DATA"); nr_ul_id = event_id_from_name(database, "GNB_MAC_UL_PDU_WITH_DATA");
nr_dl_id = event_id_from_name(database, "GNB_MAC_DL_PDU_WITH_DATA"); nr_dl_id = event_id_from_name(database, "GNB_MAC_DL_PDU_WITH_DATA");
nr_mib_id = event_id_from_name(database, "GNB_PHY_MIB"); nr_mib_id = event_id_from_name(database, "GNB_PHY_MIB");
nr_rar_id = event_id_from_name(database, "GNB_MAC_DL_RAR_PDU_WITH_DATA"); nr_rar_id = event_id_from_name(database, "GNB_MAC_DL_RAR_PDU_WITH_DATA");
setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id, setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id, sr_id,
nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id); nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id);
register_handler_function(h, ul_id, ul, &d); register_handler_function(h, ul_id, ul, &d);
...@@ -635,6 +726,7 @@ int main(int n, char **v) ...@@ -635,6 +726,7 @@ int main(int n, char **v)
register_handler_function(h, mib_id, mib, &d); register_handler_function(h, mib_id, mib, &d);
register_handler_function(h, preamble_id, preamble, &d); register_handler_function(h, preamble_id, preamble, &d);
register_handler_function(h, rar_id, rar, &d); register_handler_function(h, rar_id, rar, &d);
register_handler_function(h, sr_id, sr, &d);
register_handler_function(h, nr_ul_id, nr_ul, &d); register_handler_function(h, nr_ul_id, nr_ul, &d);
register_handler_function(h, nr_dl_id, nr_dl, &d); register_handler_function(h, nr_dl_id, nr_dl, &d);
...@@ -662,7 +754,7 @@ int main(int n, char **v) ...@@ -662,7 +754,7 @@ int main(int n, char **v)
if (e.type == -1) break; if (e.type == -1) break;
if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id || if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id ||
e.type == preamble_id || e.type == rar_id || e.type == preamble_id || e.type == rar_id || e.type == sr_id ||
e.type == nr_ul_id || e.type == nr_dl_id || e.type == nr_ul_id || e.type == nr_dl_id ||
e.type == nr_mib_id || e.type == nr_rar_id)) continue; e.type == nr_mib_id || e.type == nr_rar_id)) continue;
......
...@@ -11,26 +11,7 @@ ...@@ -11,26 +11,7 @@
* *
* Copyright (C) 2009 Martin Mathieson. All rights reserved. * Copyright (C) 2009 Martin Mathieson. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * SPDX-License-Identifier: BSD-2-Clause
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE
*/ */
#ifndef __COMMON_UTILS_T_TRACER_PACKET_MAC_LTE__H__ #ifndef __COMMON_UTILS_T_TRACER_PACKET_MAC_LTE__H__
...@@ -67,9 +48,9 @@ ...@@ -67,9 +48,9 @@
/* and implemented by this dissector, using the definitions */ /* and implemented by this dissector, using the definitions */
/* below. A link to an example program showing you how to encode */ /* below. A link to an example program showing you how to encode */
/* these headers and send LTE MAC PDUs on a UDP socket is */ /* these headers and send LTE MAC PDUs on a UDP socket is */
/* provided at https://wiki.wireshark.org/MAC-LTE */ /* provided at https://wiki.wireshark.org/MAC-LTE */
/* */ /* */
/* A heuristic dissecter (enabled by a preference) will */ /* A heuristic dissector (enabled by a preference) will */
/* recognise a signature at the beginning of these frames. */ /* recognise a signature at the beginning of these frames. */
/*****************************************************************/ /*****************************************************************/
...@@ -126,18 +107,25 @@ ...@@ -126,18 +107,25 @@
MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte), MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte),
HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */ HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */
#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL 0x0C #define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL_TAG 0x0C
/* 0 byte */ /* 0 byte */
#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL 0x0D #define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL_TAG 0x0D
/* 0 byte */ /* 0 byte */
#define MAC_LTE_CE_MODE 0x0E #define MAC_LTE_CE_MODE_TAG 0x0E
/* 1 byte containing mac_lte_ce_mode enum value */ /* 1 byte containing mac_lte_ce_mode enum value */
#define MAC_LTE_NB_MODE 0x0F #define MAC_LTE_NB_MODE_TAG 0x0F
/* 1 byte containing mac_lte_nb_mode enum value */ /* 1 byte containing mac_lte_nb_mode enum value */
#define MAC_LTE_N_UL_RB_TAG 0x10
/* 1 byte containing the number of UL resource blocks: 6, 15, 25, 50, 75 or 100 */
#define MAC_LTE_SR_TAG 0x11
/* 2 bytes for the number of items, followed by that number of ueid, rnti (2 bytes each) */
/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU /* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
continues until the end of the frame) */ continues until the end of the frame) */
#define MAC_LTE_PAYLOAD_TAG 0x01 #define MAC_LTE_PAYLOAD_TAG 0x01
......
This diff is collapsed.
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libresolver \
-I$(top_srcdir)/libbuffers \
-I$(top_srcdir)/libui
SUBDIRS = libparser libresolver libbuffers libui .
itti_analyzer_LDADD = \
$(top_builddir)/libui/libui.la \
$(top_builddir)/libparser/libparser.la \
$(top_builddir)/libresolver/libresolver.la \
$(top_builddir)/libbuffers/libbuffers.la
bin_PROGRAMS = itti_analyzer
To run itti_analyzer, please perform the following actions:
1) apt-get install autotools-dev automake libtool
2) libtoolize
3) ./autogen.sh
4) ./configure
5) make
6) ./itti_analyzer
\ No newline at end of file
#! /bin/sh
aclocal \
&& autoheader \
&& automake --add-missing \
&& autoconf
\ No newline at end of file
/*
* 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
*/
/** @brief Intertask Interface common types
* Contains type definitions used for generating and parsing ITTI messages.
* @author Laurent Winckel <laurent.winckel@eurecom.fr>
*/
#ifndef _ITTI_TYPES_H_
#define _ITTI_TYPES_H_
#include <stdint.h>
#define CHARS_TO_UINT32(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1))
#define MESSAGE_NUMBER_CHAR_FORMAT "%11u"
/* Intertask message types */
enum itti_message_types_e
{
ITTI_DUMP_XML_DEFINITION = CHARS_TO_UINT32 ('\n', 'I', 'x', 'd'),
ITTI_DUMP_XML_DEFINITION_END = CHARS_TO_UINT32 ('i', 'X', 'D', '\n'),
ITTI_DUMP_MESSAGE_TYPE = CHARS_TO_UINT32 ('\n', 'I', 'm', 's'),
ITTI_DUMP_MESSAGE_TYPE_END = CHARS_TO_UINT32 ('i', 'M', 'S', '\n'),
ITTI_STATISTIC_MESSAGE_TYPE = CHARS_TO_UINT32 ('\n', 'I', 's', 't'),
ITTI_STATISTIC_MESSAGE_TYPE_END = CHARS_TO_UINT32 ('i', 'S', 'T', '\n'),
/* This signal is not meant to be used by remote analyzer */
ITTI_DUMP_EXIT_SIGNAL = CHARS_TO_UINT32 ('e', 'X', 'I', 'T'),
};
typedef uint32_t itti_message_types_t;
/* Message header is the common part that should never change between
* remote process and this one.
*/
typedef struct {
/* The size of this structure */
uint32_t message_size;
itti_message_types_t message_type;
} itti_socket_header_t;
typedef struct {
char message_number_char[12]; /* 9 chars are needed to store an unsigned 32 bits value in decimal, but must be a multiple of 32 bits to avoid alignment issues */
} itti_signal_header_t;
#define INSTANCE_DEFAULT (UINT16_MAX - 1)
#define INSTANCE_ALL (UINT16_MAX)
typedef uint16_t instance_t;
#endif
/*
* 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
*/
/*
* logs.h
*
* Created on: Nov 22, 2013
* Author: Laurent Winckel
*/
#ifndef LOGS_H_
#define LOGS_H_
/* Added definition of the g_info log function to complete the set of log functions from "gmessages.h" */
#include <glib/gmessages.h>
#ifdef G_HAVE_ISO_VARARGS
#define g_info(...) g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_INFO, \
__VA_ARGS__)
#else
static void
g_info (const gchar *format,
...)
{
va_list args;
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args);
va_end (args);
}
#endif
#endif /* LOGS_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
*/
#include <errno.h>
#include <string.h>
#ifndef RC_H_
#define RC_H_
#define RC_OK 0
#define RC_FAIL -1
#define RC_BAD_PARAM -2
#define RC_NULL_POINTER -3
static const char * const rc_strings[] =
{"Ok", "fail", "bad parameter", "null pointer"};
#define CHECK_FCT(fCT) \
do { \
int rET; \
if ((rET = fCT) != RC_OK) { \
fprintf(stderr, #fCT" has failed (%s:%d)\n", __FILE__, __LINE__); \
return rET; \
} \
} while(0)
#define CHECK_FCT_POSIX(fCT) \
do { \
if (fCT == -1) { \
fprintf(stderr, #fCT" has failed (%d:%s) (%s:%d)\n", errno, \
strerror(errno), __FILE__, __LINE__); \
return RC_FAIL; \
} \
} while(0)
#define CHECK_FCT_DO(fCT, dO) \
do { \
int rET; \
if ((rET = fCT) != RC_OK) { \
fprintf(stderr, #fCT" has returned %d (%s:%d)\n", rET, __FILE__, __LINE__); \
dO; \
} \
} while(0)
#define CHECK_BUFFER(bUFFER) \
do { \
if ((bUFFER) == NULL) { \
fprintf(stderr, #bUFFER" is NULL (%s:%d)\n", __FILE__, __LINE__); \
return RC_NULL_POINTER; \
} \
} while(0)
#endif /* RC_H_ */
AC_PREREQ([2.68])
define([svnversion], esyscmd([sh -c "svnversion ..|tr -d '\n'"]))
AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision])
AC_INIT([itti_analyzer], [0.2.svnversion], [openair_admin@eurecom.fr])
AC_CANONICAL_BUILD
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.11 silent-rules])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
AM_SILENT_RULES([yes])
AM_PROG_LIBTOOL
AC_PROG_RANLIB
AC_PROG_CXX
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([socket])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([strstr])
AC_CHECK_HEADERS([arpa/inet.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([libintl.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_LIB(m, log10)
PKG_CHECK_MODULES(XML2, [libxml-2.0 >= 2.7.8], [HAVE_XML2=true], [AC_MSG_ERROR(lixml-2.0 not installed)])
CFLAGS="$CFLAGS $XML2_CFLAGS"
LIBS="$LIBS $XML2_LIBS"
AM_PATH_GTK_3_0(3.0.0, [], AC_MSG_ERROR(Requirement not met: gtk >= 3.0.0))
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
dnl Add these flags
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -Wshadow"
CFLAGS="$CFLAGS -Wcast-align"
CFLAGS="$CFLAGS -Wchar-subscripts"
CFLAGS="$CFLAGS -Wmissing-prototypes"
CFLAGS="$CFLAGS -Wmissing-declarations"
CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
AC_SUBST([AM_CFLAGS])
AC_SUBST(ADD_CFLAGS)
dnl *** Autoconf support ***
AC_ARG_ENABLE(autoconf,
[ --disable-autoconf disable automatic generation of configure script ],
enable_autoconf=$enableval, enable_autoconf=yes
)
AC_PATH_PROG(AUTOCONF, autoconf, @echo autoconf not available)
AC_PATH_PROG(AUTOHEADER, autoheader, @echo autoheader not available)
if test -z "$AUTOCONF"; then enable_autoconf=no ; fi
if test -z "$AUTOHEADER"; then enable_autoconf=no ; fi
if test x$enable_autoconf = xyes; then
CONFIGURE_DEPENDS="configure.in aclocal.m4"
fi
AC_SUBST(CONFIGURE_DEPENDS)
AC_CONFIG_FILES(
libbuffers/Makefile \
libparser/Makefile \
libresolver/Makefile \
libui/Makefile \
Makefile \
)
AC_OUTPUT
<?xml version="1.0" encoding="UTF-8"?>
<filters>
<messages>
<INITIALIZE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<ACTIVATE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<DEACTIVATE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<TERMINATE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<MESSAGE_TEST enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<ERROR_LOG enabled="1" foreground_color="#000000" background_color="#ff8080"/>
<WARNING_LOG enabled="1" foreground_color="#303030" background_color="#fff050"/>
<NOTICE_LOG enabled="0" foreground_color="#585858" background_color="#ffffa0"/>
<INFO_LOG enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<DEBUG_LOG enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<GENERIC_LOG enabled="1" foreground_color="#246b24" background_color="#ffffff"/>
<TIMER_HAS_EXPIRED enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<PHY_DEACTIVATE_REQ enabled="1" foreground_color="#000000" background_color="#bef2ff"/>
<PHY_FIND_CELL_REQ enabled="1" foreground_color="#000000" background_color="#bef2ff"/>
<PHY_FIND_NEXT_CELL_REQ enabled="1" foreground_color="#000000" background_color="#bef2ff"/>
<PHY_FIND_CELL_IND enabled="1" foreground_color="#585858" background_color="#bef2ff"/>
<RRC_MAC_IN_SYNC_IND enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_OUT_OF_SYNC_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_BCCH_DATA_REQ enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_BCCH_DATA_IND enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_CCCH_DATA_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_CCCH_DATA_CNF enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_CCCH_DATA_IND enabled="1" foreground_color="#585858" background_color="#dfb9fc"/>
<RRC_MAC_MCCH_DATA_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_MCCH_DATA_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_DCCH_DATA_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_DCCH_DATA_IND enabled="1" foreground_color="#585858" background_color="#a7b1de"/>
<RRC_STATE_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_CONFIGURATION_REQ enabled="1" foreground_color="#ffffff" background_color="#4d2a73"/>
<NAS_CELL_SELECTION_REQ enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_CONN_ESTABLI_REQ enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_UPLINK_DATA_REQ enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_RAB_ESTABLI_RSP enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_CELL_SELECTION_CNF enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_CELL_SELECTION_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_PAGING_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_CONN_ESTABLI_CNF enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_CONN_RELEASE_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_UPLINK_DATA_CNF enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_DOWNLINK_DATA_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<S1AP_REGISTER_ENB_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_REGISTER_ENB_CNF enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_DEREGISTERED_ENB_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_NAS_FIRST_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_UPLINK_NAS enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CAPABILITIES_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_INITIAL_CONTEXT_SETUP_RESP enabled="1" foreground_color="#19431e" background_color="#cbffb1"/>
<S1AP_INITIAL_CONTEXT_SETUP_FAIL enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_NAS_NON_DELIVERY_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CONTEXT_RELEASE_RESP enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CTXT_MODIFICATION_RESP enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CTXT_MODIFICATION_FAIL enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_DOWNLINK_NAS enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_INITIAL_CONTEXT_SETUP_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_UE_CTXT_MODIFICATION_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_PAGING_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CONTEXT_RELEASE_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<SCTP_NEW_ASSOCIATION_REQ enabled="0" foreground_color="#000000" background_color="#aefeff"/>
<SCTP_NEW_ASSOCIATION_RESP enabled="0" foreground_color="#585858" background_color="#aefeff"/>
<SCTP_NEW_ASSOCIATION_IND enabled="1" foreground_color="#585858" background_color="#aefeff"/>
<SCTP_REGISTER_UPPER_LAYER enabled="1" foreground_color="#585858" background_color="#aefeff"/>
<SCTP_DATA_REQ enabled="1" foreground_color="#000000" background_color="#aefeff"/>
<SCTP_DATA_IND enabled="1" foreground_color="#585858" background_color="#aefeff"/>
<RRC_RAL_SYSTEM_CONFIGURATION_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_SYSTEM_INFORMATION_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_SCAN_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_SCAN_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONFIGURE_THRESHOLD_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONFIGURE_THRESHOLD_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_MEASUREMENT_REPORT_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_ESTABLISHMENT_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_ESTABLISHMENT_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_ESTABLISHMENT_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_REESTABLISHMENT_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RECONFIGURATION_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RELEASE_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RELEASE_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RELEASE_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<NAS_UPLINK_DATA_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
</messages>
<origin_tasks>
<TASK_UNKNOWN enabled="1"/>
<TASK_TIMER enabled="1"/>
<TASK_L2L1 enabled="1"/>
<TASK_BM enabled="1"/>
<TASK_PHY_ENB enabled="1"/>
<TASK_MAC_ENB enabled="1"/>
<TASK_RLC_ENB enabled="1"/>
<TASK_PDCP_ENB enabled="1"/>
<TASK_DATA_FORWARDING enabled="1"/>
<TASK_END_MARKER enabled="1"/>
<TASK_RRC_ENB enabled="1"/>
<TASK_RAL_ENB enabled="1"/>
<TASK_S1AP enabled="1"/>
<TASK_X2AP enabled="1"/>
<TASK_SCTP enabled="1"/>
<TASK_ENB_APP enabled="1"/>
<TASK_PHY_UE enabled="1"/>
<TASK_MAC_UE enabled="1"/>
<TASK_RLC_UE enabled="1"/>
<TASK_PDCP_UE enabled="1"/>
<TASK_RRC_UE enabled="1"/>
<TASK_NAS_UE enabled="1"/>
<TASK_RAL_UE enabled="1"/>
</origin_tasks>
<destination_tasks>
<TASK_UNKNOWN enabled="1"/>
<TASK_TIMER enabled="1"/>
<TASK_L2L1 enabled="1"/>
<TASK_BM enabled="1"/>
<TASK_PHY_ENB enabled="1"/>
<TASK_MAC_ENB enabled="1"/>
<TASK_RLC_ENB enabled="1"/>
<TASK_PDCP_ENB enabled="1"/>
<TASK_DATA_FORWARDING enabled="1"/>
<TASK_END_MARKER enabled="1"/>
<TASK_RRC_ENB enabled="1"/>
<TASK_RAL_ENB enabled="1"/>
<TASK_S1AP enabled="1"/>
<TASK_X2AP enabled="1"/>
<TASK_SCTP enabled="1"/>
<TASK_ENB_APP enabled="1"/>
<TASK_PHY_UE enabled="1"/>
<TASK_MAC_UE enabled="1"/>
<TASK_RLC_UE enabled="1"/>
<TASK_PDCP_UE enabled="1"/>
<TASK_RRC_UE enabled="1"/>
<TASK_NAS_UE enabled="1"/>
<TASK_RAL_UE enabled="1"/>
</destination_tasks>
</filters>
This diff is collapsed.
This diff is collapsed.
/*
* 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
*/
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libxml/parser.h>
#include "xml_parse.h"
#include "resolvers.h"
#include "locate_root.h"
#include "file.h"
#include "ui_main_screen.h"
#include "rc.h"
#define G_LOG_LEVELS (G_LOG_LEVEL_ERROR | \
G_LOG_LEVEL_CRITICAL | \
G_LOG_LEVEL_WARNING | \
G_LOG_LEVEL_MESSAGE | \
G_LOG_LEVEL_INFO | \
G_LOG_LEVEL_DEBUG)
int debug_buffers = 1;
int debug_parser = 0;
static void console_log_handler(const char *log_domain, GLogLevelFlags log_level,
const char *message, gpointer user_data)
{
GLogLevelFlags domain_log_level = (GLogLevelFlags) user_data;
time_t curr;
struct tm *today;
const char *level;
if (ui_main_data.log_flags & domain_log_level & log_level)
{
switch (log_level & G_LOG_LEVEL_MASK)
{
case G_LOG_LEVEL_ERROR:
level = "Err ";
break;
case G_LOG_LEVEL_CRITICAL:
level = "Crit";
break;
case G_LOG_LEVEL_WARNING:
level = "Warn";
break;
case G_LOG_LEVEL_MESSAGE:
level = "Msg ";
break;
case G_LOG_LEVEL_INFO:
level = "Info";
break;
case G_LOG_LEVEL_DEBUG:
level = "Dbg ";
break;
default:
fprintf(stderr, "unknown log_level %u\n", log_level);
level = NULL;
g_assert_not_reached();
break;
}
/* create a "timestamp" */
time(&curr);
today = localtime(&curr);
fprintf(stderr, "%02u:%02u:%02u %-9s %s %s\n", today->tm_hour, today->tm_min, today->tm_sec,
log_domain != NULL ? log_domain : "", level, message);
}
}
int main(int argc, char *argv[])
{
int ret = 0;
GLogLevelFlags log_flags;
log_flags = (GLogLevelFlags)
(G_LOG_LEVEL_ERROR |
G_LOG_LEVEL_CRITICAL |
G_LOG_LEVEL_WARNING |
G_LOG_LEVEL_MESSAGE |
G_LOG_LEVEL_INFO |
G_LOG_LEVEL_DEBUG);
/* This initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
* library used.
*/
LIBXML_TEST_VERSION;
xmlInitParser();
/* Initialize the widget set */
gtk_init(&argc, &argv);
/* Parse command line options */
ui_gtk_parse_arg (argc, argv);
/* Set log handlers:
* Domain, Levels, Handler, Domain enabled levels */
g_log_set_handler( NULL, log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS));
g_log_set_handler("BUFFERS", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("PARSER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("RESOLVER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("UI", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("UI_CB", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS));
g_log_set_handler("UI_FILTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("UI_INTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS));
g_log_set_handler("UI_TREE", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
CHECK_FCT(ui_gtk_initialize(argc, argv));
/* Enter the main event loop, and wait for user interaction */
gtk_main ();
/* Free the global variables that may
* have been allocated by the parser.
*/
xmlCleanupParser ();
return ret;
}
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libui
noinst_LTLIBRARIES = libbuffers.la
libbuffers_la_LDFLAGS = -all-static
libbuffers_la_SOURCES = \
buffers.c buffers.h \
file.c file.h \
socket.c socket.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
*/
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define G_LOG_DOMAIN ("BUFFERS")
#include <glib.h>
#include "rc.h"
#include "buffers.h"
extern int debug_buffers;
static
int buffer_fetch(buffer_t *buffer, uint32_t offset, int size, void *value);
/* Try to fetch 8 bits unsigned from the buffer */
uint8_t buffer_get_uint8_t(buffer_t *buffer, uint32_t offset)
{
uint8_t value;
buffer_fetch(buffer, offset, 1, &value);
return value;
}
/* Try to fetch 16 bits unsigned from the buffer */
uint16_t buffer_get_uint16_t(buffer_t *buffer, uint32_t offset)
{
uint16_t value;
buffer_fetch(buffer, offset, 2, &value);
return value;
}
/* Try to fetch 32 bits unsigned from the buffer */
uint32_t buffer_get_uint32_t(buffer_t *buffer, uint32_t offset)
{
uint32_t value;
buffer_fetch(buffer, offset, 4, &value);
return value;
}
/* Try to fetch 64 bits unsigned from the buffer */
uint64_t buffer_get_uint64_t(buffer_t *buffer, uint32_t offset)
{
uint64_t value;
buffer_fetch(buffer, offset, 8, &value);
return value;
}
static
int buffer_fetch(buffer_t *buffer, uint32_t offset, int size, void *value)
{
if (buffer == NULL || value == NULL)
return -1;
if (size <= 0)
return -1;
if (buffer->size_bytes < ((offset >> 3) + size)) {
g_warning("Not enough data to fetch");
return -1;
}
memcpy(value, &buffer->data[offset >> 3], size);
buffer->buffer_current = &buffer->data[(offset >> 3) + size];
return 0;
}
int buffer_fetch_nbytes(buffer_t *buffer, uint32_t offset, int n_bytes, uint8_t *value)
{
if (buffer->size_bytes < ((offset >> 3) + n_bytes)) {
g_warning("Not enough data to fetch");
return -1;
}
memcpy(&value[0], &buffer->data[offset >> 3], n_bytes);
return 0;
}
int buffer_fetch_bits(buffer_t *buffer, uint32_t offset, int nbits, uint32_t *value)
{
uint32_t temp = 0;
int i;
if (buffer == NULL || value == NULL)
return RC_BAD_PARAM;
/* We cannot fetch more than 32 bits */
if (nbits > 32)
return RC_BAD_PARAM;
for (i = 0; i < nbits; i++)
{
temp |= ((buffer->data[(offset + i) / 8] >> ((offset + i) % 8)) & 1) << i;
}
*value = temp;
return RC_OK;
}
/**
* @brief Create a new buffer from data
* @param buffer caller reference where created buffer will be stored
* @param data Data to attach to the new buffer
* @param length Length of data buffer
* @param data_static flag that indicates if data pointer has been statically (= 0) or not (!= 0)
*/
int buffer_new_from_data(buffer_t **buffer, uint8_t *data, const uint32_t length,
int data_static)
{
buffer_t *new;
if (!buffer)
return RC_BAD_PARAM;
new = malloc(sizeof(buffer_t));
new->size_bytes = length;
if (data && length > 0) {
if (data_static == 0) {
new->data = malloc(sizeof(uint8_t) * new->size_bytes);
memcpy(new->data, data, new->size_bytes);
} else {
new->data = data;
}
new->buffer_current = &new->data[0];
} else {
new->buffer_current = NULL;
}
*buffer = new;
return 0;
}
#define INDENTED(fILE, x, y) \
do { \
int indentation = x; \
while(indentation--) fprintf(fILE, " "); \
y; \
} while(0)
#define INDENT_BREAK 20
void buffer_dump(buffer_t *buffer, FILE *to)
{
FILE *file = to;
uint32_t i;
if (!buffer)
return;
if (!to)
to = stdout;
fprintf(file, "<Buffer>\n");
INDENTED(file, 4, fprintf(file, "<Length>%u<Length>\n", buffer->size_bytes));
INDENTED(file, 4, fprintf(file, "<Bytes>\n"));
for (i = 0; i < buffer->size_bytes; i++)
{
if ((i % INDENT_BREAK) == 0)
fprintf(file, " ");
fprintf(file, "0x%02x ", buffer->data[i]);
if ((i % INDENT_BREAK) == (INDENT_BREAK - 1))
fprintf(file, "\n");
}
if ((i % INDENT_BREAK) != (INDENT_BREAK - 1))
fprintf(file, "\n");
INDENTED(file, 4, fprintf(file, "</Bytes>\n"));
fprintf(file, "</Buffer>\n");
}
int buffer_append_data(buffer_t *buffer, const uint8_t *data, const uint32_t length)
{
if (!buffer)
return -1;
if (data && length > 0) {
if (!buffer->data) {
buffer->size_bytes = length;
buffer->data = malloc(sizeof(uint8_t) * buffer->size_bytes);
memcpy(buffer->data, data, buffer->size_bytes);
} else {
buffer->data = realloc(buffer->data, sizeof(uint8_t) * (buffer->size_bytes + length));
memcpy(&buffer->data[buffer->size_bytes], data, length);
buffer->size_bytes += length;
}
buffer->buffer_current = &buffer->data[0];
}
return 0;
}
int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get)
{
int underflow;
if (!buffer)
return -1;
underflow = (buffer->size_bytes >= ((offset + to_get) / 8)) ? 0 : -1;
if (underflow && debug_buffers)
g_warning("Detected Underflow offset %u, to_get %u, buffer size %u\n",
offset, to_get, buffer->size_bytes);
return underflow;
}
void *buffer_at_offset(buffer_t *buffer, uint32_t offset)
{
// if (buffer_has_enouch_data(buffer, 0, offset) != 0) {
// return NULL;
// }
return &buffer->data[offset / 8];
}
/*
* 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
*/
#include <stdint.h>
#ifndef BUFFERS_H_
#define BUFFERS_H_
typedef struct buffer_s {
/* The size in bytes as read from socket */
uint32_t size_bytes;
/* Current position */
uint8_t *buffer_current;
/* The complete data */
uint8_t *data;
/* The message number as read from socket */
uint32_t message_number;
uint32_t message_id;
} buffer_t;
uint8_t buffer_get_uint8_t(buffer_t *buffer, uint32_t offset);
uint16_t buffer_get_uint16_t(buffer_t *buffer, uint32_t offset);
uint32_t buffer_get_uint32_t(buffer_t *buffer, uint32_t offset);
uint64_t buffer_get_uint64_t(buffer_t *buffer, uint32_t offset);
int buffer_fetch_bits(buffer_t *buffer, uint32_t offset, int nbits, uint32_t *value);
int buffer_fetch_nbytes(buffer_t *buffer, uint32_t offset, int n_bytes, uint8_t *value);
void buffer_dump(buffer_t *buffer, FILE *to);
int buffer_append_data(buffer_t *buffer, const uint8_t *data, const uint32_t length);
int buffer_new_from_data(buffer_t **buffer, uint8_t *data, const uint32_t length,
int data_static);
int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get);
void *buffer_at_offset(buffer_t *buffer, uint32_t offset);
#endif /* BUFFERS_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
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#define G_LOG_DOMAIN ("BUFFERS")
#include <glib.h>
#include "rc.h"
#include "buffers.h"
#include "file.h"
#define READ_BUFFER_SIZE 1024
int file_read_dump(buffer_t **buffer, const char *filename)
{
int fd = -1;
buffer_t *new_buf = NULL;
uint8_t data[READ_BUFFER_SIZE];
ssize_t current_read;
if (!filename)
return RC_BAD_PARAM;
if ((fd = open(filename, O_RDONLY)) == -1) {
g_warning("Cannot open %s for reading, returned %d:%s\n",
filename, errno, strerror(errno));
return RC_FAIL;
}
CHECK_FCT(buffer_new_from_data(&new_buf, NULL, 0, 0));
do {
current_read = read(fd, data, READ_BUFFER_SIZE);
if (current_read == -1)
{
g_warning("Failed to read data from file, returned %d:%s\n",
errno, strerror(errno));
return RC_FAIL;
}
CHECK_FCT(buffer_append_data(new_buf, data, current_read));
} while(current_read == READ_BUFFER_SIZE);
*buffer = new_buf;
buffer_dump(new_buf, stdout);
close(fd);
return RC_OK;
}
/*
* 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
*/
#ifndef FILE_H_
#define FILE_H_
int file_read_dump(buffer_t **buffer, const char *filename);
#endif /* FILE_H_ */
This diff is collapsed.
/*
* 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
*/
#include <arpa/inet.h>
#include <netinet/in.h>
#ifndef SOCKET_H_
#define SOCKET_H_
typedef struct {
pthread_t thread;
int sd;
char *ip_address;
uint16_t port;
/* The pipe used between main thread (running GTK) and the socket thread */
int pipe_fd;
/* Time used to avoid refreshing UI every time a new signal is incoming */
gint64 last_data_notification;
uint8_t nb_signals_since_last_update;
/* The last signals received which are not yet been updated in GUI */
GList *signal_list;
} socket_data_t;
gboolean socket_abort_connection;
int socket_connect_to_remote_host(const char *remote_ip, const uint16_t port,
int pipe_fd);
int socket_disconnect_from_remote_host(void);
#endif /* SOCKET_H_ */
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libbuffers \
-I$(top_srcdir)/libui
noinst_LTLIBRARIES = libparser.la
libparser_la_LDFLAGS = -all-static
libparser_la_SOURCES = \
xml_parse.c \
array_type.c array_type.h \
enum_type.c enum_type.h \
enum_value_type.c enum_value_type.h \
file_type.c file_type.h \
field_type.c field_type.h \
fundamental_type.c fundamental_type.h \
pointer_type.h pointer_type.c \
reference_type.c reference_type.h \
struct_type.c struct_type.h \
typedef_type.c typedef_type.h \
types.h types.c \
union_type.c union_type.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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <tgmath.h>
#define G_LOG_DOMAIN ("PARSER")
#include "array_type.h"
#include "fundamental_type.h"
#include "ui_interface.h"
int array_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
types_t *type_child;
int length = 0;
char cbuf[50];
DISPLAY_PARSE_INFO("array", type->name, offset, parent_offset);
/* Ignore TYPEDEF children */
for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF;
type_child = type_child->child) {
}
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "<%s>\n", type->name));
}
if (type->child != NULL) {
int items = type->size / type_child->size;
int i;
int zero_counter = 0;
gboolean is_string = FALSE;
char *string;
int nb_digits = 0;
/* Factorizes trailing 0 */
if ((items > 1) && (type_child->type == TYPE_FUNDAMENTAL))
{
for (i = items - 1; i >= 0; i--)
{
if (fundamental_read_from_buffer(type_child, buffer, parent_offset, offset + i * type_child->size) == 0)
{
zero_counter ++;
}
else
{
break;
}
}
/* Check if this is an array of 8 bits items and if at least the firsts ones are not null */
if ((type_child->size == 8) && (zero_counter >= 1) && ((items - zero_counter) >= 2))
{
int end = items - zero_counter;
/* check if this is a printable string */
is_string = TRUE;
string = malloc(end + 1);
for (i = 0; i < end; i++)
{
string[i] = fundamental_read_from_buffer(type_child, buffer, parent_offset, offset + i * type_child->size);
if (isprint(string[i]) == 0)
{
/* This is not a printable string */
is_string = FALSE;
break;
}
}
if (is_string)
{
string[i] = '\0';
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[0 .. %d] \"%s\"\n", end - 1, string));
ui_set_signal_text_cb(user_data, cbuf, length);
}
}
/* Do not factorize if there is only one null item */
if (zero_counter <= 1)
{
zero_counter = 0;
}
}
if (is_string == FALSE)
{
nb_digits = log10(items - zero_counter) + 1;
for (i = 0; i < (items - zero_counter); i++)
{
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%*d] ", nb_digits, i));
ui_set_signal_text_cb(user_data, cbuf, length);
type->child->type_dissect_from_buffer (
type->child, ui_set_signal_text_cb, user_data, buffer, parent_offset,
offset + i * type_child->size, indent,
FALSE);
}
if (zero_counter > 0)
{
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%d .. %d] ", i, items -1));
ui_set_signal_text_cb(user_data, cbuf, length);
type->child->type_dissect_from_buffer (
type->child, ui_set_signal_text_cb, user_data,
buffer, parent_offset, offset + i * type_child->size, indent, FALSE);
}
}
}
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "</%s>\n", type->name));
}
return 0;
}
int array_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Array>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Min ........: %d\n", type->min));
INDENTED(file, indent+4, fprintf(file, "Max ........: %d\n", type->max));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
if (type->child != NULL)
type->child->type_file_print (type->child, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Array>\n"));
return 0;
}
int array_type_hr_display(types_t *type, int indent) {
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Array>\n"));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Min ........: %d\n", type->min));
INDENTED(stdout, indent+4, printf("Max ........: %d\n", type->max));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
if (type->child != NULL)
type->child->type_hr_display (type->child, indent + 4);
INDENTED(stdout, indent, printf("</Array>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef ARRAY_TYPE_H_
#define ARRAY_TYPE_H_
int array_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int array_type_hr_display(types_t *type, int indent);
int array_type_file_print(types_t *type, int indent, FILE *file);
#endif /* ARRAY_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "enum_type.h"
#include "ui_interface.h"
char *enum_type_get_name_from_value(types_t *type, uint32_t value)
{
char *enum_name = "UNKNOWN";
types_t *enum_value;
/* Loop on each enumeration values */
for (enum_value = type->child; enum_value; enum_value = enum_value->next) {
if (value == enum_value->init_value) {
enum_name = enum_value->name;
break;
}
}
return enum_name;
}
int enum_type_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
uint32_t value = 0;
types_t *values;
DISPLAY_PARSE_INFO("enum", type->name, offset, parent_offset);
value = buffer_get_uint32_t(buffer, parent_offset + offset);
for (values = type->child; values; values = values->next) {
if (value == values->init_value) {
values->parent = type;
values->type_dissect_from_buffer(
values, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset,
type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, FALSE);
break;
}
}
if (values == NULL) {
int length = 0;
char cbuf[50];
length = sprintf(cbuf, "(0x%08x) UNKNOWN;\n", value);
ui_set_signal_text_cb(user_data, cbuf, length);
}
return 0;
}
int enum_type_file_print(types_t *type, int indent, FILE *file)
{
types_t *values;
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Enumeration>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
/* Call enum values display */
for (values = type->child; values; values = values->next) {
values->type_file_print(values, indent + 4, file);
}
INDENTED(file, indent, fprintf(file, "</Enumeration>\n"));
return 0;
}
int enum_type_hr_display(types_t *type, int indent)
{
types_t *values;
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Enumeration>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
/* Call enum values display */
for (values = type->child; values; values = values->next) {
values->type_hr_display(values, indent + 4);
}
INDENTED(stdout, indent, printf("</Enumeration>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef ENUM_TYPE_H_
#define ENUM_TYPE_H_
char *enum_type_get_name_from_value(types_t *type, uint32_t value);
int enum_type_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int enum_type_file_print(types_t *type, int indent, FILE *file);
int enum_type_hr_display(types_t *type, int indent);
#endif /* ENUM_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "enum_value_type.h"
#include "ui_interface.h"
uint32_t last_enum_value;
int enum_value_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
types_t *type_parent = NULL;
uint32_t value = 0;
DISPLAY_PARSE_INFO("enum_value", type->name, offset, parent_offset);
value = buffer_get_uint32_t(buffer, parent_offset + offset);
if (type->name) {
int length = 0;
char cbuf[50 + strlen(type->name)];
/* Search for enum variable name and check if it is used in association with a union type */
{
if (type->parent != NULL) {
/* Ignore ENUMERATION and TYPEDEF parents */
for (type_parent = type->parent; (type_parent != NULL) && ((type_parent->type == TYPE_ENUMERATION) || (type_parent->type == TYPE_TYPEDEF));
type_parent = type_parent->parent) {
}
}
if ((type_parent != NULL) && (type_parent->name != NULL) && (strcmp(type_parent->name, "present") == 0))
{
/* ASN1 union, keep the "present" member */
last_enum_value = value;
}
else
{
last_enum_value = 0;
}
}
length = sprintf(cbuf, "(0x%08x) %s;\n", value, type->name);
ui_set_signal_text_cb(user_data, cbuf, length);
}
return 0;
}
int enum_value_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Value>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Value ......: %d\n", type->init_value));
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
INDENTED(file, indent, fprintf(file, "</Value>\n"));
return 0;
}
int enum_value_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Value>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Value ......: %d\n", type->init_value));
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
INDENTED(stdout, indent, printf("</Value>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef ENUM_VALUE_TYPE_H_
#define ENUM_VALUE_TYPE_H_
extern uint32_t last_enum_value;
int enum_value_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int enum_value_file_print(types_t *type, int indent, FILE *file);
int enum_value_type_hr_display(types_t *type, int indent);
#endif /* ENUM_VALUE_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "rc.h"
#include "field_type.h"
#include "buffers.h"
#include "ui_interface.h"
int field_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
types_t *type_child;
char array_info[50];
new_line = FALSE;
DISPLAY_PARSE_INFO("field", type->name, offset, parent_offset);
CHECK_FCT(buffer_has_enouch_data(buffer, parent_offset + offset, type->size / 8));
if (type->bits == -1) {
if ((type->name != NULL) && (strcmp(type->name, "_asn_ctx") == 0)) {
/* Hide ASN1 asn_struct_ctx_t struct that hold context for parsing across buffer boundaries */
/*
INDENTED_STRING(cbuf, indent, sprintf(cbuf, ".asn_ctx ...\n"));
length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length);
*/
}
else {
if (type->child != NULL) {
/* Ignore TYPEDEF children */
for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child =
type_child->child) {
}
if (type_child->type == TYPE_ARRAY) {
types_t *type_array_child;
/* Ignore TYPEDEF children */
for (type_array_child = type_child->child;
type_array_child != NULL && type_array_child->type == TYPE_TYPEDEF; type_array_child =
type_array_child->child) {
}
sprintf (array_info, "[%d]", type_child->size / type_array_child->size);
}
else {
array_info[0] = '\0';
}
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, ".%s%s = ", type->name ? type->name : "Field", array_info));
ui_set_signal_text_cb(user_data, cbuf, length);
if (type_child->type == TYPE_ARRAY) {
DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);)
ui_set_signal_text_cb(user_data, "\n", 1);
new_line = TRUE;
}
/*
if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) {
DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);)
ui_set_signal_text_cb(user_data, "\n", 1);
new_line = TRUE;
}
*/
type->child->parent = type;
type->child->type_dissect_from_buffer(
type->child, ui_set_signal_text_cb, user_data, buffer,
parent_offset, offset + type->offset, new_line ? indent + DISPLAY_TAB_SIZE : indent, new_line);
DISPLAY_BRACE(
if (type_child->type == TYPE_ARRAY) {
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);
});
/*
DISPLAY_BRACE(
if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) {
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n"));
length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length);
});
*/
}
}
}
else {
/* The field is only composed of bits */
uint32_t value = 0;
CHECK_FCT(buffer_fetch_bits(buffer, offset + type->offset + parent_offset, type->bits, &value));
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, ".%s:%d = (0x%0*x) %d;\n", type->name ? type->name : "Field", type->bits, (type->bits + 3) / 4, value, value));
ui_set_signal_text_cb(user_data, cbuf, length);
}
return 0;
}
int field_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Field>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Bits .......: %d\n", type->bits));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Offset .....: %d\n", type->offset));
INDENTED(file, indent+4, fprintf(file, "Context ....: %d\n", type->context));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
if (type->child != NULL)
type->child->type_file_print (type->child, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Field>\n"));
return 0;
}
int field_type_hr_display(types_t *type, int indent) {
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Field>\n"));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Bits .......: %d\n", type->bits));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Offset .....: %d\n", type->offset));
INDENTED(stdout, indent+4, printf("Context ....: %d\n", type->context));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
if (type->child != NULL)
type->child->type_hr_display (type->child, indent + 4);
INDENTED(stdout, indent, printf("</Field>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef FIELD_TYPE_H_
#define FIELD_TYPE_H_
int field_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int field_type_file_print(types_t *type, int indent, FILE *file);
int field_type_hr_display(types_t *type, int indent);
#endif /* FIELD_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "file_type.h"
int file_type_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<File>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent, fprintf(file, "</File>\n"));
return 0;
}
int file_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<File>\n"));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent, printf("</File>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef FILE_TYPE_H_
#define FILE_TYPE_H_
int file_type_file_print(types_t *type, int indent, FILE *file);
int file_type_hr_display(types_t *type, int indent);
#endif /* FILE_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#define G_LOG_DOMAIN ("PARSER")
#include "fundamental_type.h"
#include "ui_interface.h"
uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset) {
uint64_t value;
switch (type->size) {
case 8:
value = buffer_get_uint8_t (buffer, offset + parent_offset);
break;
case 16:
value = buffer_get_uint16_t (buffer, offset + parent_offset);
break;
case 32:
value = buffer_get_uint32_t (buffer, offset + parent_offset);
break;
case 64:
value = buffer_get_uint64_t (buffer, offset + parent_offset);
break;
default:
/* ??? */
value = 0;
break;
}
return value;
}
int fundamental_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[200];
int type_unsigned;
uint8_t value8;
uint16_t value16;
uint32_t value32;
uint64_t value64;
DISPLAY_PARSE_INFO("fundamental", type->name, offset, parent_offset);
memset (cbuf, 0, 200);
type_unsigned = strstr (type->name, "unsigned") == NULL ? 0 : 1;
value64 = fundamental_read_from_buffer(type, buffer, offset, parent_offset);
indent = new_line ? indent : 0;
if (indent > 0)
{
DISPLAY_TYPE("Fun");
}
switch (type->size) {
case 8:
value8 = (uint8_t) value64;
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%02" PRIx8 ") %3" PRIu8 ";\n" : "(0x%02" PRIx8 ") %4" PRId8 ";\n", value8, value8));
break;
case 16:
value16 = (uint16_t) value64;
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%04" PRIx16 ") %5" PRIu16 ";\n" : "(0x%04" PRIx16 ") %6" PRId16 ";\n", value16, value16));
break;
case 32:
value32 = (uint32_t) value64;
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%08" PRIx32 ") %9" PRIu32 ";\n" : "(0x%08" PRIx32 ") %10" PRId32 ";\n", value32, value32));
break;
case 64:
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%016" PRIx64 ") %20" PRIu64 ";\n" : "(0x%016" PRIx64 ") %20" PRId64 ";\n", value64, value64));
break;
default:
/* ??? */
break;
}
ui_set_signal_text_cb(user_data, cbuf, length);
return 0;
}
int fundamental_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Fundamental>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Fundamental>\n"));
return 0;
}
int fundamental_type_hr_display(types_t *type, int indent) {
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Fundamental>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
INDENTED(stdout, indent, printf("</Fundamental>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef FUNDAMENTAL_TYPE_H_
#define FUNDAMENTAL_TYPE_H_
uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset);
int fundamental_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int fundamental_type_file_print(types_t *type, int indent, FILE *file);
int fundamental_type_hr_display(types_t *type, int indent);
#endif /* FUNDAMENTAL_TYPE_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
*/
#include "fundamental_type.h"
#include "struct_type.h"
#ifndef INTERTASK_CONTEXTS_H_
#define INTERTASK_CONTEXTS_H_
typedef struct {
/* List of fundamental types that can contruct any other type */
fundamental_type_t *ft_list;
struct_type_t *struct_list;
} intertask_context_t;
#endif /* INTERTASK_CONTEXTS_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "pointer_type.h"
#include "ui_interface.h"
int pointer_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0, i;
char cbuf[200];
DISPLAY_PARSE_INFO("pointer", type->name, offset, parent_offset);
memset (cbuf, 0, 200);
uint8_t value[type->size / 8];
buffer_fetch_nbytes(buffer, parent_offset + offset, type->size / 8, value);
indent = new_line ? indent : 0;
if (indent > 0)
{
DISPLAY_TYPE("Ptr");
}
if (type->child && type->child->name) {
/*
INDENTED(stdout, indent, fprintf(stdout, "<%s>0x%08x</%s>\n",
type->child->name, value, type->child->name));
*/
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(%s *) 0x", type->child->name));
}
else {
/*
INDENTED(stdout, indent, fprintf(stdout, "<Pointer>0x%08x</Pointer>\n",
value));
*/
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(void *) 0x"));
}
/* Append the value */
for (i = type->size / 8 - 1; i >= 0; i--) {
length += sprintf(&cbuf[length], "%02x", value[i]);
}
length += sprintf(&cbuf[length], ";\n");
ui_set_signal_text_cb(user_data, cbuf, length);
return 0;
}
int pointer_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Pointer>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
if (type->child != NULL) {
if (type->child->type == TYPE_FUNCTION) {
INDENTED(file, indent+4, fprintf(file, "<Function>\n"));
INDENTED(file, indent+8, fprintf(file, "<Args>To be done</Args>\n"));
INDENTED(file, indent+4, fprintf(file, "</Function>\n"));
} else {
type->child->type_file_print (type->child, indent + 4, file);
}
}
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Pointer>\n"));
return 0;
}
int pointer_type_hr_display(types_t *type, int indent) {
return pointer_type_file_print(type, indent, stdout);
}
/*
* 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
*/
#include "types.h"
#ifndef POINTER_TYPE_H_
#define POINTER_TYPE_H_
int pointer_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int pointer_type_file_print(types_t *type, int indent, FILE *file);
int pointer_type_hr_display(types_t *type, int indent);
#endif /* POINTER_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "reference_type.h"
#include "ui_interface.h"
int reference_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
DISPLAY_PARSE_INFO("reference", type->name, offset, parent_offset);
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "<%s>\n", type->name));
}
if (type->child != NULL)
type->child->type_dissect_from_buffer(type->child, ui_set_signal_text_cb,
user_data, buffer, offset, parent_offset,
type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, TRUE);
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "</%s>\n", type->name));
}
return 0;
}
int reference_type_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Reference>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Context ....: %d\n", type->context));
INDENTED(file, indent+4, fprintf(file, "Offset .....: %d\n", type->offset));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
if (type->child != NULL)
type->child->type_file_print(type->child, indent+4, file);
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
INDENTED(file, indent, fprintf(file, "</Reference>\n"));
return 0;
}
int reference_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Reference>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Context ....: %d\n", type->context));
INDENTED(stdout, indent+4, printf("Offset .....: %d\n", type->offset));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
if (type->child != NULL)
type->child->type_hr_display(type->child, indent+4);
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
INDENTED(stdout, indent, printf("</Reference>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef REFERENCE_TYPE_H_
#define REFERENCE_TYPE_H_
int reference_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int reference_type_file_print(types_t *type, int indent, FILE *file);
int reference_type_hr_display(types_t *type, int indent);
#endif /* REFERENCE_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "rc.h"
#include "struct_type.h"
#include "buffers.h"
#include "ui_callbacks.h"
#include "ui_interface.h"
int struct_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int i;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
int length = 0;
char *name;
memset (cbuf, 0, sizeof(cbuf));
DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset);
if (new_line) {
DISPLAY_TYPE("Str");
}
if (type->name) {
name = type->name;
}
else {
name = "_anonymous_";
}
if ((strcmp (name, "IttiMsgText_s") == 0) &&
(type->members_child[0] != NULL) && (strcmp (type->members_child[0]->name, "size") == 0) &&
(type->members_child[1] != NULL) && (strcmp (type->members_child[1]->name, "text") == 0)) {
uint8_t *buf;
length = buffer_get_uint32_t (buffer, offset + parent_offset);
buf = malloc (length + 1);
buf[0] = '\n';
buffer_fetch_nbytes(buffer, parent_offset + offset + 32, length, &buf[1]);
length = ui_callback_check_string ((char *) &buf[1], length, 0);
ui_set_signal_text_cb(user_data, (char *) buf, length + 1);
}
else
{
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s :", name));
DISPLAY_BRACE(length += sprintf(&cbuf[length], " {"););
length += sprintf(&cbuf[length], "\n");
ui_set_signal_text_cb(user_data, cbuf, length);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_dissect_from_buffer (
type->members_child[i], ui_set_signal_text_cb, user_data,
buffer, offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE);
}
}
DISPLAY_BRACE(
DISPLAY_TYPE("Str");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);)
return 0;
}
int struct_type_file_print(types_t *type, int indent, FILE *file) {
int i;
if (type == NULL)
return -1;
if (file == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Struct>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members));
INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled));
INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_file_print (type->members_child[i], indent + 4, file);
}
INDENTED(file, indent, fprintf(file, "</Struct>\n"));
return 0;
}
int struct_type_hr_display(types_t *type, int indent) {
int i;
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Struct>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members));
INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled));
INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_hr_display (type->members_child[i], indent + 4);
}
INDENTED(stdout, indent, printf("</Struct>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef STRUCT_TYPE_H_
#define STRUCT_TYPE_H_
int struct_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int struct_type_hr_display(types_t *type, int indent);
int struct_type_file_print(types_t *type, int indent, FILE *file);
#endif /* STRUCT_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "typedef_type.h"
#include "ui_interface.h"
int typedef_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
types_t *type_child = NULL;
DISPLAY_PARSE_INFO("typedef", type->name, offset, parent_offset);
if (type->child != NULL) {
/* Ignore TYPEDEF children */
for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child =
type_child->child) {
}
}
if ((type_child == NULL) || (type_child->type != TYPE_FUNDAMENTAL))
{
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s, ", type->name));
ui_set_signal_text_cb(user_data, cbuf, length);
new_line = FALSE;
}
/* Simply call next_type */
if (type->child != NULL) {
type->child->parent = type;
type->child->type_dissect_from_buffer(
type->child, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, indent, new_line);
}
return 0;
}
int typedef_type_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Typedef>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members));
INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled));
INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
if (type->child != NULL)
type->child->type_file_print(type->child, indent+4, file);
INDENTED(file, indent, fprintf(file, "</Typedef>\n"));
return 0;
}
int typedef_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Typedef>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members));
INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled));
INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
if (type->child != NULL)
type->child->type_hr_display(type->child, indent+4);
INDENTED(stdout, indent, printf("</Typedef>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef TYPEDEF_TYPE_H_
#define TYPEDEF_TYPE_H_
int typedef_type_file_print(types_t *type, int indent, FILE *file);
int typedef_type_hr_display(types_t *type, int indent);
int typedef_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
#endif /* TYPEDEF_TYPE_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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "types.h"
#include "array_type.h"
#include "enum_type.h"
#include "fundamental_type.h"
#include "struct_type.h"
#include "union_type.h"
#include "typedef_type.h"
#include "enum_value_type.h"
#include "file_type.h"
#include "field_type.h"
#include "reference_type.h"
#include "pointer_type.h"
types_t *type_new(enum type_e type)
{
types_t *new_p;
new_p = calloc(1, sizeof(types_t));
new_p->type = type;
switch(type) {
case TYPE_FUNCTION:
/* Nothing to do for now. Display is done by pointer type */
break;
case TYPE_ENUMERATION:
new_p->type_hr_display = enum_type_hr_display;
new_p->type_file_print = enum_type_file_print;
new_p->type_dissect_from_buffer = enum_type_dissect_from_buffer;
break;
case TYPE_FUNDAMENTAL:
new_p->type_hr_display = fundamental_type_hr_display;
new_p->type_file_print = fundamental_type_file_print;
new_p->type_dissect_from_buffer = fundamental_dissect_from_buffer;
break;
case TYPE_STRUCT:
new_p->type_hr_display = struct_type_hr_display;
new_p->type_file_print = struct_type_file_print;
new_p->type_dissect_from_buffer = struct_dissect_from_buffer;
break;
case TYPE_UNION:
new_p->type_hr_display = union_type_hr_display;
new_p->type_file_print = union_type_file_print;
new_p->type_dissect_from_buffer = union_dissect_from_buffer;
break;
case TYPE_TYPEDEF:
new_p->type_hr_display = typedef_type_hr_display;
new_p->type_file_print = typedef_type_file_print;
new_p->type_dissect_from_buffer = typedef_dissect_from_buffer;
break;
case TYPE_ENUMERATION_VALUE:
new_p->type_hr_display = enum_value_type_hr_display;
new_p->type_file_print = enum_value_file_print;
new_p->type_dissect_from_buffer = enum_value_dissect_from_buffer;
break;
case TYPE_FILE:
new_p->type_hr_display = file_type_hr_display;
new_p->type_file_print = file_type_file_print;
// new_p->type_dissect_from_buffer = file_dissect_from_buffer;
break;
case TYPE_FIELD:
new_p->type_hr_display = field_type_hr_display;
new_p->type_file_print = field_type_file_print;
new_p->type_dissect_from_buffer = field_dissect_from_buffer;
break;
case TYPE_REFERENCE:
new_p->type_hr_display = reference_type_hr_display;
new_p->type_file_print = reference_type_file_print;
new_p->type_dissect_from_buffer = reference_dissect_from_buffer;
break;
case TYPE_ARRAY:
new_p->type_hr_display = array_type_hr_display;
new_p->type_file_print = array_type_file_print;
new_p->type_dissect_from_buffer = array_dissect_from_buffer;
break;
case TYPE_POINTER:
new_p->type_hr_display = pointer_type_hr_display;
new_p->type_file_print = pointer_type_file_print;
new_p->type_dissect_from_buffer = pointer_dissect_from_buffer;
break;
default:
break;
}
return new_p;
}
int types_insert_tail(types_t **head, types_t *to_insert)
{
if (to_insert == NULL || head == NULL)
return -1;
if (*head == NULL) {
*head = to_insert;
} else {
types_t *last = *head;
while(last->next != NULL) {
last = last->next;
}
last->next = to_insert;
to_insert->previous = last;
}
to_insert->head = *head;
return 0;
}
void types_hr_display(types_t *head)
{
types_t *current = head;
if (head == NULL) {
printf("Empty list\n");
/* Empty list */
return;
}
while((current = current->next) != NULL)
{
current->type_hr_display(current, 0);
}
}
/*
* 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
*/
#include <stdio.h>
#include "buffers.h"
#include "ui_main_screen.h"
#include "ui_interface.h"
#ifndef TYPES_H_
#define TYPES_H_
/* Activate to display the type at the beginning of the line (debug option) */
#define ENABLE_DISPLAY_TYPE 0
/* Activate to display the parse information before processing each item (debug option) */
#define ENABLE_DISPLAY_PARSE_INFO 0
/* Activate to show braces, in increase the number of displayed lines (formating option)*/
#define ENABLE_DISPLAY_BRACE 1
#if (ENABLE_DISPLAY_TYPE != 0)
# define DISPLAY_TYPE(tYPE) ui_set_signal_text_cb(user_data, tYPE" ", strlen(tYPE) + 1);
#else
# define DISPLAY_TYPE(tYPE)
#endif
#define DISPLAY_TAB_SIZE (2)
#if (ENABLE_DISPLAY_PARSE_INFO != 0)
# define DISPLAY_PARSE_INFO(tYPE, nAME, oFFSET, pARENToFFSET) \
{ \
char buf[200]; \
sprintf(buf, "/* %s \"%s\" %d %d */\n", tYPE, nAME, oFFSET, pARENToFFSET); \
ui_set_signal_text_cb(user_data, buf, strlen(buf)); \
}
#else
# define DISPLAY_PARSE_INFO(tYPE, nAME, oFFSET, pARENToFFSET)
#endif
#if (ENABLE_DISPLAY_BRACE != 0)
# define DISPLAY_BRACE(cODE) if (ui_main_data.display_brace) {cODE}
#else
# define DISPLAY_BRACE(cODE)
#endif
enum type_e {
TYPE_ENUMERATION,
TYPE_ENUMERATION_VALUE,
TYPE_STRUCT,
TYPE_UNION,
TYPE_FUNDAMENTAL,
TYPE_TYPEDEF,
TYPE_ARRAY,
TYPE_REFERENCE,
TYPE_FIELD,
TYPE_FUNCTION,
TYPE_ARGUMENT,
TYPE_POINTER,
TYPE_FILE,
};
/* Forward declarations */
struct types_s;
typedef int (*type_hr_display_t)(struct types_s *type, int indent);
typedef int (*type_ui_display_t)(struct types_s *type, int indent);
typedef int (*type_file_print_t)(struct types_s *type, int indent, FILE *file);
/**
* type_dissect_from_buffer_t
* @param type The current type
* @param ui_set_signal_text_cb GUI display function
* @param user_data Transparent data to pass to the GUI display function
* @param buffer The buffer containing data to dissect
* @param offset offset of field from the beginning of the parent
* @param parent_offset offset of the parent from begining
**/
typedef int (*type_dissect_from_buffer_t)(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
typedef struct types_s {
/* The type of the current description */
enum type_e type;
/* Printable name for the current type */
char *name;
int type_xml;
int size;
int align;
int bits;
/* Used only for arrays */
int min;
int max;
int context;
/* Init value for enumerations */
int init_value;
int incomplete;
/* Id of the type as defined in XML file */
int id;
int artificial;
char *mangled;
char *demangled;
/* List of members in constructed types */
char *members;
/* The file containing the definition */
char *file;
/* Line number of the current definition */
int line;
/* offset of the field in the parent type
* -1 means no parent
*/
int offset;
struct types_s *previous;
struct types_s *next;
struct types_s *parent;
struct types_s *child;
struct types_s *file_ref;
/* Reference to the head */
struct types_s *head;
/* For structures or union */
int nb_members;
struct types_s **members_child;
/* Some procedures to display the type on terminal */
type_hr_display_t type_hr_display;
/* Some procedures to display the type on UI */
type_ui_display_t type_ui_display;
/* Procedure to display the type to a file */
type_file_print_t type_file_print;
/* Dissect the type */
type_dissect_from_buffer_t type_dissect_from_buffer;
} types_t;
types_t *type_new(enum type_e type);
int types_insert_tail(types_t **head, types_t *to_insert);
void types_hr_display(types_t *head);
#define INDENTED(fILE, x, y) \
do { \
int indentation = x; \
while(indentation--) fprintf(fILE, " "); \
y; \
} while(0)
#define INDENTED_STRING(sTR, x, y) \
do { \
int indentation = x; \
while(indentation--) ui_set_signal_text_cb(user_data, " ", 1); \
y; \
} while(0)
#endif /* TYPES_H_ */
This diff is collapsed.
/*
* 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
*/
#include "types.h"
#ifndef UNION_TYPE_H_
#define UNION_TYPE_H_
int union_msg_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int union_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int union_type_file_print(types_t *type, int indent, FILE *file);
int union_type_hr_display(types_t *type, int indent);
#endif /* UNION_TYPE_H_ */
This diff is collapsed.
/*
* 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
*/
#include "rc.h"
#include "types.h"
#ifndef XML_PARSE_H_
#define XML_PARSE_H_
extern void *xml_raw_data;
extern uint32_t xml_raw_data_size;
extern types_t *root;
int xml_parse_file(const char *filename);
int xml_parse_buffer(char *xml_buffer, const int size);
int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
gpointer user_data);
int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
gpointer cb_user_data);
#endif /* XML_PARSE_H_ */
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libui \
-I$(top_srcdir)/libbuffers
noinst_LTLIBRARIES = libresolver.la
libresolver_la_LDFLAGS = -all-static
libresolver_la_SOURCES = \
locate_root.c locate_root.h \
resolvers.c resolvers.h
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libbuffers \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libresolver
noinst_LTLIBRARIES = libui.la
libui_la_LDFLAGS = -all-static
libui_la_SOURCES = \
ui_main_screen.c ui_main_screen.h \
ui_menu_bar.c ui_menu_bar.h \
ui_callbacks.c ui_callbacks.h \
ui_tree_view.c ui_tree_view.h \
ui_signal_dissect_view.c ui_signal_dissect_view.h \
ui_notifications.c ui_notifications.h \
ui_notif_dlg.c ui_notif_dlg.h \
ui_interface.c ui_interface.h \
ui_notebook.c ui_notebook.h \
ui_filters.c ui_filters.h
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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