zebra

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEADER_MARKER     = 255
	FRR_HEADER_MARKER = 254
	INTERFACE_NAMSIZ  = 20
)
View Source
const (
	MinZapiVer uint8 = 2
	MaxZapiVer uint8 = 6
)
View Source
const MAXPATH_NUM = 64
View Source
const MPLS_MAX_LABEL = 16
View Source
const VRF_DEFAULT = 0

Variables

This section is empty.

Functions

func ChannelClose

func ChannelClose(ch chan *Message) bool

for avoiding double close

func HeaderSize

func HeaderSize(version uint8) uint16

Types

type AFI

type AFI uint8

Address Family Identifier.

const (
	AFI_IP    AFI = 1
	AFI_IP6   AFI = 2
	AFI_ETHER AFI = 3
	AFI_MAX   AFI = 4
)

func (AFI) String

func (i AFI) String() string

type API_TYPE

type API_TYPE uint16

API Types.

const (
	FRR_ZAPI6_INTERFACE_ADD API_TYPE = iota
	FRR_ZAPI6_INTERFACE_DELETE
	FRR_ZAPI6_INTERFACE_ADDRESS_ADD
	FRR_ZAPI6_INTERFACE_ADDRESS_DELETE
	FRR_ZAPI6_INTERFACE_UP
	FRR_ZAPI6_INTERFACE_DOWN
	FRR_ZAPI6_INTERFACE_SET_MASTER
	FRR_ZAPI6_ROUTE_ADD
	FRR_ZAPI6_ROUTE_DELETE
	FRR_ZAPI6_ROUTE_NOTIFY_OWNER
	FRR_ZAPI6_REDISTRIBUTE_ADD
	FRR_ZAPI6_REDISTRIBUTE_DELETE
	FRR_ZAPI6_REDISTRIBUTE_DEFAULT_ADD
	FRR_ZAPI6_REDISTRIBUTE_DEFAULT_DELETE
	FRR_ZAPI6_ROUTER_ID_ADD
	FRR_ZAPI6_ROUTER_ID_DELETE
	FRR_ZAPI6_ROUTER_ID_UPDATE
	FRR_ZAPI6_HELLO
	FRR_ZAPI6_CAPABILITIES
	FRR_ZAPI6_NEXTHOP_REGISTER
	FRR_ZAPI6_NEXT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RULE_NOTIFY_OWNER
	FRR_ZAPI5_TABLE_MANAGER_CONNECT
	FRR_ZAPI5_GET_TABLE_CHUNK
	FRR_ZAPI5_RELEASE_TABLE_CHUNK
	FRR_ZAPI5_IPSET_CREATE
	FRR_ZAPI5_IPSET_DESTROY
	FRR_ZAPI5_IPSET_ENTRY_ADD
	FRR_ZAPI5_IPSET_ENTRY_DELETE
	FRR_ZAPI5_IPSET_NOTIFY_OWNER
	FRR_ZAPI5_IPSET_ENTRY_NOTIFY_OWNER
	FRR_ZAPI5_IPTABLE_ADD
	FRR_ZAPI5_IPTABLE_DELETE
	FRR_ZAPI5_IPTABLE_NOTIFY_OWNER
)

For FRRouting version 4 and 5. (ZAPI version 5)

