sciond

package
v0.0.0-...-c8fc2fc Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package sciond queries local SCIOND servers for information.

To query SCIOND, initialize a Service object by passing in the path to the UNIX socket. It is then possible to establish connections to SCIOND by calling Connect or ConnectTimeout on the service. The connections implement interface Connector, whose methods can be used to talk to SCIOND.

Connector method calls return the entire answer of SCIOND.

Fields prefixed with Raw (e.g., RawErrorCode) contain data in the format received from SCIOND. These are used internally, and the accessors without the prefix (e.g., ErrorCode()) should be used instead.

Index

Constants

View Source
const (
	ASInfoTTL  = time.Hour
	IFInfoTTL  = time.Hour
	SVCInfoTTL = 10 * time.Second
)

Time to live for cache entries

Variables

This section is empty.

Functions

This section is empty.

Types

type ASInfoReply

type ASInfoReply struct {
	Entries []ASInfoReplyEntry
}

type ASInfoReplyEntry

type ASInfoReplyEntry struct {
	RawIsdas addr.IAInt `capnp:"isdas"`
	Mtu      uint16
	IsCore   bool
}

func (*ASInfoReplyEntry) ISD_AS

func (entry *ASInfoReplyEntry) ISD_AS() *addr.ISD_AS

func (ASInfoReplyEntry) String

func (entry ASInfoReplyEntry) String() string

type ASInfoReq

type ASInfoReq struct {
	Isdas addr.IAInt
}

type Connector

type Connector interface {
	// Paths requests from SCIOND a set of end to end paths between src and
	// dst. max specifices the maximum number of paths returned.
	Paths(dst, src *addr.ISD_AS, max uint16, f PathReqFlags) (*PathReply, error)
	// ASInfo requests from SCIOND information about AS ia.
	ASInfo(ia *addr.ISD_AS) (*ASInfoReply, error)
	// IFInfo requests from SCIOND addresses and ports of interfaces.  Slice
	// ifs contains interface IDs of BRs. If empty, a fresh (i.e., uncached)
	// answer containing all interfaces is returned.
	IFInfo(ifs []uint64) (*IFInfoReply, error)
	// SVCInfo requests from SCIOND information about addresses and ports of
	// infrastructure services.  Slice svcTypes contains a list of desired
	// service types. If unset, a fresh (i.e., uncached) answer containing all
	// service types is returned.
	SVCInfo(svcTypes []ServiceType) (*ServiceInfoReply, error)
	// RevNotification sends a raw revocation to SCIOND, as contained in an
	// SCMP message.
	RevNotificationFromRaw(revInfo []byte) (*RevReply, error)
	// RevNotification sends a RevocationInfo message to SCIOND.
	RevNotification(revInfo *path_mgmt.RevInfo) (*RevReply, error)
	// Close shuts down the connection to a SCIOND server.
	Close() error
	// SetDeadline sets a deadline associated with any SCIOND query. If
	// underlying protocol operations exceed the deadline, the queries return
	// immediately with an error.
	//
	// A zero value for t means queries will not time out.
	//
	// To check for exceeded deadlines, type assert the returned error to
	// *net.OpError and call method Timeout().
	//
	// Following a timeout error the underlying protocol to SCIOND is probably
	// desynchronized. Establishing a fresh connection to SCIOND is
	// recommended.
	SetDeadline(t time.Time) error
}

A Connector is used to query SCIOND. The connector maintains an internal cache for interface, service and AS information. All connector methods block until either an error occurs, or the method successfully returns.

type FwdPathMeta

type FwdPathMeta struct {
	FwdPath    []byte
	Mtu        uint16
	Interfaces []PathInterface
}

func (FwdPathMeta) DstIA

func (fpm FwdPathMeta) DstIA() *addr.ISD_AS

func (FwdPathMeta) SrcIA

func (fpm FwdPathMeta) SrcIA() *addr.ISD_AS

func (FwdPathMeta) String

func (fpm FwdPathMeta) String() string

type HostInfo

type HostInfo struct {
	Port  uint16
	Addrs struct {
		Ipv4 []byte
		Ipv6 []byte
	}
}

func HostInfoFromHostAddr

func HostInfoFromHostAddr(host addr.HostAddr, port uint16) *HostInfo

func (*HostInfo) Host

