pfcp_networking

package
v0.0.42 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Copyright 2024 Louis Royer and the go-pfcp-networking contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFSEID

func NewFSEID(seid api.SEID, v4, v6 *net.IPAddr) (*ie.IE, error)

Safe function to create FSEID

Types

type AssociationsMap

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

func NewAssociationsMap

func NewAssociationsMap() AssociationsMap

func (*AssociationsMap) Add

func (a *AssociationsMap) Add(association api.PFCPAssociationInterface) error

Add an association to the association table

func (*AssociationsMap) CheckNonExist

func (a *AssociationsMap) CheckNonExist(nid string) bool

Returns true if the association does not exist

func (*AssociationsMap) Get

func (a *AssociationsMap) Get(nid string) (association api.PFCPAssociationInterface, err error)

Returns a copy of an existing PFCP Association

func (*AssociationsMap) Remove

func (a *AssociationsMap) Remove(association api.PFCPAssociationInterface) error

Remove an association from the association table

func (*AssociationsMap) Update

func (a *AssociationsMap) Update(association api.PFCPAssociationInterface) error

Update a Association

type EntityOptions added in v0.0.31

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

func NewEntityOptions added in v0.0.31

func NewEntityOptions() *EntityOptions

NewEntityOptions create a new EntityOptions with default settings.

func (EntityOptions) MessageRetransmissionN1 added in v0.0.31

func (eo EntityOptions) MessageRetransmissionN1() int

func (EntityOptions) MessageRetransmissionT1 added in v0.0.31

func (eo EntityOptions) MessageRetransmissionT1() time.Duration

func (EntityOptions) SetMessageRetransmissionN1 added in v0.0.34

func (eo EntityOptions) SetMessageRetransmissionN1(messageRetransmissionN1 int) error

func (EntityOptions) SetMessageRetransmissionT1 added in v0.0.34

func (eo EntityOptions) SetMessageRetransmissionT1(messageRetransmissionT1 time.Duration) error

type FAR

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

func NewFAR

func NewFAR(id *ie.IE, applyAction *ie.IE, forwardingParameters *ie.IE) *FAR

func (*FAR) ApplyAction

func (far *FAR) ApplyAction() *ie.IE

func (*FAR) ForwardingParameters

func (far *FAR) ForwardingParameters() (*ie.IE, error)

func (*FAR) ID

func (far *FAR) ID() (api.FARID, error)

func (*FAR) NewCreateFAR

func (far *FAR) NewCreateFAR() *ie.IE

func (*FAR) Update added in v0.0.42

func (far *FAR) Update(farUpdate api.FARUpdateInterface) error

type FARMap

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

func NewFARMap

func NewFARMap(fars []*ie.IE) (farmap *FARMap, err error, cause uint8, offendingIE uint16)

func (*FARMap) Add

func (m *FARMap) Add(far api.FARInterface) error

func (*FARMap) Foreach

func (m *FARMap) Foreach(f func(api.FARInterface) error) error

func (*FARMap) Get

func (m *FARMap) Get(key api.FARID) (api.FARInterface, error)

func (*FARMap) IntoCreateFAR added in v0.0.40

func (m *FARMap) IntoCreateFAR() []*ie.IE

func (*FARMap) NewCreateFARs

func (m *FARMap) NewCreateFARs() []*ie.IE

func (*FARMap) Remove

func (m *FARMap) Remove(key api.FARID) error

func (*FARMap) SimulateAdd

func (m *FARMap) SimulateAdd(far api.FARInterface) error

func (*FARMap) SimulateRemove

func (m *FARMap) SimulateRemove(key api.FARID) error

func (*FARMap) SimulateUpdate

func (m *FARMap) SimulateUpdate(far api.FARUpdateInterface) error

func (*FARMap) Update

func (m *FARMap) Update(farUpdate api.FARUpdateInterface) error

type FARMapUpdate added in v0.0.42

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

func NewFARMapUpdate added in v0.0.36

func NewFARMapUpdate(fars []*ie.IE) (*FARMapUpdate, error, uint8, uint16)

func (*FARMapUpdate) Add added in v0.0.42

func (*FARMapUpdate) Foreach added in v0.0.42

func (m *FARMapUpdate) Foreach(f func(api.FARUpdateInterface) error) error