const (
	FRR_INTERFACE_ADD API_TYPE = iota
	FRR_INTERFACE_DELETE
	FRR_INTERFACE_ADDRESS_ADD
	FRR_INTERFACE_ADDRESS_DELETE
	FRR_INTERFACE_UP
	FRR_INTERFACE_DOWN
	FRR_IPV4_ROUTE_ADD
	FRR_IPV4_ROUTE_DELETE
	FRR_IPV6_ROUTE_ADD
	FRR_IPV6_ROUTE_DELETE
	FRR_REDISTRIBUTE_ADD
	FRR_REDISTRIBUTE_DELETE
	FRR_REDISTRIBUTE_DEFAULT_ADD
	FRR_REDISTRIBUTE_DEFAULT_DELETE
	FRR_ROUTER_ID_ADD
	FRR_ROUTER_ID_DELETE
	FRR_ROUTER_ID_UPDATE
	FRR_HELLO
	FRR_NEXTHOP_REGISTER
	FRR_NEXTHOP_UNREGISTER
	FRR_NEXTHOP_UPDATE
	FRR_INTERFACE_NBR_ADDRESS_ADD
	FRR_INTERFACE_NBR_ADDRESS_DELETE
	FRR_INTERFACE_BFD_DEST_UPDATE
	FRR_IMPORT_ROUTE_REGISTER
	FRR_IMPORT_ROUTE_UNREGISTER
	FRR_IMPORT_CHECK_UPDATE
	FRR_IPV4_ROUTE_IPV6_NEXTHOP_ADD
	FRR_BFD_DEST_REGISTER
	FRR_BFD_DEST_DEREGISTER
	FRR_BFD_DEST_UPDATE
	FRR_BFD_DEST_REPLAY
	FRR_REDISTRIBUTE_IPV4_ADD
	FRR_REDISTRIBUTE_IPV4_DEL
	FRR_REDISTRIBUTE_IPV6_ADD
	FRR_REDISTRIBUTE_IPV6_DEL
	FRR_VRF_UNREGISTER
	FRR_VRF_ADD
	FRR_VRF_DELETE
	FRR_INTERFACE_VRF_UPDATE
	FRR_BFD_CLIENT_REGISTER
	FRR_INTERFACE_ENABLE_RADV
	FRR_INTERFACE_DISABLE_RADV
	FRR_IPV4_NEXTHOP_LOOKUP_MRIB
	FRR_INTERFACE_LINK_PARAMS
	FRR_MPLS_LABELS_ADD
	FRR_MPLS_LABELS_DELETE
	FRR_IPV4_NEXTHOP_ADD
	FRR_IPV4_NEXTHOP_DELETE
	FRR_IPV6_NEXTHOP_ADD
	FRR_IPV6_NEXTHOP_DELETE
	FRR_IPMR_ROUTE_STATS
	FRR_LABEL_MANAGER_CONNECT
	FRR_GET_LABEL_CHUNK
	FRR_RELEASE_LABEL_CHUNK
	FRR_PW_ADD
	FRR_PW_DELETE
	FRR_PW_SET
	FRR_PW_UNSET
	FRR_PW_STATUS_UPDATE
)

For FRRouting.

const (
	INTERFACE_ADD API_TYPE
	INTERFACE_DELETE
	INTERFACE_ADDRESS_ADD
	INTERFACE_ADDRESS_DELETE
	INTERFACE_UP
	INTERFACE_DOWN
	IPV4_ROUTE_ADD
	IPV4_ROUTE_DELETE
	IPV6_ROUTE_ADD
	IPV6_ROUTE_DELETE
	REDISTRIBUTE_ADD
	REDISTRIBUTE_DELETE
	REDISTRIBUTE_DEFAULT_ADD
	REDISTRIBUTE_DEFAULT_DELETE
	IPV4_NEXTHOP_LOOKUP
	IPV6_NEXTHOP_LOOKUP
	IPV4_IMPORT_LOOKUP
	IPV6_IMPORT_LOOKUP
	INTERFACE_RENAME
	ROUTER_ID_ADD
	ROUTER_ID_DELETE
	ROUTER_ID_UPDATE
	HELLO
	IPV4_NEXTHOP_LOOKUP_MRIB
	VRF_UNREGISTER
	INTERFACE_LINK_PARAMS
	NEXTHOP_REGISTER
	NEXTHOP_UNREGISTER
	NEXTHOP_UPDATE
	MESSAGE_MAX
)

For Quagga.

func (API_TYPE) String

func (i API_TYPE) String() string

type Body

type Body interface {
	DecodeFromBytes([]byte, uint8) error
	Serialize(uint8) ([]byte, error)
	String() string
}

type Client

type Client struct {
	Version uint8
	// contains filtered or unexported fields
}

func NewClient

func NewClient(network, address string, typ ROUTE_TYPE, version uint8) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Receive

func (c *Client) Receive() chan *Message

func (*Client) Send

func (c *Client) Send(m *Message)

func (*Client) SendCommand

func (c *Client) SendCommand(command API_TYPE, vrfId uint32, body Body) error

func (*Client) SendHello

func (c *Client) SendHello() error

func (*Client) SendIPRoute

func (c *Client) SendIPRoute(vrfId uint32, body *IPRouteBody, isWithdraw bool) error

func (*Client) SendInterfaceAdd

func (c *Client) SendInterfaceAdd() error

func (*Client) SendNexthopRegister

func (c *Client) SendNexthopRegister(vrfId uint32, body *NexthopRegisterBody, isWithdraw bool) error

func (*Client) SendRedistribute

func (c *Client) SendRedistribute(t ROUTE_TYPE, vrfId uint32) error

func (*Client) SendRedistributeDelete

func (c *Client) SendRedistributeDelete(t ROUTE_TYPE) error

