00001 00012 /* 00013 * Copyright (c) 2004, Swedish Institute of Computer Science. 00014 * All rights reserved. 00015 * 00016 * Redistribution and use in source and binary forms, with or without 00017 * modification, are permitted provided that the following conditions 00018 * are met: 00019 * 1. Redistributions of source code must retain the above copyright 00020 * notice, this list of conditions and the following disclaimer. 00021 * 2. Redistributions in binary form must reproduce the above copyright 00022 * notice, this list of conditions and the following disclaimer in the 00023 * documentation and/or other materials provided with the distribution. 00024 * 3. Neither the name of the Institute nor the names of its contributors 00025 * may be used to endorse or promote products derived from this software 00026 * without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 00029 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00030 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00031 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 00032 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00033 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00034 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00035 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00036 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00037 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00038 * SUCH DAMAGE. 00039 * 00040 * This file is part of the uIP TCP/IP stack 00041 * 00042 * Author: Adam Dunkels <adam@sics.se> 00043 * 00044 * $Id: uip-fw.h,v 1.2 2006/06/12 08:00:30 adam Exp $ 00045 */ 00046 #ifndef __UIP_FW_H__ 00047 #define __UIP_FW_H__ 00048 00049 #include "uip.h" 00050 00054 struct uip_fw_netif { 00055 struct uip_fw_netif *next; 00057 u16_t ipaddr[2]; 00058 u16_t netmask[2]; 00059 u8_t (* output)(void); 00062 }; 00063 00080 #define UIP_FW_NETIF(ip1,ip2,ip3,ip4, nm1,nm2,nm3,nm4, outputfunc) \ 00081 NULL, \ 00082 {HTONS((ip1 << 8) | ip2), HTONS((ip3 << 8) | ip4)}, \ 00083 {HTONS((nm1 << 8) | nm2), HTONS((nm3 << 8) | nm4)}, \ 00084 outputfunc 00085 00095 #define uip_fw_setipaddr(netif, addr) \ 00096 do { (netif)->ipaddr[0] = ((u16_t *)(addr))[0]; \ 00097 (netif)->ipaddr[1] = ((u16_t *)(addr))[1]; } while(0) 00098 00107 #define uip_fw_setnetmask(netif, addr) \ 00108 do { (netif)->netmask[0] = ((u16_t *)(addr))[0]; \ 00109 (netif)->netmask[1] = ((u16_t *)(addr))[1]; } while(0) 00110 00111 void uip_fw_init(void); 00112 u8_t uip_fw_forward(void); 00113 u8_t uip_fw_output(void); 00114 void uip_fw_register(struct uip_fw_netif *netif); 00115 void uip_fw_default(struct uip_fw_netif *netif); 00116 void uip_fw_periodic(void); 00117 00118 00125 #define UIP_FW_LOCAL 0 00126 00132 #define UIP_FW_OK 0 00133 00139 #define UIP_FW_FORWARDED 1 00140 00147 #define UIP_FW_ZEROLEN 2 00148 00155 #define UIP_FW_TOOLARGE 3 00156 00163 #define UIP_FW_NOROUTE 4 00164 00171 #define UIP_FW_DROPPED 5 00172 00173 00174 #endif /* __UIP_FW_H__ */ 00175