context

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GateOpen uint8 = iota
	GateClose
)
View Source
const (
	SourceInterfaceAccess uint8 = iota
	SourceInterfaceCore
)
View Source
const (
	DestinationInterfaceAccess uint8 = iota
	DestinationInterfaceCore
	DestinationInterfaceSgiLanN6Lan
)
View Source
const (
	OuterHeaderCreationGtpUUdpIpv4 uint16 = 256
	OuterHeaderRemovalGtpUUdpIpv4  uint8  = 0
)
View Source
const (
	CONNECTED    = "Connected"
	DISCONNECTED = "Disconnected"
	IDLE         = "Idle"
)
View Source
const DefaultNonGBR5QI = 9

Variables

This section is empty.

Functions

func ActionString

func ActionString(act ApplyAction) string

func AllocateLocalSEID

func AllocateLocalSEID() (uint64, error)

func BuildGSMPDUSessionEstablishmentAccept

func BuildGSMPDUSessionEstablishmentAccept(smContext *SMContext) ([]byte, error)

func BuildGSMPDUSessionEstablishmentReject

func BuildGSMPDUSessionEstablishmentReject(smContext *SMContext, cause uint8) ([]byte, error)

func BuildGSMPDUSessionReleaseCommand

func BuildGSMPDUSessionReleaseCommand(smContext *SMContext) ([]byte, error)

func BuildHandoverCommandTransfer

func BuildHandoverCommandTransfer(ctx *SMContext) ([]byte, error)

func BuildPDUSessionResourceReleaseCommandTransfer

func BuildPDUSessionResourceReleaseCommandTransfer(ctx *SMContext) (buf []byte, err error)

func BuildPDUSessionResourceSetupRequestTransfer

func BuildPDUSessionResourceSetupRequestTransfer(ctx *SMContext) ([]byte, error)

func BuildPathSwitchRequestAcknowledgeTransfer

func BuildPathSwitchRequestAcknowledgeTransfer(ctx *SMContext) ([]byte, error)

TS 38.413 9.3.4.9

func GetPDUSessionCount

func GetPDUSessionCount() int

func HandleHandoverRequestAcknowledgeTransfer

func HandleHandoverRequestAcknowledgeTransfer(b []byte, ctx *SMContext) error

func HandleHandoverRequiredTransfer

func HandleHandoverRequiredTransfer(b []byte, ctx *SMContext) error

func HandlePDUSessionResourceSetupResponseTransfer

func HandlePDUSessionResourceSetupResponseTransfer(b []byte, ctx *SMContext) error

func HandlePathSwitchRequestSetupFailedTransfer

func HandlePathSwitchRequestSetupFailedTransfer(b []byte, ctx *SMContext) error

func HandlePathSwitchRequestTransfer

func HandlePathSwitchRequestTransfer(b []byte, ctx *SMContext) error

func RemoveSMContext

func RemoveSMContext(ctx context.Context, ref string)

func ResolveRef

func ResolveRef(identifier string, pduSessID int32) (ref string, err error)

Types

type ApplyAction

type ApplyAction struct {
	Dupl bool
	Nocp bool
	Buff bool
	Forw bool
	Drop bool
}

type BAR

type BAR struct {
	BARID uint8

	DownlinkDataNotificationDelay  DownlinkDataNotificationDelay
	SuggestedBufferingPacketsCount SuggestedBufferingPacketsCount

	State RuleState
}

Buffering Action Rule 7.5.2.6-1

func (BAR) String

func (bar BAR) String() string

type DNS

type DNS struct {
	IPv4Addr net.IP
	IPv6Addr net.IP
}

type DataPath

type DataPath struct {
	DPNode    *DataPathNode
	Activated bool
}

func GenerateDataPath

func GenerateDataPath(upf *UPF, smContext *SMContext) *DataPath

func (*DataPath) ActivateTunnelAndPDR

func (dataPath *DataPath) ActivateTunnelAndPDR(smContext *SMContext, precedence uint32) error

func (*DataPath) ActivateUlDlTunnel

func (dataPath *DataPath) ActivateUlDlTunnel(smContext *SMContext) error

func (*DataPath) DeactivateTunnelAndPDR

func (dataPath *DataPath) DeactivateTunnelAndPDR(smContext *SMContext)

type DataPathNode

type DataPathNode struct {
	UPF            *UPF
	UpLinkTunnel   *GTPTunnel
	DownLinkTunnel *GTPTunnel
}

func (*DataPathNode) ActivateDlLinkPdr

func (node *DataPathNode) ActivateDlLinkPdr(smContext *SMContext, defQER *QER, defPrecedence uint32, dataPath *DataPath) error

func (*DataPathNode) ActivateDownLinkTunnel

func (node *DataPathNode) ActivateDownLinkTunnel(smContext *SMContext) error

