decoder

package
v1.66.6 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version   = 1  // Chunk 0x0001 IP protocol family (0x02=IPv4, 0x0a=IPv6)
	Protocol  = 2  // Chunk 0x0002 IP protocol ID (0x06=TCP, 0x11=UDP)
	IP4SrcIP  = 3  // Chunk 0x0003 IPv4 source address
	IP4DstIP  = 4  // Chunk 0x0004 IPv4 destination address
	IP6SrcIP  = 5  // Chunk 0x0005 IPv6 source address
	IP6DstIP  = 6  // Chunk 0x0006 IPv6 destination address
	SrcPort   = 7  // Chunk 0x0007 Protocol source port
	DstPort   = 8  // Chunk 0x0008 Protocol destination port
	Tsec      = 9  // Chunk 0x0009 Unix timestamp, seconds
	Tmsec     = 10 // Chunk 0x000a Unix timestamp, microseconds
	ProtoType = 11 // Chunk 0x000b Protocol type (DNS, LOG, RTCP, SIP)
	NodeID    = 12 // Chunk 0x000c Capture client ID
	NodePW    = 14 // Chunk 0x000e Authentication key (plain text / TLS connection)
	Payload   = 15 // Chunk 0x000f Captured packet payload
	CID       = 17 // Chunk 0x0011 Correlation ID
	Vlan      = 18 // Chunk 0x0012 VLAN
	NodeName  = 19 // Chunk 0x0013 NodeName
)

HEP chuncks

Variables

View Source
var NotSIP = errors.New("not SIP")
View Source
var (
	PacketQueue = make(chan *Packet, 20000)
)
View Source
var SIPTruncated = errors.New("not SIP")
View Source
var SIP_REQUEST_METHOD = []string{
	"INVITE",
	"REGISTER",
	"ACK",
	"BYE",
	"CANCEL",
	"OPTIONS",
	"PUBLISH",
	"INFO",
	"PRACK",
	"SUBSCRIBE",
	"NOTIFY",
	"UPDATE",
	"MESSAGE",
	"REFER",
}
View Source
var SIP_RESPONSE_TEXT = []string{
	"OK",
	"TRYING",
	"GIVING A TRY",
	"CANCEL",
	"CANCELING",
	"RINGING",
	"REQUEST TERMINATED",
	"SESSION PROGRESS",
	"UNAUTHORIZED",
	"BUSY HERE",
	"TEMPORARILY UNAVAILABLE",
	"CALL DOES NOT EXIST",
	"LOOP DETECTED",
	"ADDRESS INCOMPLETE",
	"NOT ACCEPTABLE HERE",
	"INTERNAL SERVER ERROR",
	"DECLINE",
	"DOES NOT EXIST ANYWHERE",
	"REG NOT FOUND",
	"NOT ACCEPTABLE",
	"NOT FOUND",
	"CALL LEG/TRANSACTION DOES NOT EXIST",
	"UNHANDLED BY DIALOG USAGES",
	"ACCEPTED",
	"REQUEST TIMEOUT",
	"BAD REQUEST",
	"FORBIDDEN",
	"INVALID CSEQ",
	"REQUEST CANCELLED",
	"DEFAULT STATUS MESSAGE",
	"OVERLAPPING REQUESTS",
	"REQUEST PENDING",
	"PAYMENT REQUIRED",
	"UNSUPPORTED MEDIA TYPE",
	"GATEWAY TIME-OUT",
	"MOVED TEMPORARILY",
	"CALL IS BEING TERMINATED",
	"TOO MANY HOPS",
	"BAD GATEWAY",
	"NOT IMPLEMENTED",
	"SESSION TERMINATED",
	"CALL/TRANSACTION DOES NOT EXIST",
	"PRECONDITION FAILURE",
	"BAD SESSION DESCRIPTION",
	"NEXT SERVICE  TEMPORARILY UNAVAILABLE",
}

Functions

func HashString added in v1.66.1

func HashString(algo, s string) string

HashString returns md5, sha1 or sha256 sum

func HashTable added in v1.66.1

func HashTable(op, key, val string) string

HashTable is a simple kv store

func SIPMessage added in v1.66.1

func SIPMessage(data []byte) ([]byte, error)

Types

type CachePayload added in v1.65.10

type CachePayload struct {
	SrcIP         net.IP `json:"src_ip" default:""`
	SrcPort       uint16 `json:"src_port"`
	DstIP         net.IP `json:"dst_ip"`
	DstPort       uint16 `json:"dst_port"`
	AckNumber     uint32 `json:"ack_number"`
	SeqNumber     uint32 `json:"seq_number"`
	NextSeqNumber uint32 `json:"next_seq_number"`
	RemainLength  int    `json:"remain_length" default:"-1"`
	FrameCount    int    `json:"frame_count" default:"0"`
	Payload       []byte `json:"payload"`
}

type Context

type Context struct {
	CaptureInfo gopacket.CaptureInfo
}

func (*Context) GetCaptureInfo

func (c *Context) GetCaptureInfo() gopacket.CaptureInfo

type Decoder

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

func NewDecoder

func NewDecoder(datalink layers.LinkType) *Decoder

func (*Decoder) Process

func (d *Decoder) Process(data []byte, ci *gopacket.CaptureInfo)

func (*Decoder) ProcessHEPPacket

func (d *Decoder) ProcessHEPPacket(data []byte)

func (*Decoder) SendExitHEPPacket added in v1.66.4

func (d *Decoder) SendExitHEPPacket()

func (*Decoder) SendPingHEPPacket added in v1.65.3

func (d *Decoder) SendPingHEPPacket()

type HEP

type HEP struct {
	Version     uint32 `protobuf:"varint,1,req,name=Version" json:"Version"`
	Protocol    uint32 `protobuf:"varint,2,req,name=Protocol" json:"Protocol"`
	SrcIP       string `protobuf:"bytes,3,req,name=SrcIP" json:"SrcIP"`
	DstIP       string `protobuf:"bytes,4,req,name=DstIP" json:"DstIP"`
	SrcPort     uint32 `protobuf:"varint,5,req,name=SrcPort" json:"SrcPort"`
	DstPort     uint32 `protobuf:"varint,6,req,name=DstPort" json:"DstPort"`
	Tsec        uint32 `protobuf:"varint,7,req,name=Tsec" json:"Tsec"`
	Tmsec       uint32 `protobuf:"varint,8,req,name=Tmsec" json:"Tmsec"`
	ProtoType   uint32 `protobuf:"varint,9,req,name=ProtoType" json:"ProtoType"`
	NodeID      uint32 `protobuf:"varint,10,req,name=NodeID" json:"NodeID"`
	NodePW      string `protobuf:"bytes,11,req,name=NodePW" json:"NodePW"`
	Payload     string `protobuf:"bytes,12,req,name=Payload" json:"Payload"`
	CID         string `protobuf:"bytes,13,req,name=CID" json:"CID"`
	Vlan        uint32 `protobuf:"varint,14,req,name=Vlan" json:"Vlan"`
	ProtoString string
	Timestamp   time.Time
	SIP         string
	NodeName    string
	TargetName  string
	SID         string
}

HEP represents HEP packet

func DecodeHEP

func DecodeHEP(packet []byte) (*HEP, error)

DecodeHEP returns a parsed HEP message

type LuaEngine added in v1.66.1

type LuaEngine struct {
	LuaEngine *lua.State
	// contains filtered or unexported fields
}

LuaEngine

func NewLuaEngine added in v1.66.1

func NewLuaEngine() (*LuaEngine, error)

NewLuaEngine returns the script engine struct

func (*LuaEngine) Close added in v1.66.1

func (d *LuaEngine) Close()

func (*LuaEngine) GetHEPDstIP added in v1.66.1

func (d *LuaEngine) GetHEPDstIP() string

func (*LuaEngine) GetHEPDstPort added in v1.66.1

func (d *LuaEngine) GetHEPDstPort() uint16

func (*LuaEngine) GetHEPProtoType added in v1.66.1

func (d *LuaEngine) GetHEPProtoType() uint32

func (*LuaEngine) GetHEPSrcIP added in v1.66.1

func (d *LuaEngine) GetHEPSrcIP() string

func (*LuaEngine) GetHEPSrcPort added in v1.66.1

func (d *LuaEngine) GetHEPSrcPort() uint16

func (*LuaEngine) GetHEPTimeSeconds added in v1.66.1

func (d *LuaEngine) GetHEPTimeSeconds() uint32

func (*LuaEngine) GetHEPTimeUseconds added in v1.66.1

func (d *LuaEngine) GetHEPTimeUseconds() uint32

func (*LuaEngine) GetRawMessage added in v1.66.1

func (d *LuaEngine) GetRawMessage() string

func (*LuaEngine) Logp added in v1.66.1

func (d *LuaEngine) Logp(level string, message string, data interface{})

func (*LuaEngine) Run added in v1.66.1

func (d *LuaEngine) Run(pkt *Packet) error

Run will execute the script

func (*LuaEngine) SetHEPField added in v1.66.1

func (d *LuaEngine) SetHEPField(field string, value string)

func (*LuaEngine) SetRawMessage added in v1.66.1

func (d *LuaEngine) SetRawMessage(value string)

type Packet

type Packet struct {
	Version   byte
	Protocol  byte
	SrcIP     net.IP
	DstIP     net.IP
	SrcPort   uint16
	DstPort   uint16
	Tsec      uint32
	Tmsec     uint32
	ProtoType byte
	Payload   []byte
	CID       []byte
	Vlan      uint16
}

func (*Packet) GetCID added in v1.66.1

func (pkt *Packet) GetCID() string

func (*Packet) GetDstIP added in v1.66.1

func (pkt *Packet) GetDstIP() string

func (*Packet) GetDstPort added in v1.66.1

func (pkt *Packet) GetDstPort() uint16

func (*Packet) GetPayload added in v1.66.1

func (pkt *Packet) GetPayload() string

func (*Packet) GetProtoType added in v1.66.1

func (pkt *Packet) GetProtoType() uint32

func (*Packet) GetProtocol added in v1.66.1

func (pkt *Packet) GetProtocol() uint32

func (*Packet) GetSrcIP added in v1.66.1

func (pkt *Packet) GetSrcIP() string

func (*Packet) GetSrcPort added in v1.66.1

func (pkt *Packet) GetSrcPort() uint16

func (*Packet) GetTmsec added in v1.66.1

func (pkt *Packet) GetTmsec() uint32

func (*Packet) GetTsec added in v1.66.1

func (pkt *Packet) GetTsec() uint32

func (*Packet) GetVersion added in v1.66.1

func (pkt *Packet) GetVersion() uint32

Packet

func (*Packet) MarshalJSON

func (p *Packet) MarshalJSON() ([]byte, error)

MarshalJSON implements json marshal functions for Packet

type ScriptEngine added in v1.66.1

type ScriptEngine interface {
	Run(pkt *Packet) error
	Close()
}

ScriptEngine interface

func NewScriptEngine added in v1.66.1

func NewScriptEngine() (ScriptEngine, error)

NewScriptEngine returns a script interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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