From 76fa58ee0069c8ff020b5d7ae7130081e230cbdc Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 28 Jun 2014 17:25:18 -0600 Subject: [PATCH] Move all socket-related files from net/ to net/socket. Move net/net.h to net/socket/socket.h --- net/arp/arp_timer.c | 2 -- net/icmp/icmp_ping.c | 2 -- net/net_initialize.c | 2 +- net/netdev/netdev_carrier.c | 1 - net/netdev/netdev_count.c | 1 - net/netdev/netdev_findbyaddr.c | 1 - net/netdev/netdev_findbyname.c | 1 - net/netdev/netdev_foreach.c | 1 - net/netdev/netdev_ioctl.c | 2 +- net/netdev/netdev_register.c | 1 - net/netdev/netdev_rxnotify.c | 1 - net/netdev/netdev_sem.c | 1 - net/netdev/netdev_txnotify.c | 1 - net/netdev/netdev_unregister.c | 1 - net/pkt/pkt_send.c | 2 +- net/route/net_addroute.c | 1 - net/route/net_allocroute.c | 1 - net/route/net_delroute.c | 1 - net/route/net_foreachroute.c | 1 - net/route/net_router.c | 1 - net/route/netdev_router.c | 1 - net/socket/Make.defs | 2 +- net/{ => socket}/accept.c | 4 ++-- net/{ => socket}/bind.c | 4 ++-- net/{ => socket}/connect.c | 4 ++-- net/{ => socket}/getsockname.c | 4 ++-- net/{ => socket}/getsockopt.c | 4 ++-- net/{ => socket}/listen.c | 4 ++-- net/{ => socket}/net_checksd.c | 4 ++-- net/{ => socket}/net_clone.c | 4 ++-- net/{ => socket}/net_close.c | 4 ++-- net/{ => socket}/net_dup.c | 4 ++-- net/{ => socket}/net_dup2.c | 4 ++-- net/{ => socket}/net_monitor.c | 4 ++-- net/{ => socket}/net_poll.c | 4 ++-- net/{ => socket}/net_sendfile.c | 4 ++-- net/{ => socket}/net_sockets.c | 4 ++-- net/{ => socket}/net_timeo.c | 4 ++-- net/{ => socket}/net_vfcntl.c | 4 ++-- net/{ => socket}/recv.c | 4 ++-- net/{ => socket}/recvfrom.c | 4 ++-- net/{ => socket}/send.c | 4 ++-- net/{ => socket}/sendto.c | 4 ++-- net/{ => socket}/setsockopt.c | 7 ++++--- net/{ => socket}/socket.c | 4 ++-- net/{net.h => socket/socket.h} | 11 +++++------ net/tcp/tcp_send_buffered.c | 2 +- net/tcp/tcp_send_unbuffered.c | 2 +- net/utils/Make.defs | 2 +- net/utils/net_dsec2timeval.c | 2 +- net/{ => utils}/net_timeval2dsec.c | 19 ++++++++----------- net/utils/utils.h | 29 ++++++++++++++++++++++++++++- 52 files changed, 97 insertions(+), 93 deletions(-) rename net/{ => socket}/accept.c (99%) rename net/{ => socket}/bind.c (99%) rename net/{ => socket}/connect.c (99%) rename net/{ => socket}/getsockname.c (99%) rename net/{ => socket}/getsockopt.c (99%) rename net/{ => socket}/listen.c (99%) rename net/{ => socket}/net_checksd.c (98%) rename net/{ => socket}/net_clone.c (98%) rename net/{ => socket}/net_close.c (99%) rename net/{ => socket}/net_dup.c (98%) rename net/{ => socket}/net_dup2.c (98%) rename net/{ => socket}/net_monitor.c (99%) rename net/{ => socket}/net_poll.c (99%) rename net/{ => socket}/net_sendfile.c (99%) rename net/{ => socket}/net_sockets.c (99%) rename net/{ => socket}/net_timeo.c (98%) rename net/{ => socket}/net_vfcntl.c (99%) rename net/{ => socket}/recv.c (98%) rename net/{ => socket}/recvfrom.c (99%) rename net/{ => socket}/send.c (99%) rename net/{ => socket}/sendto.c (99%) rename net/{ => socket}/setsockopt.c (98%) rename net/{ => socket}/socket.c (99%) rename net/{net.h => socket/socket.h} (97%) rename net/{ => utils}/net_timeval2dsec.c (83%) diff --git a/net/arp/arp_timer.c b/net/arp/arp_timer.c index 059f1577a6..75119a3e2d 100644 --- a/net/arp/arp_timer.c +++ b/net/arp/arp_timer.c @@ -48,8 +48,6 @@ #include #include -#include "net.h" - #ifdef CONFIG_NET_ARP /**************************************************************************** diff --git a/net/icmp/icmp_ping.c b/net/icmp/icmp_ping.c index 0054f20966..1ba91d3377 100644 --- a/net/icmp/icmp_ping.c +++ b/net/icmp/icmp_ping.c @@ -58,8 +58,6 @@ #include "uip/uip.h" #include "icmp/icmp.h" -#include "net.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/net/net_initialize.c b/net/net_initialize.c index 80366bc114..185a07943d 100644 --- a/net/net_initialize.c +++ b/net/net_initialize.c @@ -46,7 +46,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "tcp/tcp.h" #include "udp/udp.h" diff --git a/net/netdev/netdev_carrier.c b/net/netdev/netdev_carrier.c index fb5e7e4d7f..fb2dead4f1 100644 --- a/net/netdev/netdev_carrier.c +++ b/net/netdev/netdev_carrier.c @@ -52,7 +52,6 @@ #include #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_count.c b/net/netdev/netdev_count.c index 1a67be8839..7dace4993c 100644 --- a/net/netdev/netdev_count.c +++ b/net/netdev/netdev_count.c @@ -45,7 +45,6 @@ #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_findbyaddr.c b/net/netdev/netdev_findbyaddr.c index 1966d99f51..2ad23bdf9b 100644 --- a/net/netdev/netdev_findbyaddr.c +++ b/net/netdev/netdev_findbyaddr.c @@ -47,7 +47,6 @@ #include -#include "net.h" #include "netdev/netdev.h" #include "route/route.h" diff --git a/net/netdev/netdev_findbyname.c b/net/netdev/netdev_findbyname.c index 9808086521..60a9654412 100644 --- a/net/netdev/netdev_findbyname.c +++ b/net/netdev/netdev_findbyname.c @@ -45,7 +45,6 @@ #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_foreach.c b/net/netdev/netdev_foreach.c index 9a5eb491b6..f3e852e513 100644 --- a/net/netdev/netdev_foreach.c +++ b/net/netdev/netdev_foreach.c @@ -44,7 +44,6 @@ #include #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index af555dda09..c4ca4ff186 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -63,7 +63,7 @@ # include "nuttx/net/igmp.h" #endif -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "route/route.h" diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index c2e47e3be0..6ed760ec87 100644 --- a/net/netdev/netdev_register.c +++ b/net/netdev/netdev_register.c @@ -52,7 +52,6 @@ #include #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_rxnotify.c b/net/netdev/netdev_rxnotify.c index 5473d934de..c14409c3c1 100644 --- a/net/netdev/netdev_rxnotify.c +++ b/net/netdev/netdev_rxnotify.c @@ -47,7 +47,6 @@ #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_sem.c b/net/netdev/netdev_sem.c index cf6557999c..2a7fa07ca1 100644 --- a/net/netdev/netdev_sem.c +++ b/net/netdev/netdev_sem.c @@ -48,7 +48,6 @@ #include #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_txnotify.c b/net/netdev/netdev_txnotify.c index f044f2d24d..6ca3c5513a 100644 --- a/net/netdev/netdev_txnotify.c +++ b/net/netdev/netdev_txnotify.c @@ -47,7 +47,6 @@ #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/netdev/netdev_unregister.c b/net/netdev/netdev_unregister.c index 150e410f5d..68114ccb7d 100644 --- a/net/netdev/netdev_unregister.c +++ b/net/netdev/netdev_unregister.c @@ -52,7 +52,6 @@ #include #include -#include "net.h" #include "netdev/netdev.h" /**************************************************************************** diff --git a/net/pkt/pkt_send.c b/net/pkt/pkt_send.c index bc2c2b33c8..60fcb65e47 100644 --- a/net/pkt/pkt_send.c +++ b/net/pkt/pkt_send.c @@ -55,7 +55,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "uip/uip.h" #include "pkt/pkt.h" diff --git a/net/route/net_addroute.c b/net/route/net_addroute.c index 8c842a1e23..5f537a3464 100644 --- a/net/route/net_addroute.c +++ b/net/route/net_addroute.c @@ -46,7 +46,6 @@ #include -#include "net.h" #include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/route/net_allocroute.c b/net/route/net_allocroute.c index 9efa120ed7..a8074b20c0 100644 --- a/net/route/net_allocroute.c +++ b/net/route/net_allocroute.c @@ -45,7 +45,6 @@ #include -#include "net.h" #include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/route/net_delroute.c b/net/route/net_delroute.c index d1c84aa54c..7bee168a9b 100644 --- a/net/route/net_delroute.c +++ b/net/route/net_delroute.c @@ -43,7 +43,6 @@ #include #include -#include "net.h" #include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/route/net_foreachroute.c b/net/route/net_foreachroute.c index aaf92b14c2..0c0de44f1d 100644 --- a/net/route/net_foreachroute.c +++ b/net/route/net_foreachroute.c @@ -44,7 +44,6 @@ #include -#include "net.h" #include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/route/net_router.c b/net/route/net_router.c index 37fa91036a..1c04f0ea50 100644 --- a/net/route/net_router.c +++ b/net/route/net_router.c @@ -43,7 +43,6 @@ #include #include -#include "net.h" #include "route/route.h" #if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE) diff --git a/net/route/netdev_router.c b/net/route/netdev_router.c index d62fe5f0fc..7af96259e4 100644 --- a/net/route/netdev_router.c +++ b/net/route/netdev_router.c @@ -45,7 +45,6 @@ #include -#include "net.h" #include "netdev/netdev.h" #include "route/route.h" diff --git a/net/socket/Make.defs b/net/socket/Make.defs index 1b310ca7d0..f70c2d64f2 100644 --- a/net/socket/Make.defs +++ b/net/socket/Make.defs @@ -50,7 +50,7 @@ endif ifeq ($(CONFIG_NET_SOCKOPTS),y) SOCK_CSRCS += setsockopt.c getsockopt.c ifneq ($(CONFIG_DISABLE_CLOCK),y) -SOCK_CSRCS += net_timeo.c net_timeval2dsec.c +SOCK_CSRCS += net_timeo.c endif endif diff --git a/net/accept.c b/net/socket/accept.c similarity index 99% rename from net/accept.c rename to net/socket/accept.c index 6c04fa1c08..1908c92937 100644 --- a/net/accept.c +++ b/net/socket/accept.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/accept.c + * net/socket/accept.c * * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -53,7 +53,7 @@ #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Definitions diff --git a/net/bind.c b/net/socket/bind.c similarity index 99% rename from net/bind.c rename to net/socket/bind.c index 1d55846b11..f399d3c991 100644 --- a/net/bind.c +++ b/net/socket/bind.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/bind.c + * net/socket/bind.c * * Copyright (C) 2007-2009, 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -53,7 +53,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "tcp/tcp.h" #include "udp/udp.h" diff --git a/net/connect.c b/net/socket/connect.c similarity index 99% rename from net/connect.c rename to net/socket/connect.c index c7812c321f..057d795bf9 100644 --- a/net/connect.c +++ b/net/socket/connect.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/connect.c + * net/socket/connect.c * * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -52,7 +52,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "uip/uip.h" #include "tcp/tcp.h" #include "udp/udp.h" diff --git a/net/getsockname.c b/net/socket/getsockname.c similarity index 99% rename from net/getsockname.c rename to net/socket/getsockname.c index fb05eb5af9..45378f823a 100644 --- a/net/getsockname.c +++ b/net/socket/getsockname.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/getsockname.c + * net/socket/getsockname.c * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -50,7 +50,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #ifdef CONFIG_NET diff --git a/net/getsockopt.c b/net/socket/getsockopt.c similarity index 99% rename from net/getsockopt.c rename to net/socket/getsockopt.c index 7d106b591e..c7e66ed8e8 100644 --- a/net/getsockopt.c +++ b/net/socket/getsockopt.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/getsockopt.c + * net/socket/getsockopt.c * * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -44,7 +44,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "utils/utils.h" /**************************************************************************** diff --git a/net/listen.c b/net/socket/listen.c similarity index 99% rename from net/listen.c rename to net/socket/listen.c index eb4e29f348..9eb9551a96 100644 --- a/net/listen.c +++ b/net/socket/listen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/listen.c + * net/socket/listen.c * * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -46,7 +46,7 @@ #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Global Functions diff --git a/net/net_checksd.c b/net/socket/net_checksd.c similarity index 98% rename from net/net_checksd.c rename to net/socket/net_checksd.c index 77feab68af..67d783a093 100644 --- a/net/net_checksd.c +++ b/net/socket/net_checksd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_checksd.c + * net/socket/net_checksd.c * * Copyright (C) 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -45,7 +45,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Global Functions diff --git a/net/net_clone.c b/net/socket/net_clone.c similarity index 98% rename from net/net_clone.c rename to net/socket/net_clone.c index 52905da5e9..0866d88f42 100644 --- a/net/net_clone.c +++ b/net/socket/net_clone.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_clone.c + * net/socket/net_clone.c * * Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -48,7 +48,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Global Functions diff --git a/net/net_close.c b/net/socket/net_close.c similarity index 99% rename from net/net_close.c rename to net/socket/net_close.c index a2c57b6efc..7d0eab2b70 100644 --- a/net/net_close.c +++ b/net/socket/net_close.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_close.c + * net/socket/net_close.c * * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -57,7 +57,7 @@ # include #endif -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "uip/uip.h" #include "pkt/pkt.h" diff --git a/net/net_dup.c b/net/socket/net_dup.c similarity index 98% rename from net/net_dup.c rename to net/socket/net_dup.c index 5f0185a122..0c8a35c0b1 100644 --- a/net/net_dup.c +++ b/net/socket/net_dup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_dup.c + * net/socket/net_dup.c * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -44,7 +44,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 diff --git a/net/net_dup2.c b/net/socket/net_dup2.c similarity index 98% rename from net/net_dup2.c rename to net/socket/net_dup2.c index 3223fcf78e..0631237224 100644 --- a/net/net_dup2.c +++ b/net/socket/net_dup2.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_dup2.c + * net/socket/net_dup2.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -44,7 +44,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 diff --git a/net/net_monitor.c b/net/socket/net_monitor.c similarity index 99% rename from net/net_monitor.c rename to net/socket/net_monitor.c index afbe1121c3..25bcff8cb3 100644 --- a/net/net_monitor.c +++ b/net/socket/net_monitor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_monitor.c + * net/socket/net_monitor.c * * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -46,7 +46,7 @@ #include -#include "net.h" +#include "socket/socket.h" #include "uip/uip.h" /**************************************************************************** diff --git a/net/net_poll.c b/net/socket/net_poll.c similarity index 99% rename from net/net_poll.c rename to net/socket/net_poll.c index d865631a61..bb40c0b540 100644 --- a/net/net_poll.c +++ b/net/socket/net_poll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_poll.c + * net/socket/net_poll.c * * Copyright (C) 2008-2009, 2011-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -58,7 +58,7 @@ #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Pre-processor Definitions diff --git a/net/net_sendfile.c b/net/socket/net_sendfile.c similarity index 99% rename from net/net_sendfile.c rename to net/socket/net_sendfile.c index c5f249b51f..07396a1b79 100644 --- a/net/net_sendfile.c +++ b/net/socket/net_sendfile.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_sendfile.c + * net/socket/net_sendfile.c * * Copyright (C) 2013 UVC Ingenieure. All rights reserved. * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. @@ -61,7 +61,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "uip/uip.h" diff --git a/net/net_sockets.c b/net/socket/net_sockets.c similarity index 99% rename from net/net_sockets.c rename to net/socket/net_sockets.c index 1b237e3ce7..d1ece6c185 100644 --- a/net/net_sockets.c +++ b/net/socket/net_sockets.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_sockets.c + * net/socket/net_sockets.c * * Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -51,7 +51,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Pre-processor Definitions diff --git a/net/net_timeo.c b/net/socket/net_timeo.c similarity index 98% rename from net/net_timeo.c rename to net/socket/net_timeo.c index 551aa188f1..0621060927 100644 --- a/net/net_timeo.c +++ b/net/socket/net_timeo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_timeo.c + * net/socket/net_timeo.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -45,7 +45,7 @@ #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Global Functions diff --git a/net/net_vfcntl.c b/net/socket/net_vfcntl.c similarity index 99% rename from net/net_vfcntl.c rename to net/socket/net_vfcntl.c index 50da8a0208..e251af8a5b 100644 --- a/net/net_vfcntl.c +++ b/net/socket/net_vfcntl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/net_vfcntl.c + * net/socket/net_vfcntl.c * * Copyright (C) 2009, 2012-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -47,7 +47,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 diff --git a/net/recv.c b/net/socket/recv.c similarity index 98% rename from net/recv.c rename to net/socket/recv.c index 8ddb4bce6c..cac55d84ac 100644 --- a/net/recv.c +++ b/net/socket/recv.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/recv.c + * net/socket/recv.c * * Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -44,7 +44,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Global Functions diff --git a/net/recvfrom.c b/net/socket/recvfrom.c similarity index 99% rename from net/recvfrom.c rename to net/socket/recvfrom.c index 9c6c576fd6..8a74e3b3e9 100644 --- a/net/recvfrom.c +++ b/net/socket/recvfrom.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/recvfrom.c + * net/socket/recvfrom.c * * Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -60,7 +60,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "uip/uip.h" #include "tcp/tcp.h" diff --git a/net/send.c b/net/socket/send.c similarity index 99% rename from net/send.c rename to net/socket/send.c index b521949053..c9e7e969bc 100644 --- a/net/send.c +++ b/net/socket/send.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/send.c + * net/socket/send.c * * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -47,7 +47,7 @@ #include "tcp/tcp.h" #include "pkt/pkt.h" -#include "net.h" +#include "socket/socket.h" /**************************************************************************** * Definitions diff --git a/net/sendto.c b/net/socket/sendto.c similarity index 99% rename from net/sendto.c rename to net/socket/sendto.c index e88f691756..846050f820 100644 --- a/net/sendto.c +++ b/net/socket/sendto.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/sendto.c + * net/socket/sendto.c * * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -52,7 +52,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "uip/uip.h" #include "udp/udp.h" diff --git a/net/setsockopt.c b/net/socket/setsockopt.c similarity index 98% rename from net/setsockopt.c rename to net/socket/setsockopt.c index e6fc2d0929..fdd9e2e3a1 100644 --- a/net/setsockopt.c +++ b/net/socket/setsockopt.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/setsockopt.c + * net/socket/setsockopt.c * * Copyright (C) 2007, 2008, 2011-2012, 2014 Gregory Nutt. All rights * reserved. @@ -46,7 +46,8 @@ #include #include -#include "net.h" +#include "socket/socket.h" +#include "utils/utils.h" /**************************************************************************** * Global Functions @@ -184,7 +185,7 @@ int psock_setsockopt(FAR struct socket *psock, int level, int option, /* Get the timeout value */ - timeo = net_timeval2dsec((struct timeval *)value); + timeo = (socktimeo_t)net_timeval2dsec((struct timeval *)value); /* Save the timeout value */ diff --git a/net/socket.c b/net/socket/socket.c similarity index 99% rename from net/socket.c rename to net/socket/socket.c index 8676875c13..2c7e7a0719 100644 --- a/net/socket.c +++ b/net/socket/socket.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/socket.c + * net/socket/socket.c * * Copyright (C) 2007-2009, 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -49,7 +49,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "tcp/tcp.h" #include "udp/udp.h" #include "pkt/pkt.h" diff --git a/net/net.h b/net/socket/socket.h similarity index 97% rename from net/net.h rename to net/socket/socket.h index c5990d491a..6989d32ee3 100644 --- a/net/net.h +++ b/net/socket/socket.h @@ -1,7 +1,7 @@ /**************************************************************************** - * net/net.h + * net/socket/socket.h * - * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef _NET_NET_H -#define _NET_NET_H +#ifndef _NET_SOCKET_SOCKET_H +#define _NET_SOCKET_SOCKET_H /**************************************************************************** * Included Files @@ -177,7 +177,6 @@ int psock_close(FAR struct socket *psock); #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) int net_timeo(uint32_t start_time, socktimeo_t timeo); -socktimeo_t net_timeval2dsec(FAR struct timeval *tv); #endif /* send.c ********************************************************************/ @@ -191,4 +190,4 @@ ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len, #endif #endif /* CONFIG_NET */ -#endif /* _NET_NET_H */ +#endif /* _NET_SOCKET_SOCKET_H */ diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index d51a6efbf2..f9af6e0a8e 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -68,7 +68,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "tcp/tcp.h" #include "uip/uip.h" diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index 39474cfc3a..6a3d5062fb 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -56,7 +56,7 @@ #include #include -#include "net.h" +#include "socket/socket.h" #include "netdev/netdev.h" #include "uip/uip.h" #include "tcp/tcp.h" diff --git a/net/utils/Make.defs b/net/utils/Make.defs index 376398bf4d..dd3ad35a5c 100644 --- a/net/utils/Make.defs +++ b/net/utils/Make.defs @@ -33,7 +33,7 @@ # ############################################################################ -NET_CSRCS += net_dsec2timeval.c net_chksum.c +NET_CSRCS += net_dsec2timeval.c net_timeval2dsec.c net_chksum.c # Non-interrupt level support required? diff --git a/net/utils/net_dsec2timeval.c b/net/utils/net_dsec2timeval.c index 92b93cd42c..df6db20dba 100644 --- a/net/utils/net_dsec2timeval.c +++ b/net/utils/net_dsec2timeval.c @@ -44,7 +44,7 @@ #include #include -#include "net.h" +#include "utils/utils.h" /**************************************************************************** * Public Functions diff --git a/net/net_timeval2dsec.c b/net/utils/net_timeval2dsec.c similarity index 83% rename from net/net_timeval2dsec.c rename to net/utils/net_timeval2dsec.c index f61f1a1797..12fafab7fd 100644 --- a/net/net_timeval2dsec.c +++ b/net/utils/net_timeval2dsec.c @@ -1,7 +1,7 @@ /**************************************************************************** - * net/net_timeval2dsec.c + * net/utils/net_timeval2dsec.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -38,14 +38,11 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) +#if defined(CONFIG_NET) && !defined(CONFIG_DISABLE_CLOCK) -#include -#include -#include #include -#include "net.h" +#include "utils/utils.h" /**************************************************************************** * Global Functions @@ -62,15 +59,15 @@ * tv The struct timeval to convert * * Returned Value: - * the converted value + * The converted value * * Assumptions: * ****************************************************************************/ -socktimeo_t net_timeval2dsec(struct timeval *tv) +unsigned int net_timeval2dsec(struct timeval *tv) { - return (uint16_t)(tv->tv_sec* DSEC_PER_SEC + tv->tv_usec / USEC_PER_DSEC); + return (unsigned int)(tv->tv_sec * DSEC_PER_SEC + tv->tv_usec / USEC_PER_DSEC); } -#endif /* CONFIG_NET && CONFIG_NET_SOCKOPTS && !CONFIG_DISABLE_CLOCK */ +#endif /* CONFIG_NET && !CONFIG_DISABLE_CLOCK */ diff --git a/net/utils/utils.h b/net/utils/utils.h index 1ccd0aedc7..152cd4a240 100644 --- a/net/utils/utils.h +++ b/net/utils/utils.h @@ -66,6 +66,11 @@ extern "C" * Public Function Prototypes ****************************************************************************/ +struct net_driver_s; /* Forward reference */ +#if !defined(CONFIG_DISABLE_CLOCK) +struct timeval; /* Forward reference */ +#endif + /**************************************************************************** * Function: net_dsec2timeval * @@ -84,8 +89,30 @@ extern "C" * ****************************************************************************/ -struct timeval; +#if !defined(CONFIG_DISABLE_CLOCK) void net_dsec2timeval(uint16_t dsec, FAR struct timeval *tv); +#endif + +/**************************************************************************** + * Function: net_timeval2dsec + * + * Description: + * Convert a struct timeval to deciseconds. Needed by setsockopt() to + * save new timeout values. + * + * Parameters: + * tv The struct timeval to convert + * + * Returned Value: + * The converted value + * + * Assumptions: + * + ****************************************************************************/ + +#if !defined(CONFIG_DISABLE_CLOCK) +unsigned int net_timeval2dsec(FAR struct timeval *tv); +#endif /**************************************************************************** * Name: tcp_chksum