mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-09-24 09:43:48 +08:00
Removed all horizontal line seperators as they serve no use.
This commit is contained in:
@@ -30,14 +30,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* inet.c
|
||||
*
|
||||
* Functions common to all TCP/IP modules, such as the Internet checksum and the
|
||||
* byte order functions.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include "lwip/inet.h"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static u16_t
|
||||
lwip_chksum(void *dataptr, int len)
|
||||
{
|
||||
@@ -75,12 +75,12 @@ lwip_chksum(void *dataptr, int len)
|
||||
|
||||
return (u16_t)acc;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* inet_chksum_pseudo:
|
||||
*
|
||||
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
inet_chksum_pseudo(struct pbuf *p,
|
||||
struct ip_addr *src, struct ip_addr *dest,
|
||||
@@ -124,13 +124,13 @@ inet_chksum_pseudo(struct pbuf *p,
|
||||
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%lx\n", acc));
|
||||
return ~(acc & 0xffffUL);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* inet_chksum:
|
||||
*
|
||||
* Calculates the Internet checksum over a portion of memory. Used primarely for IP
|
||||
* and ICMP.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
inet_chksum(void *dataptr, u16_t len)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ inet_chksum(void *dataptr, u16_t len)
|
||||
}
|
||||
return ~(acc & 0xffff);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
inet_chksum_pbuf(struct pbuf *p)
|
||||
{
|
||||
@@ -179,7 +179,7 @@ inet_chksum_pbuf(struct pbuf *p)
|
||||
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Ascii internet address interpretation routine.
|
||||
* The value returned is in network order.
|
||||
@@ -328,24 +328,24 @@ u8_t *inet_ntoa(u32_t addr)
|
||||
return str;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#error BYTE_ORDER is not defined
|
||||
#endif
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
htons(u16_t n)
|
||||
{
|
||||
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
ntohs(u16_t n)
|
||||
{
|
||||
return htons(n);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u32_t
|
||||
htonl(u32_t n)
|
||||
{
|
||||
@@ -354,11 +354,11 @@ htonl(u32_t n)
|
||||
((n & 0xff0000) >> 8) |
|
||||
((n & 0xff000000) >> 24);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u32_t
|
||||
ntohl(u32_t n)
|
||||
{
|
||||
return htonl(n);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
|
||||
|
||||
@@ -30,14 +30,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* inet6.c
|
||||
*
|
||||
* Functions common to all TCP/IP modules, such as the Internet checksum and the
|
||||
* byte order functions.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "lwip/inet.h"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* chksum:
|
||||
*
|
||||
* Sums up all 16 bit words in a memory portion. Also includes any odd byte.
|
||||
@@ -54,7 +54,7 @@
|
||||
* For now, this is not optimized. Must be optimized for the particular processor
|
||||
* arcitecture on which it is to run. Preferebly coded in assembler.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static u32_t
|
||||
chksum(void *dataptr, u16_t len)
|
||||
{
|
||||
@@ -74,12 +74,12 @@ chksum(void *dataptr, u16_t len)
|
||||
return acc;
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* inet_chksum_pseudo:
|
||||
*
|
||||
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
inet_chksum_pseudo(struct pbuf *p,
|
||||
struct ip_addr *src, struct ip_addr *dest,
|
||||
@@ -122,13 +122,13 @@ inet_chksum_pseudo(struct pbuf *p,
|
||||
}
|
||||
return ~(acc & 0xffff);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* inet_chksum:
|
||||
*
|
||||
* Calculates the Internet checksum over a portion of memory. Used primarely for IP
|
||||
* and ICMP.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
inet_chksum(void *dataptr, u16_t len)
|
||||
{
|
||||
@@ -139,7 +139,7 @@ inet_chksum(void *dataptr, u16_t len)
|
||||
sum += (sum >> 16);
|
||||
return ~(sum & 0xffff);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u16_t
|
||||
inet_chksum_pbuf(struct pbuf *p)
|
||||
{
|
||||
@@ -165,4 +165,4 @@ inet_chksum_pbuf(struct pbuf *p)
|
||||
}
|
||||
return ~(acc & 0xffff);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/snmp.h"
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
icmp_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
}
|
||||
pbuf_free(p);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||
ICMP_TTL, 0, IP_PROTO_ICMP);
|
||||
pbuf_free(q);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if IP_FORWARD
|
||||
void
|
||||
icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip.c
|
||||
*
|
||||
* This is the code for the IP layer.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
@@ -62,23 +62,23 @@
|
||||
# include "lwip/dhcp.h"
|
||||
#endif /* LWIP_DHCP */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_init:
|
||||
*
|
||||
* Initializes the IP layer.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
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)
|
||||
@@ -123,7 +123,7 @@ ip_lookup(void *header, struct netif *inp)
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_DEBUG */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_route:
|
||||
*
|
||||
* Finds the appropriate network interface for a given IP address. It
|
||||
@@ -131,7 +131,7 @@ ip_lookup(void *header, struct netif *inp)
|
||||
* if the masked IP address of the network interface equals the masked
|
||||
* IP address given to the function.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
struct netif *
|
||||
ip_route(struct ip_addr *dest)
|
||||
{
|
||||
@@ -149,14 +149,14 @@ ip_route(struct ip_addr *dest)
|
||||
return netif_default;
|
||||
}
|
||||
#if IP_FORWARD
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_forward:
|
||||
*
|
||||
* Forwards an IP packet. It finds an appropriate route for the
|
||||
* packet, decrements the TTL value of the packet, adjusts the
|
||||
* checksum and outputs the packet on the appropriate interface.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
{
|
||||
@@ -210,7 +210,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
|
||||
}
|
||||
#endif /* IP_FORWARD */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_input:
|
||||
*
|
||||
* This function is called by the network interface device driver when
|
||||
@@ -221,7 +221,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
*
|
||||
* Finally, the packet is sent to the upper layer protocol input function.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
ip_input(struct pbuf *p, struct netif *inp) {
|
||||
static struct ip_hdr *iphdr;
|
||||
@@ -418,7 +418,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_output_if:
|
||||
*
|
||||
* Sends an IP packet on a network interface. This function constructs
|
||||
@@ -426,7 +426,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||
* IP address is NULL, the IP address of the outgoing network
|
||||
* interface is filled in as source address.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
u8_t ttl, u8_t tos,
|
||||
@@ -487,13 +487,13 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
|
||||
return netif->output(netif, p, dest);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_output:
|
||||
*
|
||||
* Simple interface to ip_output_if. It finds the outgoing network
|
||||
* interface and calls upon ip_output_if to do the actual work.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
u8_t ttl, u8_t tos, u8_t proto)
|
||||
@@ -510,7 +510,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
|
||||
return ip_output_if(p, src, dest, ttl, tos, proto, netif);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if IP_DEBUG
|
||||
void
|
||||
ip_debug_print(struct pbuf *p)
|
||||
@@ -554,7 +554,7 @@ ip_debug_print(struct pbuf *p)
|
||||
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
|
||||
}
|
||||
#endif /* IP_DEBUG */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_frag.c
|
||||
*
|
||||
* This is the code for IP segmentation and reassembly
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
icmp_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
pbuf_free(p);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
||||
(struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP);
|
||||
pbuf_free(q);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
||||
{
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip.c
|
||||
*
|
||||
* This is the code for the IP layer for IPv6.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
@@ -53,24 +53,24 @@
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "arch/perf.h"
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_init:
|
||||
*
|
||||
* Initializes the IP layer.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
ip_init(void)
|
||||
{
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_route:
|
||||
*
|
||||
* Finds the appropriate network interface for a given IP address. It searches the
|
||||
* list of network interfaces linearly. A match is found if the masked IP address of
|
||||
* the network interface equals the masked IP address given to the function.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
struct netif *
|
||||
ip_route(struct ip_addr *dest)
|
||||
{
|
||||
@@ -84,14 +84,14 @@ ip_route(struct ip_addr *dest)
|
||||
|
||||
return netif_default;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_forward:
|
||||
*
|
||||
* Forwards an IP packet. It finds an appropriate route for the packet, decrements
|
||||
* the TTL value of the packet, adjusts the checksum and outputs the packet on the
|
||||
* appropriate interface.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
||||
|
||||
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_input:
|
||||
*
|
||||
* This function is called by the network interface device driver when an IP packet is
|
||||
@@ -152,7 +152,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
|
||||
*
|
||||
* Finally, the packet is sent to the upper layer protocol input function.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
ip_input(struct pbuf *p, struct netif *inp) {
|
||||
struct ip_hdr *iphdr;
|
||||
@@ -249,14 +249,14 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||
PERF_STOP("ip_input");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_output_if:
|
||||
*
|
||||
* Sends an IP packet on a network interface. This function constructs the IP header
|
||||
* and calculates the IP header checksum. If the source IP address is NULL,
|
||||
* the IP address of the outgoing network interface is filled in as source address.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
u8_t ttl,
|
||||
@@ -311,13 +311,13 @@ ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
PERF_STOP("ip_output_if");
|
||||
return netif->output(netif, p, dest);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* ip_output:
|
||||
*
|
||||
* Simple interface to ip_output_if. It finds the outgoing network interface and
|
||||
* calls upon ip_output_if to do the actual work.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
u8_t ttl, u8_t proto)
|
||||
@@ -333,7 +333,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
|
||||
return ip_output_if (p, src, dest, ttl, proto, netif);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if IP_DEBUG
|
||||
void
|
||||
ip_debug_print(struct pbuf *p)
|
||||
@@ -383,4 +383,4 @@ ip_debug_print(struct pbuf *p)
|
||||
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
|
||||
}
|
||||
#endif /* IP_DEBUG */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/inet.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2,
|
||||
struct ip_addr *mask)
|
||||
@@ -44,7 +44,7 @@ ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2,
|
||||
(addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3]));
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
|
||||
addr1->addr[2] == addr2->addr[2] &&
|
||||
addr1->addr[3] == addr2->addr[3]);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
|
||||
dest->addr[2] = src->addr[2];
|
||||
dest->addr[3] = src->addr[3];*/
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
ip_addr_isany(struct ip_addr *addr)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ ip_addr_isany(struct ip_addr *addr)
|
||||
return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*#if IP_DEBUG*/
|
||||
void
|
||||
ip_addr_debug_print(struct ip_addr *addr)
|
||||
@@ -87,4 +87,4 @@ ip_addr_debug_print(struct ip_addr *addr)
|
||||
ntohl(addr->addr[3]) & 0xffff);
|
||||
}
|
||||
/*#endif*/ /* IP_DEBUG */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ mem_reallocm(void *rmem, mem_size_t newsize)
|
||||
mem_free(rmem);
|
||||
return nmem;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void *
|
||||
mem_realloc(void *rmem, mem_size_t newsize)
|
||||
{
|
||||
|
||||
@@ -115,11 +115,11 @@ static u8_t memp_memory[(MEMP_NUM_PBUF *
|
||||
MEM_ALIGN_SIZE(sizeof(struct sys_timeout) +
|
||||
sizeof(struct memp)))];
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if !SYS_LIGHTWEIGHT_PROT
|
||||
static sys_sem_t mutex;
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LWIP_NOASSERT
|
||||
static int
|
||||
memp_sanity(void)
|
||||
@@ -141,7 +141,7 @@ memp_sanity(void)
|
||||
return 1;
|
||||
}
|
||||
#endif /* LWIP_DEBUG */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
memp_init(void)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ memp_init(void)
|
||||
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void *
|
||||
memp_malloc(memp_t type)
|
||||
{
|
||||
@@ -236,7 +236,7 @@ memp_malloc(memp_t type)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
memp_free(memp_t type, void *mem)
|
||||
{
|
||||
@@ -271,4 +271,4 @@ memp_free(memp_t type, void *mem)
|
||||
sys_sem_signal(mutex);
|
||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ netif_find(char *name)
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
|
||||
return NULL;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
||||
{
|
||||
@@ -214,7 +214,7 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
||||
(unsigned int)(ntohl(netif->ip_addr.addr) >> 8 & 0xff),
|
||||
(unsigned int)(ntohl(netif->ip_addr.addr) & 0xff)));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
||||
(unsigned int)(ntohl(netif->gw.addr) >> 8 & 0xff),
|
||||
(unsigned int)(ntohl(netif->gw.addr) & 0xff)));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
|
||||
{
|
||||
@@ -238,7 +238,7 @@ netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
|
||||
(unsigned int)(ntohl(netif->netmask.addr) >> 8 & 0xff),
|
||||
(unsigned int)(ntohl(netif->netmask.addr) & 0xff)));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
netif_set_default(struct netif *netif)
|
||||
{
|
||||
@@ -246,10 +246,10 @@ netif_set_default(struct netif *netif)
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
|
||||
netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
netif_init(void)
|
||||
{
|
||||
netif_list = netif_default = NULL;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* raw.c
|
||||
*
|
||||
* The code for the Raw Access to the IP
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
static struct raw_pcb *raw_pcbs = NULL;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
raw_init(void)
|
||||
{
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
|
||||
#if LWIP_STATS
|
||||
struct stats_ lwip_stats;
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
stats_init(void)
|
||||
{
|
||||
memset(&lwip_stats, 0, sizeof(struct stats_));
|
||||
}
|
||||
#endif /* LWIP_STATS */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ struct sswt_cb
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
||||
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
sys_sem_wait(sys_sem_t sem)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ sys_sem_wait(sys_sem_t sem)
|
||||
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
||||
{
|
||||
@@ -203,7 +203,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
||||
/* Go through timeout list (for this task only) and remove the first matching entry,
|
||||
even though the timeout has not triggered yet.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
sys_untimeout(sys_timeout_handler h, void *arg)
|
||||
{
|
||||
@@ -238,7 +238,7 @@ sys_untimeout(sys_timeout_handler h, void *arg)
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
sswt_handler(void *arg)
|
||||
{
|
||||
@@ -252,7 +252,7 @@ sswt_handler(void *arg)
|
||||
/* Wait for a semaphore with timeout (specified in ms) */
|
||||
/* timeout = 0: wait forever */
|
||||
/* Returns 0 on timeout. 1 otherwise */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
|
||||
{
|
||||
@@ -279,7 +279,7 @@ sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
sys_msleep(u32_t ms)
|
||||
{
|
||||
@@ -289,6 +289,6 @@ sys_msleep(u32_t ms)
|
||||
|
||||
sys_sem_free(delaysem);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#endif /* NO_SYS */
|
||||
|
||||
126
src/core/tcp.c
126
src/core/tcp.c
@@ -36,7 +36,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp.c
|
||||
*
|
||||
* This file contains common functions for the TCP implementation, such as functinos
|
||||
@@ -44,7 +44,7 @@
|
||||
* related to input and output is found in tcp_input.c and tcp_output.c respectively.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include "lwip/opt.h"
|
||||
@@ -74,13 +74,13 @@ static u8_t tcp_timer;
|
||||
|
||||
static u16_t tcp_new_port(void);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_init():
|
||||
*
|
||||
* Initializes the TCP layer.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_init(void)
|
||||
{
|
||||
@@ -95,14 +95,14 @@ tcp_init(void)
|
||||
tcp_timer = 0;
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_tmr():
|
||||
*
|
||||
* Called periodically to dispatch TCP timers.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_tmr(void)
|
||||
{
|
||||
@@ -115,14 +115,14 @@ tcp_tmr(void)
|
||||
tcp_slowtmr();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_close():
|
||||
*
|
||||
* Closes the connection held by the PCB.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
tcp_close(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ tcp_close(struct tcp_pcb *pcb)
|
||||
}
|
||||
return err;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_abort()
|
||||
*
|
||||
@@ -185,7 +185,7 @@ tcp_close(struct tcp_pcb *pcb)
|
||||
* killed because of shortage of memory.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_abort(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -233,7 +233,7 @@ tcp_abort(struct tcp_pcb *pcb)
|
||||
tcp_rst(seqno, ackno, &local_ip, &remote_ip, local_port, remote_port);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_bind():
|
||||
*
|
||||
@@ -242,7 +242,7 @@ tcp_abort(struct tcp_pcb *pcb)
|
||||
* the outgoing network interface is used instead.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||
{
|
||||
@@ -390,7 +390,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
return ERR_ABRT;
|
||||
}
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_listen():
|
||||
*
|
||||
@@ -400,7 +400,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
* connection to LISTEN is an irreversible process.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
struct tcp_pcb *
|
||||
tcp_listen(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -429,7 +429,7 @@ tcp_listen(struct tcp_pcb *pcb)
|
||||
TCP_REG(&tcp_listen_pcbs, lpcb);
|
||||
return (struct tcp_pcb *)lpcb;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_recved():
|
||||
*
|
||||
@@ -438,7 +438,7 @@ tcp_listen(struct tcp_pcb *pcb)
|
||||
* when the data has been processed.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_recved(struct tcp_pcb *pcb, u16_t len)
|
||||
{
|
||||
@@ -455,14 +455,14 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len)
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %u bytes, wnd %u (%u).\n",
|
||||
len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_new_port():
|
||||
*
|
||||
* A nastly hack featuring 'goto' statements that allocates a
|
||||
* new TCP local port.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static u16_t
|
||||
tcp_new_port(void)
|
||||
{
|
||||
@@ -495,7 +495,7 @@ tcp_new_port(void)
|
||||
}
|
||||
return port;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_connect():
|
||||
*
|
||||
@@ -503,7 +503,7 @@ tcp_new_port(void)
|
||||
* argument will be called when the connection has been established.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||
err_t (* connected)(void *arg, struct tcp_pcb *tpcb, err_t err))
|
||||
@@ -550,7 +550,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_slowtmr():
|
||||
*
|
||||
@@ -558,7 +558,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||
* removes PCBs that have been in TIME-WAIT for enough time. It also increments
|
||||
* various timers such as the inactivity timer in each PCB.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_slowtmr(void)
|
||||
{
|
||||
@@ -734,13 +734,13 @@ tcp_slowtmr(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_fasttmr():
|
||||
*
|
||||
* Is called every TCP_FAST_INTERVAL (250 ms) and sends delayed ACKs.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_fasttmr(void)
|
||||
{
|
||||
@@ -755,14 +755,14 @@ tcp_fasttmr(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_segs_free():
|
||||
*
|
||||
* Deallocates a list of TCP segments (tcp_seg structures).
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u8_t
|
||||
tcp_segs_free(struct tcp_seg *seg)
|
||||
{
|
||||
@@ -775,14 +775,14 @@ tcp_segs_free(struct tcp_seg *seg)
|
||||
}
|
||||
return count;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_seg_free():
|
||||
*
|
||||
* Frees a TCP segment.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u8_t
|
||||
tcp_seg_free(struct tcp_seg *seg)
|
||||
{
|
||||
@@ -799,28 +799,28 @@ tcp_seg_free(struct tcp_seg *seg)
|
||||
}
|
||||
return count;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_setprio():
|
||||
*
|
||||
* Sets the priority of a connection.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_setprio(struct tcp_pcb *pcb, u8_t prio)
|
||||
{
|
||||
pcb->prio = prio;
|
||||
}
|
||||
#if TCP_QUEUE_OOSEQ
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_seg_copy():
|
||||
*
|
||||
* Returns a copy of the given TCP segment.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
struct tcp_seg *
|
||||
tcp_seg_copy(struct tcp_seg *seg)
|
||||
{
|
||||
@@ -835,7 +835,7 @@ tcp_seg_copy(struct tcp_seg *seg)
|
||||
return cseg;
|
||||
}
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if LWIP_CALLBACK_API
|
||||
static err_t
|
||||
tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
@@ -849,7 +849,7 @@ tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
tcp_kill_prio(u8_t prio)
|
||||
{
|
||||
@@ -880,7 +880,7 @@ tcp_kill_prio(u8_t prio)
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
tcp_kill_timewait(void)
|
||||
{
|
||||
@@ -902,8 +902,8 @@ tcp_kill_timewait(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
struct tcp_pcb *
|
||||
tcp_alloc(u8_t prio)
|
||||
{
|
||||
@@ -955,7 +955,7 @@ tcp_alloc(u8_t prio)
|
||||
}
|
||||
return pcb;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_new():
|
||||
*
|
||||
@@ -963,13 +963,13 @@ tcp_alloc(u8_t prio)
|
||||
* any of the TCP PCB lists.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
struct tcp_pcb *
|
||||
tcp_new(void)
|
||||
{
|
||||
return tcp_alloc(TCP_PRIO_NORMAL);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_arg():
|
||||
*
|
||||
@@ -977,14 +977,14 @@ tcp_new(void)
|
||||
* functions.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_arg(struct tcp_pcb *pcb, void *arg)
|
||||
{
|
||||
pcb->callback_arg = arg;
|
||||
}
|
||||
#if LWIP_CALLBACK_API
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_recv():
|
||||
*
|
||||
@@ -992,14 +992,14 @@ tcp_arg(struct tcp_pcb *pcb, void *arg)
|
||||
* connection receives data.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_recv(struct tcp_pcb *pcb,
|
||||
err_t (* recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err))
|
||||
{
|
||||
pcb->recv = recv;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_sent():
|
||||
*
|
||||
@@ -1007,14 +1007,14 @@ tcp_recv(struct tcp_pcb *pcb,
|
||||
* has been successfully delivered to the remote host.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_sent(struct tcp_pcb *pcb,
|
||||
err_t (* sent)(void *arg, struct tcp_pcb *tpcb, u16_t len))
|
||||
{
|
||||
pcb->sent = sent;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_err():
|
||||
*
|
||||
@@ -1022,14 +1022,14 @@ tcp_sent(struct tcp_pcb *pcb,
|
||||
* has occured on the connection.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_err(struct tcp_pcb *pcb,
|
||||
void (* errf)(void *arg, err_t err))
|
||||
{
|
||||
pcb->errf = errf;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_accept():
|
||||
*
|
||||
@@ -1037,7 +1037,7 @@ tcp_err(struct tcp_pcb *pcb,
|
||||
* LISTENing connection has been connected to another host.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_accept(struct tcp_pcb *pcb,
|
||||
err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err))
|
||||
@@ -1046,7 +1046,7 @@ tcp_accept(struct tcp_pcb *pcb,
|
||||
}
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_poll():
|
||||
*
|
||||
@@ -1055,7 +1055,7 @@ tcp_accept(struct tcp_pcb *pcb,
|
||||
* timer interval, which is called twice a second.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_poll(struct tcp_pcb *pcb,
|
||||
err_t (* poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval)
|
||||
@@ -1065,14 +1065,14 @@ tcp_poll(struct tcp_pcb *pcb,
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
pcb->pollinterval = interval;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_pcb_purge():
|
||||
*
|
||||
* Purges a TCP PCB. Removes any buffered data and frees the buffer memory.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -1107,14 +1107,14 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
|
||||
NULL;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_pcb_remove():
|
||||
*
|
||||
* Purges the PCB and removes it from a PCB list. Any delayed ACKs are sent first.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -1133,14 +1133,14 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
|
||||
|
||||
LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane());
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_next_iss():
|
||||
*
|
||||
* Calculates a new initial sequence number for new connections.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
u32_t
|
||||
tcp_next_iss(void)
|
||||
{
|
||||
@@ -1149,7 +1149,7 @@ tcp_next_iss(void)
|
||||
iss += tcp_ticks; /* XXX */
|
||||
return iss;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
|
||||
void
|
||||
tcp_debug_print(struct tcp_hdr *tcphdr)
|
||||
@@ -1181,7 +1181,7 @@ tcp_debug_print(struct tcp_hdr *tcphdr)
|
||||
ntohs(tcphdr->chksum), ntohs(tcphdr->urgp)));
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_debug_print_state(enum tcp_state s)
|
||||
{
|
||||
@@ -1222,7 +1222,7 @@ tcp_debug_print_state(enum tcp_state s)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_debug_print_flags(u8_t flags)
|
||||
{
|
||||
@@ -1251,7 +1251,7 @@ tcp_debug_print_flags(u8_t flags)
|
||||
LWIP_DEBUGF(TCP_DEBUG, ("CWR "));
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_debug_print_pcbs(void)
|
||||
{
|
||||
@@ -1278,7 +1278,7 @@ tcp_debug_print_pcbs(void)
|
||||
tcp_debug_print_state(pcb->state);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
tcp_pcbs_sane(void)
|
||||
{
|
||||
@@ -1295,7 +1295,7 @@ tcp_pcbs_sane(void)
|
||||
}
|
||||
#endif /* TCP_DEBUG */
|
||||
#endif /* LWIP_TCP */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp_input.c
|
||||
*
|
||||
* The input processing functions of TCP.
|
||||
@@ -45,7 +45,7 @@
|
||||
* tcp_process() -> tcp_receive() (-> application).
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include "lwip/def.h"
|
||||
@@ -85,7 +85,7 @@ static void tcp_parseopt(struct tcp_pcb *pcb);
|
||||
static err_t tcp_listen_input(struct tcp_pcb_listen *pcb);
|
||||
static err_t tcp_timewait_input(struct tcp_pcb *pcb);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp_input:
|
||||
*
|
||||
* The initial input processing of TCP. It verifies the TCP header, demultiplexes
|
||||
@@ -93,7 +93,7 @@ static err_t tcp_timewait_input(struct tcp_pcb *pcb);
|
||||
* the TCP finite state machine. This function is called by the IP layer (in
|
||||
* ip_input()).
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
@@ -398,13 +398,13 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane());
|
||||
PERF_STOP("tcp_input");
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp_listen_input():
|
||||
*
|
||||
* Called by tcp_input() when a segment arrives for a listening
|
||||
* connection.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
{
|
||||
@@ -465,13 +465,13 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp_timewait_input():
|
||||
*
|
||||
* Called by tcp_input() when a segment arrives for a connection in
|
||||
* TIME_WAIT.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
tcp_timewait_input(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -483,7 +483,7 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
||||
}
|
||||
return tcp_output(pcb);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp_process
|
||||
*
|
||||
* Implements the TCP state machine. Called by tcp_input. In some
|
||||
@@ -491,7 +491,7 @@ tcp_timewait_input(struct tcp_pcb *pcb)
|
||||
* argument will be freed by the caller (tcp_input()) unless the
|
||||
* recv_data pointer in the pcb is set.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
tcp_process(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -650,7 +650,7 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp_receive:
|
||||
*
|
||||
* Called by tcp_process. Checks if the given segment is an ACK for outstanding
|
||||
@@ -662,7 +662,7 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
* If the incoming segment constitutes an ACK for a segment that was used for RTT
|
||||
* estimation, the RTT is estimated here as well.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
tcp_receive(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -1158,7 +1158,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* tcp_parseopt:
|
||||
*
|
||||
@@ -1166,7 +1166,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
||||
* from uIP with only small changes.)
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
tcp_parseopt(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -1208,5 +1208,5 @@ tcp_parseopt(struct tcp_pcb *pcb)
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_TCP */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* tcp_output.c
|
||||
*
|
||||
* The output functions of TCP.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include "lwip/def.h"
|
||||
@@ -64,14 +64,14 @@
|
||||
static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb);
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
|
||||
{
|
||||
return tcp_enqueue(pcb, NULL, 0, flags, 1, NULL, 0);
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
|
||||
return ERR_CONN;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
err_t
|
||||
tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
||||
u8_t flags, u8_t copy,
|
||||
@@ -338,7 +338,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
||||
LWIP_DEBUGF(TCP_QLEN_DEBUG | DBG_STATE, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen));
|
||||
return ERR_MEM;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* find out what we can send and send it */
|
||||
err_t
|
||||
tcp_output(struct tcp_pcb *pcb)
|
||||
@@ -468,7 +468,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -526,7 +526,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
||||
ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos,
|
||||
IP_PROTO_TCP);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_rst(u32_t seqno, u32_t ackno,
|
||||
struct ip_addr *local_ip, struct ip_addr *remote_ip,
|
||||
@@ -560,7 +560,7 @@ tcp_rst(u32_t seqno, u32_t ackno,
|
||||
pbuf_free(p);
|
||||
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %lu ackno %lu.\n", seqno, ackno));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_rexmit(struct tcp_pcb *pcb)
|
||||
{
|
||||
@@ -590,7 +590,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
tcp_output(pcb);
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
tcp_keepalive(struct tcp_pcb *pcb)
|
||||
{
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/* udp.c
|
||||
*
|
||||
* The code for the User Datagram Protocol UDP.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
@@ -64,20 +64,20 @@ struct udp_pcb *udp_pcbs = NULL;
|
||||
|
||||
static struct udp_pcb *pcb_cache = NULL;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
udp_init(void)
|
||||
{
|
||||
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)
|
||||
@@ -718,7 +718,7 @@ udp_disconnect(struct udp_pcb *pcb)
|
||||
{
|
||||
pcb->flags &= ~UDP_FLAGS_CONNECTED;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
udp_recv(struct udp_pcb *pcb,
|
||||
void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p,
|
||||
@@ -777,7 +777,7 @@ udp_new(void) {
|
||||
|
||||
return pcb;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if UDP_DEBUG
|
||||
int
|
||||
udp_debug_print(struct udp_hdr *udphdr)
|
||||
@@ -793,7 +793,7 @@ udp_debug_print(struct udp_hdr *udphdr)
|
||||
return 0;
|
||||
}
|
||||
#endif /* UDP_DEBUG */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* LWIP_UDP */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user