func (*FARMapUpdate) IntoUpdateFAR added in v0.0.42

func (m *FARMapUpdate) IntoUpdateFAR() []*ie.IE

type FARUpdate added in v0.0.42

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

func NewFARUpdate added in v0.0.42

func NewFARUpdate(id *ie.IE, applyAction *ie.IE, updateForwardingParameters *ie.IE) *FARUpdate

func (*FARUpdate) ApplyAction added in v0.0.42

func (far *FARUpdate) ApplyAction() *ie.IE

func (*FARUpdate) ID added in v0.0.42

func (far *FARUpdate) ID() (api.FARID, error)

func (*FARUpdate) NewUpdateFAR added in v0.0.42

func (far *FARUpdate) NewUpdateFAR() *ie.IE

func (*FARUpdate) UpdateForwardingParameters added in v0.0.42

func (far *FARUpdate) UpdateForwardingParameters() *ie.IE

type OutcomingMessage added in v0.0.33

type OutcomingMessage struct {
	message.Message
	Destination net.Addr
}

func DefaultAssociationSetupRequestHandler added in v0.0.28

func DefaultAssociationSetupRequestHandler(ctx context.Context, msg ReceivedMessage) (*OutcomingMessage, error)

func DefaultHeartbeatRequestHandler added in v0.0.28

func DefaultHeartbeatRequestHandler(ctx context.Context, msg ReceivedMessage) (*OutcomingMessage, error)

func DefaultSessionEstablishmentRequestHandler added in v0.0.28

func DefaultSessionEstablishmentRequestHandler(ctx context.Context, msg ReceivedMessage) (*OutcomingMessage, error)

func DefaultSessionModificationRequestHandler added in v0.0.28

func DefaultSessionModificationRequestHandler(ctx context.Context, msg ReceivedMessage) (*OutcomingMessage, error)

type PDR

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

func NewPDR

func NewPDR(id *ie.IE, pdi *ie.IE, precedence *ie.IE, farid *ie.IE, outerHeaderRemoval *ie.IE) *PDR

func (*PDR) FARID

func (pdr *PDR) FARID() (api.FARID, error)

func (*PDR) FTEID added in v0.0.29

func (pdr *PDR) FTEID() (*ie.FTEIDFields, error)

func (*PDR) ID

func (pdr *PDR) ID() (api.PDRID, error)

func (*PDR) NewCreatePDR

func (pdr *PDR) NewCreatePDR() *ie.IE

func (*PDR) NewUpdatePDR added in v0.0.40

func (pdr *PDR) NewUpdatePDR() *ie.IE

func (*PDR) OuterHeaderRemoval

func (pdr *PDR) OuterHeaderRemoval() *ie.IE

func (*PDR) PDI

func (pdr *PDR) PDI() ([]*ie.IE, error)

func (*PDR) Precedence

func (pdr *PDR) Precedence() (uint32, error)

func (*PDR) SourceInterface added in v0.0.29

func (pdr *PDR) SourceInterface() (uint8, error)

func (*PDR) UEIPAddress added in v0.0.29

func (pdr *PDR) UEIPAddress() (*ie.UEIPAddressFields, error)

type PDRMap

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

func NewPDRMap

func NewPDRMap(pdrs []*ie.IE) (pdrmap *PDRMap, err error, cause uint8, offendingIE uint16)

func (*PDRMap) Add

func (m *PDRMap) Add(pdr api.PDRInterface) error

func (*PDRMap) Foreach

func (m *PDRMap) Foreach(f func(api.PDRInterface) error) error

func (*PDRMap) Get

func (m *PDRMap) Get(key api.PDRID) (api.PDRInterface, error)

func (*PDRMap) GetSortedPDRIDs

func (m *PDRMap) GetSortedPDRIDs() []api.PDRID

func (*PDRMap) IntoCreatePDR added in v0.0.40

func (m *PDRMap) IntoCreatePDR() []*ie.IE

func (*PDRMap) IntoUpdatePDR added in v0.0.40

func (m *PDRMap) IntoUpdatePDR() []*ie.IE

func (*PDRMap) Len

func (m *PDRMap) Len() int

func (*PDRMap) Less

func (m *PDRMap) Less(i, j int) bool