func (*DataPathNode) ActivateUpLinkPdr

func (node *DataPathNode) ActivateUpLinkPdr(smContext *SMContext, defQER *QER, defPrecedence uint32) error

func (*DataPathNode) ActivateUpLinkTunnel

func (node *DataPathNode) ActivateUpLinkTunnel(smContext *SMContext) error

func (*DataPathNode) CreatePccRuleQer

func (node *DataPathNode) CreatePccRuleQer(smContext *SMContext, qosData string) (*QER, error)

func (*DataPathNode) CreateSessRuleQer

func (node *DataPathNode) CreateSessRuleQer(smContext *SMContext) (*QER, error)

func (*DataPathNode) DeactivateDownLinkTunnel

func (node *DataPathNode) DeactivateDownLinkTunnel(smContext *SMContext)

func (*DataPathNode) DeactivateUpLinkTunnel

func (node *DataPathNode) DeactivateUpLinkTunnel(smContext *SMContext)

func (*DataPathNode) GetNodeIP

func (node *DataPathNode) GetNodeIP() (ip string)

type DestinationInterface

type DestinationInterface struct {
	InterfaceValue uint8 // 0x00001111
}

type DnnUPFInfoItem

type DnnUPFInfoItem struct {
	Dnn             string
	DnaiList        []string
	PduSessionTypes []models.PduSessionType
}

DnnUpfInfoItem presents UPF dnn information

type DownlinkDataNotificationDelay

type DownlinkDataNotificationDelay struct {
	DelayValue time.Duration
}

type FAR

type FAR struct {
	ForwardingParameters *ForwardingParameters

	BAR   *BAR
	State RuleState
	FARID uint32

	ApplyAction ApplyAction
}

Forwarding Action Rule. 7.5.2.3-1

func (FAR) String

func (far FAR) String() string

type FTEID

type FTEID struct {
	IPv4Address net.IP
	IPv6Address net.IP
	Chid        bool
	Ch          bool
	V6          bool
	V4          bool
	TeID        uint32
	ChooseID    uint8
}

type ForwardingParameters

type ForwardingParameters struct {
	OuterHeaderCreation  *OuterHeaderCreation
	PFCPSMReqFlags       *PFCPSMReqFlags
	ForwardingPolicyID   string
	NetworkInstance      string
	DestinationInterface DestinationInterface
}

Forwarding Parameters. 7.5.2.3-2

func (ForwardingParameters) String

func (fp ForwardingParameters) String() string

type GBR

type GBR struct {
	ULGBR uint64 // 40-bit data
	DLGBR uint64 // 40-bit data
}

type GTPTunnel

type GTPTunnel struct {
	PDR  map[string]*PDR
	TEID uint32
}

GTPTunnel represents the GTP tunnel information

type GateStatus

type GateStatus struct {
	ULGate uint8 // 0x00001100
	DLGate uint8 // 0x00000011
}

type MBR

type MBR struct {
	ULMBR uint64 // 40-bit data
	DLMBR uint64 // 40-bit data
}

type N3InterfaceUpfInfoItem added in v0.0.13

type N3InterfaceUpfInfoItem struct {
	NetworkInstance string
}

type NodeID

type NodeID struct {
	NodeIDValue []byte
}

func NewNodeID

func NewNodeID(nodeID string) *NodeID

func (*NodeID) ResolveNodeIDToIP added in v0.0.12

func (n *NodeID) ResolveNodeIDToIP() net.IP

func (*NodeID) String

func (n *NodeID) String() string

type OuterHeaderCreation

type OuterHeaderCreation struct {
	IPv4Address                    net.IP
	IPv6Address                    net.IP
	TeID                           uint32
	PortNumber                     uint16
	OuterHeaderCreationDescription uint16
}

type OuterHeaderRemoval

type OuterHeaderRemoval struct {
	OuterHeaderRemovalDescription uint8
}

type PDI

type PDI struct {
	LocalFTeID      *FTEID
	UEIPAddress     *UEIPAddress
	SDFFilter       *SDFFilter
	ApplicationID   string
	NetworkInstance string
	SourceInterface SourceInterface
}

Packet Detection. 7.5.2.2-2

func (PDI) String

func (pdi PDI) String() string

type PDR

type PDR struct {
	OuterHeaderRemoval *OuterHeaderRemoval

	FAR *FAR
	URR *URR
	QER []*QER

	PDI        PDI
	State      RuleState
	PDRID      uint16
	Precedence uint32
}

Packet Detection Rule. Table 7.5.2.2-1

func (PDR) String

func (pdr PDR) String() string

type PFCPSMReqFlags

type PFCPSMReqFlags struct {
	Qaurr bool
	Sndem bool
	Drobu bool
}

