server

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: GPL-3.0 Imports: 30 Imported by: 0

README

PkgGoDev Go Report Card REUSE status

yuppie is a library that supports building UPnP servers in Go

Installation

Run go get -u gitlab.com/mipimipi/yuppie.

Usage

You can focus on the specific application logic of your server and don't have to bother with all the generic UPnP stuff. yuppie takes care of ...

  • Device discovery, i.e. SSDP notifications and search responses
  • Provisioning of device and service descriptions
  • Management of state variables
  • Eventing
  • Receipt and verification of service control calls, sending of responses

The yuppie server requires ...

  • a device description
  • service descriptions
  • handler functions for HTTP and SOAP action calls

This example shows how a simple UPnP music server can be built with yuppie. You find more detailed information about how to use yuppie to build a server here.

Description files

The yuppie server requires a device and service descriptions. These descriptions can come from XML files (see [2], [3] and [4] for further information; see the example server for an example device description and an example description for a ContentDirectory service). yuppie provides functions to create the input data for the server from such files.

Configuration

Besides device and service descriptions, yuppie requires a simple configuration to create a server. If no configuration is provided the default values are used:

  • All network interfaces are used by the server
  • The server listens on port 8008

Logging

yuppie uses logrus for logging. It uses the logrus default configuration (i.e. output on stdout with text formatter and info level). If you don't want that, configure the output, formatter and level in your server application. This will also be adhered to by the logging of yuppie server.

Scope and Limitations

yuppie implements the UPnP Device Architecture version 2.0, except:

  • SSDP update notifications

    yuppie does not send update notifications if network interfaces or server IP addresses changed. Thus, it's recommended to give the server a static IP address and to restart the server if network interfaces were changed.

  • Chunked transfer encoding that was introduced with HTTP 1.1

  • Custom UPnP data types

    yuppie only supports the standard UPnP data types

Further Reading

[1] UPnP Standards and Architecture

[2] UPnP Device Architecture version 2.0 (PDF)

[3] UPnP ContentDirectory Service (PDF)

[4] UPnP ConnectionManager Service (PDF)

[5] UPnP MediaServer and MediaRenderer

Documentation

Overview

Package server implements an UPnP server and is the primary package to be used when building an UPnP server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinBase64

type BinBase64 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

BinBase64 is the representation of the SOAP type bin.base64 as golang type

func NewBinBase64

func NewBinBase64(s string) (t *BinBase64, err error)

NewBinBase64 creates a new SOAP variable the represents the SOAP type bin.base64

func (BinBase64) Get

func (t BinBase64) Get() interface{}

Get returns the value of t

func (*BinBase64) Init

func (t *BinBase64) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*BinBase64) IsNumeric

func (t *BinBase64) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*BinBase64) IsString

func (t *BinBase64) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (BinBase64) IsZero

func (t BinBase64) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*BinBase64) Set

func (t *BinBase64) Set(v interface{}) (err error)

Set sets t to the new value v

func (*BinBase64) SetFromString

func (t *BinBase64) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (BinBase64) String

func (t BinBase64) String() string

String returns the string representation of the value of t

func (BinBase64) Type

func (t BinBase64) Type() string

Type returns the SOAP type of t

type BinHex

type BinHex struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

BinHex is the representation of the SOAP type bin.hex as golang type

func NewBinHex

func NewBinHex(s string) (t *BinHex, err error)

NewBinHex creates a new SOAP variable the represents the SOAP type bin.hex

func (BinHex) Get

func (t BinHex) Get() interface{}

Get returns the value of t

func (*BinHex) Init

func (t *BinHex) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*BinHex) IsNumeric

func (t *BinHex) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*BinHex) IsString

func (t *BinHex) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (BinHex) IsZero

func (t BinHex) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*BinHex) Set

func (t *BinHex) Set(v interface{}) (err error)

Set sets t to the new value v

func (*BinHex) SetFromString

func (t *BinHex) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (BinHex) String

func (t BinHex) String() string

String returns the string representation of the value of t

func (BinHex) Type

func (t BinHex) Type() string

Type returns the SOAP type of t

type Boolean

type Boolean struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Boolean is the representation of the SOAP type boolean as golang type

func NewBoolean

func NewBoolean(s string) (t *Boolean, err error)

NewBoolean creates a new SOAP variable the represents the SOAP type boolean

