thrift

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2015 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionsHashSize = 2 ^ 16
	TransactionTimeout   = 10 * 1e9
)
View Source
const (
	ThriftStartState = iota
	ThriftFieldState
)
View Source
const (
	ThriftVersionMask = 0xffff0000
	ThriftVersion1    = 0x80010000
	ThriftTypeMask    = 0x000000ff
)
View Source
const (
	ThriftTypeStop   = 0
	ThriftTypeVoid   = 1
	ThriftTypeBool   = 2
	ThriftTypeByte   = 3
	ThriftTypeDouble = 4
	ThriftTypeI16    = 6
	ThriftTypeI32    = 8
	ThriftTypeI64    = 10
	ThriftTypeString = 11
	ThriftTypeStruct = 12
	ThriftTypeMap    = 13
	ThriftTypeSet    = 14
	ThriftTypeList   = 15
	ThriftTypeUtf8   = 16
	ThriftTypeUtf16  = 17
)

Thrift types

View Source
const (
	ThriftMsgTypeCall
	ThriftMsgTypeReply
	ThriftMsgTypeException
	ThriftMsgTypeOneway
)

Thrift message types

View Source
const (
	ThriftTBinary  = 1
	ThriftTCompact = 2
)

Thrift protocol types

View Source
const (
	ThriftTSocket = 1
	ThriftTFramed = 2
)

Thrift transport types

Variables

This section is empty.

Functions

func BuildMethodsMap

func BuildMethodsMap(thrift_files map[string]parser.Thrift) map[string]*ThriftIdlMethod

func ReadFiles

func ReadFiles(files []string) (map[string]parser.Thrift, error)

Types

type Thrift

type Thrift struct {

	// config
	StringMaxSize          int
	CollectionMaxSize      int
	DropAfterNStructFields int
	CaptureReply           bool
	ObfuscateStrings       bool
	Send_request           bool
	Send_response          bool

	TransportType byte
	ProtocolType  byte

	PublishQueue chan *ThriftTransaction

	Idl *ThriftIdl
	// contains filtered or unexported fields
}
var ThriftMod Thrift

func (*Thrift) GapInStream

func (thrift *Thrift) GapInStream(tcptuple *common.TcpTuple, dir uint8,
	private protos.ProtocolData) protos.ProtocolData

func (*Thrift) Init

func (thrift *Thrift) Init(test_mode bool, results chan common.MapStr) error

func (*Thrift) InitDefaults

func (thrift *Thrift) InitDefaults()

func (*Thrift) Parse

func (thrift *Thrift) Parse(pkt *protos.Packet, tcptuple *common.TcpTuple, dir uint8,
	private protos.ProtocolData) protos.ProtocolData

func (*Thrift) ReceivedFin

func (thrift *Thrift) ReceivedFin(tcptuple *common.TcpTuple, dir uint8,
	private protos.ProtocolData) protos.ProtocolData

type ThriftField

type ThriftField struct {
	Type byte
	Id   uint16

	Value string
}

type ThriftFieldReader

type ThriftFieldReader func(data []byte) (value string, ok bool, complete bool, off int)

Functions to decode simple types They all have the same signature, returning the string value and the number of bytes consumed (off).

type ThriftIdl

type ThriftIdl struct {
	MethodsByName map[string]*ThriftIdlMethod
}

func NewThriftIdl

func NewThriftIdl(idl_files []string) (*ThriftIdl, error)

func (*ThriftIdl) FindMethod

func (thriftidl *ThriftIdl) FindMethod(name string) *ThriftIdlMethod

type ThriftIdlMethod

type ThriftIdlMethod struct {
	Service *parser.Service
	Method  *parser.Method

	Params     []*string
	Exceptions []*string
}

type ThriftMessage

type ThriftMessage struct {
	Ts time.Time

	TcpTuple     common.TcpTuple
	CmdlineTuple *common.CmdlineTuple
	Direction    uint8

	IsRequest    bool
	HasException bool
	Version      uint32
	Type         uint32
	Method       string
	SeqId        uint32
	Params       string
	ReturnValue  string
	Exceptions   string
	FrameSize    uint32
	Service      string
	// contains filtered or unexported fields
}

func (*ThriftMessage) String

func (m *ThriftMessage) String() string

type ThriftStream

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

func (*ThriftStream) PrepareForNewMessage

func (stream *ThriftStream) PrepareForNewMessage(flush bool)

type ThriftTransaction

type ThriftTransaction struct {
	Type string

	Src          common.Endpoint
	Dst          common.Endpoint
	ResponseTime int32
	Ts           int64
	JsTs         time.Time

	Request *ThriftMessage
	Reply   *ThriftMessage
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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