| 1 | // Copyright (c) 2022, 2024 blackshirt. All rights reserved. |
| 2 | // Use of this source code is governed by a MIT License |
| 3 | // that can be found in the LICENSE file. |
| 4 | module asn1 |
| 5 | |
| 6 | // ANY DEFINED BY |
| 7 | // |
| 8 | pub struct AnyDefinedBy { |
| 9 | pub: |
| 10 | // default to null element |
| 11 | params Element = Null{} |
| 12 | } |
| 13 | |
| 14 | // AnyDefinedBy.new creates a new ANY DEFINED BY element. |
| 15 | pub fn AnyDefinedBy.new(params Element) AnyDefinedBy { |
| 16 | return AnyDefinedBy{params} |
| 17 | } |
| 18 | |
| 19 | // tag returns the underlying tag of ANY DEFINED BY element. |
| 20 | pub fn (a AnyDefinedBy) tag() Tag { |
| 21 | return a.params.tag() |
| 22 | } |
| 23 | |
| 24 | // payload returns the underlying payload of ANY DEFINED BY element. |
| 25 | pub fn (a AnyDefinedBy) payload() ![]u8 { |
| 26 | return a.params.payload()! |
| 27 | } |
| 28 | |