Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
zhangtu
openairinterface5G
Commits
e54100b8
Commit
e54100b8
authored
8 years ago
by
Rohit Gupta
Browse files
Options
Downloads
Plain Diff
Merge branch 'bugfix-9i-opt-wireshark' into develop
parents
99db0df3
362d28b4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openair2/UTIL/OPT/probe.c
+52
-89
52 additions, 89 deletions
openair2/UTIL/OPT/probe.c
with
52 additions
and
89 deletions
openair2/UTIL/OPT/probe.c
+
52
−
89
View file @
e54100b8
...
...
@@ -137,27 +137,15 @@ typedef guint8 gboolean;
//static unsigned char g_PDUBuffer[1600];
//static unsigned int g_PDUOffset;
#ifdef JUMBO_FRAME
static
unsigned
char
g_frameBuffer
[
9000
];
#else
static
unsigned
char
g_frameBuffer
[
1600
];
#endif
//static unsigned char g_fileBuffer[1600];
static
unsigned
int
g_frameOffset
;
char
in_ip
[
40
];
char
in_path
[
100
];
static
uint16_t
in_port
;
FILE
*
file_fd
=
NULL
;
trace_mode_t
opt_type
=
OPT_NONE
;
static
radio_type_t
radio_type
;
static
unsigned
int
subframesSinceCaptureStart
;
// double timing_perf[250];
// clock_t timing_in[250];
// clock_t timing_out[250];
int
test
=
0
;
int
init_value
=
0
;
static
int
g_socksd
=
-
1
;
/* UDP socket used for sending frames */
static
struct
sockaddr_in
g_serv_addr
;
...
...
@@ -277,66 +265,73 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
guint8
oob_event
,
guint8
oob_event_value
,
uint8_t
*
pdu_buffer
,
unsigned
int
pdu_buffer_size
)
{
#ifdef JUMBO_FRAME
static
unsigned
char
frameBuffer
[
9000
];
#else
static
unsigned
char
frameBuffer
[
1600
];
#endif
static
unsigned
int
frameOffset
;
ssize_t
bytesSent
;
g_
frameOffset
=
0
;
frameOffset
=
0
;
uint16_t
tmp16
;
/********************************************************************/
/* Fixed start to each frame (allowing heuristic dissector to work) */
/* Not NULL terminated */
memset
(
g_
frameBuffer
+
g_
frameOffset
,
0
,
sizeof
(
mac_lte_info
)
+
pdu_buffer_size
+
8
);
memset
(
frameBuffer
+
frameOffset
,
0
,
sizeof
(
mac_lte_info
)
+
pdu_buffer_size
+
8
);
memcpy
(
g_
frameBuffer
+
g_
frameOffset
,
MAC_LTE_START_STRING
,
memcpy
(
frameBuffer
+
frameOffset
,
MAC_LTE_START_STRING
,
strlen
(
MAC_LTE_START_STRING
));
g_
frameOffset
+=
strlen
(
MAC_LTE_START_STRING
);
frameOffset
+=
strlen
(
MAC_LTE_START_STRING
);
/******************************************************************************/
/* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */
g_
frameBuffer
[
g_
frameOffset
++
]
=
radioType
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
direction
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
rntiType
;
frameBuffer
[
frameOffset
++
]
=
radioType
;
frameBuffer
[
frameOffset
++
]
=
direction
;
frameBuffer
[
frameOffset
++
]
=
rntiType
;
/*************************************/
/* Now optional fields */
/* RNTI */
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_RNTI_TAG
;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_RNTI_TAG
;
tmp16
=
htons
(
rnti
);
memcpy
(
g_
frameBuffer
+
g_
frameOffset
,
&
tmp16
,
2
);
g_
frameOffset
+=
2
;
memcpy
(
frameBuffer
+
frameOffset
,
&
tmp16
,
2
);
frameOffset
+=
2
;
/* UEId */
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_UEID_TAG
;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_UEID_TAG
;
tmp16
=
htons
(
ueid
);
memcpy
(
g_
frameBuffer
+
g_
frameOffset
,
&
tmp16
,
2
);
g_
frameOffset
+=
2
;
memcpy
(
frameBuffer
+
frameOffset
,
&
tmp16
,
2
);
frameOffset
+=
2
;
/* Subframe number */
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_SUBFRAME_TAG
;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_SUBFRAME_TAG
;
tmp16
=
htons
(
subframeNumber
);
// frame counter : this will give an expert info as wireshark expects SF and not F
memcpy
(
g_
frameBuffer
+
g_
frameOffset
,
&
tmp16
,
2
);
g_
frameOffset
+=
2
;
memcpy
(
frameBuffer
+
frameOffset
,
&
tmp16
,
2
);
frameOffset
+=
2
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_CRC_STATUS_TAG
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
crcStatus
;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_CRC_STATUS_TAG
;
frameBuffer
[
frameOffset
++
]
=
crcStatus
;
#ifdef WIRESHARK_DEV
g_
frameOffset
+=
2
;
frameOffset
+=
2
;
tmp16
=
htons
(
subframeNumber
);
// subframe
memcpy
(
g_
frameBuffer
+
g_
frameOffset
,
&
tmp16
,
2
);
g_
frameOffset
+=
2
;
memcpy
(
frameBuffer
+
frameOffset
,
&
tmp16
,
2
);
frameOffset
+=
2
;
#endif
/***********************************************************/
/* For these optional fields, no need to encode if value is default */
if
(
!
isPredefinedData
)
{
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_PREDEFINED_DATA_TAG
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
isPredefinedData
;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_PREDEFINED_DATA_TAG
;
frameBuffer
[
frameOffset
++
]
=
isPredefinedData
;
}
if
(
retx
!=
0
)
{
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_RETX_TAG
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
retx
;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_RETX_TAG
;
frameBuffer
[
frameOffset
++
]
=
retx
;
}
#ifdef WIRESHARK_DEV
...
...
@@ -347,19 +342,19 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
switch
(
oob_event
)
{
case
ltemac_send_preamble
:
LOG_D
(
OPT
,
"oob event %d %d
\n
"
,
ltemac_send_preamble
);
//
g_
frameBuffer[
g_
frameOffset++]=0;
//
g_
frameBuffer[
g_
frameOffset++]=0;
//
g_
frameBuffer[
g_
frameOffset++]=0;
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_OOB_EVENT_TAG
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
ltemac_send_preamble
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
rnti
;
// is the preamble
g_
frameBuffer
[
g_
frameOffset
++
]
=
oob_event_value
;
//frameBuffer[frameOffset++]=0;
//frameBuffer[frameOffset++]=0;
//frameBuffer[frameOffset++]=0;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_OOB_EVENT_TAG
;
frameBuffer
[
frameOffset
++
]
=
ltemac_send_preamble
;
frameBuffer
[
frameOffset
++
]
=
rnti
;
// is the preamble
frameBuffer
[
frameOffset
++
]
=
oob_event_value
;
break
;
case
ltemac_send_sr
:
g_
frameBuffer
[
g_
frameOffset
++
]
=
ltemac_send_sr
;
g_
frameOffset
+=
2
;
g_
frameBuffer
[
g_
frameOffset
++
]
=
oob_event_value
;
frameBuffer
[
frameOffset
++
]
=
ltemac_send_sr
;
frameOffset
+=
2
;
frameBuffer
[
frameOffset
++
]
=
oob_event_value
;
break
;
case
ltemac_sr_failure
:
...
...
@@ -372,23 +367,23 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
#endif
/***************************************/
/* Now write the MAC PDU */
g_
frameBuffer
[
g_
frameOffset
++
]
=
MAC_LTE_PAYLOAD_TAG
;
frameBuffer
[
frameOffset
++
]
=
MAC_LTE_PAYLOAD_TAG
;
/* Append actual PDU */
//memcpy(
g_
frameBuffer+
g_
frameOffset, g_PDUBuffer, g_PDUOffset);
//
g_
frameOffset += g_PDUOffset;
//memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
//frameOffset += g_PDUOffset;
if
(
pdu_buffer
!=
NULL
)
{
memcpy
(
g_
frameBuffer
+
g_
frameOffset
,
(
void
*
)
pdu_buffer
,
pdu_buffer_size
);
g_
frameOffset
+=
pdu_buffer_size
;
memcpy
(
frameBuffer
+
frameOffset
,
(
void
*
)
pdu_buffer
,
pdu_buffer_size
);
frameOffset
+=
pdu_buffer_size
;
}
/* Send out the data over the UDP socket */
bytesSent
=
sendto
(
g_socksd
,
g_
frameBuffer
,
g_
frameOffset
,
0
,
bytesSent
=
sendto
(
g_socksd
,
frameBuffer
,
frameOffset
,
0
,
(
const
struct
sockaddr
*
)
&
g_serv_addr
,
sizeof
(
g_serv_addr
));
if
(
bytesSent
!=
g_
frameOffset
)
{
if
(
bytesSent
!=
frameOffset
)
{
LOG_W
(
OPT
,
"sendto() failed (not a thread-safe func)- expected %d bytes, got %d (errno=%d)
\n
"
,
g_
frameOffset
,
bytesSent
,
errno
);
frameOffset
,
bytesSent
,
errno
);
//exit(1);
}
}
...
...
@@ -509,6 +504,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
/*---------------------------------------------------*/
int
init_opt
(
char
*
path
,
char
*
ip
,
char
*
port
,
radio_type_t
radio_type_p
)
{
uint16_t
in_port
;
subframesSinceCaptureStart
=
0
;
if
(
path
!=
NULL
)
{
...
...
@@ -612,37 +608,4 @@ void terminate_opt(void)
break
;
}
}
/*
double *timing_analyzer(int index, int direction ){
//
int i;
if (direction==0)// in
{
timing_in[index]=clock();
//if(timing_out[index+100]>timing_in[index+100]);
//timing_perf[index+100] +=(double)((double)(timing_out[index+100]-timing_in[index+100])/(double)CLOCKS_PER_SEC);
}
else
{
timing_out[index]=clock();
if(index==5)timing_perf[index]=0;
timing_perf[index] +=(double)((double)(timing_out[index]-timing_in[index])/(((double)CLOCKS_PER_SEC)/1000000));
//LOG_I(OPT,"timing_analyser index %d =%f\n",index,timing_perf[index]);
init_value++;
if(init_value==500)
{
for(i=0;i<6;i++)
{
LOG_I(OPT,"timing_analyser index %d =%f\n",i,timing_perf[i]);
}
init_value=0;
}
return(&timing_perf[0]);
}
}
*/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment