sgsip

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

SIPExer Generic SIP Parsing Library

Index

Constants

View Source
const (
	SGSIPRetOK = 0

	// generic errors
	SGSIPRetErr      = -1
	SGSIPRetNotFound = -2

	// first line parse errors
	SGSIPRetErrFLineShort          = -100
	SGSIPRetErrFLineFormat         = -101
	SGSIPRetErrFLineRequestFormat  = -102
	SGSIPRetErrFLineResponseShort  = -103
	SGSIPRetErrFLineResponseFormat = -104
	SGSIPRetErrFLineResponseCode   = -105

	// sip params parse errors
	SGSIPRetErrParamFormat   = -140
	SGSIPRetErrParamNotFound = -141

	// socket address error
	SGSIPRetErrSocketAddressPort    = -200
	SGSIPRetErrSocketAddressPortVal = -201
	SGSIPRetErrSocketAddressAFIPv6  = -202

	// uri errors
	SGSIPRetErrURI       = -220
	SGSIPRetErrURIUser   = -221
	SGSIPRetErrURIAFIPv6 = -222
	SGSIPRetErrURIPort   = -223
	SGSIPRetErrURIFormat = -224
	SGSIPRetErrURIProto  = -225

	// header errors
	SGSIPRetErrHeaderLength = -240
	SGSIPRetErrHeaderEmpty  = -241
	SGSIPRetErrHeaderFormat = -242
	SGSIPRetErrHeaderName   = -243
	SGSIPRetErrHeaderEoL    = -244

	// body errors
	SGSIPRetErrBody = -260

	// cseq errors
	SGSIPRetErrCSeqBody   = -280
	SGSIPRetErrCSeqNumber = -281

	// sip message errors
	SGSIPRetErrMessageNotSet = -300
)

return and error code values

View Source
const (
	ProtoNONE = iota
	ProtoUDP
	ProtoTCP
	ProtoTLS
	ProtoSCTP
	ProtoWS
	ProtoWSS
)
View Source
const (
	AFNONE = 0
	AFIPv4 = 4
	AFIPv6 = 6
	AFHost = 8
)
View Source
const (
	SchemaNONE = iota
	SchemaSIP
	SchemaSIPS
	SchemaTEL
)
View Source
const (
	ParamValNone = iota
	ParamValBare
	ParamValQuoted
)
View Source
const (
	FLineNone = iota
	FLineRequest
	FLineResponse
)
View Source
const (
	SIPMethodNONE = iota
	SIPMethodINVITE
	SIPMethodACK
	SIPMethodBYE
	SIPMethodCANCEL
	SIPMethodREGISTER
	SIPMethodMESSAGE
	SIPMethodOPTIONS
	SIPMethodINFO
	SIPMethodUPDATE
	SIPMethodSUBSCRIBE
	SIPMethodNOTIFY
	SIPMethodPUBLISH
	SIPMethodPRACK
	SIPMethodOTHER
)
View Source
const (
	HeaderTypeNone = iota
	HeaderTypeCallID
	HeaderTypeCSeq
	HeaderTypeFrom
	HeaderTypeTo
	HeaderTypeVia
	HeaderTypeContact
	HeaderTypeSubject
	HeaderTypeContentLength
	HeaderTypeContentType
	HeaderTypeContentEncoding
	HeaderTypeAcceptContact
	HeaderTypeReferTo
	HeaderTypeReferredBy
	HeaderTypeEvent
	HeaderTypeAllowEvents
	HeaderTypeSupported
	HeaderTypeRecordRoute
	HeaderTypeRoute
	HeaderTypeExpires
	HeaderTypeUserAgent
	HeaderTypeOther
)
View Source
const (
	SGSIPMFlagNone      = 0
	SGSIPMFlagLateOffer = 1
)

message flags

Variables

This section is empty.

Functions

func SGAddrType

func SGAddrType(addr string) int

Quick detection of ip/address type

func SGAddrTypeEx

func SGAddrTypeEx(addr string) int

Quick detection of ip/address type also with IPv6 square brackets

func SGSIPACKToByeString

func SGSIPACKToByeString(ackReq *SGSIPMessage, outputStr *string) int

SGSIPACKToByeString --

func SGSIPHeaderGetType

func SGSIPHeaderGetType(name string) int

SGSIPHeaderGetType --

func SGSIPHeaderParseDigestAuthBody

func SGSIPHeaderParseDigestAuthBody(hbody string) map[string]string

SGSIPHeaderParseDigestAuthBody - parse www/proxy-authenticate header body. Return a map of parameters or nil if the header is not Digest auth header.

func SGSIPHeaderValidName

func SGSIPHeaderValidName(name string) bool

SGSIPValidHeaderName --

func SGSIPInviteToACKString

func SGSIPInviteToACKString(invReq *SGSIPMessage, invRpl *SGSIPMessage, outputStr *string) int

