/*====================================================================*
 *
 *   void SessionPeek ();
 *
 *   session.h
 *
 *   send session variable information to HTML client for development
 *   and debugging purposes; 
 *
 *   This software and documentation is the property of Atheros 
 *   Corporation, Ocala, Florida. It is provided 'as is' without 
 *   expressed or implied warranty of any kind to anyone for any 
 *   reason. Atheros assumes no responsibility or liability for 
 *   errors or omissions in the software or documentation and 
 *   reserves the right to make changes without notification. 
 *   
 *   Atheros customers may modify and distribute the software 
 *   without obligation to Atheros. Since use of this software 
 *   is optional, users shall bear sole responsibility and 
 *   liability for any consequences of it's use. 
 *   
 *.  Atheros Powerline Toolkit for HomePlug AV;
 *:  Published 2006-2009 by Intellon Corp. ALL RIGHTS RESERVED;
 *;  For demonstration; Not for production use;
 *
 *   Contributor(s):
 *      Charles Maier <charles.maier@atheros.com>
 *
 *--------------------------------------------------------------------*/

#ifndef SESSIONPEEK_SOURCE
#define SESSIONPEEk_SOURCE

#include "../cgi/page.h"
#include "../cgi/session.h"
#include "../tools/memory.h"
#include "../tools/format.h"

void SessionPeek () 

{
	extern struct session session;
	char address [ETHER_ADDR_LEN * 3];
	signed margin = 0;
	unsigned bridge = 0;
	output (margin++, "<div class ='%s' style='background:yellow;'>", STYLE_PEEK);
	output (margin++, "<table>");
	output (margin++, "<tr>");
	output (margin++, "<td>");
	printf ("%s=%s<br/>", SUBMIT_OPTION, session.option);
	printf ("%s=%s<br/>", SUBMIT_ACTION, session.action);
	printf ("%s=%s<br/>", SUBMIT_SOURCE, session.source);
	while (bridge < session.bridges)
	{
		printf ("bridge=%s<br/>", hexstring (address, sizeof (address), session.bridge[bridge++].MAC, ETHER_ADDR_LEN));
	}
	printf ("device=%s<br/>", hexstring (address, sizeof (address), session.device.MAC, ETHER_ADDR_LEN));
	printf ("DAK=%s DPW='%s'<br/>", hexstring (address, sizeof (address), session.device.DAK, sizeof (session.device.DAK)), session.DPW);
	printf ("NMK=%s NPW='%s'<br/>", hexstring (address, sizeof (address), session.device.NMK, sizeof (session.device.NMK)), session.NPW);
	printf ("NID=%s<br/>", hexstring (address, sizeof (address), session.device.NID, sizeof (session.device.NID)));
	printf ("method=%d,%d<br/>", session.QoS.method [0], session.QoS.method [1]);
	output (margin--, "</td>");
	output (margin--, "</tr>");
	output (margin--, "</table>");
	output (margin--, "</div>");
	return;
}

#endif