amf_context

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNumOfTAI                       int   = 16
	MaxNumOfBroadcastPLMNs            int   = 12
	MaxNumOfPLMNs                     int   = 12
	MaxNumOfSlice                     int   = 1024
	MaxNumOfAllowedSnssais            int   = 8
	MaxValueOfAmfUeNgapId             int64 = 1099511627775
	MaxNumOfServedGuamiList           int   = 256
	MaxNumOfPDUSessions               int   = 256
	MaxNumOfDRBs                      int   = 32
	MaxNumOfAOI                       int   = 64
	MaxPagingRetryTime                int   = 3
	TimeT3513                         int   = 2
	MaxNotificationRetryTime          int   = 5
	TimeT3565                         int   = 6
	TimeT3560                         int   = 6
	MaxT3560RetryTimes                int   = 4
	MAxNumOfAlgorithm                 int   = 8
	TimeT3550                         int   = 6
	MaxT3550RetryTimes                int   = 4
	DefaultT3502                      int   = 720  // 12 min
	DefaultT3512                      int   = 3240 // 54 min
	DefaultNon3gppDeregistrationTimer int   = 3240 // 54 min
	TimeT3522                         int   = 6
	MaxT3522RetryTimes                int   = 4
)
View Source
const (
	RanPresentGNbId   = 1
	RanPresentNgeNbId = 2
	RanPresentN3IwfId = 3
)
View Source
const (
	NgRanCgiPresentNRCGI    int32 = 0
	NgRanCgiPresentEUTRACGI int32 = 1
)
View Source
const (
	RecommendRanNodePresentRanNode int32 = 0
	RecommendRanNodePresentTAI     int32 = 1
)
View Source
const (
	N_NAS_ENC_ALG uint8 = 0x01
	N_NAS_INT_ALG uint8 = 0x02
	N_RRC_ENC_ALG uint8 = 0x03
	N_RRC_INT_ALG uint8 = 0x04
	N_UP_ENC_alg  uint8 = 0x05
	N_UP_INT_alg  uint8 = 0x06
)

TS 33501 Annex A.8 Algorithm distinguisher For Knas_int Knas_enc

View Source
const (
	ALG_INTEGRITY_128_NIA0 uint8 = 0x00 // NULL
	ALG_INTEGRITY_128_NIA1 uint8 = 0x01 // 128-Snow3G
	ALG_INTEGRITY_128_NIA2 uint8 = 0x02 // 128-AES
	ALG_INTEGRITY_128_NIA3 uint8 = 0x03 // 128-ZUC
)

TS 33501 Annex D Algorithm identifier values For Knas_int

View Source
const (
	ALG_CIPHERING_128_NEA0 uint8 = 0x00 // NULL
	ALG_CIPHERING_128_NEA1 uint8 = 0x01 // 128-Snow3G
	ALG_CIPHERING_128_NEA2 uint8 = 0x02 // 128-AES
	ALG_CIPHERING_128_NEA3 uint8 = 0x03 // 128-ZUC
)

TS 33501 Annex D Algorithm identifier values For Knas_enc

View Source
const (
	SECURITY_DIRECTION_UPLINK   uint8 = 0x00
	SECURITY_DIRECTION_DOWNLINK uint8 = 0x01
)

1bit

View Source
const (
	SECURITY_ONLY_ONE_BEARER uint8 = 0x00
	SECURITY_BEARER_3GPP     uint8 = 0x01
	SECURITY_BEARER_NON_3GPP uint8 = 0x02
)

5bits

View Source
const (
	ACCESS_TYPE_3GPP     uint8 = 0x01
	ACCESS_TYPE_NON_3GPP uint8 = 0x02
)

TS 33501 Annex A.0 Access type distinguisher For Kgnb Kn3iwf

View Source
const (
	RanUeNgapIdUnspecified int64 = 0xffffffff
)

Variables

View Source
var TmsiGenerator int32 = 0

Functions

func AttachSourceUeTargetUe

func AttachSourceUeTargetUe(sourceUe, targetUe *RanUe)