func (Boolean) Get

func (t Boolean) Get() interface{}

Get returns the value of t

func (*Boolean) Init

func (t *Boolean) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*Boolean) IsNumeric

func (t *Boolean) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*Boolean) IsString

func (t *Boolean) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (Boolean) IsZero

func (t Boolean) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*Boolean) Set

func (t *Boolean) Set(v interface{}) (err error)

Set sets t to the new value v

func (*Boolean) SetFromString

func (t *Boolean) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (Boolean) String

func (t Boolean) String() string

String returns the string representation of the value of t

func (Boolean) Type

func (t Boolean) Type() string

Type returns the SOAP type of t

type Char

type Char struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Char is the representation of the SOAP type char as golang type

func NewChar

func NewChar(s string) (t *Char, err error)

NewChar creates a new SOAP variable the represents the SOAP type char

func (Char) Get

func (t Char) Get() interface{}

Get returns the value of t

func (*Char) Init

func (t *Char) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*Char) IsNumeric

func (t *Char) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*Char) IsString

func (t *Char) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (Char) IsZero

func (t Char) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*Char) Set

func (t *Char) Set(v interface{}) (err error)

Set sets t to the new value v

func (*Char) SetFromString

func (t *Char) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (Char) String

func (t Char) String() string

String returns the string representation of the value of t

func (Char) Type

func (t Char) Type() string

Type returns the SOAP type of t

type Config

type Config struct {
	// Interfaces  contain the names of the network interfaces to be used
	Interfaces []string
	// Port is the prot where the server listens
	Port           int
	MaxAge         int
	ProductName    string
	ProductVersion string
	StatusFile     string
}

Config represents the configuration of the UPnP server

func (Config) Equal

func (a Config) Equal(b Config) bool

Equal returns true if two config structures are equal, otherwise false is returned

type Date

type Date struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Date is the representation of the SOAP type date as golang type

func NewDate

func NewDate(s string) (t *Date, err error)

NewDate creates a new SOAP variable the represents the SOAP type date

func (Date) Get

func (t Date) Get() interface{}

Get returns the value of t

func (*Date) Init

func (t *Date) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*Date) IsNumeric

func (t *Date) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*Date) IsString

func (t *Date) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (Date) IsZero

func (t Date) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*Date) Set

func (t *Date) Set(v interface{}) (err error)

Set sets t to the new value v

func (*Date) SetFromString

func (t *Date) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (Date) String

func (t Date) String() string

String returns the string representation of the value of t

func (Date) Type

func (t Date) Type() string

Type returns the SOAP type of t

type DateTime

type DateTime struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

DateTime is the representation of the SOAP type dateTime as golang type

func NewDateTime

func NewDateTime(s string) (t *DateTime, err error)

NewDateTime creates a new SOAP variable the represents the SOAP type dateTime

func (DateTime) Get

func (t DateTime) Get() interface{}

Get returns the value of t

func (*DateTime) Init

func (t *DateTime) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*DateTime) IsNumeric

func (t *DateTime) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*DateTime) IsString

func (t *DateTime) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (DateTime) IsZero

func (t DateTime) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*DateTime) Set

func (t *DateTime) Set(v interface{}) (err error)

Set sets t to the new value v

func (*DateTime) SetFromString

func (t *DateTime) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (DateTime) String

func (t DateTime) String() string

String returns the string representation of the value of t

func (DateTime) Type

func (t DateTime) Type() string

Type returns the SOAP type of t

type DateTimeTz

type DateTimeTz struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

DateTimeTz is the representation of the SOAP type dateTime.tz as golang type

func NewDateTimeTz

func NewDateTimeTz(s string) (t *DateTimeTz, err error)

NewDateTimeTz creates a new SOAP variable the represents the SOAP type dateTime.tz

func (DateTimeTz) Get

func (t DateTimeTz) Get() interface{}

Get returns the value of t

func (*DateTimeTz) Init

func (t *DateTimeTz) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*DateTimeTz) IsNumeric

func (t *DateTimeTz) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*DateTimeTz) IsString

func (t *DateTimeTz) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (DateTimeTz) IsZero

func (t DateTimeTz) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*DateTimeTz) Set

func (t *DateTimeTz) Set(v interface{}) (err error)

Set sets t to the new value v

