cwmp

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FTFireware   string = "1 Firmware Upgrade Image"
	FTWebContent string = "2 Web Content"
	FTConfig     string = "3 Vendor Configuration File"
)

Download type

View Source
const (
	// XsdString string type
	XsdString string = "xsd:string"
	// XsdUnsignedint uint type
	XsdUnsignedint string = "xsd:unsignedInt"
)
View Source
const (
	// EventBootStrap first connection
	EventBootStrap string = "0 BOOTSTRAP"
	// EventBoot reset or power on
	EventBoot string = "1 BOOT"
	// EventPeriodic periodic inform
	EventPeriodic string = "2 PERIODIC"
	// EventScheduled scheduled infrorm
	EventScheduled string = "3 SCHEDULED"
	// EventValueChange value change event
	EventValueChange string = "4 VALUE CHANGE"
	// EventKicked acs notify cpe
	EventKicked string = "5 KICKED"
	// EventConnectionRequest cpe request connection
	EventConnectionRequest string = "6 CONNECTION REQUEST"
	// EventTransferComplete download complete
	EventTransferComplete string = "7 TRANSFER COMPLETE"
	// EventClientChange custom event client online/offline
	EventClientChange string = "8 CLIENT CHANGE"
)
View Source
const (
	// SoapArray array type
	SoapArray string = "soap-enc:Array"
)

Variables

This section is empty.

Functions

func ConnectionRequestAuth

func ConnectionRequestAuth(username string, password string, uri string) (bool, error)

func DigestAuthParams

func DigestAuthParams(r *http.Response) map[string]string

Parse Authorization header from the http.Request. Returns a map of auth parameters or nil if the header is not a valid parsable Digest auth header.

func H

func H(data string) string

H function for MD5 algorithm (returns a lower-case hex MD5 digest)

func RandomKey

func RandomKey() string

Types

type Download

type Download struct {
	ID             string
	Name           string
	NoMore         int
	CommandKey     string
	FileType       string
	URL            string
	Username       string
	Password       string
	FileSize       int
	TargetFileName string
	DelaySeconds   int
	SuccessURL     string
	FailureURL     string
}

Download tr069 download msg

func (*Download) CreateXML

func (msg *Download) CreateXML() []byte

CreateXML encode xml

func (*Download) GetID

func (msg *Download) GetID() string

GetID get download msg id(tr069 msg id)

func (*Download) GetName

func (msg *Download) GetName() string

GetName name is msg object type, use for decode

func (*Download) Parse

func (msg *Download) Parse(doc *xmlx.Document)

Parse parse from xml

type DownloadResponse

type DownloadResponse struct {
	ID           string
	Name         string
	Status       int
	StartTime    string
	CompleteTime string
}

DownloadResponse download response

func (*DownloadResponse) CreateXML

func (msg *DownloadResponse) CreateXML() []byte

CreateXML encode into xml

func (*DownloadResponse) GetID

func (msg *DownloadResponse) GetID() string

GetID tr069 msg id

func (*DownloadResponse) GetName

func (msg *DownloadResponse) GetName() string

GetName msg type name

func (*DownloadResponse) Parse

func (msg *DownloadResponse) Parse(doc *xmlx.Document)

Parse decode into struct

type Envelope

type Envelope struct {
	XMLName   xml.Name    `xml:"soap-env:Envelope"`
	XmlnsEnv  string      `xml:"xmlns:soap-env,attr"`
	XmlnsEnc  string      `xml:"xmlns:soap-enc,attr"`
	XmlnsXsd  string      `xml:"xmlns:xsd,attr"`
	XmlnsXsi  string      `xml:"xmlns:xsi,attr"`
	XmlnsCwmp string      `xml:"xmlns:cwmp,attr"`
	Header    interface{} `xml:"soap-env:Header"`
	Body      interface{} `xml:"soap-env:Body"`
}

Envelope tr069 body

type EventNodeStruct

type EventNodeStruct struct {
	EventCode  NodeStruct `xml:"EventCode"`
	CommandKey string     `xml:"CommandKey"`
}

EventNodeStruct event node

type EventStruct

type EventStruct struct {
	Type   string            `xml:"soap-enc:arrayType,attr"`
	Events []EventNodeStruct `xml:"EventStruct"`
}