func CompareUserLocation

func CompareUserLocation(loc1 models.UserLocation, loc2 models.UserLocation) bool

func DetachSourceUeTargetUe

func DetachSourceUeTargetUe(ranUe *RanUe)

func GetSecurityCount

func GetSecurityCount(overflow uint16, sqn uint8) []uint8

func InTaiList

func InTaiList(servedTai models.Tai, taiList []models.Tai) bool

func TacInAreas

func TacInAreas(targetTac string, areas []models.Area) bool

Types

type AMFContext

type AMFContext struct {
	EventSubscriptionIDGenerator     int
	EventSubscriptions               map[string]*AMFContextEventSubscription
	UePool                           map[string]*AmfUe // use imsi as key
	GutiPool                         map[string]*AmfUe
	TmsiPool                         map[int32]*AmfUe // tmsi as key
	RanIdPool                        map[models.GlobalRanNodeId]*AmfRan
	RanUePool                        map[int64]*RanUe   // AmfUeNgapId as key
	AmfRanPool                       map[string]*AmfRan // use remote Addr String as key
	LadnPool                         map[string]*LADN   // ladn as key
	SupportTaiLists                  []models.Tai
	ServedGuamiList                  []models.Guami
	PlmnSupportList                  []PlmnSupportItem
	RelativeCapacity                 int64
	NfId                             string
	Name                             string
	NfService                        map[models.ServiceName]models.NfService // use ServiceName as key, nfservice that amf support
	UriScheme                        models.UriScheme
	HttpIpv4Port                     int
	HttpIPv4Address                  string
	HttpIPv6Address                  string
	TNLWeightFactor                  int64
	SupportDnnLists                  []string
	AMFStatusSubscriptionIDGenerator int
	AMFStatusSubscriptions           map[string]*models.SubscriptionData
	NrfUri                           string
	SecurityAlgorithm                SecurityAlgorithm
	NetworkName                      NetworkName
	NgapIpList                       []string // NGAP Server IP
	T3502Value                       int      // unit is second
	T3512Value                       int      // unit is second
	Non3gppDeregistrationTimerValue  int      // unit is second
}

func AMF_Self

func AMF_Self() *AMFContext

Create new AMF context

func (*AMFContext) AddAmfUeToUePool

func (context *AMFContext) AddAmfUeToUePool(ue *AmfUe, supi string)

func (*AMFContext) AllocateGutiToUe

func (context *AMFContext) AllocateGutiToUe(ue *AmfUe)

func (*AMFContext) AllocateRegistrationArea

func (context *AMFContext) AllocateRegistrationArea(ue *AmfUe, anType models.AccessType)

func (*AMFContext) AmfRanFindByRanId

func (context *AMFContext) AmfRanFindByRanId(ranNodeId models.GlobalRanNodeId) *AmfRan

func (*AMFContext) AmfUeFindByGuti

func (context *AMFContext) AmfUeFindByGuti(targetGuti string) *AmfUe

func (*AMFContext) AmfUeFindByPolicyAssociationId

func (context *AMFContext) AmfUeFindByPolicyAssociationId(polAssoId string) *AmfUe

func (*AMFContext) AmfUeNgapIdAlloc

func (context *AMFContext) AmfUeNgapIdAlloc() int64

func (*AMFContext) GetIPv4Uri

func (context *AMFContext) GetIPv4Uri() string

func (*AMFContext) InSupportDnnList

func (context *AMFContext) InSupportDnnList(targetDnn string) bool

func (*AMFContext) InitNFService

func (context *AMFContext) InitNFService(serivceName []string, version string)

func (*AMFContext) NewAmfRan

func (context *AMFContext) NewAmfRan(conn net.Conn) *AmfRan

func (*AMFContext) NewAmfUe

func (context *AMFContext) NewAmfUe(supi string) *AmfUe

func (*AMFContext) RanUeFindByAmfUeNgapID

func (context *AMFContext) RanUeFindByAmfUeNgapID(amfUeNgapID int64) *RanUe

func (*AMFContext) Reset