type PFCPSessionContext

type PFCPSessionContext struct {
	PDRs       map[uint16]*PDR
	NodeID     NodeID
	LocalSEID  uint64
	RemoteSEID uint64
}

type ProtocolConfigurationOptions

type ProtocolConfigurationOptions struct {
	DNSIPv4Request     bool
	DNSIPv6Request     bool
	IPv4LinkMTURequest bool
}

type QER

type QER struct {
	GateStatus *GateStatus
	MBR        *MBR
	GBR        *GBR

	State RuleState
	QFI   QFI
	QERID uint32
}

QoS Enhancement Rule

func (QER) String

func (qer QER) String() string

type QFI

type QFI struct {
	QFI uint8
}

type RecoveryTimeStamp

type RecoveryTimeStamp struct {
	RecoveryTimeStamp time.Time
}

type RuleState

type RuleState uint8
const (
	RuleInitial RuleState = 0
	RuleCreate  RuleState = 1
	RuleUpdate  RuleState = 2
	RuleRemove  RuleState = 3
)

type SDFFilter

type SDFFilter struct {
	FlowDescription         []byte
	TosTrafficClass         []byte
	SecurityParameterIndex  []byte
	FlowLabel               []byte
	SdfFilterID             uint32
	LengthOfFlowDescription uint16
	Bid                     bool
	Fl                      bool
	Spi                     bool
	Ttc                     bool
	Fd                      bool
}

type SMContext

type SMContext struct {
	Ref                            string
	Supi                           string
	Pei                            string
	Identifier                     string
	Gpsi                           string
	Dnn                            string
	UeTimeZone                     string
	ServingNfID                    string
	SmStatusNotifyURI              string
	UpCnxState                     models.UpCnxState
	AnType                         models.AccessType
	RatType                        models.RatType
	DnnConfiguration               models.DnnConfiguration
	Snssai                         *models.Snssai
	ServingNetwork                 *models.PlmnID
	UeLocation                     *models.UserLocation
	PDUAddress                     *UeIPAddr
	Tunnel                         *UPTunnel
	DNNInfo                        *SnssaiSmfDnnInfo
	ProtocolConfigurationOptions   *ProtocolConfigurationOptions
	SubGsmLog                      *zap.Logger
	SubPfcpLog                     *zap.Logger
	SubPduSessLog                  *zap.Logger
	SubCtxLog                      *zap.Logger
	SmPolicyUpdates                []*qos.PolicyUpdate
	SmPolicyData                   qos.SmCtxtPolicyData
	PFCPContext                    map[string]*PFCPSessionContext
	SMLock                         sync.Mutex
	PDUSessionID                   int32
	SelectedPDUSessionType         uint8
	PDUSessionReleaseDueToDupPduID bool
	Pti                            uint8
	EstAcceptCause5gSMValue        uint8
}

func GetSMContext

func GetSMContext(ref string) (smContext *SMContext)

func GetSMContextBySEID

func GetSMContextBySEID(SEID uint64) (smContext *SMContext)

func NewSMContext

func NewSMContext(identifier string, pduSessID int32) (smContext *SMContext)

func PDUSessionsByDNN added in v0.2.0

func PDUSessionsByDNN(dnn string) []*SMContext

func PDUSessionsByIMSI added in v0.1.0

func PDUSessionsByIMSI(imsi string) []*SMContext

func (*SMContext) AllocateLocalSEIDForDataPath

func (smContext *SMContext) AllocateLocalSEIDForDataPath(dataPath *DataPath) error

func (*SMContext) BuildCreatedData

func (smContext *SMContext) BuildCreatedData() (createdData *models.SmContextCreatedData)

func (*SMContext) CommitSmPolicyDecision

func (smContext *SMContext) CommitSmPolicyDecision(status bool) error

func (*SMContext) GeneratePDUSessionEstablishmentReject

func (smContext *SMContext) GeneratePDUSessionEstablishmentReject(cause uint8) *models.PostSmContextsErrorResponse

func (*SMContext) GetNodeIDByLocalSEID

func (smContext *SMContext) GetNodeIDByLocalSEID(seid uint64) (nodeID NodeID)

func (*SMContext) HandlePDUSessionEstablishmentRequest

func (smContext *SMContext) HandlePDUSessionEstablishmentRequest(req *nasMessage.PDUSessionEstablishmentRequest)

func (*SMContext) HandlePDUSessionReleaseRequest

func (smContext *SMContext) HandlePDUSessionReleaseRequest(ctx context.Context, req *nasMessage.PDUSessionReleaseRequest)

func (*SMContext) PDUAddressToNAS

func (smContext *SMContext) PDUAddressToNAS() (addr [12]byte, addrLen uint8)

func (*SMContext) PutPDRtoPFCPSession

