Documentation ¶
Index ¶
- type Config
- type SOAPError
- type SOAPRespArgs
- type Server
- func (me *Server) BootID() uint32
- func (me *Server) ConfigID() uint32
- func (me *Server) Connect(ctx context.Context) (err error)
- func (me *Server) Disconnect(ctx context.Context)
- func (me *Server) Errors() <-chan error
- func (me *Server) HTTPHandleFunc(pattern string, handleFunc func(http.ResponseWriter, *http.Request))
- func (me *Server) PresentationHandleFunc(handleFunc func(http.ResponseWriter, *http.Request))
- func (me *Server) Run(ctx context.Context, wg *sync.WaitGroup)
- func (me *Server) SOAPHandleFunc(svcID string, act string, ...)
- func (me *Server) ServerString() (s string)
- func (me *Server) StateVariable(svcID, svName string) (StateVar, bool)
- type StateVar
- type UPnPErrorCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Interfaces contain the names of the network interfaces to be used. If // Interfaces is empty, all available interfaces will be used Interfaces []string // Port is the port where the server listens Port int // MaxAge is the validity time period of the SSDP advertisement in seconds MaxAge int // ProductName is the product name used for the server string ProductName string // ProductVersion is the product version for the server string ProductVersion string // StatusFile is the path to the JSON file that persists data such as // state variables StatusFile string // IconRootDir is the root directory for device icons. I.e. if the icon url // in the device description is someDir/icon.png, for example, the icon // must be located in IconRootDir/someDir/icon.png IconRootDir string }
Config represents the configuration of the UPnP server
type SOAPError ¶
type SOAPError struct { Code UPnPErrorCode Desc string }
SOAPError represents a SOAP error
type SOAPRespArgs ¶
SOAPRespArgs maps argument name to argument value
type Server ¶
type Server struct { Errs chan error Device *rootDevice // Locals contains variables that are persisted in the status.json of // yuppie Locals map[string]string // contains filtered or unexported fields }
Server represents the UPnP server
func New ¶
func New(cfg Config, rootDesc *desc.RootDevice, svcDescs desc.ServiceMap) (srv *Server, err error)
New creates a new instance of the UPnP server from a device description and service descriptions. Note: The keys of the service map must correspond to the service ids in the device description
func (*Server) Disconnect ¶
Disconnect stops the SSDP processes and the multicast eventing
func (*Server) HTTPHandleFunc ¶
func (me *Server) HTTPHandleFunc(pattern string, handleFunc func(http.ResponseWriter, *http.Request))
HTTPHandleFunc is a wrapper around http.ServeMux.HandleFunc. It allowes to register handler functions for HTTP requests for given patterns
func (*Server) PresentationHandleFunc ¶ added in v0.3.0
func (me *Server) PresentationHandleFunc(handleFunc func(http.ResponseWriter, *http.Request))
PresentationHandleFunc sets the handler function for HTTP calls to the presentation url of the root device
func (*Server) SOAPHandleFunc ¶
func (me *Server) SOAPHandleFunc(svcID string, act string, handler func(map[string]StateVar) (SOAPRespArgs, SOAPError))
SOAPHandleFunc allows to register functions to handle UPnP SOAP requests. Such handlers are defined per service ID / action combination
func (*Server) ServerString ¶
ServerString assembles the server string in the format "<OS>/<OS version> UPnP/<UPnP version> <product name>/<product version>"
type StateVar ¶
type StateVar interface { Type() string Init(interface{}) error Get() interface{} Set(interface{}) error SetFromString(string) error IsNumeric() bool IsString() bool IsZero() bool String() string Lock() Unlock() }
StateVar represents a SOAP variable (e.g. a SOAP state variable)
type UPnPErrorCode ¶
type UPnPErrorCode uint
UPnPErrorCode represents an UPnP error code
const ( // UPnPErrorInvalidAction is the code foran invalid action UPnPErrorInvalidAction UPnPErrorCode = 400 // UPnPErrorInvalidArgs is the code for invalid arguments UPnPErrorInvalidArgs UPnPErrorCode = 402 // UPnPErrorActionFailed is the code for a failed action UPnPErrorActionFailed UPnPErrorCode = 501 // UPnPErrorArgValInvalid is the code for an invalid argument value UPnPErrorArgValInvalid UPnPErrorCode = 600 // UPnPErrorArgValOutOfRange is the code for an argument value that is out // of range UPnPErrorArgValOutOfRange UPnPErrorCode = 601 // UPnPErrorOptActionNotImplemented is the code for an action that is // called but not implemented UPnPErrorOptActionNotImplemented UPnPErrorCode = 602 // UPnPErrorHumanRequired indicates that human interaction is required UPnPErrorHumanRequired UPnPErrorCode = 604 // UPnPErrorStrTooLong indicates that a string is too long UPnPErrorStrTooLong UPnPErrorCode = 605 )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package desc implements data types to map to the content from description XML files
|
Package desc implements data types to map to the content from description XML files |
Package main implements a simple test server
|
Package main implements a simple test server |
Package main generates the Go types that implement the UPnP types i4, ui2, string, fixed.14.4 etc.
|
Package main generates the Go types that implement the UPnP types i4, ui2, string, fixed.14.4 etc. |
internal
|
|
events
Package events implements eventing for state variables.
|
Package events implements eventing for state variables. |
network
Package network contains function of facilitate sending and receiving messages via UDP and TCP
|
Package network contains function of facilitate sending and receiving messages via UDP and TCP |
ssdp
Package ssdp implements an SSDP (=Simple Service Discovery Protocol) server
|
Package ssdp implements an SSDP (=Simple Service Discovery Protocol) server |
types
Package types implements basic types
|
Package types implements basic types |