func (*Client) SendRouterIDAdd

func (c *Client) SendRouterIDAdd() error

type FLAG

type FLAG uint64

Message Flags

const (
	FLAG_INTERNAL        FLAG = 0x01
	FLAG_SELFROUTE       FLAG = 0x02
	FLAG_BLACKHOLE       FLAG = 0x04
	FLAG_IBGP            FLAG = 0x08
	FLAG_SELECTED        FLAG = 0x10
	FLAG_CHANGED         FLAG = 0x20
	FLAG_STATIC          FLAG = 0x40
	FLAG_REJECT          FLAG = 0x80
	FLAG_SCOPE_LINK      FLAG = 0x100
	FLAG_FIB_OVERRIDE    FLAG = 0x200
	FLAG_EVPN_ROUTE      FLAG = 0x400
	FLAG_RR_USE_DISTANCE FLAG = 0x800
)

func (FLAG) String

func (t FLAG) String() string
type Header struct {
	Len     uint16
	Marker  uint8
	Version uint8
	VrfId   uint32 // ZAPI v4: 16bits, v5: 32bits
	Command API_TYPE
}

func (*Header) DecodeFromBytes

func (h *Header) DecodeFromBytes(data []byte) error

func (*Header) Serialize

func (h *Header) Serialize() ([]byte, error)

type HelloBody

type HelloBody struct {
	RedistDefault ROUTE_TYPE
	Instance      uint16
	ReceiveNotify uint8
}

func (*HelloBody) DecodeFromBytes

func (b *HelloBody) DecodeFromBytes(data []byte, version uint8) error

Reference: zread_hello function in zebra/zserv.c of Quagga1.2.x (ZAPI3) Reference: zread_hello function in zebra/zserv.c of FRR3.x (ZAPI4) Reference: zread_hello function in zebra/zapi_msg.c of FRR5.x (ZAPI5)

func (*HelloBody) Serialize

func (b *HelloBody) Serialize(version uint8) ([]byte, error)

Reference: zebra_hello_send function in lib/zclient.c of Quagga1.2.x (ZAPI3) Reference: zebra_hello_send function in lib/zclient.c of FRR3.x (ZAPI4) Reference: zebra_hello_send function in lib/zclient.c of FRR5.x (ZAPI5)

func (*HelloBody) String

func (b *HelloBody) String() string

type INTERFACE_ADDRESS_FLAG

type INTERFACE_ADDRESS_FLAG uint8

Interface Connected Address Flags

const (
	INTERFACE_ADDRESS_SECONDARY  INTERFACE_ADDRESS_FLAG = 0x01
	INTERFACE_ADDRESS_PEER       INTERFACE_ADDRESS_FLAG = 0x02
	INTERFACE_ADDRESS_UNNUMBERED INTERFACE_ADDRESS_FLAG = 0x04
)

func (INTERFACE_ADDRESS_FLAG) String

func (t INTERFACE_ADDRESS_FLAG) String() string

type INTERFACE_STATUS

type INTERFACE_STATUS uint8

Internal Interface Status.

const (
	INTERFACE_ACTIVE        INTERFACE_STATUS = 0x01
	INTERFACE_SUB           INTERFACE_STATUS = 0x02
	INTERFACE_LINKDETECTION INTERFACE_STATUS = 0x04
	INTERFACE_VRF_LOOPBACK  INTERFACE_STATUS = 0x08
)

func (INTERFACE_STATUS) String

func (t INTERFACE_STATUS) String() string

type IPRouteBody

type IPRouteBody struct {
	Type      ROUTE_TYPE
	Instance  uint16
	Flags     FLAG
	Message   MESSAGE_FLAG
	SAFI      SAFI
	Prefix    Prefix
	SrcPrefix Prefix
	Nexthops  []Nexthop
	Distance  uint8
	Metric    uint32
	Mtu       uint32
	Tag       uint32
	Rmac      [6]byte
	Api       API_TYPE
}

func (*IPRouteBody) DecodeFromBytes

func (b *IPRouteBody) DecodeFromBytes(data []byte, version uint8) error

Reference: zebra_read_ipv4 function in bgpd/bgp_zebra.c of Quagga1.2.x (ZAPI3) Reference: zebra_read_ipv4 function in bgpd/bgp_zebra.c of FRR4.x (ZAPI4) Reference: zapi_route_decode function in lib/zclient.c of FRR5.x (ZAPI5)

func (*IPRouteBody) IsWithdraw

func (b *IPRouteBody) IsWithdraw(version uint8) bool

func (*IPRouteBody) RouteFamily

