You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/04/02 10:40:07 UTC

[incubator-nuttx-apps] branch master updated (0640e07 -> 97b439f)

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.


    from 0640e07  CI: update matrix boards accordingly since testlist updated
     new d79de16  examples/udp: Appease nxstyle errors
     new d55401d  examples/udp: Avoid conflicts with host OS definitions
     new d5ec9f9  examples/udp: Avoid common symbols
     new 97b439f  examples/udp: Avoid using non-standard s6_addr16

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/udp/udp.h        | 14 ++++++++++----
 examples/udp/udp_server.c | 34 +++++++++++++++++++++++-----------
 2 files changed, 33 insertions(+), 15 deletions(-)


[incubator-nuttx-apps] 03/04: examples/udp: Avoid common symbols

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit d5ec9f91aed6cb9cb3cba70526dcaf56a9173042
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Apr 2 01:31:11 2020 +0900

    examples/udp: Avoid common symbols
---
 examples/udp/udp.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/udp/udp.h b/examples/udp/udp.h
index 5956ab9..82145a4 100644
--- a/examples/udp/udp.h
+++ b/examples/udp/udp.h
@@ -105,9 +105,9 @@
  ****************************************************************************/
 
 #ifdef CONFIG_EXAMPLES_UDP_IPv6
-uint16_t g_udpserver_ipv6[8];
+extern uint16_t g_udpserver_ipv6[8];
 #else
-uint32_t g_udpserver_ipv4;
+extern uint32_t g_udpserver_ipv4;
 #endif
 
 /****************************************************************************


[incubator-nuttx-apps] 04/04: examples/udp: Avoid using non-standard s6_addr16

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 97b439f180a74543a5cc5558f35e0f5e984ce172
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Apr 2 01:35:15 2020 +0900

    examples/udp: Avoid using non-standard s6_addr16
    
    Also, fixes endian issues.
---
 examples/udp/udp_server.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/examples/udp/udp_server.c b/examples/udp/udp_server.c
index 0237be3..cc9b053 100644
--- a/examples/udp/udp_server.c
+++ b/examples/udp/udp_server.c
@@ -168,12 +168,18 @@ void udp_server(void)
                         (struct sockaddr *)&client, &recvlen);
 
 #ifdef CONFIG_EXAMPLES_UDP_IPv6
-      printf("server: %d. Received %d bytes from %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x port %d\n",
+      printf("server: %d. Received %d bytes from "
+             "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
+             "%02x%02x:%02x%02x:%02x%02x:%02x%02x port %d\n",
              offset, nbytes,
-             client.sin6_addr.s6_addr16[0], client.sin6_addr.s6_addr16[1],
-             client.sin6_addr.s6_addr16[2], client.sin6_addr.s6_addr16[3],
-             client.sin6_addr.s6_addr16[4], client.sin6_addr.s6_addr16[5],
-             client.sin6_addr.s6_addr16[6], client.sin6_addr.s6_addr16[7],
+             client.sin6_addr.s6_addr[0], client.sin6_addr.s6_addr[1],
+             client.sin6_addr.s6_addr[2], client.sin6_addr.s6_addr[3],
+             client.sin6_addr.s6_addr[4], client.sin6_addr.s6_addr[5],
+             client.sin6_addr.s6_addr[6], client.sin6_addr.s6_addr[7],
+             client.sin6_addr.s6_addr[8], client.sin6_addr.s6_addr[9],
+             client.sin6_addr.s6_addr[10], client.sin6_addr.s6_addr[11],
+             client.sin6_addr.s6_addr[12], client.sin6_addr.s6_addr[13],
+             client.sin6_addr.s6_addr[14], client.sin6_addr.s6_addr[15],
              ntohs(client.sin6_port));
 #else
       tmpaddr = ntohl(client.sin_addr.s_addr);


[incubator-nuttx-apps] 01/04: examples/udp: Appease nxstyle errors

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit d79de1665742170c17a74014b222f3914f8756a9
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Apr 2 01:27:28 2020 +0900

    examples/udp: Appease nxstyle errors
---
 examples/udp/udp.h        |  2 +-
 examples/udp/udp_server.c | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/examples/udp/udp.h b/examples/udp/udp.h
index b00bac9..f18db12 100644
--- a/examples/udp/udp.h
+++ b/examples/udp/udp.h
@@ -52,7 +52,7 @@
  ****************************************************************************/
 
 #ifdef EXAMPLES_UDP_HOST
