Documentation
¶
Overview ¶
Package utils provides some utilities which might be useful specifically for GTP(or other telco protocols).
Index ¶
- func DecodeFQDN(b []byte) string
- func DecodeMCC(b []byte) string
- func DecodeMNC(b []byte) string
- func DecodePLMN(b []byte) (mcc, mnc string, err error)
- func EncodeFQDN(fqdn string) []byte
- func EncodePLMN(mcc, mnc string) ([]byte, error)
- func ParseECI(eci uint32) (enbID uint32, cellID uint8, err error)
- func StrToSwappedBytes(s, filler string) ([]byte, error)
- func SwappedBytesToStr(raw []byte, cutLastDigit bool) string
- func Uint24To32(b []byte) uint32
- func Uint32To24(n uint32) []byte
- func Uint40To64(b []byte) uint64
- func Uint64To40(n uint64) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeFQDN ¶ added in v0.8.9
DecodeFQDN decodes the given Name Syntax-encoded []byte as a string.
func DecodePLMN ¶
DecodePLMN decodes BCD-encoded bytes into MCC and MNC.
func EncodeFQDN ¶ added in v0.8.9
EncodeFQDN encodes the given string as the Name Syntax defined in RFC 2181, RFC 1035 and RFC 1123.
func EncodePLMN ¶
EncodePLMN encodes MCC and MNC as BCD-encoded bytes.
func StrToSwappedBytes ¶
StrToSwappedBytes returns swapped bits from a byte. It is used for some values where some values are represented in swapped format.
The second parameter is the hex character(0-f) to fill the last digit when handling a odd number. "f" is used In most cases.
func SwappedBytesToStr ¶
SwappedBytesToStr decodes raw swapped bytes into string. It is used for some values where some values are represented in swapped format.
The second parameter is to decide whether to cut the last digit or not.
func Uint24To32 ¶
Uint24To32 converts 24bits-length []byte value into the uint32 with 8bits of zeros as prefix. This function is used for the fields with 3 octets.
func Uint32To24 ¶
Uint32To24 converts the uint32 value into 24bits-length []byte. The values in 25-32 bit are cut off. This function is used for the fields with 3 octets.
func Uint40To64 ¶
Uint40To64 converts 40bits-length []byte value into the uint64 with 8bits of zeros as prefix. This function is used for the fields with 3 octets.
func Uint64To40 ¶
Uint64To40 converts the uint64 value into 40bits-length []byte. The values in 25-64 bit are cut off. This function is used for the fields with 3 octets.
Types ¶
This section is empty.