server

package
Version: v0.1.1 Latest Latest
Warning

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

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

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 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 SOAPHandleFunc

type SOAPHandleFunc func(types.SOAPVars) (soap.ResponseArguments, soap.Error)

SOAPHandleFunc represents a handler function for calls of SOAP actions

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) (sv *types.StatVar, exists bool)

StateVariable returns the state variable svName of service svcID

Jump to

Keyboard shortcuts

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