Begin - Functions used internally to sort PDR IDs calling them is unsafe

func (*PDRMap) NewCreatePDRs

func (m *PDRMap) NewCreatePDRs() []*ie.IE

func (*PDRMap) Remove

func (m *PDRMap) Remove(key api.PDRID) error

func (*PDRMap) SimulateAdd

func (m *PDRMap) SimulateAdd(pdr api.PDRInterface) error

func (*PDRMap) SimulateRemove

func (m *PDRMap) SimulateRemove(key api.PDRID) error

func (*PDRMap) SimulateUpdate

func (m *PDRMap) SimulateUpdate(pdr api.PDRInterface) error

func (*PDRMap) Swap

func (m *PDRMap) Swap(i, j int)

func (*PDRMap) Update

func (m *PDRMap) Update(pdr api.PDRInterface) error

type PFCPAssociation

type PFCPAssociation struct {
	api.PFCPPeerInterface // connection to remote peer
	// contains filtered or unexported fields
}

func (*PFCPAssociation) CreateSession

func (association *PFCPAssociation) CreateSession(remoteFseid *ie.IE, pdrs api.PDRMapInterface, fars api.FARMapInterface) (session api.PFCPSessionInterface, err error)

remoteFseid can be nil if caller is at CP function side

func (*PFCPAssociation) GetNextSEID

func (association *PFCPAssociation) GetNextSEID() api.SEID

Get next available SEID for this PFCPAssociation. SEID are not globally unique, F-SEID are globally unique. F-SEID consist of IPv4 and/or IPv6 address(es) of the peer plus the SEID. So as long as SEID are unique per peer (i.e. per PFCPAssociation), everything should be okay.

func (*PFCPAssociation) SetupInitiatedByCP

func (association *PFCPAssociation) SetupInitiatedByCP() error

Setup a PFCPAssociation with the PFCP Association Setup by the CP Function Procedure If the LocalEntity is a CP function, a PFCP Association Setup Request is sent, if the LocalEntity is a UP function, we assume this method is called because we received a Association Setup Request.

PFCP Association Setup Initiated by the UP Function is NOT supported (yet). PR are welcome.

See 129.244 v16.0.1, section 6.2.6.1: The setup of a PFCP association may be initiated by the CP function (see clause 6.2.6.2) or the UP function (see clause 6.2.6.3). The CP function and the UP function shall support the PFCP Association Setup initiated by the CP function. The CP function and the UP function may additionally support the PFCP Association Setup initiated by the UP function.

type PFCPConn added in v0.0.33

type PFCPConn struct {
	net.UDPConn
}

func ListenPFCP added in v0.0.33

func ListenPFCP(network string, laddr netip.Addr) (*PFCPConn, error)

func (*PFCPConn) Write added in v0.0.33

func (conn *PFCPConn) Write(m *OutcomingMessage) error

type PFCPEntity

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

func NewPFCPEntity

func NewPFCPEntity(nodeID string, listenAddr netip.Addr, kind string, handlers map[pfcputil.MessageType]PFCPMessageHandler, options api.EntityOptionsInterface) PFCPEntity

func (*PFCPEntity) AddEstablishedPFCPSession

func (e *PFCPEntity) AddEstablishedPFCPSession(session api.PFCPSessionInterface) error

Add an Established PFCP Session

func (*PFCPEntity) AddHandler

func (*PFCPEntity) AddHandlers

func (e *PFCPEntity) AddHandlers(funcs map[pfcputil.MessageType]PFCPMessageHandler) error

func (*PFCPEntity) Close added in v0.0.33

func (e *PFCPEntity) Close() error

Close stop the server and closes active PFCP connection.

func (*PFCPEntity) GetHandler

func (e *PFCPEntity) GetHandler(t pfcputil.MessageType) (h PFCPMessageHandler, err error)

func (*PFCPEntity) GetPFCPAssociation

func (e *PFCPEntity) GetPFCPAssociation(nid string) (association api.PFCPAssociationInterface, err error)

Returns an existing PFCP Association

func (*PFCPEntity) GetPFCPSession

func (e *PFCPEntity) GetPFCPSession(localIP string, seid api.SEID) (api.PFCPSessionInterface, error)