SGSIPInviteToACKString --

func SGSIPMessageCSeqParse

func SGSIPMessageCSeqParse(msgVal *SGSIPMessage) int

SGSIPMessageCSeqParse --

func SGSIPMessageCSeqUpdate

func SGSIPMessageCSeqUpdate(msgVal *SGSIPMessage, ival int) int

SGSIPMessageCSeqUpdate --

func SGSIPMessageGetContactURI

func SGSIPMessageGetContactURI(msgVal *SGSIPMessage, cturi *string) int

SGSIPMessageGetContactURI --

func SGSIPMessageHeaderGet

func SGSIPMessageHeaderGet(msgVal *SGSIPMessage, hname string, hbody *string) int

SGSIPMessageHeaderGet --

func SGSIPMessageHeaderSet

func SGSIPMessageHeaderSet(msgVal *SGSIPMessage, hname string, hbody string) int

SGSIPMessageHeaderSet --

func SGSIPMessageToResponseString

func SGSIPMessageToResponseString(sipReq *SGSIPMessage, scode string, sreason string, outputStr *string) int

func SGSIPMessageToString

func SGSIPMessageToString(msgVal *SGSIPMessage, outputStr *string) int

SGSIPMessageToString --

func SGSIPMessageViaUpdate

func SGSIPMessageViaUpdate(msgObj *SGSIPMessage) int

SGSIPMessageViaUpdate --

func SGSIPParamsGet

func SGSIPParamsGet(paramStr string, paramName string, vmode int, paramVal *SGSIPParam) int

SGSIPParamsGet --

func SGSIPParseBody

func SGSIPParseBody(inputStr string, bodyVal *SGSIPBody) int

SGSIPParseBody --

func SGSIPParseFirstLine

func SGSIPParseFirstLine(inputStr string, flineVal *SGSIPFirstLine) int

SGSIPParseFirstLine --

func SGSIPParseHeaders

func SGSIPParseHeaders(inputStr string, pMode int, headersList *[]SGSIPHeader) int

SGSIPParseHeader --

func SGSIPParseMessage

func SGSIPParseMessage(inputStr string, msgVal *SGSIPMessage) int

SGSIPParseMessage --

func SGSIPParseSocketAddress

func SGSIPParseSocketAddress(sockstr string, sockaddr *SGSIPSocketAddress) int

SGSIPParseSocketAddress --

func SGSIPParseURI

func SGSIPParseURI(uristr string, uri *SGSIPURI) int

SGSIPParseURI --

func SGSIPSetMethodId

func SGSIPSetMethodId(method string, methodid *int)

SGSIPSetMethodId --

func SGSIPSetProto

func SGSIPSetProto(protostr string, protoval *string, protoid *int) int

SGSIPSetProto --

func SGSIPSetSchema

func SGSIPSetSchema(schemastr string, schemaval *string, schemaid *int) int

SGSIPSetSchema --

func SGSIPURIToSocketAddress

func SGSIPURIToSocketAddress(uri *SGSIPURI, sockaddr *SGSIPSocketAddress) int

SGSIPURIToSocketAddress --

func SGSocketAddressToSIPURI

func SGSocketAddressToSIPURI(sockaddr *SGSIPSocketAddress, user string, tmode int, uri *SGSIPURI) int

SGSocketAddressToSIPURI --

Types

type SGSIPBody

type SGSIPBody struct {
	Content     string
	ContentLen  int
	ContentType string
}

type SGSIPCSeq

type SGSIPCSeq struct {
	Number   int
	Method   string
	MethodId int
}

type SGSIPFirstLine

type SGSIPFirstLine struct {
	Val      string
	MType    int
	Proto    string
	Method   string
	MethodId int
	URI      string
	Code     int    // status code number
	CodeVal  string // status code string
	Reason   string
}

type SGSIPHeader

type SGSIPHeader struct {
	Name  string
	Body  string
	HType int
}

type SGSIPMessage

type SGSIPMessage struct {
	Data    string
	FLine   SGSIPFirstLine
	RURI    SGSIPURI
	Headers []SGSIPHeader
	CSeq    SGSIPCSeq
	Body    SGSIPBody
	MFlags  int
}

type SGSIPParam

type SGSIPParam struct {
	Name  string
	Value string
	PMode int
}

type SGSIPSocketAddress

type SGSIPSocketAddress struct {
	Val     string
	Proto   string
	Addr    string
	Port    string
	PortNo  int
	AType   int
	ProtoId int
}

type SGSIPURI

type SGSIPURI struct {
	Val      string
	Schema   string
	SchemaId int
	User     string
	Addr     string
	Port     string
	PortNo   int
	Params   string
	UParams  string
	Proto    string
	ProtoId  int
	AType    int
}

Jump to

Keyboard shortcuts

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