wmnsk / go-pfcp

PFCP (Packet Forwarding Control Protocol) in pure Go.
MIT License
125 stars 56 forks source link

Add `AllIEs()` method on `Message` interface to retrieve all the IEs #126

Closed wmnsk closed 1 year ago

wmnsk commented 1 year ago

It can possibly be useful if the IEs can be retrieved all at once regardless of the message type (without asserting by the message type). The example implementation for AssociationSetupRequest would be like this.

func (m *AssociationSetupRequest) AllIEs() []*ie.IE {
    ies := []*ie.IE{
        m.NodeID,
        m.RecoveryTimeStamp,
        m.UPFunctionFeatures,
        m.CPFunctionFeatures,
        m.SMFSetID,
        m.PFCPSessionRetentionInformation,
        m.PFCPASReqFlags,
    }

    ies = append(ies, m.UserPlaneIPResourceInformation...)
    ies = append(ies, m.AlternativeSMFIPAddress...)
    ies = append(ies, m.UEIPAddressPoolInformation...)
    ies = append(ies, m.GTPUPathQoSControlInformation...)
    ies = append(ies, m.ClockDriftControlInformation...)
    ies = append(ies, m.IEs...)

    return ies
}

*Maybe the inefficient append can be avoided, as the length of returned slice (=number of IEs) can be determined beforehand.

wmnsk commented 1 year ago

Doesn't seem to be very useful