当前位置: 首页>>代码示例>>C++>>正文


C++ NetSetTimeout函数代码示例

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


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

示例1: BootpHandler

/*
 *	Handle a BOOTP received packet.
 */
static void
BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
	     unsigned len)
{
	struct Bootp_t *bp;

	debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
		src, dest, len, sizeof(struct Bootp_t));

	bp = (struct Bootp_t *)pkt;

	/* Filter out pkts we don't want */
	if (BootpCheckPkt(pkt, dest, src, len))
		return;

	/*
	 *	Got a good BOOTP reply.	 Copy the data into our variables.
	 */
#ifdef CONFIG_STATUS_LED
	status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
#endif

	BootpCopyNetParams(bp);		/* Store net parameters from reply */

	/* Retrieve extended information (we must parse the vendor area) */
	if (NetReadLong((uint *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
		BootpVendorProcess((uchar *)&bp->bp_vend[4], len);

	NetSetTimeout(0, (thand_f *)0);
	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");

	debug("Got good BOOTP\n");

	net_auto_load();
}
开发者ID:khadas,项目名称:u-boot,代码行数:38,代码来源:bootp.c

示例2: RarpRequest

void
RarpRequest (void)
{
	int i;
	volatile uchar *pkt;
	ARP_t *	rarp;

	printf("RARP broadcast %d\n", ++RarpTry);
	pkt = NetTxPacket;

	pkt += NetSetEther(pkt, NetBcastAddr, PROT_RARP);

	rarp = (ARP_t *)pkt;

	rarp->ar_hrd = htons (ARP_ETHER);
	rarp->ar_pro = htons (PROT_IP);
	rarp->ar_hln = 6;
	rarp->ar_pln = 4;
	rarp->ar_op  = htons (RARPOP_REQUEST);
	memcpy (&rarp->ar_data[0],  NetOurEther, 6);	/* source ET addr */
	memcpy (&rarp->ar_data[6],  &NetOurIP,   4);	/* source IP addr */
	memcpy (&rarp->ar_data[10], NetOurEther, 6);	/* dest ET addr = source ET addr ??*/
	/* dest. IP addr set to broadcast */
	for (i = 0; i <= 3; i++) {
		rarp->ar_data[16 + i] = 0xff;
	}

	NetSendPacket(NetTxPacket, (pkt - NetTxPacket) + ARP_HDR_SIZE);

	NetSetTimeout(TIMEOUT, RarpTimeout);
	NetSetHandler(RarpHandler);
}
开发者ID:fulinux,项目名称:U-boot-2009.08_tekkaman,代码行数:32,代码来源:rarp.c

示例3: flash_erase

int
flash_erase(flash_info_t *info, int s_first, int s_last)
{
    int i, sector_size = info->size/info->sector_count;

    printf("\nFirst %#x last %#x sector size %#x\n",
           s_first, s_last, sector_size);

#if (defined(CONFIG_WNDR3700U_LED) || defined(CONFIG_WNDR3700V1H2_LED) || defined(CONFIG_HW29763654P16P128)) && defined(FIRMWARE_RECOVER_FROM_TFTP_SERVER)
    NetSetTimeout (CFG_HZ/10,Update_LedSet);
#endif
    for (i = s_first; i <= s_last; i++) {
        printf("\b\b\b\b%4d", i);
#if (defined(CONFIG_WNDR3700U_LED) || defined(CONFIG_WNDR3700V1H2_LED) || defined(CONFIG_HW29763654P16P128)) && defined(FIRMWARE_RECOVER_FROM_TFTP_SERVER)
        if (timeHandler && ((get_timer(0) - timeStart) > timeDelta)) {
            thand_f *x;
            x = timeHandler;
            timeHandler = (thand_f *)0;
            (*x)();
        }
#endif
        ar7100_spi_sector_erase(i * sector_size);
    }
    ar7100_spi_done();
    printf("\n");

    return 0;
}
开发者ID:cidermole,项目名称:wndr3800-uboot,代码行数:28,代码来源:ar7100_flash.c

示例4: ping_start

void ping_start(void)
{
	printf("Using %s device\n", eth_get_name());
	NetSetTimeout(10000UL, ping_timeout);

	ping_send();
}
开发者ID:AeroGirl,项目名称:u-boot-VAR-SOM-AM33-SDK7,代码行数:7,代码来源:ping.c

示例5: BootMeRequest

int BootMeRequest(IPaddr_t server_ip, const void *buf, size_t len, int timeout)
{
	bootme_init(server_ip);
	bootme_timeout = timeout * 1000;
	bootme_timed_out = 0;
	NetSetTimeout(bootme_timeout, bootme_timeout_handler);
	return bootme_send_frame(buf, len);
}
开发者ID:mbasharat,项目名称:kundogit_android,代码行数:8,代码来源:bootme.c

示例6: BootpTimeout

/*
 *	Timeout on BOOTP/DHCP request.
 */
static void BootpTimeout(void){
	if(BootpTry >= TIMEOUT_COUNT){
		puts("\n## Error: retry count exceeded, starting again!\n\n");
		NetStartAgain();
	} else {
		NetSetTimeout(TIMEOUT * CFG_HZ, BootpTimeout);
		BootpRequest();
	}
}
开发者ID:jfojfo,项目名称:u-boot_mod,代码行数:12,代码来源:bootp.c

示例7: TftpStart

void
TftpStart (void)
{
	struct timestamp now;
	time_get(&now);

#ifdef ET_DEBUG
	printf ("\nServer ethernet address %02x:%02x:%02x:%02x:%02x:%02x\n",
		NetServerEther[0],
		NetServerEther[1],
		NetServerEther[2],
		NetServerEther[3],
		NetServerEther[4],
		NetServerEther[5]
	);
#endif /* DEBUG */

	printf ("TFTP from server %s", inet_ntoa(NetServerIP));
	printf ("; our IP address is %s", inet_ntoa(NetOurIP));


	// Check if we need to send across this subnet
	if (NetOurGatewayIP && NetOurSubnetMask) {
	    IPaddr_t OurNet 	= NetOurIP    & NetOurSubnetMask;
	    IPaddr_t ServerNet 	= NetServerIP & NetOurSubnetMask;

	    if (OurNet != ServerNet) {
		printf ("; sending through gateway ");
		print_IPaddr (NetOurGatewayIP) ;
	    }
	}
	printf("\n");

	printf ("Filename '%s'.", tftp_filename);

	if (NetBootFileSize) {
	    printf (" Size is %d%s kB => %x Bytes", NetBootFileSize/2, (NetBootFileSize%2) ? ".5" : "",	NetBootFileSize<<9);
	}

	printf("\n");

	printf ("Load address: 0x%lx\n\n", get_board_desc()->memctrl_membase);
	printf ("Press Ctrl-C to abort...\n");
	printf ("Loading: *\b");


	NetSetTimeout (TIMEOUT * 1000, TftpTimeout);
	NetSetHandler (TftpHandler);

	TftpServerPort = WELL_KNOWN_PORT;
	TftpTimeoutCount = 0;
	TftpState = STATE_RRQ;
	TftpOurPort = 1024 + (now.usec % 3072); //FIXED

	TftpSend ();
}
开发者ID:jvillar,项目名称:milkymist,代码行数:56,代码来源:tftp.c

示例8: DnsStart

void
DnsStart(void)
{
	debug("%s\n", __func__);

	NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
	NetSetHandler(DnsHandler);

	DnsSend();
}
开发者ID:Apaisal,项目名称:u-boot,代码行数:10,代码来源:dns.c

示例9: BootpTimeout

/*
 *	Timeout on BOOTP/DHCP request.
 */
static void
BootpTimeout(void)
{
	if (BootpTry >= TIMEOUT_COUNT) {
		puts ("\nRetry count exceeded; starting again\n");
		NetStartAgain ();
	} else {
		NetSetTimeout (TIMEOUT, BootpTimeout);
		BootpRequest ();
	}
}
开发者ID:Astralix,项目名称:hardware_drivers,代码行数:14,代码来源:bootp.c

示例10: SntpStart

void
SntpStart (void)
{
	debug ("%s\n", __FUNCTION__);

	NetSetTimeout (SNTP_TIMEOUT, SntpTimeout);
	NetSetHandler(SntpHandler);
	memset (NetServerEther, 0, 6);

	SntpSend ();
}
开发者ID:kipr,项目名称:u-boot-2009.07-silvermoon,代码行数:11,代码来源:sntp.c

示例11: BootpHandler

/*
 *	Handle a BOOTP received packet.
 */
static void
BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
{
	Bootp_t *bp;
	char	*s;

	debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
		src, dest, len, sizeof (Bootp_t));

	bp = (Bootp_t *)pkt;

	if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */
		return;

	/*
	 *	Got a good BOOTP reply.	 Copy the data into our variables.
	 */
#ifdef CONFIG_STATUS_LED
	status_led_set (STATUS_LED_BOOT, STATUS_LED_OFF);
#endif

	BootpCopyNetParams(bp);		/* Store net parameters from reply */

	/* Retrieve extended information (we must parse the vendor area) */
	if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
		BootpVendorProcess((uchar *)&bp->bp_vend[4], len);

	NetSetTimeout(0, (thand_f *)0);

	debug("Got good BOOTP\n");

	if ((s = getenv("autoload")) != NULL) {
		if (*s == 'n') {
			/*
			 * Just use BOOTP to configure system;
			 * Do not use TFTP to load the bootfile.
			 */
			NetState = NETLOOP_SUCCESS;
			return;
#if defined(CONFIG_CMD_NFS)
		} else if (strcmp(s, "NFS") == 0) {
			/*
			 * Use NFS to load the bootfile.
			 */
			NfsStart();
			return;
#endif
		}
	}

	struct NetTask tftp_task;
	BootpDeriveTaskTftp(&tftp_task, bp);
	TftpStart(&tftp_task);
}
开发者ID:RC-MODULE,项目名称:mboot,代码行数:57,代码来源:bootp.c

示例12: TftpTimeout

static void TftpTimeout (void)
{
	if (++TftpTimeoutCount >= TIMEOUT_COUNT) {
		printf ("\nRetry count exceeded; starting again\n");
		NetStartAgain ();
	} else {
		printf ("T ");
		NetSetTimeout (TIMEOUT * 1000, TftpTimeout);
		TftpSend ();
	}
}
开发者ID:jvillar,项目名称:milkymist,代码行数:11,代码来源:tftp.c

示例13: RarpTimeout

/*
 *	Timeout on BOOTP request.
 */
static void
RarpTimeout(void)
{
	if (RarpTry >= TIMEOUT_COUNT) {
		puts ("\nRetry count exceeded; starting again\n");
		NetStartAgain ();
	} else {
		NetSetTimeout (TIMEOUT * CFG_HZ, RarpTimeout);
		RarpRequest ();
	}
}
开发者ID:1136632326,项目名称:hello,代码行数:14,代码来源:rarp.c

示例14: SntpStart

void SntpStart(void){
#ifdef DEBUG
	printf("%s\n", __FUNCTION__);
#endif

	NetSetTimeout(SNTP_TIMEOUT * CFG_HZ, SntpTimeout);
	NetSetHandler(SntpHandler);

	memset(NetServerEther, 0, 6);

	SntpSend();
}
开发者ID:a291899192,项目名称:u-boot_mod,代码行数:12,代码来源:sntp.c

示例15: TftpTimeout

static void
TftpTimeout(void)
{
	if (++TftpTimeoutCount > TftpTimeoutCountMax) {
		restart("Retry count exceeded");
	} else {
		puts("T ");
		NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
		if (TftpState != STATE_RECV_WRQ)
			TftpSend();
	}
}
开发者ID:Android4SAM,项目名称:u-boot-at91,代码行数:12,代码来源:tftp.c


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