vppapi

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package vppapi parses VPP API files without any additional processing.

Index

Constants

View Source
const (
	VPPVersionEnvVar = "VPP_VERSION"
	VPPDirEnvVar     = "VPP_DIR"
)
View Source
const (
	// DefaultDir is default location of API files.
	DefaultDir = "/usr/share/vpp/api"

	// APIFileExtension is a VPP API file extension suffix
	APIFileExtension = ".api.json"
)

Variables

This section is empty.

Functions

func FindFiles

func FindFiles(dir string, deep int) (files []string, err error)

FindFiles finds API files located in dir or in a nested directory that is not nested deeper than deep.

func GetVPPVersionInstalled

func GetVPPVersionInstalled() (string, error)

GetVPPVersionInstalled retrieves VPP version of installed package using dpkg-query.

func GetVPPVersionRepo

func GetVPPVersionRepo(repoDir string) (string, error)

GetVPPVersionRepo retrieves VPP version using script in repo directory.

func ResolveVPPVersion

func ResolveVPPVersion(apidir string) string

ResolveVPPVersion resolves version of the VPP for target directory.

Version resolved here can be overriden by setting VPP_VERSION env var.

Types

type AliasType

type AliasType struct {
	Name   string
	Type   string
	Length int `json:",omitempty"`
}

type EnumEntry

type EnumEntry struct {
	Name  string
	Value uint32
}

type EnumType

type EnumType struct {
	Name    string
	Type    string
	Entries []EnumEntry
}

type Field

type Field struct {
	Name     string
	Type     string
	Length   int                    `json:",omitempty"`
	Array    bool                   `json:",omitempty"`
	SizeFrom string                 `json:",omitempty"`
	Meta     map[string]interface{} `json:",omitempty"`
}

type File

type File struct {
	Name string
	Path string
	CRC  string

	Options map[string]string `json:",omitempty"`
	Imports []string          `json:",omitempty"`

	AliasTypes    []AliasType  `json:",omitempty"`
	EnumTypes     []EnumType   `json:",omitempty"`
	EnumflagTypes []EnumType   `json:",omitempty"`
	StructTypes   []StructType `json:",omitempty"`
	UnionTypes    []UnionType  `json:",omitempty"`

	Messages []Message `json:",omitempty"`
	Service  *Service  `json:",omitempty"`
}

func Parse

func Parse() ([]*File, error)

Parse parses API files in directory DefaultDir.

func ParseDir

func ParseDir(apiDir string) ([]*File, error)

ParseDir finds and parses API files in given directory and returns parsed files. Supports API files in JSON format (.api.json) only.

func ParseFile

func ParseFile(apiFile string) (*File, error)

ParseFile parses API file and returns File.

func ParseRaw

func ParseRaw(data []byte) (file *File, err error)

ParseRaw parses raw API file data and returns File.

type Message

type Message struct {
	Name    string
	Fields  []Field
	CRC     string
	Options map[string]string
}

type RPC

type RPC struct {
	Request   string
	Reply     string
	Stream    bool     `json:",omitempty"`
	StreamMsg string   `json:",omitempty"`
	Events    []string `json:",omitempty"`
}

type Service

type Service struct {
	RPCs []RPC `json:",omitempty"`
}

type StructType

type StructType struct {
	Name   string
	Fields []Field
}

type UnionType

type UnionType struct {
	Name   string
	Fields []Field
}

Jump to

Keyboard shortcuts

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