common

package
v0.0.0-...-4bc4564 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

* Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net) * * 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. *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAttributesSubset

func GetAttributesSubset(attributes me.AttributeValueMap, attrDefs me.AttributeDefinitionMap, requestedMask uint16, allowedMask uint16) (me.AttributeValueMap, uint16, uint16, uint16)

GetAttributesSubset gets the subset of attribute values that go with the supplied attribute mask

func ReverseInt

func ReverseInt(vals []int) []int

ReverseInt takes an array of ints on input and reverses the items

func ReverseUint

func ReverseUint(vals []uint) []uint

ReverseUint takes an array of uints on input and reverses the items

func ShuffleInt

func ShuffleInt(vals []int) []int

ShuffleInt takes an array of ints on input and randomizes it

func ShuffleStrings

func ShuffleStrings(vals []string) []string

ShuffleStrings takes an array of strings on input and randomizes it

func ShuffleUint

func ShuffleUint(vals []uint) []uint

ShuffleUint takes an array of unsigned ints on input and randomizes it

Types

type DscpPBitMapping

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

DscpPBitMapping organizes an array of 64 3-bit fields as a binary string. The leftmost 3-char in the string represent the bits for file #63.

func NewDscpPBitMapping

func NewDscpPBitMapping(bits []uint8) (DscpPBitMapping, error)

NewDscpPBitMapping creates a DSCP PBit mapping structure from an array of 64 3-bit values.

func (*DscpPBitMapping) GetPBits

func (d *DscpPBitMapping) GetPBits(dscp uint8) (uint8, bool)

GetPBits gets the 3-bit PBit value for the corresponding DSCP value

func (*DscpPBitMapping) Serialize

func (d *DscpPBitMapping) Serialize() []uint8

Serialize returns the DSCP PBit Mapping as an array of octets ready for insertion into a frame for transmission

func (*DscpPBitMapping) SetPBits

func (d *DscpPBitMapping) SetPBits(dscp uint8, pbits uint8) error

SetPBits sets the 3-bit PBit value for the corresponding DSCP value

func (*DscpPBitMapping) String

func (d *DscpPBitMapping) String() string

Convert type to string

type Error

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

Error is the struct representing internal errors. This implements the error interface

func NewErrorStruct

func NewErrorStruct(message string, code ErrorCode) *Error

NewErrorStruct uses message and code to create an *Error struct. The *Error struct implements the 'error' interface, so it should be able to be used wherever 'error' is expected.

func (*Error) Code

func (e *Error) Code() ErrorCode

Code returns the error code.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Message

func (e *Error) Message() string

Message returns the error message.

type ErrorCode

type ErrorCode uint

ErrorCode is the type for package-specific error codes. This is used within the Error struct, which allows you to programmatically determine the error cause.

func (ErrorCode) String

func (e ErrorCode) String() string

Jump to

Keyboard shortcuts

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