00001 /* 00002 * White Rabbit RTU (Routing Table Unit) 00003 * Copyright (C) 2010, CERN. 00004 * 00005 * Version: wrsw_rtud v0.1 11/15/2010 00006 * 00007 * Authors: Juan Luis Manas (juan.manas@integrasys.es) 00008 * Based on code by Maciej Lipinski 00009 * (maciej.lipinski@cern.ch) - CERN BE-CO-HT 00010 * 00011 * Description: RTU Filtering Database Entry Object header. 00012 * 00013 * Fixes: 00014 * 00015 * 00016 * This program is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU General Public License 00018 * as published by the Free Software Foundation; either version 00019 * 2 of the License, or (at your option) any later version. 00020 * 00021 * This program is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU General Public License 00027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00028 */ 00029 00030 00031 #ifndef __WHITERABBIT_RTU_FE_H 00032 #define __WHITERABBIT_RTU_FE_H 00033 00034 #include <stdint.h> 00035 #include "mac.h" 00036 00037 //--------------------------------------------- 00038 // Data Types 00039 //--------------------------------------------- 00040 00041 typedef struct { 00042 int valid; // bit: 1 = entry is valid, 0: entry is 00043 // invalid (empty) 00044 int end_of_bucket; // bit: 1 = last entry in current bucket, stop 00045 // search at this point 00046 int is_bpdu; // bit: 1 = BPDU (or other non-STP-dependent 00047 // packet) 00048 00049 mac_addr_t mac; // MAC address (for searching the bucketed 00050 // hashtable) 00051 uint8_t fid; // Filtering database ID (for searching the 00052 // bucketed hashtable) 00053 00054 uint32_t port_mask_src; // port mask for source MAC addresses. Bits 00055 // set to 1 indicate that packet having this 00056 // MAC address can be forwarded from these 00057 // corresponding ports. Ports having their 00058 // bits set to 0 shall drop the packet. 00059 00060 uint32_t port_mask_dst; // port mask for destination MAC address. Bits 00061 // set to 1 indicate to which physical ports 00062 // the packet with matching destination MAC 00063 // address shall be routed 00064 00065 int drop_when_source; // bit: 1 = drop the packet when source 00066 // address matches 00067 int drop_when_dest; // bit: 1 = drop the packet when destination 00068 // address matches 00069 int drop_unmatched_src_ports; // bit: 1 = drop the packet when it comes from 00070 // source port different than specified in 00071 // port_mask_src 00072 00073 uint32_t last_access_t; // time of last access to the rule (for aging) 00074 00075 uint8_t prio_src; // priority (src MAC) 00076 int has_prio_src; // priority value valid 00077 int prio_override_src; // priority override (force per-MAC priority) 00078 00079 uint8_t prio_dst; // priority (dst MAC) 00080 int has_prio_dst; // priority value valid 00081 int prio_override_dst; // priority override (force per-MAC priority) 00082 00083 int go_to_cam; // 1 : there are more entries outside the 00084 // bucket 00085 00086 uint16_t cam_addr; // address of the first entry in CAM memory 00087 // (2 words) 00088 } filtering_entry_t; 00089 00090 00091 //--------------------------------------------- 00092 // Methods 00093 //--------------------------------------------- 00094 00095 void rtu_fe_copy_data(filtering_entry_t* dst, filtering_entry_t* src); 00096 00097 void rtu_fe_clean(filtering_entry_t* ent); 00098 00099 #endif /*__WHITERABBIT_RTU_FE_H*/ 00100 00101