Main Page Class Hierarchy Compound List File List Compound Members File Members

# MutableServerBase Class Reference

`#include <mutableserverbase.h>`

Inheritance diagram for MutableServerBase:

List of all members.

## Public Member Functions
HANDLE_STATUS | HandleConfigLine (ConfigSource *p_parser)
void | StartThreadFunc (void *p_arg)
| MutableServerBase ()
| ~MutableServerBase ()
WORM_STATUS_CODE | Run (int argc, char *argv[])
## Protected Member Functions
void | CheckConfig ()
virtual bool | PrepareToRun ()
THREAD_RETURN | ClientServicer (void *p_socketdescriptor)
THREAD_RETURN | Stacker ()
THREAD_RETURN | Handler ()
virtual const char * | OutputMessageTypeKey ()=0
bool | CheckForThreadDeath ()
WORM_STATUS_CODE | MainThreadActions ()
virtual long | GetMaxSocketBufferSize ()=0
virtual MutableServerRequest * | GetRequestContainer ()=0
virtual MutableServerResult * | GetResultContainer ()=0
virtual WORM_STATUS_CODE | GetRequestFromInput (int p_argc, char *p_argv[], void *r_container)=0
virtual WORM_STATUS_CODE | ProcessRequest (void *p_request, void *r_result)=0
virtual WORM_STATUS_CODE | HandleResult (void *p_result)=0
## Protected Attributes
MUTABLE_MODE_TYPE | Mode
unsigned short | MaxClients
PROVIDER_VECTOR | Providers
int | ConnectFailureSec
int | MaxServerTryLoopCount
std::string | InputRingName
std::string | OutputRingName
WORM_RING_ID | InputRingKey
WORM_RING_ID | OutputRingKey
SHM_INFO * | InputRegion
SHM_INFO * | OutputRegion
SHM_INFO | InputRegionStruct
SHM_INFO | OutputRegionStruct
MSG_LOGO | ServeLogo [SERVE_MAX_LOGOS]
short | ServeLogoCount
char * | TransmitBuffer
long | TransmitBufferLength
TMutex * | MessageMutex
std::queue< std::string > | MessageQueue
TO_THREAD_ID | StackerThreadId
long | LastStackerPulse
TO_THREAD_ID | HandlerThreadId
long | LastHandlerPulse
MSG_LOGO | ResultMsgLogo
int | LoggingOptions
## Static Protected Attributes
const char * | MSB_MODE_NAME []
## Private Member Functions
WORM_STATUS_CODE | TransmitRequest (MutableServerRequest *p_request, MutableServerResult *r_result)
WORM_STATUS_CODE | TransmitResult (MutableServerResult *p_result, const SOCKET *p_socketdescriptor=NULL)
## Private Attributes
int | MaxMessageLength
char * | MessageBuffer

## Constructor & Destructor Documentation

MutableServerBase::MutableServerBase | ( |  | ) |

| Definition at line 36 of file mutableserverbase.cpp. References SHM_INFO::addr, ConnectFailureSec, InputRegion, InputRegionStruct, InputRingKey, InputRingName, LoggingOptions, MaxClients, MaxMessageLength, MaxServerTryLoopCount, MessageBuffer, MessageMutex, MMT_NONE, Mode, OutputRegion, OutputRegionStruct, OutputRingKey, OutputRingName, ServeLogoCount, TransmitBuffer, TransmitBufferLength, WORM_LOG_TOFILE, and WORM_RING_INVALID.

MutableServerBase::~MutableServerBase | ( |  | ) |

| Definition at line 72 of file mutableserverbase.cpp. References SHM_INFO::addr, WormServerBase::CommandRegion, WormServerBase::CommandRingKey, InputRegionStruct, InputRingKey, TLogger::Logit(), MessageBuffer, MessageMutex, OutputRegionStruct, OutputRingKey, tport_detach(), TransmitBuffer, and WORM_RING_INVALID.

## Member Function Documentation

void MutableServerBase::CheckConfig | ( |  | ) | `[protected, virtual]`

