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#include <stdio.h> 20#include <stdlib.h> 21#include <string.h> 22#include <sys/time.h> 23#include <asm/param.h> 24#include "libbridge.h" 25#include "libbridge_private.h" 26 27 28static const char *state_names[5] = { 29 [BR_STATE_DISABLED] = "disabled", 30 [BR_STATE_LISTENING] = "listening", 31 [BR_STATE_LEARNING] = "learning", 32 [BR_STATE_FORWARDING] = "forwarding", 33 [BR_STATE_BLOCKING] = "blocking", 34}; 35 36const char *br_get_state_name(int state) 37{ 38 if (state >= 0 && state <= 4) 39 return state_names[state]; 40 41 return "<INVALID STATE>"; 42} 43 44int __br_hz_internal; 45 46int __get_hz(void) 47{ 48 const char * s = getenv("HZ"); 49 return s ? atoi(s) : HZ; 50} 51