My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

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_type (struct pbuf *p, u16_t ofs, u8_t *type)
 Retrieves type field from incoming pbuf chain.
err_t snmp_asn1_dec_length (struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length)
 Decodes length field from incoming pbuf chain into host length.
err_t snmp_asn1_dec_u32t (struct pbuf *p, u16_t ofs, u16_t len, u32_t *value)
 Decodes positive integer (counter, gauge, timeticks) into u32_t.
err_t snmp_asn1_dec_s32t (struct pbuf *p, u16_t ofs, u16_t len, s32_t *value)
 Decodes integer into s32_t.
err_t snmp_asn1_dec_oid (struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid)
 Decodes object identifier from incoming message into array of s32_t.
err_t snmp_asn1_dec_raw (struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw)
 Decodes (copies) raw data (ip-addresses, octet strings, opaque encoding) from incoming message into array.
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_s32t_cnt (s32_t value, u16_t *octets_needed)
 Returns octet count for an s32_t.
void snmp_asn1_enc_oid_cnt (u8_t ident_len, s32_t *ident, u16_t *octets_needed)
 Returns octet count for an object identifier.
err_t snmp_asn1_enc_type (struct pbuf *p, u16_t ofs, u8_t type)
 Encodes ASN type field into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_length (struct pbuf *p, u16_t ofs, u16_t length)
 Encodes host order length field into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_u32t (struct pbuf *p, u16_t ofs, u8_t octets_needed, u32_t value)
 Encodes u32_t (counter, gauge, timeticks) into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_s32t (struct pbuf *p, u16_t ofs, u8_t octets_needed, s32_t value)
 Encodes s32_t integer into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_oid (struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident)
 Encodes object identifier into a pbuf chained ASN1 msg.
err_t snmp_asn1_enc_raw (struct pbuf *p, u16_t ofs, u8_t raw_len, u8_t *raw)
 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_asn1_dec_length ( struct pbuf *  p,
u16_t  ofs,
u8_t *  octets_used,
u16_t *  length 
)

Decodes length field from incoming pbuf chain into host length.

Parameters:
ppoints to a pbuf holding an ASN1 coded length
ofspoints to the offset within the pbuf chain of the ASN1 coded length
octets_usedreturns number of octets used by the length code
lengthreturn host order length, upto 64k
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) decode

Definition at line 85 of file asn1_dec.c.

err_t snmp_asn1_dec_oid ( struct pbuf *  p,
u16_t  ofs,
u16_t  len,
struct snmp_obj_id oid 
)

Decodes object identifier from incoming message into array of s32_t.

Parameters:
ppoints to a pbuf holding an ASN1 coded object identifier
ofspoints to the offset within the pbuf chain of the ASN1 coded object identifier
lenlength of the coded object identifier
oidreturn object identifier struct
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) decode

Definition at line 429 of file asn1_dec.c.

err_t snmp_asn1_dec_raw ( struct pbuf *  p,
u16_t  ofs,
u16_t  len,
u16_t  raw_len,
u8_t *  raw 
)

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

Parameters:
ppoints to a pbuf holding an ASN1 coded raw data
ofspoints to the offset within the pbuf chain of the ASN1 coded raw data
lenlength of the coded raw data (zero is valid, e.g. empty string!)
raw_lenlength of the raw return value
rawreturn raw bytes
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) decode

Definition at line 596 of file asn1_dec.c.

err_t snmp_asn1_dec_s32t ( struct pbuf *  p,
u16_t  ofs,
u16_t  len,
s32_t *  value 
)

Decodes integer into s32_t.

Parameters:
ppoints to a pbuf holding an ASN1 coded integer
ofspoints to the offset within the pbuf chain of the ASN1 coded integer
lenlength of the coded integer field
valuereturn host order integer
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) decode
Note:
ASN coded integers are _always_ signed!

Definition at line 333 of file asn1_dec.c.

err_t snmp_asn1_dec_type ( struct pbuf *  p,
u16_t  ofs,
u8_t *  type 
)

Retrieves type field from incoming pbuf chain.

Parameters:
ppoints to a pbuf holding an ASN1 coded type field
ofspoints to the offset within the pbuf chain of the ASN1 coded type field
typereturn ASN1 type
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) decode

