/*
* NetInfo.h
* Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
#pragma once
#include <sol/Object.h>
#include <lm.h>
#include <sol/ArgT.h>
#include <sol/StringBufferT.h>
namespace SOL {
class NetInfo: public Object {
private:
DWORD level;
LPBYTE pInfo;
DWORD entriesRead;
DWORD totalEntries;
public:
/**
* Constructor
*/
NetInfo(int lv=0)
:level(lv),
pInfo(NULL)
{
}
public:
/**
* Destructor
*/
~NetInfo()
{
clear();
}
private:
void clear()
{
if (pInfo) {
NetApiBufferFree(pInfo);
pInfo = NULL;
}
}
public:
int allocate(DWORD bytesCount= 64000)
{
clear();
LPBYTE pbuffer = NULL;
NET_API_STATUS rc =NetApiBufferAllocate(bytesCount, (LPVOID*)&pbuffer);
if (rc == NERR_Success) {
pInfo = pbuffer;
} else {
throw (int)rc;
}
return rc;
}
public:
virtual void display()
{
}
public:
int getLevel()
{
return level;
}
public:
LPBYTE getBuffer()
{
return pInfo;
}
public:
void setInfo(LPBYTE info, DWORD read, DWORD total)
{
clear();
pInfo = info;
entriesRead = read;
totalEntries = total;
}
public:
DWORD getEntriesRead()
{
return entriesRead;
}
/*
public:
void setEntriesRead(DWORD count)
{
entriesRead = count;
}
*/
public:
DWORD getTotalEntries()
{
return totalEntries;
}
/*public:
void setTotalEntries(DWORD count)
{
totalEntries = count;
}
*/
};
}
|