1*5d5fbe79SDavid van Moolenbroek /** 2*5d5fbe79SDavid van Moolenbroek * @file 3*5d5fbe79SDavid van Moolenbroek * Ethernet input function - handles INCOMING ethernet level traffic 4*5d5fbe79SDavid van Moolenbroek * To be used in most low-level netif implementations 5*5d5fbe79SDavid van Moolenbroek */ 6*5d5fbe79SDavid van Moolenbroek 7*5d5fbe79SDavid van Moolenbroek /* 8*5d5fbe79SDavid van Moolenbroek * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 9*5d5fbe79SDavid van Moolenbroek * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv> 10*5d5fbe79SDavid van Moolenbroek * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands. 11*5d5fbe79SDavid van Moolenbroek * All rights reserved. 12*5d5fbe79SDavid van Moolenbroek * 13*5d5fbe79SDavid van Moolenbroek * Redistribution and use in source and binary forms, with or without modification, 14*5d5fbe79SDavid van Moolenbroek * are permitted provided that the following conditions are met: 15*5d5fbe79SDavid van Moolenbroek * 16*5d5fbe79SDavid van Moolenbroek * 1. Redistributions of source code must retain the above copyright notice, 17*5d5fbe79SDavid van Moolenbroek * this list of conditions and the following disclaimer. 18*5d5fbe79SDavid van Moolenbroek * 2. Redistributions in binary form must reproduce the above copyright notice, 19*5d5fbe79SDavid van Moolenbroek * this list of conditions and the following disclaimer in the documentation 20*5d5fbe79SDavid van Moolenbroek * and/or other materials provided with the distribution. 21*5d5fbe79SDavid van Moolenbroek * 3. The name of the author may not be used to endorse or promote products 22*5d5fbe79SDavid van Moolenbroek * derived from this software without specific prior written permission. 23*5d5fbe79SDavid van Moolenbroek * 24*5d5fbe79SDavid van Moolenbroek * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25*5d5fbe79SDavid van Moolenbroek * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26*5d5fbe79SDavid van Moolenbroek * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27*5d5fbe79SDavid van Moolenbroek * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28*5d5fbe79SDavid van Moolenbroek * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29*5d5fbe79SDavid van Moolenbroek * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30*5d5fbe79SDavid van Moolenbroek * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31*5d5fbe79SDavid van Moolenbroek * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32*5d5fbe79SDavid van Moolenbroek * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33*5d5fbe79SDavid van Moolenbroek * OF SUCH DAMAGE. 34*5d5fbe79SDavid van Moolenbroek * 35*5d5fbe79SDavid van Moolenbroek * This file is part of the lwIP TCP/IP stack. 36*5d5fbe79SDavid van Moolenbroek * 37*5d5fbe79SDavid van Moolenbroek * Author: Adam Dunkels <adam@sics.se> 38*5d5fbe79SDavid van Moolenbroek * 39*5d5fbe79SDavid van Moolenbroek */ 40*5d5fbe79SDavid van Moolenbroek 41*5d5fbe79SDavid van Moolenbroek #ifndef LWIP_HDR_NETIF_ETHERNET_H 42*5d5fbe79SDavid van Moolenbroek #define LWIP_HDR_NETIF_ETHERNET_H 43*5d5fbe79SDavid van Moolenbroek 44*5d5fbe79SDavid van Moolenbroek #include "lwip/opt.h" 45*5d5fbe79SDavid van Moolenbroek 46*5d5fbe79SDavid van Moolenbroek #include "lwip/pbuf.h" 47*5d5fbe79SDavid van Moolenbroek #include "lwip/netif.h" 48*5d5fbe79SDavid van Moolenbroek #include "lwip/prot/ethernet.h" 49*5d5fbe79SDavid van Moolenbroek 50*5d5fbe79SDavid van Moolenbroek #ifdef __cplusplus 51*5d5fbe79SDavid van Moolenbroek extern "C" { 52*5d5fbe79SDavid van Moolenbroek #endif 53*5d5fbe79SDavid van Moolenbroek 54*5d5fbe79SDavid van Moolenbroek #if LWIP_ARP || LWIP_ETHERNET 55*5d5fbe79SDavid van Moolenbroek 56*5d5fbe79SDavid van Moolenbroek /** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type) 57*5d5fbe79SDavid van Moolenbroek * to a filter function that returns the correct netif when using multiple 58*5d5fbe79SDavid van Moolenbroek * netifs on one hardware interface where the netif's low-level receive 59*5d5fbe79SDavid van Moolenbroek * routine cannot decide for the correct netif (e.g. when mapping multiple 60*5d5fbe79SDavid van Moolenbroek * IP addresses to one hardware interface). 61*5d5fbe79SDavid van Moolenbroek */ 62*5d5fbe79SDavid van Moolenbroek #ifndef LWIP_ARP_FILTER_NETIF 63*5d5fbe79SDavid van Moolenbroek #define LWIP_ARP_FILTER_NETIF 0 64*5d5fbe79SDavid van Moolenbroek #endif 65*5d5fbe79SDavid van Moolenbroek 66*5d5fbe79SDavid van Moolenbroek err_t ethernet_input(struct pbuf *p, struct netif *netif); 67*5d5fbe79SDavid van Moolenbroek err_t ethernet_output(struct netif* netif, struct pbuf* p, const struct eth_addr* src, const struct eth_addr* dst, u16_t eth_type); 68*5d5fbe79SDavid van Moolenbroek 69*5d5fbe79SDavid van Moolenbroek extern const struct eth_addr ethbroadcast, ethzero; 70*5d5fbe79SDavid van Moolenbroek 71*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_ARP || LWIP_ETHERNET */ 72*5d5fbe79SDavid van Moolenbroek 73*5d5fbe79SDavid van Moolenbroek #ifdef __cplusplus 74*5d5fbe79SDavid van Moolenbroek } 75*5d5fbe79SDavid van Moolenbroek #endif 76*5d5fbe79SDavid van Moolenbroek 77*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_HDR_NETIF_ETHERNET_H */ 78