74 lines
1.8 KiB
C
74 lines
1.8 KiB
C
|
#ifndef __SERVER_H__
|
||
|
#define __SERVER_H__
|
||
|
|
||
|
/*
|
||
|
#ifndef __NETDDE_H__
|
||
|
#include "netdde.h"
|
||
|
#define BASE_SERVER TDDEServer
|
||
|
#endif
|
||
|
*/
|
||
|
|
||
|
#ifndef __NETSOCK_H__
|
||
|
#include "NetSock.h"
|
||
|
#define BASE_SERVER TSocketServer
|
||
|
#endif
|
||
|
|
||
|
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
// TPrassiServer
|
||
|
|
||
|
// Preferisco metterla nel .cpp
|
||
|
class TDataSources;
|
||
|
class TTableDefPool;
|
||
|
class TSnapshotPool;
|
||
|
|
||
|
class TPrassiServer : public BASE_SERVER
|
||
|
{
|
||
|
enum { DONGLE_WORDS = 4 };
|
||
|
static WORD m_DongleNumber;
|
||
|
static WORD m_DongleModules[DONGLE_WORDS];
|
||
|
|
||
|
TDataSources* m_pDataSources;
|
||
|
TTableDefPool* m_pTables;
|
||
|
TSnapshotPool* m_pSnapshots;
|
||
|
|
||
|
protected: // TNet_Server
|
||
|
virtual TConnection* OnCreateConnection(DWORD id);
|
||
|
virtual BOOL OnRemoveConnection(DWORD id);
|
||
|
|
||
|
public:
|
||
|
BOOL TestFirm(int nFirm) const;
|
||
|
|
||
|
BOOL OpenTableDef(int nFirm, int nLogicNum);
|
||
|
CdbTableDef GetTableDef(int nFirm, int nLogicNum);
|
||
|
CdbRecordset& GetDynaset(int nFirm, int nLogicNum);
|
||
|
void CloseTableDef(int nFirm, int nLogicNum);
|
||
|
|
||
|
DWORD OpenSnapshot(int nFirm, int nLogicNum, LPCSTR sWhere, LPCSTR sOrder);
|
||
|
CdbRecordset& GetSnapshot(DWORD nHandle);
|
||
|
BOOL UpdateSnapshot(DWORD nHandle, int nFirm, int nLogicNum);
|
||
|
void CloseSnapshot(DWORD nHandle);
|
||
|
|
||
|
int Lock(int nFirm, int nLogicNumber, LPCSTR sKey, DWORD locker);
|
||
|
int Unlock(int nFirm, int nLogicNumber, LPCSTR sKey, DWORD locker);
|
||
|
|
||
|
int ExclusiveLock(int nFirm, int nLogicNumber, DWORD dwLocker);
|
||
|
int ExclusiveUnlock(int nFirm, int nLogicNumber, DWORD dwLocker);
|
||
|
|
||
|
WORD DongleSerialNumber() const { return m_DongleNumber; }
|
||
|
const WORD* DongleAuthorizations() const { return m_DongleModules; }
|
||
|
|
||
|
static WORD DongleLogin();
|
||
|
static void DongleLogout();
|
||
|
|
||
|
virtual BOOL IsOk() const;
|
||
|
|
||
|
TPrassiServer();
|
||
|
virtual ~TPrassiServer();
|
||
|
};
|
||
|
|
||
|
BOOL StartServer();
|
||
|
TPrassiServer& GetServer();
|
||
|
BOOL StopServer();
|
||
|
|
||
|
#endif
|