Cleanup and fix problems introduce in last commit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@337 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
952db3328f
commit
4283c46855
@ -1,10 +1,18 @@
|
||||
/* main.c
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
/****************************************************************************
|
||||
* examples/uip/main.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Copyright (c) 2001, 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
|
||||
@ -29,11 +37,11 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: main.c,v 1.4 2007-09-03 20:34:43 patacongo Exp $
|
||||
*
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -87,8 +87,8 @@
|
||||
#define NSEC2TICK(nsec) (((nsec)+(NSEC_PER_TICK/2))/NSEC_PER_TICK) /* Rounds */
|
||||
#define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) /* Rounds */
|
||||
#define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) /* Rounds */
|
||||
#define DSEC2TICK(dsec) MSEC2TICK((dsec)*DSEC_PER_MSEC)
|
||||
#define SEC2TICK(sec) MSEC2TICK((sec)*SEC_PER_MSEC)
|
||||
#define DSEC2TICK(dsec) MSEC2TICK((dsec)*MSEC_PER_DSEC)
|
||||
#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC)
|
||||
|
||||
/****************************************************************************
|
||||
* Global Data
|
||||
|
@ -135,7 +135,7 @@
|
||||
#define SO_SNDBUF 7 /* Sets send buffer size. arg: integer value (get/set). */
|
||||
#define SO_RCVBUF 8 /* Sets receive buffer size. arg: integer value (get/set). */
|
||||
#define SO_ERROR 9 /* Reports and clears error status (get only). arg: returns
|
||||
* an integer value
|
||||
* an integer value */
|
||||
#define SO_TYPE 10 /* Reports the socket type (get only). return: int */
|
||||
#define SO_DONTROUTE 11 /* Requests that outgoing messages bypass standard routing (get/set)
|
||||
* arg: pointer to integer containing a boolean value */
|
||||
|
@ -46,7 +46,7 @@ STD_CSRCS = socket.c bind.c connect.c send.c sendto.c recv.c recvfrom.c \
|
||||
ifeq ($(CONFIG_NET_SOCKOPTS),y)
|
||||
STD_CSRCS += setsockopt.c getsockopt.c
|
||||
ifneq ($(CONFIG_DISABLE_CLOCK),y)
|
||||
STD_CSRCS += net-timeout.c net-dsec2timeval.c net-timeval2dsec.c
|
||||
STD_CSRCS += net-timeo.c net-dsec2timeval.c net-timeval2dsec.c
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -110,7 +110,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
|
||||
|
||||
/* Verify that the socket option if valid (but might not be supported ) */
|
||||
|
||||
if (!_SO_GETVALID(option) || !value)
|
||||
if (!_SO_GETVALID(option) || !value || !value_len)
|
||||
{
|
||||
err = EINVAL;
|
||||
goto errout;
|
||||
@ -138,7 +138,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
|
||||
* that 'value' is properly aligned for an 'int'
|
||||
*/
|
||||
|
||||
if (value_len != sizeof(int))
|
||||
if (*value_len < sizeof(int))
|
||||
{
|
||||
err = EINVAL;
|
||||
goto errout;
|
||||
@ -150,8 +150,9 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
|
||||
* a macro will do.
|
||||
*/
|
||||
|
||||
optionset = psock->options;
|
||||
optionset = psock->s_options;
|
||||
*(int*)value = _SO_GETOPT(optionset, option);
|
||||
*value_len = sizeof(int);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -161,7 +162,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
|
||||
* that 'value' is properly aligned for an 'int'
|
||||
*/
|
||||
|
||||
if (value_len != sizeof(int))
|
||||
if (*value_len < sizeof(int))
|
||||
{
|
||||
err = EINVAL;
|
||||
goto errout;
|
||||
@ -170,6 +171,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
|
||||
/* Return the socket type */
|
||||
|
||||
*(int*)value = psock->s_type;
|
||||
*value_len = sizeof(int);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -185,7 +187,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
|
||||
* that 'value' is properly aligned for an 'int'
|
||||
*/
|
||||
|
||||
if (value_len != sizeof(struct timeval))
|
||||
if (*value_len < sizeof(struct timeval))
|
||||
{
|
||||
err = EINVAL;
|
||||
goto errout;
|
||||
@ -207,6 +209,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
|
||||
/* Then return the timeout value to the caller */
|
||||
|
||||
net_dsec2timeval(timeo, (struct timeval *)value);
|
||||
*value_len = sizeof(struct timeval);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -124,7 +124,7 @@ EXTERN FAR struct socket *sockfd_socket(int sockfd);
|
||||
|
||||
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
|
||||
EXTERN int net_timeo(uint32 start_time, socktimeo_t timeo);
|
||||
EXTERN socktimeo_t socktimeo_t net_timeval2dsec(struct timeval *tv);
|
||||
EXTERN socktimeo_t net_timeval2dsec(struct timeval *tv);
|
||||
EXTERN void net_dsec2timeval(uint16 dsec, struct timeval *tv);
|
||||
#endif
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
struct recvfrom_s
|
||||
{
|
||||
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
|
||||
FAR struct socket *rf_sock /* The parent socket structure */
|
||||
FAR struct socket *rf_sock; /* The parent socket structure */
|
||||
#endif
|
||||
sem_t rf_sem; /* Semaphore signals recv completion */
|
||||
sint16 rf_buflen; /* Length of receive buffer (error if <0) */
|
||||
@ -102,7 +102,7 @@ void recvfrom_interrupt(void *private)
|
||||
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
uip_conn->private = NULL;
|
||||
uip_conn->private = NULL;
|
||||
uip_conn->callback = NULL;
|
||||
|
||||
/* Wake up the waiting thread, returning the number of bytes
|
||||
@ -113,23 +113,33 @@ void recvfrom_interrupt(void *private)
|
||||
sem_post(&pstate-> rf_sem);
|
||||
}
|
||||
|
||||
/* No data has been received. If this is a poll event, then check
|
||||
* for a timeout.
|
||||
/* No data has been received -- this is some other event... probably a
|
||||
* poll -- check for a timeout.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
|
||||
else if (uip_newdata() && pstate->rf_sock)
|
||||
else if (pstate->rf_sock)
|
||||
{
|
||||
/* Check if SO_RCVTIMEO has been selected for this socket */
|
||||
|
||||
uint rcvtimeo = ;
|
||||
if (pstate->rf_sock->s_rcvtimeo)
|
||||
{
|
||||
/* Yes.. Check if the timeout has elapsed */
|
||||
|
||||
if (net_timeo(pstate->rf_starttime, pstate->rf_sock->s_rcvtimeo))
|
||||
{
|
||||
}
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
uip_conn->private = NULL;
|
||||
uip_conn->callback = NULL;
|
||||
|
||||
/* Wake up the waiting thread, returning the error -EAGAIN
|
||||
* that signals the timeout event
|
||||
*/
|
||||
|
||||
pstate->rf_buflen = -EAGAIN;
|
||||
sem_post(&pstate-> rf_sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "net-internal.h"
|
||||
|
||||
|
@ -1,10 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
/****************************************************************************
|
||||
* net/uip/psock.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* 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,12 +34,11 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: psock.c,v 1.2 2007-09-01 18:06:13 patacongo Exp $
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -1,21 +1,20 @@
|
||||
/**
|
||||
* \addtogroup uipfw
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
/****************************************************************************
|
||||
* net/uip/uip-fw.h
|
||||
* uIP packet forwarding header file.
|
||||
* \author Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* 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
|
||||
@ -37,21 +36,21 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: uip-fw.h,v 1.1.1.1 2007-08-26 23:04:07 patacongo Exp $
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIP_FW_H__
|
||||
#define __UIP_FW_H__
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <net/uip/uip.h>
|
||||
|
||||
/**
|
||||
* Representation of a uIP network interface.
|
||||
*/
|
||||
struct uip_fw_netif {
|
||||
/* Representation of a uIP network interface. */
|
||||
|
||||
struct uip_fw_netif
|
||||
{
|
||||
struct uip_fw_netif *next; /**< Pointer to the next interface when
|
||||
linked in a list. */
|
||||
uint16 ipaddr[2]; /**< The IP address of this interface. */
|
||||
|
@ -1,10 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
/****************************************************************************
|
||||
* net/uip/uip-split.h
|
||||
* Module for splitting outbound TCP segments in two to avoid the
|
||||
* delayed ACK throughput degradation.
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* 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,20 +37,9 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: uip-split.h,v 1.1.1.1 2007-08-26 23:04:08 patacongo Exp $
|
||||
*/
|
||||
/**
|
||||
* \addtogroup uip
|
||||
* @{
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* \defgroup uipsplit uIP TCP throughput booster hack
|
||||
* @{
|
||||
/* uipsplit uIP TCP throughput booster hack
|
||||
*
|
||||
* The basic uIP TCP implementation only allows each TCP connection to
|
||||
* have a single TCP segment in flight at any given time. Because of
|
||||
@ -59,15 +59,9 @@
|
||||
* to work.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Module for splitting outbound TCP segments in two to avoid the
|
||||
* delayed ACK throughput degradation.
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIP_SPLIT_H__
|
||||
#define __UIP_SPLIT_H__
|
||||
|
@ -1,21 +1,20 @@
|
||||
/**
|
||||
* \file
|
||||
/****************************************************************************
|
||||
* netutils/telnetd/shell.h
|
||||
* Interface for the Contiki shell.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*
|
||||
* Some of the functions declared in this file must be implemented as
|
||||
* a shell back-end in the architecture specific files of a Contiki
|
||||
* port.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@dunkels.com>
|
||||
* Copyright (c) 2003, 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
|
||||
@ -37,68 +36,68 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki desktop OS.
|
||||
*
|
||||
* $Id: shell.h,v 1.1.1.1 2007-08-26 23:07:06 patacongo Exp $
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* Some of the functions declared in this file must be implemented as
|
||||
* a shell back-end in the architecture specific files of a Contiki
|
||||
* port.
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_H__
|
||||
#define __SHELL_H__
|
||||
|
||||
/**
|
||||
* Initialize the shell.
|
||||
/* Initialize the shell.
|
||||
*
|
||||
* Called when the shell front-end process starts. This function may
|
||||
* be used to start listening for signals.
|
||||
*/
|
||||
|
||||
void shell_init(void);
|
||||
|
||||
/**
|
||||
* Start the shell back-end.
|
||||
/* Start the shell back-end.
|
||||
*
|
||||
* Called by the front-end when a new shell is started.
|
||||
*/
|
||||
|
||||
void shell_start(void);
|
||||
|
||||
/**
|
||||
* Process a shell command.
|
||||
/* Process a shell command.
|
||||
*
|
||||
* This function will be called by the shell GUI / telnet server whan
|
||||
* a command has been entered that should be processed by the shell
|
||||
* back-end.
|
||||
*
|
||||
* \param command The command to be processed.
|
||||
* command The command to be processed.
|
||||
*/
|
||||
|
||||
void shell_input(char *command);
|
||||
|
||||
/**
|
||||
* Quit the shell.
|
||||
*
|
||||
*/
|
||||
/* Quit the shell. */
|
||||
|
||||
void shell_quit(char *);
|
||||
|
||||
|
||||
/**
|
||||
* Print a string to the shell window.
|
||||
/* Print a string to the shell window.
|
||||
*
|
||||
* This function is implemented by the shell GUI / telnet server and
|
||||
* can be called by the shell back-end to output a string in the
|
||||
* shell window. The string is automatically appended with a linebreak.
|
||||
*
|
||||
* \param str1 The first half of the string to be output.
|
||||
* \param str2 The second half of the string to be output.
|
||||
* str1 The first half of the string to be output.
|
||||
* str2 The second half of the string to be output.
|
||||
*/
|
||||
|
||||
void shell_output(char *str1, char *str2);
|
||||
|
||||
/**
|
||||
* Print a prompt to the shell window.
|
||||
/* Print a prompt to the shell window.
|
||||
*
|
||||
* This function can be used by the shell back-end to print out a
|
||||
* prompt to the shell window.
|
||||
*
|
||||
* \param prompt The prompt to be printed.
|
||||
* prompt The prompt to be printed.
|
||||
*
|
||||
*/
|
||||
|
||||
void shell_prompt(char *prompt);
|
||||
|
||||
#endif /* __SHELL_H__ */
|
||||
|
@ -1,11 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Adam Dunkels and the Swedish Institute of
|
||||
* Computer Science.
|
||||
* All rights reserved.
|
||||
/****************************************************************************
|
||||
* netutils/uiplib/uiplib.c
|
||||
* Various uIP library functions.
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2004, Adam Dunkels and the Swedish Institute of
|
||||
* Computer Science.
|
||||
* 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
|
||||
@ -27,19 +37,17 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* $Id: uiplib.c,v 1.1.1.1 2007-08-26 23:07:05 patacongo Exp $
|
||||
*
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <net/uip/uip.h>
|
||||
|
||||
#include "uiplib.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr)
|
||||
unsigned char uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr)
|
||||
{
|
||||
unsigned char tmp;
|
||||
char c;
|
||||
@ -69,5 +77,3 @@ uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -1,18 +1,20 @@
|
||||
/**
|
||||
* \file
|
||||
/****************************************************************************
|
||||
* netutils/uiplib/uiplib.h
|
||||
* Various uIP library functions.
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2002, 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
|
||||
@ -35,37 +37,27 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* $Id: uiplib.h,v 1.1.1.1 2007-08-26 23:07:05 patacongo Exp $
|
||||
*
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIPLIB_H__
|
||||
#define __UIPLIB_H__
|
||||
|
||||
/**
|
||||
* \addtogroup uipconvfunc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert a textual representation of an IP address to a numerical representation.
|
||||
/* Convert a textual representation of an IP address to a numerical representation.
|
||||
*
|
||||
* This function takes a textual representation of an IP address in
|
||||
* the form a.b.c.d and converts it into a 4-byte array that can be
|
||||
* used by other uIP functions.
|
||||
*
|
||||
* \param addrstr A pointer to a string containing the IP address in
|
||||
* addrstr A pointer to a string containing the IP address in
|
||||
* textual form.
|
||||
*
|
||||
* \param addr A pointer to a 4-byte array that will be filled in with
|
||||
* addr A pointer to a 4-byte array that will be filled in with
|
||||
* the numerical representation of the address.
|
||||
*
|
||||
* \retval 0 If the IP address could not be parsed.
|
||||
* \retval Non-zero If the IP address was parsed.
|
||||
* Return: 0 If the IP address could not be parsed.
|
||||
* Return: Non-zero If the IP address was parsed.
|
||||
*/
|
||||
|
||||
unsigned char uiplib_ipaddrconv(char *addrstr, unsigned char *addr);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* __UIPLIB_H__ */
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* webclient.c
|
||||
/****************************************************************************
|
||||
* netutils/webclient/webclient.c
|
||||
* Implementation of the HTTP client.
|
||||
* Author: Adam Dunkels <adam@dunkels.com>
|
||||
*
|
||||
* This example shows a HTTP client that is able to download web pages
|
||||
* and files from web servers. It requires a number of callback
|
||||
* functions to be implemented by the module that utilizes the code:
|
||||
* webclient_datahandler(), webclient_connected(),
|
||||
* webclient_timedout(), webclient_aborted(), webclient_closed().
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Copyright (c) 2002, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@dunkels.com>
|
||||
* Copyright (c) 2002, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -36,12 +36,19 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: webclient.c,v 1.4 2007-09-03 23:35:17 patacongo Exp $
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This example shows a HTTP client that is able to download web pages
|
||||
* and files from web servers. It requires a number of callback
|
||||
* functions to be implemented by the module that utilizes the code:
|
||||
* webclient_datahandler(), webclient_connected(),
|
||||
* webclient_timedout(), webclient_aborted(), webclient_closed().
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,10 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
/****************************************************************************
|
||||
* netutils/webserver/httpd-fs.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* 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,12 +35,11 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: httpd-fs.c,v 1.1.1.1 2007-08-26 23:07:02 patacongo Exp $
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -49,9 +57,7 @@
|
||||
static uint16 count[HTTPD_FS_NUMFILES];
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static uint8
|
||||
httpd_fs_strcmp(const char *str1, const char *str2)
|
||||
static uint8 httpd_fs_strcmp(const char *str1, const char *str2)
|
||||
{
|
||||
uint8 i;
|
||||
i = 0;
|
||||
@ -71,9 +77,8 @@ httpd_fs_strcmp(const char *str1, const char *str2)
|
||||
++i;
|
||||
goto loop;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
|
||||
int httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
{
|
||||
#if HTTPD_FS_STATISTICS
|
||||
uint16 i = 0;
|
||||
@ -99,9 +104,8 @@ httpd_fs_open(const char *name, struct httpd_fs_file *file)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
httpd_fs_init(void)
|
||||
|
||||
void httpd_fs_init(void)
|
||||
{
|
||||
#if HTTPD_FS_STATISTICS
|
||||
uint16 i;
|
||||
@ -110,10 +114,9 @@ httpd_fs_init(void)
|
||||
}
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if HTTPD_FS_STATISTICS
|
||||
uint16 httpd_fs_count
|
||||
(char *name)
|
||||
uint16 httpd_fs_count(char *name)
|
||||
{
|
||||
struct httpd_fsdata_file_noconst *f;
|
||||
uint16 i;
|
||||
@ -131,4 +134,3 @@ uint16 httpd_fs_count
|
||||
return 0;
|
||||
}
|
||||
#endif /* HTTPD_FS_STATISTICS */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -1,6 +1,14 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
/****************************************************************************
|
||||
* netutils/webserver/httpd-fsdata.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -26,15 +34,15 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: httpd-fsdata.h,v 1.1.1.1 2007-08-26 23:07:04 patacongo Exp $
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __HTTPD_FSDATA_H__
|
||||
#define __HTTPD_FSDATA_H__
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <net/uip/uip.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user