From 4beb3c0ad784a0a889db13be6d62f3ac2812e45e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 16 Aug 2014 10:23:17 -0600 Subject: [PATCH] Move SLIP prototypes from net.h to new slip.h --- drivers/net/slip.c | 39 +++++++++++----------- include/nuttx/net/slip.h | 70 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 include/nuttx/net/slip.h diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 66a8bdeadf..66e84961e9 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -58,6 +58,7 @@ #include #include #include +#include #if defined(CONFIG_NET) && defined(CONFIG_NET_SLIP) @@ -201,23 +202,23 @@ static void slip_semtake(FAR struct slip_driver_s *priv); static void slip_write(FAR struct slip_driver_s *priv, const uint8_t *buffer, int len); static void slip_putc(FAR struct slip_driver_s *priv, int ch); static int slip_transmit(FAR struct slip_driver_s *priv); -static int slip_txpoll(struct net_driver_s *dev); -static void slip_txtask(int argc, char *argv[]); +static int slip_txpoll(FAR struct net_driver_s *dev); +static void slip_txtask(int argc, FAR char *argv[]); /* Packet receiver task */ static int slip_getc(FAR struct slip_driver_s *priv); static inline void slip_receive(FAR struct slip_driver_s *priv); -static int slip_rxtask(int argc, char *argv[]); +static int slip_rxtask(int argc, FAR char *argv[]); /* NuttX callback functions */ -static int slip_ifup(struct net_driver_s *dev); -static int slip_ifdown(struct net_driver_s *dev); -static int slip_txavail(struct net_driver_s *dev); +static int slip_ifup(FAR struct net_driver_s *dev); +static int slip_ifdown(FAR struct net_driver_s *dev); +static int slip_txavail(FAR struct net_driver_s *dev); #ifdef CONFIG_NET_IGMP -static int slip_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); -static int slip_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); +static int slip_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); +static int slip_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif /**************************************************************************** @@ -418,7 +419,7 @@ static int slip_transmit(FAR struct slip_driver_s *priv) * ****************************************************************************/ -static int slip_txpoll(struct net_driver_s *dev) +static int slip_txpoll(FAR struct net_driver_s *dev) { FAR struct slip_driver_s *priv = (FAR struct slip_driver_s *)dev->d_private; @@ -452,7 +453,7 @@ static int slip_txpoll(struct net_driver_s *dev) * ****************************************************************************/ -static void slip_txtask(int argc, char *argv[]) +static void slip_txtask(int argc, FAR char *argv[]) { FAR struct slip_driver_s *priv; unsigned int index = *(argv[1]) - '0'; @@ -641,7 +642,7 @@ static inline void slip_receive(FAR struct slip_driver_s *priv) * ****************************************************************************/ -static int slip_rxtask(int argc, char *argv[]) +static int slip_rxtask(int argc, FAR char *argv[]) { FAR struct slip_driver_s *priv; unsigned int index = *(argv[1]) - '0'; @@ -759,7 +760,7 @@ static int slip_rxtask(int argc, char *argv[]) * ****************************************************************************/ -static int slip_ifup(struct net_driver_s *dev) +static int slip_ifup(FAR struct net_driver_s *dev) { FAR struct slip_driver_s *priv = (FAR struct slip_driver_s *)dev->d_private; @@ -789,7 +790,7 @@ static int slip_ifup(struct net_driver_s *dev) * ****************************************************************************/ -static int slip_ifdown(struct net_driver_s *dev) +static int slip_ifdown(FAR struct net_driver_s *dev) { FAR struct slip_driver_s *priv = (FAR struct slip_driver_s *)dev->d_private; @@ -815,7 +816,7 @@ static int slip_ifdown(struct net_driver_s *dev) * ****************************************************************************/ -static int slip_txavail(struct net_driver_s *dev) +static int slip_txavail(FAR struct net_driver_s *dev) { FAR struct slip_driver_s *priv = (FAR struct slip_driver_s *)dev->d_private; @@ -850,7 +851,7 @@ static int slip_txavail(struct net_driver_s *dev) ****************************************************************************/ #ifdef CONFIG_NET_IGMP -static int slip_addmac(struct net_driver_s *dev, FAR const uint8_t *mac) +static int slip_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac) { FAR struct slip_driver_s *priv = (FAR struct slip_driver_s *)dev->d_private; @@ -879,7 +880,7 @@ static int slip_addmac(struct net_driver_s *dev, FAR const uint8_t *mac) ****************************************************************************/ #ifdef CONFIG_NET_IGMP -static int slip_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) +static int slip_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac) { FAR struct slip_driver_s *priv = (FAR struct slip_driver_s *)dev->d_private; @@ -911,11 +912,11 @@ static int slip_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) * ****************************************************************************/ -int slip_initialize(int intf, const char *devname) +int slip_initialize(int intf, FAR const char *devname) { - struct slip_driver_s *priv; + FAR struct slip_driver_s *priv; char buffer[8]; - const char *argv[2]; + FAR const char *argv[2]; /* Get the interface structure associated with this interface number. */ diff --git a/include/nuttx/net/slip.h b/include/nuttx/net/slip.h new file mode 100644 index 0000000000..2c3515eb0b --- /dev/null +++ b/include/nuttx/net/slip.h @@ -0,0 +1,70 @@ +/**************************************************************************** + * include/nuttx/net/pkt.h + * Definitions for use with AF_PACKET sockets + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Daniel Laszlo Sitzer + * + * Includes some definitions that a compatible with the LGPL GNU C Library + * header file of the same name. + * + * 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 NuttX 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT OWNER 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. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_NET_PKT_H +#define __INCLUDE_NUTTX_NET_PKT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ +/* This function provides the interface between Ethernet device drivers and + * packet socket logic. All frames that are received should be provided to + * pkt_input() prior to other routing. + */ + +struct net_driver_s; /* Forward reference */ +int pkt_input(FAR struct net_driver_s *dev); + +#endif /* __INCLUDE_NUTTX_NET_PKT_H */