Documentation
¶
Index ¶
- Constants
- Variables
- func MarshalToFile(val interface{}, path string, mode os.FileMode) error
- type Assignment
- type AssignmentList
- type AstNode
- type BitStringType
- type Boolean
- type BooleanType
- type CharacterStringType
- type ChoiceExtension
- type ChoiceType
- type CodeGenerator
- type ComponentType
- type ComponentTypeList
- type ComponentsOfComponentType
- type Constraint
- type ConstraintSpec
- type ConstraintedType
- type DefinedValue
- type DefinitiveIdentifier
- type DefinitiveObjIdComponent
- type ElementSetSpec
- type Elements
- type Exclusions
- type GenParams
- type GenType
- type GeneralConstraint
- type GlobalModuleReference
- type IdentifiedIntegerValue
- type Identifier
- type IntegerType
- type IntersectionElements
- type Intersections
- type ModuleBody
- type ModuleDefinition
- type ModuleIdentifier
- type ModuleReference
- type MyLexer
- type NamedBit
- type NamedComponentType
- type NamedType
- type NullType
- type Number
- type ObjIdComponents
- type ObjectIdElement
- type ObjectIdentifierType
- type ObjectIdentifierValue
- type OctetStringType
- type RangeEndpoint
- type Real
- type RealType
- type Reference
- type RestrictedStringType
- type SequenceOfType
- type SequenceType
- type SingleValue
- type SizeConstraint
- type SubtypeConstraint
- type Symbol
- type SymbolsFromModule
- type Tag
- type TaggedType
- type Type
- type TypeAssignment
- type TypeConstraint
- type TypeReference
- type Unions
- type Value
- type ValueAssignment
- type ValueRange
- type ValueReference
Constants ¶
const ( TAGS_EXPLICIT = iota TAGS_IMPLICIT TAGS_AUTOMATIC )
const ( CLASS_CONTEXT_SPECIFIC = iota // when not specified CLASS_UNIVERSAL CLASS_APPLICATION CLASS_PRIVATE )
const ( GeneralizedTimeName = "GeneralizedTime" UTCTimeName = "UTCTime" )
const ABSENT = 57389
const ABSTRACT_SYNTAX = 57393
const ALL = 57397
const APOSTROPHE = 57382
const APPLICATION = 57401
const ASSIGNMENT = 57357
const AT = 57385
const AUTOMATIC = 57405
const BEGIN = 57409
const BIT = 57413
const BMPString = 57417
const BOOLEAN = 57421
const BSTRING = 57351
const BY = 57425
const CARET = 57388
const CHARACTER = 57429
const CHOICE = 57433
const CLASS = 57437
const CLOSE_CURLY = 57369
const CLOSE_ROUND = 57375
const CLOSE_SQUARE = 57377
const COLON = 57379
const COMMA = 57372
const COMPONENT = 57441
const COMPONENTS = 57445
const CONSTRAINED = 57449
const CONTAINING = 57453
const CSTRING = 57355
const DEFAULT = 57457
const DEFINITIONS = 57461
const DOT = 57373
const ELLIPSIS = 57359
const EMBEDDED = 57465
const ENCODED = 57390
const END = 57394
const ENUMERATED = 57398
const EQUALS = 57380
const EXCEPT = 57402
const EXCLAMATION = 57387
const EXPLICIT = 57406
const EXPONENT = 57367
const EXPORTS = 57410
const EXTENSIBILITY = 57414
const EXTERNAL = 57418
const FALSE = 57422
const FROM = 57426
const GREATER = 57371
const GeneralString = 57434
const GeneralizedTime = 57430
const GraphicString = 57438
const HSTRING = 57353
const IA5String = 57442
const IDENTIFIER = 57446
const IMPLICIT = 57450
const IMPLIED = 57454
const IMPORTS = 57458
const INCLUDES = 57462
const INSTANCE = 57466
const INTEGER = 57391
const INTERSECTION = 57395
const ISO646String = 57399
const LEFT_VERSION_BRACKETS = 57360
const LESS = 57370
const MAX = 57403
const MIN = 57407
const MINUS = 57378
const MINUS_INFINITY = 57411
const NEWLINE = 57347
const NULL = 57415
const NUMBER = 57350
const NumericString = 57419
const OBJECT = 57423
const OCTET = 57431
const OF = 57435
const OPEN_CURLY = 57368
const OPEN_ROUND = 57374
const OPEN_SQUARE = 57376
const OPTIONAL = 57439
const ObjectDescriptor = 57427
const PATTERN = 57443
const PDV = 57447
const PIPE = 57386
const PLUS_INFINITY = 57451
const PRESENT = 57455
const PRIVATE = 57463
const PrintableString = 57459
const QUOTATION_MARK = 57381
const RANGE_SEPARATOR = 57358
const REAL = 57467
const RELATIVE_OID = 57392
const RIGHT_VERSION_BRACKETS = 57361
const SEMICOLON = 57384
const SEQUENCE = 57396
const SET = 57400
const SIZE = 57404
const SPACE = 57383
const STRING = 57408
const SYNTAX = 57412
const T61String = 57416
const TAGS = 57420
const TRUE = 57428
const TYPEORMODULEREFERENCE = 57348
const TYPE_IDENTIFIER = 57432
const TeletexString = 57424
const UNION = 57436
const UNIQUE = 57440
const UNIVERSAL = 57444
const UTCTime = 57452
const UTF8String = 57456
const UniversalString = 57448
const VALUEIDENTIFIER = 57349
const VideotexString = 57460
const VisibleString = 57464
const WHITESPACE = 57346
const WITH = 57468
const XMLASN1TYPENAME = 57366
const XMLBSTRING = 57352
const XMLCSTRING = 57356
const XMLHSTRING = 57354
const XML_BOOLEAN_FALSE = 57365
const XML_BOOLEAN_TRUE = 57364
const XML_END_TAG_START = 57362
const XML_SINGLE_START_END = 57363
Variables ¶
var ( RESERVED_WORDS map[string]int = map[string]int{ "ABSENT": ABSENT, "ENCODED": ENCODED, "INTEGER": INTEGER, "RELATIVE-OID": RELATIVE_OID, "ABSTRACT-SYNTAX": ABSTRACT_SYNTAX, "END": END, "INTERSECTION": INTERSECTION, "SEQUENCE": SEQUENCE, "ALL": ALL, "ENUMERATED": ENUMERATED, "ISO646String": ISO646String, "SET": SET, "APPLICATION": APPLICATION, "EXCEPT": EXCEPT, "MAX": MAX, "SIZE": SIZE, "AUTOMATIC": AUTOMATIC, "EXPLICIT": EXPLICIT, "MIN": MIN, "STRING": STRING, "BEGIN": BEGIN, "EXPORTS": EXPORTS, "MINUS-INFINITY": MINUS_INFINITY, "SYNTAX": SYNTAX, "BIT": BIT, "EXTENSIBILITY": EXTENSIBILITY, "NULL": NULL, "T61String": T61String, "BMPString": BMPString, "EXTERNAL": EXTERNAL, "NumericString": NumericString, "TAGS": TAGS, "BOOLEAN": BOOLEAN, "FALSE": FALSE, "OBJECT": OBJECT, "TeletexString": TeletexString, "BY": BY, "FROM": FROM, "ObjectDescriptor": ObjectDescriptor, "TRUE": TRUE, "CHARACTER": CHARACTER, "GeneralizedTime": GeneralizedTime, "OCTET": OCTET, "TYPE-IDENTIFIER": TYPE_IDENTIFIER, "CHOICE": CHOICE, "GeneralString": GeneralString, "OF": OF, "UNION": UNION, "CLASS": CLASS, "GraphicString": GraphicString, "OPTIONAL": OPTIONAL, "UNIQUE": UNIQUE, "COMPONENT": COMPONENT, "IA5String": IA5String, "PATTERN": PATTERN, "UNIVERSAL": UNIVERSAL, "COMPONENTS": COMPONENTS, "IDENTIFIER": IDENTIFIER, "PDV": PDV, "UniversalString": UniversalString, "CONSTRAINED": CONSTRAINED, "IMPLICIT": IMPLICIT, "PLUS-INFINITY": PLUS_INFINITY, "UTCTime": UTCTime, "CONTAINING": CONTAINING, "IMPLIED": IMPLIED, "PRESENT": PRESENT, "UTF8String": UTF8String, "DEFAULT": DEFAULT, "IMPORTS": IMPORTS, "PrintableString": PrintableString, "VideotexString": VideotexString, "DEFINITIONS": DEFINITIONS, "INCLUDES": INCLUDES, "PRIVATE": PRIVATE, "VisibleString": VisibleString, "EMBEDDED": EMBEDDED, "INSTANCE": INSTANCE, "REAL": REAL, "WITH": WITH, } )
var ( USEFUL_TYPES map[string]Type = map[string]Type{ GeneralizedTimeName: TaggedType{ Tag: Tag{Class: CLASS_UNIVERSAL, ClassNumber: Number(24)}, Type: RestrictedStringType{VisibleString}}, } )
Functions ¶
Types ¶
type Assignment ¶
type Assignment interface {
Reference() Reference
}
type AssignmentList ¶
type AssignmentList []Assignment
func NewAssignmentList ¶
func NewAssignmentList(other ...Assignment) AssignmentList
func (AssignmentList) Append ¶
func (al AssignmentList) Append(other ...Assignment) AssignmentList
func (AssignmentList) Get ¶
func (l AssignmentList) Get(name string) Assignment
func (AssignmentList) GetType ¶
func (l AssignmentList) GetType(name string) *TypeAssignment
func (AssignmentList) GetValue ¶
func (l AssignmentList) GetValue(name string) *ValueAssignment
type BitStringType ¶
type BitStringType struct {
NamedBits []NamedBit
}
BIT STRING with optional named bits
func (BitStringType) Zero ¶
func (BitStringType) Zero() interface{}
type BooleanType ¶
type BooleanType struct{}
boolean
func (BooleanType) Zero ¶
func (BooleanType) Zero() interface{}
type CharacterStringType ¶
type CharacterStringType struct{}
func (CharacterStringType) Zero ¶
func (CharacterStringType) Zero() interface{}
type ChoiceExtension ¶
type ChoiceExtension interface {
// contains filtered or unexported methods
}
type ChoiceType ¶
type ChoiceType struct { AlternativeTypeList []NamedType ExtensionTypes []ChoiceExtension }
func (ChoiceType) Zero ¶
func (ChoiceType) Zero() interface{}
type CodeGenerator ¶
type CodeGenerator interface {
Generate(module ModuleDefinition, writer io.Writer) error
}
func NewCodeGenerator ¶
func NewCodeGenerator(params GenParams) CodeGenerator
type ComponentType ¶
type ComponentType interface {
IsComponentType()
}
type ComponentTypeList ¶
type ComponentTypeList []ComponentType
type ComponentsOfComponentType ¶
type ComponentsOfComponentType struct {
Type Type
}
reference to other SEQUENCE type to be expanded
func (ComponentsOfComponentType) IsComponentType ¶
func (ComponentsOfComponentType) IsComponentType()
type Constraint ¶
type Constraint struct {
ConstraintSpec ConstraintSpec
}
func SingleElementConstraint ¶
func SingleElementConstraint(elem Elements) Constraint
type ConstraintSpec ¶
type ConstraintSpec interface {
IsConstraintSpec()
}
ConstraintSpec can be SubtypeConstraint or GeneralConstraint
type ConstraintedType ¶
type ConstraintedType struct { Type Type Constraint Constraint }
////////////////////////////////////////////// type with constraints
func (ConstraintedType) Zero ¶
func (t ConstraintedType) Zero() interface{}
type DefinedValue ¶
type DefinedValue struct{}
TODO represents value reference
func (DefinedValue) IsObjectIdComponent ¶
func (DefinedValue) IsObjectIdComponent() bool
func (DefinedValue) Type ¶
func (DefinedValue) Type() Type
type DefinitiveIdentifier ¶
type DefinitiveIdentifier []DefinitiveObjIdComponent
type Elements ¶
type Elements interface {
IsElements()
}
Describe elements of Intersections or Exclusions
type Exclusions ¶
type Exclusions struct {
Elements Elements
}
Exclusion is ElementSetSpec and Elements
func (Exclusions) IsElementSpec ¶
func (Exclusions) IsElementSpec()
func (Exclusions) IsElements ¶
func (Exclusions) IsElements()
type GeneralConstraint ¶
type GeneralConstraint struct{}
TODO
func (GeneralConstraint) IsConstraintSpec ¶
func (GeneralConstraint) IsConstraintSpec()
type GlobalModuleReference ¶
type IdentifiedIntegerValue ¶
type IdentifiedIntegerValue struct { Name string // contains filtered or unexported fields }
element of integer type referenced by name
func (IdentifiedIntegerValue) Type ¶
func (x IdentifiedIntegerValue) Type() Type
type Identifier ¶
type Identifier string
identifier type
func (Identifier) Name ¶
func (id Identifier) Name() string
type IntersectionElements ¶
type IntersectionElements struct { Elements Elements Exclusions Exclusions }
type ModuleBody ¶
type ModuleBody struct { AssignmentList AssignmentList Imports []SymbolsFromModule }
type ModuleDefinition ¶
type ModuleDefinition struct { ModuleIdentifier ModuleIdentifier TagDefault int ExtensibilityImplied bool ModuleBody ModuleBody }
func ParseFile ¶
func ParseFile(name string) (*ModuleDefinition, error)
func ParseStream ¶
func ParseStream(reader io.Reader) (*ModuleDefinition, error)
func ParseString ¶
func ParseString(str string) (*ModuleDefinition, error)
type ModuleIdentifier ¶
type ModuleIdentifier struct { Reference string DefinitiveIdentifier DefinitiveIdentifier }
type ModuleReference ¶
type ModuleReference string
module reference
func (ModuleReference) IsSymbol ¶
func (ModuleReference) IsSymbol()
type NamedBit ¶
type NamedBit struct { Name Identifier Index Value // Number or DefinedValue }
type NamedComponentType ¶
"regular" named element of SEQUENCE
func (NamedComponentType) IsComponentType ¶
func (NamedComponentType) IsComponentType()
type NamedType ¶
type NamedType struct { Identifier Identifier Type Type }
type ObjIdComponents ¶
type ObjIdComponents interface {
IsObjectIdComponent() bool // fake method for grouping
}
implemented by ObjectIdElement, DefinedValue and ObjectIdentifierValue itself
type ObjectIdElement ¶
type ObjectIdElement struct { Name string Id int Reference *DefinedValue // nil if Id is set explicitly }
func (ObjectIdElement) IsObjectIdComponent ¶
func (ObjectIdElement) IsObjectIdComponent() bool
type ObjectIdentifierType ¶
type ObjectIdentifierType struct{}
object identifier
func (ObjectIdentifierType) Zero ¶
func (ObjectIdentifierType) Zero() interface{}
type ObjectIdentifierValue ¶
type ObjectIdentifierValue []ObjIdComponents
//////////////////////////// OID
func NewObjectIdentifierValue ¶
func NewObjectIdentifierValue(initial ...ObjIdComponents) ObjectIdentifierValue
func (ObjectIdentifierValue) Append ¶
func (oid ObjectIdentifierValue) Append(other ...ObjIdComponents) ObjectIdentifierValue
func (ObjectIdentifierValue) IsObjectIdComponent ¶
func (ObjectIdentifierValue) IsObjectIdComponent() bool
func (ObjectIdentifierValue) Type ¶
func (ObjectIdentifierValue) Type() Type
type OctetStringType ¶
type OctetStringType struct{}
func (OctetStringType) Zero ¶
func (OctetStringType) Zero() interface{}
type RangeEndpoint ¶
func (RangeEndpoint) IsUnspecified ¶
func (e RangeEndpoint) IsUnspecified() bool
IsUnspecified corresponds to MIN or MAX
type RestrictedStringType ¶
type RestrictedStringType struct {
LexType int
}
func (RestrictedStringType) Zero ¶
func (RestrictedStringType) Zero() interface{}
type SequenceOfType ¶
type SequenceOfType struct {
Type Type
}
func (SequenceOfType) Zero ¶
func (SequenceOfType) Zero() interface{}
type SequenceType ¶
type SequenceType struct {
Components ComponentTypeList
}
TODO Extensions are not supported
func (SequenceType) Zero ¶
func (SequenceType) Zero() interface{}
type SingleValue ¶
type SingleValue struct {
Value
}
SingleValue is Elements
func (SingleValue) IsElements ¶
func (SingleValue) IsElements()
type SizeConstraint ¶
type SizeConstraint struct {
Constraint Constraint
}
func (SizeConstraint) IsElements ¶
func (SizeConstraint) IsElements()
type SubtypeConstraint ¶
type SubtypeConstraint []ElementSetSpec
SubtypeConstraint describes list of element sets that can be used in constainted type
func (SubtypeConstraint) IsConstraintSpec ¶
func (SubtypeConstraint) IsConstraintSpec()
type SymbolsFromModule ¶
type SymbolsFromModule struct { SymbolList []Symbol Module GlobalModuleReference }
type TaggedType ¶
type TaggedType struct { Tag Tag Type Type TagType int // one of TAGS_* HasTagType bool // true if explicitly set }
tagged types
func (TaggedType) Zero ¶
func (t TaggedType) Zero() interface{}
type TypeAssignment ¶
type TypeAssignment struct { TypeReference TypeReference Type Type }
assigns Type to TypeReference
func (TypeAssignment) Reference ¶
func (v TypeAssignment) Reference() Reference
type TypeConstraint ¶
type TypeConstraint struct {
Type Type
}
func (TypeConstraint) IsElements ¶
func (TypeConstraint) IsElements()
type TypeReference ¶
type TypeReference string
type reference
func (TypeReference) IsSymbol ¶
func (TypeReference) IsSymbol()
func (TypeReference) Name ¶
func (r TypeReference) Name() string
func (TypeReference) Zero ¶
func (r TypeReference) Zero() interface{}
type Unions ¶
type Unions []Intersections
Unions is ElementSetSpec and Elements
func (Unions) IsElementSpec ¶
func (Unions) IsElementSpec()
func (Unions) IsElements ¶
func (Unions) IsElements()
type ValueAssignment ¶
type ValueAssignment struct { ValueReference ValueReference Type Type Value Value }
assigns Value of Type to ValueReference
func (ValueAssignment) Reference ¶
func (v ValueAssignment) Reference() Reference
type ValueRange ¶
type ValueRange struct { LowerEndpoint RangeEndpoint UpperEndpoint RangeEndpoint }
ValueRange is Elements
func (ValueRange) IsElements ¶
func (ValueRange) IsElements()
type ValueReference ¶
type ValueReference string
value reference
func (ValueReference) IsSymbol ¶
func (ValueReference) IsSymbol()
func (ValueReference) Name ¶
func (r ValueReference) Name() string