diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-04-12 12:13:01 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-04-12 12:13:01 -0600 |
commit | 387c4ace106479e457033b1717051ec55b8d673e (patch) | |
tree | f84c1b5e8f1b343cfbce0695e7fb0d2fd266edbd | |
parent | 3e8caf3af969b40b8088111ee77e5ccdc6c4980b (diff) | |
download | nuttx-387c4ace106479e457033b1717051ec55b8d673e.tar.gz nuttx-387c4ace106479e457033b1717051ec55b8d673e.tar.bz2 nuttx-387c4ace106479e457033b1717051ec55b8d673e.zip |
net/uip: Review all files in this directory for coding style and spelling
36 files changed, 183 insertions, 144 deletions
diff --git a/nuttx/net/net_send_buffered.c b/nuttx/net/net_send_buffered.c index e251c65ac..c7263a675 100644 --- a/nuttx/net/net_send_buffered.c +++ b/nuttx/net/net_send_buffered.c @@ -269,7 +269,7 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn, * NOTE 1: This could be an expensive check if there are a lot of * entries in the ARP table. * - * NOTE 2: If we are actually harvesting IP addresses on incomming IP + * NOTE 2: If we are actually harvesting IP addresses on incoming IP * packets, then this check should not be necessary; the MAC mapping * should already be in the ARP table. */ diff --git a/nuttx/net/net_sendfile.c b/nuttx/net/net_sendfile.c index 17189ae0f..81dbbada9 100644 --- a/nuttx/net/net_sendfile.c +++ b/nuttx/net/net_sendfile.c @@ -315,7 +315,7 @@ static uint16_t sendfile_interrupt(FAR struct uip_driver_s *dev, FAR void *pvcon * in the ARP table. Hence, we only check on the first packet -- when * snd_sent is zero. * - * NOTE 2: If we are actually harvesting IP addresses on incomming IP + * NOTE 2: If we are actually harvesting IP addresses on incoming IP * packets, then this check should not be necessary; the MAC mapping * should already be in the ARP table. */ diff --git a/nuttx/net/uip/uip_arp.c b/nuttx/net/uip/uip_arp.c index e80c80dec..068552084 100644 --- a/nuttx/net/uip/uip_arp.c +++ b/nuttx/net/uip/uip_arp.c @@ -240,6 +240,7 @@ void uip_arp_arpin(struct uip_driver_s *dev) dev->d_len = 0; return; } + dev->d_len = 0; ipaddr = uip_ip4addr_conv(parp->ah_dipaddr); @@ -327,7 +328,7 @@ void uip_arp_out(struct uip_driver_s *dev) in_addr_t destipaddr; /* Find the destination IP address in the ARP table and construct - * the Ethernet header. If the destination IP addres isn't on the + * the Ethernet header. If the destination IP address isn't on the * local network, we use the default router's IP address instead. * * If not ARP table entry is found, we overwrite the original IP @@ -340,6 +341,7 @@ void uip_arp_out(struct uip_driver_s *dev) { memcpy(peth->dest, g_broadcast_ethaddr.ether_addr_octet, ETHER_ADDR_LEN); } + #if defined(CONFIG_NET_IGMP) && !defined(CONFIG_NET_IPv6) /* Check if the destination address is a multicast address * @@ -353,7 +355,7 @@ void uip_arp_out(struct uip_driver_s *dev) else if (NTOHS(pip->eh_destipaddr[0]) >= 0xe000 && NTOHS(pip->eh_destipaddr[0]) <= 0xefff) { - /* Build the well-known IPv4 IGMP ethernet address. The first + /* Build the well-known IPv4 IGMP Ethernet address. The first * three bytes are fixed; the final three variable come from the * last three bytes of the IP address. */ @@ -374,7 +376,7 @@ void uip_arp_out(struct uip_driver_s *dev) #ifdef CONFIG_NET_ROUTE /* We have a routing table.. find the correct router to use in - * this case (or, as a fallback, use the device's default router + * this case (or, as a fall-back, use the device's default router * address). We will use the router IP address instead of the * destination address when determining the MAC address. */ @@ -426,12 +428,12 @@ void uip_arp_out(struct uip_driver_s *dev) return; } - /* Build an ethernet header. */ + /* Build an Ethernet header. */ memcpy(peth->dest, tabptr->at_ethaddr.ether_addr_octet, ETHER_ADDR_LEN); } - /* Finish populating the ethernet header */ + /* Finish populating the Ethernet header */ memcpy(peth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); peth->type = HTONS(UIP_ETHTYPE_IP); diff --git a/nuttx/net/uip/uip_arptab.c b/nuttx/net/uip/uip_arptab.c index 3dff97070..af68a3bd8 100644 --- a/nuttx/net/uip/uip_arptab.c +++ b/nuttx/net/uip/uip_arptab.c @@ -199,7 +199,8 @@ void uip_arp_update(uint16_t *pipaddr, uint8_t *ethaddr) if (i == CONFIG_NET_ARPTAB_SIZE) { uint8_t tmpage = 0; - int j = 0; + int j = 0; + for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i) { tabptr = &g_arptable[i]; @@ -209,6 +210,7 @@ void uip_arp_update(uint16_t *pipaddr, uint8_t *ethaddr) j = i; } } + i = j; tabptr = &g_arptable[i]; } @@ -229,7 +231,7 @@ void uip_arp_update(uint16_t *pipaddr, uint8_t *ethaddr) * Find the ARP entry corresponding to this IP address. * * Input parameters: - * ipaddr - Refers to an IP addressin network order + * ipaddr - Refers to an IP address in network order * * Assumptions * Interrupts are disabled; Returned value will become unstable when @@ -250,6 +252,7 @@ struct arp_entry *uip_arp_find(in_addr_t ipaddr) return tabptr; } } + return NULL; } diff --git a/nuttx/net/uip/uip_callback.c b/nuttx/net/uip/uip_callback.c index e945c5b1a..4ed830e95 100644 --- a/nuttx/net/uip/uip_callback.c +++ b/nuttx/net/uip/uip_callback.c @@ -69,7 +69,7 @@ static FAR struct uip_callback_s *g_cbfreelist = NULL; * Function: uip_callbackinit * * Description: - * Configure the pre-allocated callaback structures into a free list. + * Configure the pre-allocated callback structures into a free list. * This is called internally as part of uIP initialization and should not * be accessed from the application or socket layer. * @@ -153,7 +153,8 @@ FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list) * ****************************************************************************/ -void uip_callbackfree(FAR struct uip_callback_s *cb, FAR struct uip_callback_s **list) +void uip_callbackfree(FAR struct uip_callback_s *cb, + FAR struct uip_callback_s **list) { FAR struct uip_callback_s *prev; FAR struct uip_callback_s *curr; diff --git a/nuttx/net/uip/uip_chksum.c b/nuttx/net/uip/uip_chksum.c index 7a4eee790..edea6db65 100644 --- a/nuttx/net/uip/uip_chksum.c +++ b/nuttx/net/uip/uip_chksum.c @@ -84,6 +84,7 @@ static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len) { sum++; /* carry */ } + dataptr += 2; } @@ -114,7 +115,7 @@ static uint16_t upper_layer_chksum(struct uip_driver_s *dev, uint8_t proto) upper_layer_len = (((uint16_t)(pbuf->len[0]) << 8) + pbuf->len[1]) - UIP_IPH_LEN; #endif /* CONFIG_NET_IPv6 */ - /* First sum pseudoheader. */ + /* First sum pseudo-header. */ /* IP protocol and length fields. This addition cannot carry. */ @@ -226,5 +227,4 @@ uint16_t uip_icmpchksum(struct uip_driver_s *dev, int len) #endif #endif /* UIP_ARCH_CHKSUM */ - #endif /* CONFIG_NET */ diff --git a/nuttx/net/uip/uip_icmpinput.c b/nuttx/net/uip/uip_icmpinput.c index cea2ae4fc..d6b79e176 100644 --- a/nuttx/net/uip/uip_icmpinput.c +++ b/nuttx/net/uip/uip_icmpinput.c @@ -221,7 +221,7 @@ typeerr: } /* We should now send a neighbor advertisement back to where the - * neighbor solicication came from. + * neighbor solicitation came from. */ picmp->type = ICMP6_NEIGHBOR_ADVERTISEMENT; diff --git a/nuttx/net/uip/uip_icmpping.c b/nuttx/net/uip/uip_icmpping.c index 8aa1f3e84..c3afd1225 100644 --- a/nuttx/net/uip/uip_icmpping.c +++ b/nuttx/net/uip/uip_icmpping.c @@ -192,7 +192,7 @@ static uint16_t ping_interrupt(struct uip_driver_s *dev, void *conn, * If the output buffer currently contains unprocessed incoming * data. * -OR- - * If we have alread sent the ECHO request + * If we have already sent the ECHO request * * In the first two cases, we will just have to wait for the next * polling cycle. @@ -350,7 +350,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno, state.png_cb->event = ping_interrupt; state.png_result = -EINTR; /* Assume sem-wait interrupted by signal */ - /* Notify the device driver of the availaibilty of TX data */ + /* Notify the device driver of the availability of TX data */ netdev_txnotify(state.png_addr); diff --git a/nuttx/net/uip/uip_icmppoll.c b/nuttx/net/uip/uip_icmppoll.c index bcf7fe94b..d0ce72a6e 100644 --- a/nuttx/net/uip/uip_icmppoll.c +++ b/nuttx/net/uip/uip_icmppoll.c @@ -49,7 +49,7 @@ #include "uip_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** diff --git a/nuttx/net/uip/uip_icmpsend.c b/nuttx/net/uip/uip_icmpsend.c index 00c5bb9de..6865e9a59 100644 --- a/nuttx/net/uip/uip_icmpsend.c +++ b/nuttx/net/uip/uip_icmpsend.c @@ -49,7 +49,7 @@ #include "uip_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ #define ICMPBUF ((struct uip_icmpip_hdr *)&dev->d_buf[UIP_LLH_LEN]) @@ -94,7 +94,7 @@ void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr) if (dev->d_sndlen > 0) { /* The total length to send is the size of the application data plus - * the IP and ICMP headers (and, eventually, the ethernet header) + * the IP and ICMP headers (and, eventually, the Ethernet header) */ dev->d_len = dev->d_sndlen + UIP_IPICMPH_LEN; diff --git a/nuttx/net/uip/uip_igmpgroup.c b/nuttx/net/uip/uip_igmpgroup.c index 29ba3bfe9..9953f5026 100644 --- a/nuttx/net/uip/uip_igmpgroup.c +++ b/nuttx/net/uip/uip_igmpgroup.c @@ -163,7 +163,9 @@ static inline FAR struct igmp_group_s *uip_grpheapalloc(void) #if CONFIG_PREALLOC_IGMPGROUPS > 0 static inline FAR struct igmp_group_s *uip_grpprealloc(void) { - FAR struct igmp_group_s *group = (FAR struct igmp_group_s *)sq_remfirst(&g_freelist); + FAR struct igmp_group_s *group = + (FAR struct igmp_group_s *)sq_remfirst(&g_freelist); + if (group) { memset(group, 0, sizeof(struct igmp_group_s)); @@ -361,7 +363,7 @@ void uip_grpfree(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group) sq_rem((FAR sq_entry_t*)group, &dev->grplist); - /* Destroy the wait semapore */ + /* Destroy the wait semaphore */ (void)sem_destroy(&group->sem); diff --git a/nuttx/net/uip/uip_igmpinput.c b/nuttx/net/uip/uip_igmpinput.c index 40c1cf3ba..919bebb09 100644 --- a/nuttx/net/uip/uip_igmpinput.c +++ b/nuttx/net/uip/uip_igmpinput.c @@ -59,7 +59,7 @@ * Pre-processor Definitions ****************************************************************************/ -#define IGMPBUF ((struct uip_igmphdr_s *)&dev->d_buf[UIP_LLH_LEN]) +#define IGMPBUF ((struct uip_igmphdr_s *)&dev->d_buf[UIP_LLH_LEN]) /**************************************************************************** * Private Functions @@ -156,8 +156,8 @@ void uip_igmpinput(struct uip_driver_s *dev) /* RFC 2236, 2.2. ax Response Time * "The Max Response Time field is meaningful only in Membership Query * messages, and specifies the maximum allowed time before sending a - * responding report in units of 1/10 second. In all other messages, it - * is set to zero by the sender and ignored by receivers. + * responding report in units of 1/10 second. In all other messages, + * it is set to zero by the sender and ignored by receivers. */ /* Check if the query was sent to all systems */ @@ -239,7 +239,7 @@ void uip_igmpinput(struct uip_driver_s *dev) else if (group->grpaddr != 0) { - nllvdbg("Unitcast queury\n"); + nllvdbg("Unicast query\n"); IGMP_STATINCR(uip_stat.igmp.ucast_query); nlldbg("Query to a specific group with the group address as destination\n"); diff --git a/nuttx/net/uip/uip_igmppoll.c b/nuttx/net/uip/uip_igmppoll.c index e86eb687b..9201cd6e6 100644 --- a/nuttx/net/uip/uip_igmppoll.c +++ b/nuttx/net/uip/uip_igmppoll.c @@ -81,7 +81,7 @@ static inline void uip_schedsend(FAR struct uip_driver_s *dev, FAR struct igmp_g { uip_ipaddr_t *dest; - /* Check what kind of messsage we need to send. There are only two + /* Check what kind of message we need to send. There are only two * possibilities: */ @@ -156,7 +156,9 @@ void uip_igmppoll(FAR struct uip_driver_s *dev) /* Check each member of the group */ - for (group = (FAR struct igmp_group_s *)dev->grplist.head; group; group = group->next) + for (group = (FAR struct igmp_group_s *)dev->grplist.head; + group; + group = group->next) { /* Does this member have a pending outgoing message? */ diff --git a/nuttx/net/uip/uip_igmpsend.c b/nuttx/net/uip/uip_igmpsend.c index f22282b62..e36dc499b 100644 --- a/nuttx/net/uip/uip_igmpsend.c +++ b/nuttx/net/uip/uip_igmpsend.c @@ -105,9 +105,9 @@ static uint16_t uip_igmpchksum(FAR uint8_t *buffer, int buflen) * the IP header and calculates the IP header checksum. * * Parameters: - * dev - The device driver structure to use in the send operation. - * group - Describes the multicast group member and identifies the message - * to be sent. + * dev - The device driver structure to use in the send operation. + * group - Describes the multicast group member and identifies the + * message to be sent. * destipaddr - The IP address of the recipient of the message * * Return: @@ -124,7 +124,7 @@ void uip_igmpsend(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group, nllvdbg("msgid: %02x destipaddr: %08x\n", group->msgid, (int)*destipaddr); /* The total length to send is the size of the IP and IGMP headers and 4 - * bytes for the ROUTER ALERT (and, eventually, the ethernet header) + * bytes for the ROUTER ALERT (and, eventually, the Ethernet header) */ dev->d_len = UIP_IPIGMPH_LEN; diff --git a/nuttx/net/uip/uip_igmptimer.c b/nuttx/net/uip/uip_igmptimer.c index 4655f3a2f..2aee84c8e 100644 --- a/nuttx/net/uip/uip_igmptimer.c +++ b/nuttx/net/uip/uip_igmptimer.c @@ -123,7 +123,7 @@ static void uip_igmptimeout(int argc, uint32_t arg, ...) /* If the group exists and is no an IDLE MEMBER, then it must be a DELAYING * member. Race conditions are avoided because (1) the timer is not started * until after the first IGMPv2_MEMBERSHIP_REPORT during the join, and (2) - * the timer is canceled before sending the IGMP_LEAVE_GROUP during a leave. + * the timer is cancelled before sending the IGMP_LEAVE_GROUP during a leave. */ if (!IS_IDLEMEMBER(group->flags)) @@ -141,7 +141,7 @@ static void uip_igmptimeout(int argc, uint32_t arg, ...) * is stranded if both reports were lost? This is consistent with the * RFC that states: "To cover the possibility of the initial Membership * Report being lost or damaged, it is recommended that it be repeated - * once or twice after shortdelays [Unsolicited Report Interval]..." + * once or twice after short delays [Unsolicited Report Interval]..." */ } } @@ -190,8 +190,11 @@ void uip_igmpstartticks(FAR struct igmp_group_s *group, int ticks) /* Start the timer */ gtmrlldbg("ticks: %d\n", ticks); + ret = wd_start(group->wdog, ticks, uip_igmptimeout, 1, (uint32_t)group); + DEBUGASSERT(ret == OK); + UNUSED(ret); } void uip_igmpstarttimer(FAR struct igmp_group_s *group, uint8_t decisecs) @@ -213,7 +216,7 @@ void uip_igmpstarttimer(FAR struct igmp_group_s *group, uint8_t decisecs) * avoid race conditions) and return true. * * Assumptions: - * This function may be called from most any context. If true is retuend + * This function may be called from most any context. If true is returned * then the caller must call uip_igmpstartticks() to restart the timer * ****************************************************************************/ diff --git a/nuttx/net/uip/uip_input.c b/nuttx/net/uip/uip_input.c index 9411e3cc4..fa0496ad9 100644 --- a/nuttx/net/uip/uip_input.c +++ b/nuttx/net/uip/uip_input.c @@ -65,7 +65,7 @@ * a byte stream if needed. The application will not be fed with data * that is out of sequence. * - * If the application whishes to send data to the peer, it should put + * If the application wishes to send data to the peer, it should put * its data into the d_buf. The d_appdata pointer points to the * first available byte. The TCP/IP stack will calculate the * checksums, and fill in the necessary header fields and finally send @@ -166,7 +166,7 @@ static uint8_t uip_reass(void) } /* Check if the incoming fragment matches the one currently present - * in the reasembly buffer. If so, we proceed with copying the + * in the reassembly buffer. If so, we proceed with copying the * fragment into the buffer. */ @@ -297,7 +297,6 @@ nullreturn: * yet. Currently useful for UDP when a packet arrives before a recv * call is in place. * - * * Assumptions: * ****************************************************************************/ @@ -329,6 +328,7 @@ int uip_input(struct uip_driver_s *dev) nlldbg("Invalid IPv6 version: %d\n", pbuf->vtc >> 4); goto drop; } + #else /* CONFIG_NET_IPv6 */ /* Check validity of the IP header. */ diff --git a/nuttx/net/uip/uip_internal.h b/nuttx/net/uip/uip_internal.h index 6170dee31..4905c94a3 100644 --- a/nuttx/net/uip/uip_internal.h +++ b/nuttx/net/uip/uip_internal.h @@ -53,7 +53,7 @@ #include <nuttx/net/uip/uip.h> /**************************************************************************** - * Public Macro Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** diff --git a/nuttx/net/uip/uip_listen.c b/nuttx/net/uip/uip_listen.c index 420fbb070..c86bfea50 100644 --- a/nuttx/net/uip/uip_listen.c +++ b/nuttx/net/uip/uip_listen.c @@ -112,7 +112,7 @@ struct uip_conn *uip_findlistener(uint16_t portno) * Setup the listening data structures * * Assumptions: - * Called early in the inialization phase while the system is still + * Called early in the initialization phase while the system is still * single-threaded. * ****************************************************************************/ @@ -282,7 +282,8 @@ int uip_accept(struct uip_driver_s *dev, struct uip_conn *conn, } #endif } - return ret; + + return ret; } #endif /* CONFIG_NET */ diff --git a/nuttx/net/uip/uip_neighbor.c b/nuttx/net/uip/uip_neighbor.c index 82fb9a845..ecc45a09e 100644 --- a/nuttx/net/uip/uip_neighbor.c +++ b/nuttx/net/uip/uip_neighbor.c @@ -10,6 +10,7 @@ * 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 @@ -91,6 +92,7 @@ void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr) oldest_time = 0; oldest = 0; + for (i = 0; i < ENTRIES; ++i) { if (entries[i].time == MAX_TIME) @@ -130,6 +132,7 @@ static struct neighbor_entry *find_entry(uip_ipaddr_t ipaddr) return &entries[i]; } } + return NULL; } @@ -156,7 +159,8 @@ struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr) e->addr.addr.ether_addr_octet[2], e->addr.addr.ether_addr_octet[3], e->addr.addr.ether_addr_octet[4], e->addr.addr.ether_addr_octet[5]); - return &e->addr; - } + return &e->addr; + } + return NULL; } diff --git a/nuttx/net/uip/uip_poll.c b/nuttx/net/uip/uip_poll.c index 663f021e5..17deca30a 100644 --- a/nuttx/net/uip/uip_poll.c +++ b/nuttx/net/uip/uip_poll.c @@ -69,7 +69,8 @@ ****************************************************************************/ #if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) -static inline int uip_pollicmp(struct uip_driver_s *dev, uip_poll_callback_t callback) +static inline int uip_pollicmp(FAR struct uip_driver_s *dev, + uip_poll_callback_t callback) { /* Perform the UDP TX poll */ @@ -94,7 +95,8 @@ static inline int uip_pollicmp(struct uip_driver_s *dev, uip_poll_callback_t cal ****************************************************************************/ #ifdef CONFIG_NET_IGMP -static inline int uip_polligmp(struct uip_driver_s *dev, uip_poll_callback_t callback) +static inline int uip_polligmp(FAR struct uip_driver_s *dev, + uip_poll_callback_t callback) { /* Perform the UDP TX poll */ @@ -113,17 +115,17 @@ static inline int uip_polligmp(struct uip_driver_s *dev, uip_poll_callback_t cal * Poll all UDP connections for available packets to send. * * Assumptions: - * This function is called from the MAC device driver and may be called from - * the timer interrupt/watchdog handle level. + * This function is called from the MAC device driver and may be called + * from the timer interrupt/watchdog handle level. * ****************************************************************************/ #ifdef CONFIG_NET_UDP -static int uip_polludpconnections(struct uip_driver_s *dev, +static int uip_polludpconnections(FAR struct uip_driver_s *dev, uip_poll_callback_t callback) { - struct uip_udp_conn *udp_conn = NULL; - int bstop = 0; + FAR struct uip_udp_conn *udp_conn = NULL; + int bstop = 0; /* Traverse all of the allocated UDP connections and perform the poll action */ @@ -149,17 +151,17 @@ static int uip_polludpconnections(struct uip_driver_s *dev, * Poll all UDP connections for available packets to send. * * Assumptions: - * This function is called from the MAC device driver and may be called from - * the timer interrupt/watchdog handle level. + * This function is called from the MAC device driver and may be called + * from the timer interrupt/watchdog handle level. * ****************************************************************************/ #ifdef CONFIG_NET_TCP -static inline int uip_polltcpconnections(struct uip_driver_s *dev, +static inline int uip_polltcpconnections(FAR struct uip_driver_s *dev, uip_poll_callback_t callback) { - struct uip_conn *conn = NULL; - int bstop = 0; + FAR struct uip_conn *conn = NULL; + int bstop = 0; /* Traverse all of the active TCP connections and perform the poll action */ @@ -194,11 +196,11 @@ static inline int uip_polltcpconnections(struct uip_driver_s *dev, ****************************************************************************/ #ifdef CONFIG_NET_TCP -static inline int uip_polltcptimer(struct uip_driver_s *dev, +static inline int uip_polltcptimer(FAR struct uip_driver_s *dev, uip_poll_callback_t callback, int hsec) { - struct uip_conn *conn = NULL; - int bstop = 0; + FAR struct uip_conn *conn = NULL; + int bstop = 0; /* Traverse all of the active TCP connections and perform the poll action */ @@ -229,11 +231,12 @@ static inline int uip_polltcptimer(struct uip_driver_s *dev, * Description: * This function will traverse each active uIP connection structure and * will perform TCP and UDP polling operations. uip_poll() may be called - * asychronously with the network drvier can accept another outgoing packet. + * asynchronously with the network driver can accept another outgoing + * packet. * * This function will call the provided callback function for every active * connection. Polling will continue until all connections have been polled - * or until the user-suplied function returns a non-zero value (which it + * or until the user-supplied function returns a non-zero value (which it * should do only if it cannot accept further write data). * * When the callback function is called, there may be an outbound packet @@ -242,16 +245,16 @@ static inline int uip_polltcptimer(struct uip_driver_s *dev, * out the packet. * * Assumptions: - * This function is called from the MAC device driver and may be called from - * the timer interrupt/watchdog handle level. + * This function is called from the MAC device driver and may be called + * from the timer interrupt/watchdog handle level. * ****************************************************************************/ -int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback) +int uip_poll(FAR struct uip_driver_s *dev, uip_poll_callback_t callback) { int bstop; - /* Check for pendig IGMP messages */ + /* Check for pending IGMP messages */ #ifdef CONFIG_NET_IGMP bstop = uip_polligmp(dev, callback); @@ -264,14 +267,18 @@ int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback) if (!bstop) { #ifdef CONFIG_NET_UDP - /* Traverse all of the allocated UDP connections and perform the poll action */ + /* Traverse all of the allocated UDP connections and perform the + * poll action. + */ bstop = uip_polludpconnections(dev, callback); if (!bstop) #endif { #if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) - /* Traverse all of the tasks waiting to send an ICMP ECHO request */ + /* Traverse all of the tasks waiting to send an ICMP ECHO + * request + */ bstop = uip_pollicmp(dev, callback); #endif @@ -292,7 +299,7 @@ int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback) * * This function will call the provided callback function for every active * connection. Polling will continue until all connections have been polled - * or until the user-suplied function returns a non-zero value (which it + * or until the user-supplied function returns a non-zero value (which it * should do only if it cannot accept further write data). * * When the callback function is called, there may be an outbound packet @@ -306,7 +313,8 @@ int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback) * ****************************************************************************/ -int uip_timer(struct uip_driver_s *dev, uip_poll_callback_t callback, int hsec) +int uip_timer(FAR struct uip_driver_s *dev, uip_poll_callback_t callback, + int hsec) { int bstop; diff --git a/nuttx/net/uip/uip_send.c b/nuttx/net/uip/uip_send.c index b26c799a0..cd5712b40 100644 --- a/nuttx/net/uip/uip_send.c +++ b/nuttx/net/uip/uip_send.c @@ -48,7 +48,7 @@ #include <nuttx/net/uip/uip-arch.h> /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -87,7 +87,7 @@ * the network interface driver. * * Assumptions: - * Called from the interrupt level or, at a mimimum, with interrupts + * Called from the interrupt level or, at a minimum, with interrupts * disabled. * ****************************************************************************/ diff --git a/nuttx/net/uip/uip_setipid.c b/nuttx/net/uip/uip_setipid.c index 12a94860b..9aaea482a 100644 --- a/nuttx/net/uip/uip_setipid.c +++ b/nuttx/net/uip/uip_setipid.c @@ -4,7 +4,6 @@ * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: diff --git a/nuttx/net/uip/uip_tcpappsend.c b/nuttx/net/uip/uip_tcpappsend.c index 79f384c25..8607d93cb 100644 --- a/nuttx/net/uip/uip_tcpappsend.c +++ b/nuttx/net/uip/uip_tcpappsend.c @@ -55,7 +55,7 @@ #include "uip_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** diff --git a/nuttx/net/uip/uip_tcpbacklog.c b/nuttx/net/uip/uip_tcpbacklog.c index 78b62d9e8..20f9151dd 100644 --- a/nuttx/net/uip/uip_tcpbacklog.c +++ b/nuttx/net/uip/uip_tcpbacklog.c @@ -107,7 +107,7 @@ int uip_backlogcreate(FAR struct uip_conn *conn, int nblg) /* Then determine the full size of the allocation include the * uip_backlog_s, a pre-allocated array of struct uip_blcontainer_s - * and alignement padding + * and alignment padding */ size = offset + nblg * sizeof(struct uip_blcontainer_s); @@ -399,6 +399,7 @@ int uip_backlogdelete(FAR struct uip_conn *conn, FAR struct uip_conn *blconn) nlldbg("Failed to find pending connection\n"); return -EINVAL; } + return OK; } diff --git a/nuttx/net/uip/uip_tcpcallback.c b/nuttx/net/uip/uip_tcpcallback.c index e9d09e93b..8cd82fb42 100644 --- a/nuttx/net/uip/uip_tcpcallback.c +++ b/nuttx/net/uip/uip_tcpcallback.c @@ -63,7 +63,7 @@ * Function: uip_readahead * * Description: - * Copy as much received data as possible into the readahead buffer + * Copy as much received data as possible into the read-ahead buffer * * Assumptions: * This function is called at the interrupt level with interrupts disabled. @@ -71,8 +71,8 @@ ****************************************************************************/ #ifdef CONFIG_NET_TCP_READAHEAD -static int uip_readahead(struct uip_readahead_s *readahead, uint8_t *buf, - int len) +static int uip_readahead(FAR struct uip_readahead_s *readahead, + FAR uint8_t *buf, int len) { int available = CONFIG_NET_TCP_READAHEAD_BUFSIZE - readahead->rh_nbytes; int recvlen = 0; @@ -95,6 +95,7 @@ static int uip_readahead(struct uip_readahead_s *readahead, uint8_t *buf, memcpy(&readahead->rh_buffer[readahead->rh_nbytes], buf, recvlen); readahead->rh_nbytes += recvlen; } + return recvlen; } #endif @@ -216,7 +217,7 @@ uint16_t uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, * attempted. * UIP_SNDACK - If UIP_NEWDATA is cleared, then UIP_SNDACK may be set * to indicate that an ACK should be included in the response. - * (In UIP_NEWDATA is cleared bu UIP_SNDACK is not set, then + * (In UIP_NEWDATA is cleared but UIP_SNDACK is not set, then * dev->d_len should also be cleared). */ @@ -259,7 +260,7 @@ uint16_t uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, * (2) from the TCP event logic is there is no listener in place ready to * receive the data. * - * Input Parmeters: + * Input Parameters: * conn - A pointer to the TCP connection structure * buffer - A pointer to the buffer to be copied to the read-ahead * buffers @@ -287,11 +288,11 @@ uint16_t uip_datahandler(FAR struct uip_conn *conn, FAR uint8_t *buffer, /* First, we need to determine if we have space to buffer the data. This * needs to be verified before we actually begin buffering the data. We - * will use any remaining space in the last allocated readahead buffer + * will use any remaining space in the last allocated read-ahead buffer * plus as much one additional buffer. It is expected that the size of - * readahead buffers are tuned so that one full packet will always fit - * into one readahead buffer (for example if the buffer size is 420, then - * a readahead buffer of 366 will hold a full packet of TCP data). + * read-ahead buffers are tuned so that one full packet will always fit + * into one read-ahead buffer (for example if the buffer size is 420, then + * a read-ahead buffer of 366 will hold a full packet of TCP data). */ readahead1 = (FAR struct uip_readahead_s*)conn->readahead.tail; @@ -300,7 +301,7 @@ uint16_t uip_datahandler(FAR struct uip_conn *conn, FAR uint8_t *buffer, (readahead2 = uip_tcpreadahead_alloc()) != NULL) { /* We have buffer space. Now try to append add as much data as possible - * to the last readahead buffer attached to this connection. + * to the last read-ahead buffer attached to this connection. */ remaining = buflen; @@ -321,7 +322,7 @@ uint16_t uip_datahandler(FAR struct uip_conn *conn, FAR uint8_t *buffer, readahead2->rh_nbytes = 0; recvlen += uip_readahead(readahead2, buffer, remaining); - /* Save the readahead buffer in the connection structure where + /* Save the read-ahead buffer in the connection structure where * it can be found with recv() is called. */ diff --git a/nuttx/net/uip/uip_tcpconn.c b/nuttx/net/uip/uip_tcpconn.c index f62c30fea..2a2ce2a54 100644 --- a/nuttx/net/uip/uip_tcpconn.c +++ b/nuttx/net/uip/uip_tcpconn.c @@ -89,8 +89,8 @@ static uint16_t g_last_tcp_port; * Name: uip_selectport() * * Description: - * If the portnumber is zero; select an unused port for the connection. - * If the portnumber is non-zero, verify that no other connection has + * If the port number is zero; select an unused port for the connection. + * If the port number is non-zero, verify that no other connection has * been created with this port number. * * Input Parameters: @@ -164,7 +164,7 @@ static int uip_selectport(uint16_t portno) * * Description: * Initialize the TCP/IP connection structures. Called only once and only - * from the UIP layer at startup in normal user mode. + * from the UIP layer at start-up in normal user mode. * ****************************************************************************/ @@ -221,7 +221,7 @@ struct uip_conn *uip_tcpalloc(void) if (!conn) { - /* As a fallback, check for connection structures which can be stalled. + /* As a fall-back, check for connection structures which can be stalled. * * Search the active connection list for the oldest connection * that is in the UIP_TIME_WAIT or UIP_FIN_WAIT_1 state. @@ -462,7 +462,7 @@ struct uip_conn *uip_nexttcpconn(struct uip_conn *conn) * connection that listens on this this port. * * Primary uses: (1) to determine if a port number is available, (2) to - * To idenfity the socket that will accept new connections on a local port. + * To identify the socket that will accept new connections on a local port. * ****************************************************************************/ @@ -478,7 +478,7 @@ struct uip_conn *uip_tcplistener(uint16_t portno) conn = &g_tcp_connections[i]; if (conn->tcpstateflags != UIP_CLOSED && conn->lport == portno) { - /* The portnumber is in use, return the connection */ + /* The port number is in use, return the connection */ return conn; } @@ -614,7 +614,7 @@ int uip_tcpbind(struct uip_conn *conn, const struct sockaddr_in *addr) * TCP connect() operation: It connects to a remote host using TCP. * * This function is used to start a new connection to the specified - * port on the specied host. It uses the connection structure that was + * port on the specified host. It uses the connection structure that was * allocated by a preceding socket() call. It sets the connection to * the SYN_SENT state and sets the retransmission timer to 0. This will * cause a TCP SYN segment to be sent out the next time this connection @@ -645,7 +645,7 @@ int uip_tcpconnect(struct uip_conn *conn, const struct sockaddr_in *addr) return -EISCONN; } - /* If the TCP port has not alread been bound to a local port, then select + /* If the TCP port has not already been bound to a local port, then select * one now. */ diff --git a/nuttx/net/uip/uip_tcpinput.c b/nuttx/net/uip/uip_tcpinput.c index 8c7c1837c..9f18a0db7 100644 --- a/nuttx/net/uip/uip_tcpinput.c +++ b/nuttx/net/uip/uip_tcpinput.c @@ -354,7 +354,7 @@ found: uint32_t ackseq; /* The next sequence number is equal to the current sequence - * number (sndseq) plus the size of the oustanding, unacknowledged + * number (sndseq) plus the size of the outstanding, unacknowledged * data (unacked). */ @@ -379,7 +379,7 @@ found: if (ackseq <= unackseq) { - /* Calculate the new number of oustanding, unacknowledged bytes */ + /* Calculate the new number of outstanding, unacknowledged bytes */ conn->unacked = unackseq - ackseq; } @@ -487,6 +487,7 @@ found: uip_tcpack(dev, conn, TCP_ACK | TCP_SYN); return; } + goto drop; case UIP_SYN_SENT: @@ -584,6 +585,7 @@ found: { goto drop; } + uip_tcpreset(dev); return; @@ -668,7 +670,7 @@ found: /* If d_len > 0 we have TCP data in the packet, and we flag this * by setting the UIP_NEWDATA flag. If the application has stopped - * the dataflow using uip_stop(), we must not accept any data + * the data flow using uip_stop(), we must not accept any data * packets from the remote host. */ @@ -727,6 +729,7 @@ found: uip_tcpappsend(dev, conn, result); return; } + goto drop; case UIP_LAST_ACK: diff --git a/nuttx/net/uip/uip_tcppoll.c b/nuttx/net/uip/uip_tcppoll.c index ddc8ab029..3b1bf45b8 100644 --- a/nuttx/net/uip/uip_tcppoll.c +++ b/nuttx/net/uip/uip_tcppoll.c @@ -108,7 +108,7 @@ void uip_tcppoll(struct uip_driver_s *dev, struct uip_conn *conn) dev->d_len = 0; dev->d_sndlen = 0; - /* Perfom the callback */ + /* Perform the callback */ result = uip_tcpcallback(dev, conn, UIP_POLL); diff --git a/nuttx/net/uip/uip_tcpreadahead.c b/nuttx/net/uip/uip_tcpreadahead.c index 7ac0ec00e..7ee9073ae 100644 --- a/nuttx/net/uip/uip_tcpreadahead.c +++ b/nuttx/net/uip/uip_tcpreadahead.c @@ -108,7 +108,7 @@ void uip_tcpreadahead_init(void) * Description: * Allocate a TCP read-ahead buffer by taking a pre-allocated buffer from * the free list. This function is called from TCP logic when new, - * incoming TCP data is received but there is no user logic recving the + * incoming TCP data is received but there is no user logic receiving the * the data. Note: kmalloc() cannot be used because this function is * called from interrupt level. * diff --git a/nuttx/net/uip/uip_tcpsend.c b/nuttx/net/uip/uip_tcpsend.c index 7051d7621..7d8e7a9c4 100644 --- a/nuttx/net/uip/uip_tcpsend.c +++ b/nuttx/net/uip/uip_tcpsend.c @@ -80,7 +80,7 @@ * up IP header and computes the TCP checksum * * Parameters: - * dev - The device driver structure to use in the send operation + * dev - The device driver structure to use in the send operation * * Return: * None @@ -90,9 +90,9 @@ * ****************************************************************************/ -static void uip_tcpsendcomplete(struct uip_driver_s *dev) +static void uip_tcpsendcomplete(FAR struct uip_driver_s *dev) { - struct uip_tcpip_hdr *pbuf = BUF; + FAR struct uip_tcpip_hdr *pbuf = BUF; pbuf->ttl = UIP_TTL; @@ -160,8 +160,8 @@ static void uip_tcpsendcomplete(struct uip_driver_s *dev) * calculating the checksum and finally send the packet. * * Parameters: - * dev - The device driver structure to use in the send operation - * conn - The TCP connection structure holding connection information + * dev - The device driver structure to use in the send operation + * conn - The TCP connection structure holding connection information * * Return: * None @@ -171,9 +171,10 @@ static void uip_tcpsendcomplete(struct uip_driver_s *dev) * ****************************************************************************/ -static void uip_tcpsendcommon(struct uip_driver_s *dev, struct uip_conn *conn) +static void uip_tcpsendcommon(FAR struct uip_driver_s *dev, + FAR struct uip_conn *conn) { - struct uip_tcpip_hdr *pbuf = BUF; + FAR struct uip_tcpip_hdr *pbuf = BUF; memcpy(pbuf->ackno, conn->rcvseq, 4); memcpy(pbuf->seqno, conn->sndseq, 4); @@ -205,7 +206,6 @@ static void uip_tcpsendcommon(struct uip_driver_s *dev, struct uip_conn *conn) */ uip_tcpsendcomplete(dev); - } /**************************************************************************** @@ -232,10 +232,10 @@ static void uip_tcpsendcommon(struct uip_driver_s *dev, struct uip_conn *conn) * ****************************************************************************/ -void uip_tcpsend(struct uip_driver_s *dev, struct uip_conn *conn, +void uip_tcpsend(FAR struct uip_driver_s *dev, FAR struct uip_conn *conn, uint16_t flags, uint16_t len) { - struct uip_tcpip_hdr *pbuf = BUF; + FAR struct uip_tcpip_hdr *pbuf = BUF; pbuf->flags = flags; dev->d_len = len; @@ -260,12 +260,11 @@ void uip_tcpsend(struct uip_driver_s *dev, struct uip_conn *conn, * ****************************************************************************/ -void uip_tcpreset(struct uip_driver_s *dev) +void uip_tcpreset(FAR struct uip_driver_s *dev) { - struct uip_tcpip_hdr *pbuf = BUF; - + FAR struct uip_tcpip_hdr *pbuf = BUF; uint16_t tmp16; - uint8_t seqbyte; + uint8_t seqbyte; #ifdef CONFIG_NET_STATISTICS uip_stat.tcp.rst++; @@ -332,9 +331,9 @@ void uip_tcpreset(struct uip_driver_s *dev) * Send the SYN or SYNACK response. * * Parameters: - * dev - The device driver structure to use in the send operation - * conn - The TCP connection structure holding connection information - * ack - The ACK response to send + * dev - The device driver structure to use in the send operation + * conn - The TCP connection structure holding connection information + * ack - The ACK response to send * * Return: * None @@ -344,7 +343,8 @@ void uip_tcpreset(struct uip_driver_s *dev) * ****************************************************************************/ -void uip_tcpack(struct uip_driver_s *dev, struct uip_conn *conn, uint8_t ack) +void uip_tcpack(FAR struct uip_driver_s *dev, FAR struct uip_conn *conn, + uint8_t ack) { struct uip_tcpip_hdr *pbuf = BUF; diff --git a/nuttx/net/uip/uip_tcptimer.c b/nuttx/net/uip/uip_tcptimer.c index fdd3a38a9..a2b3cdbe3 100644 --- a/nuttx/net/uip/uip_tcptimer.c +++ b/nuttx/net/uip/uip_tcptimer.c @@ -81,9 +81,9 @@ * Handle a TCP timer expiration for the provided TCP connection * * Parameters: - * dev - The device driver structure to use in the send operation - * conn - The TCP "connection" to poll for TX data - * hsed - The polling interval in halves of a second + * dev - The device driver structure to use in the send operation + * conn - The TCP "connection" to poll for TX data + * hsed - The polling interval in halves of a second * * Return: * None @@ -93,7 +93,8 @@ * ****************************************************************************/ -void uip_tcptimer(struct uip_driver_s *dev, struct uip_conn *conn, int hsec) +void uip_tcptimer(FAR struct uip_driver_s *dev, FAR struct uip_conn *conn, + int hsec) { uint8_t result; diff --git a/nuttx/net/uip/uip_tcpwrbuffer.c b/nuttx/net/uip/uip_tcpwrbuffer.c index c729dd4b8..d08b682b0 100644 --- a/nuttx/net/uip/uip_tcpwrbuffer.c +++ b/nuttx/net/uip/uip_tcpwrbuffer.c @@ -122,7 +122,8 @@ void uip_tcpwrbuffer_init(void) * ****************************************************************************/ -FAR struct uip_wrbuffer_s *uip_tcpwrbuffer_alloc(FAR const struct timespec *abstime) +FAR struct uip_wrbuffer_s * +uip_tcpwrbuffer_alloc(FAR const struct timespec *abstime) { int ret; @@ -148,8 +149,8 @@ FAR struct uip_wrbuffer_s *uip_tcpwrbuffer_alloc(FAR const struct timespec *abst * * Description: * Release a TCP write buffer by returning the buffer to the free list. - * This function is called from user logic after it is consumed the buffered - * data. + * This function is called from user logic after it is consumed the + * buffered data. * * Assumptions: * Called from interrupt level with interrupts disabled. diff --git a/nuttx/net/uip/uip_udpconn.c b/nuttx/net/uip/uip_udpconn.c index a9f5c71cd..ee41e045f 100644 --- a/nuttx/net/uip/uip_udpconn.c +++ b/nuttx/net/uip/uip_udpconn.c @@ -95,7 +95,7 @@ static uint16_t g_last_udp_port; * ****************************************************************************/ -static inline void _uip_semtake(sem_t *sem) +static inline void _uip_semtake(FAR sem_t *sem) { /* Take the semaphore (perhaps waiting) */ @@ -120,7 +120,7 @@ static inline void _uip_semtake(sem_t *sem) * ****************************************************************************/ -static struct uip_udp_conn *uip_find_conn(uint16_t portno) +static FAR struct uip_udp_conn *uip_find_conn(uint16_t portno) { int i; @@ -143,7 +143,7 @@ static struct uip_udp_conn *uip_find_conn(uint16_t portno) * Description: * Select an unused port number. * - * NOTE that in prinicple this function could fail if there is no available + * NOTE that in principle this function could fail if there is no available * port number. There is no check for that case and it would actually * in an infinite loop if that were the case. In this simple, small UDP * implementation, it is reasonable to assume that that error cannot happen @@ -231,7 +231,7 @@ void uip_udpinit(void) * Name: uip_udpalloc() * * Description: - * Alloc a new, uninitialized UDP connection structure. + * Allocate a new, uninitialized UDP connection structure. * ****************************************************************************/ @@ -255,6 +255,7 @@ struct uip_udp_conn *uip_udpalloc(void) dq_addlast(&conn->node, &g_active_udp_connections); } + _uip_semgive(&g_free_sem); return conn; } @@ -295,16 +296,17 @@ void uip_udpfree(struct uip_udp_conn *conn) * * Description: * Find a connection structure that is the appropriate - * connection to be used withi the provided TCP/IP header + * connection to be used within the provided TCP/IP header * * Assumptions: * This function is called from UIP logic at interrupt level * ****************************************************************************/ -struct uip_udp_conn *uip_udpactive(struct uip_udpip_hdr *buf) +struct uip_udp_conn *uip_udpactive(FAR struct uip_udpip_hdr *buf) { - struct uip_udp_conn *conn = (struct uip_udp_conn *)g_active_udp_connections.head; + FAR struct uip_udp_conn *conn = + (FAR struct uip_udp_conn *)g_active_udp_connections.head; while (conn) { @@ -348,7 +350,7 @@ struct uip_udp_conn *uip_udpactive(struct uip_udpip_hdr *buf) * ****************************************************************************/ -struct uip_udp_conn *uip_nextudpconn(struct uip_udp_conn *conn) +FAR struct uip_udp_conn *uip_nextudpconn(FAR struct uip_udp_conn *conn) { if (!conn) { @@ -373,9 +375,11 @@ struct uip_udp_conn *uip_nextudpconn(struct uip_udp_conn *conn) ****************************************************************************/ #ifdef CONFIG_NET_IPv6 -int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in6 *addr) +int uip_udpbind(FAR struct uip_udp_conn *conn, + FAR const struct sockaddr_in6 *addr) #else -int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in *addr) +int uip_udpbind(FAR struct uip_udp_conn *conn, + FAR const struct sockaddr_in *addr) #endif { int ret = -EADDRINUSE; @@ -408,6 +412,7 @@ int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in *addr) uip_unlock(flags); } + return ret; } @@ -432,9 +437,11 @@ int uip_udpbind(struct uip_udp_conn *conn, const struct sockaddr_in *addr) ****************************************************************************/ #ifdef CONFIG_NET_IPv6 -int uip_udpconnect(struct uip_udp_conn *conn, const struct sockaddr_in6 *addr) +int uip_udpconnect(FAR struct uip_udp_conn *conn, + FAR const struct sockaddr_in6 *addr) #else -int uip_udpconnect(struct uip_udp_conn *conn, const struct sockaddr_in *addr) +int uip_udpconnect(FAR struct uip_udp_conn *conn, + FAR const struct sockaddr_in *addr) #endif { /* Has this address already been bound to a local port (lport)? */ @@ -461,7 +468,7 @@ int uip_udpconnect(struct uip_udp_conn *conn, const struct sockaddr_in *addr) uip_ipaddr_copy(conn->ripaddr, g_allzeroaddr); } - conn->ttl = UIP_TTL; + conn->ttl = UIP_TTL; return OK; } diff --git a/nuttx/net/uip/uip_udpinput.c b/nuttx/net/uip/uip_udpinput.c index 6411ca21d..f8093bbd7 100644 --- a/nuttx/net/uip/uip_udpinput.c +++ b/nuttx/net/uip/uip_udpinput.c @@ -87,14 +87,14 @@ * Return: * OK The packet has been processed and can be deleted * ERROR Hold the packet and try again later. There is a listening socket - * but no recv in place to catch the packet yet. + * but no receive in place to catch the packet yet. * * Assumptions: * Called from the interrupt level or with interrupts disabled. * ****************************************************************************/ -int uip_udpinput(struct uip_driver_s *dev) +int uip_udpinput(FAR struct uip_driver_s *dev) { struct uip_udp_conn *conn; struct uip_udpip_hdr *pbuf = UDPBUF; @@ -131,7 +131,7 @@ int uip_udpinput(struct uip_driver_s *dev) { uint16_t flags; - /* Setup for the application callback */ + /* Set-up for the application callback */ dev->d_appdata = &dev->d_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_snddata = &dev->d_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; diff --git a/nuttx/net/uip/uip_udppoll.c b/nuttx/net/uip/uip_udppoll.c index 5cb764351..727b6c29f 100644 --- a/nuttx/net/uip/uip_udppoll.c +++ b/nuttx/net/uip/uip_udppoll.c @@ -80,7 +80,7 @@ * Poll a UDP "connection" structure for availability of TX data * * Parameters: - * dev - The device driver structure to use in the send operation + * dev - The device driver structure to use in the send operation * conn - The UDP "connection" to poll for TX data * * Return: @@ -91,13 +91,13 @@ * ****************************************************************************/ -void uip_udppoll(struct uip_driver_s *dev, struct uip_udp_conn *conn) +void uip_udppoll(FAR struct uip_driver_s *dev, FAR struct uip_udp_conn *conn) { /* Verify that the UDP connection is valid */ if (conn->lport != 0) { - /* Setup for the application callback */ + /* Set-up for the application callback */ dev->d_appdata = &dev->d_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; dev->d_snddata = &dev->d_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; diff --git a/nuttx/net/uip/uip_udpsend.c b/nuttx/net/uip/uip_udpsend.c index 9ba8ec8f5..7cea86645 100644 --- a/nuttx/net/uip/uip_udpsend.c +++ b/nuttx/net/uip/uip_udpsend.c @@ -78,10 +78,10 @@ * Name: uip_udpsend * * Description: - * Setup to send a UDP packet + * Set-up to send a UDP packet * * Parameters: - * dev - The device driver structure to use in the send operation + * dev - The device driver structure to use in the send operation * conn - The UDP "connection" structure holding port information * * Return: @@ -98,8 +98,8 @@ void uip_udpsend(struct uip_driver_s *dev, struct uip_udp_conn *conn) if (dev->d_sndlen > 0) { - /* The total lenth to send is the size of the application data plus - * the IP and UDP headers (and, eventually, the ethernet header) + /* The total length to send is the size of the application data plus + * the IP and UDP headers (and, eventually, the Ethernet header) */ dev->d_len = dev->d_sndlen + UIP_IPUDPH_LEN; |