avpdata

package
v1.0.0 Latest Latest
Warning

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

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

README

Diameter Data Types

For details see RFC 6733.

Tests

Run:

go test -v

Benchmarks

Run:

go test -bench .

Documentation

Overview

Diameter data types.

Index

Constants

This section is empty.

Variables

View Source
var AF_INET = []byte{0, 1}

AF_INET represents IPv4 address family.

Functions

This section is empty.

Types

type Address

type Address struct {
	// Address Family (e.g. AF_INET=1)
	// http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml
	Family []byte

	// Parsed IP address
	IP net.IP

	// Padding to 4 octets
	Padding int
}

Address Diameter Type.

func (*Address) Bytes

func (addr *Address) Bytes() []byte

Bytes implement the Codec interface.

func (*Address) Data

func (addr *Address) Data() Generic

Data implements the Generic interface.

func (*Address) Length

func (addr *Address) Length() uint32

Length implements the Codec interface. Returns length without padding.

func (*Address) Put

func (addr *Address) Put(b []byte)

Put implements the Coded interface. It updates internal Family and IP.

func (*Address) String

func (addr *Address) String() string

String returns a human readable version of the AVP.

type DiameterIdentity

type DiameterIdentity struct {
	OctetString
}

DiameterIdentity Diameter Type.

func (*DiameterIdentity) String

func (p *DiameterIdentity) String() string

String returns a human readable version of the AVP.

type DiameterURI

type DiameterURI struct {
	Value string
}

DiameterURI Diameter Type.

func (*DiameterURI) Bytes

func (du *DiameterURI) Bytes() []byte

Bytes implement the Codec interface.

func (*DiameterURI) Data

func (du *DiameterURI) Data() Generic

Data implements the Generic interface.

func (*DiameterURI) Length

func (du *DiameterURI) Length() uint32

Length implements the Codec interface.

func (*DiameterURI) Put

func (du *DiameterURI) Put(b []byte)

Put implements the Codec interface.

func (*DiameterURI) String

func (du *DiameterURI) String() string

String returns a human readable version of the AVP.

type Enumerated

type Enumerated struct {
	Integer32
}

Enumerated Diameter Type

func (*Enumerated) String

func (p *Enumerated) String() string

String returns a human readable version of the AVP.

type Float32

type Float32 struct {
	Value float32
}

Float32 Diameter Type

func (*Float32) Bytes

func (n *Float32) Bytes() []byte

Bytes implement the Codec interface. Bytes are always rewritten from the internal Float32 and stored on Buffer.

func (*Float32) Data

func (n *Float32) Data() Generic

Data implements the Data interface.

func (*Float32) Length

func (n *Float32) Length() uint32

Length implements the Codec interface.

func (*Float32) Put

func (n *Float32) Put(b []byte)

Put implements the Codec interface. It updates internal Buffer and Float32.

func (*Float32) String

func (n *Float32) String() string

String returns a human readable version of the AVP.

type Float64

type Float64 struct {
	Value float64
}

Float64 Diameter Type

func (*Float64) Bytes

func (n *Float64) Bytes() []byte

Bytes implement the Codec interface. Bytes are always rewritten from the internal Float64 and stored on Buffer.

func (*Float64) Data

func (n *Float64) Data() Generic

Data implements the Generic interface.

func (*Float64) Length

func (n *Float64) Length() uint32

Length implements the Codec interface.

func (*Float64) Put

func (n *Float64) Put(b []byte)

Put implements the Codec interface. It updates internal Buffer and Float64.

func (*Float64) String

func (n *Float64) String() string

String returns a human readable version of the AVP.

type Generic

type Generic interface{}

Generic is an interface for AVP Data types.

type IPFilterRule

type IPFilterRule struct {
	OctetString
}

IPFilterRule Diameter Type.

func (*IPFilterRule) String

func (p *IPFilterRule) String() string

String returns a human readable version of the AVP.

type IPv4

type IPv4 struct {
	// Parsed IP address
	IP net.IP
}

IPv4 Type for Framed-IP-Address and alike.

func (*IPv4) Bytes

func (addr *IPv4) Bytes() []byte

Bytes implement the Codec interface.

func (*IPv4) Data

func (addr *IPv4) Data() Generic

Data implements the Generic interface.

func (*IPv4) Length

func (addr *IPv4) Length() uint32

Length implements the Codec interface. Returns length without padding.

func (*IPv4) Put

func (addr *IPv4) Put(b []byte)

Put implements the Coded interface. It updates internal Family and IP.

func (*IPv4) String

func (addr *IPv4) String() string

