# README
sipsp
This go modules provides SIP message "stream" parsing functions.
It supports parsing partial SIP messages received on streams: if the parsing functions detect an incomplete message, they will signal this through the return values and parsing can be latter resumed fromt the point where it stopped.
# Functions
BUG is a shorthand for logging a bug message.
ContainsIP4 checks if a []byte string contains an ipv4 address.
ContainsIP6 checks if a []byte string contains an ipv6 address.
DBG is a shorthand for logging a debug message.
DBGon() is a shorthand for checking if generic debug logging is enabled.
ERR is a shorthand for logging an error message.
GetCallIDSig returns a call-id sig and a sig len (call-id lenght w/o ip).
GetHdrSigId returns the header signature id for the header h.
GetHdrType returns the corresponding HdrT type for a given header name.
GetMethodNo converts from an ASCII SIP method name to the corresponding numeric internal value.
GetMsgSig returns a MsgSig structure containing the message signature.
GetPField returns a byte slice for the corresponding field f, pointing inside buf.
GetViaBrSig returns a via branch sig and a sig len.
IP4Prefix checks if a []byte string starts with an ipv4 address.
IP6Prefix checks if a []byte string starts with an ipv6 address.
ParseAllContactValues tries to parse all the values in a contact header situated at offs in buf and add them to the passed PContacts.
ParseAllPAIValues tries to parse all the values in a PAI header situated at offs in buf and add them to the passed PPAIs.
ParseAllURIHdrs tries to parse buf[offs:] as a list of uri headers and add them to the passed URIHdrsLst.
ParseAllURIParams tries to parse buf[offs:] as a list of uri parameters and add them to the passed URIParamsLst.
ParseCallIDVal parses the value/content of a Callid header.
ParseCLenVal parses a Content-Length header value, starting at offs in buf and filling pcl.
ParseCSeqVal parses the value/content of a CSeq header.
ParseExpiresVal parses an Expires header value, starting at offs in buf.
ParseFLine parses the request/response line (first line) of a SIP message.
ParseFromVal parses the value of a From header.
ParseHdrLine parses a header from a SIP message.
ParseHeaders parses all the headers till end of header marker (double CRLF).
ParseNameAddrPVal parses the value/content of a From, To, Contact, Record-Router or Route header.
ParseOneContact parses the content of one Contact vale, found at offset offs in buf.
ParseOnePAI parses the content of one PAI vale, found at offset offs in buf.
ParseSIPMsg parses a SIP message contained in buf[], starting at offset offs.
ParseTokenParam will parse a string of the form param [= value] [;] .
ParseUIntVal parses the value/content of a header containing an uint (e.g.
ParseURI parses a sip uri into a PSIPUri structure.
SkipQuoted skips a quoted string, looking for the end quote.
URICmp compares 2 URIs, taking into account the passed flags.
URICmpShort compares 2 "shortened" uris (up to port, not including parameters or headers).
URIHdrsEq will parse & compare 2 uri headers lists.
URIHdrsLstEq returns true if 2 parsed uri headers lists are equal according to rfc3261 19.1.4.
URIParamResolve will try to resolve/parse a uri parameter value to the correponding numeric URIParamF flag.
URIParamsEq will parse & compare a uri parameteres list.
URIParamsLstEq returns true if 2 parsed uri parameters lists are equal according to rfc3261 19.1.4.
URIParseCmp parses 2 []byte string as URIs and compares them.
URIRawCmp compares 2 un-parsed URIs.
WARN is a shorthand for logging a warning message.
# Constants
Possible error value for header parsing functions.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
empty header (e.g.
header end.
more input needed (premature end).
more contacts, call again.
no Content-Length header and Content-Length required.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
no error, equiv.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
Possible error value for header parsing functions.
Possible error values.
Possible error values.
Possible error values.
Possible error values.
Possible error values.
Possible error values.
Possible error values.
Possible error values.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
generic, non recognized header.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
mask for the compact format bit in the hdr.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
HdrT header types constants.
HdrFlags constants for each header type.
enum.
method types.
numeric max.
MaxCLenValueSize holds the maximum length of the Content-Length value interpreted as string (more then 9 can overflow and uint32).
numeric max.
MaxCSeqNValueSize holds the maximum length of the CSeq value interpreted as string (more then 9 can overflow and uint32).
method types.
method types.
method types.
method types.
method types.
method types.
method types.
last.
method types.
method types.
method types.
method types.
method types.
method types.
method types.
No description provided by the author
Possible error values.
inputs end at end of buf.
parsing flags.
param.
param.
comma is a terminator.
'?' is a terminator.
whitespace is a terminator.
parse as uri hdr ('&' sep).
parse as uri param.
base 64 encoding.
composed of multiple digits blocks.
@.
:.
-.
/.
.
=.
|.
+.
*.
_.
hex encoding.
No description provided by the author
No description provided by the author
No description provided by the author
Parsing states.
error if SIPMsgSkipBodyF and no CLen.
Parsing states.
fully parsed.
Parsing states.
Parsing states.
Parsing states.
no Content-Length and Content-Length required.
no more message data, stop at end of buf.
don't parse the body (return offset = body start).
enum.
enum.
enum.
URICmpFlags flags values.
URICmpFlags flags values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
not "parsed".
unknown/other.
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
Log is the generic log.
Method2Name translates between a numeric SIPMethod and the ASCII name.
# Structs
Hdr contains a partial or fully parsed header.
HdrIState contains internal header parsing state.
HdrLst groups a list of parsed headers.
HdrLstIState contains internal HdrLst parsing state.
MsgSig contains the message signature.
PCallIDBody holds a partially or fully parsed Call-ID body.
PCallIDIState contains ParseCallIDVal internal state info (private).
PContacts contains the parsed Contact header values for one or more different Contact headers (all the contacts in the message that fit in the parsed value array).
PCSeqBody contains a partially or fully parsed CSeq header value.
PCSeqIState contains ParseCLenVal internal state info (private).
PField is the type for parsed fields (like host, to body a.s.o.).
PFLine contains the parsed first line of a SIP message (request or reply).
PFLineIState contains internal parsing state associated to a PFLine.
PFromBody is used to hold a fully or partially parsed From, To, Contact, RR or Route.
PFromIState contains ParseFrom internal state info (private).
PHdrVals holds all the header specific parsed values structures.
No description provided by the author
PSIPMsg contains a fully or partially parsed SIP message.
PsipURI is a structure containing sip uri elements (scheme, user, host...).
PTokParam contains a parameter (from a ';' separated name=val list) E.g.
PUIntBody holds a partial or fully parsed unsigned int header value.
PUIntIState contains ParseUIntVal internal state info (private).
SIPMsgIState holds the internal parsing state.
URIHdrsLst contains the parsed uri headers (?h1&h2&h3...).
URIParam contains a parsed uri param and the correponding numeric type.
URIParamsLst contains the parsed uri parameters.
# Interfaces
PHBodies defines an interface for getting pointers to parsed bodies structs.
# Type aliases
ErrorHdr is the type for the errors returned by various header parsing functions.
ErrorURI is the type for the errors returned by Parse.
HdrFlags packs several header values into bit flags.
HdrSigId contains the header id used in a message header signature.
HdrT is used to hold the header type as a numeric constant.
OffsT is the type used for offset and length used internally in PField.
POptFlags contains various parsing options flags.
SIPMethod is the type used to hold the various SIP request methods.
SIPStr is the "string" type used by all the sip parsing functions.
StrSigId contains a signature for some string (e.g.
URICmpFlags is the type for URI comparisons flags.
URIHdr is the type used or holding a parsed uri header.
URIParamF is the type used for the known uri parameters converted to a "flags" numeric value (values are 2^k).
URIScheme is the type for possible uri schemes (sips, sip, tel...).