func (b *IPRouteBody) RouteFamily(version uint8) bgp.RouteFamily

func (*IPRouteBody) Serialize

func (b *IPRouteBody) Serialize(version uint8) ([]byte, error)

Reference: zapi_ipv4_route function in lib/zclient.c of Quagga1.2.x (ZAPI3) Reference: zapi_ipv4_route function in lib/zclient.c of FRR3.x (ZAPI4) Reference: zapi_route_encode function in lib/zclient.c of FRR5.x (ZAPI5)

func (*IPRouteBody) String

func (b *IPRouteBody) String() string

type ImportLookupBody

type ImportLookupBody struct {
	Api          API_TYPE
	PrefixLength uint8
	Prefix       net.IP
	Addr         net.IP
	Metric       uint32
	Nexthops     []Nexthop
}

func (*ImportLookupBody) DecodeFromBytes

func (b *ImportLookupBody) DecodeFromBytes(data []byte, version uint8) error

Quagga only. Reference: zsend_ipv4_import_lookup in zebra/zserv.c of Quagga1.2.x (ZAPI3)

func (*ImportLookupBody) Serialize

func (b *ImportLookupBody) Serialize(version uint8) ([]byte, error)

Quagga only. Reference: zread_ipv4_import_lookup in zebra/zserv.c of Quagga1.2.x (ZAPI3)

func (*ImportLookupBody) String

func (b *ImportLookupBody) String() string

type InterfaceAddressUpdateBody

type InterfaceAddressUpdateBody struct {
	Index       uint32
	Flags       INTERFACE_ADDRESS_FLAG
	Prefix      net.IP
	Length      uint8
	Destination net.IP
}

func (*InterfaceAddressUpdateBody) DecodeFromBytes

func (b *InterfaceAddressUpdateBody) DecodeFromBytes(data []byte, version uint8) error

Reference: zebra_interface_address_read function in lib/zclient.c of Quagga1.2.x (ZAPI4) Reference: zebra_interface_address_read function in lib/zclient.c of FRR3.x (ZAPI4) Reference: zebra_interface_address_read function in lib/zclient.c of FRR5.x (ZAPI5)

func (*InterfaceAddressUpdateBody) Serialize

func (b *InterfaceAddressUpdateBody) Serialize(version uint8) ([]byte, error)

func (*InterfaceAddressUpdateBody) String

func (b *InterfaceAddressUpdateBody) String() string

type InterfaceUpdateBody

type InterfaceUpdateBody struct {
	Name         string
	Index        uint32
	Status       INTERFACE_STATUS
	Flags        uint64
	PTMEnable    PTM_ENABLE
	PTMStatus    PTM_STATUS
	Metric       uint32
	Speed        uint32
	MTU          uint32
	MTU6         uint32
	Bandwidth    uint32
	Linktype     LINK_TYPE
	HardwareAddr net.HardwareAddr
	LinkParam    LinkParam
}

func (*InterfaceUpdateBody) DecodeFromBytes

func (b *InterfaceUpdateBody) DecodeFromBytes(data []byte, version uint8) error

Reference: zebra_interface_if_set_value function in lib/zclient.c of Quagga1.2.x (ZAPI4) Reference: zebra_interface_if_set_value function in lib/zclient.c of FRR3.x (ZAPI4) Reference: zebra_interface_if_set_value function in lib/zclient.c of FRR5.x (ZAPI5)

func (*InterfaceUpdateBody) Serialize

func (b *InterfaceUpdateBody) Serialize(version uint8) ([]byte, error)

func (*InterfaceUpdateBody) String

func (b *InterfaceUpdateBody) String() string
type LINK_TYPE uint32

Interface Link Layer Types.

