common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	Deployed = iota + 1
	PendingDownload
	InDeployment
	Failure
)
View Source
const (
	HeaderIfNoneMatch     = "If-None-Match"
	HeaderFirmwareVersion = "X-System-Firmware-Version"
	HeaderSupportedDocs   = "X-System-Supported-Docs"
)
View Source
const (
	TR181Str  = 0
	TR181Int  = 1
	TR181Uint = 2
	TR181Bool = 3
	TR181Blob = 12
)
View Source
const (
	LoggingTimeFormat = "2006-01-02 15:04:05.000"
)

Variables

View Source
var (
	BinaryVersion   = ""
	BinaryBranch    = ""
	BinaryBuildTime = ""

	DefaultIgnoredHeaders = []string{
		"Accept",
		"User-Agent",
		"Authorization",
		"Content-Type",
		"Content-Length",
		"Accept-Encoding",
		"X-B3-Sampled",
		"X-B3-Spanid",
		"X-B3-Traceid",
		"X-Envoy-Decorator-Operation",
		"X-Envoy-External-Address",
		"X-Envoy-Peer-Metadata",
		"X-Envoy-Peer-Metadata-Id",
		"X-Forwarded-Proto",
	}
)
View Source
var (
	Http400ErrorType    = &Http400Error{}
	Http404ErrorType    = &Http404Error{}
	Http500ErrorType    = &Http500Error{}
	RemoteHttpErrorType = &RemoteHttpError{}
)
View Source
var (
	NotOK = fmt.Errorf("!ok")
)
View Source
var (
	SubdocBitIndexMap = map[string]int{
		"portforwarding":  1,
		"lan":             2,
		"wan":             3,
		"macbinding":      4,
		"xfinity":         5,
		"bridge":          6,
		"privatessid":     7,
		"homessid":        8,
		"radio":           9,
		"moca":            10,
		"xdns":            11,
		"advsecurity":     12,
		"mesh":            13,
		"aker":            14,
		"telemetry":       15,
		"statusreport":    16,
		"trafficreport":   17,
		"interfacereport": 18,
		"radioreport":     19,
	}
)
View Source
var (
	SupportedDocsBitMaskMap = map[int][]BitMaskTuple{
		1: []BitMaskTuple{
			BitMaskTuple{1, 1},
			BitMaskTuple{2, 2},
			BitMaskTuple{3, 3},
			BitMaskTuple{4, 4},
			BitMaskTuple{5, 5},
			BitMaskTuple{6, 6},
		},
		2: []BitMaskTuple{
			BitMaskTuple{1, 7},
			BitMaskTuple{2, 8},
			BitMaskTuple{3, 9},
		},
		3: []BitMaskTuple{
			BitMaskTuple{1, 10},
		},
		4: []BitMaskTuple{
			BitMaskTuple{1, 11},
		},
		5: []BitMaskTuple{
			BitMaskTuple{1, 12},
		},
		6: []BitMaskTuple{
			BitMaskTuple{1, 13},
		},
		7: []BitMaskTuple{
			BitMaskTuple{1, 14},
		},
		8: []BitMaskTuple{
			BitMaskTuple{1, 15},
		},
		9: []BitMaskTuple{
			BitMaskTuple{1, 16},
			BitMaskTuple{2, 17},
		},
		10: []BitMaskTuple{
			BitMaskTuple{1, 18},
			BitMaskTuple{2, 19},
		},
	}
)

