/*
* NetConnection.h
* Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
#pragma once
#include <sol/nm/NetManager.h>
#include <sol/nm/ConnectionInfo.h>
namespace SOL {
class NetConnection: public NetManager {
public:
NetConnection(const wchar_t* server=NULL)
:NetManager(server)
{
}
public:
int enumerate(const wchar_t* qualifier, ConnectionInfo& connectionInfo)
{
const wchar_t* serverName = getServerName();
DWORD level = connectionInfo.getLevel();
LPBYTE pbuffer = NULL;
DWORD entriesRead = 0;
DWORD totalEntries = 0;
NET_API_STATUS rc = NetConnectionEnum(
(wchar_t*)serverName,
(wchar_t*)qualifier,
level,
&pbuffer,
MAX_PREFERRED_LENGTH,
&entriesRead,
&totalEntries,
NULL);
if (rc == NERR_Success) {
connectionInfo.setInfo(pbuffer, entriesRead, totalEntries);
} else {
throw (int)rc;
}
return rc;
}
};
}
|