const (
	LINK_TYPE_UNKNOWN LINK_TYPE = iota
	LINK_TYPE_ETHER
	LINK_TYPE_EETHER
	LINK_TYPE_AX25
	LINK_TYPE_PRONET
	LINK_TYPE_IEEE802
	LINK_TYPE_ARCNET
	LINK_TYPE_APPLETLK
	LINK_TYPE_DLCI
	LINK_TYPE_ATM
	LINK_TYPE_METRICOM
	LINK_TYPE_IEEE1394
	LINK_TYPE_EUI64
	LINK_TYPE_INFINIBAND
	LINK_TYPE_SLIP
	LINK_TYPE_CSLIP
	LINK_TYPE_SLIP6
	LINK_TYPE_CSLIP6
	LINK_TYPE_RSRVD
	LINK_TYPE_ADAPT
	LINK_TYPE_ROSE
	LINK_TYPE_X25
	LINK_TYPE_PPP
	LINK_TYPE_CHDLC
	LINK_TYPE_LAPB
	LINK_TYPE_RAWHDLC
	LINK_TYPE_IPIP
	LINK_TYPE_IPIP6
	LINK_TYPE_FRAD
	LINK_TYPE_SKIP
	LINK_TYPE_LOOPBACK
	LINK_TYPE_LOCALTLK
	LINK_TYPE_FDDI
	LINK_TYPE_SIT
	LINK_TYPE_IPDDP
	LINK_TYPE_IPGRE
	LINK_TYPE_IP6GRE
	LINK_TYPE_PIMREG
	LINK_TYPE_HIPPI
	LINK_TYPE_ECONET
	LINK_TYPE_IRDA
	LINK_TYPE_FCPP
	LINK_TYPE_FCAL
	LINK_TYPE_FCPL
	LINK_TYPE_FCFABRIC
	LINK_TYPE_IEEE802_TR
	LINK_TYPE_IEEE80211
	LINK_TYPE_IEEE80211_RADIOTAP
	LINK_TYPE_IEEE802154
	LINK_TYPE_IEEE802154_PHY
)
func (i LINK_TYPE) String() string

type LinkParam

type LinkParam struct {
	Status      uint32
	TeMetric    uint32
	MaxBw       float32
	MaxRsvBw    float32
	UnrsvBw     [8]float32
	BwClassNum  uint32
	AdminGroup  uint32
	RemoteAS    uint32
	RemoteIP    net.IP
	AveDelay    uint32
	MinDelay    uint32
	MaxDelay    uint32
	DelayVar    uint32
	PktLoss     float32
	ResidualBw  float32
	AvailableBw float32
	UseBw       float32
}

type MESSAGE_FLAG

type MESSAGE_FLAG uint8

API Message Flags.

const (
	FRR_ZAPI5_MESSAGE_NEXTHOP  MESSAGE_FLAG = 0x01
	FRR_ZAPI5_MESSAGE_DISTANCE MESSAGE_FLAG = 0x02
	FRR_ZAPI5_MESSAGE_METRIC   MESSAGE_FLAG = 0x04
	FRR_ZAPI5_MESSAGE_TAG      MESSAGE_FLAG = 0x08
	FRR_ZAPI5_MESSAGE_MTU      MESSAGE_FLAG = 0x10
	FRR_ZAPI5_MESSAGE_SRCPFX   MESSAGE_FLAG = 0x20
	FRR_ZAPI5_MESSAGE_LABEL    MESSAGE_FLAG = 0x40
	FRR_ZAPI5_MESSAGE_TABLEID  MESSAGE_FLAG = 0x80
)

For FRRouting version 4, 5 and 6 (ZAPI version 5 and 6).

const (
	FRR_MESSAGE_NEXTHOP  MESSAGE_FLAG = 0x01
	FRR_MESSAGE_IFINDEX  MESSAGE_FLAG = 0x02
	FRR_MESSAGE_DISTANCE MESSAGE_FLAG = 0x04
	FRR_MESSAGE_METRIC   MESSAGE_FLAG = 0x08
	FRR_MESSAGE_TAG      MESSAGE_FLAG = 0x10
	FRR_MESSAGE_MTU      MESSAGE_FLAG = 0x20
	FRR_MESSAGE_SRCPFX   MESSAGE_FLAG = 0x40
)

For FRRouting.

const (
	MESSAGE_NEXTHOP  MESSAGE_FLAG = 0x01
	MESSAGE_IFINDEX  MESSAGE_FLAG = 0x02
	MESSAGE_DISTANCE MESSAGE_FLAG = 0x04
	MESSAGE_METRIC   MESSAGE_FLAG = 0x08
	MESSAGE_MTU      MESSAGE_FLAG = 0x10
	MESSAGE_TAG      MESSAGE_FLAG = 0x20
)

For Quagga.

func (MESSAGE_FLAG) String

func (t MESSAGE_FLAG) String(version uint8) string

type Message

type Message struct {
	Header Header
	Body   Body
}

func ParseMessage

func ParseMessage(hdr *Header, data []byte) (m *Message, err error)

func (*Message) Serialize

func (m *Message) Serialize() ([]byte, error)

type NEXTHOP_FLAG

type NEXTHOP_FLAG uint8

Nexthop Flags.

