nas

package module
v0.0.0-...-d937fce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2021 License: MIT Imports: 16 Imported by: 2

Documentation

Overview

Package nas is implementation for non-access stratum (NAS) procedure in the 5GS Sytem. document version: 3GPP TS 24.501 v16.3.0 (2019-12)

Index

Constants

View Source
const (
	MMNULL = iota
	MMDeregistared
	MMRegisteredInitiated
	MMRegistered
	MMServiceRequestInitiated
	MMDeregistaredInitiated
)

5.1.3 5GMM sublayer states actual value is not defined in the standard.

View Source
const (
	SMInactive = iota
	SMActivePending
	SMInactivePending
	SMModificationPending
	SMActive
)

6.1.3 5GSM sublayer states actual value is not defined in the standard.

View Source
const (
	EPD5GSSessionManagement  = 0x2e
	EPD5GSMobilityManagement = 0x7e
)

TS 24.007 11.2.3.1.1A Extended protocol discriminator (EPD)

View Source
const (
	SecurityHeaderTypePlain = iota
	SecurityHeaderTypeIntegrityProtected
	SecurityHeaderTypeIntegrityProtectedAndCiphered
	SecurityHeaderTypeIntegrityProtectedWithNewContext
	SecurityHeaderTypeIntegrityProtectedAndCipheredWithNewContext
)

9.3 Security header type

View Source
const (
	MessageTypeRegistrationRequest            = 0x41
	MessageTypeRegistrationAccept             = 0x42
	MessageTypeRegistrationComplete           = 0x43
	MessageTypeDeregistrationRequest          = 0x45
	MessageTypeDeregistrationAccept           = 0x46
	MessageTypeAuthenticationRequest          = 0x56
	MessageTypeAuthenticationResponse         = 0x57
	MessageTypeSecurityModeCommand            = 0x5d
	MessageTypeSecurityModeComplete           = 0x5e
	MessageTypeULNasTransport                 = 0x67
	MessageTypeDLNasTransport                 = 0x68
	MessageTypePDUSessionEstablishmentRequest = 0xc1
	MessageTypePDUSessionEstablishmentAccept  = 0xc2
)

9.7 Message type

View Source
const (
	TypeIDNoIdentity = iota
	TypeIDSUCI
	TypeID5GGUTI
	TypeIDIMEI
	TypeID5GSTMSI
	TypeIDIMEISV
)

9.11.3.4 5GS mobile identity I need C 'union' for golang...

View Source
const (
	SUPIFormatIMSI = iota
	SUPIFormatNetworkSpecificID
)
View Source
const (
	ProtectionSchemeNull = iota
	ProtectionSchemeProfileA
	ProtectionSchemeProfileB
)
View Source
const (
	RegistrationTypeInitialRegistration        = 0x01
	RegistrationTypeFlagFollowOnRequestPending = 0x08
)

9.11.3.7 5GS registration type

View Source
const (
	KeySetIdentityNoKeyIsAvailable          = 0x07
	KeySetIdentityFlagMappedSecurityContext = 0x08
)

9.11.3.32 NAS key set identifier

View Source
const (
	EA0 = 0x80
	EA1 = 0x40
	EA2 = 0x20
	IA0 = 0x80
	IA1 = 0x40
	IA2 = 0x20
)
View Source
const (
	PDUSessionIPv4   = 0x01
	PDUSessionIPv6   = 0x02
	PDUSessionIPv4v6 = 0x03
)

9.11.4.11 PDU session type

View Source
const (
	FiveGMMCapN3data = 0x20
)
View Source
const (
	PayloadContainerN1SMInformation = 0x1
)

9.11.3.40 Payload container type

View Source
const (
	RequestTypeInitialRequest = 0x01
)

9.11.3.47 Request type

Variables

View Source
var MMstateStr = map[int]string{
	MMNULL:                    "5GMM NULL",
	MMDeregistared:            "5GMM DEREGISTERED",
	MMRegisteredInitiated:     "5GMM REGISTERED-INITIATED",
	MMRegistered:              "5GMM REGISTERED",
	MMServiceRequestInitiated: "5GMM SERVICE-REQUEST-INITIATED",
	MMDeregistaredInitiated:   "5GMM DEREGISTERED-INITIATED",
}
View Source
var SMstateStr = map[int]string{
	SMInactive:            "5GSM PDU SESSION INACTIVE",
	SMActivePending:       "5GSM PDU SESSION ACTIVE PENDING",
	SMInactivePending:     "5GSM PDU SESSION INACTIVE PENDING",
	SMModificationPending: "5GSM PDU SESSION MODIFICATION PENDING",
	SMActive:              "5GSM PDU SESSION ACTIVE",
}

Functions

func ShiftType1IE

func ShiftType1IE(iei bool, pdu *[]byte)

func Str2BCD

func Str2BCD(str string) (bcd []byte)

-----

Types

