static oid ospfv3_trap_oid[] = {OSPFv3MIB, 0};
/* Hook functions. */
-static u_char *ospfv3GeneralGroup(struct variable *, oid *, size_t *, int,
+static uint8_t *ospfv3GeneralGroup(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static uint8_t *ospfv3AreaEntry(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+static uint8_t *ospfv3WwLsdbEntry(struct variable *, oid *, size_t *, int,
size_t *, WriteMethod **);
-static u_char *ospfv3AreaEntry(struct variable *, oid *, size_t *, int,
+static uint8_t *ospfv3NbrEntry(struct variable *, oid *, size_t *, int,
size_t *, WriteMethod **);
-static u_char *ospfv3WwLsdbEntry(struct variable *, oid *, size_t *, int,
- size_t *, WriteMethod **);
-static u_char *ospfv3NbrEntry(struct variable *, oid *, size_t *, int, size_t *,
+static uint8_t *ospfv3IfEntry(struct variable *, oid *, size_t *, int, size_t *,
WriteMethod **);
-static u_char *ospfv3IfEntry(struct variable *, oid *, size_t *, int, size_t *,
- WriteMethod **);
static struct variable ospfv3_variables[] = {
/* OSPF general variables */
{1, 9, 1, 15}},
};
-static u_char *ospfv3GeneralGroup(struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len,
- WriteMethod **write_method)
+static uint8_t *ospfv3GeneralGroup(struct variable *v, oid *name,
+ size_t *length, int exact, size_t *var_len,
+ WriteMethod **write_method)
{
- u_int16_t sum;
- u_int32_t count;
+ uint16_t sum;
+ uint32_t count;
struct ospf6_lsa *lsa = NULL;
/* Check whether the instance identifier is valid */
return NULL;
}
-static u_char *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len,
- WriteMethod **write_method)
+static uint8_t *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len,
+ WriteMethod **write_method)
{
struct ospf6_area *oa, *area = NULL;
struct ospf6_lsa *lsa = NULL;
- u_int32_t area_id = 0;
- u_int32_t count;
- u_int16_t sum;
+ uint32_t area_id = 0;
+ uint32_t count;
+ uint16_t sum;
struct listnode *node;
unsigned int len;
char a[16];
inet_ntop(AF_INET, &area_id, a, sizeof(a));
zlog_debug("SNMP access by area: %s, exact=%d len=%d length=%lu", a,
- exact, len, (u_long)*length);
+ exact, len, (unsigned long)*length);
for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
if (area == NULL) {
inet_ntop(AF_INET, &area->area_id, a, sizeof(a));
zlog_debug("SNMP found area: %s, exact=%d len=%d length=%lu", a, exact,
- len, (u_long)*length);
+ len, (unsigned long)*length);
switch (v->magic) {
case OSPFv3IMPORTASEXTERN:
return (ifp1->ifindex - ifp2->ifindex);
}
-static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len,
- WriteMethod **write_method)
+static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len,
+ WriteMethod **write_method)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct ospf6_lsa *lsa = NULL;
ifindex_t ifindex;
uint32_t area_id, id, instid, adv_router;
- u_int16_t type;
+ uint16_t type;
int len;
oid *offset;
int offsetlen;
if (len)
id = htonl(*offset);
offset += len;
- //offsetlen -= len; // Add back in if we need it again
+ // offsetlen -= len; // Add back in if we need it again
if (exact) {
if (v->magic & OSPFv3WWASTABLE) {
break;
case OSPFv3WWLSDBADVERTISEMENT:
*var_len = ntohs(lsa->header->length);
- return (u_char *)lsa->header;
+ return (uint8_t *)lsa->header;
break;
case OSPFv3WWLSDBTYPEKNOWN:
return SNMP_INTEGER(OSPF6_LSA_IS_KNOWN(lsa->header->type)
return NULL;
}
-static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len,
- WriteMethod **write_method)
+static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len,
+ WriteMethod **write_method)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
ifindex_t ifindex = 0;
struct list *ifslist;
oid *offset;
int offsetlen, len;
- u_int32_t sum;
+ uint32_t sum;
if (smux_header_table(v, name, length, exact, var_len, write_method)
== MATCH_FAILED)
len = (offsetlen < 1 ? 0 : 1);
if (len)
instid = *offset;
- //offset += len; // Add back in if we ever start using again
- //offsetlen -= len;
+ // offset += len; // Add back in if we ever start using again
+ // offsetlen -= len;
if (exact) {
oi = ospf6_interface_lookup_by_ifindex(ifindex);
return SNMP_INTEGER(ntohl(oi->area->area_id));
break;
case OSPFv3IFTYPE:
- if (if_is_broadcast(oi->interface))
+ if (oi->type == OSPF_IFTYPE_BROADCAST)
return SNMP_INTEGER(1);
- else if (if_is_pointopoint(oi->interface))
+ else if (oi->type == OSPF_IFTYPE_POINTOPOINT)
return SNMP_INTEGER(3);
else
break; /* Unknown, don't put anything */
return NULL;
}
-static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len,
- WriteMethod **write_method)
+static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len,
+ WriteMethod **write_method)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
ifindex_t ifindex = 0;
len = (offsetlen < 1 ? 0 : 1);
if (len)
rtrid = htonl(*offset);
- //offset += len; // Add back in if we ever start looking at data
- //offsetlen -= len;
+ // offset += len; // Add back in if we ever start looking at data
+ // offsetlen -= len;
if (exact) {
oi = ospf6_interface_lookup_by_ifindex(ifindex);
return SNMP_INTEGER(2); /* IPv6 only */
case OSPFv3NBRADDRESS:
*var_len = sizeof(struct in6_addr);
- return (u_char *)&on->linklocal_addr;
+ return (uint8_t *)&on->linklocal_addr;
case OSPFv3NBROPTIONS:
return SNMP_INTEGER(on->options[2]);
case OSPFv3NBRPRIORITY:
index[1] = on->ospf6_if->instance_id;
index[2] = ntohl(on->router_id);
- smux_trap(ospfv3_variables,
- sizeof ospfv3_variables / sizeof(struct variable),
- ospfv3_trap_oid, sizeof ospfv3_trap_oid / sizeof(oid),
- ospfv3_oid, sizeof ospfv3_oid / sizeof(oid), index, 3,
- ospf6NbrTrapList,
- sizeof ospf6NbrTrapList / sizeof(struct trap_object),
- NBRSTATECHANGE);
+ smux_trap(ospfv3_variables, array_size(ospfv3_variables),
+ ospfv3_trap_oid, array_size(ospfv3_trap_oid), ospfv3_oid,
+ sizeof ospfv3_oid / sizeof(oid), index, 3, ospf6NbrTrapList,
+ array_size(ospf6NbrTrapList), NBRSTATECHANGE);
return 0;
}
index[0] = oi->interface->ifindex;
index[1] = oi->instance_id;
- smux_trap(ospfv3_variables,
- sizeof ospfv3_variables / sizeof(struct variable),
- ospfv3_trap_oid, sizeof ospfv3_trap_oid / sizeof(oid),
- ospfv3_oid, sizeof ospfv3_oid / sizeof(oid), index, 2,
- ospf6IfTrapList,
- sizeof ospf6IfTrapList / sizeof(struct trap_object),
- IFSTATECHANGE);
+ smux_trap(ospfv3_variables, array_size(ospfv3_variables),
+ ospfv3_trap_oid, array_size(ospfv3_trap_oid), ospfv3_oid,
+ sizeof ospfv3_oid / sizeof(oid), index, 2, ospf6IfTrapList,
+ array_size(ospf6IfTrapList), IFSTATECHANGE);
return 0;
}