The group based bitmaps will be merged into 1 cpe bitmap 1: []BitMaskTuple{ // group_id:

BitMaskTuple{1, 1},  // {"index_of_bit_from_lsb" for a group bitmap, "index_of_bit_from_lsb" for the cpe bitmap

Functions

func NewError

func NewError(err error) error

Types

type BitMaskTuple

type BitMaskTuple struct {
	GroupBit int
	CpeBit   int
}

header X-System-Supported-Docs

type Document

type Document struct {
	// contains filtered or unexported fields
}

func NewDocument

func NewDocument(bytes []byte, params *string, version *string, state *int, updatedTime *int64) *Document

func (*Document) Bytes

func (d *Document) Bytes() []byte

func (*Document) Equals

func (d *Document) Equals(tdoc *Document) error

func (*Document) HasBytes

func (d *Document) HasBytes() bool

func (*Document) Params

func (d *Document) Params() *string

func (*Document) SetBytes

func (d *Document) SetBytes(bytes []byte)

func (*Document) SetParams

func (d *Document) SetParams(params *string)

func (*Document) SetState

func (d *Document) SetState(state *int)

func (*Document) SetUpdatedTime

func (d *Document) SetUpdatedTime(updatedTime *int64)

func (*Document) SetVersion

func (d *Document) SetVersion(version *string)

func (*Document) State

func (d *Document) State() *int

func (Document) String

func (d Document) String() string

func (*Document) UpdatedTime

func (d *Document) UpdatedTime() *int64

func (*Document) Version

func (d *Document) Version() *string

type Folder

type Folder struct {
	// contains filtered or unexported fields
}

func NewFolder

func NewFolder() *Folder

func (*Folder) DeleteDocument

func (f *Folder) DeleteDocument(groupId string)

func (*Folder) Document

func (f *Folder) Document(groupId string) *Document

func (*Folder) Items

func (f *Folder) Items() map[string]Document

func (*Folder) Length

func (f *Folder) Length() int

func (*Folder) SetDocument

func (f *Folder) SetDocument(groupId string, d *Document)

func (*Folder) VersionMap

func (f *Folder) VersionMap() map[string]string

type Http400Error

type Http400Error struct {
	Message string
}

func (Http400Error) Error

func (e Http400Error) Error() string

type Http404Error

type Http404Error struct {
	Message string
}

func (Http404Error) Error

func (e Http404Error) Error() string

type Http500Error

type Http500Error struct {
	Message string
}

func (Http500Error) Error

func (e Http500Error) Error() string

type HttpErrorResponse

type HttpErrorResponse struct {
	Status    int         `json:"status"`
	ErrorCode int         `json:"error_code,omitempty"`
	Message   string      `json:"message,omitempty"`
	Errors    interface{} `json:"errors,omitempty"`
}

http error response

type HttpResponse

type HttpResponse struct {
	Status  int         `json:"status"`
	Message string      `json:"message,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

http ok response

type Multipart

type Multipart struct {
	Bytes   []byte
	Version string
	Name    string
}

type PostTokenResponse

type PostTokenResponse struct {
	Data    string `json:"data"`
	Message string `json:"message"`
	Status  int    `json:"status"`
}

type RemoteHttpError

type RemoteHttpError struct {
	StatusCode int
	Message    string
}

func (RemoteHttpError) Error

func (e RemoteHttpError) Error() string

type RootDocument

type RootDocument struct {
	// contains filtered or unexported fields
}

func NewRootDocument

func NewRootDocument(version string, bitmap int) *RootDocument

func (*RootDocument) Bitmap

func (d *RootDocument) Bitmap() int

func (*RootDocument) Equals

func (d *RootDocument) Equals(r *RootDocument) bool

func (*RootDocument) Version

func (d *RootDocument) Version() string

type ServerConfig

type ServerConfig struct {
	*configuration.Config
	// contains filtered or unexported fields
}

func NewServerConfig

func NewServerConfig(configFile string) (*ServerConfig, error)

func (*ServerConfig) ConfigBytes

func (c *ServerConfig) ConfigBytes() []byte

type SupportedGroupsData

type SupportedGroupsData struct {
	Bitmap int             `json:"bitmap"`
	Groups map[string]bool `json:"groups"`
}

type SupportedGroupsGetResponse

type SupportedGroupsGetResponse struct {
	Data    SupportedGroupsData `json:"data"`
	Message string              `json:"message"`
	Status  int                 `json:"status"`
}

type TR181Entry

type TR181Entry struct {
	Name     string `json:"name" msgpack:"name"`
	Value    string `json:"value" msgpack:"value"`
	DataType int    `json:"dataType" msgpack:"dataType,omitempty"`
}

type TR181Output

type TR181Output struct {
	Parameters []TR181Entry `json:"parameters" msgpack:"parameters"`
}

type Version

type Version struct {
	CodeGitCommit   string `json:"code_git_commit"`
	BuildTime       string `json:"build_time"`
	BinaryVersion   string `json:"binary_version"`
	BinaryBranch    string `json:"binary_branch"`
	BinaryBuildTime string `json:"binary_build_time"`
}

Jump to

Keyboard shortcuts

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