Rtos API example

Embed: (wiki syntax)

« Back to documentation index

snmp_asn1.h File Reference

snmp_asn1.h File Reference

Abstract Syntax Notation One (ISO 8824, 8825) codec. More...

Go to the source code of this file.

Functions

err_t snmp_asn1_dec_tlv (struct snmp_pbuf_stream *pbuf_stream, struct snmp_asn1_tlv *tlv)
 Decodes a TLV from a pbuf stream.
err_t snmp_asn1_dec_u32t (struct snmp_pbuf_stream *pbuf_stream, u16_t len, u32_t *value)
 Decodes positive integer (counter, gauge, timeticks) into u32_t.
err_t snmp_asn1_dec_u64t (struct snmp_pbuf_stream *pbuf_stream, u16_t len, u32_t *value)
 Decodes large positive integer (counter64) into 2x u32_t.
err_t snmp_asn1_dec_s32t (struct snmp_pbuf_stream *pbuf_stream, u16_t len, s32_t *value)
 Decodes integer into s32_t.
err_t snmp_asn1_dec_oid (struct snmp_pbuf_stream *pbuf_stream, u16_t len, u32_t *oid, u8_t *oid_len, u8_t oid_max_len)
 Decodes object identifier from incoming message into array of u32_t.
err_t snmp_asn1_dec_raw (struct snmp_pbuf_stream *pbuf_stream, u16_t len, u8_t *buf, u16_t *buf_len, u16_t buf_max_len)
 Decodes (copies) raw data (ip-addresses, octet strings, opaque encoding) from incoming message into array.
err_t snmp_ans1_enc_tlv (struct snmp_pbuf_stream *pbuf_stream, struct snmp_asn1_tlv *tlv)
 Encodes a TLV into a pbuf stream.
void snmp_asn1_enc_length_cnt (u16_t length, u8_t *octets_needed)
 Returns octet count for length.
void snmp_asn1_enc_u32t_cnt (u32_t value, u16_t *octets_needed)
 Returns octet count for an u32_t.
void snmp_asn1_enc_u64t_cnt (const u32_t *value, u16_t *octets_needed)
 Returns octet count for an u64_t.
void snmp_asn1_enc_s32t_cnt (s32_t value, u16_t *octets_needed)
 Returns octet count for an s32_t.
void snmp_asn1_enc_oid_cnt (const u32_t *oid, u16_t oid_len, u16_t *octets_needed)
 Returns octet count for an object identifier.
err_t snmp_asn1_enc_oid (struct snmp_pbuf_stream *pbuf_stream, const u32_t *oid, u16_t oid_len)
 Encodes object identifier into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_s32t (struct snmp_pbuf_stream *pbuf_stream, u16_t octets_needed, s32_t value)
 Encodes s32_t integer into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_u32t (struct snmp_pbuf_stream *pbuf_stream, u16_t octets_needed, u32_t value)
 Encodes u32_t (counter, gauge, timeticks) into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_u64t (struct snmp_pbuf_stream *pbuf_stream, u16_t octets_needed, const u32_t *value)
 Encodes u64_t (counter64) into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_raw (struct snmp_pbuf_stream *pbuf_stream, const u8_t *raw, u16_t raw_len)
 Encodes raw data (octet string, opaque) into a pbuf chained ASN1 msg.

Detailed Description

Abstract Syntax Notation One (ISO 8824, 8825) codec.

Definition in file snmp_asn1.h.


Function Documentation

err_t snmp_ans1_enc_tlv ( struct snmp_pbuf_stream *  pbuf_stream,
struct snmp_asn1_tlv *  tlv 
)

Encodes a TLV into a pbuf stream.

Parameters:
pbuf_streampoints to a pbuf stream
tlvTLV to encode
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) encode

Definition at line 57 of file lwip_snmp_asn1.c.

err_t snmp_asn1_dec_oid ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  len,
u32_t *  oid,
u8_t *  oid_len,
u8_t  oid_max_len 
)

Decodes object identifier from incoming message into array of u32_t.

Parameters:
pbuf_streampoints to a pbuf stream
lenlength of the coded object identifier
oidreturn decoded object identifier
oid_lenreturn decoded object identifier length
oid_max_lensize of oid buffer
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) decode

Definition at line 641 of file lwip_snmp_asn1.c.

err_t snmp_asn1_dec_raw ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  len,
u8_t *  buf,
u16_t *  buf_len,
u16_t  buf_max_len 
)

Decodes (copies) raw data (ip-addresses, octet strings, opaque encoding) from incoming message into array.

Parameters:
pbuf_streampoints to a pbuf stream
lenlength of the coded raw data (zero is valid, e.g. empty string!)
bufreturn raw bytes
buf_lenreturns length of the raw return value
buf_max_lenbuffer size
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) decode

Definition at line 732 of file lwip_snmp_asn1.c.

err_t snmp_asn1_dec_s32t ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  len,
s32_t *  value 
)

Decodes integer into s32_t.

Parameters:
pbuf_streampoints to a pbuf stream
lenlength of the coded integer field
valuereturn host order integer
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) decode
Note:
ASN coded integers are _always_ signed!

Definition at line 577 of file lwip_snmp_asn1.c.

err_t snmp_asn1_dec_tlv ( struct snmp_pbuf_stream *  pbuf_stream,
struct snmp_asn1_tlv *  tlv 
)