| Reimplemented from WormServerBase. Reimplemented in DBMutableServer, and ServerTemplate. Definition at line 349 of file mutableserverbase.cpp. References WormServerBase::CommandRingKey, TConfigurable::ConfigState, ConnectFailureSec, TGlobalUtils::GetThisInstallationId(), TGlobalUtils::GetThisModuleId(), InputRingKey, MSG_LOGO::instid, TLogger::Logit(), TGlobalUtils::LookupMessageTypeId(), MaxMessageLength, MIN_RECV_TIMEOUT_MS, MMT_CLIENT, MMT_MODULE, MMT_NONE, MMT_SERVER, MSG_LOGO::mod, OutputMessageTypeKey(), OutputRingKey, Providers, WormServerBase::RecvTimeoutMS, ResultMsgLogo, WormServerBase::SendTimeoutMS, ServeLogoCount, WormServerBase::ServerPort, MSG_LOGO::type, WORM_MSGTYPE_INVALID, WORM_RING_INVALID, and WORM_STAT_BADSTATE. Referenced by DBMutableServer::CheckConfig().

bool MutableServerBase::CheckForThreadDeath | ( |  | ) | `[protected]`

| Definition at line 496 of file mutableserverbase.cpp. References LastHandlerPulse, WormServerBase::LastListenerPulse, LastStackerPulse, MMT_MODULE, MMT_SERVER, and WormServerBase::SendStatus(). Referenced by MainThreadActions().

THREAD_RETURN MutableServerBase::ClientServicer | ( | void * | p_socketdescriptor | ) | `[protected, virtual]`

| Implements WormServerBase. Definition at line 1654 of file mutableserverbase.cpp. References closesocket_ew(), GetMaxSocketBufferSize(), GetRequestContainer(), GetResultContainer(), WormServerBase::ListenForMsg(), WormServerBase::LoggingLevel, TLogger::Logit(), MaxClients, MutableServerMessage::ParseMessageLine(), ProcessRequest(), WormServerBase::RecvTimeoutMS, MutableServerResult::SetStatus(), THREAD_COMPLETED, THREAD_ERROR, THREAD_INITIALIZING, THREAD_PROCESSING, THREAD_WAITING, WormServerBase::ThreadsInfo, TransmitResult(), WORM_LOG_ERRORS, WORM_LOG_STATUS, WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by StartThreadFunc().

virtual long MutableServerBase::GetMaxSocketBufferSize | ( |  | ) | `[protected, pure virtual]`

| Implemented in ServerTemplate. Referenced by ClientServicer(), and TransmitRequest().

virtual MutableServerRequest* MutableServerBase::GetRequestContainer | ( |  | ) | `[protected, pure virtual]`

| Implemented in ServerTemplate. Referenced by ClientServicer(), Handler(), and Run().

virtual WORM_STATUS_CODE MutableServerBase::GetRequestFromInput | ( | int | p_argc,
|  | char * | p_argv[],
|  | void * | r_container
| ) | `[protected, pure virtual]`

| Implemented in ServerTemplate. Referenced by Run().

virtual MutableServerResult* MutableServerBase::GetResultContainer | ( |  | ) | `[protected, pure virtual]`

| Implemented in ServerTemplate. Referenced by ClientServicer(), Handler(), Run(), and TransmitResult().

HANDLE_STATUS MutableServerBase::HandleConfigLine | ( | ConfigSource * | p_parser | ) | `[virtual]`

| Reimplemented from WormServerBase. Reimplemented in DBMutableServer, and ServerTemplate. Definition at line 135 of file mutableserverbase.cpp. References TConfigurable::ConfigState, ConnectFailureSec, HANDLE_STATUS, WormServerBase::HandleConfigLine(), HANDLER_INVALID, HANDLER_USED, InputRingKey, InputRingName, ConfigSource::Int(), ConfigSource::INVALID_INT, _PROVIDER_ADDR::IPAddr, ConfigSource::Its(), TLogger::Logit(), TGlobalUtils::LookupInstallationId(), TGlobalUtils::LookupMessageTypeId(), TGlobalUtils::LookupModuleId(), TGlobalUtils::LookupRingKey(), MaxMessageLength, MessageBuffer, MMT_CLIENT, MMT_MODULE, MMT_SERVER, MMT_STANDALONE, Mode, OutputRingKey, OutputRingName, _PROVIDER_ADDR::Port, Providers, SERVE_MAX_LOGOS, ServeLogo, ServeLogoCount, ConfigSource::String(), WORM_RING_INVALID, and WORM_STAT_BADSTATE. Referenced by DBMutableServer::HandleConfigLine().

