From befc37ada0b901ad7c315e4089976508396d496b Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 19 Nov 2007 18:17:23 +0000 Subject: uIP webserver now uses listen/accept git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@386 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/include/net/uip/httpd.h | 25 +++++++++++++++++++++---- nuttx/include/net/uip/uip-lib.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) (limited to 'nuttx/include') diff --git a/nuttx/include/net/uip/httpd.h b/nuttx/include/net/uip/httpd.h index ef21cc6ba..44d4d8f4a 100644 --- a/nuttx/include/net/uip/httpd.h +++ b/nuttx/include/net/uip/httpd.h @@ -1,11 +1,19 @@ -/* httpd.h +/**************************************************************************** + * net/uip/httpd.h * - * Copyright (c) 2001-2005, Adam Dunkels. - * All rights reserved. + * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Based on uIP which also has a BSD style license: + * + * Author: Adam Dunkels + * Copyright (c) 2001-2005, Adam Dunkels. + * All rights reserved. * * 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 @@ -26,13 +34,22 @@ * 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 _NET_UIP_HTTPD_H #define _NET_UIP_HTTPD_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + extern void httpd_init(void); extern int httpd_listen(void); diff --git a/nuttx/include/net/uip/uip-lib.h b/nuttx/include/net/uip/uip-lib.h index 3f6c9860d..d5799ee56 100644 --- a/nuttx/include/net/uip/uip-lib.h +++ b/nuttx/include/net/uip/uip-lib.h @@ -42,9 +42,33 @@ #ifndef __UIPLIB_H__ #define __UIPLIB_H__ +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include +#include #include +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* SOCK_DGRAM is the preferred socket type to use when we just want a + * socket for performing drive ioctls. However, we can't use SOCK_DRAM + * if UDP is disabled. + */ + +#ifdef CONFIG_NET_UDP +# define UIPLIB_SOCK_IOCTL SOCK_DGRAM +#else +# define UIPLIB_SOCK_IOCTL SOCK_STREAM +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + /* Convert a textual representation of an IP address to a numerical representation. * * This function takes a textual representation of an IP address in @@ -80,4 +104,8 @@ extern int uip_setdraddr(const char *ifname, const struct in_addr *addr); extern int uip_setnetmask(const char *ifname, const struct in_addr *addr); #endif +/* Generic server logic */ + +extern void uip_server(uint16 portno, main_t handler, int stacksize); + #endif /* __UIPLIB_H__ */ -- cgit v1.2.3