Documentation ¶
Overview ¶
Package smparser provides message parsers for the state machine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingResultCode is returned by Parse when // the message does nt contain a Result-Code AVP. ErrMissingResultCode = errors.New("missing Result-Code") // ErrMissingOriginHost is returned by Parse when // the message does not contain an Origin-Host AVP. ErrMissingOriginHost = errors.New("missing Origin-Host") // ErrMissingOriginRealm is returned by Parse when // the message does not contain an Origin-Realm AVP. ErrMissingOriginRealm = errors.New("missing Origin-Realm") // ErrMissingApplication is returned by Parse when // the CER does not contain any Acct-Application-Id or // Auth-Application-Id, or their embedded versions in // the Vendor-Specific-Application-Id AVP. ErrMissingApplication = errors.New("missing application") // ErrNoCommonSecurity is returned by Parse when // the CER contains the Inband-Security-Id. // We currently don't support that. ErrNoCommonSecurity = errors.New("no common security") // ErrNoCommonApplication is returned by Parse when the // application IDs in the CER don't match the applications // defined in our dictionary. ErrNoCommonApplication = errors.New("no common application") )
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { AcctApplicationID []*diam.AVP AuthApplicationID []*diam.AVP VendorSpecificApplicationID []*diam.AVP // contains filtered or unexported fields }
Application validates accounting, auth, and vendor specific application IDs.
func (*Application) ID ¶
func (app *Application) ID() []uint32
ID returns a list of supported application IDs. Must be called after Parse, otherwise it returns an empty array.
type CEA ¶
type CEA struct { ResultCode uint32 `avp:"Result-Code"` OriginHost datatype.DiameterIdentity `avp:"Origin-Host"` OriginRealm datatype.DiameterIdentity `avp:"Origin-Realm"` OriginStateID uint32 `avp:"Origin-State-Id"` AcctApplicationID []*diam.AVP `avp:"Acct-Application-Id"` AuthApplicationID []*diam.AVP `avp:"Auth-Application-Id"` VendorSpecificApplicationID []*diam.AVP `avp:"Vendor-Specific-Application-Id"` FailedAVP []*diam.AVP `avp:"Failed-AVP"` ErrorMessage string `avp:"Error-Message"` // contains filtered or unexported fields }
CEA is a Capabilities-Exchange-Answer message. See RFC 6733 section 5.3.2 for details.
func (*CEA) Applications ¶
Applications return a list of supported Application IDs.
type CER ¶
type CER struct { OriginHost datatype.DiameterIdentity `avp:"Origin-Host"` OriginRealm datatype.DiameterIdentity `avp:"Origin-Realm"` OriginStateID *diam.AVP `avp:"Origin-State-Id"` InbandSecurityID *diam.AVP `avp:"Inband-Security-Id"` AcctApplicationID []*diam.AVP `avp:"Acct-Application-Id"` AuthApplicationID []*diam.AVP `avp:"Auth-Application-Id"` VendorSpecificApplicationID []*diam.AVP `avp:"Vendor-Specific-Application-Id"` // contains filtered or unexported fields }
CER is a Capabilities-Exchange-Request message. See RFC 6733 section 5.3.1 for details.
func (*CER) Applications ¶
Applications return a list of supported Application IDs.
func (*CER) Parse ¶
Parse parses and validates the given message, and returns nil when all AVPs are ok, and all accounting or authentication applications in the CER match the applications in our dictionary. If one or more mandatory AVPs are missing, it returns a nil failedAVP and a proper error. If all mandatory AVPs are present but no common application is found, then it returns the failedAVP (with the application that we don't support in our dictionary) and an error. Another cause for error is the presence of Inband Security, we don't support that.
type DWA ¶
type DWA struct { ResultCode uint32 `avp:"Result-Code"` OriginStateID uint32 `avp:"Origin-State-Id"` }
DWA is a Device-Watchdog-Answer message. See RFC 6733 section 5.5.2 for details.
type DWR ¶
type DWR struct { OriginHost datatype.DiameterIdentity `avp:"Origin-Host"` OriginRealm datatype.DiameterIdentity `avp:"Origin-Realm"` OriginStateID *diam.AVP `avp:"Origin-State-Id"` }
DWR is a Device-Watchdog-Request message. See RFC 6733 section 5.5.1 for details.
type ErrFailedResultCode ¶
type ErrFailedResultCode struct {
*CEA
}
ErrFailedResultCode is returned by Dial or DialTLS when the handshake answer (CEA) contains a Result-Code AVP that is not success (2001).
func (ErrFailedResultCode) Error ¶
func (e ErrFailedResultCode) Error() string
Error implements the error interface.
type ErrUnexpectedAVP ¶
ErrUnexpectedAVP is returned by Parse when the code of the AVP passed as AcctApplicationID, AuthApplicationID or VendorSpecificApplicationID and its embedded AVPs do not match their names.
func (*ErrUnexpectedAVP) Error ¶
func (e *ErrUnexpectedAVP) Error() string
Error implements the error interface.