THREAD_RETURN MutableServerBase::Handler | ( |  | ) | `[protected]`

| Definition at line 1520 of file mutableserverbase.cpp. References WormServerBase::CommandRegion, WormServerBase::CommandRingKey, GetRequestContainer(), GetResultContainer(), InputRegionStruct, InputRingKey, LastHandlerPulse, TLogger::Logit(), MessageQueue, TTimeFuncs::MSecSleep(), OutputRegion, OutputRegionStruct, OutputRingKey, MutableServerMessage::ParseFromBuffer(), ProcessRequest(), tport_attach(), tport_detach(), TransmitResult(), WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by StartThreadFunc().

virtual WORM_STATUS_CODE MutableServerBase::HandleResult | ( | void * | p_result | ) | `[protected, pure virtual]`

| Implemented in ServerTemplate. Referenced by Run().

WORM_STATUS_CODE MutableServerBase::MainThreadActions | ( |  | ) | `[protected, virtual]`

| Reimplemented from WormServerBase. Definition at line 569 of file mutableserverbase.cpp. References CheckForThreadDeath(), WormServerBase::CommandRingKey, TGlobalUtils::GetHeartbeatInt(), TGlobalUtils::GetPID(), TGlobalUtils::GetTerminateFlag(), LastHandlerPulse, WormServerBase::LastListenerPulse, LastStackerPulse, MessageMutex, MMT_MODULE, MMT_SERVER, TTimeFuncs::MSecSleep(), WormServerBase::Running, WormServerBase::SendStatus(), setSocket_ewDebug(), ThreadableObject::StartThreadWithArg(), TERMINATE, THR_KEY_HANDLER, THR_KEY_LISTENER, THR_KEY_STACKER, tport_getflag(), WORM_RING_INVALID, WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by Run().

virtual const char* MutableServerBase::OutputMessageTypeKey | ( |  | ) | `[protected, pure virtual]`

| Implemented in ServerTemplate. Referenced by CheckConfig().

virtual bool MutableServerBase::PrepareToRun | ( |  | ) | `[inline, protected, virtual]`

| Reimplemented from WormServerBase. Reimplemented in DBMutableServer, and ServerTemplate. Definition at line 122 of file mutableserverbase.h. References WormServerBase::PrepareToRun(). Referenced by DBMutableServer::PrepareToRun(), and Run().

virtual WORM_STATUS_CODE MutableServerBase::ProcessRequest | ( | void * | p_request,
|  | void * | r_result
| ) | `[protected, pure virtual]`

| Implemented in ServerTemplate. Referenced by ClientServicer(), Handler(), and Run().

WORM_STATUS_CODE MutableServerBase::Run | ( | int | argc,
|  | char * | argv[]
| ) |

| Definition at line 700 of file mutableserverbase.cpp. References WormServerBase::CommandRingKey, TConfigurable::ConfigState, GetRequestContainer(), GetRequestFromInput(), GetResultContainer(), HandleResult(), LoggingOptions, TLogger::Logit(), MainThreadActions(), MMT_CLIENT, MMT_MODULE, MMT_SERVER, MMT_STANDALONE, PrepareToRun(), ProcessRequest(), WormServerBase::Running, tport_attach(), tport_detach(), TransmitRequest(), WORM_LOG_TOFILE, WORM_LOG_TOSTDERR, WORM_RING_INVALID, WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by main().

THREAD_RETURN MutableServerBase::Stacker | ( |  | ) | `[protected]`

| Definition at line 1334 of file mutableserverbase.cpp. References WormServerBase::CommandRegion, WormServerBase::CommandRingKey, GET_MISS, GET_MISS_LAPPED, GET_MISS_SEQGAP, GET_NONE, GET_NOTRACK, GET_OK, GET_TOOBIG, InputRegion, InputRegionStruct, InputRingKey, MSG_LOGO::instid, LastStackerPulse, TLogger::Logit(), TGlobalUtils::LookupInstallationId(), TGlobalUtils::LookupMessageTypeId(), TGlobalUtils::LookupModuleId(), MessageBuffer, MessageQueue, MSG_LOGO::mod, TTimeFuncs::MSecSleep(), WormServerBase::SendStatus(), ServeLogo, ServeLogoCount, tport_attach(), tport_detach(), tport_getmsg(), TransmitResult(), and MSG_LOGO::type. Referenced by StartThreadFunc().

