gtp5gnl

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 7 Imported by: 0

README

go-gtp5gnl

go-gtp5gnl provides a netlink library about gtp5g for Go.

License

This software is released under the MIT License, see LICENSE

Documentation

Index

Constants

View Source
const (
	LINK = iota + 1
	NET_NS_FD
)
View Source
const (
	FAR_ID = iota + 3
	FAR_APPLY_ACTION
	FAR_FORWARDING_PARAMETER
	FAR_RELATED_TO_PDR
)
View Source
const (
	FORWARDING_PARAMETER_OUTER_HEADER_CREATION = iota + 1
	FORWARDING_PARAMETER_FORWARDING_POLICY
)
View Source
const (
	OUTER_HEADER_CREATION_DESCRIPTION = iota + 1
	OUTER_HEADER_CREATION_O_TEID
	OUTER_HEADER_CREATION_PEER_ADDR_IPV4
	OUTER_HEADER_CREATION_PORT
)
View Source
const (
	PDR_ID = iota + 3
	PDR_PRECEDENCE
	PDR_PDI
	PDR_OUTER_HEADER_REMOVAL
	PDR_FAR_ID
	PDR_ROLE_ADDR_IPV4
	PDR_UNIX_SOCKET_PATH
	PDR_QER_ID
)
View Source
const (
	PDI_UE_ADDR_IPV4 = iota + 1
	PDI_F_TEID
	PDI_SDF_FILTER
)
View Source
const (
	F_TEID_I_TEID = iota + 1
	F_TEID_GTPU_ADDR_IPV4
)
View Source
const (
	SDF_FILTER_FLOW_DESCRIPTION = iota + 1
	SDF_FILTER_TOS_TRAFFIC_CLASS
	SDF_FILTER_SECURITY_PARAMETER_INDEX
	SDF_FILTER_FLOW_LABEL
	SDF_FILTER_SDF_FILTER_ID
)
View Source
const (
	FLOW_DESCRIPTION_ACTION = iota + 1
	FLOW_DESCRIPTION_DIRECTION
	FLOW_DESCRIPTION_PROTOCOL
	FLOW_DESCRIPTION_SRC_IPV4
	FLOW_DESCRIPTION_SRC_MASK
	FLOW_DESCRIPTION_DEST_IPV4
	FLOW_DESCRIPTION_DEST_MASK
	FLOW_DESCRIPTION_SRC_PORT
	FLOW_DESCRIPTION_DEST_PORT
)
View Source
const (
	SDF_FILTER_ACTION_UNSPEC = iota
	SDF_FILTER_PERMIT
)
View Source
const (
	SDF_FILTER_DIRECTION_UNSPEC = iota
	SDF_FILTER_IN
	SDF_FILTER_OUT
)
View Source
const (
	QER_ID = iota + 3
	QER_GATE
	QER_MBR
	QER_GBR
	QER_CORR_ID
	QER_RQI
	QER_QFI
	QER_PPI
	QER_RCSR // deplicated
	QER_RELATED_TO_PDR
)
View Source
const (
	QER_MBR_UL_HIGH32 = iota + 1
	QER_MBR_UL_LOW8
	QER_MBR_DL_HIGH32
	QER_MBR_DL_LOW8
)
View Source
const (
	QER_GBR_UL_HIGH32 = iota + 1
	QER_GBR_UL_LOW8
	QER_GBR_DL_HIGH32
	QER_GBR_DL_LOW8
)
View Source
const (
	CMD_UNSPEC = iota

	CMD_ADD_PDR
	CMD_ADD_FAR
	CMD_ADD_QER

	CMD_DEL_PDR
	CMD_DEL_FAR
	CMD_DEL_QER

	CMD_GET_PDR
	CMD_GET_FAR
	CMD_GET_QER
)
View Source
const (
	IFLA_UNSPEC = iota
	IFLA_FD1
	IFLA_HASHSIZE
	IFLA_ROLE
)
View Source
const (
	ATTR_MAX = 0x10
)

Variables

This section is empty.

Functions

func CreateFAR

func CreateFAR(c *Client, link *Link, farid int, attrs []nl.Attr) error

m LINK: ifindex m FAR_ID: u32 m FAR_APPLY_ACTION: u8 m FAR_FORWARDING_PARAMETER {

m   FORWARDING_PARAMETER_OUTER_HEADER_CREATION {
      OUTER_HEADER_CREATION_DESCRIPTION: u16
      OUTER_HEADER_CREATION_O_TEID: u32
      OUTER_HEADER_CREATION_PEER_ADDR_IPV4: [4]byte IP
      OUTER_HEADER_CREATION_PORT: u16
    }

o FORWARDING_PARAMETER_FORWARDING_POLICY: string

}

func CreatePDR

func CreatePDR(c *Client, link *Link, pdrid int, attrs []nl.Attr) error

m LINK: ifindex m PDR_ID: u16 o PDR_PRECEDENCE: u32 o PDR_OUTER_HEADER_REMOVAL: u8 o PDR_FAR_ID: u32 o PDR_QER_ID: u32 o PDR_PDI { o PDI_UE_ADDR_IPV4: u32

o   PDI_F_TEID {
      F_TEID_I_TEID: u32
      F_TEID_GTPU_ADDR_IPV4: u32
    }
o   PDI_SDF_FILTER {
    }
  }

