asn_t * snmp_get_ifOperStatus (snmp_t *snmp, unsigned nif, ...) { if (! find_netif (snmp->ip->route, nif)) return 0; return asn_make_int (snmp->pool, SNMP_IFS_UP, ASN_INTEGER); }
asn_t * snmp_get_ifLastChange (snmp_t *snmp, unsigned nif, ...) { if (! find_netif (snmp->ip->route, nif)) return 0; return asn_make_int (snmp->pool, 0, ASN_TIME_TICKS); }
asn_t * snmp_get_ifIndex (snmp_t *snmp, unsigned nif, ...) { if (! find_netif (snmp->ip->route, nif)) return 0; return asn_make_int (snmp->pool, nif, ASN_INTEGER); }
asn_t * snmp_get_ifSpecific (snmp_t *snmp, unsigned nif, ...) { if (! find_netif (snmp->ip->route, nif)) return 0; return asn_make_oid (snmp->pool, ".0.0"); }
asn_t * snmp_get_ifSpeed (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_int (snmp->pool, u->bps, ASN_GAUGE); }
asn_t * snmp_get_ifOutUcastPkts (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_int (snmp->pool, u->out_packets - u->out_mcast_pkts, ASN_COUNTER); }
asn_t * snmp_get_ifOutErrors (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_int (snmp->pool, u->out_errors, ASN_COUNTER); }
asn_t * snmp_get_ifOutQLen (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_int (snmp->pool, u->out_qlen, ASN_GAUGE); }
asn_t * snmp_get_ifInUnknownProtos (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_int (snmp->pool, u->in_unknown_protos, ASN_COUNTER); }
asn_t * snmp_get_ifInDiscards (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_int (snmp->pool, u->in_discards, ASN_COUNTER); }
asn_t * snmp_get_ifType (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_int (snmp->pool, u->type, ASN_INTEGER); }
asn_t * snmp_get_ifDescr (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; return asn_make_string_flash (snmp->pool, u->name); }
asn_t * snmp_next_ifIndex (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { if (nextflag) ++*nif; else *nif = 1; if (! find_netif (snmp->ip->route, *nif)) return 0; return asn_make_int (snmp->pool, *nif, ASN_INTEGER); }
asn_t * snmp_next_ifAdminStatus (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { if (nextflag) ++*nif; else *nif = 1; if (! find_netif (snmp->ip->route, *nif)) return 0; return asn_make_int (snmp->pool, SNMP_IFS_UP, ASN_INTEGER); }
asn_t * snmp_get_ifPhysAddress (snmp_t *snmp, unsigned nif, ...) { netif_t *u = find_netif (snmp->ip->route, nif); if (! u) return 0; if (! u->arp) return asn_make_stringn (snmp->pool, 0, 0); return asn_make_stringn (snmp->pool, u->ethaddr.ucs, 6); }
asn_t * snmp_next_ifSpecific (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { if (nextflag) ++*nif; else *nif = 1; if (! find_netif (snmp->ip->route, *nif)) return 0; return asn_make_oid (snmp->pool, ".0.0"); }
asn_t * snmp_next_ifLastChange (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { if (nextflag) ++*nif; else *nif = 1; if (! find_netif (snmp->ip->route, *nif)) return 0; return asn_make_int (snmp->pool, 0, ASN_TIME_TICKS); }
asn_t * snmp_next_ifOutQLen (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { netif_t *u; if (nextflag) ++*nif; else *nif = 1; u = find_netif (snmp->ip->route, *nif); if (! u) return 0; return asn_make_int (snmp->pool, u->out_qlen, ASN_GAUGE); }
asn_t * snmp_next_ifInUnknownProtos (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { netif_t *u; if (nextflag) ++*nif; else *nif = 1; u = find_netif (snmp->ip->route, *nif); if (! u) return 0; return asn_make_int (snmp->pool, u->in_unknown_protos, ASN_COUNTER); }
asn_t * snmp_next_ifInNUcastPkts (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { netif_t *u; if (nextflag) ++*nif; else *nif = 1; u = find_netif (snmp->ip->route, *nif); if (! u) return 0; return asn_make_int (snmp->pool, u->in_mcast_pkts, ASN_COUNTER); }
asn_t * snmp_next_ifOutErrors (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { netif_t *u; if (nextflag) ++*nif; else *nif = 1; u = find_netif (snmp->ip->route, *nif); if (! u) return 0; return asn_make_int (snmp->pool, u->out_errors, ASN_COUNTER); }
asn_t * snmp_next_ifType (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { netif_t *u; if (nextflag) ++*nif; else *nif = 1; u = find_netif (snmp->ip->route, *nif); if (! u) return 0; return asn_make_int (snmp->pool, u->type, ASN_INTEGER); }
asn_t * snmp_next_ifDescr (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { netif_t *u; if (nextflag) ++*nif; else *nif = 1; u = find_netif (snmp->ip->route, *nif); if (! u) return 0; return asn_make_string_flash (snmp->pool, u->name); }
small_uint_t snmp_set_ifAdminStatus (snmp_t *snmp, asn_t *val, unsigned nif, ...) { netif_t *u; u = find_netif (snmp->ip->route, nif); if (! u) return SNMP_NO_SUCH_NAME; if (val->type != ASN_INTEGER) return SNMP_BAD_VALUE; if (val->int32.val != SNMP_IFS_UP && val->int32.val != SNMP_IFS_DOWN) return SNMP_BAD_VALUE; /* TODO */ return SNMP_NO_ERROR; }
asn_t * snmp_next_ifPhysAddress (snmp_t *snmp, bool_t nextflag, unsigned *nif, ...) { netif_t *u; if (nextflag) ++*nif; else *nif = 1; u = find_netif (snmp->ip->route, *nif); if (! u) return 0; if (! u->arp) return asn_make_stringn (snmp->pool, 0, 0); return asn_make_stringn (snmp->pool, u->ethaddr.ucs, 6); }
/*------------------------------------------------------------------------------*/ u8_t uip_fw_output(void) { struct uip_fw_netif *netif; #if UIP_BROADCAST const struct uip_udpip_hdr *udp = (void *)BUF; #endif /* UIP_BROADCAST */ if(uip_len == 0) { return UIP_FW_ZEROLEN; } fwcache_register(); #if UIP_BROADCAST /* Link local broadcasts go out on all interfaces. */ if(uip_ipaddr_cmp(&udp->destipaddr, &uip_broadcast_addr)) { if(defaultnetif != NULL) { defaultnetif->output(); } for(netif = netifs; netif != NULL; netif = netif->next) { netif->output(); } return UIP_FW_OK; } #endif /* UIP_BROADCAST */ netif = find_netif(); /* printf("uip_fw_output: netif %p ->output %p len %d\n", netif, netif->output, uip_len);*/ if(netif == NULL) { return UIP_FW_NOROUTE; } /* If we now have found a suitable network interface, we call its output function to send out the packet. */ return netif->output(); }
/*------------------------------------------------------------------------------*/ u8_t uip_fw_output(void) { struct uip_fw_netif *netif; if(uip_len == 0) { return UIP_FW_ZEROLEN; } fwcache_register(); #if UIP_BROADCAST /* Link local broadcasts go out on all interfaces. */ if(/*BUF->proto == UIP_PROTO_UDP &&*/ BUF->destipaddr[0] == 0xffff && BUF->destipaddr[1] == 0xffff) { if(defaultnetif != NULL) { defaultnetif->output(); } for(netif = netifs; netif != NULL; netif = netif->next) { netif->output(); } return UIP_FW_OK; } #endif /* UIP_BROADCAST */ netif = find_netif(); /* printf("uip_fw_output: netif %p ->output %p len %d\n", netif, netif->output, uip_len);*/ if(netif == NULL) { return UIP_FW_NOROUTE; } /* If we now have found a suitable network interface, we call its output function to send out the packet. */ return netif->output(); }