func (context *AMFContext) Reset()

Reset AMF Context

func (*AMFContext) TmsiAlloc

func (context *AMFContext) TmsiAlloc() int32

type AMFContextEventSubscription

type AMFContextEventSubscription struct {
	IsAnyUe           bool
	IsGroupUe         bool
	UeSupiList        []string
	Expiry            *time.Time
	EventSubscription models.AmfEventSubscription
}

type AmfRan

type AmfRan struct {
	RanPresent int
	RanId      *models.GlobalRanNodeId
	Name       string
	AnType     models.AccessType
	/* socket Connect*/
	Conn net.Conn
	/* Supported TA List */
	SupportedTAList []SupportedTAI

	/* RAN UE List */
	RanUeList []*RanUe // RanUeNgapId as key
}

func (*AmfRan) NewRanUe

func (ran *AmfRan) NewRanUe() *RanUe

func (*AmfRan) RanUeFindByRanUeNgapID

func (ran *AmfRan) RanUeFindByRanUeNgapID(ranUeNgapID int64) *RanUe

func (*AmfRan) Remove

func (ran *AmfRan) Remove(key string)

func (*AmfRan) RemoveAllUeInRan

func (ran *AmfRan) RemoveAllUeInRan()

func (*AmfRan) SetRanId

func (ran *AmfRan) SetRanId(ranNodeId *ngapType.GlobalRANNodeID)

type AmfUe

