diff options
Diffstat (limited to 'Projects/Webserver/Lib/uip')
-rw-r--r-- | Projects/Webserver/Lib/uip/clock.c | 1 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/clock.h | 1 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/timer.c | 1 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/timer.h | 1 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uip-split.c | 13 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uip-split.h | 51 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uip.c | 153 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uip.h | 29 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uip_arp.c | 27 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uip_arp.h | 5 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uipopt.h | 23 |
11 files changed, 158 insertions, 147 deletions
diff --git a/Projects/Webserver/Lib/uip/clock.c b/Projects/Webserver/Lib/uip/clock.c index 046b6e344..86322966e 100644 --- a/Projects/Webserver/Lib/uip/clock.c +++ b/Projects/Webserver/Lib/uip/clock.c @@ -36,3 +36,4 @@ clock_time_t clock_time() return time; } + diff --git a/Projects/Webserver/Lib/uip/clock.h b/Projects/Webserver/Lib/uip/clock.h index 05d30386b..bbfa4ac0e 100644 --- a/Projects/Webserver/Lib/uip/clock.h +++ b/Projects/Webserver/Lib/uip/clock.h @@ -10,3 +10,4 @@ void clock_init(void); clock_time_t clock_time(void); #endif /* __CLOCK_ARCH_H__ */ + diff --git a/Projects/Webserver/Lib/uip/timer.c b/Projects/Webserver/Lib/uip/timer.c index 3c5fd202e..0e5e59147 100644 --- a/Projects/Webserver/Lib/uip/timer.c +++ b/Projects/Webserver/Lib/uip/timer.c @@ -125,3 +125,4 @@ timer_expired(struct timer *t) /*---------------------------------------------------------------------------*/ /** @} */ + diff --git a/Projects/Webserver/Lib/uip/timer.h b/Projects/Webserver/Lib/uip/timer.h index 057bea49c..04917e4c5 100644 --- a/Projects/Webserver/Lib/uip/timer.h +++ b/Projects/Webserver/Lib/uip/timer.h @@ -84,3 +84,4 @@ int timer_expired(struct timer *t); #endif /* __TIMER_H__ */ /** @} */ + diff --git a/Projects/Webserver/Lib/uip/uip-split.c b/Projects/Webserver/Lib/uip/uip-split.c index 5fac6d53b..87dbd7e1f 100644 --- a/Projects/Webserver/Lib/uip/uip-split.c +++ b/Projects/Webserver/Lib/uip/uip-split.c @@ -47,7 +47,7 @@ uip_split_output(void) /* We only try to split maximum sized TCP segments. */ if(BUF->proto == UIP_PROTO_TCP && uip_len == UIP_BUFSIZE) { - + tcplen = uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN; /* Split the segment in two. If the original packet length was odd, we make the second packet one byte larger. */ @@ -68,7 +68,7 @@ uip_split_output(void) BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8; BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff; #endif /* UIP_CONF_IPV6 */ - + /* Recalculate the TCP checksum. */ BUF->tcpchksum = 0; BUF->tcpchksum = ~(uip_tcpchksum()); @@ -78,14 +78,14 @@ uip_split_output(void) BUF->ipchksum = 0; BUF->ipchksum = ~(uip_ipchksum()); #endif /* UIP_CONF_IPV6 */ - + /* Transmit the first packet. */ #if UIP_CONF_IPV6 tcpip_ipv6_output(); #else RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len); #endif /* UIP_CONF_IPV6 */ - + /* Now, create the second packet. To do this, it is not enough to just alter the length field, but we must also update the TCP sequence number and point the uip_appdata to a new place in @@ -101,7 +101,7 @@ uip_split_output(void) BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8; BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff; #endif /* UIP_CONF_IPV6 */ - + memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2); uip_add32(BUF->seqno, len1); @@ -109,7 +109,7 @@ uip_split_output(void) BUF->seqno[1] = uip_acc32[1]; BUF->seqno[2] = uip_acc32[2]; BUF->seqno[3] = uip_acc32[3]; - + /* Recalculate the TCP checksum. */ BUF->tcpchksum = 0; BUF->tcpchksum = ~(uip_tcpchksum()); @@ -139,3 +139,4 @@ uip_split_output(void) } /*-----------------------------------------------------------------------------*/ + diff --git a/Projects/Webserver/Lib/uip/uip-split.h b/Projects/Webserver/Lib/uip/uip-split.h index c7274c36a..2243355d6 100644 --- a/Projects/Webserver/Lib/uip/uip-split.h +++ b/Projects/Webserver/Lib/uip/uip-split.h @@ -1,33 +1,33 @@ /* * Copyright (c) 2004, Swedish Institute of Computer Science. - * All rights reserved. + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * This file is part of the Contiki operating system. - * + * * Author: Adam Dunkels <adam@sics.se> * * $Id: uip-split.h,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $ @@ -63,7 +63,7 @@ /** * \file * Module for splitting outbound TCP segments in two to avoid the - * delayed ACK throughput degradation. + * delayed ACK throughput degradation. * \author * Adam Dunkels <adam@sics.se> * @@ -101,3 +101,4 @@ void uip_add32(u8_t *op32, u16_t op16); /** @} */ /** @} */ + diff --git a/Projects/Webserver/Lib/uip/uip.c b/Projects/Webserver/Lib/uip/uip.c index 36053029a..afa19f750 100644 --- a/Projects/Webserver/Lib/uip/uip.c +++ b/Projects/Webserver/Lib/uip/uip.c @@ -245,15 +245,15 @@ uip_add32(u8_t *op32, u16_t op16) uip_acc32[2] = op32[2] + (op16 >> 8); uip_acc32[1] = op32[1]; uip_acc32[0] = op32[0]; - + if(uip_acc32[2] < (op16 >> 8)) { ++uip_acc32[1]; if(uip_acc32[1] == 0) { ++uip_acc32[0]; } } - - + + if(uip_acc32[3] < (op16 & 0xff)) { ++uip_acc32[2]; if(uip_acc32[2] == 0) { @@ -278,7 +278,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len) dataptr = data; last_byte = data + len - 1; - + while(dataptr < last_byte) { /* At least two more bytes */ t = (dataptr[0] << 8) + dataptr[1]; sum += t; @@ -287,7 +287,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len) } dataptr += 2; } - + if(dataptr == last_byte) { t = (dataptr[0] << 8) + 0; sum += t; @@ -323,15 +323,15 @@ upper_layer_chksum(u8_t proto) { u16_t upper_layer_len; u16_t sum; - + #if UIP_CONF_IPV6 upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]); #else /* UIP_CONF_IPV6 */ upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; #endif /* UIP_CONF_IPV6 */ - + /* First sum pseudoheader. */ - + /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ @@ -340,7 +340,7 @@ upper_layer_chksum(u8_t proto) /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], upper_layer_len); - + return (sum == 0) ? 0xffff : htons(sum); } /*---------------------------------------------------------------------------*/ @@ -349,7 +349,7 @@ u16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); - + } #endif /* UIP_CONF_IPV6 */ /*---------------------------------------------------------------------------*/ @@ -386,7 +386,7 @@ uip_init(void) uip_udp_conns[c].lport = 0; } #endif /* UIP_UDP */ - + /* IPv4 initialization. */ #if UIP_FIXEDADDR == 0 @@ -400,7 +400,7 @@ struct uip_conn * uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) { register struct uip_conn *conn, *cconn; - + /* Find an unused local port. */ again: ++lastport; @@ -437,7 +437,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) if(conn == 0) { return 0; } - + conn->tcpstateflags = UIP_SYN_SENT; conn->snd_nxt[0] = iss[0]; @@ -446,7 +446,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) conn->snd_nxt[3] = iss[3]; conn->initialmss = conn->mss = UIP_TCP_MSS; - + conn->len = 1; /* TCP length of the SYN is one. */ conn->nrtx = 0; conn->timer = 1; /* Send the SYN next time around. */ @@ -456,7 +456,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) conn->lport = htons(lastport); conn->rport = rport; uip_ipaddr_copy(&conn->ripaddr, ripaddr); - + return conn; } #endif /* UIP_ACTIVE_OPEN */ @@ -466,7 +466,7 @@ struct uip_udp_conn * uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) { register struct uip_udp_conn *conn; - + /* Find an unused local port. */ again: ++lastport; @@ -474,7 +474,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) if(lastport >= 32000) { lastport = 4096; } - + for(c = 0; c < UIP_UDP_CONNS; ++c) { if(uip_udp_conns[c].lport == htons(lastport)) { goto again; @@ -493,7 +493,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) if(conn == 0) { return 0; } - + conn->lport = HTONS(lastport); conn->rport = rport; if(ripaddr == NULL) { @@ -502,7 +502,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport) uip_ipaddr_copy(&conn->ripaddr, ripaddr); } conn->ttl = UIP_TTL; - + return conn; } #endif /* UIP_UDP */ @@ -587,12 +587,12 @@ uip_reass(void) memcpy(&uip_reassbuf[UIP_IPH_LEN + offset], (char *)BUF + (int)((BUF->vhl & 0x0f) * 4), len); - + /* Update the bitmap. */ if(offset / (8 * 8) == (offset + len) / (8 * 8)) { /* If the two endpoints are in the same byte, we only update that byte. */ - + uip_reassbitmap[offset / (8 * 8)] |= bitmap_bits[(offset / 8 ) & 7] & ~bitmap_bits[((offset + len) / 8 ) & 7]; @@ -608,7 +608,7 @@ uip_reass(void) uip_reassbitmap[(offset + len) / (8 * 8)] |= ~bitmap_bits[((offset + len) / 8 ) & 7]; } - + /* If this fragment has the More Fragments flag set to zero, we know that this is the last fragment, so we can calculate the size of the entire packet. We also set the @@ -619,7 +619,7 @@ uip_reass(void) uip_reassflags |= UIP_REASS_FLAG_LASTFRAG; uip_reasslen = offset + len; } - + /* Finally, we check if we have a full packet in the buffer. We do this by checking if we have the last fragment and if all bits in the bitmap are set. */ @@ -681,7 +681,7 @@ uip_process(u8_t flag) goto udp_send; } #endif /* UIP_UDP */ - + uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN]; /* Check if we were invoked because of a poll request for a @@ -695,7 +695,7 @@ uip_process(u8_t flag) goto appsend; } goto drop; - + /* Check if we were invoked because of the periodic timer firing. */ } else if(flag == UIP_TIMER) { #if UIP_REASSEMBLY @@ -754,7 +754,7 @@ uip_process(u8_t flag) 4: uip_connr->nrtx); ++(uip_connr->nrtx); - + /* Ok, so we need to retransmit. We do this differently depending on which state we are in. In ESTABLISHED, we call upon the application so that it may prepare the @@ -767,14 +767,14 @@ uip_process(u8_t flag) /* In the SYN_RCVD state, we should retransmit our SYNACK. */ goto tcp_send_synack; - + #if UIP_ACTIVE_OPEN case UIP_SYN_SENT: /* In the SYN_SENT state, we retransmit out SYN. */ BUF->flags = 0; goto tcp_send_syn; #endif /* UIP_ACTIVE_OPEN */ - + case UIP_ESTABLISHED: /* In the ESTABLISHED state, we call upon the application to do the actual retransmit after which we jump into @@ -783,19 +783,19 @@ uip_process(u8_t flag) uip_flags = UIP_REXMIT; UIP_APPCALL(); goto apprexmit; - + case UIP_FIN_WAIT_1: case UIP_CLOSING: case UIP_LAST_ACK: /* In all these states we should retransmit a FINACK. */ goto tcp_send_finack; - + } } } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) { /* If there was no need for a retransmission, we poll the application for new data. */ - uip_len = uip_slen = 0; + uip_len = uip_slen = 0; uip_flags = UIP_POLL; UIP_APPCALL(); goto appsend; @@ -822,7 +822,7 @@ uip_process(u8_t flag) UIP_STAT(++uip_stat.ip.recv); /* Start of IP input header processing code. */ - + #if UIP_CONF_IPV6 /* Check validity of the IP header. */ if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */ @@ -840,7 +840,7 @@ uip_process(u8_t flag) goto drop; } #endif /* UIP_CONF_IPV6 */ - + /* Check the size of the packet. If the size reported to us in uip_len is smaller the size reported in the IP header, we assume that the packet has been corrupted in transit. If the size of @@ -910,7 +910,7 @@ uip_process(u8_t flag) goto udp_input; } #endif /* UIP_BROADCAST */ - + /* Check if the packet is destined for our IP address. */ #if !UIP_CONF_IPV6 if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) { @@ -1028,14 +1028,14 @@ uip_process(u8_t flag) /* Save the sender's address in our neighbor list. */ uip_neighbor_add(&ICMPBUF->srcipaddr, &(ICMPBUF->options[2])); } - + /* We should now send a neighbor advertisement back to where the neighbor solicitation came from. */ ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT; ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */ - + ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0; - + uip_ipaddr_copy(&ICMPBUF->destipaddr, &ICMPBUF->srcipaddr); uip_ipaddr_copy(&ICMPBUF->srcipaddr, &uip_hostaddr); ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS; @@ -1043,9 +1043,9 @@ uip_process(u8_t flag) memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr)); ICMPBUF->icmpchksum = 0; ICMPBUF->icmpchksum = ~uip_icmp6chksum(); - + goto send; - + } goto drop; } else if(ICMPBUF->type == ICMP6_ECHO) { @@ -1054,12 +1054,12 @@ uip_process(u8_t flag) ICMP checksum before we return the packet. */ ICMPBUF->type = ICMP6_ECHO_REPLY; - + uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr); uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr); ICMPBUF->icmpchksum = 0; ICMPBUF->icmpchksum = ~uip_icmp6chksum(); - + UIP_STAT(++uip_stat.icmp.sent); goto send; } else { @@ -1071,7 +1071,7 @@ uip_process(u8_t flag) } /* End of IPv6 ICMP processing. */ - + #endif /* !UIP_CONF_IPV6 */ #if UIP_UDP @@ -1147,7 +1147,7 @@ uip_process(u8_t flag) #else /* UIP_CONF_ICMP_DEST_UNREACH */ goto drop; #endif /* UIP_CONF_ICMP_DEST_UNREACH */ - + udp_found: uip_conn = NULL; uip_flags = UIP_NEWDATA; @@ -1182,7 +1182,7 @@ uip_process(u8_t flag) uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr); uip_ipaddr_copy(&BUF->destipaddr, &uip_udp_conn->ripaddr); - + uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN]; #if UIP_UDP_CHECKSUMS @@ -1192,16 +1192,16 @@ uip_process(u8_t flag) UDPBUF->udpchksum = 0xffff; } #endif /* UIP_UDP_CHECKSUMS */ - + goto ip_send_nolen; #endif /* UIP_UDP */ - + /* TCP input processing. */ tcp_input: UIP_STAT(++uip_stat.tcp.recv); /* Start of TCP input header processing code. */ - + if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP checksum. */ UIP_STAT(++uip_stat.tcp.drop); @@ -1209,7 +1209,7 @@ uip_process(u8_t flag) UIP_LOG("tcp: bad checksum."); goto drop; } - + /* Demultiplex this segment. */ /* First check any active connections. */ for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1]; @@ -1229,7 +1229,7 @@ uip_process(u8_t flag) if((BUF->flags & TCP_CTL) != TCP_SYN) { goto reset; } - + tmp16 = BUF->destport; /* Next, check listening connections. */ for(c = 0; c < UIP_LISTENPORTS; ++c) { @@ -1237,7 +1237,7 @@ uip_process(u8_t flag) goto found_listen; } } - + /* No matching connection found, so we send a RST packet. */ UIP_STAT(++uip_stat.tcp.synrst); @@ -1248,7 +1248,7 @@ uip_process(u8_t flag) } UIP_STAT(++uip_stat.tcp.rst); - + BUF->flags = TCP_RST | TCP_ACK; uip_len = UIP_IPTCPH_LEN; BUF->tcpoffset = 5 << 4; @@ -1257,15 +1257,15 @@ uip_process(u8_t flag) c = BUF->seqno[3]; BUF->seqno[3] = BUF->ackno[3]; BUF->ackno[3] = c; - + c = BUF->seqno[2]; BUF->seqno[2] = BUF->ackno[2]; BUF->ackno[2] = c; - + c = BUF->seqno[1]; BUF->seqno[1] = BUF->ackno[1]; BUF->ackno[1] = c; - + c = BUF->seqno[0]; BUF->seqno[0] = BUF->ackno[0]; BUF->ackno[0] = c; @@ -1280,16 +1280,16 @@ uip_process(u8_t flag) } } } - + /* Swap port numbers. */ tmp16 = BUF->srcport; BUF->srcport = BUF->destport; BUF->destport = tmp16; - + /* Swap IP addresses. */ uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr); uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr); - + /* And send out the RST packet! */ goto tcp_send_noconn; @@ -1326,7 +1326,7 @@ uip_process(u8_t flag) goto drop; } uip_conn = uip_connr; - + /* Fill in the necessary fields for the new connection. */ uip_connr->rto = uip_connr->timer = UIP_RTO; uip_connr->sa = 0; @@ -1367,7 +1367,7 @@ uip_process(u8_t flag) (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; uip_connr->initialmss = uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; - + /* And we are done processing options. */ break; } else { @@ -1382,19 +1382,19 @@ uip_process(u8_t flag) } } } - + /* Our response will be a SYNACK. */ #if UIP_ACTIVE_OPEN tcp_send_synack: BUF->flags = TCP_ACK; - + tcp_send_syn: BUF->flags |= TCP_SYN; #else /* UIP_ACTIVE_OPEN */ tcp_send_synack: BUF->flags = TCP_SYN | TCP_ACK; #endif /* UIP_ACTIVE_OPEN */ - + /* We send out the TCP Maximum Segment Size option with our SYNACK. */ BUF->optdata[0] = TCP_OPT_MSS; @@ -1458,7 +1458,7 @@ uip_process(u8_t flag) uip_connr->snd_nxt[1] = uip_acc32[1]; uip_connr->snd_nxt[2] = uip_acc32[2]; uip_connr->snd_nxt[3] = uip_acc32[3]; - + /* Do RTT estimation, unless we have done retransmissions. */ if(uip_connr->nrtx == 0) { signed char m; @@ -1482,7 +1482,7 @@ uip_process(u8_t flag) /* Reset length of outstanding data. */ uip_connr->len = 0; } - + } /* Do different things depending on in what state the connection is. */ @@ -1570,7 +1570,7 @@ uip_process(u8_t flag) uip_conn->tcpstateflags = UIP_CLOSED; goto reset; #endif /* UIP_ACTIVE_OPEN */ - + case UIP_ESTABLISHED: /* In the ESTABLISHED state, we call upon the application to feed data into the uip_buf. If the UIP_ACKDATA flag is set, the @@ -1672,7 +1672,7 @@ uip_process(u8_t flag) UIP_APPCALL(); appsend: - + if(uip_flags & UIP_ABORT) { uip_slen = 0; uip_connr->tcpstateflags = UIP_CLOSED; @@ -1724,7 +1724,7 @@ uip_process(u8_t flag) uip_connr->nrtx = 0; apprexmit: uip_appdata = uip_sappdata; - + /* If the application has data to be sent, or if the incoming packet had new data in it, we must send out a packet. */ if(uip_slen > 0 && uip_connr->len > 0) { @@ -1753,7 +1753,7 @@ uip_process(u8_t flag) UIP_APPCALL(); } break; - + case UIP_FIN_WAIT_1: /* The application has closed the connection, but the remote host hasn't closed its end yet. Thus we do nothing but wait for a @@ -1782,7 +1782,7 @@ uip_process(u8_t flag) goto tcp_send_ack; } goto drop; - + case UIP_FIN_WAIT_2: if(uip_len > 0) { uip_add_rcv_nxt(uip_len); @@ -1802,7 +1802,7 @@ uip_process(u8_t flag) case UIP_TIME_WAIT: goto tcp_send_ack; - + case UIP_CLOSING: if(uip_flags & UIP_ACKDATA) { uip_connr->tcpstateflags = UIP_TIME_WAIT; @@ -1810,7 +1810,7 @@ uip_process(u8_t flag) } } goto drop; - + /* We jump here when we are ready to send the packet, and just want to set the appropriate TCP sequence numbers in the TCP header. */ tcp_send_ack: @@ -1831,14 +1831,14 @@ uip_process(u8_t flag) BUF->ackno[1] = uip_connr->rcv_nxt[1]; BUF->ackno[2] = uip_connr->rcv_nxt[2]; BUF->ackno[3] = uip_connr->rcv_nxt[3]; - + BUF->seqno[0] = uip_connr->snd_nxt[0]; BUF->seqno[1] = uip_connr->snd_nxt[1]; BUF->seqno[2] = uip_connr->snd_nxt[2]; BUF->seqno[3] = uip_connr->snd_nxt[3]; BUF->proto = UIP_PROTO_TCP; - + BUF->srcport = uip_connr->lport; BUF->destport = uip_connr->rport; @@ -1867,7 +1867,7 @@ uip_process(u8_t flag) #endif /* UIP_CONF_IPV6 */ BUF->urgp[0] = BUF->urgp[1] = 0; - + /* Calculate TCP checksum. */ BUF->tcpchksum = 0; BUF->tcpchksum = ~(uip_tcpchksum()); @@ -1888,14 +1888,14 @@ uip_process(u8_t flag) BUF->ipchksum = 0; BUF->ipchksum = ~(uip_ipchksum()); DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum()); -#endif /* UIP_CONF_IPV6 */ +#endif /* UIP_CONF_IPV6 */ UIP_STAT(++uip_stat.tcp.sent); #if UIP_CONF_IPV6 send: #endif /* UIP_CONF_IPV6 */ DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len, (BUF->len[0] << 8) | BUF->len[1]); - + UIP_STAT(++uip_stat.ip.sent); /* Return and let the caller do the actual transmission. */ uip_flags = 0; @@ -1936,3 +1936,4 @@ uip_send(const void *data, int len) /*---------------------------------------------------------------------------*/ /** @} */ #endif /* UIP_CONF_IPV6 */ + diff --git a/Projects/Webserver/Lib/uip/uip.h b/Projects/Webserver/Lib/uip/uip.h index 83a08a8a0..10f20de6b 100644 --- a/Projects/Webserver/Lib/uip/uip.h +++ b/Projects/Webserver/Lib/uip/uip.h @@ -145,7 +145,7 @@ typedef struct uip_eth_addr uip_lladdr_t; uip_ipaddr(&addr, 192,168,1,2); uip_sethostaddr(&addr); - + \endcode * \param addr A pointer to an IP address of type uip_ipaddr_t; * @@ -805,7 +805,7 @@ void uip_send(const void *data, int len); \code uip_ipaddr_t addr; struct uip_udp_conn *c; - + uip_ipaddr(&addr, 192,168,2,1); c = uip_udp_new(&addr, HTONS(12345)); if(c != NULL) { @@ -866,7 +866,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); * These functions can be used for converting between different data * formats used by uIP. */ - + /** * Convert an IP address to four bytes separated by commas. * @@ -892,7 +892,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); \code uip_ipaddr_t ipaddr; struct uip_conn *c; - + uip_ipaddr(&ipaddr, 192,168,1,2); c = uip_connect(&ipaddr, HTONS(80)); \endcode @@ -1281,11 +1281,11 @@ extern u16_t uip_urglen, uip_surglen; */ struct uip_conn { uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */ - + u16_t lport; /**< The local TCP port, in network byte order. */ u16_t rport; /**< The local remote TCP port, in network byte order. */ - + u8_t rcv_nxt[4]; /**< The sequence number that we expect to receive next. */ u8_t snd_nxt[4]; /**< The sequence number that was last sent by @@ -1398,7 +1398,7 @@ struct uip_stats { layer. */ uip_stats_t sent; /**< Number of sent packets at the IP layer. */ - uip_stats_t forwarded;/**< Number of forwarded packets at the IP + uip_stats_t forwarded;/**< Number of forwarded packets at the IP layer. */ uip_stats_t drop; /**< Number of dropped packets at the IP layer. */ @@ -1527,14 +1527,14 @@ uip_ext_hdr_options_process(); */ * The actual uIP function which does all the work. */ void uip_process(u8_t flag); - + /* The following flags are passed as an argument to the uip_process() function. They are used to distinguish between the two cases where uip_process() is called. It can be called either because we have incoming data that should be processed, or because the periodic timer has fired. These values are never used directly, but only in the macros defined in this file. */ - + #define UIP_DATA 1 /* Tells uIP that there is incoming data in the uip_buf buffer. The length of the data is stored in the @@ -1561,7 +1561,7 @@ void uip_process(u8_t flag); #define UIP_TIME_WAIT 7 #define UIP_LAST_ACK 8 #define UIP_TS_MASK 15 - + #define UIP_STOPPED 16 /* The TCP and IP headers. */ @@ -1586,7 +1586,7 @@ struct uip_tcpip_hdr { u16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; #endif /* UIP_CONF_IPV6 */ - + /* TCP header. */ u16_t srcport, destport; @@ -1622,7 +1622,7 @@ struct uip_icmpip_hdr { u16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; #endif /* UIP_CONF_IPV6 */ - + /* ICMP header. */ u8_t type, icode; u16_t icmpchksum; @@ -1655,7 +1655,7 @@ struct uip_udpip_hdr { u16_t ipchksum; uip_ipaddr_t srcipaddr, destipaddr; #endif /* UIP_CONF_IPV6 */ - + /* UDP header. */ u16_t srcport, destport; @@ -2023,7 +2023,7 @@ extern uip_lladdr_t uip_lladdr; (((a)->u8[13]) == (m)->addr[3]) && \ (((a)->u8[14]) == (m)->addr[4]) && \ (((a)->u8[15]) == (m)->addr[5])) - + #endif /*UIP_CONF_LL_802154*/ /** @@ -2127,3 +2127,4 @@ u16_t uip_icmp6chksum(void); /** @} */ + diff --git a/Projects/Webserver/Lib/uip/uip_arp.c b/Projects/Webserver/Lib/uip/uip_arp.c index b7e3b7342..fcb783b14 100644 --- a/Projects/Webserver/Lib/uip/uip_arp.c +++ b/Projects/Webserver/Lib/uip/uip_arp.c @@ -16,7 +16,7 @@ * * \note This ARP implementation only supports Ethernet. */ - + /** * \file * Implementation of the ARP Address Resolution Protocol. @@ -150,7 +150,7 @@ void uip_arp_timer(void) { struct arp_entry *tabptr = NULL; - + ++arptime; for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { tabptr = &arp_table[i]; @@ -178,7 +178,7 @@ uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr) /* Check if the source IP address of the incoming packet matches the IP address in this ARP table entry. */ if(uip_ipaddr_cmp(ipaddr, &tabptr->ipaddr)) { - + /* An old entry found, update this and return. */ memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6); tabptr->time = arptime; @@ -240,7 +240,7 @@ void uip_arp_ipin(void) { uip_len -= sizeof(struct uip_eth_hdr); - + /* Only insert/update an entry if the source IP address of the incoming IP packet comes from a host on the local network. */ if((IPBUF->srcipaddr[0] & uip_netmask[0]) != @@ -252,7 +252,7 @@ uip_arp_ipin(void) return; } uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src)); - + return; } #endif /* 0 */ @@ -287,7 +287,7 @@ uip_arp_arpin(void) return; } uip_len = 0; - + switch(BUF->opcode) { case HTONS(ARP_REQUEST): /* ARP request. If it asked for our address, we send out a @@ -304,14 +304,14 @@ uip_arp_arpin(void) table, since it is likely that we will do more communication with this host in the future. */ uip_arp_update(&BUF->sipaddr, &BUF->shwaddr); - + BUF->opcode = HTONS(ARP_REPLY); memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6); memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6); memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6); memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6); - + uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr); uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr); @@ -362,7 +362,7 @@ void uip_arp_out(void) { struct arp_entry *tabptr = NULL; - + /* Find the destination IP address in the ARP table and construct the Ethernet header. If the destination IP address isn't on the local network, we use the default router's IP address instead. @@ -384,7 +384,7 @@ uip_arp_out(void) /* Else, we use the destination IP address. */ uip_ipaddr_copy(&ipaddr, &IPBUF->destipaddr); } - + for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { tabptr = &arp_table[i]; if(uip_ipaddr_cmp(&ipaddr, &tabptr->ipaddr)) { @@ -400,7 +400,7 @@ uip_arp_out(void) memset(BUF->dhwaddr.addr, 0x00, 6); memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6); memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6); - + uip_ipaddr_copy(&BUF->dipaddr, &ipaddr); uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr); BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */ @@ -411,7 +411,7 @@ uip_arp_out(void) BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP); uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN]; - + uip_len = sizeof(struct arp_hdr); return; } @@ -420,7 +420,7 @@ uip_arp_out(void) memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6); } memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6); - + IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP); uip_len += sizeof(struct uip_eth_hdr); @@ -429,3 +429,4 @@ uip_arp_out(void) /** @} */ /** @} */ + diff --git a/Projects/Webserver/Lib/uip/uip_arp.h b/Projects/Webserver/Lib/uip/uip_arp.h index 114d4310c..4e78ce7b7 100644 --- a/Projects/Webserver/Lib/uip/uip_arp.h +++ b/Projects/Webserver/Lib/uip/uip_arp.h @@ -7,13 +7,13 @@ * \addtogroup uiparp * @{ */ - + /** * \file * Macros and definitions for the ARP module. * \author Adam Dunkels <adam@dunkels.com> */ - + /* * Copyright (c) 2001-2003, Adam Dunkels. @@ -143,3 +143,4 @@ void uip_arp_timer(void); #endif /* __UIP_ARP_H__ */ /** @} */ + diff --git a/Projects/Webserver/Lib/uip/uipopt.h b/Projects/Webserver/Lib/uip/uipopt.h index 244ce1df1..b61a7b4a8 100644 --- a/Projects/Webserver/Lib/uip/uipopt.h +++ b/Projects/Webserver/Lib/uip/uipopt.h @@ -189,12 +189,12 @@ #define UIP_CONF_IPV6_QUEUE_PKT 0 #endif -#ifndef UIP_CONF_IPV6_CHECKS +#ifndef UIP_CONF_IPV6_CHECKS /** Do we do IPv6 consistency checks (highly recommended, default: yes) */ #define UIP_CONF_IPV6_CHECKS 1 #endif -#ifndef UIP_CONF_IPV6_REASSEMBLY +#ifndef UIP_CONF_IPV6_REASSEMBLY /** Do we do IPv6 fragmentation (default: no) */ #define UIP_CONF_IPV6_REASSEMBLY 0 #endif @@ -204,14 +204,14 @@ #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #endif -#ifndef UIP_CONF_ND6_MAX_PREFIXES +#ifndef UIP_CONF_ND6_MAX_PREFIXES /** Default number of IPv6 prefixes associated to the node's interface */ #define UIP_CONF_ND6_MAX_PREFIXES 3 #endif -#ifndef UIP_CONF_ND6_MAX_NEIGHBORS +#ifndef UIP_CONF_ND6_MAX_NEIGHBORS /** Default number of neighbors that can be stored in the %neighbor cache */ -#define UIP_CONF_ND6_MAX_NEIGHBORS 4 +#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #endif #ifndef UIP_CONF_ND6_MAX_DEFROUTERS @@ -485,14 +485,14 @@ /** * If we use IPHC compression, how many address contexts do we support */ -#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS +#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1 #endif /** * Do we support 6lowpan fragmentation */ -#ifndef SICSLOWPAN_CONF_FRAG +#ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 0 #endif @@ -690,19 +690,19 @@ typedef union { uint8_t CurrentState; uint8_t NextState; - + char FileName[MAX_URI_LENGTH]; FIL FileHandle; bool FileOpen; uint32_t ACKedFilePos; uint16_t SentChunkSize; } HTTPServer; - + struct { uint8_t CurrentState; uint8_t NextState; - + uint8_t IssuedCommand; } TELNETServer; } uip_tcp_appstate_t; @@ -720,7 +720,7 @@ typedef union { uint8_t CurrentState; struct timer Timeout; - + struct { uint8_t AllocatedIP[4]; @@ -735,3 +735,4 @@ typedef union #endif /* __UIPOPT_H__ */ /** @} */ /** @} */ + |