check_is_pppoe ()
{
	if  [ -z $1 ]; then
		return 1;
	fi

	/bin/grep pppoe /proc/$1/cmdline  > /dev/null 2>&1
	if [ 0 -eq $? ]; then
		return 0;
	fi

	return 1;
}

check_is_usbmodem ()
{
	local IPPARAM="$1"
	local PEERWVDIAL_PATH='/etc/ppp/peers/wvdial'

	# if this ppp called wvdial, it will pass addition parameter
	if [ -z $IPPARAM ]; then
		return 0
	fi

	# if file is not readable
	if [ ! -r $PEERWVDIAL_PATH ]; then
		return 0
	fi

	# the parameter should same as ipparam in wvdial
	local WVDIAL_IPPARAM=`grep ipparam $PEERWVDIAL_PATH | cut -d' ' -f2`
	if [ "x$WVDIAL_IPPARAM" != "x$IPPARAM" ]; then
		return 0
	fi

	return 1
}

check_is_vpnclient_pptp ()
{
	if  [ -z $1 ]; then
		return 1;
	fi

	/bin/grep connect_p /proc/$1/cmdline  > /dev/null 2>&1
	if [ 0 -eq $? ]; then
		return 0;
	fi

	return 1;
}

check_is_vpnclient_l2tp ()
{
	if  [ -z $1 ]; then
		return 1;
	fi

	/bin/grep synovpnclient /proc/$1/cmdline  > /dev/null 2>&1
	if [ 0 -eq $? ]; then
		return 0;
	fi

	return 1;
}

check_is_client_of_vpnserver ()
{
	if  [ -z "$1" ]; then
		return 1;
	fi

	if [ "${1}" = "ppp200" ] || [ "${1}" = "ppp300" ]; then
		return 1;
	fi

	if [ "${1#ppp*}" -lt 200 ]; then
		return 1;
	fi

	return 0;
}
