mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-21 23:13:08 +08:00
Feature: refactor ClientList and add dialog to show it
This commit is contained in:
58
server/2015Remote/HostInfo.h
Normal file
58
server/2015Remote/HostInfo.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#include <unordered_map>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include "context.h"
|
||||
|
||||
enum {
|
||||
MAP_NOTE,
|
||||
MAP_LOCATION,
|
||||
MAP_LEVEL,
|
||||
MAP_AUTH,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
class _ClientValue {
|
||||
public:
|
||||
char Note[64];
|
||||
char Location[64];
|
||||
char Level;
|
||||
char IP[46];
|
||||
char InstallTime[20];
|
||||
char LastLoginTime[20];
|
||||
char OsName[32];
|
||||
char Authorized;
|
||||
uint64_t ID;
|
||||
char Reserved[768];
|
||||
|
||||
_ClientValue()
|
||||
{
|
||||
memset(this, 0, sizeof(_ClientValue));
|
||||
}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef uint64_t ClientKey;
|
||||
|
||||
typedef _ClientValue ClientValue;
|
||||
|
||||
typedef std::unordered_map<ClientKey, ClientValue> ClientMap;
|
||||
|
||||
class _ClientList {
|
||||
public:
|
||||
virtual ~_ClientList() {}
|
||||
virtual bool Exists(ClientKey key) = 0;
|
||||
virtual CString GetClientMapData(ClientKey key, int typ) = 0;
|
||||
virtual int GetClientMapInteger(ClientKey key, int typ) = 0;
|
||||
virtual void SetClientMapInteger(ClientKey key, int typ, int value) = 0;
|
||||
virtual void SetClientMapData(ClientKey key, int typ, const char* value) = 0;
|
||||
virtual void SaveClientMapData(context* ctx) = 0;
|
||||
virtual std::vector<std::pair<ClientKey, ClientValue>> GetAll() = 0;
|
||||
virtual void SaveToFile(const std::string& filename) = 0;
|
||||
virtual void LoadFromFile(const std::string& filename) = 0;
|
||||
};
|
||||
|
||||
_ClientList* NewClientList();
|
||||
Reference in New Issue
Block a user