func (h *HostInfo) Host() addr.HostAddr

type IFInfoReply

type IFInfoReply struct {
	RawEntries []IFInfoReplyEntry `capnp:"entries"`
}

func (*IFInfoReply) Entries

func (reply *IFInfoReply) Entries() map[uint64]HostInfo

Entries maps IFIDs to their addresses and ports; the map is rebuilt each time.

type IFInfoReplyEntry

type IFInfoReplyEntry struct {
	IfID     uint64
	HostInfo HostInfo
}

type IFInfoRequest

type IFInfoRequest struct {
	IfIDs []uint64
}

type PathErrorCode

type PathErrorCode uint16
const (
	ErrorOk PathErrorCode = iota
	ErrorNoPaths
	ErrorPSTimeout
	ErrorInternal
)

func (PathErrorCode) String

func (c PathErrorCode) String() string

type PathInterface

type PathInterface struct {
	RawIsdas addr.IAInt `capnp:"isdas"`
	IfID     uint64
}

func (*PathInterface) ISD_AS

func (iface *PathInterface) ISD_AS() *addr.ISD_AS

func (PathInterface) String

func (iface PathInterface) String() string

type PathReply

type PathReply struct {
	ErrorCode PathErrorCode
	Entries   []PathReplyEntry
}

type PathReplyEntry

type PathReplyEntry struct {
	Path     FwdPathMeta
	HostInfo HostInfo
}

type PathReq

type PathReq struct {
	Dst      addr.IAInt
	Src      addr.IAInt
	MaxPaths uint16
	Flags    PathReqFlags
}

type PathReqFlags

type PathReqFlags struct {
	Flush bool
	Sibra bool
}

type Pld

type Pld struct {
	Id                 uint64
	Which              proto.SCIONDMsg_Which
	PathReq            PathReq
	PathReply          PathReply
	AsInfoReq          ASInfoReq
	AsInfoReply        ASInfoReply
	RevNotification    RevNotification
	RevReply           RevReply
	IfInfoRequest      IFInfoRequest
	IfInfoReply        IFInfoReply
	ServiceInfoRequest ServiceInfoRequest
	ServiceInfoReply   ServiceInfoReply
}

func NewPldFromRaw

func NewPldFromRaw(b common.RawBytes) (*Pld, error)

func (*Pld) ProtoId

func (p *Pld) ProtoId() proto.ProtoIdType

func (*Pld) String

func (p *Pld) String() string

type RevNotification

type RevNotification struct {
	RevInfo *path_mgmt.RevInfo
}

type RevReply

type RevReply struct {
	Result RevResult
}

type RevResult

type RevResult uint16
const (
	RevValid RevResult = iota
	RevStale
	RevInvalid
	RevUnknown
)

func (RevResult) String

func (c RevResult) String() string

type Service

type Service interface {
	// Connect connects to the SCIOND server described by Service. Future
	// method calls on the returned Connector request information from SCIOND.
	// The information is not guaranteed to be fresh, as the returned connector
	// caches ASInfo replies for ASInfoTTL time, IFInfo replies for IFInfoTTL
	// time and SVCInfo for SVCInfoTTL time.
	Connect() (Connector, error)
	// ConnectTimeout acts like Connect but takes a timeout.
	//
	// A negative timeout means infinite timeout.
	//
	// To check for timeout errors, type assert the returned error to
	// *net.OpError and call method Timeout().
	ConnectTimeout(timeout time.Duration) (Connector, error)
}

Service describes a SCIOND endpoint. New connections to SCIOND can be initialized via Connect and ConnectTimeout.

func NewService

func NewService(name string) Service

type ServiceInfoReply

type ServiceInfoReply struct {
	Entries []ServiceInfoReplyEntry
}

type ServiceInfoReplyEntry

type ServiceInfoReplyEntry struct {
	ServiceType ServiceType
	Ttl         uint32
	HostInfos   []HostInfo
}

type ServiceInfoRequest

type ServiceInfoRequest struct {
	ServiceTypes []ServiceType
}

type ServiceType

type ServiceType uint16
const (
	SvcBS ServiceType = iota
	SvcPS
	SvcCS
	SvcBR
	SvcSB
)

func (ServiceType) String

func (st ServiceType) String() string

Jump to

Keyboard shortcuts

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