const (
	NEXTHOP_FLAG_ACTIVE     NEXTHOP_FLAG = 0x01 // This nexthop is alive.
	NEXTHOP_FLAG_FIB        NEXTHOP_FLAG = 0x02 // FIB nexthop.
	NEXTHOP_FLAG_RECURSIVE  NEXTHOP_FLAG = 0x04 // Recursive nexthop.
	NEXTHOP_FLAG_ONLINK     NEXTHOP_FLAG = 0x08 // Nexthop should be installed onlink.
	NEXTHOP_FLAG_MATCHED    NEXTHOP_FLAG = 0x10 // Already matched vs a nexthop
	NEXTHOP_FLAG_FILTERED   NEXTHOP_FLAG = 0x20 // rmap filtered (version >= 4)
	NEXTHOP_FLAG_DUPLICATE  NEXTHOP_FLAG = 0x40 // nexthop duplicates (version >= 5)
	NEXTHOP_FLAG_EVPN_RVTEP NEXTHOP_FLAG = 0x80 // EVPN remote vtep nexthop (version >= 5)
)

func (NEXTHOP_FLAG) String

func (i NEXTHOP_FLAG) String() string

type NEXTHOP_TYPE

type NEXTHOP_TYPE uint8

Nexthop Types.

const (
	FRR_NEXTHOP_TYPE_IFINDEX NEXTHOP_TYPE
	FRR_NEXTHOP_TYPE_IPV4
	FRR_NEXTHOP_TYPE_IPV4_IFINDEX
	FRR_NEXTHOP_TYPE_IPV6
	FRR_NEXTHOP_TYPE_IPV6_IFINDEX
	FRR_NEXTHOP_TYPE_BLACKHOLE
)

For FRRouting.

const (
	NEXTHOP_TYPE_IFINDEX NEXTHOP_TYPE
	NEXTHOP_TYPE_IFNAME
	NEXTHOP_TYPE_IPV4
	NEXTHOP_TYPE_IPV4_IFINDEX
	NEXTHOP_TYPE_IPV4_IFNAME
	NEXTHOP_TYPE_IPV6
	NEXTHOP_TYPE_IPV6_IFINDEX
	NEXTHOP_TYPE_IPV6_IFNAME
	NEXTHOP_TYPE_BLACKHOLE
)

For Quagga.

func (NEXTHOP_TYPE) String

func (i NEXTHOP_TYPE) String() string

type Nexthop

type Nexthop struct {
	Type          NEXTHOP_TYPE
	VrfId         uint32
	Ifindex       uint32
	Gate          net.IP
	BlackholeType uint8
	LabelNum      uint8
	MplsLabels    []uint32
}

Reference: struct zapi_nexthop in lib/zclient.h of FRR5.x (ZAPI5)

func (*Nexthop) String

func (n *Nexthop) String() string

type NexthopLookupBody

type NexthopLookupBody struct {
	Api      API_TYPE
	Addr     net.IP
	Distance uint8
	Metric   uint32
	Nexthops []Nexthop
}

func (*NexthopLookupBody) DecodeFromBytes

func (b *NexthopLookupBody) DecodeFromBytes(data []byte, version uint8) error

Quagga only. Reference: zsend_ipv[4|6]_nexthop_lookup in zebra/zserv.c of Quagga1.2.x (ZAPI3)

func (*NexthopLookupBody) Serialize

func (b *NexthopLookupBody) Serialize(version uint8) ([]byte, error)

Quagga only. Reference: zread_ipv[4|6]_nexthop_lookup in zebra/zserv.c of Quagga1.2.x (ZAPI3)

func (*NexthopLookupBody) String

func (b *NexthopLookupBody) String() string

type NexthopRegisterBody

type NexthopRegisterBody struct {
	Api      API_TYPE
	Nexthops []*RegisteredNexthop
}

func (*NexthopRegisterBody) DecodeFromBytes

func (b *NexthopRegisterBody) DecodeFromBytes(data []byte, version uint8) error

Reference: zserv_nexthop_register in zebra/zserv.c of Quagga1.2.x (ZAPI3) Reference: zserv_rnh_register in zebra/zserv.c of FRR3.x (ZAPI4) Reference: zread_rnh_register in zebra/zapi_msg.c of FRR5.x (ZAPI5)

func (*NexthopRegisterBody) Serialize

func (b *NexthopRegisterBody) Serialize(version uint8) ([]byte, error)

Reference: sendmsg_nexthop in bgpd/bgp_nht.c of Quagga1.2.x (ZAPI3) Reference: sendmsg_zebra_rnh in bgpd/bgp_nht.c of FRR3.x (ZAPI4) Reference: zclient_send_rnh function in lib/zclient.c of FRR5.x (ZAPI5)

