fritzbox_upnp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0 Imports: 12 Imported by: 7

Documentation

Overview

Package fritzbox_upnp queries UPNP variables from Fritz!Box devices.

Index

Constants

View Source
const (
	IGDServiceDescriptor  = "igddesc.xml"
	TR64ServiceDescriptor = "tr64desc.xml"
)

Variables

View Source
var ErrInvalidSOAPResponse = errors.New("invalid SOAP response")

Functions

This section is empty.

Types

type Action

type Action struct {
	Name        string               `xml:"name"`
	Arguments   []*Argument          `xml:"argumentList>argument"`
	ArgumentMap map[string]*Argument // Map of arguments indexed by .Name
	// contains filtered or unexported fields
}

Action is an UPNP Action on a service

func (*Action) Call

func (a *Action) Call() (Result, error)

Call an action. Currently only actions without input arguments are supported.

func (*Action) IsGetOnly

func (a *Action) IsGetOnly() bool

IsGetOnly returns if the action seems to be a query for information. This is determined by checking if the action has no input arguments and at least one output argument.

type Argument

type Argument struct {
	Name                 string `xml:"name"`
	Direction            string `xml:"direction"`
	RelatedStateVariable string `xml:"relatedStateVariable"`
	StateVariable        *StateVariable
}

An Argument to an action

type ConnectionParameters

type ConnectionParameters struct {
	Device          string // Hostname or IP
	Port            int
	PortTLS         int
	UseTLS          bool
	Username        string
	Password        string
	AllowSelfSigned bool
}

type Device

type Device struct {
	DeviceType       string `xml:"deviceType"`
	FriendlyName     string `xml:"friendlyName"`
	Manufacturer     string `xml:"manufacturer"`
	ManufacturerUrl  string `xml:"manufacturerURL"`
	ModelDescription string `xml:"modelDescription"`
	ModelName        string `xml:"modelName"`
	ModelNumber      string `xml:"modelNumber"`
	ModelUrl         string `xml:"modelURL"`
	UDN              string `xml:"UDN"`

	Services []*Service `xml:"serviceList>service"` // Service of the device
	Devices  []*Device  `xml:"deviceList>device"`   // Sub-Devices of the device

	PresentationUrl string `xml:"presentationURL"`
	// contains filtered or unexported fields
}

Device represents a UPNP Device

type Result

type Result map[string]interface{}

Result of a Call() contains all output arguments of the call. The map is indexed by the name of the state variable. The type of the value is string, uint64 or bool depending on the DataType of the variable.

type Root

type Root struct {
	Device   Device              `xml:"device"`
	Services map[string]*Service // Map of all services indexed by .ServiceType
	// contains filtered or unexported fields
}

Root of the UPNP tree

func LoadServiceRoot

func LoadServiceRoot(params ConnectionParameters, descriptor string) (*Root, error)

LoadServiceRoot loads a service descriptor and populates a Service Root

type Service

type Service struct {
	Device *Device

	ServiceType string `xml:"serviceType"`
	ServiceId   string `xml:"serviceId"`
	ControlUrl  string `xml:"controlURL"`
	EventSubUrl string `xml:"eventSubURL"`
	SCPDUrl     string `xml:"SCPDURL"`

	Actions        map[string]*Action // All actions available on the service
	StateVariables []*StateVariable   // All state variables available on the service
}

Service represents a UPNP Service

type StateVariable

type StateVariable struct {
	Name         string `xml:"name"`
	DataType     string `xml:"dataType"`
	DefaultValue string `xml:"defaultValue"`
}

StateVariable that can be manipulated through actions

Jump to

Keyboard shortcuts

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