Exemple #1
0
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);
}
Exemple #2
0
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);
}
Exemple #3
0
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);
}
Exemple #4
0
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");
}
Exemple #5
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);
}
Exemple #6
0
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);
}
Exemple #7
0
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);
}
Exemple #8
0
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);
}
Exemple #9
0
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);
}
Exemple #10
0
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);
}
Exemple #11
0
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);
}
Exemple #12
0
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);
}
Exemple #13
0
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);
}
Exemple #14
0
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);
}
Exemple #15
0
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);
}
Exemple #16
0
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");
}
Exemple #17
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);
}
Exemple #18
0
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);
}
Exemple #19
0
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);
}
Exemple #20
0
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);
}
Exemple #21
0
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);
}
Exemple #22
0
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);
}
Exemple #23
0
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);
}
Exemple #24
0
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;
}
Exemple #25
0
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);
}
Exemple #26
0
/*------------------------------------------------------------------------------*/
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();
}
Exemple #27
0
/*------------------------------------------------------------------------------*/
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();
}