func (*DateTimeTz) SetFromString

func (t *DateTimeTz) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (DateTimeTz) String

func (t DateTimeTz) String() string

String returns the string representation of the value of t

func (DateTimeTz) Type

func (t DateTimeTz) Type() string

Type returns the SOAP type of t

type Fixed14_4

type Fixed14_4 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Fixed14_4 is the representation of the SOAP type fixed.14.4 as golang type

func NewFixed14_4

func NewFixed14_4(s string) (t *Fixed14_4, err error)

NewFixed14_4 creates a new SOAP variable the represents the SOAP type fixed.14.4

func (Fixed14_4) Get

func (t Fixed14_4) Get() interface{}

Get returns the value of t

func (*Fixed14_4) Init

func (t *Fixed14_4) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*Fixed14_4) IsNumeric

func (t *Fixed14_4) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*Fixed14_4) IsString

func (t *Fixed14_4) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (Fixed14_4) IsZero

func (t Fixed14_4) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*Fixed14_4) Set

func (t *Fixed14_4) Set(v interface{}) (err error)

Set sets t to the new value v

func (*Fixed14_4) SetFromString

func (t *Fixed14_4) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (Fixed14_4) String

func (t Fixed14_4) String() string

String returns the string representation of the value of t

func (Fixed14_4) Type

func (t Fixed14_4) Type() string

Type returns the SOAP type of t

type Float

type Float struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Float is the representation of the SOAP type float as golang type

func NewFloat

func NewFloat(s string) (t *Float, err error)

NewFloat creates a new SOAP variable the represents the SOAP type float

func (Float) Get

func (t Float) Get() interface{}

Get returns the value of t

func (*Float) Init

func (t *Float) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*Float) IsNumeric

func (t *Float) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*Float) IsString

func (t *Float) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (Float) IsZero

func (t Float) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*Float) Set

func (t *Float) Set(v interface{}) (err error)

Set sets t to the new value v

func (*Float) SetFromString

func (t *Float) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (Float) String

func (t Float) String() string

String returns the string representation of the value of t

func (Float) Type

func (t Float) Type() string

Type returns the SOAP type of t

type I1

type I1 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

I1 is the representation of the SOAP type i1 as golang type

func NewI1

func NewI1(s string) (t *I1, err error)

NewI1 creates a new SOAP variable the represents the SOAP type i1

func (I1) Get

func (t I1) Get() interface{}

Get returns the value of t

func (*I1) Init

func (t *I1) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*I1) IsNumeric

func (t *I1) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*I1) IsString

func (t *I1) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (I1) IsZero

func (t I1) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*I1) Set

func (t *I1) Set(v interface{}) (err error)

Set sets t to the new value v

func (*I1) SetFromString

func (t *I1) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (I1) String

func (t I1) String() string

String returns the string representation of the value of t

func (I1) Type

func (t I1) Type() string

Type returns the SOAP type of t

type I2

type I2 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

I2 is the representation of the SOAP type i2 as golang type

func NewI2

func NewI2(s string) (t *I2, err error)

NewI2 creates a new SOAP variable the represents the SOAP type i2

func (I2) Get

func (t I2) Get() interface{}

Get returns the value of t

func (*I2) Init

func (t *I2) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*I2) IsNumeric

func (t *I2) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*I2) IsString

func (t *I2) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (I2) IsZero

func (t I2) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*I2) Set

func (t *I2) Set(v interface{}) (err error)

Set sets t to the new value v

func (*I2) SetFromString

func (t *I2) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (I2) String

func (t I2) String() string

String returns the string representation of the value of t

func (I2) Type

func (t I2) Type() string

Type returns the SOAP type of t

type I4

type I4 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

I4 is the representation of the SOAP type i4 as golang type

func NewI4

func NewI4(s string) (t *I4, err error)

NewI4 creates a new SOAP variable the represents the SOAP type i4

func (I4) Get

func (t I4) Get() interface{}

Get returns the value of t

func (*I4) Init

func (t *I4) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*I4) IsNumeric

func (t *I4) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*I4) IsString

func (t *I4) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (I4) IsZero

func (t I4) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*I4) Set

func (t *I4) Set(v interface{}) (err error)

Set sets t to the new value v

func (*I4) SetFromString

func (t *I4) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (I4) String

func (t I4) String() string