func CreateQER

func CreateQER(c *Client, link *Link, qerid int, attrs []nl.Attr) error

m QER_ID: u32 o QER_GATE: u8 o QER_MBR { m QER_MBR_UL_HIGH32: u32 m QER_MBR_UL_LOW8: u8 m QER_MBR_DL_HIGH32: u32 m QER_MBR_DL_LOW8: u8

}

o QER_GBR { m QER_GBR_UL_HIGH32: u32 m QER_GBR_UL_LOW8: u8 m QER_GBR_DL_HIGH32: u32 m QER_GBR_DL_LOW8: u8

}

o QER_CORR_ID: u32 o QER_RQI: u8 o QER_QFI: u8 o QER_PPI: u8

func NativeEndian

func NativeEndian() binary.ByteOrder

func RemoveFAR

func RemoveFAR(c *Client, link *Link, farid int) error

func RemovePDR

func RemovePDR(c *Client, link *Link, pdrid int) error

func RemoveQER

func RemoveQER(c *Client, link *Link, qerid int) error

func UpdateFAR

func UpdateFAR(c *Client, link *Link, farid int, attrs []nl.Attr) error

func UpdatePDR

func UpdatePDR(c *Client, link *Link, pdrid int, attrs []nl.Attr) error

func UpdateQER

func UpdateQER(c *Client, link *Link, qerid int, attrs []nl.Attr) error

Types

type Client

type Client struct {
	Client *nl.Client
	ID     int
}

func NewClient

func NewClient(conn *nl.Conn, mux *nl.Mux) (*Client, error)

func (*Client) Do

func (c *Client) Do(req *nl.Request) ([]nl.Msg, error)

type FAR

type FAR struct {
	ID     uint32
	Action uint8
	Param  *ForwardParam
	PDRIDs []uint16
}

func DecodeFAR

func DecodeFAR(b []byte) (*FAR, error)

func GetFAR

func GetFAR(c *Client, link *Link, farid int) (*FAR, error)

func GetFARAll

func GetFARAll(c *Client) ([]FAR, error)

type FTEID

type FTEID struct {
	TEID     uint32
	GTPuAddr net.IP
}

func DecodeFTEID

func DecodeFTEID(b []byte) (FTEID, error)

type FlowDesc

type FlowDesc struct {
	Action   uint8
	Dir      uint8
	Proto    uint8
	Src      net.IPNet
	Dst      net.IPNet
	SrcPorts []uint32
	DstPorts []uint32
}

func DecodeFlowDesc

func DecodeFlowDesc(b []byte) (FlowDesc, error)

type ForwardParam

type ForwardParam struct {
	Creation *HeaderCreation
	Policy   *string
}

func DecodeForwardParam

func DecodeForwardParam(b []byte) (ForwardParam, error)

type GBR

type GBR struct {
	ULHigh uint32
	ULLow  uint8
	DLHigh uint32
	DLLow  uint8
}

func DecodeGBR

func DecodeGBR(b []byte) (GBR, error)

type HeaderCreation

type HeaderCreation struct {
	Desc     uint16
	TEID     uint32
	PeerAddr net.IP
	Port     uint16
}

func DecodeHeaderCreation

func DecodeHeaderCreation(b []byte) (HeaderCreation, error)
type Link struct {
	Name  string
	Index int
}
func GetLink(name string) (*Link, error)

type MBR

type MBR struct {
	ULHigh uint32
	ULLow  uint8
	DLHigh uint32
	DLLow  uint8
}

func DecodeMBR

func DecodeMBR(b []byte) (MBR, error)

type PDI

type PDI struct {
	UEAddr net.IP
	FTEID  *FTEID
	SDF    *SDFFilter
}

func DecodePDI

func DecodePDI(b []byte) (PDI, error)

type PDR

type PDR struct {
	ID              uint16
	Precedence      *uint32
	PDI             *PDI
	OuterHdrRemoval *uint8
	FARID           *uint32
	QERID           *uint32
}

func DecodePDR

func DecodePDR(b []byte) (*PDR, error)

func GetPDR

func GetPDR(c *Client, link *Link, pdrid int) (*PDR, error)

func GetPDRAll

func GetPDRAll(c *Client) ([]PDR, error)

type QER

type QER struct {
	ID     uint32
	Gate   uint8
	MBR    MBR
	GBR    GBR
	CorrID uint32
	RQI    uint8
	QFI    uint8
	PPI    uint8
	PDRIDs []uint16
}

func DecodeQER

func DecodeQER(b []byte) (*QER, error)

func GetQER

func GetQER(c *Client, link *Link, qerid int) (*QER, error)

func GetQERAll

func GetQERAll(c *Client) ([]QER, error)

type SDFFilter

type SDFFilter struct {
	FD  *FlowDesc
	TTC *uint16
	SPI *uint32
	FL  *uint32
	BID *uint32
}

func DecodeSDFFilter

func DecodeSDFFilter(b []byte) (SDFFilter, error)

Jump to

Keyboard shortcuts

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