Contiki-NG
Macros | Functions

This group contains the BER implementation. More...

Macros

#define BER_DATA_TYPE_EOC   0x00
 End-of-Content. More...
 
#define BER_DATA_TYPE_INTEGER   0x02
 Integer. More...
 
#define BER_DATA_TYPE_OCTET_STRING   0x04
 Octet String. More...
 
#define BER_DATA_TYPE_NULL   0x05
 Null. More...
 
#define BER_DATA_TYPE_OBJECT_IDENTIFIER   0x06
 Object Identifier. More...
 
#define BER_DATA_TYPE_SEQUENCE   0x30
 Sequence. More...
 
#define BER_DATA_TYPE_TIMETICKS   0x43
 TimeTicks. More...
 
#define BER_DATA_TYPE_NO_SUCH_INSTANCE   0x81
 No Such Instance. More...
 
#define BER_DATA_TYPE_END_OF_MIB_VIEW   0x82
 End of MIB View. More...
 
#define BER_DATA_TYPE_PDU_GET_REQUEST   0xA0
 PDU Get Request. More...
 
#define BER_DATA_TYPE_PDU_GET_NEXT_REQUEST   0xA1
 PDU Get Next Request. More...
 
#define BER_DATA_TYPE_PDU_GET_RESPONSE   0xA2
 PDU Get Reponse. More...
 
#define BER_DATA_TYPE_PDU_SET_REQUEST   0xA3
 PDU Set Request. More...
 
#define BER_DATA_TYPE_PDU_TRAP   0xA4
 PDU Trap. More...
 
#define BER_DATA_TYPE_PDU_GET_BULK   0xA5
 PDU Get Bulk. More...
 

Functions

int snmp_ber_encode_type (snmp_packet_t *snmp_packet, uint8_t type)
 Encodes a type. More...
 
int snmp_ber_encode_length (snmp_packet_t *snmp_packet, uint16_t length)
 Encodes the length. More...
 
int snmp_ber_encode_integer (snmp_packet_t *snmp_packet, uint32_t integer)
 Encodes an integer. More...
 
int snmp_ber_encode_timeticks (snmp_packet_t *snmp_packet, uint32_t timeticks)
 Encodes a timeticks. More...
 
int snmp_ber_encode_string_len (snmp_packet_t *snmp_packet, const char *str, uint32_t length)
 Encodes a string. More...
 
int snmp_ber_encode_oid (snmp_packet_t *snmp_packet, snmp_oid_t *oid)
 Encodes a Oid. More...
 
int snmp_ber_encode_null (snmp_packet_t *snmp_packet, uint8_t type)
 Encodes a null. More...
 
int snmp_ber_decode_type (snmp_packet_t *snmp_packet, uint8_t *type)
 Decodes a type. More...
 
int snmp_ber_decode_length (snmp_packet_t *snmp_packet, uint8_t *length)
 Decodes a length. More...
 
int snmp_ber_decode_integer (snmp_packet_t *snmp_packet, uint32_t *integer)
 Decodes an integer. More...
 
int snmp_ber_decode_timeticks (snmp_packet_t *snmp_packet, uint32_t *timeticks)
 Decodes a timeticks. More...
 
int snmp_ber_decode_string_len_buffer (snmp_packet_t *snmp_packet, const char **str, uint32_t *length)
 Decodes a string. More...
 
int snmp_ber_decode_null (snmp_packet_t *snmp_packet)
 Decodes a null. More...
 
int snmp_ber_decode_oid (snmp_packet_t *snmp_packet, snmp_oid_t *oid)
 Decodes an OID. More...
 

Detailed Description

This group contains the BER implementation.

Macro Definition Documentation

◆ BER_DATA_TYPE_END_OF_MIB_VIEW

#define BER_DATA_TYPE_END_OF_MIB_VIEW   0x82

End of MIB View.

Definition at line 114 of file snmp-ber.h.

◆ BER_DATA_TYPE_EOC

#define BER_DATA_TYPE_EOC   0x00

End-of-Content.

Definition at line 66 of file snmp-ber.h.

◆ BER_DATA_TYPE_INTEGER

