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
zzha zzha
OpenXG-RAN
Commits
840dd7bc
Commit
840dd7bc
authored
Nov 03, 2014
by
Lionel Gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@5957
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
1ad05afd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
13 deletions
+45
-13
openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c
openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c
+1
-1
openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
+44
-12
No files found.
openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c
View file @
840dd7bc
...
@@ -210,7 +210,7 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort,
...
@@ -210,7 +210,7 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort,
*
((
NwU32T
*
)
msgHdr
)
=
htonl
(
pMsg
->
teid
);
*
((
NwU32T
*
)
msgHdr
)
=
htonl
(
pMsg
->
teid
);
msgHdr
+=
4
;
msgHdr
+=
4
;
GTPU_DEBUG
(
"nwGtpv1uCreateAndSendMsg to teid %u
\n
"
,
pMsg
->
teid
);
GTPU_DEBUG
(
"nwGtpv1uCreateAndSendMsg to teid %u
length %d
\n
"
,
pMsg
->
teid
,
pMsg
->
msgLen
);
if
(
pMsg
->
seqNumFlag
||
pMsg
->
extHdrFlag
||
pMsg
->
npduNumFlag
)
{
if
(
pMsg
->
seqNumFlag
||
pMsg
->
extHdrFlag
||
pMsg
->
npduNumFlag
)
{
*
((
NwU16T
*
)
msgHdr
)
=
(
pMsg
->
seqNumFlag
?
htons
(
pMsg
->
seqNum
)
:
0x0000
);
*
((
NwU16T
*
)
msgHdr
)
=
(
pMsg
->
seqNumFlag
?
htons
(
pMsg
->
seqNum
)
:
0x0000
);
...
...
openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
View file @
840dd7bc
...
@@ -120,7 +120,8 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
...
@@ -120,7 +120,8 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_OUT
NwGtpv1uMsgHandleT
*
phMsg
)
NW_OUT
NwGtpv1uMsgHandleT
*
phMsg
)
{
{
NwGtpv1uStackT
*
pStack
=
(
NwGtpv1uStackT
*
)
hGtpuStackHandle
;
NwGtpv1uStackT
*
pStack
=
(
NwGtpv1uStackT
*
)
hGtpuStackHandle
;
NwGtpv1uMsgT
*
pMsg
;
NwGtpv1uMsgT
*
pMsg
;
NwU32T
header_len
=
0
;
if
(
gpGtpv1uMsgPool
)
{
if
(
gpGtpv1uMsgPool
)
{
pMsg
=
gpGtpv1uMsgPool
;
pMsg
=
gpGtpv1uMsgPool
;
...
@@ -130,26 +131,57 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
...
@@ -130,26 +131,57 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
}
}
if
(
pMsg
)
{
if
(
pMsg
)
{
// Version field: This field is used to determine the version of the GTP-U protocol.
// The version number shall be set to '1'.
pMsg
->
version
=
NW_GTPU_VERSION
;
pMsg
->
version
=
NW_GTPU_VERSION
;
// Protocol Type (PT): This bit is used as a protocol discriminator between GTP (when PT is '1')
// and GTP' (when PT is '0'). GTP is described in this document and the GTP' protocol in 3GPP TS 32.295 [8].
// Note that the interpretation of the header fields may be different in GTP' than in GTP.
pMsg
->
protocolType
=
NW_GTP_PROTOCOL_TYPE_GTP
;
pMsg
->
protocolType
=
NW_GTP_PROTOCOL_TYPE_GTP
;
// Extension Header flag (E): This flag indicates the presence of a meaningful value of the Next Extension
// Header field. When it is set to '0', the Next Extension Header field either is not present or, if present,
// shall not be interpreted.
pMsg
->
extHdrFlag
=
NW_FALSE
;
pMsg
->
extHdrFlag
=
NW_FALSE
;
// Sequence number flag (S): This flag indicates the presence of a meaningful value of the Sequence Number field.
// When it is set to '0', the Sequence Number field either is not present or, if present, shall not be interpreted.
// When it is set to '1', the Sequence Number field is present, and shall be interpreted, as described below in
// this section.
// For the Echo Request, Echo Response, Error Indication and Supported Extension Headers Notification
// messages, the S flag shall be set to '1'. Since the use of Sequence Numbers is optional for G-PDUs, the PGW,
// SGW, ePDG and eNodeB should set the flag to '0'. However, when a G-PDU (T-PDU+header) is being relayed
// by the Indirect Data Forwarding for Inter RAT HO procedure, then if the received G-PDU has the S flag set to
// '1', then the relaying entity shall set S flag to '1' and forward the G-PDU (T-PDU+header). In an End marker
// message the S flag shall be set to '0'.
pMsg
->
seqNumFlag
=
(
seqNumFlag
?
NW_TRUE
:
NW_FALSE
);
pMsg
->
seqNumFlag
=
(
seqNumFlag
?
NW_TRUE
:
NW_FALSE
);
pMsg
->
npduNumFlag
=
NW_FALSE
;
pMsg
->
msgType
=
NW_GTP_GPDU
;
pMsg
->
teid
=
teid
;
pMsg
->
seqNum
=
seqNum
;
pMsg
->
seqNum
=
seqNum
;
// N-PDU Number flag (PN): This flag indicates the presence of a meaningful value of the N-PDU Number field.
// When it is set to '0', the N-PDU Number field either is not present, or, if present, shall not be interpreted.
// When it is set to '1', the N-PDU Number field is present, and shall be interpreted.
pMsg
->
npduNumFlag
=
NW_FALSE
;
pMsg
->
npduNum
=
0x00
;
pMsg
->
npduNum
=
0x00
;
pMsg
->
nextExtHdrType
=
0x00
;
// Message Type: This field indicates the type of GTP-U message.
pMsg
->
msgType
=
NW_GTP_GPDU
;
// Length: This field indicates the length in octets of the payload, i.e. the rest of the packet following the
// mandatory part of the GTP header (that is the first 8 octets).
// The Sequence Number, the N-PDU Number or any Extension headers shall be considered to be part of the payload,
// i.e. included in the length count.
header_len
=
((
pMsg
->
seqNumFlag
||
pMsg
->
npduNumFlag
||
pMsg
->
extHdrFlag
)
?
NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE
:
NW_GTPV1U_EPC_MIN_HEADER_SIZE
);
pMsg
->
msgLen
=
((
pMsg
->
seqNumFlag
||
pMsg
->
npduNumFlag
pMsg
->
msgLen
=
((
pMsg
->
seqNumFlag
||
pMsg
->
npduNumFlag
||
pMsg
->
extHdrFlag
)
?
||
pMsg
->
extHdrFlag
)
?
NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE
:
(
NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE
-
4
));
(
NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE
-
NW_GTPV1U_EPC_MIN_HEADER_SIZE
)
+
tpduLength
:
tpduLength
);
memcpy
(
pMsg
->
msgBuf
+
pMsg
->
msgLen
,
tpdu
,
tpduLength
);
// Tunnel Endpoint Identifier (TEID): This field unambiguously identifies a tunnel endpoint in the receiving
pMsg
->
msgLen
+=
tpduLength
;
// GTP-U protocol entity. The receiving end side of a GTP tunnel locally assigns the TEID value the transmitting
pMsg
->
msgLen
=
pMsg
->
msgLen
-
((
pMsg
->
seqNumFlag
||
pMsg
->
npduNumFlag
// side has to use. The TEID shall be used by the receiving entity to find the PDP context, except for the
||
pMsg
->
extHdrFlag
)
?
// following cases:
NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE
:
(
NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE
-
4
));
// - The Echo Request/Response and Supported Extension Headers notification messages, where the Tunnel
// Endpoint Identifier shall be set to all zeroes.
// - The Error Indication message where the Tunnel Endpoint Identifier shall be set to all zeros.
pMsg
->
teid
=
teid
;
pMsg
->
nextExtHdrType
=
0x00
;
memcpy
(
pMsg
->
msgBuf
+
header_len
,
tpdu
,
tpduLength
);
*
phMsg
=
(
NwGtpv1uMsgHandleT
)
pMsg
;
*
phMsg
=
(
NwGtpv1uMsgHandleT
)
pMsg
;
return
NW_GTPV1U_OK
;
return
NW_GTPV1U_OK
;
}
}
...
...
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