func (*NexthopRegisterBody) String

func (b *NexthopRegisterBody) String() string

type NexthopUpdateBody

type NexthopUpdateBody IPRouteBody

NEXTHOP_UPDATE message uses same data structure as IPRoute (zapi_route)

in FRR version 4, 5 (ZApi version 5)

func (*NexthopUpdateBody) DecodeFromBytes

func (b *NexthopUpdateBody) DecodeFromBytes(data []byte, version uint8) error

Reference: bgp_parse_nexthop_update function in bgpd/bgp_nht.c of Quagga1.2.x (ZAPI3) Reference: bgp_parse_nexthop_update function in bgpd/bgp_nht.c of FRR3.x (ZAPI4) Reference: zapi_nexthop_update_decode function in lib/zclient.c of FRR5.x (ZAPI5)

func (*NexthopUpdateBody) Serialize

func (b *NexthopUpdateBody) Serialize(version uint8) ([]byte, error)

Reference: send_client function in zebra/zebra_rnh.c of Quagga1.2.x (ZAPI3) Reference: send_client function in zebra/zebra_rnh.c of FRR3.x (ZAPI4) Reference: send_client function in zebra/zebra_rnh.c of FRR5.x (ZAPI5)

func (*NexthopUpdateBody) String

func (b *NexthopUpdateBody) String() string

type PTM_ENABLE

type PTM_ENABLE uint8

Interface PTM Enable Configuration.

const (
	PTM_ENABLE_OFF    PTM_ENABLE = 0
	PTM_ENABLE_ON     PTM_ENABLE = 1
	PTM_ENABLE_UNSPEC PTM_ENABLE = 2
)

func (PTM_ENABLE) String

func (i PTM_ENABLE) String() string

type PTM_STATUS

type PTM_STATUS uint8

PTM Status.

const (
	PTM_STATUS_DOWN    PTM_STATUS = 0
	PTM_STATUS_UP      PTM_STATUS = 1
	PTM_STATUS_UNKNOWN PTM_STATUS = 2
)

func (PTM_STATUS) String

func (i PTM_STATUS) String() string

type Prefix

type Prefix struct {
	Family    uint8
	PrefixLen uint8
	Prefix    net.IP
}

type ROUTE_TYPE

type ROUTE_TYPE uint8

Route Types.

const (
	FRR_ZAPI6_ROUTE_SYSTEM ROUTE_TYPE = iota
	FRR_ZAPI6_ROUTE_KERNEL
	FRR_ZAPI6_ROUTE_CONNECT
	FRR_ZAPI6_ROUTE_STATIC
	FRR_ZAPI6_ROUTE_RIP
	FRR_ZAPI6_ROUTE_RIPNG
	FRR_ZAPI6_ROUTE_OSPF
	FRR_ZAPI6_ROUTE_OSPF6
	FRR_ZAPI6_ROUTE_ISIS
	FRR_ZAPI6_ROUTE_BGP
	FRR_ZAPI6_ROUTE_PIM
	FRR_ZAPI6_ROUTE_EIGRP
	FRR_ZAPI6_ROUTE_NHRP
	FRR_ZAPI6_ROUTE_HSLS
	FRR_ZAPI6_ROUTE_OLSR
	FRR_ZAPI6_ROUTE_TABLE
	FRR_ZAPI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E_TYPE = iota
	FRR_ROUTE_KERNEL
	FRR_ROUTE_CONNECT
	FRR_ROUTE_STATIC
	FRR_ROUTE_RIP
	FRR_ROUTE_RIPNG
	FRR_ROUTE_OSPF
	FRR_ROUTE_OSPF6
	FRR_ROUTE_ISIS
	FRR_ROUTE_BGP
	FRR_ROUTE_PIM
	FRR_ROUTE_HSLS
	FRR_ROUTE_OLSR
	FRR_ROUTE_TABLE
	FRR_ROUTE_LDP
	FRR_ROUTE_VNC
	FRR_ROUTE_VNC_DIRECT
	FRR_ROUTE_VNC_DIRECT_RH
	FRR_ROUTE_BGP_DIRECT
	FRR_ROUTE_BGP_DIRECT_EXT
	FRR_ROUTE_ALL
	FRR_ROUTE_MAX
)

For FRRouting.

