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