type AmfUe struct {
	/* Gmm State */
	Sm map[models.AccessType]*fsm.FSM
	/* Registration procedure related context */
	RegistrationType5GS                uint8
	IdentityTypeUsedForRegistration    uint8
	RegistrationRequest                *nasMessage.RegistrationRequest
	ServingAmfChanged                  bool
	DeregistrationTargetAccessType     uint8 // only used when deregistration procedure is initialized by the network
	RegistrationAcceptForNon3GPPAccess []byte
	/* Used for AMF relocation */
	TargetAmfUri string
	/* Ue Identity*/
	PlmnId              models.PlmnId
	Suci                string
	Supi                string
	UnauthenticatedSupi bool
	Gpsi                string
	Pei                 string
	Tmsi                int32 // 5G-Tmsi
	Guti                string
	GroupID             string
	EBI                 int32
	IsCleartext         bool
	/* Ue Identity*/
	EventSubscriptionsInfo map[string]*AmfUeEventSubscription
	/* User Location*/
	RatType                  models.RatType
	Location                 models.UserLocation
	Tai                      models.Tai
	LocationChanged          bool
	LastVisitedRegisteredTai models.Tai
	TimeZone                 string
	/* context about udm */
	UdmId                             string
	NudmUECMUri                       string
	NudmSDMUri                        string
	ContextValid                      bool
	Reachability                      models.UeReachability
	SubscribedData                    models.SubscribedData
	SmfSelectionData                  *models.SmfSelectionSubscriptionData
	UeContextInSmfData                *models.UeContextInSmfData
	TraceData                         *models.TraceData
	UdmGroupId                        string
	SubscribedNssai                   []models.SubscribedSnssai
	AccessAndMobilitySubscriptionData *models.AccessAndMobilitySubscriptionData
	/* contex abut ausf */
	AusfGroupId                       string
	AusfId                            string
	AusfUri                           string
	RoutingIndicator                  string
	AuthenticationCtx                 *models.UeAuthenticationCtx
	AuthFailureCauseSynchFailureTimes int
	ABBA                              []uint8
	Kseaf                             string
	Kamf                              string
	/* context about PCF */
	PcfId                        string
	PcfUri                       string
	PolicyAssociationId          string
	AmPolicyUri                  string
	AmPolicyAssociation          *models.PolicyAssociation
	RequestTriggerLocationChange bool // true if AmPolicyAssociation.Trigger contains RequestTrigger_LOC_CH
	ConfigurationUpdateMessage   []byte
	/* UeContextForHandover*/
	HandoverNotifyUri string
	/* N1N2Message */
	N1N2MessageIDGenerator          int
	N1N2Message                     *N1N2Message
	N1N2MessageSubscribeIDGenerator int
	N1N2SubscriptionID              string
	N1N2MessageSubscribeInfo        map[string]*models.UeN1N2InfoSubscriptionCreateData
	/* Pdu Sesseion */
	StoredSmContext map[int32]*StoredSmContext // for DUPLICATE PDU Session ID
	SmContextList   map[int32]*SmContext
	/* Related Context*/
	RanUe map[models.AccessType]*RanUe
	/* other */
	OnGoing                       map[models.AccessType]*OnGoing
	UeRadioCapability             string // OCTET string
	Capability5GMM                nasType.Capability5GMM
	ConfigurationUpdateIndication nasType.ConfigurationUpdateIndication
	/* context related to Paging */
	UeRadioCapabilityForPaging                 *UERadioCapabilityForPaging
	InfoOnRecommendedCellsAndRanNodesForPaging *InfoOnRecommendedCellsAndRanNodesForPaging
	UESpecificDRX                              uint8
	/* Security Context */
	SecurityContextAvailable bool
	SecurityCapabilities     UeSecurityCapabilities
	NasUESecurityCapability  nasType.UESecurityCapability // for security command
	NgKsi                    models.NgKsi
	MacFailed                bool
	KnasInt                  []uint8 // 16 byte
	KnasEnc                  []uint8 // 16 byte
	Kgnb                     []uint8 // 32 byte
	Kn3iwf                   []uint8 // 32 byte
	NH                       []uint8 // 32 byte
	NCC                      uint8   // 0..7
	ULCountOverflow          uint16
	ULCountSQN               uint8
	DLCount                  uint32
	CipheringAlg             uint8
	IntegrityAlg             uint8
	/* Registration Area */
	RegistrationArea map[models.AccessType][]models.Tai
	LadnInfo         []LADN
	/* Network Slicing related context and Nssf */
	NssfId                            string
	NssfUri                           string
	NetworkSliceInfo                  *models.AuthorizedNetworkSliceInfo
	AllowedNssai                      map[models.AccessType][]models.AllowedSnssai
	ConfiguredNssai                   []models.ConfiguredSnssai
	NetworkSlicingSubscriptionChanged bool
	/* T3513(Paging) */
	T3513            *time.Timer // for paging
	PagingRetryTimes int
	LastPagingPkg    []byte
	/* T3565(Notification) */
	T3565                  *time.Timer // for NAS Notification
	NotificationRetryTimes int
	LastNotificationPkg    []byte
	/* T3560 (for authentication request/security mode command retransmission) */
	T3560           *time.Timer
	T3560RetryTimes int
	/* T3550 (for registration accept retransmission) */
	T3550           *time.Timer
	T3550RetryTimes int
	/* Ue Context Release Cause */
	ReleaseCause map[models.AccessType]*CauseAll
	/* T3502 (Assigned by AMF, and used by UE to initialize registration procedure) */
	T3502Value                      int // Second
	T3512Value                      int // default 54 min
	Non3gppDeregistrationTimerValue int // default 54 min
	/* T3522 (for deregistration request) */
	T3522           *time.Timer
	T3522RetryTimes int
}

func (*AmfUe) AttachRanUe

func (ue *AmfUe) AttachRanUe(ranUe *RanUe)

func (*AmfUe) ClearRegistrationRequestData

func (ue *AmfUe) ClearRegistrationRequestData()

func (*AmfUe) CmConnect

func (ue *AmfUe) CmConnect(anType models.AccessType) bool

func (*AmfUe) CmIdle

func (ue *AmfUe) CmIdle(anType models.AccessType) bool

func (*AmfUe) DerivateAlgKey

func (ue *AmfUe) DerivateAlgKey()

Algorithm key Derivation function defined in TS 33.501 Annex A.9

func (*AmfUe) DerivateAnKey

func (ue *AmfUe) DerivateAnKey(anType models.AccessType)

Access Network key Derivation function defined in TS 33.501 Annex A.9

