dispatcher

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUnsupportedL4              common.ErrMsg = "unsupported SCION L4 protocol"
	ErrUnsupportedDestination     common.ErrMsg = "unsupported destination address type"
	ErrUnsupportedSCMPDestination common.ErrMsg = "unsupported SCMP destination address type"
	ErrUnsupportedQuotedL4Type    common.ErrMsg = "unsupported quoted L4 protocol type"
	ErrMalformedL4Quote           common.ErrMsg = "malformed L4 quote"
)
View Source
const OverflowLoggingInterval = 10 * time.Second

OverflowLoggingInterval is the minimum amount of time that needs to pass before another overflow logging message is printed (if needed).

View Source
const ReceiveBufferSize = 1 << 20

ReceiveBufferSize is the size of receive buffers used by the dispatcher.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn represents a connection bound to a specific SCION port/SVC.

func (*Conn) Close

func (ac *Conn) Close() error

func (*Conn) LocalAddr

func (ac *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (ac *Conn) Read() *respool.Packet

Read is optimized for the use by ConnHandler (avoids one copy).

func (*Conn) ReadFrom

func (ac *Conn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*Conn) SVCAddr

func (ac *Conn) SVCAddr() addr.HostSVC

func (*Conn) SetDeadline

func (ac *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (ac *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (ac *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (ac *Conn) Write(pkt *respool.Packet) (int, error)

Write is optimized for the use by ConnHandler (avoids reparsing the packet).

func (*Conn) WriteTo

func (ac *Conn) WriteTo(p []byte, addr net.Addr) (int, error)

type Destination

type Destination interface {
	// Send takes ownership of pkt, and then sends it to the location described
	// by this destination.
	Send(dp *NetToRingDataplane, pkt *respool.Packet)
}

type IATable

type IATable struct {
	registration.IATable
}

IATable is a type-safe convenience wrapper around a generic routing table.

func NewIATable

func NewIATable(minPort, maxPort int) *IATable

func (*IATable) LookupID

func (t *IATable) LookupID(ia addr.IA, id uint64) (*TableEntry, bool)

func (*IATable) LookupPublic

func (t *IATable) LookupPublic(ia addr.IA, public *net.UDPAddr) (*TableEntry, bool)

func (*IATable) LookupService

func (t *IATable) LookupService(ia addr.IA, svc addr.HostSVC, bind net.IP) []*TableEntry

type NetToRingDataplane

type NetToRingDataplane struct {
	UnderlayConn net.PacketConn
	RoutingTable *IATable
}

NetToRingDataplane reads SCION packets from the underlay socket, routes them to determine the destination process, and then enqueues the packets on the application's ingress ring.

The rings are used to provide non-blocking IO for the underlay receiver.

func (*NetToRingDataplane) Run

func (dp *NetToRingDataplane) Run() error

type SCMPDestination

type SCMPDestination struct {
	IA addr.IA
	ID uint16
}

func (SCMPDestination) Send

type SCMPHandler

type SCMPHandler struct{}

SCMPHandler replies to SCMP echo and traceroute requests.

func (SCMPHandler) Send

func (h SCMPHandler) Send(dp *NetToRingDataplane, pkt *respool.Packet)

type SVCDestination

type SVCDestination struct {
	IA  addr.IA
	Svc addr.HostSVC
}

SVCDestination delivers packets to apps that registered for the configured service.

func (SVCDestination) Send

func (d SVCDestination) Send(dp *NetToRingDataplane, pkt *respool.Packet)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the main object allowing to create new SCION connections.

func NewServer

func NewServer(address string, ipv4Conn, ipv6Conn net.PacketConn) (*Server, error)

NewServer creates new instance of Server. Internally, it opens the dispatcher ports for both IPv4 and IPv6. Returns error if the ports can't be opened.

func (*Server) Close

func (as *Server) Close()

func (*Server) Register

func (as *Server) Register(ctx context.Context, ia addr.IA, address *net.UDPAddr,
	svc addr.HostSVC) (net.PacketConn, uint16, error)

Register creates a new connection.

func (*Server) Serve

func (as *Server) Serve() error

Serve starts reading packets from network and dispatching them to different connections. The function blocks and returns if there's an error or when Close has been called.

type SocketMetaHandler

type SocketMetaHandler interface {
	Handle(*conn.ReadMeta)
}

SocketMetaHandler processes OS socket metadata during reads.

type TableEntry

type TableEntry struct {
	// contains filtered or unexported fields
}

type UDPDestination

type UDPDestination struct {
	IA     addr.IA
	Public *net.UDPAddr
}

UDPDestination delivers packets to the app that registered for the configured public address.

func (UDPDestination) Send

func (d UDPDestination) Send(dp *NetToRingDataplane, pkt *respool.Packet)

Jump to

Keyboard shortcuts

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