/* Web Polygraph http://www.web-polygraph.org/
* (C) 2003-2006 The Measurement Factory
* Licensed under the Apache License, Version 2.0 */
#ifndef POLYGRAPH__SERVER_SERVER_H
#define POLYGRAPH__SERVER_SERVER_H
#include "xstd/Socket.h"
#include "xstd/FileScanner.h"
#include "runtime/Agent.h"
#include "runtime/XactFarm.h"
#include "runtime/BcastRcver.h"
#include "server/SrvXact.h"
#include "server/SrvConnMgr.h"
class RndDistr;
class OidRec;
class PopModel;
class ContentSel;
class SrvCfg;
class SrvSharedCfgs;
class ServerSym;
class Server: public Agent, public FileScanner::User, public SrvConnMgr::User, public BcastRcver {
public:
enum ReqTypes { rptBasic = 1, rpt302Found };
public:
static void LogState(OLog &log);
static void Farm(XactFarm<SrvXact> *aFarm);
public:
Server();
~Server();
void configure(const ServerSym *cfg, const NetAddr &aHost);
virtual void start();
virtual void stop();
// xactions need access to this
int hostIdx() const { return theHostIdx; }
SrvCfg *cfg() { return theCfg; }
PopModel *popModel();
void selectRepType(ObjId &oid);
void noteXactDone(SrvXact *x);
virtual void noteReadReady(int fd);
virtual void noteConnReady(Connection *conn);
virtual int logCat() const;
virtual const UniqId &id() const;
protected:
void configureContents(const ServerSym *cfg);
void startXact(Connection *conn);
void deaf();
virtual void noteLogEvent(BcastChannel *ch, OLog &log);
protected:
static XactFarm<SrvXact> *TheXacts;
static SrvSharedCfgs *TheSharedCfgs;
SrvCfg *theCfg; // server configuration (maybe shared)
SrvConnMgr *theConnMgr;
Socket theSock;
int theHostIdx; // index into the HostMap
int theReqCount; // number of accepted requests
FileScanReserv theReserv;
};
#endif
syntax highlighted by Code2HTML, v. 0.9.1