Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
openairinterface5G
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
16
Merge Requests
16
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
oai
openairinterface5G
Commits
17251dda
Commit
17251dda
authored
Dec 21, 2015
by
nikaeinn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Very basic version of the enb agent
parent
0dee574c
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1414 additions
and
9 deletions
+1414
-9
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+19
-5
cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+1
-1
openair2/ENB_APP/MESSAGES/V2/header.proto
openair2/ENB_APP/MESSAGES/V2/header.proto
+2
-1
openair2/ENB_APP/MESSAGES/V2/progran.proto
openair2/ENB_APP/MESSAGES/V2/progran.proto
+29
-2
openair2/ENB_APP/enb_agent.c
openair2/ENB_APP/enb_agent.c
+202
-0
openair2/ENB_APP/enb_agent.h
openair2/ENB_APP/enb_agent.h
+47
-0
openair2/ENB_APP/enb_agent_common.c
openair2/ENB_APP/enb_agent_common.c
+246
-0
openair2/ENB_APP/enb_agent_common.h
openair2/ENB_APP/enb_agent_common.h
+88
-0
openair2/ENB_APP/enb_agent_handler.c
openair2/ENB_APP/enb_agent_handler.c
+133
-0
openair2/ENB_APP/enb_agent_mac.c
openair2/ENB_APP/enb_agent_mac.c
+552
-0
openair2/ENB_APP/enb_agent_mac.h
openair2/ENB_APP/enb_agent_mac.h
+77
-0
openair2/ENB_APP/enb_app.c
openair2/ENB_APP/enb_app.c
+9
-0
targets/SIMU/USER/oaisim.c
targets/SIMU/USER/oaisim.c
+9
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
17251dda
...
...
@@ -477,7 +477,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc
add_boolean_option
(
MESSAGE_CHART_GENERATOR_RLC_MAC False
"trace RLC-MAC exchanges in sequence diagrams"
)
add_boolean_option
(
MESSAGE_CHART_GENERATOR_PHY False
"trace some PHY exchanges in sequence diagrams"
)
add_boolean_option
(
ENB_AGENT
True
"enable eNB agent to inteface with a SDN contrller"
)
add_boolean_option
(
ENB_AGENT
_SB_IF
True
"enable eNB agent to inteface with a SDN contrller"
)
########################
# Include order
...
...
@@ -693,7 +693,7 @@ include_directories("${OPENAIR_DIR}")
# Utilities Library
################
if
(
ENB_AGENT
)
if
(
ENB_AGENT
_SB_IF
)
# set the version of protobuf messages, V3 not supported yet
add_list1_option
(
PRPT_VERSION V2
"PRPT MSG protobuf grammar version"
V2 V3
)
...
...
@@ -730,7 +730,8 @@ if (ENB_AGENT)
${
PRPT_source
}
)
set
(
PRPT_MSG_LIB PRPT_MSG
)
include_directories
(
"
${
PRPT_C_DIR
}
"
)
#message("prpt c dir is : ${PRPT_C_DIR}")
include_directories
(
${
PRPT_C_DIR
}
)
add_library
(
ASYNC_IF
${
OPENAIR2_DIR
}
/UTIL/ASYNC_IF/socket_link.c
...
...
@@ -740,6 +741,18 @@ if (ENB_AGENT)
set
(
ASYNC_IF_LIB ASYNC_IF
)
include_directories
(
${
OPENAIR2_DIR
}
/UTIL/ASYNC_IF
)
add_library
(
ENB_AGENT
${
OPENAIR2_DIR
}
/ENB_APP/enb_agent_handler.c
${
OPENAIR2_DIR
}
/ENB_APP/enb_agent_common.c
${
OPENAIR2_DIR
}
/ENB_APP/enb_agent_mac.c
${
OPENAIR2_DIR
}
/ENB_APP/enb_agent.c
)
set
(
ENB_AGENT_LIB ENB_AGENT
)
#include_directories(${OPENAIR2_DIR}/ENB_APP)
set
(
PROTOBUF_LIB
"protobuf-c"
)
#set(PROTOBUF_LIB "protobuf") #for Cpp
endif
()
...
...
@@ -1647,15 +1660,16 @@ add_executable(oaisim_nos1
target_include_directories
(
oaisim_nos1 PUBLIC
${
OPENAIR_TARGETS
}
/SIMU/USER
)
target_link_libraries
(
oaisim_nos1
-Wl,--start-group
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS
${
MSC_LIB
}
L2
${
RAL_LIB
}
SIMU SIMU_ETH SECU_OSA
${
ITTI_LIB
}
${
MIH_LIB
}
${
PRPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS
${
MSC_LIB
}
L2
${
RAL_LIB
}
SIMU SIMU_ETH SECU_OSA
${
ITTI_LIB
}
${
MIH_LIB
}
${
PRPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
ENB_AGENT_LIB
}
-Wl,--end-group
)
target_link_libraries
(
oaisim_nos1
${
LIBXML2_LIBRARIES
}
${
LAPACK_LIBRARIES
}
)
target_link_libraries
(
oaisim_nos1 pthread m
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
option_HW_lib
}
${
ATLAS_LIBRARIES
}
${
XFORMS_LIBRARIES
}
${
OPENPGM_LIBRARIES
}
)
${
ATLAS_LIBRARIES
}
${
XFORMS_LIBRARIES
}
${
OPENPGM_LIBRARIES
}
${
PROTOBUF_LIB
}
)
#Force link with forms, regardless XFORMS option
target_link_libraries
(
oaisim_nos1 forms
)
#message("protobuflib is ${PROTOBUF_LIB}")
# Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator
#####################################
...
...
cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
View file @
17251dda
...
...
@@ -48,7 +48,7 @@ set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU True )
set ( OAISIM True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET
Tru
e )
set ( OAI_NW_DRIVER_TYPE_ETHERNET
Fals
e )
set ( OAI_NW_DRIVER_USE_NETLINK True )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
...
...
openair2/ENB_APP/MESSAGES/V2/header.proto
View file @
17251dda
...
...
@@ -3,7 +3,7 @@ package protocol;
message
prp_header
{
optional
uint32
version
=
1
;
optional
uint32
type
=
2
;
optional
uint32
xid
=
3
;
optional
uint32
xid
=
4
;
}
enum
prp_type
{
...
...
@@ -16,3 +16,4 @@ enum prp_type {
PRPT_STATS_REQUEST
=
3
;
PRPT_STATS_REPLY
=
4
;
}
openair2/ENB_APP/MESSAGES/V2/progran.proto
View file @
17251dda
//'syntax = "proto2";'
package
protocol
;
import
"stats_messages.proto"
;
import
"header.proto"
;
message
progran_message
{
oneof
msg
{
required
progran_direction
msg_dir
=
100
;
oneof
msg
{
prp_hello
hello_msg
=
1
;
prp_echo_request
echo_request_msg
=
2
;
prp_echo_reply
echo_reply_msg
=
3
;
...
...
@@ -13,6 +15,32 @@ message progran_message {
}
}
enum
progran_direction
{
//option allow_alias = true;
NOT_SET
=
0
;
INITIATING_MESSAGE
=
1
;
SUCCESSFUL_OUTCOME
=
2
;
UNSUCCESSFUL_OUTCOME
=
3
;
}
enum
progran_err
{
option
allow_alias
=
true
;
// message errors
NO_ERR
=
0
;
MSG_DEQUEUING
=
-
1
;
MSG_ENQUEUING
=
-
2
;
MSG_DECODING
=
-
3
;
MSG_ENCODING
=
-
4
;
MSG_BUILD
=
-
5
;
MSG_NOT_SUPPORTED
=
-
6
;
MSG_NOT_HANDLED
=
-
7
;
MSG_NOT_VALIDATED
=
-
8
;
MSG_OUT_DATED
=
-
9
;
// other erros
UNEXPECTED
=
-
100
;
}
//
// Maintenance and discovery messages
...
...
@@ -34,7 +62,6 @@ message prp_echo_reply {
}
//
// Statistics request and reply message
//
...
...
openair2/ENB_APP/enb_agent.c
0 → 100644
View file @
17251dda
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file
* \brief
* \author
* \date 2016
* \version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include "enb_agent_common.h"
#include "link_manager.h"
#include "log.h"
#include "enb_agent.h"
typedef
uint8_t
xid_t
;
// tx and rx shared context
typedef
struct
{
message_queue_t
*
tx_mq
;
message_queue_t
*
rx_mq
;
xid_t
tx_xid
;
xid_t
rx_xid
;
}
msg_context_t
;
msg_context_t
shared_ctxt
;
void
*
send_thread
(
void
*
arg
);
void
*
receive_thread
(
void
*
arg
);
pthread_t
new_thread
(
void
*
(
*
f
)(
void
*
),
void
*
b
);
void
*
send_thread
(
void
*
arg
)
{
msg_context_t
*
d
=
arg
;
void
*
data
;
int
size
;
int
priority
;
while
(
1
)
{
// need logic for the timer, and
usleep
(
10
);
if
(
message_put
(
d
->
tx_mq
,
data
,
size
,
priority
))
goto
error
;
}
return
NULL
;
error:
printf
(
"receive_thread: there was an error
\n
"
);
return
NULL
;
}
void
*
receive_thread
(
void
*
arg
)
{
msg_context_t
*
d
=
arg
;
void
*
data
;
int
size
;
int
priority
;
err_code_t
err_code
;
Protocol__ProgranMessage
*
msg
;
while
(
1
)
{
if
(
message_get
(
d
->
rx_mq
,
&
data
,
&
size
,
&
priority
)){
err_code
=
PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING
;
goto
error
;
}
LOG_D
(
ENB_APP
,
"received message with size %d
\n
"
,
size
);
msg
=
enb_agent_handle_message
(
d
->
rx_xid
,
data
,
size
);
free
(
data
);
d
->
rx_xid
=
((
d
->
rx_xid
)
+
1
)
%
4
;
d
->
tx_xid
=
d
->
rx_xid
;
// check if there is something to send back to the controller
if
(
msg
!=
NULL
){
data
=
enb_agent_send_message
(
d
->
tx_xid
,
msg
,
&
size
);
if
(
message_put
(
d
->
tx_mq
,
data
,
size
,
priority
)){
err_code
=
PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING
;
goto
error
;
}
LOG_D
(
ENB_APP
,
"sent message with size %d
\n
"
,
size
);
}
}
return
NULL
;
error:
printf
(
"receive_thread: error %d occured
\n
"
,
err_code
);
return
NULL
;
}
/* utility function to create a thread */
pthread_t
new_thread
(
void
*
(
*
f
)(
void
*
),
void
*
b
)
{
pthread_t
t
;
pthread_attr_t
att
;
if
(
pthread_attr_init
(
&
att
)){
fprintf
(
stderr
,
"pthread_attr_init err
\n
"
);
exit
(
1
);
}
if
(
pthread_attr_setdetachstate
(
&
att
,
PTHREAD_CREATE_DETACHED
))
{
fprintf
(
stderr
,
"pthread_attr_setdetachstate err
\n
"
);
exit
(
1
);
}
if
(
pthread_create
(
&
t
,
&
att
,
f
,
b
))
{
fprintf
(
stderr
,
"pthread_create err
\n
"
);
exit
(
1
);
}
if
(
pthread_attr_destroy
(
&
att
))
{
fprintf
(
stderr
,
"pthread_attr_destroy err
\n
"
);
exit
(
1
);
}
return
t
;
}
int
enb_agent_start
(){
socket_link_t
*
link
;
message_queue_t
*
send_queue
;
message_queue_t
*
receive_queue
;
link_manager_t
*
manager
;
LOG_I
(
ENB_APP
,
"starting enb agent client
\n
"
);
link
=
new_link_client
(
"127.0.0.1"
,
2210
);
if
(
link
==
NULL
)
goto
error
;
send_queue
=
new_message_queue
();
if
(
send_queue
==
NULL
)
goto
error
;
receive_queue
=
new_message_queue
();
if
(
receive_queue
==
NULL
)
goto
error
;
manager
=
create_link_manager
(
send_queue
,
receive_queue
,
link
);
if
(
manager
==
NULL
)
goto
error
;
memset
(
&
shared_ctxt
,
0
,
sizeof
(
msg_context_t
));
shared_ctxt
.
tx_mq
=
send_queue
;
shared_ctxt
.
rx_mq
=
receive_queue
;
new_thread
(
receive_thread
,
&
shared_ctxt
);
// new_thread(send_thread, &shared_ctxt);
// while (1) pause();
printf
(
"client ends
\n
"
);
return
0
;
error:
printf
(
"there was an error
\n
"
);
return
1
;
}
int
enb_agent_stop
(){
}
openair2/ENB_APP/enb_agent.h
0 → 100644
View file @
17251dda
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file
* \brief
* \author
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_H_
#define ENB_AGENT_H_
int
enb_agent_start
();
int
enb_agent_stop
();
#endif
openair2/ENB_APP/enb_agent_common.c
0 → 100644
View file @
17251dda
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file
* \brief
* \author
* \date 2016
* \version 0.1
*/
#include "enb_agent_common.h"
#include "log.h"
int
enb_agent_serialize_message
(
Protocol__ProgranMessage
*
msg
,
void
**
buf
,
int
*
size
)
{
*
size
=
protocol__progran_message__get_packed_size
(
msg
);
*
buf
=
malloc
(
*
size
);
if
(
buf
==
NULL
)
goto
error
;
protocol__progran_message__pack
(
msg
,
*
buf
);
return
0
;
error:
LOG_E
(
ENB_APP
,
"an error occured
\n
"
);
// change the com
return
-
1
;
}
/* We assume that the buffer size is equal to the message size.
Should be chekced durint Tx/Rx */
int
enb_agent_deserialize_message
(
void
*
data
,
int
size
,
Protocol__ProgranMessage
**
msg
)
{
*
msg
=
protocol__progran_message__unpack
(
NULL
,
size
,
data
);
if
(
*
msg
==
NULL
)
goto
error
;
return
0
;
error:
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return
-
1
;
}
int
prp_create_header
(
uint32_t
xid
,
Protocol__PrpType
type
,
Protocol__PrpHeader
**
header
)
{
*
header
=
malloc
(
sizeof
(
Protocol__PrpHeader
));
if
(
*
header
==
NULL
)
goto
error
;
protocol__prp_header__init
(
*
header
);
(
*
header
)
->
version
=
PROGRAN_VERSION
;
(
*
header
)
->
has_version
=
1
;
// check if the type is set
(
*
header
)
->
type
=
type
;
(
*
header
)
->
has_type
=
1
;
(
*
header
)
->
xid
=
xid
;
(
*
header
)
->
has_xid
=
1
;
return
0
;
error:
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
int
enb_agent_hello
(
uint32_t
xid
,
Protocol__ProgranMessage
**
msg
)
{
Protocol__PrpHeader
*
header
;
if
(
prp_create_header
(
xid
,
PROTOCOL__PRP_TYPE__PRPT_HELLO
,
&
header
)
!=
0
)
goto
error
;
Protocol__PrpHello
*
hello_msg
;
hello_msg
=
malloc
(
sizeof
(
Protocol__PrpHello
));
if
(
hello_msg
==
NULL
)
goto
error
;
protocol__prp_hello__init
(
hello_msg
);
hello_msg
->
header
=
header
;
*
msg
=
malloc
(
sizeof
(
Protocol__ProgranMessage
));
if
(
*
msg
==
NULL
)
goto
error
;
protocol__progran_message__init
(
*
msg
);
(
*
msg
)
->
msg_case
=
PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG
;
(
*
msg
)
->
msg_dir
=
PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE
;
(
*
msg
)
->
hello_msg
=
hello_msg
;
return
0
;
error:
if
(
header
!=
NULL
)
free
(
header
);
if
(
hello_msg
!=
NULL
)
free
(
hello_msg
);
if
(
*
msg
!=
NULL
)
free
(
*
msg
);
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
int
enb_agent_destroy_hello_message
(
Protocol__ProgranMessage
*
msg
)
{
if
(
msg
->
msg_case
!=
PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG
)
goto
error
;
free
(
msg
->
hello_msg
->
header
);
free
(
msg
->
hello_msg
);
free
(
msg
);
return
0
;
error:
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
int
enb_agent_echo_request
(
uint32_t
xid
,
Protocol__ProgranMessage
**
msg
)
{
Protocol__PrpHeader
*
header
;
if
(
prp_create_header
(
xid
,
PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST
,
&
header
)
!=
0
)
goto
error
;
Protocol__PrpEchoRequest
*
echo_request_msg
;
echo_request_msg
=
malloc
(
sizeof
(
Protocol__PrpEchoRequest
));
if
(
echo_request_msg
==
NULL
)
goto
error
;
protocol__prp_echo_request__init
(
echo_request_msg
);
echo_request_msg
->
header
=
header
;
*
msg
=
malloc
(
sizeof
(
Protocol__ProgranMessage
));
if
(
*
msg
==
NULL
)
goto
error
;
protocol__progran_message__init
(
*
msg
);
(
*
msg
)
->
msg_case
=
PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG
;
(
*
msg
)
->
msg_dir
=
PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE
;
(
*
msg
)
->
echo_request_msg
=
echo_request_msg
;
return
0
;
error:
if
(
header
!=
NULL
)
free
(
header
);
if
(
echo_request_msg
!=
NULL
)
free
(
echo_request_msg
);
if
(
*
msg
!=
NULL
)
free
(
*
msg
);
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return
-
1
;
}
int
enb_agent_destroy_echo_request
(
Protocol__ProgranMessage
*
msg
)
{
if
(
msg
->
msg_case
!=
PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG
)
goto
error
;
free
(
msg
->
echo_request_msg
->
header
);
free
(
msg
->
echo_request_msg
);
free
(
msg
);
return
0
;
error:
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
int
enb_agent_echo_reply
(
uint32_t
xid
,
Protocol__ProgranMessage
**
msg
)
{
Protocol__PrpHeader
*
header
;
if
(
prp_create_header
(
xid
,
PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY
,
&
header
)
!=
0
)
goto
error
;
Protocol__PrpEchoReply
*
echo_reply_msg
;
echo_reply_msg
=
malloc
(
sizeof
(
Protocol__PrpEchoReply
));
if
(
echo_reply_msg
==
NULL
)
goto
error
;
protocol__prp_echo_reply__init
(
echo_reply_msg
);
echo_reply_msg
->
header
=
header
;
*
msg
=
malloc
(
sizeof
(
Protocol__ProgranMessage
));
if
(
*
msg
==
NULL
)
goto
error
;
protocol__progran_message__init
(
*
msg
);
(
*
msg
)
->
msg_case
=
PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG
;
(
*
msg
)
->
msg_dir
=
PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME
;
(
*
msg
)
->
echo_reply_msg
=
echo_reply_msg
;
return
0
;
error:
if
(
header
!=
NULL
)
free
(
header
);
if
(
echo_reply_msg
!=
NULL
)
free
(
echo_reply_msg
);
if
(
*
msg
!=
NULL
)
free
(
*
msg
);
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
int
enb_agent_destroy_echo_reply
(
Protocol__ProgranMessage
*
msg
)
{
if
(
msg
->
msg_case
!=
PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG
)
goto
error
;
free
(
msg
->
echo_reply_msg
->
header
);
free
(
msg
->
echo_reply_msg
);
free
(
msg
);
return
0
;
error:
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
openair2/ENB_APP/enb_agent_common.h
0 → 100644
View file @
17251dda
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,