func (*PFCPEntity) GetPFCPSessions

func (e *PFCPEntity) GetPFCPSessions() []api.PFCPSessionInterface

func (*PFCPEntity) IsControlPlane

func (e *PFCPEntity) IsControlPlane() bool

func (*PFCPEntity) IsUserPlane

func (e *PFCPEntity) IsUserPlane() bool

func (*PFCPEntity) ListenAddr added in v0.0.40

func (e *PFCPEntity) ListenAddr() netip.Addr

func (*PFCPEntity) ListenAndServe added in v0.0.33

func (e *PFCPEntity) ListenAndServe() error

Listen PFCP and run the entity with the provided context. Always return a non-nil error.

func (*PFCPEntity) ListenAndServeContext added in v0.0.33

func (e *PFCPEntity) ListenAndServeContext(ctx context.Context) error

Listen PFCP and run the entity with the provided context. Always return a non-nil error.

func (*PFCPEntity) LogPFCPRules added in v0.0.33

func (e *PFCPEntity) LogPFCPRules()

func (*PFCPEntity) NewEstablishedPFCPAssociation

func (e *PFCPEntity) NewEstablishedPFCPAssociation(nodeID *ie.IE) (association api.PFCPAssociationInterface, err error)

func (*PFCPEntity) NodeID

func (e *PFCPEntity) NodeID() *ie.IE

func (*PFCPEntity) Options added in v0.0.31

func (e *PFCPEntity) Options() api.EntityOptionsInterface

func (*PFCPEntity) RecoveryTimeStamp

func (e *PFCPEntity) RecoveryTimeStamp() *ie.IE

func (*PFCPEntity) RemovePFCPAssociation

func (e *PFCPEntity) RemovePFCPAssociation(association api.PFCPAssociationInterface) error

Remove an association from the association table

func (*PFCPEntity) Serve added in v0.0.33

func (e *PFCPEntity) Serve(ctx context.Context, conn *PFCPConn) error

Run the entity with the provided context. Always return a non-nil error and close the PFCPConn.

func (*PFCPEntity) WaitReady added in v0.0.41

func (e *PFCPEntity) WaitReady(ctx context.Context) error

Blocks until the PFCPEntity is ready or context is done

type PFCPEntityCP

type PFCPEntityCP struct {
	PFCPEntity
}

func NewPFCPEntityCP

func NewPFCPEntityCP(nodeID string, listenAddr netip.Addr) *PFCPEntityCP

func NewPFCPEntityCPWithOptions added in v0.0.31

func NewPFCPEntityCPWithOptions(nodeID string, listenAddr netip.Addr, options api.EntityOptionsInterface) *PFCPEntityCP

type PFCPEntityUP

type PFCPEntityUP struct {
	PFCPEntity
}

func NewPFCPEntityUP

func NewPFCPEntityUP(nodeID string, listenAddr netip.Addr) *PFCPEntityUP

func NewPFCPEntityUPWithOptions added in v0.0.31

func NewPFCPEntityUPWithOptions(nodeID string, listenAddr netip.Addr, options api.EntityOptionsInterface) *PFCPEntityUP

type PFCPMessageHandler

type PFCPMessageHandler = func(ctx context.Context, receivedMessage ReceivedMessage) (*OutcomingMessage, error)

type PFCPPeer

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

A PFCPPeer is a remote PFCPEntity

func (*PFCPPeer) Close

func (peer *PFCPPeer) Close() error

Close connection of PFCPPeer

func (*PFCPPeer) IsAlive

func (peer *PFCPPeer) IsAlive() (res bool, err error)

Send an Heartbeat request, return true if the PFCP peer is alive.

func (*PFCPPeer) IsControlPlane

func (peer *PFCPPeer) IsControlPlane() bool

func (*PFCPPeer) IsRunning

func (peer *PFCPPeer) IsRunning() bool

func (*PFCPPeer) IsUserPlane

func (peer *PFCPPeer) IsUserPlane() bool

func (*PFCPPeer) LocalEntity

func (peer *PFCPPeer) LocalEntity() api.PFCPEntityInterface

func (*PFCPPeer) NewEstablishedPFCPAssociation

func (peer *PFCPPeer) NewEstablishedPFCPAssociation() (api.PFCPAssociationInterface, error)

