lwIP 2.2.0 Lightweight IP stack

Functions
Traps
Applications » SNMPv2c/v3 agent

## Functions
const char * | snmp_get_community_trap (void)
void | snmp_set_community_trap (const char *const community)
void | snmp_trap_dst_enable (u8_t dst_idx, u8_t enable)
void | snmp_trap_dst_ip_set (u8_t dst_idx, const ip_addr_t *dst)
void | snmp_set_auth_traps_enabled (u8_t enable)
u8_t | snmp_get_auth_traps_enabled (void)
void | snmp_set_default_trap_version (u8_t snmp_version)
u8_t | snmp_get_default_trap_version (void)
err_t | snmp_send_trap (const struct snmp_obj_id *oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds)
err_t | snmp_send_trap_generic (s32_t generic_trap)
err_t | snmp_send_trap_specific (s32_t specific_trap, struct snmp_varbind *varbinds)
void | snmp_coldstart_trap (void)
void | snmp_authfail_trap (void)
err_t | snmp_send_inform_specific (s32_t specific_trap, struct snmp_varbind *varbinds, s32_t *ptr_request_id)
err_t | snmp_send_inform_generic (s32_t generic_trap, struct snmp_varbind *varbinds, s32_t *ptr_request_id)
err_t | snmp_send_inform (const struct snmp_obj_id *oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds, s32_t *ptr_request_id)

## Detailed Description

## Function Documentation

## ◆ snmp_authfail_trap()

void snmp_authfail_trap | ( | void |  | ) |

Send authentication failure trap (used internally by agent)

Return values

  void |

## ◆ snmp_coldstart_trap()

void snmp_coldstart_trap | ( | void |  | ) |

Send coldstart trap

Return values

  void |

## ◆ snmp_get_auth_traps_enabled()

u8_t snmp_get_auth_traps_enabled | ( | void |  | ) |

Get authentication traps enabled state

Returns
  TRUE if traps are enabled, FALSE if they aren't

## ◆ snmp_get_community_trap()

const char* snmp_get_community_trap | ( | void |  | ) |

Returns current SNMP community string used for sending traps.

Returns
  current SNMP community string used for sending traps

## ◆ snmp_get_default_trap_version()

u8_t snmp_get_default_trap_version | ( | void |  | ) |

Get default SNMP version for sending traps

Returns
  selected default version: 0 - SNMP_VERSION_1 1 - SNMP_VERSION_2c 3 - SNMP_VERSION_3

## ◆ snmp_send_inform()

err_t snmp_send_inform | ( | const struct snmp_obj_id * | oid,
|  | s32_t | generic_trap,
|  | s32_t | specific_trap,
|  | struct snmp_varbind * | varbinds,
|  | s32_t * | ptr_request_id
| ) |  |

Generic function for sending informs

Parameters

  oid | points to object identifier
  generic_trap | is the trap code
  specific_trap | used for enterprise traps when generic_trap == 6
  varbinds | linked list of varbinds (at the beginning of this list function will insert 2 special purpose varbinds [see RFC 3584])
  ptr_request_id | [out] variable in which to store request_id needed to verify acknowledgement

Returns
  ERR_OK if successful

## ◆ snmp_send_inform_generic()

err_t snmp_send_inform_generic | ( | s32_t | generic_trap,
|  | struct snmp_varbind * | varbinds,
|  | s32_t * | ptr_request_id
| ) |  |

Wrapper function for sending informs

Parameters

  generic_trap | is the trap code
  varbinds | linked list of varbinds (at the beginning of this list function will insert 2 special purpose varbinds [see RFC 3584])
  ptr_request_id | [out] variable in which to store request_id needed to verify acknowledgement

Returns
  ERR_OK if successful

## ◆ snmp_send_inform_specific()

err_t snmp_send_inform_specific | ( | s32_t | specific_trap,
|  | struct snmp_varbind * | varbinds,
|  | s32_t * | ptr_request_id
| ) |  |

Wrapper function for sending informs

Parameters

  specific_trap | will be appended to enterprise oid [see RFC 3584]
  varbinds | linked list of varbinds (at the beginning of this list function will insert 2 special purpose varbinds [see RFC 3584])
  ptr_request_id | [out] variable in which to store request_id needed to verify acknowledgement

Returns
  ERR_OK if successful

## ◆ snmp_send_trap()

err_t snmp_send_trap | ( | const struct snmp_obj_id * | oid,
|  | s32_t | generic_trap,
|  | s32_t | specific_trap,
|  | struct snmp_varbind * | varbinds
| ) |  |

This function is a wrapper function for preparing and sending generic or specific traps.

Parameters

  oid | points to enterprise object identifier
  generic_trap | is the trap code
  specific_trap | used for enterprise traps when generic_trap == 6
  varbinds | linked list of varbinds to be sent

Returns
  ERR_OK when success, ERR_MEM if we're out of memory

Note
  the use of the enterprise identifier field is per RFC1215. Use .iso.org.dod.internet.mgmt.mib-2.snmp for generic traps and .iso.org.dod.internet.private.enterprises.yourenterprise (sysObjectID) for specific traps.

## ◆ snmp_send_trap_generic()

err_t snmp_send_trap_generic | ( | s32_t | generic_trap | ) |

Send generic SNMP trap

Parameters

  generic_trap | is the trap code return ERR_OK when success

## ◆ snmp_send_trap_specific()

err_t snmp_send_trap_specific | ( | s32_t | specific_trap,
|  | struct snmp_varbind * | varbinds
| ) |  |

Send specific SNMP trap with variable bindings

Parameters

  specific_trap | used for enterprise traps (generic_trap = 6)
  varbinds | linked list of varbinds to be sent

Returns
  ERR_OK when success

## ◆ snmp_set_auth_traps_enabled()

void snmp_set_auth_traps_enabled | ( | u8_t | enable | ) |

Enable/disable authentication traps

Parameters

  enable | enable SNMP traps

Return values

  void |

## ◆ snmp_set_community_trap()

void snmp_set_community_trap | ( | const char *const | community | ) |

Sets SNMP community string used for sending traps. The string itself (its storage) must be valid throughout the whole life of program (or until it is changed to sth else).

Parameters

  community | is a pointer to new trap community string

## ◆ snmp_set_default_trap_version()

void snmp_set_default_trap_version | ( | u8_t | snmp_version | ) |

Choose default SNMP version for sending traps (if not specified, default version is SNMP_VERSION_1) SNMP_VERSION_1 0 SNMP_VERSION_2c 1 SNMP_VERSION_3 3

Parameters

  snmp_version | version that will be used for sending traps

Return values

  void |

## ◆ snmp_trap_dst_enable()

void snmp_trap_dst_enable | ( | u8_t | dst_idx,
|  | u8_t | enable
| ) |  |

Sets enable switch for this trap destination.

Parameters

  dst_idx | index in 0 .. SNMP_TRAP_DESTINATIONS-1
  enable | switch if 0 destination is disabled >0 enabled.

Return values

  void |

## ◆ snmp_trap_dst_ip_set()

void snmp_trap_dst_ip_set | ( | u8_t | dst_idx,
|  | const ip_addr_t * | dst
| ) |  |

Sets IPv4 address for this trap destination.

Parameters

  dst_idx | index in 0 .. SNMP_TRAP_DESTINATIONS-1
  dst | IPv4 address in host order.

Return values

  void |