Definition at line 52 of file asn1_dec.c.

err_t snmp_asn1_dec_u32t ( struct pbuf *  p,
u16_t  ofs,
u16_t  len,
u32_t *  value 
)

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

Parameters:
ppoints to a pbuf holding an ASN1 coded integer
ofspoints to the offset within the pbuf chain of the ASN1 coded integer
lenlength of the coded integer field
valuereturn host order integer
Returns:
ERR_OK if successfull, 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 240 of file asn1_dec.c.

err_t snmp_asn1_enc_length ( struct pbuf *  p,
u16_t  ofs,
u16_t  length 
)

Encodes host order length field into a pbuf chained ASN1 msg.

Parameters:
ppoints to output pbuf to encode length into
ofspoints to the offset within the pbuf chain
lengthis the host order length to be encoded
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) encode

Definition at line 213 of file asn1_enc.c.

void snmp_asn1_enc_length_cnt ( u16_t  length,
u8_t *  octets_needed 
)

Returns octet count for length.

Parameters:
length
octets_neededpoints to the return value

Definition at line 50 of file asn1_enc.c.

err_t snmp_asn1_enc_oid ( struct pbuf *  p,
u16_t  ofs,
u8_t  ident_len,
s32_t *  ident 
)

Encodes object identifier into a pbuf chained ASN1 msg.

Parameters:
ppoints to output pbuf to encode oid into
ofspoints to the offset within the pbuf chain
ident_lenobject identifier array length
identpoints to object identifier array
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) encode

Definition at line 438 of file asn1_enc.c.

void snmp_asn1_enc_oid_cnt ( u8_t  ident_len,
s32_t *  ident,
u16_t *  octets_needed 
)

Returns octet count for an object identifier.

Parameters:
ident_lenobject identifier array length
identpoints to object identifier array
octets_neededpoints to the return value

Definition at line 142 of file asn1_enc.c.

err_t snmp_asn1_enc_raw ( struct pbuf *  p,
u16_t  ofs,
u8_t  raw_len,
u8_t *  raw 
)

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

Parameters:
ppoints to output pbuf to encode raw data into
ofspoints to the offset within the pbuf chain
raw_lenraw data length
rawpoints raw data
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) encode

Definition at line 562 of file asn1_enc.c.

err_t snmp_asn1_enc_s32t ( struct pbuf *  p,
u16_t  ofs,
u8_t  octets_needed,
s32_t  value 
)

Encodes s32_t integer into a pbuf chained ASN1 msg.

Parameters:
ppoints to output pbuf to encode value into
ofspoints to the offset within the pbuf chain
octets_neededencoding length (from snmp_asn1_enc_s32t_cnt())
valueis the host order s32_t value to be encoded
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
See also:
snmp_asn1_enc_s32t_cnt()

Definition at line 384 of file asn1_enc.c.

void snmp_asn1_enc_s32t_cnt ( s32_t  value,
u16_t *  octets_needed 
)

Returns octet count for an s32_t.

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

Definition at line 110 of file asn1_enc.c.

err_t snmp_asn1_enc_type ( struct pbuf *  p,
u16_t  ofs,
u8_t  type 
)

Encodes ASN type field into a pbuf chained ASN1 msg.

Parameters:
ppoints to output pbuf to encode value into
ofspoints to the offset within the pbuf chain
typeinput ASN1 type
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) encode

Definition at line 181 of file asn1_enc.c.

err_t snmp_asn1_enc_u32t ( struct pbuf *  p,
u16_t  ofs,
u8_t  octets_needed,
u32_t  value 
)

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

Parameters:
ppoints to output pbuf to encode value into
ofspoints to the offset within the pbuf chain
octets_neededencoding length (from snmp_asn1_enc_u32t_cnt())
valueis the host order u32_t value to be encoded
Returns:
ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
See also:
snmp_asn1_enc_u32t_cnt()

Definition at line 308 of file asn1_enc.c.

void snmp_asn1_enc_u32t_cnt ( u32_t  value,
u16_t *  octets_needed 
)

Returns octet count for an u32_t.

Parameters:
value
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 77 of file asn1_enc.c.