EventStruct event

type FactoryReset

type FactoryReset struct {
	ID     string
	Name   string
	NoMore int
}

FactoryReset cpe

func (*FactoryReset) CreateXML

func (msg *FactoryReset) CreateXML() []byte

CreateXML encode into xml

func (*FactoryReset) GetID

func (msg *FactoryReset) GetID() string

GetID get msg id

func (*FactoryReset) GetName

func (msg *FactoryReset) GetName() string

GetName get msg name

func (*FactoryReset) Parse

func (msg *FactoryReset) Parse(doc *xmlx.Document)

Parse decode from xml

type FactoryResetResponse

type FactoryResetResponse struct {
	ID   string
	Name string
}

FactoryResetResponse

func (*FactoryResetResponse) CreateXML

func (msg *FactoryResetResponse) CreateXML() []byte

CreateXML encode into xml

func (*FactoryResetResponse) GetID

func (msg *FactoryResetResponse) GetID() string

GetID get msg id

func (*FactoryResetResponse) GetName

func (msg *FactoryResetResponse) GetName() string

GetName get msg type

func (*FactoryResetResponse) Parse

func (msg *FactoryResetResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type FaultStruct

type FaultStruct struct {
	FaultCode   int
	FaultString string
}

FaultStruct error

type GetParameterNames

type GetParameterNames struct {
	ID            string
	Name          string
	NoMore        int
	ParameterPath string
	NextLevel     string
}

GetParameterNames get rpc methods

func (*GetParameterNames) CreateXML

func (msg *GetParameterNames) CreateXML() []byte

CreateXML encode into xml

func (*GetParameterNames) GetID

func (msg *GetParameterNames) GetID() string

GetID get msg id

func (*GetParameterNames) GetName

func (msg *GetParameterNames) GetName() string

GetName get type name

func (*GetParameterNames) Parse

func (msg *GetParameterNames) Parse(doc *xmlx.Document)

Parse decode from xml

type GetParameterNamesResponse

type GetParameterNamesResponse struct {
	ID     string
	Name   string
	Params []ParameterInfoStruct
}

GetParameterNamesResponse GetParameterNames reponse

func (*GetParameterNamesResponse) CreateXML

func (msg *GetParameterNamesResponse) CreateXML() []byte

CreateXML encode into xml

func (*GetParameterNamesResponse) GetID

func (msg *GetParameterNamesResponse) GetID() string

GetID get msg id

func (*GetParameterNamesResponse) GetName

func (msg *GetParameterNamesResponse) GetName() string

GetName get msg type

func (*GetParameterNamesResponse) Parse

func (msg *GetParameterNamesResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type GetParameterNamesResponseBodyStruct

type GetParameterNamesResponseBodyStruct struct {
	Body GetParameterNamesResponseStruct `xml:"cwmp:GetParameterNamesResponse"`
}

type GetParameterNamesResponseStruct

type GetParameterNamesResponseStruct struct {
	ParameterList ParameterListStruct `xml:"cwmp:ParameterList"`
}

type GetParameterValues

type GetParameterValues struct {
	ID             string
	Name           string
	NoMore         int
	ParameterNames []string
}

GetParameterValues get paramvalues

func (*GetParameterValues) CreateXML

func (msg *GetParameterValues) CreateXML() []byte

CreateXML encode into xml

func (*GetParameterValues) GetID

func (msg *GetParameterValues) GetID() string

GetID get tr069 msg id

func (*GetParameterValues) GetName

func (msg *GetParameterValues) GetName() string

GetName get type name

func (*GetParameterValues) Parse

func (msg *GetParameterValues) Parse(doc *xmlx.Document)

Parse decode from xml

type GetParameterValuesResponse

type GetParameterValuesResponse struct {
	ID     string
	Name   string
	Values map[string]string
}

GetParameterValuesResponse getParameterValues response

func NewGetParameterValuesResponse

func NewGetParameterValuesResponse() (m *GetParameterValuesResponse)

NewGetParameterValuesResponse create GetParameterValuesResponse object

func (*GetParameterValuesResponse) CreateXML

func (msg *GetParameterValuesResponse) CreateXML() []byte

CreateXML encode into xml

func (*GetParameterValuesResponse) GetID

func (msg *GetParameterValuesResponse) GetID() string

GetID get msg id

func (*GetParameterValuesResponse) GetName

func (msg *GetParameterValuesResponse) GetName() string

GetName get type name

func (*GetParameterValuesResponse) Parse

func (msg *GetParameterValuesResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type GetRPCMethods

type GetRPCMethods struct {
	ID     string
	Name   string
	NoMore int
}

GetRPCMethods get rpc methods

func (*GetRPCMethods) CreateXML

func (msg *GetRPCMethods) CreateXML() []byte

CreateXML encode into xml

func (*GetRPCMethods) GetID

func (msg *GetRPCMethods) GetID() string

GetID get msg id

func (*GetRPCMethods) GetName

func (msg *GetRPCMethods) GetName() string

GetName get type name

func (*GetRPCMethods) Parse

func (msg *GetRPCMethods) Parse(doc *xmlx.Document)

Parse decode from xml

type GetRPCMethodsResponse

type GetRPCMethodsResponse struct {
	ID      string
	Name    string
	Methods []string
}

GetRPCMethodsResponse getRPCMethods reponse

func (*GetRPCMethodsResponse) CreateXML

func (msg *GetRPCMethodsResponse) CreateXML() []byte

CreateXML encode into xml

func (*GetRPCMethodsResponse) GetID

func (msg *GetRPCMethodsResponse) GetID() string

GetID get msg id

func (*GetRPCMethodsResponse) GetName

func (msg *GetRPCMethodsResponse) GetName() string

GetName get msg type

func (*GetRPCMethodsResponse) Parse

func (msg *GetRPCMethodsResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type HeaderStruct

type HeaderStruct struct {
	ID     IDStruct    `xml:"cwmp:ID"`
	NoMore interface{} `xml:"cwmp:NoMoreRequests,ommitempty"`
}

HeaderStruct tr069 header

type IDStruct

type IDStruct struct {
	Attr  string `xml:"soap-env:mustUnderstand,attr,ommitempty"`
	Value string `xml:",chardata"`
}

IDStruct msg id

type Inform

type Inform struct {
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	Manufacturer string            `json:"manufacturer"`
	OUI          string            `json:"oui"`
	ProductClass string            `json:"productClass"`
	Sn           string            `json:"sn"`
	Events       map[string]string `json:"events"`
	MaxEnvelopes int               `json:"maxEnvelopes"`
	CurrentTime  string            `json:"currentTime"`
	RetryCount   int               `json:"retryCount"`
	CommandKey   string            `json:"commandKey"`
	Params       map[string]string `json:"params"`
}

Inform tr069 inform (heartbeat)

func NewInform

func NewInform() *Inform

func (*Inform) CreateXML

func (msg *Inform) CreateXML() []byte

CreateXML encode into xml

func (*Inform) GetConfigVersion

func (msg *Inform) GetConfigVersion() (version string)

GetConfigVersion get current config version

func (*Inform) GetID

func (msg *Inform) GetID() string

GetID get msg id

func (*Inform) GetName

func (msg *Inform) GetName() string

GetName get msg type

func (*Inform) GetParam

func (msg *Inform) GetParam(name string) (value string)

GetParam get param in inform

func (*Inform) GetSoftwareVersion

func (msg *Inform) GetSoftwareVersion() (version string)

func (*Inform) IsEvent

func (msg *Inform) IsEvent(event string) bool

IsEvent is a connect request or others

func (*Inform) Parse

func (msg *Inform) Parse(doc *xmlx.Document)

Parse decode from xml

type InformMessage

type InformMessage struct {
	Inform    *Inform
	Timestamp string
}

InformMessage used to store device inform

type InformResponse

type InformResponse struct {
	ID           string
	Name         string
	NoMore       int
	MaxEnvelopes int
}

InformResponse infrom response

func (*InformResponse) CreateXML

func (msg *InformResponse) CreateXML() []byte

CreateXML encode into xml

func (*InformResponse) GetID

func (msg *InformResponse) GetID() string

GetID get msg id

func (*InformResponse) GetName

func (msg *InformResponse) GetName() string

GetName get msg type

func (*InformResponse) Parse

func (msg *InformResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type Message

type Message interface {
	Parse(doc *xmlx.Document)
	CreateXML() []byte
	GetName() string
	GetID() string
}

Message tr069 msg interface

func ParseXML

func ParseXML(data []byte) (msg Message, err error)

ParseXML parse xml msg

type NodeStruct

type NodeStruct struct {
	Type  interface{} `xml:"xsi:type,attr"`
	Value string      `xml:",chardata"`
}

NodeStruct node

type OnlineInform

type OnlineInform struct {
	Sn    string `json:"sn"`
	Hosts []host
}

OnlineInform online client

func (*OnlineInform) CreateXML

func (msg *OnlineInform) CreateXML() (xml []byte)

CreateXML encode into xml

func (*OnlineInform) GetID

func (msg *OnlineInform) GetID() string

GetID get msg id

func (*OnlineInform) GetName

func (msg *OnlineInform) GetName() string

GetName get msg type

func (*OnlineInform) Parse

func (msg *OnlineInform) Parse(doc *xmlx.Document)

Parse parse from xml

type ParameterInfoStruct

type ParameterInfoStruct struct {
	Name     string `xml:"Name" json:"name"`
	Writable string `xml:"Writable" json:"writable"`
}

type ParameterListStruct

type ParameterListStruct struct {
	Type   string                 `xml:"soap-enc:arrayType,attr"`
	Params []ParameterValueStruct `xml:"ParameterValueStruct"`
}

ParameterListStruct param list

type ParameterValueStruct

type ParameterValueStruct struct {
	Name  NodeStruct `xml:"Name"`
	Value NodeStruct `xml:"Value"`
}

ParameterValueStruct param value

type Reboot

type Reboot struct {
	ID         string
	Name       string
	NoMore     int
	CommandKey string
}

Reboot reboot cpe

func (*Reboot) CreateXML

func (msg *Reboot) CreateXML() []byte

CreateXML encode into xml

func (*Reboot) GetID

func (msg *Reboot) GetID() string

GetID get msg id

func (*Reboot) GetName

func (msg *Reboot) GetName() string

GetName get msg name

func (*Reboot) Parse

func (msg *Reboot) Parse(doc *xmlx.Document)

Parse decode from xml

type RebootResponse

type RebootResponse struct {
	ID   string
	Name string
}

RebootResponse reboot response

func (*RebootResponse) CreateXML

func (msg *RebootResponse) CreateXML() []byte

CreateXML encode into xml

func (*RebootResponse) GetID

func (msg *RebootResponse) GetID() string

GetID get msg id

func (*RebootResponse) GetName

func (msg *RebootResponse) GetName() string

GetName get msg type

func (*RebootResponse) Parse

func (msg *RebootResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type ScheduleInform

type ScheduleInform struct {
	ID           string
	Name         string
	NoMore       int
	CommandKey   string
	DelaySeconds int
}

ScheduleInform cpe

func (*ScheduleInform) CreateXML

func (msg *ScheduleInform) CreateXML() []byte

CreateXML encode into xml

func (*ScheduleInform) GetID

func (msg *ScheduleInform) GetID() string

GetID get msg id

func (*ScheduleInform) GetName

func (msg *ScheduleInform) GetName() string

GetName get msg name

func (*ScheduleInform) Parse

func (msg *ScheduleInform) Parse(doc *xmlx.Document)

Parse decode from xml

type ScheduleInformResponse

type ScheduleInformResponse struct {
	ID   string
	Name string
}

ScheduleInformResponse resp

func (*ScheduleInformResponse) CreateXML

func (msg *ScheduleInformResponse) CreateXML() []byte

CreateXML encode into xml

func (*ScheduleInformResponse) GetID

func (msg *ScheduleInformResponse) GetID() string

GetID get msg id

func (*ScheduleInformResponse) GetName

func (msg *ScheduleInformResponse) GetName() string

GetName get msg type

func (*ScheduleInformResponse) Parse

func (msg *ScheduleInformResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type SetParameterValues

type SetParameterValues struct {
	ID           string
	Name         string
	NoMore       int
	Params       map[string]ValueStruct
	ParameterKey string
}

SetParameterValues set param

func (*SetParameterValues) CreateXML

func (msg *SetParameterValues) CreateXML() []byte

CreateXML encode into xml

func (*SetParameterValues) GetID

func (msg *SetParameterValues) GetID() string

GetID get msg id

func (*SetParameterValues) GetName

func (msg *SetParameterValues) GetName() string

GetName get msg type

func (*SetParameterValues) Parse

func (msg *SetParameterValues) Parse(doc *xmlx.Document)

Parse decode from xml

type SetParameterValuesResponse

type SetParameterValuesResponse struct {
	ID           string
	Name         string
	Status       int
	ParameterKey string
}

SetParameterValuesResponse set param reponse

func (*SetParameterValuesResponse) CreateXML

func (msg *SetParameterValuesResponse) CreateXML() []byte

CreateXML encode into xml

func (*SetParameterValuesResponse) GetID

func (msg *SetParameterValuesResponse) GetID() string

GetID get msg id

func (*SetParameterValuesResponse) GetName

func (msg *SetParameterValuesResponse) GetName() string

GetName get msg type

func (*SetParameterValuesResponse) Parse

func (msg *SetParameterValuesResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type TransferComplete

type TransferComplete struct {
	ID           string
	Name         string
	CommandKey   string
	StartTime    string
	CompleteTime string
	FaultCode    int
	FaultString  string
}

TransferComplete download complete

func (*TransferComplete) CreateXML

func (msg *TransferComplete) CreateXML() []byte

CreateXML encode into mxl

func (*TransferComplete) GetID

func (msg *TransferComplete) GetID() string

GetID get msg id

func (*TransferComplete) GetName

func (msg *TransferComplete) GetName() string

GetName get msg type

func (*TransferComplete) Parse

func (msg *TransferComplete) Parse(doc *xmlx.Document)

Parse decode from xml

type TransferCompleteResponse

type TransferCompleteResponse struct {
	ID     string
	Name   string
	NoMore int
}

TransferCompleteResponse transferComplete response

func (*TransferCompleteResponse) CreateXML

func (msg *TransferCompleteResponse) CreateXML() []byte

CreateXML encode into xml

func (*TransferCompleteResponse) GetID

func (msg *TransferCompleteResponse) GetID() string

GetID get msg id

func (*TransferCompleteResponse) GetName

func (msg *TransferCompleteResponse) GetName() string

GetName get msg name

func (*TransferCompleteResponse) Parse

func (msg *TransferCompleteResponse) Parse(doc *xmlx.Document)

Parse decode from xml

type Upload

type Upload struct {
	ID           string
	Name         string
	NoMore       int
	CommandKey   string
	FileType     string
	URL          string
	Username     string
	Password     string
	DelaySeconds int
}

Upload tr069 upload msg

func (*Upload) CreateXML

func (msg *Upload) CreateXML() []byte

CreateXML encode xml

func (*Upload) GetID

func (msg *Upload) GetID() string

GetID get upload msg id(tr069 msg id)

func (*Upload) GetName

func (msg *Upload) GetName() string

GetName name is msg object type, use for decode

func (*Upload) Parse

func (msg *Upload) Parse(doc *xmlx.Document)

Parse parse from xml

type UploadResponse

type UploadResponse struct {
	ID           string
	Name         string
	Status       int
	StartTime    string
	CompleteTime string
}

UploadResponse upload response

func (*UploadResponse) CreateXML

func (msg *UploadResponse) CreateXML() []byte

CreateXML encode into xml

func (*UploadResponse) GetID

func (msg *UploadResponse) GetID() string

GetID tr069 msg id

func (*UploadResponse) GetName

func (msg *UploadResponse) GetName() string

GetName msg type name

func (*UploadResponse) Parse

func (msg *UploadResponse) Parse(doc *xmlx.Document)

Parse decode into struct

type ValueChange

type ValueChange struct {
	Sn    string `json:"sn"`
	Names []string
}

ValueChange value change

func (*ValueChange) CreateXML

func (msg *ValueChange) CreateXML() (xml []byte)

CreateXML encode into xml

func (*ValueChange) GetID

func (msg *ValueChange) GetID() string

GetID get msg id

func (*ValueChange) GetName

func (msg *ValueChange) GetName() string

GetName get msg type

func (*ValueChange) Parse

func (msg *ValueChange) Parse(doc *xmlx.Document)

Parse decode from xml

type ValueStruct

type ValueStruct struct {
	Type  string
	Value string
}

ValueStruct value

Jump to

Keyboard shortcuts

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