void MutableServerBase::StartThreadFunc | ( | void * | p_arg | ) | `[virtual]`

| Reimplemented from WormServerBase. Definition at line 543 of file mutableserverbase.cpp. References ClientServicer(), Handler(), WormServerBase::Listener(), Stacker(), THR_KEY_HANDLER, THR_KEY_LISTENER, and THR_KEY_STACKER.

WORM_STATUS_CODE MutableServerBase::TransmitRequest | ( | MutableServerRequest * | p_request,
|  | MutableServerResult * | r_result
| ) | `[private]`

| Definition at line 872 of file mutableserverbase.cpp. References closesocket_ew(), connect_ew(), _ServiceThreadInfoStruct::descriptor, MutableServerMessage::FormatBuffer(), MutableServerMessage::GetBuffer(), MutableServerMessage::GetBufferLength(), TGlobalUtils::GetLoggingLevel(), GetMaxSocketBufferSize(), MutableServerResult::GetStatus(), _ServiceThreadInfoStruct::ipaddr, _PROVIDER_ADDR::IPAddr, WormServerBase::ListenForMsg(), TLogger::Logit(), MaxServerTryLoopCount, MMT_CLIENT, Mode, MSB_MODE_NAME, MSB_RESULT_BUSY, TTimeFuncs::MSecSleep(), MutableServerMessage::ParseMessageLine(), _PROVIDER_ADDR::Port, Providers, WormServerBase::RecvTimeoutMS, WormServerBase::SendMessage(), socket_ew(), WormServerBase::ThreadsInfo, WORM_LOG_DEBUG, WORM_LOG_DETAILS, WORM_LOG_ERRORS, WORM_LOG_STATUS, WORM_STAT_DISCONNECT, WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by Run().

WORM_STATUS_CODE MutableServerBase::TransmitResult | ( | MutableServerResult * | p_result,
|  | const SOCKET * | p_socketdescriptor = NULL
| ) | `[private]`

| Definition at line 1177 of file mutableserverbase.cpp. References MutableServerMessage::FormatBuffer(), MutableServerMessage::GetBuffer(), MutableServerMessage::GetBufferLength(), TGlobalUtils::GetLoggingLevel(), GetResultContainer(), WormServerBase::LoggingLevel, TLogger::Logit(), MMT_MODULE, MMT_SERVER, Mode, MSB_MODE_NAME, PUT_OK, WormServerBase::SendMessage(), MutableServerResult::SetStatus(), tport_putmsg(), TransmitBuffer, TransmitBufferLength, WORM_LOG_ERRORS, WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by ClientServicer(), Handler(), and Stacker().

## Member Data Documentation

int MutableServerBase::ConnectFailureSec`[protected]`

| Definition at line 162 of file mutableserverbase.h. Referenced by CheckConfig(), HandleConfigLine(), and MutableServerBase().

TO_THREAD_ID MutableServerBase::HandlerThreadId`[protected]`

| Definition at line 206 of file mutableserverbase.h.

SHM_INFO* MutableServerBase::InputRegion`[protected]`

| Definition at line 178 of file mutableserverbase.h. Referenced by MutableServerBase(), and Stacker().

SHM_INFO MutableServerBase::InputRegionStruct`[protected]`

| Definition at line 178 of file mutableserverbase.h. Referenced by Handler(), MutableServerBase(), Stacker(), and ~MutableServerBase().

WORM_RING_ID MutableServerBase::InputRingKey`[protected]`

| Definition at line 175 of file mutableserverbase.h. Referenced by CheckConfig(), HandleConfigLine(), Handler(), MutableServerBase(), Stacker(), and ~MutableServerBase().

std::string MutableServerBase::InputRingName`[protected]`

| Definition at line 172 of file mutableserverbase.h. Referenced by HandleConfigLine(), and MutableServerBase().

long MutableServerBase::LastHandlerPulse`[protected]`

| Definition at line 207 of file mutableserverbase.h. Referenced by CheckForThreadDeath(), Handler(), and MainThreadActions().