func (*AmfUe) DerivateKamf

func (ue *AmfUe) DerivateKamf()

Kamf Derivation function defined in TS 33.501 Annex A.7

func (*AmfUe) DerivateNH

func (ue *AmfUe) DerivateNH(syncInput []byte)

NH Derivation function defined in TS 33.501 Annex A.10

func (*AmfUe) DetachRanUe

func (ue *AmfUe) DetachRanUe(anType models.AccessType)

func (*AmfUe) GetAnType

func (ue *AmfUe) GetAnType() models.AccessType

func (*AmfUe) GetCmInfo

func (ue *AmfUe) GetCmInfo() (cmInfos []models.CmInfo)

func (*AmfUe) GetNsiInformationFromSnssai

func (ue *AmfUe) GetNsiInformationFromSnssai(anType models.AccessType, snssai models.Snssai) *models.NsiInformation

func (*AmfUe) GetSecurityDLCount

func (ue *AmfUe) GetSecurityDLCount() []byte

func (*AmfUe) GetSecurityULCount

func (ue *AmfUe) GetSecurityULCount() []byte

func (*AmfUe) HasWildCardSubscribedDNN

func (ue *AmfUe) HasWildCardSubscribedDNN() bool

func (*AmfUe) InAllowedNssai

func (ue *AmfUe) InAllowedNssai(targetSNssai models.Snssai, anType models.AccessType) bool

func (*AmfUe) InSubscribedNssai

func (ue *AmfUe) InSubscribedNssai(targetSNssai models.Snssai) bool

func (*AmfUe) Remove

func (ue *AmfUe) Remove()

func (*AmfUe) RemoveAmPolicyAssociation

func (ue *AmfUe) RemoveAmPolicyAssociation()

func (*AmfUe) SecurityContextIsValid

func (ue *AmfUe) SecurityContextIsValid() bool

func (*AmfUe) SelectSecurityAlg

func (ue *AmfUe) SelectSecurityAlg(intOrder, encOrder []uint8)

func (*AmfUe) TaiListInRegistrationArea

func (ue *AmfUe) TaiListInRegistrationArea(taiList []models.Tai) bool

func (*AmfUe) UpdateNH

func (ue *AmfUe) UpdateNH()

func (*AmfUe) UpdateSecurityContext

func (ue *AmfUe) UpdateSecurityContext(anType models.AccessType)

type AmfUeEventSubscription

type AmfUeEventSubscription struct {
	Timestamp         time.Time
	AnyUe             bool
	RemainReports     *int32
	EventSubscription *models.AmfEventSubscription
}

type CauseAll

type CauseAll struct {
	Cause        *models.Cause
	NgapCause    *models.NgApCause
	Var5GmmCause *int32
}

type InfoOnRecommendedCellsAndRanNodesForPaging

type InfoOnRecommendedCellsAndRanNodesForPaging struct {
	RecommendedCells    []RecommendedCell  // RecommendedCellsForPaging
	RecommendedRanNodes []RecommendRanNode // RecommendedRanNodesForPaging
}

TS 38.413 9.3.1.100

type LADN

type LADN struct {
	Ladn     string
	TaiLists []models.Tai
}

type N1N2Message

type N1N2Message struct {
	Request     models.N1N2MessageTransferRequest
	Status      models.N1N2MessageTransferCause
	ResourceUri string
}

type NGRANCGI

type NGRANCGI struct {
	Present  int32
	NRCGI    *models.Ncgi
	EUTRACGI *models.Ecgi
}

type NetworkName

type NetworkName struct {
	Full  string `yaml:"full"`
	Short string `yaml:"short,omitempty"`
}

type OnGoing

type OnGoing struct {
	Procedure OnGoingProcedure
	Ppi       int32 //Paging priority
}

type OnGoingProcedure

type OnGoingProcedure string
const (
	OnGoingProcedureNothing    OnGoingProcedure = "Nothing"
	OnGoingProcedurePaging     OnGoingProcedure = "Paging"
	OnGoingProcedureN2Handover OnGoingProcedure = "N2Handover"
)

type PlmnSupportItem

type PlmnSupportItem struct {
	PlmnId     models.PlmnId   `yaml:"plmnId"`
	SNssaiList []models.Snssai `yaml:"snssaiList,omitempty"`
}

func NewPlmnSupportItem

func NewPlmnSupportItem() (item PlmnSupportItem)

type RanUe

type RanUe struct {
	/* UE identity*/
	RanUeNgapId int64
	AmfUeNgapId int64

	/* HandOver Info*/
	HandOverType        ngapType.HandoverType
	SuccessPduSessionId []int32
	SourceUe            *RanUe
	TargetUe            *RanUe

	/* UserLocation*/
	Tai      models.Tai
	Location models.UserLocation
	/* context about udm */
	SupportVoPSn3gpp  bool
	SupportVoPS       bool
	SupportedFeatures string
	LastActTime       *time.Time

	/* Related Context*/
	AmfUe *AmfUe
	Ran   *AmfRan

	/* Routing ID */
	RoutingID string
	/* Trace Recording Session Reference */
	Trsr string
	/* Ue Context Release Action */
	ReleaseAction RelAction
}

func (*RanUe) DetachAmfUe

func (ranUe *RanUe) DetachAmfUe()

func (*RanUe) Remove

func (ranUe *RanUe) Remove() error

func (*RanUe) SwitchToRan

func (ranUe *RanUe) SwitchToRan(newRan *AmfRan, ranUeNgapId int64) error

func (*RanUe) UpdateLocation

func (ranUe *RanUe) UpdateLocation(userLocationInformation *ngapType.UserLocationInformation)

type RecommendRanNode

type RecommendRanNode struct {
	Present         int32
	GlobalRanNodeId *models.GlobalRanNodeId
	Tai             *models.Tai
}

TS 38.413 9.3.1.101

type RecommendedCell

type RecommendedCell struct {
	NgRanCGI         NGRANCGI
	TimeStayedInCell *int64
}

TS 38.413 9.3.1.71

type RelAction

type RelAction int
const (
	UeContextN2NormalRelease RelAction = iota
	UeContextReleaseHandover
	UeContextReleaseUeContext
)

type SecurityAlgorithm

type SecurityAlgorithm struct {
	IntegrityOrder []uint8 // 8bits(NIA1, NIA2, NIA3 , EIA0, EIA1, EIA2, EIA3, ..)
	CipheringOrder []uint8 // 8bits(NEA1, NEA2, NEA3 , EEA0, EEA1, EEA2, EEA3, ..)
}

type SmContext

type SmContext struct {
	SmfId             string
	SmfUri            string
	PlmnId            models.PlmnId
	UserLocation      models.UserLocation
	PduSessionContext *models.PduSessionContext
}

type StoredSmContext

type StoredSmContext struct {
	SmfId             string
	SmfUri            string
	PduSessionContext *models.PduSessionContext
	AnType            models.AccessType
	Payload           []byte
}

type SupportedTAI

type SupportedTAI struct {
	Tai        models.Tai
	SNssaiList []models.Snssai
}

func NewSupportedTAI

func NewSupportedTAI() (tai SupportedTAI)

type UERadioCapabilityForPaging

type UERadioCapabilityForPaging struct {
	NR    string // OCTET string
	EUTRA string // OCTET string
}

type UeSecurityCapabilities

type UeSecurityCapabilities struct {
	NREncryptionAlgorithms             [2]byte // 2 byte hex string, (NEA1 NEA2 NEA3 ....)
	NRIntegrityProtectionAlgorithms    [2]byte // 2 byte hex string, (NIA1 NIA2 NIA3 ....)
	EUTRAEncryptionAlgorithms          [2]byte // 2 byte hex string, (EEA1 EEA2 EEA3 ....)
	EUTRAIntegrityProtectionAlgorithms [2]byte // 2 byte hex string, (EIA1 EIA2 EIA3 ....)
}

TS 38.413 9.3.1.86

Jump to

Keyboard shortcuts

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