// NetCard.h: interface for the CNetCard class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_NETCARD_H__FC4CF1CA_63A6_4C69_B1E5_1E8140056A09__INCLUDED_)
#define AFX_NETCARD_H__FC4CF1CA_63A6_4C69_B1E5_1E8140056A09__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <Iphlpapi.h>
#include "AiroOid.h"
#include "hwx500.h"


typedef struct _MaccAddr
    {
    unsigned char M1;
    unsigned char M2;
    unsigned char M3; 
    unsigned char M4;
    unsigned char M5;
    unsigned char M6;
    } 	MACADDR;

#define MAX_NAME_LEN    256
#define MAX_USTATUS_LEN	25
#define MAX_DNAME_LEN	75
#define MAX_SNAME_LEN	20

typedef struct _CLIENTINFO {
	char  UserName[MAX_NAME_LEN];	   // User name
	char  UserStatus[MAX_USTATUS_LEN]; // Is the use Online/Active/Away
	char  MachineName[MAX_NAME_LEN];   // Host/computer/machine name
	char  DomainName[MAX_DNAME_LEN];   // Domain to which machine belongs
	char  AdapterName[MAX_ADAPTER_NAME];   // Name of the wireless NIC
	char  ApName[MAX_NAME_LEN];		   // Name of Access Point
	DWORD Version;					   // OS version 
	float DataRate;					   // Raw data rate of network
	BYTE  IpAddress[4];				   // Client's IP address in dot format
	BYTE  ApIpAddress[4];			   // AP's IP address in dot format	
	BYTE  EtherAddress[6];			   // Ethernet address of client
	BYTE  ApEtherAddress[6];		   // Ethernet address of AP
	char  SSID[MAX_SNAME_LEN];		   // Network SSID
	DWORD SignalStrength;		       // Received Signal Stength
	DWORD NormalizedSignalStrength; 
	DWORD BeaconPeriod;				   // Beacon Period
	SYSTEMTIME	 st;				   // System Time
	unsigned int ElapsedSeconds;       // Time since last reset of NIC
	DWORD RxBytes;					   // Number of bytes received
	DWORD TxBytes;					   // Number of bytes transmitted
} CLIENTINFO;

#define WIRED_NETWORK_HANDLE  1001

// Maximum number of network adapters
#define MAX_NICS 10

// WiLIB
#define WRAPI __declspec(dllimport)
#define WRAPI_INVALID_HANDLE	-1

typedef int WRAPIHANDLE;

typedef struct WrapiDevInfo {
	char *Make;
	char *Model;
	char *Device;
} WRAPIDEVINFO;

// Prototypes //
extern WRAPI int WrapiGetDeviceList(WRAPIDEVINFO **list, int *count);
extern WRAPI WRAPIHANDLE WrapiOpenDevice(char *device);
extern WRAPI int WrapiIoctl(WRAPIHANDLE hndl, int oid, void *out, int outLen, int *retBytes);


class NetCard  
{
public:
	NetCard();
	void Update();
	virtual ~NetCard();
	WRAPIHANDLE handle;
	CLIENTINFO info;
private:
	WRAPIHANDLE  OpenDevice (void);
	int  GetInfo(int Handle, CLIENTINFO *Client);
	void InitClientInfo (CLIENTINFO *Client);
	void PrintClientInfo (CLIENTINFO *ClientInfo);
};

#endif // !defined(AFX_NETCARD_H__FC4CF1CA_63A6_4C69_B1E5_1E8140056A09__INCLUDED_)
