• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snmp_get_sysuptime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中snmp_get_sysuptime函数的典型用法代码示例。如果您正苦于以下问题:C++ snmp_get_sysuptime函数的具体用法?C++ snmp_get_sysuptime怎么用?C++ snmp_get_sysuptime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了snmp_get_sysuptime函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: netif_set_up

/**
 * Bring an interface up, available for processing
 * traffic.
 * 
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_up(struct netif *netif)
{
  
  if (!(netif->flags & NETIF_FLAG_UP)) {
    netif->flags |= NETIF_FLAG_UP;
#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif /* LWIP_SNMP */

    NETIF_STATUS_CALLBACK(netif);
	//printf("netif flag is %d\n\r",(netif->flags& NETIF_FLAG_LINK_UP));
    if (netif->flags & NETIF_FLAG_LINK_UP) {
#if LWIP_ARP
      /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ 
      if (netif->flags & (NETIF_FLAG_ETHARP)) {
        etharp_gratuitous(netif);
		//printf("etharp_gratuitous end\n\r");
      }
#endif /* LWIP_ARP */

#if LWIP_IGMP
      /* resend IGMP memberships */
      if (netif->flags & NETIF_FLAG_IGMP) {
        igmp_report_groups( netif);
      }
#endif /* LWIP_IGMP */
    }
  }
}
开发者ID:JasonYSU,项目名称:VETH3000Switch,代码行数:38,代码来源:netif.c


示例2: netif_set_up

/**
 * Bring an interface up, available for processing
 * traffic.
 *
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 *
 * @see dhcp_start()
 */
void netif_set_up(struct netif *netif)
{
  if ( !(netif->flags & NETIF_FLAG_UP )) {
    netif->flags |= NETIF_FLAG_UP;

#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif /* LWIP_SNMP */

    NETIF_LINK_CALLBACK(netif);
    NETIF_STATUS_CALLBACK(netif);

#if LWIP_ARP_GRATUITOUS
    /** For Ethernet network interfaces, we would like to send a
     *  "gratuitous ARP"; this is an ARP packet sent by a node in order
     *  to spontaneously cause other nodes to update an entry in their
     *  ARP cache. From RFC 3220 "IP Mobility Support for IPv4" section 4.6.
     */
    if (netif->flags & NETIF_FLAG_ETHARP) {
      etharp_query(netif, &(netif->ip_addr), NULL);
    }
#endif /* LWIP_ARP */

  }
}
开发者ID:laurarg94,项目名称:fpga-magic-1,代码行数:34,代码来源:netif.c


示例3: netif_set_up

/**
 * Bring an interface up, available for processing
 * traffic.
 * 
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_up(struct netif *netif)
{
  if ( !(netif->flags & NETIF_FLAG_UP )) {
    netif->flags |= NETIF_FLAG_UP;
    
#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif /* LWIP_SNMP */

#if LWIP_ARP
    /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ 
    if (netif->flags & NETIF_FLAG_ETHARP) {
      etharp_gratuitous(netif);
    }
#endif /* LWIP_ARP */

#if LWIP_IGMP
    /* resend IGMP memberships */
    if (netif->flags & NETIF_FLAG_IGMP) {
      igmp_report_groups( netif);
    }
#endif /* LWIP_IGMP */
  }

    //[MS_CHANGE - move this outside the if statement so we can be notified when DHCP gets an address]
    NETIF_LINK_CALLBACK(netif);
    NETIF_STATUS_CALLBACK(netif);
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:37,代码来源:netif.c


示例4: netif_set_down

/**
 * Bring an interface down, disabling any traffic processing.
 *
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_down(struct netif *netif)
{
  netif->flags &= ~NETIF_FLAG_UP;
#if LWIP_SNMP
  snmp_get_sysuptime(&netif->ts);
#endif
}
开发者ID:BlueSkyGjj,项目名称:nRF52,代码行数:15,代码来源:netif.c


示例5: snmp_send_trap

/**
 * Sends an generic or enterprise specific trap message.
 *
 * @param generic_trap is the trap code
 * @param eoid points to enterprise object identifier
 * @param specific_trap used for enterprise traps when generic_trap == 6
 * @return ERR_OK when success, ERR_MEM if we're out of memory
 *
 * @note the caller is responsible for filling in outvb in the trap_msg
 * @note the use of the enterpise 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.
 */
