本文整理汇总了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();
}
示例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);
}
示例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;
}
示例4: ping_start
void ping_start(void)
{
printf("Using %s device\n", eth_get_name());
NetSetTimeout(10000UL, ping_timeout);
ping_send();
}
示例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);
}
示例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();
}
}
示例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 ();
}
示例8: DnsStart
void
DnsStart(void)
{
debug("%s\n", __func__);
NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
NetSetHandler(DnsHandler);
DnsSend();
}
示例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 ();
}
}
示例10: SntpStart
void
SntpStart (void)
{
debug ("%s\n", __FUNCTION__);
NetSetTimeout (SNTP_TIMEOUT, SntpTimeout);
NetSetHandler(SntpHandler);
memset (NetServerEther, 0, 6);
SntpSend ();
}
示例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);
}
示例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 ();
}
}
示例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 ();
}
}
示例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();
}
示例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();
}
}