
#-----------------------------------------------------------------------
# Copyright (C) 2000-2001, Jean-Sebastien Morisset <jsmoriss@mvlan.net>
#-----------------------------------------------------------------------
# $Id: match_interface.sh,v 1.4 2001/08/11 17:01:20 jsmoriss Exp $
#-----------------------------------------------------------------------
#  $RCSfile: match_interface.sh,v $
#   $Author: jsmoriss $
# $Revision: 1.4 $
#     $Date: 2001/08/11 17:01:20 $
#   $Locker:  $ 
#     $Name:  $
#-----------------------------------------------------------------------
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by 
# the Free Software Foundation <http://www.gnu.org/copyleft/gpl.txt>.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License (LICENSE file in archive) for more details.
#
#-----------------------------------------------------------------------
# README
#-----------------------------------------------------------------------
#
# Function returns the interface name if it is in the TYPE_INTERFACES
# variable. Calling Syntax is: Match_Interface {type} {interface}
#
#-----------------------------------------------------------------------
# FUNCTION
#-----------------------------------------------------------------------

Match_Interface () {
	if [ "$2" ]
	then
		interface_type="`echo ${1}|To_Upper`"
		eval interfaces=\"\$${interface_type}_INTERFACES\"

		case $interface_type in
			LO|PUBLIC|DMZ|PRIVATE|MZ|REFRESH|ALL)
				echo $interfaces | grep -i "\(^\| \)${2}\( \|$\)" ;;
			*)
				echo "Match_Interface: Invalid Type: $interface_type" >&2 ;;
		esac
		unset interface_type interfaces
	fi
}

