socketclient

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package socketclient is a pure Go implementation of adapter.VppAPI, which uses unix domain sockets as the transport for connecting to the VPP binary API.

The current implementation only supports VPP binary API, the VPP stats API is not supported and clients still have to use vppapiclient for retrieving stats.

Requirements

The socketclient will connect to /run/vpp-api.sock by default. However this is not enabled in VPP configuration by default.

To enable the socket in VPP, add following section to VPP config.

socksvr {
	default
}

Index

Constants

View Source
const (
	// DefaultSocketName is default VPP API socket file path.
	DefaultSocketName = adapter.DefaultBinapiSocket
)

Variables

View Source
var (
	// DefaultConnectTimeout is default timeout for connecting
	DefaultConnectTimeout = time.Second * 3
	// DefaultDisconnectTimeout is default timeout for discconnecting
	DefaultDisconnectTimeout = time.Millisecond * 100
	// MaxWaitReady defines maximum duration before waiting for socket file
	// times out
	MaxWaitReady = time.Second * 10
	// ClientName is used for identifying client in socket registration
	ClientName = "govppsock"
)
View Source
var (
	// Debug is global variable that determines debug mode
	Debug = os.Getenv("DEBUG_GOVPP_SOCK") != ""
	// DebugMsgIds is global variable that determines debug mode for msg ids
	DebugMsgIds = os.Getenv("DEBUG_GOVPP_SOCKMSG") != ""

	// Log is global logger
	Log = logger.New()
)

Functions

func NewVppClient

func NewVppClient(sockAddr string) *vppClient

Types

type APIVersions added in v0.3.7

type APIVersions struct{}

APIVersions represents VPP binary API message 'api_versions'.

func (*APIVersions) GetCrcString added in v0.3.7

func (*APIVersions) GetCrcString() string

func (*APIVersions) GetMessageName added in v0.3.7

func (*APIVersions) GetMessageName() string

func (*APIVersions) GetMessageType added in v0.3.7

func (*APIVersions) GetMessageType() api.MessageType

type APIVersionsReply added in v0.3.7

type APIVersionsReply struct {
	Retval      int32
	Count       uint32 `struc:"sizeof=APIVersions"`
	APIVersions []ModuleVersion
}

APIVersionsReply represents VPP binary API message 'api_versions_reply'.

func (*APIVersionsReply) GetCrcString added in v0.3.7

func (*APIVersionsReply) GetCrcString() string

func (*APIVersionsReply) GetMessageName added in v0.3.7

func (*APIVersionsReply) GetMessageName() string

func (*APIVersionsReply) GetMessageType added in v0.3.7

func (*APIVersionsReply) GetMessageType() api.MessageType

type MessageTableEntry added in v0.3.7

type MessageTableEntry struct {
	Index uint16
	Name  string `struc:"[64]byte"`
}

MessageTableEntry represents VPP binary API type 'message_table_entry'.

func (*MessageTableEntry) GetTypeName added in v0.3.7

func (*MessageTableEntry) GetTypeName() string

type ModuleVersion added in v0.3.7

type ModuleVersion struct {
	Major uint32
	Minor uint32
	Patch uint32
	Name  string `struc:"[64]byte"`
}

ModuleVersion represents VPP binary API type 'module_version'.

func (*ModuleVersion) GetTypeName added in v0.3.7

func (*ModuleVersion) GetTypeName() string

type SockclntCreate added in v0.3.7

type SockclntCreate struct {
	Name string `struc:"[64]byte"`
}

SockclntCreate represents VPP binary API message 'sockclnt_create'.

func (*SockclntCreate) GetCrcString added in v0.3.7

func (*SockclntCreate) GetCrcString() string

func (*SockclntCreate) GetMessageName added in v0.3.7

func (*SockclntCreate) GetMessageName() string

func (*SockclntCreate) GetMessageType added in v0.3.7

func (*SockclntCreate) GetMessageType() api.MessageType

type SockclntCreateReply added in v0.3.7

type SockclntCreateReply struct {
	Response     int32
	Index        uint32
	Count        uint16 `struc:"sizeof=MessageTable"`
	MessageTable []MessageTableEntry
}

SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'.

func (*SockclntCreateReply) GetCrcString added in v0.3.7

func (*SockclntCreateReply) GetCrcString() string

func (*SockclntCreateReply) GetMessageName added in v0.3.7

func (*SockclntCreateReply) GetMessageName() string

func (*SockclntCreateReply) GetMessageType added in v0.3.7

func (*SockclntCreateReply) GetMessageType() api.MessageType

type SockclntDelete added in v0.3.7

type SockclntDelete struct {
	Index uint32
}

SockclntDelete represents VPP binary API message 'sockclnt_delete'.

func (*SockclntDelete) GetCrcString added in v0.3.7

func (*SockclntDelete) GetCrcString() string

func (*SockclntDelete) GetMessageName added in v0.3.7

func (*SockclntDelete) GetMessageName() string

func (*SockclntDelete) GetMessageType added in v0.3.7

func (*SockclntDelete) GetMessageType() api.MessageType

type SockclntDeleteReply added in v0.3.7

type SockclntDeleteReply struct {
	Response int32
}

SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'.

func (*SockclntDeleteReply) GetCrcString added in v0.3.7

func (*SockclntDeleteReply) GetCrcString() string

func (*SockclntDeleteReply) GetMessageName added in v0.3.7

func (*SockclntDeleteReply) GetMessageName() string

func (*SockclntDeleteReply) GetMessageType added in v0.3.7

func (*SockclntDeleteReply) GetMessageType() api.MessageType

Jump to

Keyboard shortcuts

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