format

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2014 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Diameter AVP data formats.

Index

Constants

This section is empty.

Variables

View Source
var Available = map[string]FormatId{
	"Address":          AddressFormat,
	"DiameterIdentity": DiameterIdentityFormat,
	"DiameterURI":      DiameterURIFormat,
	"Enumerated":       EnumeratedFormat,
	"Float32":          Float32Format,
	"Float64":          Float64Format,
	"Grouped":          GroupedFormat,
	"IPFilterRule":     IPFilterRuleFormat,
	"IPv4":             IPv4Format,
	"Integer32":        Integer32Format,
	"Integer64":        Integer64Format,
	"OctetString":      OctetStringFormat,
	"Time":             TimeFormat,
	"UTF8String":       UTF8StringFormat,
	"Unsigned32":       Unsigned32Format,
	"Unsigned64":       Unsigned64Format,
}
View Source
var Decoder = map[FormatId]DecoderFunc{
	AddressFormat:          DecodeAddress,
	DiameterIdentityFormat: DecodeDiameterIdentity,
	DiameterURIFormat:      DecodeDiameterURI,
	EnumeratedFormat:       DecodeEnumerated,
	Float32Format:          DecodeFloat32,
	Float64Format:          DecodeFloat64,
	GroupedFormat:          DecodeGrouped,
	IPFilterRuleFormat:     DecodeIPFilterRule,
	IPv4Format:             DecodeIPv4,
	Integer32Format:        DecodeInteger32,
	Integer64Format:        DecodeInteger64,
	OctetStringFormat:      DecodeOctetString,
	TimeFormat:             DecodeTime,
	UTF8StringFormat:       DecodeUTF8String,
	Unsigned32Format:       DecodeUnsigned32,
	Unsigned64Format:       DecodeUnsigned64,
}

Functions

This section is empty.

Types

type Address

type Address net.IP

Address Diameter Format.

func (Address) Format

func (addr Address) Format() FormatId

func (Address) Len

func (addr Address) Len() int

func (Address) Padding

func (addr Address) Padding() int

func (Address) Serialize

func (addr Address) Serialize() []byte

Serialize returns the byte representation of the Diameter Address. Example:

ip := net.IP(addr.Serialize())

func (Address) String

func (addr Address) String() string

type DecoderFunc

type DecoderFunc func([]byte) (Format, error)

type DiameterIdentity

type DiameterIdentity OctetString

DiameterIdentity Diameter Format.

func (DiameterIdentity) Format

func (s DiameterIdentity) Format() FormatId

func (DiameterIdentity) Len

func (s DiameterIdentity) Len() int

func (DiameterIdentity) Padding

func (s DiameterIdentity) Padding() int

func (DiameterIdentity) Serialize

func (s DiameterIdentity) Serialize() []byte

func (DiameterIdentity) String

func (s DiameterIdentity) String() string

type DiameterURI

type DiameterURI OctetString

DiameterURI Diameter Format.

func (DiameterURI) Format

func (s DiameterURI) Format() FormatId

func (DiameterURI) Len

func (s DiameterURI) Len() int

func (DiameterURI) Padding

func (s DiameterURI) Padding() int

func (DiameterURI) Serialize

func (s DiameterURI) Serialize() []byte

func (DiameterURI) String

func (s DiameterURI) String() string

type Enumerated

type Enumerated Integer32

Enumerated Diameter Format

func (Enumerated) Format

func (n Enumerated) Format() FormatId

func (Enumerated) Len

func (n Enumerated) Len() int

func (Enumerated) Padding

func (n Enumerated) Padding() int

func (Enumerated) Serialize

func (n Enumerated) Serialize() []byte

func (Enumerated) String

func (n Enumerated) String() string

type Float32

type Float32 float32

Float32 Diameter Format

func (Float32) Format

func (n Float32) Format() FormatId

func (Float32) Len

func (n Float32) Len() int

func (Float32) Padding

func (n Float32) Padding() int

func (Float32) Serialize

func (n Float32) Serialize() []byte

func (Float32) String

func (n Float32) String() string

type Float64

type Float64 float64

Float64 Diameter Format

func (Float64) Format

func (n Float64) Format() FormatId

func (Float64) Len

func (n Float64) Len() int

func (Float64) Padding

func (n Float64) Padding() int

func (Float64) Serialize

func (n Float64) Serialize() []byte

func (Float64) String

func (n Float64) String() string

type Format

type Format interface {
	Serialize() []byte
	Len() int
	Padding() int
	Format() FormatId
	String() string
}

Format is an interface for supporting multiple AVP data formats.

func Decode

func Decode(Format FormatId, b []byte) (Format, error)

func DecodeAddress

func DecodeAddress(b []byte) (Format, error)

DecodeAddress decodes the byte representation of a Diameter Address. Example:

b := Address(net.ParseIP("10.0.0.1"))

func DecodeDiameterIdentity

func DecodeDiameterIdentity(b []byte) (Format, error)

func DecodeDiameterURI

func DecodeDiameterURI(b []byte) (Format, error)

func DecodeEnumerated

func DecodeEnumerated(b []byte) (Format, error)

func DecodeFloat32

func DecodeFloat32(b []byte) (Format, error)

func DecodeFloat64

func DecodeFloat64(b []byte) (Format, error)

func DecodeGrouped

