#!/bin/sh
#This script is created by ssparser automatically. The parser first created by MaoShouyan
printf "Content-type: text/html;charset=gb2312
Cache-Control: no-cache

"
echo -n "";
if [ -f ${RAMDISK}/PG.conf ]; then
        . ${RAMDISK}/PG.conf
        PGPATH="${RAMDISK}"
else
        . /etc/PG.conf
fi
FLOWEYE=${PGPATH}/bin/floweye
firstelem=1
printf "["
${FLOWEYE} nat listproxy type=routerif.proxy.pppoe | while read type id name f4 addr gateway dnsaddr vlan \
gatewaymac flowcnt ttl f12 f13 inbps outbps dnsreqs dnsfail linkup theothers
do
	if [ "${type}" = "rtif" ]; then
		linkup=${f4}
		inbps="${f12}"
		outbps="${f13}"
		dnsreq="0"
		dnsfail="0"
		flowcnt="0"
	fi
	if [ ${firstelem} -eq 1 ]; then
		printf "{ 'id':'${id}','type':'${type}','state':${linkup},'inbps':'${inbps}','outbps':'${outbps}','dnsreq':'${dnsreqs}','dnsfail':'${dnsfail}','flowcnt':'${flowcnt}'}"
		firstelem=0
	else
		printf ",{ 'id':'${id}','type':'${type}','state':${linkup},'inbps':'${inbps}','outbps':'${outbps}','dnsreq':'${dnsreqs}','dnsfail':'${dnsfail}','flowcnt':'${flowcnt}'}"
	fi
done
echo "]"

echo -n "
";