err_t
snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap)
{
	struct snmp_trap_dst *td;
	struct netif *dst_if;
	ip_addr_t dst_ip;
	struct pbuf *p;
	u16_t i,tot_len;

	for (i=0, td = &trap_dst[0]; i<SNMP_TRAP_DESTINATIONS; i++, td++) {
		if ((td->enable != 0) && !ip_addr_isany(&td->dip)) {
			/* network order trap destination */
			ip_addr_copy(trap_msg.dip, td->dip);
			/* lookup current source address for this dst */
			dst_if = ip_route(&td->dip);
			ip_addr_copy(dst_ip, dst_if->ip_addr);
			/* @todo: what about IPv6? */
			trap_msg.sip_raw[0] = ip4_addr1(&dst_ip);
			trap_msg.sip_raw[1] = ip4_addr2(&dst_ip);
			trap_msg.sip_raw[2] = ip4_addr3(&dst_ip);
			trap_msg.sip_raw[3] = ip4_addr4(&dst_ip);
			trap_msg.gen_trap = generic_trap;
			trap_msg.spc_trap = specific_trap;
			if (generic_trap == SNMP_GENTRAP_ENTERPRISESPC) {
				/* enterprise-Specific trap */
				trap_msg.enterprise = eoid;
			} else {
				/* generic (MIB-II) trap */
				snmp_get_snmpgrpid_ptr(&trap_msg.enterprise);
			}
			snmp_get_sysuptime(&trap_msg.ts);

			/* pass 0, calculate length fields */
			tot_len = snmp_varbind_list_sum(&trap_msg.outvb);
			tot_len = snmp_trap_header_sum(&trap_msg, tot_len);

			/* allocate pbuf(s) */
			p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL);
			if (p != NULL) {
				u16_t ofs;

				/* pass 1, encode packet ino the pbuf(s) */
				ofs = snmp_trap_header_enc(&trap_msg, p);
				snmp_varbind_list_enc(&trap_msg.outvb, p, ofs);

				snmp_inc_snmpouttraps();
				snmp_inc_snmpoutpkts();

				/** send to the TRAP destination */
				udp_sendto(trap_msg.pcb, p, &trap_msg.dip, SNMP_TRAP_PORT);

				pbuf_free(p);
			} else {
				return ERR_MEM;
			}
		}
	}
	return ERR_OK;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:74,代码来源:msg_out.c


示例6: netif_set_down

/**
 * Bring an interface down, disabling any traffic processing.
 *
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_down(struct netif *netif)
{
  if (netif->flags & NETIF_FLAG_UP) {
    netif->flags &= ~NETIF_FLAG_UP;
#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif

    NETIF_STATUS_CALLBACK(netif);
  }
}
开发者ID:carriercomm,项目名称:NCD,代码行数:19,代码来源:netif.c


示例7: netif_set_down

/**
 * Bring an interface down, disabling any traffic processing.
 *
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_down(struct netif *netif)
{
  if (netif->flags & NETIF_FLAG_UP) {
    netif->flags &= ~NETIF_FLAG_UP;
#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif

#if LWIP_ARP
    if (netif->flags & NETIF_FLAG_ETHARP) {
      etharp_cleanup_netif(netif);
    }
#endif /* LWIP_ARP */
    NETIF_STATUS_CALLBACK(netif);
  }
}
开发者ID:projectarkc,项目名称:psiphon,代码行数:24,代码来源:netif.c


示例8: netif_set_up

/**
 * Bring an interface up, available for processing
 * traffic.
 * 
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_up(struct netif *netif)
{
  if (!(netif->flags & NETIF_FLAG_UP)) {
    netif->flags |= NETIF_FLAG_UP;

#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif /* LWIP_SNMP */

    NETIF_STATUS_CALLBACK(netif);

    if (netif->flags & NETIF_FLAG_LINK_UP) {
      netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4|NETIF_REPORT_TYPE_IPV6);
    }
  }
}
开发者ID:bastien-roucaries,项目名称:lwip,代码行数:25,代码来源:netif.c


示例9: if_set_up

/**
 * Bring an interface up, available for processing
 * traffic.
 * 
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */
void
if_set_up (struct interface *netif)
{
    if (!(netif->flags & NETIF_FLAG_UP))
    {
        netif->flags |= NETIF_FLAG_UP;

#if LWIP_SNMP
        snmp_get_sysuptime (&netif->ts);
#endif /* LWIP_SNMP */

        NETIF_STATUS_CALLBACK (netif);

        if (netif->flags & NETIF_FLAG_LINK_UP)
        {
#ifdef CONFIG_OPENSWITCH_TCP_IP
#if LWIP_ARP
            /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
            if (netif->flags & (NETIF_FLAG_ETHARP))
            {
                etharp_gratuitous (netif);
            }
#endif /* LWIP_ARP */
#endif

#if 0
            /* resend IGMP memberships */
            if (netif->flags & NETIF_FLAG_IGMP)
            {
                igmp_report_groups (netif);
            }
#endif /* LWIP_IGMP */
#if LWIP_IPV6 && LWIP_IPV6_MLD
      /* send mld memberships */
      mld6_report_groups( netif);
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */

#if LWIP_IPV6_SEND_ROUTER_SOLICIT
      /* Send Router Solicitation messages. */
      netif->rs_count = LWIP_ND6_MAX_MULTICAST_SOLICIT;
#endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */

    }
  }
}
开发者ID:balajig,项目名称:Layer3Switch,代码行数:54,代码来源:if.c