String returns the string representation of the value of t

func (I4) Type

func (t I4) Type() string

Type returns the SOAP type of t

type Int

type Int struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Int is the representation of the SOAP type int as golang type

func NewInt

func NewInt(s string) (t *Int, err error)

NewInt creates a new SOAP variable the represents the SOAP type int

func (Int) Get

func (t Int) Get() interface{}

Get returns the value of t

func (*Int) Init

func (t *Int) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*Int) IsNumeric

func (t *Int) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*Int) IsString

func (t *Int) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (Int) IsZero

func (t Int) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*Int) Set

func (t *Int) Set(v interface{}) (err error)

Set sets t to the new value v

func (*Int) SetFromString

func (t *Int) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (Int) String

func (t Int) String() string

String returns the string representation of the value of t

func (Int) Type

func (t Int) Type() string

Type returns the SOAP type of t

type Number

type Number struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Number is the representation of the SOAP type number as golang type

func NewNumber

func NewNumber(s string) (t *Number, err error)

NewNumber creates a new SOAP variable the represents the SOAP type number

func (Number) Get

func (t Number) Get() interface{}

Get returns the value of t

func (*Number) Init

func (t *Number) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*Number) IsNumeric

func (t *Number) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*Number) IsString

func (t *Number) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (Number) IsZero

func (t Number) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*Number) Set

func (t *Number) Set(v interface{}) (err error)

Set sets t to the new value v

func (*Number) SetFromString

func (t *Number) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (Number) String

func (t Number) String() string

String returns the string representation of the value of t

func (Number) Type

func (t Number) Type() string

Type returns the SOAP type of t

type R4

type R4 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

R4 is the representation of the SOAP type r4 as golang type

func NewR4

func NewR4(s string) (t *R4, err error)

NewR4 creates a new SOAP variable the represents the SOAP type r4

func (R4) Get

func (t R4) Get() interface{}

Get returns the value of t

func (*R4) Init

func (t *R4) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*R4) IsNumeric

func (t *R4) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*R4) IsString

func (t *R4) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (R4) IsZero

func (t R4) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*R4) Set

func (t *R4) Set(v interface{}) (err error)

Set sets t to the new value v

func (*R4) SetFromString

func (t *R4) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (R4) String

func (t R4) String() string

String returns the string representation of the value of t

func (R4) Type

func (t R4) Type() string

Type returns the SOAP type of t

type R8

type R8 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

R8 is the representation of the SOAP type r8 as golang type

func NewR8

func NewR8(s string) (t *R8, err error)

NewR8 creates a new SOAP variable the represents the SOAP type r8

func (R8) Get

func (t R8) Get() interface{}

Get returns the value of t

func (*R8) Init

func (t *R8) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*R8) IsNumeric

func (t *R8) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*R8) IsString

func (t *R8) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (R8) IsZero

func (t R8) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*R8) Set

func (t *R8) Set(v interface{}) (err error)

Set sets t to the new value v

func (*R8) SetFromString

func (t *R8) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (R8) String

func (t R8) String() string

String returns the string representation of the value of t

func (R8) Type

func (t R8) Type() string

Type returns the SOAP type of t

type SOAPError

type SOAPError struct {
	Code UPnPErrorCode
	Desc string
}

SOAPError represents a SOAP error

func (SOAPError) IsNil

func (me SOAPError) IsNil() bool

IsNil returns true is the SOAP error not really an error

type SOAPHandleFunc

type SOAPHandleFunc func(StateVars) (SOAPRespArgs, SOAPError)

SOAPHandleFunc represents a handler function for calls of SOAP actions

type SOAPRespArgs

type SOAPRespArgs map[string]string

SOAPRespArgs maps argument name to argument value

type Server