func (smContext *SMContext) PutPDRtoPFCPSession(nodeID NodeID, pdrList map[string]*PDR) error

func (*SMContext) ReleaseUeIPAddr added in v0.0.12

func (smContext *SMContext) ReleaseUeIPAddr(ctx context.Context) error

func (*SMContext) RemovePDRfromPFCPSession

func (smContext *SMContext) RemovePDRfromPFCPSession(nodeID NodeID, pdr *PDR)

func (*SMContext) SelectedSessionRule

func (smContext *SMContext) SelectedSessionRule() *models.SessionRule

SelectedSessionRule - return the SMF selected session rule for this SM Context

func (*SMContext) SetCreateData

func (smContext *SMContext) SetCreateData(createData *models.SmContextCreateData)

type SMFContext

type SMFContext struct {
	DBInstance     *db.Database
	UPF            *UPF
	CPNodeID       NodeID
	LocalSEIDCount uint64
}

func SMFSelf added in v0.0.12

func SMFSelf() *SMFContext

type SNssai

type SNssai struct {
	Sd  string
	Sst int32
}

type SnssaiSmfDnnInfo

type SnssaiSmfDnnInfo struct {
	DNS DNS
	MTU uint16
}

SnssaiSmfDnnInfo records the SMF per S-NSSAI DNN information

func RetrieveDnnInformation

func RetrieveDnnInformation(ctx context.Context, Snssai models.Snssai, dnn string) (*SnssaiSmfDnnInfo, error)

RetrieveDnnInformation gets the corresponding dnn info from S-NSSAI and DNN

type SnssaiSmfInfo

type SnssaiSmfInfo struct {
	DnnInfos map[string]*SnssaiSmfDnnInfo
	PlmnID   models.PlmnID
	Snssai   SNssai
}

SnssaiSmfInfo records the SMF S-NSSAI related information

func GetSnssaiInfo

func GetSnssaiInfo(ctx context.Context) (*SnssaiSmfInfo, error)

type SnssaiUPFInfo

type SnssaiUPFInfo struct {
	SNssai  SNssai
	DnnList []DnnUPFInfoItem
}

type SourceInterface

type SourceInterface struct {
	InterfaceValue uint8 // 0x00001111
}

type SuggestedBufferingPacketsCount

type SuggestedBufferingPacketsCount struct {
	PacketCountValue uint8
}

type UEIPAddress

type UEIPAddress struct {
	IPv4Address              net.IP
	IPv6Address              net.IP
	V6                       bool // bit 1
	V4                       bool // bit 2
	Sd                       bool // bit 3
	Ipv6d                    bool // bit 4
	CHV4                     bool // bit 5
	CHV6                     bool // bit 6
	IP6PL                    bool // bit 7
	Ipv6PrefixDelegationBits uint8
	Ipv6PrefixLength         uint8
}

type UPF

type UPF struct {
	N3Interface UPFInterfaceInfo

	NodeID NodeID

	// lock
	UpfLock sync.RWMutex
	// contains filtered or unexported fields
}

func NewUPF

func NewUPF(nodeID *NodeID) (upf *UPF)

func (*UPF) AddBAR

func (upf *UPF) AddBAR() (*BAR, error)

func (*UPF) AddFAR

func (upf *UPF) AddFAR() (*FAR, error)

func (*UPF) AddPDR

func (upf *UPF) AddPDR() (*PDR, error)

func (*UPF) AddQER

func (upf *UPF) AddQER() (*QER, error)

func (*UPF) BuildCreatePdrFromPccRule

func (upf *UPF) BuildCreatePdrFromPccRule(rule *models.PccRule) (*PDR, error)

func (*UPF) RemoveBAR

func (upf *UPF) RemoveBAR(bar *BAR)

func (*UPF) RemoveFAR

func (upf *UPF) RemoveFAR(far *FAR)

func (*UPF) RemovePDR

func (upf *UPF) RemovePDR(pdr *PDR)

func (*UPF) RemoveQER

func (upf *UPF) RemoveQER(qer *QER)

type UPFInterfaceInfo

type UPFInterfaceInfo struct {
	IPv4EndPointAddresses []net.IP
}

UPFInterfaceInfo store the UPF interface information

func (*UPFInterfaceInfo) IP

func (i *UPFInterfaceInfo) IP(pduSessType uint8) (net.IP, error)

IP returns the IP of the user plane IP information of the pduSessType

type UPTunnel

type UPTunnel struct {
	DataPath      *DataPath
	ANInformation struct {
		IPAddress net.IP
		TEID      uint32
	}
}

type URR

type URR struct{}

Usage Report Rule

type UeIPAddr added in v0.0.12

type UeIPAddr struct {
	IP net.IP
}

Jump to

Keyboard shortcuts

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