long MutableServerBase::LastStackerPulse`[protected]`

| Definition at line 202 of file mutableserverbase.h. Referenced by CheckForThreadDeath(), MainThreadActions(), and Stacker().

int MutableServerBase::LoggingOptions`[protected]`

| Definition at line 232 of file mutableserverbase.h. Referenced by MutableServerBase(), and Run().

unsigned short MutableServerBase::MaxClients`[protected]`

| Definition at line 150 of file mutableserverbase.h. Referenced by ClientServicer(), and MutableServerBase().

int MutableServerBase::MaxMessageLength`[private]`

| Definition at line 69 of file mutableserverbase.h. Referenced by CheckConfig(), HandleConfigLine(), and MutableServerBase().

int MutableServerBase::MaxServerTryLoopCount`[protected]`

| Definition at line 166 of file mutableserverbase.h. Referenced by MutableServerBase(), and TransmitRequest().

char* MutableServerBase::MessageBuffer`[private]`

| Definition at line 70 of file mutableserverbase.h. Referenced by HandleConfigLine(), MutableServerBase(), Stacker(), and ~MutableServerBase().

TMutex* MutableServerBase::MessageMutex`[protected]`

| Definition at line 197 of file mutableserverbase.h. Referenced by MainThreadActions(), MutableServerBase(), and ~MutableServerBase().

std::queue<std::string> MutableServerBase::MessageQueue`[protected]`

| Definition at line 199 of file mutableserverbase.h. Referenced by Handler(), and Stacker().

MUTABLE_MODE_TYPE MutableServerBase::Mode`[protected]`

| Definition at line 143 of file mutableserverbase.h. Referenced by HandleConfigLine(), MutableServerBase(), TransmitRequest(), and TransmitResult().

const char * MutableServerBase::MSB_MODE_NAME`[static, protected]`

| Initial value:
    {
      ""
    , "Standalone"
    , "Module"
    , "Server"
    , "Client"
    }
Definition at line 22 of file mutableserverbase.cpp. Referenced by TransmitRequest(), and TransmitResult().

SHM_INFO * MutableServerBase::OutputRegion`[protected]`

| Definition at line 178 of file mutableserverbase.h. Referenced by Handler(), and MutableServerBase().

SHM_INFO MutableServerBase::OutputRegionStruct`[protected]`

| Definition at line 178 of file mutableserverbase.h. Referenced by Handler(), MutableServerBase(), and ~MutableServerBase().

WORM_RING_ID MutableServerBase::OutputRingKey`[protected]`

| Definition at line 175 of file mutableserverbase.h. Referenced by CheckConfig(), HandleConfigLine(), Handler(), MutableServerBase(), and ~MutableServerBase().

std::string MutableServerBase::OutputRingName`[protected]`

| Definition at line 172 of file mutableserverbase.h. Referenced by HandleConfigLine(), and MutableServerBase().

PROVIDER_VECTOR MutableServerBase::Providers`[protected]`

| Definition at line 156 of file mutableserverbase.h. Referenced by CheckConfig(), HandleConfigLine(), and TransmitRequest().

MSG_LOGO MutableServerBase::ResultMsgLogo`[protected]`

| Definition at line 211 of file mutableserverbase.h. Referenced by CheckConfig().

MSG_LOGO MutableServerBase::ServeLogo[SERVE_MAX_LOGOS]`[protected]`

| Definition at line 183 of file mutableserverbase.h. Referenced by HandleConfigLine(), and Stacker().

short MutableServerBase::ServeLogoCount`[protected]`

| Definition at line 184 of file mutableserverbase.h. Referenced by CheckConfig(), HandleConfigLine(), MutableServerBase(), and Stacker().

TO_THREAD_ID MutableServerBase::StackerThreadId`[protected]`

| Definition at line 201 of file mutableserverbase.h.

char* MutableServerBase::TransmitBuffer`[protected]`

| Definition at line 186 of file mutableserverbase.h. Referenced by MutableServerBase(), TransmitResult(), and ~MutableServerBase().

long MutableServerBase::TransmitBufferLength`[protected]`

| Definition at line 187 of file mutableserverbase.h. Referenced by MutableServerBase(), and TransmitResult().

The documentation for this class was generated from the following files:

- mutableserverbase.h
- mutableserverbase.cpp