#define BER_DATA_TYPE_INTEGER   0x02

Integer.

Definition at line 72 of file snmp-ber.h.

◆ BER_DATA_TYPE_NO_SUCH_INSTANCE

#define BER_DATA_TYPE_NO_SUCH_INSTANCE   0x81

No Such Instance.

Definition at line 108 of file snmp-ber.h.

◆ BER_DATA_TYPE_NULL

#define BER_DATA_TYPE_NULL   0x05

Null.

Definition at line 84 of file snmp-ber.h.

◆ BER_DATA_TYPE_OBJECT_IDENTIFIER

#define BER_DATA_TYPE_OBJECT_IDENTIFIER   0x06

Object Identifier.

Definition at line 90 of file snmp-ber.h.

Referenced by snmp_api_set_oid().

◆ BER_DATA_TYPE_OCTET_STRING

#define BER_DATA_TYPE_OCTET_STRING   0x04

Octet String.

Definition at line 78 of file snmp-ber.h.

Referenced by snmp_api_set_string().

◆ BER_DATA_TYPE_PDU_GET_BULK

#define BER_DATA_TYPE_PDU_GET_BULK   0xA5

PDU Get Bulk.

Definition at line 150 of file snmp-ber.h.

◆ BER_DATA_TYPE_PDU_GET_NEXT_REQUEST

#define BER_DATA_TYPE_PDU_GET_NEXT_REQUEST   0xA1

PDU Get Next Request.

Definition at line 126 of file snmp-ber.h.

◆ BER_DATA_TYPE_PDU_GET_REQUEST

#define BER_DATA_TYPE_PDU_GET_REQUEST   0xA0

PDU Get Request.

Definition at line 120 of file snmp-ber.h.

◆ BER_DATA_TYPE_PDU_GET_RESPONSE

#define BER_DATA_TYPE_PDU_GET_RESPONSE   0xA2

PDU Get Reponse.

Definition at line 132 of file snmp-ber.h.

◆ BER_DATA_TYPE_PDU_SET_REQUEST

#define BER_DATA_TYPE_PDU_SET_REQUEST   0xA3

PDU Set Request.

Definition at line 138 of file snmp-ber.h.

◆ BER_DATA_TYPE_PDU_TRAP

#define BER_DATA_TYPE_PDU_TRAP   0xA4

PDU Trap.

Definition at line 144 of file snmp-ber.h.

◆ BER_DATA_TYPE_SEQUENCE

#define BER_DATA_TYPE_SEQUENCE   0x30

Sequence.

Definition at line 96 of file snmp-ber.h.

◆ BER_DATA_TYPE_TIMETICKS

#define BER_DATA_TYPE_TIMETICKS   0x43

TimeTicks.

Definition at line 102 of file snmp-ber.h.

Referenced by snmp_api_set_time_ticks().

Function Documentation

◆ snmp_ber_decode_integer()

int snmp_ber_decode_integer ( snmp_packet_t snmp_packet,
uint32_t *  integer 
)

Decodes an integer.

Parameters
snmp_packetA pointer to the snmp packet
integerA pointer to the integer
Returns
0 if error or 1 if success

Definition at line 351 of file snmp-ber.c.

◆ snmp_ber_decode_length()

int snmp_ber_decode_length ( snmp_packet_t snmp_packet,
uint8_t *  length 
)

Decodes a length.

Parameters
snmp_packetA pointer to the snmp packet
lengthA pointer to the length
Returns
0 if error or 1 if success

Definition at line 332 of file snmp-ber.c.

References snmp_packet_t::in, and snmp_packet_t::used.

◆ snmp_ber_decode_null()

int snmp_ber_decode_null ( snmp_packet_t snmp_packet)

Decodes a null.

Parameters
snmp_packetA pointer to the snmp packet
Returns
0 if error or 1 if success

Definition at line 492 of file snmp-ber.c.

References snmp_packet_t::in, and snmp_packet_t::used.

◆ snmp_ber_decode_oid()

int snmp_ber_decode_oid ( snmp_packet_t snmp_packet,
snmp_oid_t oid 
)

Decodes an OID.

