anchao commented on code in PR #7616:
URL: https://github.com/apache/incubator-nuttx/pull/7616#discussion_r1027228166


##########
net/tcp/tcp_send_buffered.c:
##########
@@ -244,6 +244,44 @@ static inline void psock_lost_connection(FAR struct 
tcp_conn_s *conn,
     }
 }
 
+/****************************************************************************
+ * Name: send_tcpip_hdrsize
+ *
+ * Description:
+ *   Get the total size of L3 and L4 TCP header
+ *
+ * Input Parameters:
+ *   conn     The connection structure associated with the socket
+ *
+ * Returned Value:
+ *   the total size of L3 and L4 TCP header
+ *
+ ****************************************************************************/
+
+static inline uint16_t send_tcpip_hdrsize(FAR struct tcp_conn_s *conn)
+{
+#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6)
+  if (conn->domain == PF_INET)
+    {
+      /* Select the IPv4 domain */
+
+      return sizeof(struct ipv4_hdr_s) + sizeof(struct tcp_hdr_s);
+    }
+  else /* if (domain == PF_INET6) */
+    {
+      /* Select the IPv6 domain */
+
+      return sizeof(struct ipv6_hdr_s) + sizeof(struct tcp_hdr_s);
+    }
+#elif defined(CONFIG_NET_IPv4)
+  ((void)conn);

Review Comment:
   Done



##########
net/udp/udp_sendto_buffered.c:
##########
@@ -327,6 +333,46 @@ static int sendto_next_transfer(FAR struct udp_conn_s 
*conn)
   return OK;
 }
 
+/****************************************************************************
+ * Name: send_tcpip_hdrsize
+ *
+ * Description:
+ *   Get the total size of L3 and L4 UDP header
+ *
+ * Input Parameters:
+ *   conn     The connection structure associated with the socket
+ *
+ * Returned Value:
+ *   the total size of L3 and L4 TCP header
+ *
+ ****************************************************************************/
+
+static inline uint16_t sendto_udpip_hdrsize(FAR struct udp_conn_s *conn)
+{
+#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6)
+  /* Which domain the socket used */
+
+  if (conn->domain == PF_INET)
+    {
+      /* Select the IPv4 domain */
+
+      return sizeof(struct ipv4_hdr_s) + sizeof(struct udp_hdr_s);
+    }
+  else /* if (domain == PF_INET6) */
+    {
+      /* Select the IPv6 domain */
+
+      return sizeof(struct ipv6_hdr_s) + sizeof(struct udp_hdr_s);
+    }
+#elif defined(CONFIG_NET_IPv4)
+  ((void)conn);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to