| 1 | /* |
| 2 | * Copyright (C) 2000 Lennert Buytenhek |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; either version 2 of the |
| 7 | * License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef _LIBBRIDGE_H |
| 20 | #define _LIBBRIDGE_H |
| 21 | |
| 22 | #include <sys/socket.h> |
| 23 | #include <linux/if.h> |
| 24 | #include <linux/if_bridge.h> |
| 25 | |
| 26 | /* defined in net/if.h but that conflicts with linux/if.h... */ |
| 27 | extern unsigned int if_nametoindex (const char *__ifname); |
| 28 | extern char *if_indextoname (unsigned int __ifindex, char *__ifname); |
| 29 | |
| 30 | struct bridge_id |
| 31 | { |
| 32 | unsigned char prio[2]; |
| 33 | unsigned char addr[6]; |
| 34 | }; |
| 35 | |
| 36 | struct bridge_info |
| 37 | { |
| 38 | struct bridge_id designated_root; |
| 39 | struct bridge_id bridge_id; |
| 40 | unsigned root_path_cost; |
| 41 | struct timeval max_age; |
| 42 | struct timeval hello_time; |
| 43 | struct timeval forward_delay; |
| 44 | struct timeval bridge_max_age; |
| 45 | struct timeval bridge_hello_time; |
| 46 | struct timeval bridge_forward_delay; |
| 47 | u_int16_t root_port; |
| 48 | unsigned char stp_enabled; |
| 49 | unsigned char topology_change; |
| 50 | unsigned char topology_change_detected; |
| 51 | struct timeval ageing_time; |
| 52 | struct timeval hello_timer_value; |
| 53 | struct timeval tcn_timer_value; |
| 54 | struct timeval topology_change_timer_value; |
| 55 | struct timeval gc_timer_value; |
| 56 | }; |
| 57 | |
| 58 | struct fdb_entry |
| 59 | { |
| 60 | u_int8_t mac_addr[6]; |
| 61 | u_int16_t port_no; |
| 62 | unsigned char is_local; |
| 63 | struct timeval ageing_timer_value; |
| 64 | }; |
| 65 | |
| 66 | struct port_info |
| 67 | { |
| 68 | unsigned port_no; |
| 69 | struct bridge_id designated_root; |
| 70 | struct bridge_id designated_bridge; |
| 71 | u_int16_t port_id; |
| 72 | u_int16_t designated_port; |
| 73 | u_int8_t priority; |
| 74 | unsigned char top_change_ack; |
| 75 | unsigned char config_pending; |
| 76 | unsigned char state; |
| 77 | unsigned path_cost; |
| 78 | unsigned designated_cost; |
| 79 | struct timeval message_age_timer_value; |
| 80 | struct timeval forward_delay_timer_value; |
| 81 | struct timeval hold_timer_value; |
| 82 | }; |
| 83 | |
| 84 | #endif |
| 85 | |