/* Current RX packet handler */
static rxhand_f *packetHandler;
+#ifdef CONFIG_CMD_TFTPPUT
static rxhand_icmp_f *packet_icmp_handler; /* Current ICMP rx handler */
+#endif
/* Current timeout handler */
static thand_f *timeHandler;
/* Time base value */
}
done:
+#ifdef CONFIG_CMD_TFTPPUT
/* Clear out the handlers */
NetSetHandler(NULL);
net_set_icmp_handler(NULL);
+#endif
return ret;
}
packetHandler = f;
}
+#ifdef CONFIG_CMD_TFTPPUT
void net_set_icmp_handler(rxhand_icmp_f *f)
{
packet_icmp_handler = f;
}
+#endif
void
NetSetTimeout(ulong iv, thand_f *f)
break;
#endif
default:
+#ifdef CONFIG_CMD_TFTPPUT
if (packet_icmp_handler)
packet_icmp_handler(icmph->type, icmph->code,
ntohs(ip->udp_dst), src_ip, ntohs(ip->udp_src),
icmph->un.data, ntohs(ip->udp_len));
+#endif
break;
}
}
TftpOurPort, len);
}
-
+#ifdef CONFIG_CMD_TFTPPUT
static void icmp_handler(unsigned type, unsigned code, unsigned dest,
IPaddr_t sip, unsigned src, uchar *pkt, unsigned len)
{
restart("TFTP server died");
}
}
+#endif
static void
TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
NetSetHandler(TftpHandler);
+#ifdef CONFIG_CMD_TFTPPUT
net_set_icmp_handler(icmp_handler);
-
+#endif
TftpRemotePort = WELL_KNOWN_PORT;
TftpTimeoutCount = 0;
/* Use a pseudo-random port unless a specific port is set */