type Server struct {
	// 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) BootID

func (me *Server) BootID() uint32

BootID returns the current value of BOOTID.UPNP.ORG

func (*Server) ConfigID

func (me *Server) ConfigID() uint32

ConfigID returns the current value of CONFIGID.UPNP.ORG

func (*Server) Connect

func (me *Server) Connect() (err error)

Connect starts the SSDP processes and multicast eventing

func (*Server) Disconnect

func (me *Server) Disconnect()

Disconnect stops the SSDP processes and the multicast eventing

func (*Server) Errors

func (me *Server) Errors() <-chan error

Errors returns a receive-only channel for errors from the UPnP server

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 given patterns

func (*Server) Run

func (me *Server) Run(ctx context.Context, wg *sync.WaitGroup)

Run starts the server. It can be stopped via the context ctx

func (*Server) SOAPHandleFunc

func (me *Server) SOAPHandleFunc(svcID string, act string, handler SOAPHandleFunc)

SOAPHandleFunc allows to register functions to handle UPnP SOAP requests. Such handlers are defined per service ID / action combination

func (*Server) ServerString

func (me *Server) ServerString() (s string)

ServerString assembles the server string in the format "<OS>/<OS version> UPnP/<UPnP version> <product name>/<product version>"

func (*Server) StateVariable

func (me *Server) StateVariable(svcID, svName string) (StateVar, bool)

StateVariable returns the state variable svName of service svcID

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 StateVars

type StateVars map[string]StateVar

StateVars maps the name of a variable to the variable

type String

type String struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

String is the representation of the SOAP type string as golang type

func NewString

func NewString(s string) (t *String, err error)

NewString creates a new SOAP variable the represents the SOAP type string

func (String) Get

func (t String) Get() interface{}

Get returns the value of t

func (*String) Init

func (t *String) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*String) IsNumeric

func (t *String) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*String) IsString

func (t *String) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (String) IsZero

func (t String) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*String) Set

func (t *String) Set(v interface{}) (err error)

Set sets t to the new value v

func (*String) SetFromString

func (t *String) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (String) String

func (t String) String() string

String returns the string representation of the value of t

func (String) Type

func (t String) Type() string

Type returns the SOAP type of t

type TimeOfDay

type TimeOfDay struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

TimeOfDay is the representation of the SOAP type time as golang type

func NewTimeOfDay

func NewTimeOfDay(s string) (t *TimeOfDay, err error)

NewTimeOfDay creates a new SOAP variable the represents the SOAP type time

func (TimeOfDay) Get

func (t TimeOfDay) Get() interface{}

Get returns the value of t

func (*TimeOfDay) Init

func (t *TimeOfDay) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*TimeOfDay) IsNumeric

func (t *TimeOfDay) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*TimeOfDay) IsString

func (t *TimeOfDay) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (TimeOfDay) IsZero

func (t TimeOfDay) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*TimeOfDay) Set

func (t *TimeOfDay) Set(v interface{}) (err error)

Set sets t to the new value v

func (*TimeOfDay) SetFromString

func (t *TimeOfDay) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (TimeOfDay) String

func (t TimeOfDay) String() string

String returns the string representation of the value of t

func (TimeOfDay) Type

func (t TimeOfDay) Type() string

Type returns the SOAP type of t

type TimeOfDayTz

type TimeOfDayTz struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

TimeOfDayTz is the representation of the SOAP type time.tz as golang type

func NewTimeOfDayTz

func NewTimeOfDayTz(s string) (t *TimeOfDayTz, err error)

NewTimeOfDayTz creates a new SOAP variable the represents the SOAP type time.tz

func (TimeOfDayTz) Get

func (t TimeOfDayTz) Get() interface{}

Get returns the value of t

func (*TimeOfDayTz) Init

func (t *TimeOfDayTz) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*TimeOfDayTz) IsNumeric

func (t *TimeOfDayTz) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*TimeOfDayTz) IsString

func (t *TimeOfDayTz) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (TimeOfDayTz) IsZero

func (t TimeOfDayTz) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*TimeOfDayTz) Set

func (t *TimeOfDayTz) Set(v interface{}) (err error)

Set sets t to the new value v

func (*TimeOfDayTz) SetFromString

func (t *TimeOfDayTz) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (TimeOfDayTz) String

func (t TimeOfDayTz) String() string

String returns the string representation of the value of t

func (TimeOfDayTz) Type

func (t TimeOfDayTz) Type() string

Type returns the SOAP type of t

type UI1

type UI1 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

UI1 is the representation of the SOAP type ui1 as golang type

func NewUI1

func NewUI1(s string) (t *UI1, err error)

NewUI1 creates a new SOAP variable the represents the SOAP type ui1

func (UI1) Get

func (t UI1) Get() interface{}

Get returns the value of t

func (*UI1) Init

func (t *UI1) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*UI1) IsNumeric

