session

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const GTPU_PORT = 2152

Variables

View Source
var (
	ErrNilCtx = errors.New("nil context")

	ErrUnsupportedPDUType      = errors.New("Unsupported PDU type")
	ErrPduSessionNotFound      = errors.New("PDU Session not found")
	ErrForwardDownlinkNotFound = errors.New("Forward Downlink rule not found")
)

Functions

This section is empty.

Types

type Fteid

type Fteid struct {
	IpAddr netip.Addr
	Teid   uint32
}

type PduSessions

type PduSessions struct {
	PduSessionsMap sync.Map // key : UE 5G ip address; value: UE Control URI
	UserAgent      string
	Client         http.Client
	Control        jsonapi.ControlURI
	Cp             jsonapi.ControlURI
	GnbGtp         netip.Addr
	// contains filtered or unexported fields
}

func NewPduSessions

func NewPduSessions(control jsonapi.ControlURI, cp jsonapi.ControlURI, manager *PduSessionsManager, userAgent string, gnbGtp netip.Addr) *PduSessions

func (*PduSessions) Context

func (p *PduSessions) Context() context.Context

func (*PduSessions) EstablishmentRequest

func (p *PduSessions) EstablishmentRequest(c *gin.Context)

request from UE

func (*PduSessions) HandleEstablishmentRequest

func (p *PduSessions) HandleEstablishmentRequest(ps n1n2.PduSessionEstabReqMsg)

func (*PduSessions) HandleHandoverCommand

func (s *PduSessions) HandleHandoverCommand(ps n1n2.HandoverCommand)

Handover Command is send to the source gNB by the Control Plane. Upon receiving an Handover Command, the source gNB configure temporary forwarding of DL traffic, and forward the Handover Command to the UE. PDU Session (including the forwarding of DL traffic) is removed with a timer.

func (*PduSessions) HandleHandoverConfirm

func (s *PduSessions) HandleHandoverConfirm(ps n1n2.HandoverConfirm)

Handover Confirm is send by the UE to the target gNB. Upon receiving Handover Confirm, the target gNB send a Handover Notify to the Control Plane.

func (*PduSessions) HandleHandoverRequest

func (s *PduSessions) HandleHandoverRequest(ps n1n2.HandoverRequest)

Handover Request is send to the target gNB by the Control Plane. Upon receiving an Handover Request, the target gNB must allocate DL FTEID, and send it within an Handover Request Ack to the Control Plane. UL FTEID is included in Handover Request and the session can is pre-configured to be ready to be used as soon as Handover Notify is received

func (*PduSessions) HandleN2EstablishmentRequest

func (p *PduSessions) HandleN2EstablishmentRequest(ps n1n2.N2PduSessionReqMsg)

func (*PduSessions) HandoverCommand

func (s *PduSessions) HandoverCommand(c *gin.Context)

func (*PduSessions) HandoverConfirm

func (s *PduSessions) HandoverConfirm(c *gin.Context)

func (*PduSessions) HandoverRequest

func (s *PduSessions) HandoverRequest(c *gin.Context)

func (*PduSessions) Init

func (p *PduSessions) Init(ctx context.Context) error

func (*PduSessions) N2EstablishmentRequest

func (p *PduSessions) N2EstablishmentRequest(c *gin.Context)

request from CP

func (*PduSessions) Register

func (p *PduSessions) Register(e *gin.Engine)

type PduSessionsManager

type PduSessionsManager struct {
	sync.Mutex

	Downlink        map[uint32]jsonapi.ControlURI // teid: UE control uri
	ForwardDownlink map[uint32]*jsonapi.Fteid
	Uplink          map[netip.Addr]*jsonapi.Fteid // ue 5G ip address: uplink fteid
	GtpAddr         netip.Addr
	// contains filtered or unexported fields
}

func NewPduSessionsManager

func NewPduSessionsManager(gtpAddr netip.Addr) *PduSessionsManager
func (p *PduSessionsManager) ForwardUplink(ctx context.Context, pkt []byte, fteid *jsonapi.Fteid) error

func (*PduSessionsManager) GetForwarding

func (p *PduSessionsManager) GetForwarding(teid uint32) (*jsonapi.Fteid, error)

func (*PduSessionsManager) GetUECtrl

func (p *PduSessionsManager) GetUECtrl(teid uint32) (jsonapi.ControlURI, error)

func (*PduSessionsManager) NewPduSession

func (p *PduSessionsManager) NewPduSession(ctx context.Context, ueIpAddr netip.Addr, ueControlURI jsonapi.ControlURI, uplinkFteid *jsonapi.Fteid) (*jsonapi.Fteid, error)

Returns the new DL TEID allocated

func (p *PduSessionsManager) WriteUplink(ctx context.Context, pkt []byte) error

Jump to

Keyboard shortcuts

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