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
alex037yang
OpenXG-RAN
Commits
e15f0b28
Commit
e15f0b28
authored
Oct 20, 2020
by
heshanyun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add struct for registration request message
parent
fad30fff
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
628 additions
and
0 deletions
+628
-0
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c
+71
-0
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h
+99
-0
openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c
openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c
+28
-0
openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h
openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h
+26
-0
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
+156
-0
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
+113
-0
openair3/NAS/COMMON/IES/FGSRegistrationType.c
openair3/NAS/COMMON/IES/FGSRegistrationType.c
+43
-0
openair3/NAS/COMMON/IES/FGSRegistrationType.h
openair3/NAS/COMMON/IES/FGSRegistrationType.h
+35
-0
openair3/NAS/COMMON/IES/SpareHalfOctet.c
openair3/NAS/COMMON/IES/SpareHalfOctet.c
+28
-0
openair3/NAS/COMMON/IES/SpareHalfOctet.h
openair3/NAS/COMMON/IES/SpareHalfOctet.h
+29
-0
No files found.
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c
0 → 100644
View file @
e15f0b28
/*! \file RegistrationRequest.c
\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 <string.h>
#include <stdint.h>
#include "nas_log.h"
#include "RegistrationRequest.h"
int
decode_registration_request
(
registration_request_msg
*
registration_request
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
decoded
=
0
;
int
decoded_result
=
0
;
LOG_FUNC_IN
;
LOG_TRACE
(
INFO
,
"EMM - registration_request len = %d"
,
len
);
/* Decoding mandatory fields */
if
((
decoded_result
=
decode_5gs_registration_type
(
&
registration_request
->
fgsregistrationtype
,
0
,
*
(
buffer
+
decoded
)
&
0x0f
,
len
-
decoded
))
<
0
)
{
// return decoded_result;
LOG_FUNC_RETURN
(
decoded_result
);
}
if
((
decoded_result
=
decode_u8_nas_key_set_identifier
(
&
registration_request
->
naskeysetidentifier
,
0
,
*
(
buffer
+
decoded
)
>>
4
,
len
-
decoded
))
<
0
)
{
// return decoded_result;
LOG_FUNC_RETURN
(
decoded_result
);
}
decoded
++
;
if
((
decoded_result
=
decode_5gs_mobile_identity
(
&
registration_request
->
fgsmobileidentity
,
0
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
{
// return decoded_result;
LOG_FUNC_RETURN
(
decoded_result
);
}
else
decoded
+=
decoded_result
;
// TODO, Decoding optional fields
return
decoded
;
}
int
encode_registration_request
(
registration_request_msg
*
registration_request
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
encoded
=
0
;
int
encode_result
=
0
;
*
(
buffer
+
encoded
)
=
((
encode_u8_nas_key_set_identifier
(
&
registration_request
->
naskeysetidentifier
)
&
0x0f
)
<<
4
)
|
(
encode_5gs_registration_type
(
&
registration_request
->
fgsregistrationtype
)
&
0x0f
);
encoded
++
;
if
((
encode_result
=
encode_5gs_mobile_identity
(
&
registration_request
->
fgsmobileidentity
,
0
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//Return in case of error
return
encode_result
;
else
encoded
+=
encode_result
;
// TODO, Eecoding optional fields
return
encoded
;
}
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h
0 → 100644
View file @
e15f0b28
/*! \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 "FGSMobileIdentity.h"
#include "NasKeySetIdentifier.h"
#include "FGSRegistrationType.h"
#include "MessageType.h"
#ifndef REGISTRATION_REQUEST_H_
#define REGISTRATION_REQUEST_H_
# define REGISTRATION_REQUEST_NON_CURRENT_NATIVE_NAS_KEYSET_PRESENT (1<<0)
# define REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT (1<<1)
# define REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT (1<<2)
# define REGISTRATION_REQUEST_REQUESTED_NSSAI_PRESENT (1<<3)
# define REGISTRATION_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT (1<<4)
# define REGISTRATION_REQUEST_S1_UE_NETWORK_CAPABILITY_PRESENT (1<<5)
# define REGISTRATION_REQUEST_UPLINK_DATA_STATUS_PRESENT (1<<6)
# define REGISTRATION_REQUEST_PDU_SESSION_STATUS_PRESENT (1<<7)
# define REGISTRATION_REQUEST_MICO_INDICATION_PRESENT (1<<8)
# define REGISTRATION_REQUEST_UE_STATUS_PRESENT (1<<9)
# define REGISTRATION_REQUEST_ADDITIONAL_GUTI_PRESENT (1<<10)
# define REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_PRESENT (1<<11)
# define REGISTRATION_REQUEST_UE_USAGE_SETTING_PRESENT (1<<12)
# define REGISTRATION_REQUEST_REQUESTED_DRX_PARAMETERS_PRESENT (1<<13)
# define REGISTRATION_REQUEST_EPS_NAS_MESSAGE_CONTAINER_PRESENT (1<<14)
# define REGISTRATION_REQUEST_LADN_INDICATION_PRESENT (1<<15)
# define REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_PRESENT (1<<16)
# define REGISTRATION_REQUEST_PAYLOAD_CONTAINER_PRESENT (1<<17)
# define REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_PRESENT (1<<18)
# define REGISTRATION_REQUEST_5GS_UPDATE_TYPE_PRESENT (1<<19)
# define REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT (1<<20)
# define REGISTRATION_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT (1<<21)
typedef
enum
registration_request_iei_tag
{
REGISTRATION_REQUEST_NON_CURRENT_NATIVE_NAS_KEYSET_IEI
=
0xC0
,
/* 0xC- = 192- */
REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI
=
0x10
,
/* 0x10 = 16 */
REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI
=
0x2E
,
/* 0x2E = 46 */
REGISTRATION_REQUEST_REQUESTED_NSSAI_IEI
=
0x2F
,
/* 0x2F = 47 */
REGISTRATION_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI
=
0x52
,
/* 0x52 = 82 */
REGISTRATION_REQUEST_S1_UE_NETWORK_CAPABILITY_IEI
=
0x17
,
/* 0x17 = 23 */
REGISTRATION_REQUEST_UPLINK_DATA_STATUS_IEI
=
0x40
,
/* 0x40 = 64 */
REGISTRATION_REQUEST_PDU_SESSION_STATUS_IEI
=
0x50
,
/* 0x50 = 80 */
REGISTRATION_REQUEST_MICO_INDICATION_IEI
=
0xB0
,
/* 0xB- = 176- */
REGISTRATION_REQUEST_UE_STATUS_IEI
=
0x2B
,
/* 0x2B = 43 */
REGISTRATION_REQUEST_ADDITIONAL_GUTI_IEI
=
0x77
,
/* 0x77 = 119 */
REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_IEI
=
0x25
,
/* 0x25 = 37 */
REGISTRATION_REQUEST_UE_USAGE_SETTING_IEI
=
0x18
,
/* 0x18 = 24 */
REGISTRATION_REQUEST_REQUESTED_DRX_PARAMETERS_IEI
=
0x51
,
/* 0x51 = 81 */
REGISTRATION_REQUEST_EPS_NAS_MESSAGE_CONTAINER_IEI
=
0x70
,
/* 0x70 = 112 */
REGISTRATION_REQUEST_LADN_INDICATION_IEI
=
0x74
,
/* 0x74 = 116 */
REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_IEI
=
0x80
,
/* 0x80 = 128 */
REGISTRATION_REQUEST_PAYLOAD_CONTAINER_IEI
=
0x7B
,
/* 0x7B = 123 */
REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_IEI
=
0x90
,
/* 0x90 = 144 */
REGISTRATION_REQUEST_5GS_UPDATE_TYPE_IEI
=
0x53
,
/* 0x53 = 83 */
REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_IEI
=
0x71
,
/* 0x71 = 113 */
REGISTRATION_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI
=
0x60
/* 0x60 = 96 */
}
registration_request_iei
;
/*
* Message name: Registration request
* Description: This message is sent by the UE to the AMF. See TS24.501 table 8.2.6.1.1.
* Significance: dual
* Direction: UE to network
*/
typedef
struct
registration_request_msg_tag
{
/* Mandatory fields */
ExtendedProtocolDiscriminator
protocoldiscriminator
;
SecurityHeaderType
securityheadertype
:
4
;
SpareHalfOctet
sparehalfoctet
:
4
;
MessageType
messagetype
;
FGSRegistrationType
fgsregistrationtype
;
NasKeySetIdentifier
naskeysetidentifier
;
FGSMobileIdentity
fgsmobileidentity
;
/* Optional fields */
}
registration_request_msg
;
int
decode_registration_request
(
registration_request_msg
*
registrationrequest
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encode_registration_request
(
registration_request_msg
*
registrationrequest
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* ! defined(REGISTRATION_REQUEST_H_) */
openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c
0 → 100644
View file @
e15f0b28
/*! \file ExtendedProtocolDiscriminator.c
\brief Extended protocol discriminator for registration request procedures
\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 "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ExtendedProtocolDiscriminator.h"
int
encode_ex_protocol_discriminator
(
ExtendedProtocolDiscriminator
*
exprotocoldiscriminator
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
return
0
;
}
int
decode_ex_protocol_discriminator
(
ExtendedProtocolDiscriminator
*
exprotocoldiscriminator
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
return
0
;
}
openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h
0 → 100644
View file @
e15f0b28
/*! \file ExtendedProtocolDiscriminator.h
\brief Extended protocol discriminator for registration request procedures
\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 "OctetString.h"
#ifndef EXTENDED_PROTOCOL_DISCRIMINATOR_H_
#define EXTENDED_PROTOCOL_DISCRIMINATOR_H_
typedef
uint8_t
ExtendedProtocolDiscriminator
;
int
encode_ex_protocol_discriminator
(
ExtendedProtocolDiscriminator
*
exprotocoldiscriminator
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_ex_protocol_discriminator
(
ExtendedProtocolDiscriminator
*
exprotocoldiscriminator
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* EXTENDED PROTOCOL DISCRIMINATOR_H_ */
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
0 → 100644
View file @
e15f0b28
/*! \file FGSMobileIdentity.c
\brief 5GS Mobile Identity for registration request procedures
\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 "TLVEncoder.h"
#include "TLVDecoder.h"
#include "FGSMobileIdentity.h"
static
int
decode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
);
static
int
encode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
);
int
decode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded_rc
=
TLV_DECODE_VALUE_DOESNT_MATCH
;
int
decoded
=
0
;
uint8_t
ielen
=
0
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
(
iei
,
*
buffer
);
decoded
++
;
}
ielen
=
*
(
buffer
+
decoded
);
decoded
++
;
CHECK_LENGTH_DECODER
(
len
-
decoded
,
ielen
);
uint8_t
typeofidentity
=
*
(
buffer
+
decoded
)
&
0x7
;
if
(
typeofidentity
==
FGS_MOBILE_IDENTITY_5G_GUTI
)
{
decoded_rc
=
decode_guti_5gs_mobile_identity
(
&
fgsmobileidentity
->
guti
,
buffer
+
decoded
);
}
if
(
decoded_rc
<
0
)
{
return
decoded_rc
;
}
return
(
decoded
+
decoded_rc
);
}
int
encode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint8_t
*
lenPtr
;
int
encoded_rc
=
TLV_ENCODE_VALUE_DOESNT_MATCH
;
uint32_t
encoded
=
0
;
if
(
iei
>
0
)
{
*
buffer
=
iei
;
encoded
++
;
}
lenPtr
=
(
buffer
+
encoded
);
encoded
++
;
if
(
fgsmobileidentity
->
guti
.
typeofidentity
==
FGS_MOBILE_IDENTITY_5G_GUTI
)
{
encoded_rc
=
encode_guti_5gs_mobile_identity
(
&
fgsmobileidentity
->
guti
,
buffer
+
encoded
);
}
if
(
encoded_rc
<
0
)
{
return
encoded_rc
;
}
*
lenPtr
=
encoded
+
encoded_rc
-
1
-
((
iei
>
0
)
?
1
:
0
);
return
(
encoded
+
encoded_rc
);
}
static
int
decode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
)
{
int
decoded
=
0
;
uint16_t
temp
;
guti
->
spare
=
(
*
(
buffer
+
decoded
)
>>
4
)
&
0xf
;
/*
* For the 5G-GUTI, bits 5 to 8 of octet 3 are coded as "1111"
*/
if
(
guti
->
spare
!=
0xf
)
{
return
(
TLV_ENCODE_VALUE_DOESNT_MATCH
);
}
guti
->
oddeven
=
(
*
(
buffer
+
decoded
)
>>
3
)
&
0x1
;
/*
* For the 5G-GUTI, bits 4 of octet 3 are coded as "0"
*/
if
(
guti
->
oddeven
!=
0
)
{
return
(
TLV_ENCODE_VALUE_DOESNT_MATCH
);
}
guti
->
typeofidentity
=
*
(
buffer
+
decoded
)
&
0x7
;
if
(
guti
->
typeofidentity
!=
FGS_MOBILE_IDENTITY_5G_GUTI
)
{
return
(
TLV_ENCODE_VALUE_DOESNT_MATCH
);
}
decoded
++
;
guti
->
mccdigit2
=
(
*
(
buffer
+
decoded
)
>>
4
)
&
0xf
;
guti
->
mccdigit1
=
*
(
buffer
+
decoded
)
&
0xf
;
decoded
++
;
guti
->
mncdigit3
=
(
*
(
buffer
+
decoded
)
>>
4
)
&
0xf
;
guti
->
mccdigit3
=
*
(
buffer
+
decoded
)
&
0xf
;
decoded
++
;
guti
->
mncdigit2
=
(
*
(
buffer
+
decoded
)
>>
4
)
&
0xf
;
guti
->
mncdigit1
=
*
(
buffer
+
decoded
)
&
0xf
;
decoded
++
;
guti
->
amfregionid
=
*
(
buffer
+
decoded
);
decoded
++
;
IES_DECODE_U16
(
buffer
,
decoded
,
temp
);
guti
->
amfsetid
=
temp
>>
3
;
guti
->
amfpointer
=
temp
&
0x3f
;
IES_DECODE_U32
(
buffer
,
decoded
,
guti
->
tmsi
);
return
decoded
;
}
static
int
encode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
)
{
uint32_t
encoded
=
0
;
uint16_t
temp
;
*
(
buffer
+
encoded
)
=
0xf0
|
((
guti
->
oddeven
&
0x1
)
<<
3
)
|
(
guti
->
typeofidentity
&
0x7
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
guti
->
mccdigit2
&
0xf
)
<<
4
)
|
(
guti
->
mccdigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
guti
->
mncdigit3
&
0xf
)
<<
4
)
|
(
guti
->
mccdigit3
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
guti
->
mncdigit2
&
0xf
)
<<
4
)
|
(
guti
->
mncdigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
guti
->
amfregionid
;
encoded
++
;
temp
=
0x00
|
((
guti
->
amfsetid
&
0x3f
)
<<
6
)
|
(
guti
->
amfpointer
&
0x3f
);
IES_ENCODE_U16
(
buffer
,
encoded
,
temp
);
IES_ENCODE_U32
(
buffer
,
encoded
,
guti
->
tmsi
);
return
encoded
;
}
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
0 → 100644
View file @
e15f0b28
/*! \file FGSMobileIdentity.h
\brief 5GS Mobile Identity for registration request procedures
\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 "OctetString.h"
#ifndef FGS_MOBILE_IDENTITY_H_
#define FGS_MOBILE_IDENTITY_H_
typedef
struct
{
uint8_t
spare
:
5
;
uint8_t
typeofidentity
:
3
;
}
NoIdentity5GSMobileIdentity_t
;
typedef
struct
{
uint8_t
spare1
:
1
;
uint8_t
supiformat
:
3
;
uint8_t
spare2
:
1
;
uint8_t
typeofidentity
:
3
;
uint8_t
mccdigit2
:
4
;
uint8_t
mccdigit1
:
4
;
uint8_t
mncdigit3
:
4
;
uint8_t
mccdigit3
:
4
;
uint8_t
mncdigit2
:
4
;
uint8_t
mncdigit1
:
4
;
uint8_t
routingindicatordigit2
:
4
;
uint8_t
routingindicatordigit1
:
4
;
uint8_t
routingindicatordigit4
:
4
;
uint8_t
routingindicatordigit3
:
4
;
uint8_t
spare3
:
1
;
uint8_t
spare4
:
1
;
uint8_t
spare5
:
1
;
uint8_t
spare6
:
1
;
uint8_t
protectionschemeId
:
4
;
uint8_t
homenetworkpki
;
}
Suci5GSMobileIdentity_t
;
typedef
struct
{
uint8_t
spare
:
4
;
uint8_t
oddeven
:
1
;
uint8_t
typeofidentity
:
3
;
uint8_t
mccdigit2
:
4
;
uint8_t
mccdigit1
:
4
;
uint8_t
mncdigit3
:
4
;
uint8_t
mccdigit3
:
4
;
uint8_t
mncdigit2
:
4
;
uint8_t
mncdigit1
:
4
;
uint8_t
amfregionid
;
uint16_t
amfsetid
:
10
;
uint16_t
amfpointer
:
6
;
uint32_t
tmsi
;
}
Guti5GSMobileIdentity_t
;
typedef
struct
{
uint8_t
digit1
:
4
;
uint8_t
oddeven
:
1
;
uint8_t
typeofidentity
:
3
;
uint8_t
digitp1
:
4
;
uint8_t
digitp
:
4
;
}
Imei5GSMobileIdentity_t
;
typedef
Imei5GSMobileIdentity_t
Imeisv5GSMobileIdentity_t
;
typedef
struct
{
uint8_t
digit1
:
4
;
uint8_t
spare
:
1
;
uint8_t
typeofidentity
:
3
;
uint16_t
amfsetid
:
10
;
uint16_t
amfpointer
:
6
;
uint32_t
tmsi
;
}
Stmsi5GSMobileIdentity_t
;
typedef
struct
{
uint8_t
spare
:
5
;
uint8_t
typeofidentity
:
3
;
uint8_t
macaddr
;
}
Macaddr5GSMobileIdentity_t
;
typedef
union
FGSMobileIdentity_tag
{
#define FGS_MOBILE_IDENTITY_NOIDENTITY 0b000
#define FGS_MOBILE_IDENTITY_SUCI 0b001
#define FGS_MOBILE_IDENTITY_5G_GUTI 0b010
#define FGS_MOBILE_IDENTITY_IMEI 0b011
#define FGS_MOBILE_IDENTITY_5GS_TMSI 0b100
#define FGS_MOBILE_IDENTITY_IMEISV 0b101
#define FGS_MOBILE_IDENTITY_MAC_ADDR 0b110
NoIdentity5GSMobileIdentity_t
noidentity
;
Suci5GSMobileIdentity_t
suci
;
Guti5GSMobileIdentity_t
guti
;
Imei5GSMobileIdentity_t
imei
;
Stmsi5GSMobileIdentity_t
stmsi
;
Imeisv5GSMobileIdentity_t
imeisv
;
Macaddr5GSMobileIdentity_t
macaddress
;
}
FGSMobileIdentity
;
int
encode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* FGS MOBILE IDENTITY_H_ */
openair3/NAS/COMMON/IES/FGSRegistrationType.c
0 → 100644
View file @
e15f0b28
/*! \file FGSRegistrationType.c
\brief 5GS Registration Type for registration request procedures
\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 "TLVEncoder.h"
#include "TLVDecoder.h"
#include "FGSRegistrationType.h"
int
decode_5gs_registration_type
(
FGSRegistrationType
*
fgsregistrationtype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
((
*
buffer
&
0xf0
),
iei
);
}
*
fgsregistrationtype
=
*
buffer
&
0x7
;
decoded
++
;
return
decoded
;
}
int
encode_5gs_registration_type
(
FGSRegistrationType
*
fgsregistrationtype
)
{
uint8_t
bufferReturn
;
uint8_t
*
buffer
=
&
bufferReturn
;
uint8_t
encoded
=
0
;
uint8_t
iei
=
0
;
*
(
buffer
+
encoded
)
=
0x00
|
(
iei
&
0xf0
)
|
(
*
fgsregistrationtype
&
0x7
);
encoded
++
;
return
bufferReturn
;
}
openair3/NAS/COMMON/IES/FGSRegistrationType.h
0 → 100644
View file @
e15f0b28
/*! \file FGSRegistrationType.h
\brief 5GS Registration Type for registration request procedures
\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 "OctetString.h"
#ifndef FGS_REGISTRATION_TYPE_H_
#define FGS_REGISTRATION_TYPE_H_
#define FGS_REGISTRATION_TYPE_MINIMUM_LENGTH 1
#define FGS_REGISTRATION_TYPE_MAXIMUM_LENGTH 1
typedef
uint8_t
FGSRegistrationType
;
#define INITIAL_REGISTRATION 0b001
#define MOBILITY_REGISTRATION_UPDATING 0b010
#define PERIODIC_REGISTRATION_UPDATING 0b011
#define EMERGENCY_REGISTRATION 0b100
int
encode_5gs_registration_type
(
FGSRegistrationType
*
fgsregistrationtype
);
int
decode_5gs_registration_type
(
FGSRegistrationType
*
fgsregistrationtype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* FGS_REGISTRATION_TYPE_H_*/
openair3/NAS/COMMON/IES/SpareHalfOctet.c
0 → 100644
View file @
e15f0b28
/*! \file SpareHalfOctet.c
\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 "TLVEncoder.h"
#include "TLVDecoder.h"
#include "SpareHalfOctet.h"
int
decode_spare_half_octet
(
SpareHalfOctet
*
sparehalfoctet
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
return
0
;
}
int
encode_spare_half_octet
(
SpareHalfOctet
*
sparehalfoctet
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
return
0
;
}
openair3/NAS/COMMON/IES/SpareHalfOctet.h
0 → 100644
View file @
e15f0b28
/*! \file SpareHalfOctet.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 "OctetString.h"
#ifndef SPARE_HALF_OCTET_H_
#define SPARE_HALF_OCTET_H_
#define SPARE_HALF_OCTET_MINIMUM_LENGTH 1
#define SPARE_HALF_OCTET_MAXIMUM_LENGTH 1
typedef
uint8_t
SpareHalfOctet
;
int
encode_spare_half_octet
(
SpareHalfOctet
*
sparehalfoctet
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_spare_half_octet
(
SpareHalfOctet
*
sparehalfoctet
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* SPARE HALF OCTET_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