Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Black
OpenXG-RAN
Commits
008a70c9
Commit
008a70c9
authored
Apr 18, 2014
by
Lionel Gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@5274
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
c71fd045
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
43 deletions
+87
-43
openair2/X2AP/x2ap_common.c
openair2/X2AP/x2ap_common.c
+75
-32
openair2/X2AP/x2ap_common.h
openair2/X2AP/x2ap_common.h
+12
-11
No files found.
openair2/X2AP/x2ap_common.c
View file @
008a70c9
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 201
2
Eurecom
Copyright(c) 1999 - 201
4
Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
...
...
@@ -30,26 +30,43 @@
/*! \file x2ap_common.c
* \brief x2ap procedures for both eNB and MME
* \author Sebastien ROUX <sebastien.roux@eurecom.fr>
* \date 201
2
* \author Sebastien ROUX <sebastien.roux@eurecom.fr>
, Lionel GAUTHIER <Lionel.GAUTHIER@eurecom.fr>
* \date 201
4
* \version 0.1
*/
#include <stdint.h>
#include "x2ap_common.h"
#include "X2AP-PDU.h"
int
asn_debug
=
0
;
int
asn1_xer_print
=
0
;
#if defined(EMIT_ASN_DEBUG_EXTERN)
inline
void
ASN_DEBUG
(
const
char
*
fmt
,
...)
{
if
(
asn_debug
)
{
int
adi
=
asn_debug_indent
;
va_list
ap
;
va_start
(
ap
,
fmt
);
fprintf
(
stderr
,
"[ASN1]"
);
while
(
adi
--
)
fprintf
(
stderr
,
" "
);
vfprintf
(
stderr
,
fmt
,
ap
);
fprintf
(
stderr
,
"
\n
"
);
va_end
(
ap
);
}
}
#endif
ssize_t
x2ap_generate_initiating_message
(
uint8_t
**
buffer
,
uint32_t
*
length
,
e_
ProcedureCode
procedureCode
,
Criticality_t
criticality
,
e_
X2ap_ProcedureCode
procedureCode
,
X2ap_Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
void
*
sptr
)
{
X2AP_PDU_t
pdu
;
ssize_t
encoded
;
...
...
@@ -60,10 +77,15 @@ ssize_t x2ap_generate_initiating_message(
pdu
.
choice
.
initiatingMessage
.
criticality
=
criticality
;
ANY_fromType_aper
(
&
pdu
.
choice
.
initiatingMessage
.
value
,
td
,
sptr
);
if
(
asn1_xer_print
)
xer_fprint
(
stdout
,
&
asn_DEF_X2AP_PDU
,(
void
*
)
&
pdu
);
if
(
asn1_xer_print
)
{
xer_fprint
(
stdout
,
&
asn_DEF_X2AP_PDU
,
(
void
*
)
&
pdu
);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY
(
*
td
,
sptr
);
if
((
encoded
=
aper_encode_to_new_buffer
(
&
asn_DEF_X2AP_PDU
,
0
,
&
pdu
,
(
void
**
)
buffer
))
<
0
)
{
if
((
encoded
=
aper_encode_to_new_buffer
(
&
asn_DEF_X2AP_PDU
,
0
,
&
pdu
,
(
void
**
)
buffer
))
<
0
)
{
return
-
1
;
}
...
...
@@ -74,11 +96,11 @@ ssize_t x2ap_generate_initiating_message(
ssize_t
x2ap_generate_successfull_outcome
(
uint8_t
**
buffer
,
uint32_t
*
length
,
e_ProcedureCode
procedureCode
,
Criticality_t
criticality
,
e_
X2ap_
ProcedureCode
procedureCode
,
X2ap_
Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
void
*
sptr
)
{
X2AP_PDU_t
pdu
;
ssize_t
encoded
;
...
...
@@ -89,7 +111,15 @@ ssize_t x2ap_generate_successfull_outcome(
pdu
.
choice
.
successfulOutcome
.
criticality
=
criticality
;
ANY_fromType_aper
(
&
pdu
.
choice
.
successfulOutcome
.
value
,
td
,
sptr
);
if
((
encoded
=
aper_encode_to_new_buffer
(
&
asn_DEF_X2AP_PDU
,
0
,
&
pdu
,
(
void
**
)
buffer
))
<
0
)
{
if
(
asn1_xer_print
)
{
xer_fprint
(
stdout
,
&
asn_DEF_X2AP_PDU
,
(
void
*
)
&
pdu
);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY
(
*
td
,
sptr
);
if
((
encoded
=
aper_encode_to_new_buffer
(
&
asn_DEF_X2AP_PDU
,
0
,
&
pdu
,
(
void
**
)
buffer
))
<
0
)
{
return
-
1
;
}
...
...
@@ -101,11 +131,11 @@ ssize_t x2ap_generate_successfull_outcome(
ssize_t
x2ap_generate_unsuccessfull_outcome
(
uint8_t
**
buffer
,
uint32_t
*
length
,
e_ProcedureCode
procedureCode
,
Criticality_t
criticality
,
e_
X2ap_
ProcedureCode
procedureCode
,
X2ap_
Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
void
*
sptr
)
{
X2AP_PDU_t
pdu
;
ssize_t
encoded
;
...
...
@@ -116,7 +146,15 @@ ssize_t x2ap_generate_unsuccessfull_outcome(
pdu
.
choice
.
successfulOutcome
.
criticality
=
criticality
;
ANY_fromType_aper
(
&
pdu
.
choice
.
successfulOutcome
.
value
,
td
,
sptr
);
if
((
encoded
=
aper_encode_to_new_buffer
(
&
asn_DEF_X2AP_PDU
,
0
,
&
pdu
,
(
void
**
)
buffer
))
<
0
)
{
if
(
asn1_xer_print
)
{
xer_fprint
(
stdout
,
&
asn_DEF_X2AP_PDU
,
(
void
*
)
&
pdu
);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY
(
*
td
,
sptr
);
if
((
encoded
=
aper_encode_to_new_buffer
(
&
asn_DEF_X2AP_PDU
,
0
,
&
pdu
,
(
void
**
)
buffer
))
<
0
)
{
return
-
1
;
}
...
...
@@ -125,27 +163,31 @@ ssize_t x2ap_generate_unsuccessfull_outcome(
return
encoded
;
}
IE_t
*
x2ap_new_ie
(
ProtocolIE_ID_t
id
,
Criticality_t
criticality
,
X2ap_
IE_t
*
x2ap_new_ie
(
X2ap_ProtocolIE_ID_t
id
,
X2ap_Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
type
,
void
*
sptr
)
{
void
*
sptr
)
{
X2ap_IE_t
*
buff
;
IE_t
*
buff
;
if
((
buff
=
malloc
(
sizeof
(
IE_t
)))
==
NULL
)
{
if
((
buff
=
malloc
(
sizeof
(
X2ap_IE_t
)))
==
NULL
)
{
// Possible error on malloc
return
NULL
;
}
memset
((
void
*
)
buff
,
0
,
sizeof
(
IE_t
));
memset
((
void
*
)
buff
,
0
,
sizeof
(
X2ap_
IE_t
));
buff
->
id
=
id
;
buff
->
criticality
=
criticality
;
ANY_fromType_aper
(
&
buff
->
value
,
type
,
sptr
);
if
(
ANY_fromType_aper
(
&
buff
->
value
,
type
,
sptr
)
<
0
)
{
fprintf
(
stderr
,
"Encoding of %s failed
\n
"
,
type
->
name
);
free
(
buff
);
return
NULL
;
}
if
(
asn1_xer_print
)
if
(
xer_fprint
(
stdout
,
&
asn_DEF_IE
,
buff
)
<
0
)
{
if
(
xer_fprint
(
stdout
,
&
asn_DEF_
X2ap_
IE
,
buff
)
<
0
)
{
free
(
buff
);
return
NULL
;
}
...
...
@@ -153,6 +195,7 @@ IE_t *x2ap_new_ie(
return
buff
;
}
void
x2ap_handle_criticality
(
e_Criticality
criticality
)
{
void
x2ap_handle_criticality
(
X2ap_Criticality_t
criticality
)
{
}
openair2/X2AP/x2ap_common.h
View file @
008a70c9
...
...
@@ -288,8 +288,8 @@ typedef int (*x2ap_message_decoded_callback)(
ssize_t
x2ap_generate_successfull_outcome
(
uint8_t
**
buffer
,
uint32_t
*
length
,
e_ProcedureCode
procedureCode
,
Criticality_t
criticality
,
e_
X2ap_
ProcedureCode
procedureCode
,
X2ap_
Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
);
...
...
@@ -305,8 +305,8 @@ ssize_t x2ap_generate_successfull_outcome(
ssize_t
x2ap_generate_initiating_message
(
uint8_t
**
buffer
,
uint32_t
*
length
,
e_
ProcedureCode
procedureCode
,
Criticality_t
criticality
,
e_
X2ap_ProcedureCode
procedureCode
,
X2ap_Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
);
...
...
@@ -322,8 +322,8 @@ ssize_t x2ap_generate_initiating_message(
ssize_t
x2ap_generate_unsuccessfull_outcome
(
uint8_t
**
buffer
,
uint32_t
*
length
,
e_ProcedureCode
procedureCode
,
Criticality_t
criticality
,
e_
X2ap_
ProcedureCode
procedureCode
,
X2ap_
Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
);
...
...
@@ -334,8 +334,9 @@ ssize_t x2ap_generate_unsuccessfull_outcome(
\param sptr Structure to be encoded in the value field
@returns a pointer to the newly created IE structure or NULL in case of failure
**/
IE_t
*
x2ap_new_ie
(
ProtocolIE_ID_t
id
,
Criticality_t
criticality
,
X2ap_IE_t
*
x2ap_new_ie
(
X2ap_ProtocolIE_ID_t
id
,
X2ap_Criticality_t
criticality
,
asn_TYPE_descriptor_t
*
type
,
void
*
sptr
);
...
...
@@ -343,6 +344,6 @@ IE_t *x2ap_new_ie(ProtocolIE_ID_t id,
\param criticality Criticality of the IE
@returns void
**/
void
x2ap_handle_criticality
(
e_Criticality
criticality
);
void
x2ap_handle_criticality
(
X2ap_Criticality_t
criticality
);
#endif
/* X2AP_COMMON_H_ */
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