My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

Committer:
screamer
Date:
Tue Nov 20 12:18:53 2012 +0000
Revision:
1:284f2df30cf9
Parent:
0:7a64fbb4069d
local changes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:7a64fbb4069d 1 /*
screamer 0:7a64fbb4069d 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
screamer 0:7a64fbb4069d 3 * All rights reserved.
screamer 0:7a64fbb4069d 4 *
screamer 0:7a64fbb4069d 5 * Redistribution and use in source and binary forms, with or without modification,
screamer 0:7a64fbb4069d 6 * are permitted provided that the following conditions are met:
screamer 0:7a64fbb4069d 7 *
screamer 0:7a64fbb4069d 8 * 1. Redistributions of source code must retain the above copyright notice,
screamer 0:7a64fbb4069d 9 * this list of conditions and the following disclaimer.
screamer 0:7a64fbb4069d 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
screamer 0:7a64fbb4069d 11 * this list of conditions and the following disclaimer in the documentation
screamer 0:7a64fbb4069d 12 * and/or other materials provided with the distribution.
screamer 0:7a64fbb4069d 13 * 3. The name of the author may not be used to endorse or promote products
screamer 0:7a64fbb4069d 14 * derived from this software without specific prior written permission.
screamer 0:7a64fbb4069d 15 *
screamer 0:7a64fbb4069d 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
screamer 0:7a64fbb4069d 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
screamer 0:7a64fbb4069d 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
screamer 0:7a64fbb4069d 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
screamer 0:7a64fbb4069d 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
screamer 0:7a64fbb4069d 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
screamer 0:7a64fbb4069d 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
screamer 0:7a64fbb4069d 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
screamer 0:7a64fbb4069d 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
screamer 0:7a64fbb4069d 25 * OF SUCH DAMAGE.
screamer 0:7a64fbb4069d 26 *
screamer 0:7a64fbb4069d 27 * This file is part of the lwIP TCP/IP stack.
screamer 0:7a64fbb4069d 28 *
screamer 0:7a64fbb4069d 29 * Author: Adam Dunkels <adam@sics.se>
screamer 0:7a64fbb4069d 30 *
screamer 0:7a64fbb4069d 31 */
screamer 0:7a64fbb4069d 32 #ifndef __LWIP_TCPIP_H__
screamer 0:7a64fbb4069d 33 #define __LWIP_TCPIP_H__
screamer 0:7a64fbb4069d 34
screamer 0:7a64fbb4069d 35 #include "lwip/opt.h"
screamer 0:7a64fbb4069d 36
screamer 0:7a64fbb4069d 37 #if !NO_SYS /* don't build if not configured for use in lwipopts.h */
screamer 0:7a64fbb4069d 38
screamer 0:7a64fbb4069d 39 #include "lwip/api_msg.h"
screamer 0:7a64fbb4069d 40 #include "lwip/netifapi.h"
screamer 0:7a64fbb4069d 41 #include "lwip/pbuf.h"
screamer 0:7a64fbb4069d 42 #include "lwip/api.h"
screamer 0:7a64fbb4069d 43 #include "lwip/sys.h"
screamer 0:7a64fbb4069d 44
screamer 0:7a64fbb4069d 45 #ifdef __cplusplus
screamer 0:7a64fbb4069d 46 extern "C" {
screamer 0:7a64fbb4069d 47 #endif
screamer 0:7a64fbb4069d 48
screamer 0:7a64fbb4069d 49 #if LWIP_TCPIP_CORE_LOCKING
screamer 0:7a64fbb4069d 50 /** The global semaphore to lock the stack. */
screamer 0:7a64fbb4069d 51 extern sys_sem_t lock_tcpip_core;
screamer 0:7a64fbb4069d 52 #define LOCK_TCPIP_CORE() sys_sem_wait(lock_tcpip_core)
screamer 0:7a64fbb4069d 53 #define UNLOCK_TCPIP_CORE() sys_sem_signal(lock_tcpip_core)
screamer 0:7a64fbb4069d 54 #define TCPIP_APIMSG(m) tcpip_apimsg_lock(m)
screamer 0:7a64fbb4069d 55 #define TCPIP_APIMSG_ACK(m)
screamer 0:7a64fbb4069d 56 #define TCPIP_NETIFAPI(m) tcpip_netifapi_lock(m)
screamer 0:7a64fbb4069d 57 #define TCPIP_NETIFAPI_ACK(m)
screamer 0:7a64fbb4069d 58 #else
screamer 0:7a64fbb4069d 59 #define LOCK_TCPIP_CORE()
screamer 0:7a64fbb4069d 60 #define UNLOCK_TCPIP_CORE()
screamer 0:7a64fbb4069d 61 #define TCPIP_APIMSG(m) tcpip_apimsg(m)
screamer 0:7a64fbb4069d 62 #define TCPIP_APIMSG_ACK(m) sys_sem_signal(m->conn->op_completed)
screamer 0:7a64fbb4069d 63 #define TCPIP_NETIFAPI(m) tcpip_netifapi(m)
screamer 0:7a64fbb4069d 64 #define TCPIP_NETIFAPI_ACK(m) sys_sem_signal(m->sem)
screamer 0:7a64fbb4069d 65 #endif /* LWIP_TCPIP_CORE_LOCKING */
screamer 0:7a64fbb4069d 66
screamer 0:7a64fbb4069d 67 void tcpip_init(void (* tcpip_init_done)(void *), void *arg);
screamer 0:7a64fbb4069d 68
screamer 0:7a64fbb4069d 69 #if LWIP_NETCONN
screamer 0:7a64fbb4069d 70 err_t tcpip_apimsg(struct api_msg *apimsg);
screamer 0:7a64fbb4069d 71 #if LWIP_TCPIP_CORE_LOCKING
screamer 0:7a64fbb4069d 72 err_t tcpip_apimsg_lock(struct api_msg *apimsg);
screamer 0:7a64fbb4069d 73 #endif /* LWIP_TCPIP_CORE_LOCKING */
screamer 0:7a64fbb4069d 74 #endif /* LWIP_NETCONN */
screamer 0:7a64fbb4069d 75
screamer 0:7a64fbb4069d 76 err_t tcpip_input(struct pbuf *p, struct netif *inp);
screamer 0:7a64fbb4069d 77
screamer 0:7a64fbb4069d 78 #if LWIP_NETIF_API
screamer 0:7a64fbb4069d 79 err_t tcpip_netifapi(struct netifapi_msg *netifapimsg);
screamer 0:7a64fbb4069d 80 #if LWIP_TCPIP_CORE_LOCKING
screamer 0:7a64fbb4069d 81 err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg);
screamer 0:7a64fbb4069d 82 #endif /* LWIP_TCPIP_CORE_LOCKING */
screamer 0:7a64fbb4069d 83 #endif /* LWIP_NETIF_API */
screamer 0:7a64fbb4069d 84
screamer 0:7a64fbb4069d 85 err_t tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block);
screamer 0:7a64fbb4069d 86 #define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1)
screamer 0:7a64fbb4069d 87
screamer 0:7a64fbb4069d 88 /* free pbufs or heap memory from another context without blocking */
screamer 0:7a64fbb4069d 89 err_t pbuf_free_callback(struct pbuf *p);
screamer 0:7a64fbb4069d 90 err_t mem_free_callback(void *m);
screamer 0:7a64fbb4069d 91
screamer 0:7a64fbb4069d 92 err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
screamer 0:7a64fbb4069d 93 err_t tcpip_untimeout(u32_t msecs, sys_timeout_handler h, void *arg);
screamer 0:7a64fbb4069d 94
screamer 0:7a64fbb4069d 95 enum tcpip_msg_type {
screamer 0:7a64fbb4069d 96 #if LWIP_NETCONN
screamer 0:7a64fbb4069d 97 TCPIP_MSG_API,
screamer 0:7a64fbb4069d 98 #endif /* LWIP_NETCONN */
screamer 0:7a64fbb4069d 99 TCPIP_MSG_INPKT,
screamer 0:7a64fbb4069d 100 #if LWIP_NETIF_API
screamer 0:7a64fbb4069d 101 TCPIP_MSG_NETIFAPI,
screamer 0:7a64fbb4069d 102 #endif /* LWIP_NETIF_API */
screamer 0:7a64fbb4069d 103 TCPIP_MSG_CALLBACK,
screamer 0:7a64fbb4069d 104 TCPIP_MSG_TIMEOUT,
screamer 0:7a64fbb4069d 105 TCPIP_MSG_UNTIMEOUT
screamer 0:7a64fbb4069d 106 };
screamer 0:7a64fbb4069d 107
screamer 0:7a64fbb4069d 108 struct tcpip_msg {
screamer 0:7a64fbb4069d 109 enum tcpip_msg_type type;
screamer 0:7a64fbb4069d 110 sys_sem_t *sem;
screamer 0:7a64fbb4069d 111 union {
screamer 0:7a64fbb4069d 112 #if LWIP_NETCONN
screamer 0:7a64fbb4069d 113 struct api_msg *apimsg;
screamer 0:7a64fbb4069d 114 #endif /* LWIP_NETCONN */
screamer 0:7a64fbb4069d 115 #if LWIP_NETIF_API
screamer 0:7a64fbb4069d 116 struct netifapi_msg *netifapimsg;
screamer 0:7a64fbb4069d 117 #endif /* LWIP_NETIF_API */
screamer 0:7a64fbb4069d 118 struct {
screamer 0:7a64fbb4069d 119 struct pbuf *p;
screamer 0:7a64fbb4069d 120 struct netif *netif;
screamer 0:7a64fbb4069d 121 } inp;
screamer 0:7a64fbb4069d 122 struct {
screamer 0:7a64fbb4069d 123 void (*f)(void *ctx);
screamer 0:7a64fbb4069d 124 void *ctx;
screamer 0:7a64fbb4069d 125 } cb;
screamer 0:7a64fbb4069d 126 struct {
screamer 0:7a64fbb4069d 127 u32_t msecs;
screamer 0:7a64fbb4069d 128 sys_timeout_handler h;
screamer 0:7a64fbb4069d 129 void *arg;
screamer 0:7a64fbb4069d 130 } tmo;
screamer 0:7a64fbb4069d 131 } msg;
screamer 0:7a64fbb4069d 132 };
screamer 0:7a64fbb4069d 133
screamer 0:7a64fbb4069d 134 #ifdef __cplusplus
screamer 0:7a64fbb4069d 135 }
screamer 0:7a64fbb4069d 136 #endif
screamer 0:7a64fbb4069d 137
screamer 0:7a64fbb4069d 138 #endif /* !NO_SYS */
screamer 0:7a64fbb4069d 139
screamer 0:7a64fbb4069d 140 #endif /* __LWIP_TCPIP_H__ */