mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-12-10 08:46:40 +08:00
remove udp_lookup and ip_lookup.they were unused
This commit is contained in:
parent
5a9a11ae36
commit
3505c9d792
@ -73,57 +73,6 @@ ip_init(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ip_lookup:
|
|
||||||
*
|
|
||||||
* An experimental feature that will be changed in future versions. Do
|
|
||||||
* not depend on it yet...
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
|
||||||
u8_t
|
|
||||||
ip_lookup(void *header, struct netif *inp)
|
|
||||||
{
|
|
||||||
struct ip_hdr *iphdr;
|
|
||||||
|
|
||||||
iphdr = header;
|
|
||||||
|
|
||||||
/* not IP v4? */
|
|
||||||
if (IPH_V(iphdr) != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Immediately accept/decline packets that are fragments or has
|
|
||||||
options. */
|
|
||||||
#if IP_REASSEMBLY == 0
|
|
||||||
/* if ((IPH_OFFSET(iphdr) & htons(IP_OFFMASK | IP_MF)) != 0) {
|
|
||||||
return 0;
|
|
||||||
}*/
|
|
||||||
#endif /* IP_REASSEMBLY == 0 */
|
|
||||||
|
|
||||||
#if IP_OPTIONS == 0
|
|
||||||
if (IPH_HL(iphdr) != 5) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* IP_OPTIONS == 0 */
|
|
||||||
|
|
||||||
switch (IPH_PROTO(iphdr)) {
|
|
||||||
#if LWIP_UDP
|
|
||||||
case IP_PROTO_UDP:
|
|
||||||
case IP_PROTO_UDPLITE:
|
|
||||||
return udp_lookup(iphdr, inp);
|
|
||||||
#endif /* LWIP_UDP */
|
|
||||||
#if LWIP_TCP
|
|
||||||
case IP_PROTO_TCP:
|
|
||||||
return 1;
|
|
||||||
#endif /* LWIP_TCP */
|
|
||||||
case IP_PROTO_ICMP:
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* LWIP_DEBUG */
|
|
||||||
|
|
||||||
/* ip_route:
|
/* ip_route:
|
||||||
*
|
*
|
||||||
* Finds the appropriate network interface for a given IP address. It
|
* Finds the appropriate network interface for a given IP address. It
|
||||||
|
|||||||
@ -71,76 +71,6 @@ udp_init(void)
|
|||||||
udp_pcbs = pcb_cache = NULL;
|
udp_pcbs = pcb_cache = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* udp_lookup:
|
|
||||||
*
|
|
||||||
* An experimental feature that will be changed in future versions. Do
|
|
||||||
* not depend on it yet...
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
|
||||||
u8_t
|
|
||||||
udp_lookup(struct ip_hdr *iphdr, struct netif *inp)
|
|
||||||
{
|
|
||||||
struct udp_pcb *pcb;
|
|
||||||
struct udp_hdr *udphdr;
|
|
||||||
u16_t src, dest;
|
|
||||||
|
|
||||||
PERF_START;
|
|
||||||
(void)inp;
|
|
||||||
|
|
||||||
udphdr = (struct udp_hdr *)(u8_t *)iphdr + IPH_HL(iphdr) * 4;
|
|
||||||
|
|
||||||
src = ntohs(udphdr->src);
|
|
||||||
dest = ntohs(udphdr->dest);
|
|
||||||
|
|
||||||
pcb = pcb_cache;
|
|
||||||
if (pcb != NULL &&
|
|
||||||
pcb->remote_port == src &&
|
|
||||||
pcb->local_port == dest &&
|
|
||||||
(ip_addr_isany(&pcb->remote_ip) ||
|
|
||||||
ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src))) &&
|
|
||||||
(ip_addr_isany(&pcb->local_ip) ||
|
|
||||||
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
|
|
||||||
if (pcb->remote_port == src &&
|
|
||||||
pcb->local_port == dest &&
|
|
||||||
(ip_addr_isany(&pcb->remote_ip) ||
|
|
||||||
ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src))) &&
|
|
||||||
(ip_addr_isany(&pcb->local_ip) ||
|
|
||||||
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
|
|
||||||
pcb_cache = pcb;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pcb == NULL) {
|
|
||||||
for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
|
|
||||||
if (pcb->remote_port == 0 &&
|
|
||||||
pcb->local_port == dest &&
|
|
||||||
(ip_addr_isany(&pcb->remote_ip) ||
|
|
||||||
ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src))) &&
|
|
||||||
(ip_addr_isany(&pcb->local_ip) ||
|
|
||||||
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PERF_STOP("udp_lookup");
|
|
||||||
|
|
||||||
if (pcb != NULL) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* LWIP_DEBUG */
|
|
||||||
/**
|
/**
|
||||||
* Process an incoming UDP datagram.
|
* Process an incoming UDP datagram.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -43,7 +43,6 @@
|
|||||||
struct netif;
|
struct netif;
|
||||||
|
|
||||||
void ip_init(void);
|
void ip_init(void);
|
||||||
u8_t ip_lookup(void *header, struct netif *inp);
|
|
||||||
struct netif *ip_route(struct ip_addr *dest);
|
struct netif *ip_route(struct ip_addr *dest);
|
||||||
err_t ip_input(struct pbuf *p, struct netif *inp);
|
err_t ip_input(struct pbuf *p, struct netif *inp);
|
||||||
err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||||
|
|||||||
@ -91,7 +91,6 @@ err_t udp_send (struct udp_pcb *pcb, struct pbuf *p);
|
|||||||
|
|
||||||
|
|
||||||
/* The following functions are the lower layer interface to UDP. */
|
/* The following functions are the lower layer interface to UDP. */
|
||||||
u8_t udp_lookup (struct ip_hdr *iphdr, struct netif *inp);
|
|
||||||
void udp_input (struct pbuf *p, struct netif *inp);
|
void udp_input (struct pbuf *p, struct netif *inp);
|
||||||
void udp_init (void);
|
void udp_init (void);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user