protos

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProtocolNames = []string{
	"unknown",
	"http",
	"mysql",
	"redis",
	"pgsql",
	"thrift",
	"mongodb",
}

Protocol names

Functions

This section is empty.

Types

type Packet

type Packet struct {
	Ts      time.Time
	Tuple   common.IpPortTuple
	Payload []byte
}

type Protocol

type Protocol uint16

Protocol identifier.

const (
	UnknownProtocol Protocol = iota
	HttpProtocol
	MysqlProtocol
	RedisProtocol
	PgsqlProtocol
	ThriftProtocol
	MongodbProtocol
)

Protocol constants.

func (Protocol) String

func (p Protocol) String() string

type ProtocolData

type ProtocolData interface{}

ProtocolData interface to represent an upper protocol private data. Used with types like HttpStream, MysqlStream, etc.

type ProtocolPlugin

type ProtocolPlugin interface {
	// Called to initialize the Plugin
	Init(test_mode bool, results chan common.MapStr) error

	// Called to return the configured ports
	GetPorts() []int

	// Called when payload data is available for parsing.
	Parse(pkt *Packet, tcptuple *common.TcpTuple,
		dir uint8, private ProtocolData) ProtocolData

	// Called when the FIN flag is seen in the TCP stream.
	ReceivedFin(tcptuple *common.TcpTuple, dir uint8,
		private ProtocolData) ProtocolData

	// Called when a packets are missing from the tcp
	// stream.
	GapInStream(tcptuple *common.TcpTuple, dir uint8, nbytes int,
		private ProtocolData) (priv ProtocolData, drop bool)
}

Functions to be exported by a protocol plugin

type Protocols

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

list of protocol plugins

var Protos Protocols

Singleton of Protocols type.

func (Protocols) Get

func (protocols Protocols) Get(proto Protocol) ProtocolPlugin

func (Protocols) GetAll added in v1.0.0

func (protocols Protocols) GetAll() map[Protocol]ProtocolPlugin

func (Protocols) Register

func (protos Protocols) Register(proto Protocol, plugin ProtocolPlugin)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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