-   /* HTONS/L macros are unique to uIP-based networks */
+/* HTONS/L macros are unique to uIP-based networks */
 
 #  ifdef CONFIG_ENDIAN_BIG
 #    define HTONS(ns) (ns)
diff --git a/examples/udp/udp_server.c b/examples/udp/udp_server.c
index 18f29b6..0237be3 100644
--- a/examples/udp/udp_server.c
+++ b/examples/udp/udp_server.c
@@ -70,9 +70,11 @@ static inline int check_buffer(unsigned char *buf)
         {
           j = 1;
         }
+
       if (buf[j] != ch)
         {
-          printf("server: Buffer content error for offset=%d, index=%d\n", offset, j);
+          printf("server: Buffer content error for offset=%d, index=%d\n",
+                 offset, j);
           ret = 0;
         }
     }
@@ -117,7 +119,8 @@ void udp_server(void)
   /* Set socket to reuse address */
 
   optval = 1;
-  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
+  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
+                 sizeof(int)) < 0)
     {
       printf("server: setsockopt SO_REUSEADDR failure: %d\n", errno);
       exit(1);
@@ -149,7 +152,7 @@ void udp_server(void)
   addrlen                = sizeof(struct sockaddr_in);
 #endif
 
-  if (bind(sockfd, (struct sockaddr*)&server, addrlen) < 0)
+  if (bind(sockfd, (struct sockaddr *)&server, addrlen) < 0)
     {
       printf("server: bind failure: %d\n", errno);
       exit(1);
@@ -162,7 +165,7 @@ void udp_server(void)
       printf("server: %d. Receiving up 1024 bytes\n", offset);
       recvlen = addrlen;
       nbytes = recvfrom(sockfd, inbuf, 1024, 0,
-                        (struct sockaddr*)&client, &recvlen);
+                        (struct sockaddr *)&client, &recvlen);
 
 #ifdef CONFIG_EXAMPLES_UDP_IPv6
       printf("server: %d. Received %d bytes from %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x port %d\n",
@@ -189,14 +192,16 @@ void udp_server(void)
 
       if (nbytes != SENDSIZE)
         {
-          printf("server: %d. recv size incorrect: %d vs %d\n", offset, nbytes, SENDSIZE);
+          printf("server: %d. recv size incorrect: %d vs %d\n", offset,
+                 nbytes, SENDSIZE);
           close(sockfd);
           exit(-1);
         }
 
       if (offset < inbuf[0])
         {
-          printf("server: %d. %d packets lost, resetting offset\n", offset, inbuf[0] - offset);
+          printf("server: %d. %d packets lost, resetting offset\n", offset,
+                 inbuf[0] - offset);
           offset = inbuf[0];
         }
       else if (offset > inbuf[0])
@@ -213,5 +218,6 @@ void udp_server(void)
           exit(-1);
         }
     }
+
   close(sockfd);
 }


[incubator-nuttx-apps] 02/04: examples/udp: Avoid conflicts with host OS definitions

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit d55401d3fc693ec44fda7f9e97f12885e1c667bf
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Apr 2 01:29:19 2020 +0900

    examples/udp: Avoid conflicts with host OS definitions
---
 examples/udp/udp.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/examples/udp/udp.h b/examples/udp/udp.h
index f18db12..5956ab9 100644
--- a/examples/udp/udp.h
+++ b/examples/udp/udp.h
@@ -55,14 +55,18 @@
 /* HTONS/L macros are unique to uIP-based networks */
 
 #  ifdef CONFIG_ENDIAN_BIG
+#    undef HTONS
 #    define HTONS(ns) (ns)
+#    undef HTONL
 #    define HTONL(nl) (nl)
 #  else
+#    undef HTONS
 #    define HTONS(ns) \
        (unsigned short) \
          (((((unsigned short)(ns)) & 0x00ff) << 8) | \
          ((((unsigned short)(ns)) >> 8) & 0x00ff))
-#      define HTONL(nl) \
+#    undef HTONL
+#    define HTONL(nl) \
        (unsigned long) \
          (((((unsigned long)(nl)) & 0x000000ffUL) << 24) | \
          ((((unsigned long)(nl)) & 0x0000ff00UL) <<  8) | \
@@ -70,7 +74,9 @@
          ((((unsigned long)(nl)) & 0xff000000UL) >> 24))
 #  endif
 
+#  undef NTOHS
 #  define NTOHS(hs) HTONS(hs)
+#  undef NTOHL
 #  define NTOHL(hl) HTONL(hl)
 #  define FAR
 #endif