4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai/************************************************************************
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Copyright (C) 2001-2003 Optical Access
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Author: Alex Rozin
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai *
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * This file is part of RSTP library.
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai *
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * RSTP library is free software; you can redistribute it and/or modify it
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * under the terms of the GNU Lesser General Public License as published by the
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Free Software Foundation; version 2.1
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai *
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * RSTP library is distributed in the hope that it will be useful, but
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * WITHOUT ANY WARRANTY; without even the implied warranty of
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * General Public License for more details.
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai *
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * You should have received a copy of the GNU Lesser General Public License
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * along with RSTP library; see the file COPYING. If not, write to the Free
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai * 02111-1307, USA.
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai **********************************************************************/
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#ifndef _STP_CHOOSE_H__
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#define _STP_CHOOSE_H__
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai/* State machines states & debug tools. Sorry, if these are no readable enogth :( */
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#define CHOOSE(a) a
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavaitypedef enum STATES THE_STATE_T;
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#undef CHOOSE
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavaichar * GET_STATE_NAME (int state)
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai{
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#define CHOOSE(a) #a
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavaistatic char *state_names[] = STATES;
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#undef CHOOSE
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai if (BEGIN == state) return "Begin";
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai return state_names[state];
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai}
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai
4eaa471005973e11a6110b69fe990530b3b95a38Rishi Srivatsavai#endif /* _STP_CHOOSE_H__ */