func DecodeGrouped(b []byte) (Format, error)

func DecodeIPFilterRule

func DecodeIPFilterRule(b []byte) (Format, error)

func DecodeIPv4

func DecodeIPv4(b []byte) (Format, error)

func DecodeInteger32

func DecodeInteger32(b []byte) (Format, error)

func DecodeInteger64

func DecodeInteger64(b []byte) (Format, error)

func DecodeOctetString

func DecodeOctetString(b []byte) (Format, error)

func DecodeTime

func DecodeTime(b []byte) (Format, error)

func DecodeUTF8String

func DecodeUTF8String(b []byte) (Format, error)

func DecodeUnsigned32

func DecodeUnsigned32(b []byte) (Format, error)

func DecodeUnsigned64

func DecodeUnsigned64(b []byte) (Format, error)

type FormatId

type FormatId int
const (
	UnknownFormat FormatId = iota
	AddressFormat
	DiameterIdentityFormat
	DiameterURIFormat
	EnumeratedFormat
	Float32Format
	Float64Format
	GroupedFormat
	IPFilterRuleFormat
	IPv4Format
	Integer32Format
	Integer64Format
	OctetStringFormat
	TimeFormat
	UTF8StringFormat
	Unsigned32Format
	Unsigned64Format
)

type Grouped

type Grouped []byte

Grouped Diameter Format

func (Grouped) Format

func (g Grouped) Format() FormatId

func (Grouped) Len

func (g Grouped) Len() int

func (Grouped) Padding

func (g Grouped) Padding() int

func (Grouped) Serialize

func (g Grouped) Serialize() []byte

func (Grouped) String

func (g Grouped) String() string

type IPFilterRule

type IPFilterRule OctetString

IPFilterRule Diameter Format.

func (IPFilterRule) Format

func (s IPFilterRule) Format() FormatId

func (IPFilterRule) Len

func (s IPFilterRule) Len() int

func (IPFilterRule) Padding

func (s IPFilterRule) Padding() int

func (IPFilterRule) Serialize

func (s IPFilterRule) Serialize() []byte

func (IPFilterRule) String

func (s IPFilterRule) String() string

type IPv4

type IPv4 net.IP

IPv4 Diameter Format for Framed-IP-Address AVP.

func (IPv4) Format

func (ip IPv4) Format() FormatId

func (IPv4) Len

func (ip IPv4) Len() int

func (IPv4) Padding

func (ip IPv4) Padding() int

func (IPv4) Serialize

func (ip IPv4) Serialize() []byte

func (IPv4) String

func (ip IPv4) String() string

type Integer32

type Integer32 int32

Integer32 Diameter Format

func (Integer32) Format

func (n Integer32) Format() FormatId

func (Integer32) Len

func (n Integer32) Len() int

func (Integer32) Padding

func (n Integer32) Padding() int

func (Integer32) Serialize

func (n Integer32) Serialize() []byte

func (Integer32) String

func (n Integer32) String() string

type Integer64

type Integer64 int64

Integer64 Diameter Format

func (Integer64) Format

func (n Integer64) Format() FormatId

func (Integer64) Len

func (n Integer64) Len() int

func (Integer64) Padding

func (n Integer64) Padding() int

func (Integer64) Serialize

func (n Integer64) Serialize() []byte

func (Integer64) String

func (n Integer64) String() string

type OctetString

type OctetString string

OctetString Diameter Format.

func (OctetString) Format

func (s OctetString) Format() FormatId

func (OctetString) Len

func (s OctetString) Len() int

func (OctetString) Padding

func (s OctetString) Padding() int

func (OctetString) Serialize

func (s OctetString) Serialize() []byte

func (OctetString) String

func (s OctetString) String() string

type Time

type Time time.Time

Time Diameter Format.

func (Time) Format

func (t Time) Format() FormatId

func (Time) Len

func (t Time) Len() int

func (Time) Padding

func (t Time) Padding() int

func (Time) Serialize

func (t Time) Serialize() []byte

func (Time) String

func (t Time) String() string

type UTF8String

type UTF8String OctetString

UTF8String Diameter Format.

func (UTF8String) Format

func (s UTF8String) Format() FormatId

func (UTF8String) Len

func (s UTF8String) Len() int

func (UTF8String) Padding

func (s UTF8String) Padding() int

func (UTF8String) Serialize

func (s UTF8String) Serialize() []byte

func (UTF8String) String

func (s UTF8String) String() string

type Unsigned32

type Unsigned32 uint32

Unsigned32 Diameter Format

func (Unsigned32) Format

func (n Unsigned32) Format() FormatId

func (Unsigned32) Len

func (n Unsigned32) Len() int

func (Unsigned32) Padding

func (n Unsigned32) Padding() int

func (Unsigned32) Serialize

func (n Unsigned32) Serialize() []byte

func (Unsigned32) String

func (n Unsigned32) String() string

type Unsigned64

type Unsigned64 uint64

Unsigned64 Diameter Format

func (Unsigned64) Format

func (n Unsigned64) Format() FormatId

func (Unsigned64) Len

func (n Unsigned64) Len() int

func (Unsigned64) Padding

func (n Unsigned64) Padding() int

func (Unsigned64) Serialize

func (n Unsigned64) Serialize() []byte

func (Unsigned64) String

func (n Unsigned64) String() string

Jump to

Keyboard shortcuts

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