Decodes a TLV from a pbuf stream.

Parameters:
pbuf_streampoints to a pbuf stream
tlvreturns decoded TLV
Returns:
ERR_OK if successful, ERR_VAL if we can't decode

Definition at line 423 of file lwip_snmp_asn1.c.

err_t snmp_asn1_dec_u32t ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  len,
u32_t *  value 
)

Decodes positive integer (counter, gauge, timeticks) into u32_t.

Parameters:
pbuf_streampoints to a pbuf stream
lenlength of the coded integer field
valuereturn host order integer
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) decode
Note:
ASN coded integers are _always_ signed. E.g. +0xFFFF is coded as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!!

Definition at line 485 of file lwip_snmp_asn1.c.

err_t snmp_asn1_dec_u64t ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  len,
u32_t *  value 
)

Decodes large positive integer (counter64) into 2x u32_t.

Parameters:
pbuf_streampoints to a pbuf stream
lenlength of the coded integer field
valuereturn host order integer
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) decode
Note:
ASN coded integers are _always_ signed. E.g. +0xFFFF is coded as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!!

Definition at line 525 of file lwip_snmp_asn1.c.

void snmp_asn1_enc_length_cnt ( u16_t  length,
u8_t *  octets_needed 
)

Returns octet count for length.

Parameters:
lengthparameter length
octets_neededpoints to the return value

Definition at line 295 of file lwip_snmp_asn1.c.

err_t snmp_asn1_enc_oid ( struct snmp_pbuf_stream *  pbuf_stream,
const u32_t *  oid,
u16_t  oid_len 
)

Encodes object identifier into a pbuf chained ASN1 msg.

Parameters:
pbuf_streampoints to a pbuf stream
oidpoints to object identifier array
oid_lenobject identifier array length
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) encode

Definition at line 248 of file lwip_snmp_asn1.c.

void snmp_asn1_enc_oid_cnt ( const u32_t *  oid,
u16_t  oid_len,
u16_t *  octets_needed 
)

Returns octet count for an object identifier.

Parameters:
oidpoints to object identifier array
oid_lenobject identifier array length
octets_neededpoints to the return value

Definition at line 390 of file lwip_snmp_asn1.c.

err_t snmp_asn1_enc_raw ( struct snmp_pbuf_stream *  pbuf_stream,
const u8_t *  raw,
u16_t  raw_len 
)

Encodes raw data (octet string, opaque) into a pbuf chained ASN1 msg.

Parameters:
pbuf_streampoints to a pbuf stream
raw_lenraw data length
rawpoints raw data
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) encode

Definition at line 133 of file lwip_snmp_asn1.c.

err_t snmp_asn1_enc_s32t ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  octets_needed,
s32_t  value 
)

Encodes s32_t integer into a pbuf chained ASN1 msg.

Parameters:
pbuf_streampoints to a pbuf stream
octets_neededencoding length (from snmp_asn1_enc_s32t_cnt())
valueis the host order s32_t value to be encoded
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) encode
See also:
snmp_asn1_enc_s32t_cnt()

Definition at line 225 of file lwip_snmp_asn1.c.

void snmp_asn1_enc_s32t_cnt ( s32_t  value,
u16_t *  octets_needed 
)

Returns octet count for an s32_t.

Parameters:
valuevalue to be encoded
octets_neededpoints to the return value
Note:
ASN coded integers are _always_ signed.

Definition at line 366 of file lwip_snmp_asn1.c.

err_t snmp_asn1_enc_u32t ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  octets_needed,
u32_t  value 
)

Encodes u32_t (counter, gauge, timeticks) into a pbuf chained ASN1 msg.

Parameters:
pbuf_streampoints to a pbuf stream
octets_neededencoding length (from snmp_asn1_enc_u32t_cnt())
valueis the host order u32_t value to be encoded
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) encode
See also:
snmp_asn1_enc_u32t_cnt()

Definition at line 151 of file lwip_snmp_asn1.c.

void snmp_asn1_enc_u32t_cnt ( u32_t  value,
u16_t *  octets_needed 
)

Returns octet count for an u32_t.

Parameters:
valuevalue to be encoded
octets_neededpoints to the return value
Note:
ASN coded integers are _always_ signed. E.g. +0xFFFF is coded as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!!

Definition at line 317 of file lwip_snmp_asn1.c.

err_t snmp_asn1_enc_u64t ( struct snmp_pbuf_stream *  pbuf_stream,
u16_t  octets_needed,
const u32_t *  value 
)

Encodes u64_t (counter64) into a pbuf chained ASN1 msg.

Parameters:
pbuf_streampoints to a pbuf stream
octets_neededencoding length (from snmp_asn1_enc_u32t_cnt())
valueis the host order u32_t value to be encoded
Returns:
ERR_OK if successful, ERR_ARG if we can't (or won't) encode
See also:
snmp_asn1_enc_u64t_cnt()

Definition at line 184 of file lwip_snmp_asn1.c.

void snmp_asn1_enc_u64t_cnt ( const u32_t *  value,
u16_t *  octets_needed 
)

Returns octet count for an u64_t.

Parameters:
valuevalue to be encoded
octets_neededpoints to the return value
Note:
ASN coded integers are _always_ signed. E.g. +0xFFFF is coded as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!!

Definition at line 343 of file lwip_snmp_asn1.c.