0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 10:11:53 +00:00
bird/proto/snmp/snmp_utils.h

66 lines
2.5 KiB
C
Raw Normal View History

2022-11-22 13:16:09 +00:00
#ifndef _BIRD_SNMP_UTILS_H_
#define _BIRD_SNMP_UTILS_H_
#include "subagent.h"
uint snmp_pkt_len(const byte *start, const byte *end);
2023-07-26 12:02:23 +00:00
size_t snmp_str_size_from_len(uint len);
2022-11-22 13:16:09 +00:00
size_t snmp_str_size(const char *str);
2023-07-26 12:02:23 +00:00
int snmp_is_oid_empty(const struct oid *oid);
int snmp_valid_ip4_index(const struct oid *o, uint start);
int snmp_valid_ip4_index_unsafe(const struct oid *o, uint start);
uint snmp_oid_size(const struct oid *o);
2022-12-10 17:08:00 +00:00
size_t snmp_oid_sizeof(uint n_subid);
2023-07-26 12:02:23 +00:00
uint snmp_varbind_hdr_size_from_oid(struct oid *oid);
uint snmp_varbind_header_size(struct agentx_varbind *vb);
uint snmp_varbind_size(struct agentx_varbind *vb, int byte_ord);
int snmp_test_varbind(const struct agentx_varbind *vb);
2022-11-22 13:16:09 +00:00
2023-07-26 12:02:23 +00:00
void snmp_oid_copy(struct oid *dest, const struct oid *src);
struct oid *snmp_oid_duplicate(pool *pool, const struct oid *oid);
2022-12-10 17:08:00 +00:00
struct oid *snmp_oid_blank(struct snmp_proto *p);
2022-11-22 13:16:09 +00:00
struct agentx_varbind *snmp_create_varbind(byte* buf, struct oid *oid);
byte *snmp_fix_varbind(struct agentx_varbind *vb, struct oid *new);
2023-07-26 12:02:23 +00:00
int snmp_oid_compare(const struct oid *first, const struct oid *second);
2022-11-22 13:16:09 +00:00
byte *snmp_no_such_object(byte *buf, struct agentx_varbind *vb, struct oid *oid);
byte *snmp_no_such_instance(byte *buf, struct agentx_varbind *vb, struct oid *oid);
byte *snmp_put_str(byte *buf, const char *str);
2023-07-26 12:02:23 +00:00
byte *snmp_put_nstr(byte *buf, const char *str, uint len);
2022-11-22 13:16:09 +00:00
byte *snmp_put_blank(byte *buf);
byte *snmp_put_oid(byte *buf, struct oid *oid);
2023-07-26 12:02:23 +00:00
byte *snmp_put_ip4(byte *buf, ip4_addr ip4);
2023-03-24 14:00:54 +00:00
2022-11-22 13:16:09 +00:00
byte *snmp_put_fbyte(byte *buf, u8 data);
void snmp_oid_ip4_index(struct oid *o, uint start, ip4_addr addr);
void snmp_oid_dump(const struct oid *oid);
2022-11-22 13:16:09 +00:00
2023-07-26 12:02:23 +00:00
//struct oid *snmp_prefixize(struct snmp_proto *p, struct oid *o, int byte_ord);
2022-12-10 17:08:00 +00:00
struct snmp_register *snmp_register_create(struct snmp_proto *p, u8 mib_class);
void snmp_register_ack(struct snmp_proto *p, struct agentx_header *h, u8 class);
2022-12-17 17:16:19 +00:00
2023-07-26 12:02:23 +00:00
byte *snmp_varbind_int(struct agentx_varbind *vb, uint size, u32 val);
byte *snmp_varbind_counter32(struct agentx_varbind *vb, uint size, u32 val);
byte *snmp_varbind_gauge32(struct agentx_varbind *vb, uint size, s64 val);
byte *snmp_varbind_ticks(struct agentx_varbind *vb, uint size, u32 val);
2023-07-26 12:02:23 +00:00
byte *snmp_varbind_ip4(struct agentx_varbind *vb, uint size, ip4_addr addr);
byte *snmp_varbind_nstr(struct agentx_varbind *vb, uint size, const char *str, uint len);
2022-12-17 17:16:19 +00:00
void snmp_dump_packet(byte *pkt, uint size);
2023-07-26 12:02:23 +00:00
enum agentx_type snmp_search_res_to_type(enum snmp_search_res res);
int agentx_type_size(enum agentx_type t);
2022-11-22 13:16:09 +00:00
#endif