const (
	ROUTE_SYSTEM ROUTE_TYPE = iota
	ROUTE_KERNEL
	ROUTE_CONNECT
	ROUTE_STATIC
	ROUTE_RIP
	ROUTE_RIPNG
	ROUTE_OSPF
	ROUTE_OSPF6
	ROUTE_ISIS
	ROUTE_BGP
	ROUTE_PIM
	ROUTE_HSLS
	ROUTE_OLSR
	ROUTE_BABEL
	ROUTE_MAX
)

For Quagga.

func RouteTypeFromString

func RouteTypeFromString(typ string, version uint8) (ROUTE_TYPE, error)

func (ROUTE_TYPE) String

func (i ROUTE_TYPE) String() string

type RedistributeBody

type RedistributeBody struct {
	Afi      AFI
	Redist   ROUTE_TYPE
	Instance uint16
}

func (*RedistributeBody) DecodeFromBytes

func (b *RedistributeBody) DecodeFromBytes(data []byte, version uint8) error

Reference: zebra_redistribute_add function in zebra/redistribute.c of Quagga1.2.x (ZAPI3) Reference: zebra_redistribute_add function in zebra/redistribute.c of FRR3.x (ZAPI4) Reference: zebra_redistribute_add function in zebra/redistribute.c of FRR5.x (ZAPI5)

func (*RedistributeBody) Serialize

func (b *RedistributeBody) Serialize(version uint8) ([]byte, error)

Reference: zebra_redistribute_send function in lib/zclient.c of Quagga1.2.x (ZAPI3) Reference: zebra_redistribute_send function in lib/zclient.c of FRR3.x (ZAPI4) Reference: zebra_redistribute_send function in lib/zclient.c of FRR5.x (ZAPI5)

func (*RedistributeBody) String

func (b *RedistributeBody) String() string

type RegisteredNexthop

type RegisteredNexthop struct {
	Connected uint8
	Family    uint16
	// Note: Ignores PrefixLength (uint8),
	// because this field should be always:
	// - 32 if Address Family is AF_INET
	// - 128 if Address Family is AF_INET6
	Prefix net.IP
}

func (*RegisteredNexthop) DecodeFromBytes

func (n *RegisteredNexthop) DecodeFromBytes(data []byte) error

Reference: zserv_nexthop_register in zebra/zserv.c of Quagga1.2.x (ZAPI3) Reference: zserv_rnh_register in zebra/zserv.c of FRR3.x (ZAPI4) Reference: zread_rnh_register in zebra/zapi_msg.c of FRR5.x (ZAPI5)

func (*RegisteredNexthop) Len

func (n *RegisteredNexthop) Len() int

func (*RegisteredNexthop) Serialize

func (n *RegisteredNexthop) Serialize() ([]byte, error)

Reference: sendmsg_nexthop in bgpd/bgp_nht.c of Quagga1.2.x (ZAPI3) Reference: sendmsg_zebra_rnh in bgpd/bgp_nht.c of FRR3.x (ZAPI4) Reference: zclient_send_rnh function in lib/zclient.c of FRR5.x (ZAPI5)

func (*RegisteredNexthop) String

func (n *RegisteredNexthop) String() string

type RouterIDUpdateBody

type RouterIDUpdateBody struct {
	Length uint8
	Prefix net.IP
}

func (*RouterIDUpdateBody) DecodeFromBytes

func (b *RouterIDUpdateBody) DecodeFromBytes(data []byte, version uint8) error

Reference: zebra_router_id_update_read function in lib/zclient.c of Quagga1.2.x (ZAPI4) Reference: zebra_router_id_update_read function in lib/zclient.c of FRR3.x (ZAPI4) Reference: zebra_router_id_update_read function in lib/zclient.c of FRR5.x (ZAPI5)

func (*RouterIDUpdateBody) Serialize

func (b *RouterIDUpdateBody) Serialize(version uint8) ([]byte, error)

func (*RouterIDUpdateBody) String

func (b *RouterIDUpdateBody) String() string

type SAFI

type SAFI uint8

Subsequent Address Family Identifier.

const (
	SAFI_UNICAST SAFI
	SAFI_MULTICAST
	SAFI_RESERVED_3
	SAFI_MPLS_VPN
	SAFI_MAX
)

func (SAFI) String

func (i SAFI) String() string

type UnknownBody

type UnknownBody struct {
	Data []byte
}

func (*UnknownBody) DecodeFromBytes

func (b *UnknownBody) DecodeFromBytes(data []byte, version uint8) error

func (*UnknownBody) Serialize

func (b *UnknownBody) Serialize(version uint8) ([]byte, error)

func (*UnknownBody) String

func (b *UnknownBody) String() string

Jump to

Keyboard shortcuts

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