示例10: netif_set_up

/**
 * Bring an interface up, available for processing
 * traffic.
 * 
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_up(struct netif *netif)
{
  if ( !(netif->flags & NETIF_FLAG_UP )) {
    netif->flags |= NETIF_FLAG_UP;
    
#if LWIP_SNMP
    snmp_get_sysuptime(&netif->ts);
#endif /* LWIP_SNMP */

    NETIF_LINK_CALLBACK(netif);
    NETIF_STATUS_CALLBACK(netif);

#if LWIP_ARP
    /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ 
    if (netif->flags & NETIF_FLAG_ETHARP) {
      etharp_gratuitous(netif);
    }
#endif /* LWIP_ARP */
    
  }
}
开发者ID:DenDos,项目名称:STM32F107-ETHERNET,代码行数:30,代码来源:netif.c


示例11: snmp_send_trap

/**
 * Sends an generic or enterprise specific trap message.
 *
 * @param generic_trap is the trap code
 * @param eoid points to enterprise object identifier
 * @param specific_trap used for enterprise traps when generic_trap == 6
 * @return ERR_OK when success, ERR_MEM if we're out of memory
 *
 * @note the caller is responsible for filling in outvb in the trap_msg
 * @note the use of the enterpise 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.
 */
err_t
snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap)
{
  struct snmp_trap_dst *td;
  struct netif *dst_if;
  struct ip_addr dst_ip;
  struct pbuf *p;
  u16_t i,tot_len;

  for (i=0, td = &trap_dst[0]; i<SNMP_TRAP_DESTINATIONS; i++, td++)
  {
    if ((td->enable != 0) && (td->dip.addr != 0))
    {
      /* network order trap destination */
      trap_msg.dip.addr = td->dip.addr;
      /* lookup current source address for this dst */
      dst_if = ip_route(&td->dip);
      dst_ip.addr = ntohl(dst_if->ip_addr.addr);
      trap_msg.sip_raw[0] = dst_ip.addr >> 24;
      trap_msg.sip_raw[1] = dst_ip.addr >> 16;
      trap_msg.sip_raw[2] = dst_ip.addr >> 8;
      trap_msg.sip_raw[3] = dst_ip.addr;
      trap_msg.gen_trap = generic_trap;
      trap_msg.spc_trap = specific_trap;
      if (generic_trap == SNMP_GENTRAP_ENTERPRISESPC)
      {
        /* enterprise-Specific trap */
        trap_msg.enterprise = eoid;
      }
      else
      {
        /* generic (MIB-II) trap */
        snmp_get_snmpgrpid_ptr(&trap_msg.enterprise);
      }
      snmp_get_sysuptime(&trap_msg.ts);

      /* pass 0, calculate length fields */
      tot_len = snmp_varbind_list_sum(&trap_msg.outvb);
      tot_len = snmp_trap_header_sum(&trap_msg, tot_len);

      /* allocate pbuf(s) */
      p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL);
      if (p != NULL)
      {
        u16_t ofs;

        /* pass 1, encode packet ino the pbuf(s) */
        ofs = snmp_trap_header_enc(&trap_msg, p);
        snmp_varbind_list_enc(&trap_msg.outvb, p, ofs);

        snmp_inc_snmpouttraps();
        snmp_inc_snmpoutpkts();

        /** connect to the TRAP destination */
        udp_connect(trap_msg.pcb, &trap_msg.dip, SNMP_TRAP_PORT);
        udp_send(trap_msg.pcb, p);
        /** disassociate remote address and port with this pcb */
        udp_disconnect(trap_msg.pcb);

        pbuf_free(p);
      }
      else
      {
        return ERR_MEM;
      }
    }
  }
开发者ID:comrid1987,项目名称:jb3500,代码行数:82,代码来源:msg_out.c



注:本文中的snmp_get_sysuptime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snmp_insert_iprteidx_tree函数代码示例发布时间:2022-05-30
下一篇:
C++ snmp_free_pdu函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap