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
881a6d4a
Commit
881a6d4a
authored
Oct 29, 2020
by
zhenghuangkun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add nas message for registration complete
parent
8cff73dc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
344 additions
and
2 deletions
+344
-2
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c
+61
-0
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h
+41
-0
openair3/NAS/COMMON/IES/SORTransparentContainer.c
openair3/NAS/COMMON/IES/SORTransparentContainer.c
+103
-0
openair3/NAS/COMMON/IES/SORTransparentContainer.h
openair3/NAS/COMMON/IES/SORTransparentContainer.h
+45
-0
openair3/NAS/NR_UE/nr_nas_msg_sim.c
openair3/NAS/NR_UE/nr_nas_msg_sim.c
+57
-0
openair3/NAS/NR_UE/nr_nas_msg_sim.h
openair3/NAS/NR_UE/nr_nas_msg_sim.h
+37
-2
No files found.
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c
0 → 100644
View file @
881a6d4a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "RegistrationComplete.h"
#include "SORTransparentContainer.h"
int
decode_registration_complete
(
registration_complete_msg
*
registration_complete
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
decoded
=
0
;
int
decoded_result
=
0
;
/* Decoding mandatory fields */
if
((
decoded_result
=
decode_sor_transparent_container
(
&
registration_complete
->
sortransparentcontainer
,
0
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decoded_result
;
else
decoded
+=
decoded_result
;
return
decoded
;
}
int
encode_registration_complete
(
registration_complete_msg
*
registration_complete
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
encoded
=
0
;
int
encode_result
=
0
;
if
((
encode_result
=
encode_sor_transparent_container
(
&
registration_complete
->
sortransparentcontainer
,
0
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//Return in case of error
return
encode_result
;
else
encoded
+=
encode_result
;
return
encoded
;
}
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h
0 → 100644
View file @
881a6d4a
/*! \file RegistrationRequest.h
\brief registration request procedures for gNB
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "SpareHalfOctet.h"
#include "MessageType.h"
#include "SORTransparentContainer.h"
#ifndef REGISTRATION_COMPLETE_H_
#define REGISTRATION_COMPLETE_H_
typedef
struct
registration_complete_msg_tag
{
/* Mandatory fields */
ExtendedProtocolDiscriminator
protocoldiscriminator
;
SecurityHeaderType
securityheadertype
:
4
;
SpareHalfOctet
sparehalfoctet
:
4
;
MessageType
messagetype
;
/* Optional fields */
SORTransparentContainer
sortransparentcontainer
;
}
registration_complete_msg
;
int
decode_registration_complete
(
registration_complete_msg
*
registrationcomplete
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encode_registration_complete
(
registration_complete_msg
*
registrationcomplete
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* ! defined(REGISTRATION_COMPLETE_H_) */
openair3/NAS/COMMON/IES/SORTransparentContainer.c
0 → 100644
View file @
881a6d4a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "SORTransparentContainer.h"
#include "nas_log.h"
//#define NAS_DEBUG 1
int
decode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
int
decode_result
;
uint16_t
ielen
;
LOG_FUNC_IN
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
(
iei
,
*
buffer
);
decoded
++
;
}
DECODE_LENGTH_U16
(
buffer
+
decoded
,
ielen
,
decoded
);
CHECK_LENGTH_DECODER
(
len
-
decoded
,
ielen
);
if
((
decode_result
=
decode_octet_string
(
&
sortransparentcontainer
->
sortransparentcontainercontents
,
ielen
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
{
LOG_FUNC_RETURN
(
decode_result
);
}
else
{
decoded
+=
decode_result
;
}
#if defined (NAS_DEBUG)
dump_sor_transparent_container_xml
(
sortransparentcontainer
,
iei
);
#endif
LOG_FUNC_RETURN
(
decoded
);
}
int
encode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint8_t
*
lenPtr
;
uint32_t
encoded
=
0
;
int32_t
encode_result
;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
SOR_TRANSPARENT_CONTAINER_MINIMUM_LENGTH
,
len
);
#if defined (NAS_DEBUG)
dump_sor_transparent_container_xml
(
sortransparentcontainer
,
iei
);
#endif
if
(
iei
>
0
)
{
*
buffer
=
iei
;
encoded
++
;
}
lenPtr
=
(
buffer
+
encoded
);
//encoded += 2;
//if ((encode_result = encode_octet_string(&sortransparentcontainer->sortransparentcontainercontents, buffer + sizeof(uint16_t), len - sizeof(uint16_t))) < 0)
if
((
encode_result
=
encode_octet_string
(
&
sortransparentcontainer
->
sortransparentcontainercontents
,
lenPtr
+
sizeof
(
uint16_t
),
len
-
sizeof
(
uint16_t
)))
<
0
)
return
encode_result
;
else
encoded
+=
encode_result
;
ENCODE_U16
(
lenPtr
,
encode_result
,
encoded
);
return
encoded
;
}
void
dump_sor_transparent_container_xml
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
)
{
printf
(
"<SOR Transparent Container>
\n
"
);
if
(
iei
>
0
)
/* Don't display IEI if = 0 */
printf
(
" <IEI>0x%X</IEI>
\n
"
,
iei
);
printf
(
"%s"
,
dump_octet_string_xml
(
&
sortransparentcontainer
->
sortransparentcontainercontents
));
printf
(
"</SOR Transparent Container>
\n
"
);
}
openair3/NAS/COMMON/IES/SORTransparentContainer.h
0 → 100644
View file @
881a6d4a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "OctetString.h"
#ifndef SOR_TRANSPARENT_CONTAINER_H_
#define SOR_TRANSPARENT_CONTAINER_H_
#define SOR_TRANSPARENT_CONTAINER_MINIMUM_LENGTH 2 // [length]+[length]
#define SOR_TRANSPARENT_CONTAINER_MAXIMUM_LENGTH 65538 // [IEI]+[length]+[length]+[ESM msg]
typedef
struct
SORTransparentContainer_tag
{
OctetString
sortransparentcontainercontents
;
}
SORTransparentContainer
;
int
encode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
void
dump_sor_transparent_container_xml
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
);
#endif
/* ESM MESSAGE CONTAINER_H_ */
openair3/NAS/NR_UE/nr_nas_msg_sim.c
View file @
881a6d4a
...
...
@@ -146,3 +146,60 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
}
void
generateRegistrationComplete
(
as_nas_info_t
*
ulNasMsg
,
SORTransparentContainer
*
sortransparentcontainer
)
{
int
length
=
sizeof
(
fgs_nas_message_security_header_t
);
int
size
=
0
;
fgs_nas_message_t
nas_msg
;
memset
(
&
nas_msg
,
0
,
sizeof
(
fgs_nas_message_t
));
fgs_nas_message_security_protected_t
*
sp_msg
;
sp_msg
=
&
nas_msg
.
security_protected
;
// set header
sp_msg
->
header
.
protocol_discriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
sp_msg
->
header
.
security_header_type
=
INTEGRITY_PROTECTED_AND_CIPHERED
;
sp_msg
->
header
.
message_authentication_code
=
0x8fc59d96
;
sp_msg
->
header
.
sequence_number
=
1
;
sp_msg
->
plain
.
mm_msg
.
registration_complete
.
protocoldiscriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
length
+=
1
;
sp_msg
->
plain
.
mm_msg
.
registration_complete
.
securityheadertype
=
PLAIN_5GS_MSG
;
sp_msg
->
plain
.
mm_msg
.
registration_complete
.
sparehalfoctet
=
0
;
length
+=
1
;
sp_msg
->
plain
.
mm_msg
.
registration_complete
.
messagetype
=
REGISTRATION_REQUEST
;
length
+=
1
;
if
(
sortransparentcontainer
)
{
length
+=
sortransparentcontainer
->
sortransparentcontainercontents
.
length
;
}
// encode the message
ulNasMsg
->
data
=
(
Byte_t
*
)
malloc
(
length
*
sizeof
(
Byte_t
));
/* Encode the first octet of the header (extended protocol discriminator) */
ENCODE_U8
(
ulNasMsg
->
data
+
size
,
sp_msg
->
header
.
protocol_discriminator
,
size
);
/* Encode the security header type */
ENCODE_U8
(
ulNasMsg
->
data
+
size
,
sp_msg
->
header
.
security_header_type
,
size
);
/* Encode the message authentication code */
ENCODE_U32
(
ulNasMsg
->
data
+
size
,
sp_msg
->
header
.
message_authentication_code
,
size
);
/* Encode the sequence number */
ENCODE_U8
(
ulNasMsg
->
data
+
size
,
sp_msg
->
header
.
sequence_number
,
size
);
/* Encode the extended protocol discriminator */
ENCODE_U8
(
ulNasMsg
->
data
+
size
,
sp_msg
->
plain
.
mm_msg
.
registration_complete
.
protocoldiscriminator
,
size
);
/* Encode the security header type */
ENCODE_U8
(
ulNasMsg
->
data
+
size
,
sp_msg
->
plain
.
mm_msg
.
registration_complete
.
securityheadertype
,
size
);
/* Encode the message type */
ENCODE_U8
(
ulNasMsg
->
data
+
size
,
sp_msg
->
plain
.
mm_msg
.
registration_complete
.
messagetype
,
size
);
if
(
sortransparentcontainer
)
{
encode_registration_complete
(
&
sp_msg
->
plain
.
mm_msg
.
registration_complete
,
ulNasMsg
->
data
+
size
,
length
-
size
);
}
}
openair3/NAS/NR_UE/nr_nas_msg_sim.h
View file @
881a6d4a
...
...
@@ -12,16 +12,50 @@
#define __NR_NAS_MSG_SIM_H__
#include "RegistrationRequest.h"
#include "RegistrationComplete.h"
#include "as_message.h"
#define PLAIN_5GS_MSG 0b0000
#define INTEGRITY_PROTECTED 0b0001
#define INTEGRITY_PROTECTED_AND_CIPHERED 0b0010
#define REGISTRATION_REQUEST 0b01000001
/* 65 = 0x41 */
#define INITIAL_REGISTRATION 0b001
#define REGISTRATION_REQUEST 0b01000001
/* 65 = 0x41 */
#define REGISTRATION_ACCEPT 0b01000010
/* 66 = 0x42 */
#define REGISTRATION_COMPLETE 0b01000011
/* 67 = 0x43 */
#define REGISTRATION_REJECT 0b01000100
/* 68 = 0x44 */
#define DEREGISTRATION_REQUEST_UE_ORIGINATING 0b01000101
/* 69 = 0x45 */
#define DEREGISTRATION_ACCEPT_UE_ORIGINATING 0b01000110
/* 70 = 0x46 */
#define DEREGISTRATION_REQUEST_UE_TERMINATED 0b01000111
/* 71 = 0x47 */
#define DEREGISTRATION_ACCEPT_UE_TERMINATED 0b01001000
/* 72 = 0x48 */
#define FIVEGMM_SERVICE_REQUEST 0b01001100
/* 76 = 0x4c */
#define FIVEGMM_SERVICE_REJECT 0b01001101
/* 77 = 0x4d */
#define FIVEGMM_SERVICE_ACCEPT 0b01001110
/* 78 = 0x4e */
#define CONFIGURATION_UPDATE_COMMAND 0b01010100
/* 84 = 0x54 */
#define CONFIGURATION_UPDATE_COMPLETE 0b01010101
/* 85 = 0x55 */
#define AUTHENTICATION_REQUEST 0b01010110
/* 86 = 0x56 */
#define AUTHENTICATION_RESPONSE 0b01010111
/* 87 = 0x57 */
#define AUTHENTICATION_REJECT 0b01011000
/* 88 = 0x58 */
#define AUTHENTICATION_FAILURE 0b01011001
/* 89 = 0x59 */
#define AUTHENTICATION_RESULT 0b01011010
/* 90 = 0x5a */
#define FIVEGMM_IDENTITY_REQUEST 0b01011011
/* 91 = 0x5b */
#define FIVEGMM_IDENTITY_RESPONSE 0b01011100
/* 92 = 0x5c */
#define FIVEGMM_SECURITY_MODE_COMMAND 0b01011101
/* 93 = 0x5d */
#define FIVEGMM_SECURITY_MODE_COMPLETE 0b01011110
/* 94 = 0x5e */
#define FIVEGMM_SECURITY_MODE_REJECT 0b01011111
/* 95 = 0x5f */
#define FIVEGMM_STATUS 0b01100100
/* 100 = 0x64 */
#define NOTIFICATION 0b01100101
/* 101 = 0x65 */
#define NOTIFICATION_RESPONSE 0b01100110
/* 102 = 0x66 */
#define UL_NAS_TRANSPORT 0b01100111
/* 103 = 0x67 */
#define DL_NAS_TRANSPORT 0b01101000
/* 104 = 0x68 */
typedef
enum
fgs_protocol_discriminator_e
{
/* Protocol discriminator identifier for 5GS Mobility Management */
FGS_MOBILITY_MANAGEMENT_MESSAGE
=
0x7E
,
...
...
@@ -48,6 +82,7 @@ typedef struct {
typedef
union
{
mm_msg_header_t
header
;
registration_request_msg
registration_request
;
registration_complete_msg
registration_complete
;
}
MM_msg
;
...
...
@@ -69,5 +104,5 @@ typedef union {
}
fgs_nas_message_t
;
void
generateRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
);
void
generateRegistrationComplete
(
as_nas_info_t
*
ulNasMsg
,
SORTransparentContainer
*
sortransparentcontainer
);
#endif
/* __NR_NAS_MSG_SIM_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