func (*PFCPPeer) NodeID

func (peer *PFCPPeer) NodeID() *ie.IE

func (*PFCPPeer) Send

func (peer *PFCPPeer) Send(msg message.Message) (m message.Message, err error)

Send a PFCP message

type PFCPSession

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

func (*PFCPSession) AddUpdatePDRsFARs

func (s *PFCPSession) AddUpdatePDRsFARs(createpdrs api.PDRMapInterface, createfars api.FARMapInterface, updatepdrs api.PDRMapInterface, updatefars api.FARMapUpdateInterface) error

Add/Update PDRs and FARs to the session

func (*PFCPSession) ForeachUnsortedPDR

func (s *PFCPSession) ForeachUnsortedPDR(f func(pdr api.PDRInterface) error) error

func (*PFCPSession) GetFAR

func (s *PFCPSession) GetFAR(farid api.FARID) (api.FARInterface, error)

Get FAR associated with this FARID

func (*PFCPSession) GetPDR

func (s *PFCPSession) GetPDR(pdrid api.PDRID) (api.PDRInterface, error)

Get PDR associated with this PDRID

func (*PFCPSession) GetSortedPDRIDs

func (s *PFCPSession) GetSortedPDRIDs() []api.PDRID

Returns IDs of PDRs sorted by Precedence For PDI checking, the checking order is: look first at the first item of the array, look last at the last item of the array.

func (*PFCPSession) LocalFSEID

func (s *PFCPSession) LocalFSEID() *ie.IE

Get local F-SEID of this session This value should be used when a session related message is received.

func (*PFCPSession) LocalIPAddress

func (s *PFCPSession) LocalIPAddress() (net.IP, error)

Get IP Address part of local F-SEID This value should be used when a session related message is received.

func (*PFCPSession) LocalSEID

func (s *PFCPSession) LocalSEID() (api.SEID, error)

Get SEID part of local F-SEID This value should be used when a session related message is received.

func (*PFCPSession) RLock

func (s *PFCPSession) RLock()

func (*PFCPSession) RUnlock

func (s *PFCPSession) RUnlock()

func (*PFCPSession) RemoteFSEID

func (s *PFCPSession) RemoteFSEID() *ie.IE

Get remote F-SEID of this session This value should be used when a session related message is send.

func (*PFCPSession) RemoteIPAddress

func (s *PFCPSession) RemoteIPAddress() (net.IP, error)

Get IP Address part of remote F-SEID This value should be used when a session related message is send.

func (*PFCPSession) RemoteSEID

func (s *PFCPSession) RemoteSEID() (api.SEID, error)

Get SEID part of remote F-SEID This value should be used when a session related message is send.

func (*PFCPSession) Setup

func (s *PFCPSession) Setup() error

Setup function, either by: performing the PFCP Session Establishment Procedure (if CP function), or by doing nothing particular (if UP function) since the PFCP Session Establishment Procedure is already performed

type ReceivedMessage

type ReceivedMessage struct {
	message.Message
	SenderAddr net.Addr
	Entity     api.PFCPEntityInterface
}

func (*ReceivedMessage) NewResponse added in v0.0.33

func (receivedMessage *ReceivedMessage) NewResponse(responseMessage message.Message) (*OutcomingMessage, error)

type SessionIDPool

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

SessionIDPool is a generator of session IDs

func NewSessionIDPool

func NewSessionIDPool() *SessionIDPool

Create a SessionIDPool

func (*SessionIDPool) GetNext

func (pool *SessionIDPool) GetNext() api.SEID

Get next id available in SessionIDPool

type SessionsMap

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

func NewSessionsMap

func NewSessionsMap() *SessionsMap

Create a new SessionMap

func (*SessionsMap) Add

func (sm *SessionsMap) Add(session api.PFCPSessionInterface) error

Add a session to the map

func (*SessionsMap) GetPFCPSession

func (sm *SessionsMap) GetPFCPSession(localIP string, seid api.SEID) (api.PFCPSessionInterface, error)

Returns a PFCP Session by its FSEID

func (*SessionsMap) GetPFCPSessions

func (sm *SessionsMap) GetPFCPSessions() []api.PFCPSessionInterface

Returns pfcpsessions in an array

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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