std.net.asn1
ASN.1 (Abstract Syntax Notation One) mit BER-Encoding (Basic Encoding Rules) ist das binäre Datenformat, auf dem SNMP-Pakete basieren. Die Unit stellt Encode- und Decode-Funktionen für alle in SNMP genutzten Typen bereit: Integer, OctetString, NULL, OID, Sequence, IPAddress, Counter32/64, Gauge32 und TimeTicks.
Wird intern von std.net.snmp verwendet. Direkte Nutzung ist nur erforderlich, wenn eigene SNMP-Erweiterungen oder andere ASN.1/BER-basierte Protokolle von Grund auf implementiert werden sollen.
Imports
Konstanten
| Name | Typ | Wert | Sichtbarkeit |
|---|---|---|---|
ASN1_INTEGER | int64 | $02 | pub |
ASN1_OCTET_STRING | int64 | $04 | pub |
ASN1_NULL | int64 | $05 | pub |
ASN1_OID | int64 | $06 | pub |
ASN1_SEQUENCE | int64 | $30 | pub |
ASN1_IPADDRESS | int64 | $40 | pub |
ASN1_COUNTER32 | int64 | $41 | pub |
ASN1_GAUGE32 | int64 | $42 | pub |
ASN1_TIMETICKS | int64 | $43 | pub |
ASN1_OPAQUE | int64 | $44 | pub |
ASN1_COUNTER64 | int64 | $46 | pub |
ASN1_GETBULKREQUEST | int64 | $A5 | pub |
SNMP_GETREQUEST | int64 | $A0 | pub |
SNMP_GETNEXTREQUEST | int64 | $A1 | pub |
SNMP_GETRESPONSE | int64 | $A2 | pub |
SNMP_SETREQUEST | int64 | $A3 | pub |
SNMP_TRAP | int64 | $A4 | pub |
Funktionen
| Signatur | Sichtbarkeit | Beschreibung |
|---|---|---|
ASN1WriteLength(buf: int64, pos: int64, length: int64): int64 | pub | Schreibt BER-Längenfeld in Puffer |
ASN1ReadLength(buf: int64, pos: int64): int64 | pub | Liest BER-Längenfeld aus Puffer |
ASN1LengthSize(length: int64): int64 | pub | Berechnet Bytebedarf für Längenfeld |
ASN1EncodeInteger(buf: int64, pos: int64, value: int64): int64 | pub | Kodiert Integer-Wert als BER |
ASN1EncodeOctetString(buf: int64, pos: int64, str: int64, len: int64): int64 | pub | Kodiert Byte-String als BER |
ASN1EncodeNull(buf: int64, pos: int64): int64 | pub | Kodiert NULL-Wert als BER |
ASN1EncodeOID(buf: int64, pos: int64, oid: int64, oidLen: int64): int64 | pub | Kodiert OID als BER |
ASN1EncodeSequenceHeader(buf: int64, pos: int64, innerLen: int64): int64 | pub | Kodiert SEQUENCE-Header als BER |
ASN1EncodePDUHeader(buf: int64, pos: int64, pduType: int64, innerLen: int64): int64 | pub | Kodiert PDU-Header für SNMP-Pakete |
ASN1EncodeIPAddress(buf: int64, pos: int64, a: int64, b: int64, c: int64, d: int64): int64 | pub | Kodiert IPv4-Adresse als BER |
ASN1EncodeCounter32(buf: int64, pos: int64, value: int64): int64 | pub | Kodiert Counter32-Wert als BER |
ASN1EncodeGauge32(buf: int64, pos: int64, value: int64): int64 | pub | Kodiert Gauge32-Wert als BER |
ASN1EncodeTimeTicks(buf: int64, pos: int64, ticks: int64): int64 | pub | Kodiert TimeTicks-Wert als BER |
ASN1DecodeInteger(buf: int64, pos: int64): int64 | pub | Dekodiert Integer-Wert aus BER-Puffer |
ASN1SkipValue(buf: int64, pos: int64): int64 | pub | Überspringt BER-Wert und gibt Folgeposition zurück |
