My fork of the HTTPServer (working)
Core/lwIP/netif/loopif.c@0:7a64fbb4069d, 2012-08-06 (annotated)
- Committer:
- screamer
- Date:
- Mon Aug 06 09:23:14 2012 +0000
- Revision:
- 0:7a64fbb4069d
[mbed] converted /DGWWebServer/HTTPServer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
screamer | 0:7a64fbb4069d | 1 | /** |
screamer | 0:7a64fbb4069d | 2 | * @file |
screamer | 0:7a64fbb4069d | 3 | * Loop Interface |
screamer | 0:7a64fbb4069d | 4 | * |
screamer | 0:7a64fbb4069d | 5 | */ |
screamer | 0:7a64fbb4069d | 6 | |
screamer | 0:7a64fbb4069d | 7 | /* |
screamer | 0:7a64fbb4069d | 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
screamer | 0:7a64fbb4069d | 9 | * All rights reserved. |
screamer | 0:7a64fbb4069d | 10 | * |
screamer | 0:7a64fbb4069d | 11 | * Redistribution and use in source and binary forms, with or without modification, |
screamer | 0:7a64fbb4069d | 12 | * are permitted provided that the following conditions are met: |
screamer | 0:7a64fbb4069d | 13 | * |
screamer | 0:7a64fbb4069d | 14 | * 1. Redistributions of source code must retain the above copyright notice, |
screamer | 0:7a64fbb4069d | 15 | * this list of conditions and the following disclaimer. |
screamer | 0:7a64fbb4069d | 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
screamer | 0:7a64fbb4069d | 17 | * this list of conditions and the following disclaimer in the documentation |
screamer | 0:7a64fbb4069d | 18 | * and/or other materials provided with the distribution. |
screamer | 0:7a64fbb4069d | 19 | * 3. The name of the author may not be used to endorse or promote products |
screamer | 0:7a64fbb4069d | 20 | * derived from this software without specific prior written permission. |
screamer | 0:7a64fbb4069d | 21 | * |
screamer | 0:7a64fbb4069d | 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
screamer | 0:7a64fbb4069d | 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
screamer | 0:7a64fbb4069d | 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
screamer | 0:7a64fbb4069d | 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
screamer | 0:7a64fbb4069d | 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
screamer | 0:7a64fbb4069d | 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
screamer | 0:7a64fbb4069d | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
screamer | 0:7a64fbb4069d | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
screamer | 0:7a64fbb4069d | 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
screamer | 0:7a64fbb4069d | 31 | * OF SUCH DAMAGE. |
screamer | 0:7a64fbb4069d | 32 | * |
screamer | 0:7a64fbb4069d | 33 | * This file is part of the lwIP TCP/IP stack. |
screamer | 0:7a64fbb4069d | 34 | * |
screamer | 0:7a64fbb4069d | 35 | * Author: Adam Dunkels <adam@sics.se> |
screamer | 0:7a64fbb4069d | 36 | * |
screamer | 0:7a64fbb4069d | 37 | */ |
screamer | 0:7a64fbb4069d | 38 | #include "lwip/opt.h" |
screamer | 0:7a64fbb4069d | 39 | |
screamer | 0:7a64fbb4069d | 40 | #if LWIP_HAVE_LOOPIF |
screamer | 0:7a64fbb4069d | 41 | |
screamer | 0:7a64fbb4069d | 42 | #include "netif/loopif.h" |
screamer | 0:7a64fbb4069d | 43 | #include "lwip/snmp.h" |
screamer | 0:7a64fbb4069d | 44 | |
screamer | 0:7a64fbb4069d | 45 | /** |
screamer | 0:7a64fbb4069d | 46 | * Initialize a lwip network interface structure for a loopback interface |
screamer | 0:7a64fbb4069d | 47 | * |
screamer | 0:7a64fbb4069d | 48 | * @param netif the lwip network interface structure for this loopif |
screamer | 0:7a64fbb4069d | 49 | * @return ERR_OK if the loopif is initialized |
screamer | 0:7a64fbb4069d | 50 | * ERR_MEM if private data couldn't be allocated |
screamer | 0:7a64fbb4069d | 51 | */ |
screamer | 0:7a64fbb4069d | 52 | err_t |
screamer | 0:7a64fbb4069d | 53 | loopif_init(struct netif *netif) |
screamer | 0:7a64fbb4069d | 54 | { |
screamer | 0:7a64fbb4069d | 55 | /* initialize the snmp variables and counters inside the struct netif |
screamer | 0:7a64fbb4069d | 56 | * ifSpeed: no assumption can be made! |
screamer | 0:7a64fbb4069d | 57 | */ |
screamer | 0:7a64fbb4069d | 58 | NETIF_INIT_SNMP(netif, snmp_ifType_softwareLoopback, 0); |
screamer | 0:7a64fbb4069d | 59 | |
screamer | 0:7a64fbb4069d | 60 | netif->name[0] = 'l'; |
screamer | 0:7a64fbb4069d | 61 | netif->name[1] = 'o'; |
screamer | 0:7a64fbb4069d | 62 | netif->output = netif_loop_output; |
screamer | 0:7a64fbb4069d | 63 | return ERR_OK; |
screamer | 0:7a64fbb4069d | 64 | } |
screamer | 0:7a64fbb4069d | 65 | |
screamer | 0:7a64fbb4069d | 66 | #endif /* LWIP_HAVE_LOOPIF */ |