control

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package control implements control functions of UPnP for net-upnp-go.

Index

Constants

View Source
const (
	ErrorInvalidAction                = 401
	ErrorInvalidArgs                  = 402
	ErrorActionFailed                 = 501
	ErrorArgumentValueInvalid         = 600
	ErrorArgumentValueOutOfRange      = 601
	ErrorOptionalActionNotImplemented = 602
	ErrorOutOfMemory                  = 603
	ErrorHumanInterventionRequired    = 604
	ErrorStringArgumentTooLong        = 605
)
View Source
const (
	ResponseSuffix = "Response"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name        string
	ServiceType string
	Arguments   []*Argument
}

A Action represents a SOAP action.

func (*Action) MarshalXML

func (action *Action) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ActionControl

type ActionControl struct {
	Envelope Envelope `xml:"Envelope"`
}

A ActionControl represents an action Control.

func NewActionControl

func NewActionControl() *ActionControl

NewActionControl returns a new Control.

func (*ActionControl) GetAction

func (action *ActionControl) GetAction() (*Action, error)

GetAction returns an actions in the SOAP Control.

func (*ActionControl) SOAPContentString

func (action *ActionControl) SOAPContentString() (string, error)

SOAPContent returns a SOAP content string.

type ActionInnerXML

type ActionInnerXML struct {
	Innerxml string `xml:",innerxml"`
}

A Action represents arguments in as SOAP action.

type ActionRequest

type ActionRequest struct {
	*ActionControl
}

A ActionRequest represents an action request.

func NewActionRequest

func NewActionRequest() *ActionRequest

NewActionRequest returns a new Request.

func NewActionRequestFromSOAPBytes

func NewActionRequestFromSOAPBytes(soapReq []byte) (*ActionRequest, error)

NewActionRequestFromSOAPString returns a new Request.

type ActionResponse

type ActionResponse struct {
	*ActionControl
}

A ActionResponse represents an action request.

func NewActionResponse

func NewActionResponse() *ActionResponse

NewActionResponse returns a new response.

func NewActionResponseFromSOAPBytes

func NewActionResponseFromSOAPBytes(soapRes []byte) (*ActionResponse, error)

NewActionResponseFromSOAPString returns a new response.

type Argument

type Argument struct {
	Name  string
	Value string
}

A Argument represents arguments in as SOAP action.

func NewArgument

func NewArgument() *Argument

NewArgument returns a new argument.

type Envelope

type Envelope struct {
	XMLName xml.Name `xml:"Envelope"`
	Body    struct {
		XMLName  xml.Name `xml:"Body"`
		Innerxml string   `xml:",innerxml"`
		Action   Action
	}
}

A Envelope represents an Envelope.

func (*Envelope) MarshalXML

func (ev *Envelope) MarshalXML(e *xml.Encoder, env xml.StartElement) error

type ErrorEnvelope

type ErrorEnvelope struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
	Body    struct {
		XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
		Fault   struct {
			XMLName     xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"`
			FaultCode   string   `xml:"faultcode"`
			FaultString string   `xml:"faultstring"`
			Detail      struct {
				XMLName   xml.Name  `xml:"detail"`
				UPnPError UPnPError `xml:"urn:schemas-upnp-org:control-1-0 UPnPError"`
			}
		}
	}
}

A ErrorEnvelope represents an Envelope for error response.

func (*ErrorEnvelope) MarshalXML

func (ev *ErrorEnvelope) MarshalXML(e *xml.Encoder, env xml.StartElement) error

type ErrorResponse

type ErrorResponse struct {
	Envelope ErrorEnvelope `xml:"Envelope"`
}

A ErrorResponse represents an error response.

func NewErrorResponse

func NewErrorResponse() *ErrorResponse

NewErrorResponse returns a new error response.

func NewErrorResponseFromSOAPBytes

func NewErrorResponseFromSOAPBytes(soapStr []byte) (*ErrorResponse, error)

NewErrorResponseFromSOAPString returns a new error response.

func NewErrorResponseFromUPnPError

func NewErrorResponseFromUPnPError(upnpError *UPnPError) *ErrorResponse

NewErrorResponseFromUPnPError returns a new error response.

func (*ErrorResponse) GetUPnPError

func (res *ErrorResponse) GetUPnPError() (*UPnPError, error)

GetUPnPError returns an UPnP error.

func (*ErrorResponse) SOAPContentString

func (res *ErrorResponse) SOAPContentString() (string, error)

SOAPContent returns a SOAP content string.

type UPnPError

type UPnPError struct {
	XMLName     xml.Name `xml:"urn:schemas-upnp-org:control-1-0 UPnPError"`
	Code        int      `xml:"errorCode"`
	Description string   `xml:"errorDescription"`
}

func NewUPnPError

func NewUPnPError() *UPnPError

NewUPnPError returns a new null UPnPError.

func NewUPnPErrorFromCode

func NewUPnPErrorFromCode(code int) *UPnPError

NewUPnPErrorFromCode returns a new UPnPError from the specified code.

func (*UPnPError) Error

func (ue *UPnPError) Error() string

func (*UPnPError) GetCode

func (ue *UPnPError) GetCode() int

func (*UPnPError) GetDescription

func (ue *UPnPError) GetDescription() string

func (*UPnPError) MarshalXML

func (ue *UPnPError) MarshalXML(e *xml.Encoder, start xml.StartElement) error

Jump to

Keyboard shortcuts

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