func (t *UI1) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*UI1) IsString

func (t *UI1) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (UI1) IsZero

func (t UI1) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*UI1) Set

func (t *UI1) Set(v interface{}) (err error)

Set sets t to the new value v

func (*UI1) SetFromString

func (t *UI1) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (UI1) String

func (t UI1) String() string

String returns the string representation of the value of t

func (UI1) Type

func (t UI1) Type() string

Type returns the SOAP type of t

type UI2

type UI2 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

UI2 is the representation of the SOAP type ui2 as golang type

func NewUI2

func NewUI2(s string) (t *UI2, err error)

NewUI2 creates a new SOAP variable the represents the SOAP type ui2

func (UI2) Get

func (t UI2) Get() interface{}

Get returns the value of t

func (*UI2) Init

func (t *UI2) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*UI2) IsNumeric

func (t *UI2) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*UI2) IsString

func (t *UI2) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (UI2) IsZero

func (t UI2) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*UI2) Set

func (t *UI2) Set(v interface{}) (err error)

Set sets t to the new value v

func (*UI2) SetFromString

func (t *UI2) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (UI2) String

func (t UI2) String() string

String returns the string representation of the value of t

func (UI2) Type

func (t UI2) Type() string

Type returns the SOAP type of t

type UI4

type UI4 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

UI4 is the representation of the SOAP type ui4 as golang type

func NewUI4

func NewUI4(s string) (t *UI4, err error)

NewUI4 creates a new SOAP variable the represents the SOAP type ui4

func (UI4) Get

func (t UI4) Get() interface{}

Get returns the value of t

func (*UI4) Init

func (t *UI4) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*UI4) IsNumeric

func (t *UI4) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*UI4) IsString

func (t *UI4) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (UI4) IsZero

func (t UI4) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*UI4) Set

func (t *UI4) Set(v interface{}) (err error)

Set sets t to the new value v

func (*UI4) SetFromString

func (t *UI4) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (UI4) String

func (t UI4) String() string

String returns the string representation of the value of t

func (UI4) Type

func (t UI4) Type() string

Type returns the SOAP type of t

type UI8

type UI8 struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

UI8 is the representation of the SOAP type ui8 as golang type

func NewUI8

func NewUI8(s string) (t *UI8, err error)

NewUI8 creates a new SOAP variable the represents the SOAP type ui8

func (UI8) Get

func (t UI8) Get() interface{}

Get returns the value of t

func (*UI8) Init

func (t *UI8) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*UI8) IsNumeric

func (t *UI8) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*UI8) IsString

func (t *UI8) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (UI8) IsZero

func (t UI8) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*UI8) Set

func (t *UI8) Set(v interface{}) (err error)

Set sets t to the new value v

func (*UI8) SetFromString

func (t *UI8) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (UI8) String

func (t UI8) String() string

String returns the string representation of the value of t

func (UI8) Type

func (t UI8) Type() string

Type returns the SOAP type of t

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
)

type URI

type URI struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

URI is the representation of the SOAP type uri as golang type

func NewURI

func NewURI(s string) (t *URI, err error)

NewURI creates a new SOAP variable the represents the SOAP type uri

func (URI) Get

func (t URI) Get() interface{}

Get returns the value of t

func (*URI) Init

func (t *URI) Init(v interface{}) (err error)

Init initializes t with a new value v

func (*URI) IsNumeric

func (t *URI) IsNumeric() bool

IsNumeric returns true is the value of t is numeric, otherwise false is returned

func (*URI) IsString

func (t *URI) IsString() bool

IsString returns true is the value of t is a string, otherwise false is returned

func (URI) IsZero

func (t URI) IsZero() bool

IsZero returns true is the value of t is the zero value of that type, otherwise false is returned

func (*URI) Set

func (t *URI) Set(v interface{}) (err error)

Set sets t to the new value v

func (*URI) SetFromString

func (t *URI) SetFromString(s string) (err error)

SetFromString sets the value of t from s

func (URI) String

func (t URI) String() string

String returns the string representation of the value of t

func (URI) Type

func (t URI) Type() string

Type returns the SOAP type of t

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 generates the Go types that implement the SOAP types i4, ui2, string, fixed.14.4 etc.
Package main generates the Go types that implement the SOAP 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

Jump to

Keyboard shortcuts

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