Parameters
snmp_packetpointer to the snmp packet
oidA pointer to the OID
Returns
0 if error or 1 if success

Definition at line 430 of file snmp-ber.c.

◆ snmp_ber_decode_string_len_buffer()

int snmp_ber_decode_string_len_buffer ( snmp_packet_t snmp_packet,
const char **  str,
uint32_t *  length 
)

Decodes a string.

Parameters
snmp_packetA pointer to the snmp packet
strA pointer to the string
lengthA pointer to the string length
Returns
0 if error or 1 if success

Definition at line 357 of file snmp-ber.c.

◆ snmp_ber_decode_timeticks()

int snmp_ber_decode_timeticks ( snmp_packet_t snmp_packet,
uint32_t *  timeticks 
)

Decodes a timeticks.

Parameters
snmp_packetA pointer to the snmp packet
timeticksA pointer to the timeticks
Returns
0 if error or 1 if success

Definition at line 345 of file snmp-ber.c.

◆ snmp_ber_decode_type()

int snmp_ber_decode_type ( snmp_packet_t snmp_packet,
uint8_t *  type 
)

Decodes a type.

Parameters
snmp_packetA pointer to the snmp packet
typeA pointer to the type
Returns
0 if error or 1 if success

Definition at line 319 of file snmp-ber.c.

References snmp_packet_t::in, and snmp_packet_t::used.

◆ snmp_ber_encode_integer()

int snmp_ber_encode_integer ( snmp_packet_t snmp_packet,
uint32_t  integer 
)

Encodes an integer.

Parameters
snmp_packetA pointer to the snmp packet
integerA integer
Returns
0 if error or 1 if success

Definition at line 152 of file snmp-ber.c.

◆ snmp_ber_encode_length()

int snmp_ber_encode_length ( snmp_packet_t snmp_packet,
uint16_t  length 
)

Encodes the length.

Parameters
snmp_packetA pointer to the snmp packet
lengthA length
Returns
0 if error or 1 if success

Definition at line 96 of file snmp-ber.c.

References snmp_packet_t::max, snmp_packet_t::out, and snmp_packet_t::used.

◆ snmp_ber_encode_null()

int snmp_ber_encode_null ( snmp_packet_t snmp_packet,
uint8_t  type 
)

Encodes a null.

Parameters
snmp_packetA pointer to the snmp packet
typeA type
Returns
0 if error or 1 if success

Definition at line 257 of file snmp-ber.c.

References snmp_packet_t::max, snmp_packet_t::out, snmp_ber_encode_type(), and snmp_packet_t::used.

◆ snmp_ber_encode_oid()

int snmp_ber_encode_oid ( snmp_packet_t snmp_packet,
snmp_oid_t oid 
)

Encodes a Oid.

Parameters
snmp_packetA pointer to the snmp packet
oidA OID
Returns
0 if error or 1 if success

Definition at line 184 of file snmp-ber.c.

◆ snmp_ber_encode_string_len()

int snmp_ber_encode_string_len ( snmp_packet_t snmp_packet,
const char *  str,
uint32_t  length 
)

Encodes a string.

Parameters
snmp_packetA pointer to the snmp packet
strA string
lengthThe string length
Returns
0 if error or 1 if success

Definition at line 158 of file snmp-ber.c.

◆ snmp_ber_encode_timeticks()

int snmp_ber_encode_timeticks ( snmp_packet_t snmp_packet,
uint32_t  timeticks 
)

Encodes a timeticks.

Parameters
snmp_packetA pointer to the snmp packet
timeticksA TimeTicks
Returns
0 if error or 1 if success

Definition at line 146 of file snmp-ber.c.

◆ snmp_ber_encode_type()

int snmp_ber_encode_type ( snmp_packet_t snmp_packet,
uint8_t  type 
)

Encodes a type.

Parameters
snmp_packetA pointer to the snmp packet
typeA type
Returns
0 if error or 1 if success

Definition at line 83 of file snmp-ber.c.

References snmp_packet_t::max, snmp_packet_t::out, and snmp_packet_t::used.

Referenced by snmp_ber_encode_null().