type AuthParam

type AuthParam struct {
	K   string
	OPc string

	RESstar []byte
	Kausf   []byte
	Kseaf   []byte
	Kamf    []byte
	Kenc    []byte
	Kint    []byte
	// contains filtered or unexported fields
}

9.11.3.15 Authentication parameter AUTN TS 24.008 10.5.3.1.1 Authentication Parameter AUTN (UMTS and EPS authentication challenge)

type AuthParamRes

type AuthParamRes struct {
	// contains filtered or unexported fields
}

9.11.3.17 Authentication response parameter TS 24.301 9.9.3.4 Authentication response parameter

type FiveGMMCapability

type FiveGMMCapability struct {
	// contains filtered or unexported fields
}

9.11.3.1 5GMM capability

type FiveGSMobileIDIMEISV

type FiveGSMobileIDIMEISV struct {
	// contains filtered or unexported fields
}

type FiveGSMobileIDSUCI

type FiveGSMobileIDSUCI struct {
	// contains filtered or unexported fields
}

type SNSSAI

type SNSSAI struct {
	SST int
	SD  string
	// contains filtered or unexported fields
}

9.11.2.8 S-NSSAI

type TAI

type TAI struct {
	// contains filtered or unexported fields
}

type UE

type UE struct {
	Number           int
	SUPI             string
	MSIN             string
	MCC              int
	MNC              int
	IMEISV           string
	RoutingIndicator uint16
	ProtectionScheme string
	AuthParam        AuthParam
	SNSSAI           SNSSAI
	DNN              string
	URL              string

	MMstate int
	SMstate int

	Recv struct {
		PDUAddress net.IP
		// contains filtered or unexported fields
	}

	NasCount uint32

	DecodeError error
	// contains filtered or unexported fields
}

func NewNAS

func NewNAS(filename string) (ue *UE)

func (*UE) ComputeAlgKey

func (ue *UE) ComputeAlgKey()

TS 33.501 A.8 Algorithm key derivation functions

func (*UE) ComputeKamf

func (ue *UE) ComputeKamf()

TS 33.501 A.7 KAMF derivation function

func (*UE) ComputeKausf

func (ue *UE) ComputeKausf(ck, ik []byte)

TS 33.501 A.2 KAUSF derivation function

func (*UE) ComputeKseaf

func (ue *UE) ComputeKseaf()

TS 33.501 A.6 KSEAF derivation function

func (*UE) ComputeMAC

func (ue *UE) ComputeMAC(dir uint8, pdu *[]byte) (mac []byte)

func (*UE) ComputeRESstar

func (ue *UE) ComputeRESstar(rand, res, ck, ik []byte)

TS 33.501 A.4 RES* and XRES* derivation function

func (*UE) Decode

func (ue *UE) Decode(pdu *[]byte) (msgType int)

func (*UE) Decode5GMM

func (ue *UE) Decode5GMM(pdu *[]byte) (msgType int)

8.2 5GS mobility management messages

func (*UE) Decode5GSM

func (ue *UE) Decode5GSM(pdu *[]byte) (msgType int)

8.3 5GS session management messages

func (*UE) MakeAuthenticationResponse

func (ue *UE) MakeAuthenticationResponse() (pdu []byte)

8.2.2 Authentication response

func (*UE) MakeDeregistrationRequest

func (ue *UE) MakeDeregistrationRequest() (pdu []byte)

8.2.12 De-registration request (UE originating de-registration)

func (*UE) MakeNasPdu

func (ue *UE) MakeNasPdu() (pdu []byte)

func (*UE) MakePDUSessionEstablishmentRequest

func (ue *UE) MakePDUSessionEstablishmentRequest() (pdu []byte)

8.3.1 PDU session establishment request

func (*UE) MakeRegistrationComplete

func (ue *UE) MakeRegistrationComplete() (pdu []byte)

8.2.8 Registration complete

func (*UE) MakeRegistrationRequest

func (ue *UE) MakeRegistrationRequest() (pdu []byte)

8.2.6 Registration request 5.5.1.2 Registration procedure for initial registration

func (*UE) MakeSecurityModeComplete

func (ue *UE) MakeSecurityModeComplete() (pdu []byte)

8.2.26 Security mode complete

func (*UE) MakeULNasTransport

func (ue *UE) MakeULNasTransport(
	payloadType uint8, msgType uint8, payload *[]byte) (pdu []byte)

8.2.10 UL NAS transport

func (*UE) PowerON

func (ue *UE) PowerON()

func (*UE) Receive

func (ue *UE) Receive(pdu *[]byte)

func (*UE) SetDebugLevel

func (ue *UE) SetDebugLevel(level int)

func (*UE) SetIndent

func (ue *UE) SetIndent(indent int)

type UESecurityCapability

type UESecurityCapability struct {
	// contains filtered or unexported fields
}

9.11.3.54 UE security capability

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL