Documentation ¶
Index ¶
- Constants
- func GetInterfaceName(ipAddress string) (interfaceName string, err error)
- type AMFOverloadContent
- type AMFSCTPAddresses
- type AMFTNLAssociationItem
- type BroadcastPLMNItem
- type ChildSecurityAssociation
- type GTPConnectionInfo
- type GlobalTNGFID
- type IKESecurityAssociation
- type PDUSession
- type PDUSessionSetupTemporaryData
- type PLMNID
- type QosFlow
- type RadiusSession
- type SNSSAIItem
- type SliceOverloadItem
- type SliceSupportItem
- type SupportedTAItem
- type TNGFAMF
- func (amf *TNGFAMF) AddAMFTNLAssociationItem(info ngapType.CPTransportLayerInformation) *AMFTNLAssociationItem
- func (amf *TNGFAMF) DeleteAMFTNLAssociationItem(info ngapType.CPTransportLayerInformation)
- func (amf *TNGFAMF) FindAMFTNLAssociationItem(info ngapType.CPTransportLayerInformation) *AMFTNLAssociationItem
- func (amf *TNGFAMF) FindAvalibleAMFByCompareGUAMI(ueSpecifiedGUAMI *ngapType.GUAMI) bool
- func (amf *TNGFAMF) FindAvalibleAMFByCompareSelectedPLMNId(ueSpecifiedSelectedPLMNId *ngapType.PLMNIdentity) bool
- func (amf *TNGFAMF) FindUeByAmfUeNgapID(id int64) *TNGFUe
- func (amf *TNGFAMF) RemoveAllRelatedUe()
- func (amf *TNGFAMF) StartOverload(resp *ngapType.OverloadResponse, ...) *AMFOverloadContent
- func (amf *TNGFAMF) StopOverload()
- type TNGFContext
- func (context *TNGFContext) AMFPoolLoad(sctpAddr string) (*TNGFAMF, bool)
- func (context *TNGFContext) AMFReInitAvailableListLoad(sctpAddr string) (bool, bool)
- func (context *TNGFContext) AMFReInitAvailableListStore(sctpAddr string, flag bool)
- func (context *TNGFContext) AMFSelection(ueSpecifiedGUAMI *ngapType.GUAMI, ueSpecifiedPLMNId *ngapType.PLMNIdentity) *TNGFAMF
- func (context *TNGFContext) AllocatedUEIPAddressLoad(ipAddr string) (*TNGFUe, bool)
- func (context *TNGFContext) AllocatedUETEIDLoad(teid uint32) (*TNGFUe, bool)
- func (context *TNGFContext) DeleteAMFReInitAvailableFlag(sctpAddr string)
- func (context *TNGFContext) DeleteGTPConnection(upfAddr string)
- func (context *TNGFContext) DeleteIKESecurityAssociation(spi uint64)
- func (context *TNGFContext) DeleteInternalUEIPAddr(ipAddr string)
- func (context *TNGFContext) DeleteRadiusSession(ranUeNgapId string)
- func (context *TNGFContext) DeleteTEID(teid uint32)
- func (context *TNGFContext) DeleteTngfAmf(sctpAddr string)
- func (context *TNGFContext) DeleteTngfUe(ranUeNgapId int64)
- func (context *TNGFContext) GTPConnectionWithUPFLoad(upfAddr string) (*gtpv1.UPlaneConn, bool)
- func (context *TNGFContext) GTPConnectionWithUPFStore(upfAddr string, conn *gtpv1.UPlaneConn)
- func (context *TNGFContext) IKESALoad(spi uint64) (*IKESecurityAssociation, bool)
- func (context *TNGFContext) NewIKESecurityAssociation() *IKESecurityAssociation
- func (context *TNGFContext) NewInternalUEIPAddr(ue *TNGFUe) net.IP
- func (context *TNGFContext) NewRadiusSession(callingStationID string) *RadiusSession
- func (context *TNGFContext) NewTEID(ue *TNGFUe) uint32
- func (context *TNGFContext) NewTngfAmf(sctpAddr string, conn *sctp.SCTPConn) *TNGFAMF
- func (context *TNGFContext) NewTngfUe() *TNGFUe
- func (context *TNGFContext) RadiusSessionPoolLoad(ranUeNgapId string) (*RadiusSession, bool)
- func (context *TNGFContext) UELoadbyIDi(idi []byte) *TNGFUe
- func (context *TNGFContext) UePoolLoad(ranUeNgapId int64) (*TNGFUe, bool)
- type TNGFNFInfo
- type TNGFUe
- func (ue *TNGFUe) AttachAMF(sctpAddr string) bool
- func (ue *TNGFUe) CompleteChildSA(msgID uint32, outboundSPI uint32, ...) (*ChildSecurityAssociation, error)
- func (ue *TNGFUe) CreateHalfChildSA(msgID, inboundSPI uint32, pduSessionID int64)
- func (ue *TNGFUe) CreatePDUSession(pduSessionID int64, snssai ngapType.SNSSAI) (*PDUSession, error)
- func (ue *TNGFUe) DetachAMF()
- func (ue *TNGFUe) FindPDUSession(pduSessionID int64) *PDUSession
- func (ue *TNGFUe) Remove()
- type UDPSocketInfo
Constants ¶
View Source
const ( MaxValueOfRanUeNgapID int64 = 4294967295 MaxNumOfPDUSessions int = 256 )
View Source
const (
AmfUeNgapIdUnspecified int64 = 0xffffffffff
)
View Source
const RadiusDefaultSecret = "free5GC"
Variables ¶
This section is empty.
Functions ¶
func GetInterfaceName ¶
Types ¶
type AMFOverloadContent ¶
type AMFOverloadContent struct { Action *ngapType.OverloadAction TrafficInd *int64 NSSAIList []SliceOverloadItem }
type AMFSCTPAddresses ¶
type AMFSCTPAddresses struct { IPAddresses []string `yaml:"IP" valid:"required"` Port int `yaml:"Port,omitempty" valid:"port,optional"` // Default port is 38412 if not defined. }
func (*AMFSCTPAddresses) Validate ¶
func (a *AMFSCTPAddresses) Validate() (bool, error)
type AMFTNLAssociationItem ¶
type AMFTNLAssociationItem struct { Ipv4 string Ipv6 string TNLAssociationUsage *ngapType.TNLAssociationUsage TNLAddressWeightFactor *int64 }
type BroadcastPLMNItem ¶
type BroadcastPLMNItem struct { PLMNID PLMNID `yaml:"PLMNID" valid:"required"` TAISliceSupportList []SliceSupportItem `yaml:"TAISliceSupportList" valid:"required"` }
type ChildSecurityAssociation ¶
type ChildSecurityAssociation struct { // SPI InboundSPI uint32 // TNGF Specify OutboundSPI uint32 // Non-3GPP UE Specify // Associated XFRM interface XfrmIface netlink.Link // IP address PeerPublicIPAddr net.IP LocalPublicIPAddr net.IP // Traffic selector SelectedIPProtocol uint8 TrafficSelectorLocal net.IPNet TrafficSelectorRemote net.IPNet // Security EncryptionAlgorithm uint16 InitiatorToResponderEncryptionKey []byte ResponderToInitiatorEncryptionKey []byte IntegrityAlgorithm uint16 InitiatorToResponderIntegrityKey []byte ResponderToInitiatorIntegrityKey []byte ESN bool // Encapsulate EnableEncapsulate bool TNGFPort int NATPort int // PDU Session IDs associated with this child SA PDUSessionIds []int64 // UE context ThisUE *TNGFUe }
type GTPConnectionInfo ¶
type GlobalTNGFID ¶
type IKESecurityAssociation ¶
type IKESecurityAssociation struct { // SPI RemoteSPI uint64 LocalSPI uint64 // Message ID InitiatorMessageID uint32 ResponderMessageID uint32 // Transforms for IKE SA EncryptionAlgorithm *ike_message.Transform PseudorandomFunction *ike_message.Transform IntegrityAlgorithm *ike_message.Transform DiffieHellmanGroup *ike_message.Transform ExpandedSequenceNumber *ike_message.Transform // Used for key generating ConcatenatedNonce []byte // Keys SK_d []byte // used for child SA key deriving SK_ai []byte // used by initiator for integrity checking SK_ar []byte // used by responder for integrity checking SK_ei []byte // used by initiator for encrypting SK_er []byte // used by responder for encrypting SK_pi []byte // used by initiator for IKE authentication SK_pr []byte // used by responder for IKE authentication // State for IKE_AUTH State uint8 // Temporary data stored for the use in later exchange InitiatorID *ike_message.IdentificationInitiator InitiatorCertificate *ike_message.Certificate IKEAuthResponseSA *ike_message.SecurityAssociation TrafficSelectorInitiator *ike_message.TrafficSelectorInitiator TrafficSelectorResponder *ike_message.TrafficSelectorResponder LastEAPIdentifier uint8 // Authentication data ResponderSignedOctets []byte InitiatorSignedOctets []byte // NAT detection // If UEIsBehindNAT == true, TNGF should enable NAT traversal and // TODO: should support dynamic updating network address (MOBIKE) UEIsBehindNAT bool // If TNGFIsBehindNAT == true, TNGF should send UDP keepalive periodically TNGFIsBehindNAT bool // UE context ThisUE *TNGFUe }
type PDUSession ¶
type PDUSession struct { Id int64 // PDU Session ID Type *ngapType.PDUSessionType Ambr *ngapType.PDUSessionAggregateMaximumBitRate Snssai ngapType.SNSSAI NetworkInstance *ngapType.NetworkInstance SecurityCipher bool SecurityIntegrity bool MaximumIntegrityDataRateUplink *ngapType.MaximumIntegrityProtectedDataRate MaximumIntegrityDataRateDownlink *ngapType.MaximumIntegrityProtectedDataRate GTPConnection *GTPConnectionInfo QFIList []uint8 QosFlows map[int64]*QosFlow // QosFlowIdentifier as key }
type PDUSessionSetupTemporaryData ¶
type PDUSessionSetupTemporaryData struct { // Slice of unactivated PDU session UnactivatedPDUSession []int64 // PDUSessionID as content // NGAPProcedureCode is used to identify which type of // response shall be used NGAPProcedureCode ngapType.ProcedureCode // PDU session setup list response SetupListCxtRes *ngapType.PDUSessionResourceSetupListCxtRes FailedListCxtRes *ngapType.PDUSessionResourceFailedToSetupListCxtRes SetupListSURes *ngapType.PDUSessionResourceSetupListSURes FailedListSURes *ngapType.PDUSessionResourceFailedToSetupListSURes }
type QosFlow ¶
type QosFlow struct { Identifier int64 Parameters ngapType.QosFlowLevelQosParameters }
type RadiusSession ¶
type SNSSAIItem ¶
type SliceOverloadItem ¶
type SliceOverloadItem struct { SNssaiList []ngapType.SNSSAI Action *ngapType.OverloadAction TrafficInd *int64 }
type SliceSupportItem ¶
type SliceSupportItem struct {
SNSSAI SNSSAIItem `yaml:"SNSSAI" valid:"required"`
}
type SupportedTAItem ¶
type SupportedTAItem struct { TAC string `yaml:"TAC" valid:"hexadecimal,stringlength(6|6),required"` BroadcastPLMNList []BroadcastPLMNItem `yaml:"BroadcastPLMNList" valid:"required"` }
type TNGFAMF ¶
type TNGFAMF struct { SCTPAddr string SCTPConn *sctp.SCTPConn AMFName *ngapType.AMFName ServedGUAMIList *ngapType.ServedGUAMIList RelativeAMFCapacity *ngapType.RelativeAMFCapacity PLMNSupportList *ngapType.PLMNSupportList AMFTNLAssociationList map[string]*AMFTNLAssociationItem // v4+v6 as key // Overload related AMFOverloadContent *AMFOverloadContent // Relative Context TngfUeList map[int64]*TNGFUe // ranUeNgapId as key }
func (*TNGFAMF) AddAMFTNLAssociationItem ¶
func (amf *TNGFAMF) AddAMFTNLAssociationItem(info ngapType.CPTransportLayerInformation) *AMFTNLAssociationItem
func (*TNGFAMF) DeleteAMFTNLAssociationItem ¶
func (amf *TNGFAMF) DeleteAMFTNLAssociationItem(info ngapType.CPTransportLayerInformation)
func (*TNGFAMF) FindAMFTNLAssociationItem ¶
func (amf *TNGFAMF) FindAMFTNLAssociationItem(info ngapType.CPTransportLayerInformation) *AMFTNLAssociationItem
func (*TNGFAMF) FindAvalibleAMFByCompareGUAMI ¶
FindAvalibleAMFByCompareGUAMI compares the incoming GUAMI with AMF served GUAMI and return if this AMF is avalible for UE
func (*TNGFAMF) FindAvalibleAMFByCompareSelectedPLMNId ¶
func (amf *TNGFAMF) FindAvalibleAMFByCompareSelectedPLMNId(ueSpecifiedSelectedPLMNId *ngapType.PLMNIdentity) bool
func (*TNGFAMF) FindUeByAmfUeNgapID ¶
func (*TNGFAMF) RemoveAllRelatedUe ¶
func (amf *TNGFAMF) RemoveAllRelatedUe()
func (*TNGFAMF) StartOverload ¶
func (amf *TNGFAMF) StartOverload( resp *ngapType.OverloadResponse, trafloadInd *ngapType.TrafficLoadReductionIndication, nssai *ngapType.OverloadStartNSSAIList, ) *AMFOverloadContent
func (*TNGFAMF) StopOverload ¶
func (amf *TNGFAMF) StopOverload()
type TNGFContext ¶
type TNGFContext struct { NFInfo TNGFNFInfo AMFSCTPAddresses []*sctp.SCTPAddr // ID generator RANUENGAPIDGenerator *idgenerator.IDGenerator TEIDGenerator *idgenerator.IDGenerator // Pools UePool sync.Map // map[int64]*TNGFUe, RanUeNgapID as key AMFPool sync.Map // map[string]*TNGFAMF, SCTPAddr as key AMFReInitAvailableList sync.Map // map[string]bool, SCTPAddr as key IKESA sync.Map // map[uint64]*IKESecurityAssociation, SPI as key ChildSA sync.Map // map[uint32]*ChildSecurityAssociation, inboundSPI as key GTPConnectionWithUPF sync.Map // map[string]*gtpv1.UPlaneConn, UPF address as key AllocatedUEIPAddress sync.Map // map[string]*TNGFUe, IPAddr as key AllocatedUETEID sync.Map // map[uint32]*TNGFUe, TEID as key RadiusSessionPool sync.Map // map[string]*RadiusSession, Calling Station ID as key // TNGF FQDN FQDN string // Security data CertificateAuthority []byte TNGFCertificate []byte TNGFPrivateKey *rsa.PrivateKey RadiusSecret string // UEIPAddressRange Subnet *net.IPNet // XFRM interface XfrmIfaceId uint32 XfrmIfaces sync.Map // map[uint32]*netlink.Link, XfrmIfaceId as key XfrmIfaceName string XfrmParentIfaceName string // Every UE's first UP IPsec will use default XFRM interface, additoinal UP IPsec will offset its XFRM id XfrmIfaceIdOffsetForUP uint32 // TNGF local address IKEBindAddress string RadiusBindAddress string IPSecGatewayAddress string GTPBindAddress string TCPPort uint16 // TNGF NWt interface IPv4 packet connection NWtIPv4PacketConn *ipv4.PacketConn }
func (*TNGFContext) AMFPoolLoad ¶
func (context *TNGFContext) AMFPoolLoad(sctpAddr string) (*TNGFAMF, bool)
func (*TNGFContext) AMFReInitAvailableListLoad ¶
func (context *TNGFContext) AMFReInitAvailableListLoad(sctpAddr string) (bool, bool)
func (*TNGFContext) AMFReInitAvailableListStore ¶
func (context *TNGFContext) AMFReInitAvailableListStore(sctpAddr string, flag bool)
func (*TNGFContext) AMFSelection ¶
func (context *TNGFContext) AMFSelection(ueSpecifiedGUAMI *ngapType.GUAMI, ueSpecifiedPLMNId *ngapType.PLMNIdentity, ) *TNGFAMF
func (*TNGFContext) AllocatedUEIPAddressLoad ¶
func (context *TNGFContext) AllocatedUEIPAddressLoad(ipAddr string) (*TNGFUe, bool)
func (*TNGFContext) AllocatedUETEIDLoad ¶
func (context *TNGFContext) AllocatedUETEIDLoad(teid uint32) (*TNGFUe, bool)
func (*TNGFContext) DeleteAMFReInitAvailableFlag ¶
func (context *TNGFContext) DeleteAMFReInitAvailableFlag(sctpAddr string)
func (*TNGFContext) DeleteGTPConnection ¶
func (context *TNGFContext) DeleteGTPConnection(upfAddr string)
func (*TNGFContext) DeleteIKESecurityAssociation ¶
func (context *TNGFContext) DeleteIKESecurityAssociation(spi uint64)
func (*TNGFContext) DeleteInternalUEIPAddr ¶
func (context *TNGFContext) DeleteInternalUEIPAddr(ipAddr string)
func (*TNGFContext) DeleteRadiusSession ¶
func (context *TNGFContext) DeleteRadiusSession(ranUeNgapId string)
func (*TNGFContext) DeleteTEID ¶
func (context *TNGFContext) DeleteTEID(teid uint32)
func (*TNGFContext) DeleteTngfAmf ¶
func (context *TNGFContext) DeleteTngfAmf(sctpAddr string)
func (*TNGFContext) DeleteTngfUe ¶
func (context *TNGFContext) DeleteTngfUe(ranUeNgapId int64)
func (*TNGFContext) GTPConnectionWithUPFLoad ¶
func (context *TNGFContext) GTPConnectionWithUPFLoad(upfAddr string) (*gtpv1.UPlaneConn, bool)
func (*TNGFContext) GTPConnectionWithUPFStore ¶
func (context *TNGFContext) GTPConnectionWithUPFStore(upfAddr string, conn *gtpv1.UPlaneConn)
func (*TNGFContext) IKESALoad ¶
func (context *TNGFContext) IKESALoad(spi uint64) (*IKESecurityAssociation, bool)
func (*TNGFContext) NewIKESecurityAssociation ¶
func (context *TNGFContext) NewIKESecurityAssociation() *IKESecurityAssociation
func (*TNGFContext) NewInternalUEIPAddr ¶
func (context *TNGFContext) NewInternalUEIPAddr(ue *TNGFUe) net.IP
func (*TNGFContext) NewRadiusSession ¶
func (context *TNGFContext) NewRadiusSession(callingStationID string) *RadiusSession
func (*TNGFContext) NewTEID ¶
func (context *TNGFContext) NewTEID(ue *TNGFUe) uint32
func (*TNGFContext) NewTngfAmf ¶
func (context *TNGFContext) NewTngfAmf(sctpAddr string, conn *sctp.SCTPConn) *TNGFAMF
func (*TNGFContext) NewTngfUe ¶
func (context *TNGFContext) NewTngfUe() *TNGFUe
func (*TNGFContext) RadiusSessionPoolLoad ¶
func (context *TNGFContext) RadiusSessionPoolLoad(ranUeNgapId string) (*RadiusSession, bool)
func (*TNGFContext) UELoadbyIDi ¶
func (context *TNGFContext) UELoadbyIDi(idi []byte) *TNGFUe
func (*TNGFContext) UePoolLoad ¶
func (context *TNGFContext) UePoolLoad(ranUeNgapId int64) (*TNGFUe, bool)
type TNGFNFInfo ¶
type TNGFNFInfo struct { GlobalTNGFID GlobalTNGFID `yaml:"GlobalTNGFID" valid:"required"` RanNodeName string `yaml:"Name,omitempty" valid:"optional"` SupportedTAList []SupportedTAItem `yaml:"SupportedTAList" valid:"required"` }
type TNGFUe ¶
type TNGFUe struct { /* UE identity */ RanUeNgapId int64 AmfUeNgapId int64 IPAddrv4 string IPAddrv6 string PortNumber int32 TNAPID uint64 MaskedIMEISV *ngapType.MaskedIMEISV // TS 38.413 9.3.1.54 Guti string IPSecInnerIP net.IP IPSecInnerIPAddr *net.IPAddr // Used to send UP packets to UE /* Relative Context */ AMF *TNGFAMF /* PDU Session */ PduSessionList map[int64]*PDUSession // pduSessionId as key /* PDU Session Setup Temporary Data */ TemporaryPDUSessionSetupData *PDUSessionSetupTemporaryData /* Temporary cached NAS message */ // Used when NAS registration accept arrived before // UE setup NAS TCP connection with TNGF, and // Forward pduSessionEstablishmentAccept to UE after // UE send CREATE_CHILD_SA response TemporaryCachedNASMessage []byte /* Security */ Ktngf []uint8 // 32 bytes (256 bits), value is from NGAP IE "Security Key" Ktnap []uint8 // 32 bytes (256 bits), value is computed from Ktngf Ktipsec []uint8 // 32 bytes (256 bits), value is computed from Ktngf SecurityCapabilities *ngapType.UESecurityCapabilities // TS 38.413 9.3.1.86 /* IKE Security Association */ TNGFIKESecurityAssociation *IKESecurityAssociation TNGFChildSecurityAssociation map[uint32]*ChildSecurityAssociation // inbound SPI as key SignallingIPsecSAEstablished bool // RADIUS Session RadiusSession *RadiusSession /* Temporary Mapping of two SPIs */ // Exchange Message ID(including a SPI) and ChildSA(including a SPI) // Mapping of Message ID of exchange in IKE and Child SA when creating new child SA TemporaryExchangeMsgIDChildSAMapping map[uint32]*ChildSecurityAssociation // Message ID as a key /* NAS IKE Connection */ IKEConnection *UDPSocketInfo /* NAS TCP Connection */ TCPConnection net.Conn // RADIUS Connection RadiusConnection *UDPSocketInfo /* Others */ Guami *ngapType.GUAMI IndexToRfsp int64 Ambr *ngapType.UEAggregateMaximumBitRate AllowedNssai *ngapType.AllowedNSSAI RadioCapability *ngapType.UERadioCapability // TODO: This is for RRC, can be deleted CoreNetworkAssistanceInformation *ngapType.CoreNetworkAssistanceInformation // TS 38.413 9.3.1.15 IMSVoiceSupported int32 RRCEstablishmentCause int16 UserName string UEIdentity *nasType.MobileIdentity5GS }
func (*TNGFUe) CompleteChildSA ¶
func (ue *TNGFUe) CompleteChildSA(msgID uint32, outboundSPI uint32, chosenSecurityAssociation *ike_message.SecurityAssociation, ) (*ChildSecurityAssociation, error)
func (*TNGFUe) CreateHalfChildSA ¶
When TNGF send CREATE_CHILD_SA request to N3UE, the inbound SPI of childSA will be only stored first until receive response and call CompleteChildSAWithProposal to fill the all data of childSA
func (*TNGFUe) CreatePDUSession ¶
func (*TNGFUe) FindPDUSession ¶
func (ue *TNGFUe) FindPDUSession(pduSessionID int64) *PDUSession
Click to show internal directories.
Click to hide internal directories.