String returns a human readable version of the AVP.

type Integer32

type Integer32 struct {
	Value int32
}

Integer32 Diameter Type

func (*Integer32) Bytes

func (n *Integer32) Bytes() []byte

Bytes implement the Codec interface. Bytes are always rewritten from the internal Int32 and stored on Buffer.

func (Integer32) Data

func (n Integer32) Data() Generic

Data implements the Generic interface.

func (*Integer32) Length

func (n *Integer32) Length() uint32

Length implements the Codec interface.

func (*Integer32) Put

func (n *Integer32) Put(b []byte)

Put implements the Codec interface. It updates internal Buffer and Int32.

func (*Integer32) String

func (n *Integer32) String() string

String returns a human readable version of the AVP.

type Integer64

type Integer64 struct {
	Value int64
}

Integer64 Diameter Type

func (*Integer64) Bytes

func (n *Integer64) Bytes() []byte

Bytes implement the Codec interface. Bytes are always rewritten from the internal Int64 and stored on Buffer.

func (*Integer64) Data

func (n *Integer64) Data() Generic

Data implements the Generic interface.

func (*Integer64) Length

func (n *Integer64) Length() uint32

Length implements the Codec interface.

func (*Integer64) Put

func (n *Integer64) Put(b []byte)

Put implements the Codec interface. It updates internal Buffer and Int64.

func (*Integer64) String

func (n *Integer64) String() string

String returns a human readable version of the AVP.

type OctetString

type OctetString struct {
	Value   string
	Padding uint32 // Extra bytes to make the Value a multiple of 4 octets
}

OctetString Diameter Type.

func (*OctetString) Bytes

func (os *OctetString) Bytes() []byte

Bytes implement the Codec interface. Padding is always recalculated from the internal Value.

func (*OctetString) Data

func (os *OctetString) Data() Generic

Data implements the Generic interface.

func (*OctetString) Length

func (os *OctetString) Length() uint32

Length implements the Codec interface. Returns length without padding.

func (*OctetString) Put

func (os *OctetString) Put(b []byte)

Put implements the Codec interface. It updates internal Value and Padding.

func (*OctetString) String

func (os *OctetString) String() string

String returns a human readable version of the AVP.

type Time

type Time struct {
	Value time.Time
}

Time Diameter Type.

func (*Time) Bytes

func (t *Time) Bytes() []byte

Bytes implement the Codec interface.

func (*Time) Data

func (t *Time) Data() Generic

Data implements the Generic interface.

func (*Time) Length

func (t *Time) Length() uint32

Length implements the Codec interface. Returns length without padding.

func (*Time) Put

func (t *Time) Put(b []byte)

Put implements the Codec interface. It updates internal Value.

func (*Time) String

func (t *Time) String() string

String returns a human readable version of the AVP.

type UTF8String

type UTF8String struct {
	OctetString
}

UTF8String Diameter Type.

func (*UTF8String) String

func (p *UTF8String) String() string

String returns a human readable version of the AVP.

type Unsigned32

type Unsigned32 struct {
	Value uint32
}

Unsigned32 Diameter Type

func (*Unsigned32) Bytes

func (n *Unsigned32) Bytes() []byte

Bytes implement the Codec interface. Bytes are always rewritten from the internal Uint32 and stored on Buffer.

func (*Unsigned32) Data

func (n *Unsigned32) Data() Generic

Data implements the Generic interface.

func (*Unsigned32) Length

func (n *Unsigned32) Length() uint32

Length implements the Codec interface.

func (*Unsigned32) Put

func (n *Unsigned32) Put(b []byte)

Put implements the Codec interface. It updates internal Buffer and Uint32.

func (*Unsigned32) String

func (n *Unsigned32) String() string

String returns a human readable version of the AVP.

type Unsigned64

type Unsigned64 struct {
	Value uint64
}

Unsigned64 Diameter Type

func (*Unsigned64) Bytes

func (n *Unsigned64) Bytes() []byte

Bytes implement the Codec interface. Bytes are always rewritten from the internal Uint64 and stored on Buffer.

func (*Unsigned64) Data

func (n *Unsigned64) Data() Generic

Data implements the Generic interface.

func (*Unsigned64) Length

func (n *Unsigned64) Length() uint32

Length implements the Codec interface.

func (*Unsigned64) Put

func (n *Unsigned64) Put(b []byte)

Put implements the Codec interface. It updates internal Buffer and Uint64.

func (*Unsigned64) String

func (n *Unsigned64) String() string

String returns a human readable version of the AVP.

Jump to

Keyboard shortcuts

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