Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
oai
openairinterface5G
Commits
4f618d61
Commit
4f618d61
authored
Dec 22, 2015
by
Xenofon Foukas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some bugs that would lead to segfaults and modified to support changes in protocol
parent
d5830ced
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
openair2/ENB_APP/enb_agent_common.c
openair2/ENB_APP/enb_agent_common.c
+3
-1
openair2/ENB_APP/enb_agent_handler.c
openair2/ENB_APP/enb_agent_handler.c
+17
-13
No files found.
openair2/ENB_APP/enb_agent_common.c
View file @
4f618d61
...
...
@@ -118,6 +118,7 @@ int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg) {
protocol__progran_message__init
(
*
msg
);
(
*
msg
)
->
msg_case
=
PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG
;
(
*
msg
)
->
msg_dir
=
PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE
;
(
*
msg
)
->
has_msg_dir
=
1
;
(
*
msg
)
->
hello_msg
=
hello_msg
;
return
0
;
...
...
@@ -216,6 +217,7 @@ int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg) {
protocol__progran_message__init
(
*
msg
);
(
*
msg
)
->
msg_case
=
PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG
;
(
*
msg
)
->
msg_dir
=
PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME
;
(
*
msg
)
->
has_msg_dir
=
1
;
(
*
msg
)
->
echo_reply_msg
=
echo_reply_msg
;
return
0
;
...
...
openair2/ENB_APP/enb_agent_handler.c
View file @
4f618d61
...
...
@@ -42,10 +42,11 @@
#include "assertions.h"
enb_agent_message_decoded_callback
messages_callback
[][
3
]
=
{
{
enb_agent_hello
,
enb_agent_hello
,
0
},
/*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/
{
enb_agent_echo_request
,
enb_agent_echo_reply
,
0
},
/**/
{
0
,
enb_agent_mac_reply
,
0
},
/*stats*/
{
0
,
0
,
0
},
{
enb_agent_hello
,
0
,
0
},
/*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/
{
enb_agent_echo_reply
,
0
,
0
},
/*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/
{
0
,
0
,
0
},
/*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/
//Must add handler when receiving echo reply
{
enb_agent_mac_reply
,
0
,
0
},
/*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
{
0
,
0
,
0
},
/*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/
};
...
...
@@ -61,33 +62,35 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid,
uint8_t
*
data
,
uint32_t
size
){
Protocol__ProgranMessage
*
message
;
Protocol__ProgranMessage
*
decoded_message
,
*
reply_
message
;
err_code_t
err_code
;
DevAssert
(
data
!=
NULL
);
if
(
enb_agent_deserialize_message
(
data
,
size
,
&
message
)
<
0
)
{
if
(
enb_agent_deserialize_message
(
data
,
size
,
&
decoded_
message
)
<
0
)
{
err_code
=
PROTOCOL__PROGRAN_ERR__MSG_DECODING
;
goto
error
;
}
if
((
message
->
msg_case
>
sizeof
(
messages_callback
)
/
(
3
*
sizeof
(
enb_agent_message_decoded_callback
)))
||
(
message
->
msg_dir
>
PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME
)){
if
((
decoded_
message
->
msg_case
>
sizeof
(
messages_callback
)
/
(
3
*
sizeof
(
enb_agent_message_decoded_callback
)))
||
(
decoded_
message
->
msg_dir
>
PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME
)){
err_code
=
PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED
;
goto
error
;
}
if
(
messages_callback
[
message
->
msg_case
][
message
->
msg_dir
]
==
NULL
)
{
if
(
messages_callback
[
decoded_
message
->
msg_case
-
1
][
decoded_
message
->
msg_dir
-
1
]
==
NULL
)
{
err_code
=
PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED
;
goto
error
;
}
err_code
=
((
*
messages_callback
[
message
->
msg_case
-
1
][
message
->
msg_dir
-
1
])(
xid
,
&
message
));
err_code
=
((
*
messages_callback
[
decoded_
message
->
msg_case
-
1
][
decoded_
message
->
msg_dir
-
1
])(
xid
,
&
reply_
message
));
if
(
err_code
<
0
){
goto
error
;
}
return
message
;
protocol__progran_message__free_unpacked
(
decoded_message
,
NULL
);
return
reply_message
;
error:
LOG_E
(
ENB_APP
,
"errno %d occured
\n
"
,
err_code
);
...
...
@@ -110,11 +113,12 @@ void * enb_agent_send_message(uint32_t xid,
}
// free the msg --> later keep this in the data struct and just update the values
enb_agent_mac_destroy_stats_reply
(
msg
);
//TODO call proper destroy function
// enb_agent_mac_destroy_stats_reply(msg);
DevAssert
(
buffer
!=
NULL
);
LOG_D
(
ENB_APP
,
"Serilized the enb mac stats reply (size %d)
\n
"
,
size
);
LOG_D
(
ENB_APP
,
"Serilized the enb mac stats reply (size %d)
\n
"
,
*
size
);
return
buffer
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment