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

# WormServerBase Class Reference

`#include <serverbase.h>`

Inheritance diagram for WormServerBase:

List of all members.

## Public Member Functions
HANDLE_STATUS | HandleConfigLine (ConfigSource *p_parser)
void | StartThreadFunc (void *p_arg)
| WormServerBase ()
| ~WormServerBase ()
WORM_STATUS_CODE | Run ()
## Protected Member Functions
THREAD_RETURN | Listener (void *p_dummy)
void | CheckConfig ()
bool | SetMaxThreads (unsigned short p_count)
int | ListenForMsg (SOCKET p_descriptor, char *p_rcv_buffer, int *p_length, int p_timeoutms=-1)
WORM_STATUS_CODE | SendMessage (const SOCKET p_descriptor, const char *p_msg, int *p_length)
void | SendStatus (unsigned char type, short ierr, char *note)
void | ReleaseServiceThreadInfo (SOCKET p_descriptor)
virtual bool | PrepareToRun ()
virtual WORM_STATUS_CODE | MainThreadActions ()
virtual void | FinishedRunning ()
virtual THREAD_RETURN | ClientServicer (void *p_socketdescriptor)=0
## Static Protected Member Functions
bool | DoSCNLsMatch (const char *p_s1, const char *p_c1, const char *p_n1, const char *p_l1, const char *p_s2, const char *p_c2, const char *p_n2, const char *p_l2)
## Protected Attributes
bool | SocketDebug
char | ServerIPAddr [20]
int | ServerPort
int | SendTimeoutMS
TO_THREAD_ID | ListenerThreadId
long | LastListenerPulse
int | LoggingLevel
SERVICETHREAD_MAP | ThreadsInfo
int | RecvTimeoutMS
WORM_RING_NAME | CommandRingName
WORM_RING_ID | CommandRingKey
SHM_INFO | CommandRegion
bool | Running
## Private Attributes
SOCKET | PassiveSocket
unsigned int | MaxServiceThreads

## Constructor & Destructor Documentation

WormServerBase::WormServerBase | ( |  | ) |

| Definition at line 73 of file serverbase.cpp. References SHM_INFO::addr, CommandRegion, CommandRingKey, TLogger::Logit(), TGlobalUtils::LookupMessageTypeId(), MaxServiceThreads, PassiveSocket, RecvTimeoutMS, Running, SendTimeoutMS, ServerPort, SocketDebug, SocketSysInit(), WORM_MSGTYPE_INVALID, and WORM_RING_INVALID.

WormServerBase::~WormServerBase | ( |  | ) |

| Definition at line 109 of file serverbase.cpp. References TTimeFuncs::MSecSleep(), and Running.

## Member Function Documentation

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

| Reimplemented from TConfigurable. Reimplemented in DBMutableServer, MutableServerBase, RingReaderServer, and ServerTemplate. Definition at line 363 of file serverbase.cpp. References CommandRingKey, TConfigurable::ConfigState, TGlobalUtils::GetHeartbeatInt(), TLogger::Logit(), MIN_RECV_TIMEOUT_MS, RecvTimeoutMS, SendTimeoutMS, ServerPort, WORM_RING_INVALID, and WORM_STAT_BADSTATE. Referenced by RingReaderServer::CheckConfig().

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

| Implemented in MutableServerBase. Referenced by StartThreadFunc().

bool WormServerBase::DoSCNLsMatch | ( | const char * | p_s1,
|  | const char * | p_c1,
|  | const char * | p_n1,
|  | const char * | p_l1,
|  | const char * | p_s2,
|  | const char * | p_c2,
|  | const char * | p_n2,
|  | const char * | p_l2
| ) | `[static, protected]`

| Definition at line 21 of file serverbase.cpp.

virtual void WormServerBase::FinishedRunning | ( |  | ) | `[inline, protected, virtual]`

| Reimplemented in RingReaderServer. Definition at line 266 of file serverbase.h. Referenced by Run().

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

| Reimplemented from TConfigurable. Reimplemented in DBMutableServer, MutableServerBase, RingReaderServer, and ServerTemplate. Definition at line 416 of file serverbase.cpp. References CommandRingKey, ConfigSource::GetCurrentLine(), HANDLE_STATUS, HANDLER_INVALID, HANDLER_UNUSED, HANDLER_USED, ConfigSource::Int(), ConfigSource::INVALID_INT, ConfigSource::Its(), TLogger::Logit(), TGlobalUtils::LookupRingKey(), MaxServiceThreads, RecvTimeoutMS, SendTimeoutMS, SERVE_MAX_THREADS, ServerPort, SocketDebug, ConfigSource::String(), and WORM_RING_INVALID. Referenced by RingReaderServer::HandleConfigLine(), and MutableServerBase::HandleConfigLine().

THREAD_RETURN WormServerBase::Listener | ( | void * | p_dummy | ) | `[protected]`

| Definition at line 767 of file serverbase.cpp. References accept_ew(), bind_ew(), closesocket_ew(), _ServiceThreadInfoStruct::descriptor, TGlobalUtils::GetLoggingLevel(), _ServiceThreadInfoStruct::ipaddr, ThreadableObject::KillThread(), LastListenerPulse, listen_ew(), TLogger::Logit(), MaxServiceThreads, TTimeFuncs::MSecSleep(), PassiveSocket, ServerIPAddr, SERVICE_THREAD_PULSE_MAX, SERVICETHREAD_MAP_ITERATOR, SERVICETHREADID_VECTOR, _ServiceThreadInfoStruct::sock_addr, socket_ew(), socketGetError_ew(), ThreadableObject::StartThreadWithArg(), _ServiceThreadInfoStruct::status, THREAD_BLOCKINGSOCKET, THREAD_COMPLETED, THREAD_DISCONNECTED, THREAD_ERROR, THREAD_STARTING, ThreadsInfo, WORM_LOG_DEBUG, WORM_LOG_DETAILS, WORM_LOG_ERRORS, WORM_LOG_STATUS, WORM_LOG_TRACKING, and WORM_STAT_FAILURE. Referenced by StartThreadFunc(), and MutableServerBase::StartThreadFunc().

int WormServerBase::ListenForMsg | ( | SOCKET | p_descriptor,
|  | char * | p_rcv_buffer,
|  | int * | p_length,
|  | int | p_timeoutms = -1
| ) | `[protected]`

| Definition at line 118 of file serverbase.cpp. References TGlobalUtils::GetLoggingLevel(), TLogger::Logit(), recv_ew(), RecvTimeoutMS, THREAD_BLOCKINGSOCKET, THREAD_PROCESSING, ThreadsInfo, WORM_LOG_DETAILS, and WORM_LOG_ERRORS. Referenced by MutableServerBase::ClientServicer(), and MutableServerBase::TransmitRequest().

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

| Reimplemented in MutableServerBase, and RingReaderServer. Definition at line 260 of file serverbase.h. References WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by Run().

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

| Reimplemented in DBMutableServer, MutableServerBase, RingReaderServer, and ServerTemplate. Definition at line 247 of file serverbase.h. References TGlobalUtils::GetLoggingLevel(). Referenced by MutableServerBase::PrepareToRun(), and Run().

void WormServerBase::ReleaseServiceThreadInfo | ( | SOCKET | p_descriptor | ) | `[inline, protected]`

| Definition at line 231 of file serverbase.h.

WORM_STATUS_CODE WormServerBase::Run | ( |  | ) |

| Definition at line 603 of file serverbase.cpp. References ACCEPTABLE_SEC_TO_WAIT_FOR_SERVICE_THREAD_TO_START, SHM_INFO::addr, CommandRegion, TConfigurable::ConfigState, FinishedRunning(), TGlobalUtils::GetHeartbeatInt(), TGlobalUtils::GetPID(), LastListenerPulse, TLogger::Logit(), MainThreadActions(), TTimeFuncs::MSecSleep(), PrepareToRun(), Running, SendStatus(), setSocket_ewDebug(), ThreadableObject::StartThread(), TERMINATE, tport_attach(), tport_detach(), tport_getflag(), WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE.

WORM_STATUS_CODE WormServerBase::SendMessage | ( | const SOCKET | p_descriptor,
|  | const char * | p_msg,
|  | int * | p_length
| ) | `[protected]`

| Definition at line 292 of file serverbase.cpp. References TGlobalUtils::GetLoggingLevel(), TLogger::Logit(), send_ew(), socketGetError_ew(), WORM_LOG_DEBUG, WORM_LOG_ERRORS, WORM_STAT_FAILURE, WORM_STAT_SUCCESS, and WORM_STATUS_CODE. Referenced by MutableServerBase::TransmitRequest(), and MutableServerBase::TransmitResult().

void WormServerBase::SendStatus | ( | unsigned char | type,
|  | short | ierr,
|  | char * | note
| ) | `[protected]`

| Definition at line 547 of file serverbase.cpp. References CommandRingKey, TGlobalUtils::GetThisInstallationId(), TGlobalUtils::GetThisModuleId(), MSG_LOGO::instid, TLogger::Logit(), TGlobalUtils::LookupMessageTypeId(), MSG_LOGO::mod, PUT_OK, tport_putmsg(), type, MSG_LOGO::type, and WORM_RING_INVALID. Referenced by MutableServerBase::CheckForThreadDeath(), RingReaderServer::MainThreadActions(), MutableServerBase::MainThreadActions(), Run(), and MutableServerBase::Stacker().

bool WormServerBase::SetMaxThreads | ( | unsigned short | p_count | ) | `[inline, protected]`

| Definition at line 152 of file serverbase.h. References SERVE_MAX_THREADS.

void WormServerBase::StartThreadFunc | ( | void * | p_arg | ) | `[inline, virtual]`

| Implements ThreadableObject. Reimplemented in MutableServerBase. Definition at line 310 of file serverbase.h. References ClientServicer(), and Listener().

## Member Data Documentation

SHM_INFO WormServerBase::CommandRegion`[protected]`

| Definition at line 175 of file serverbase.h. Referenced by MutableServerBase::Handler(), Run(), MutableServerBase::Stacker(), WormServerBase(), and MutableServerBase::~MutableServerBase().

WORM_RING_ID WormServerBase::CommandRingKey`[protected]`

| Definition at line 174 of file serverbase.h. Referenced by CheckConfig(), MutableServerBase::CheckConfig(), RingReaderServer::FinishedRunning(), HandleConfigLine(), MutableServerBase::Handler(), MutableServerBase::MainThreadActions(), RingReaderServer::PrepareToRun(), MutableServerBase::Run(), SendStatus(), MutableServerBase::Stacker(), WormServerBase(), MutableServerBase::~MutableServerBase(), and RingReaderServer::~RingReaderServer().

WORM_RING_NAME WormServerBase::CommandRingName`[protected]`

| Definition at line 173 of file serverbase.h.

long WormServerBase::LastListenerPulse`[protected]`

| Definition at line 116 of file serverbase.h. Referenced by MutableServerBase::CheckForThreadDeath(), Listener(), MutableServerBase::MainThreadActions(), and Run().

TO_THREAD_ID WormServerBase::ListenerThreadId`[protected]`

| Definition at line 115 of file serverbase.h.

int WormServerBase::LoggingLevel`[protected]`

| Reimplemented in RingReaderServer. Definition at line 164 of file serverbase.h. Referenced by MutableServerBase::ClientServicer(), DBMutableServer::GetDefaultsFromDB(), ServerTemplate::GetRequestContainer(), ServerTemplate::GetRequestFromInput(), ServerTemplate::HandleConfigLine(), DBMutableServer::HandleConfigLine(), ServerTemplate::HandleResult(), DBMutableServer::InitializeDB(), ServerTemplate::PrepareToRun(), DBMutableServer::PrepareToRun(), ServerTemplate::ProcessRequest(), and MutableServerBase::TransmitResult().

unsigned int WormServerBase::MaxServiceThreads`[private]`

| Definition at line 100 of file serverbase.h. Referenced by HandleConfigLine(), Listener(), and WormServerBase().

SOCKET WormServerBase::PassiveSocket`[private]`

| Definition at line 98 of file serverbase.h. Referenced by Listener(), and WormServerBase().

int WormServerBase::RecvTimeoutMS`[protected]`

| Definition at line 169 of file serverbase.h. Referenced by CheckConfig(), MutableServerBase::CheckConfig(), MutableServerBase::ClientServicer(), HandleConfigLine(), ListenForMsg(), MutableServerBase::TransmitRequest(), and WormServerBase().

bool WormServerBase::Running`[protected]`

| Definition at line 226 of file serverbase.h. Referenced by MutableServerBase::MainThreadActions(), Run(), MutableServerBase::Run(), WormServerBase(), and ~WormServerBase().

int WormServerBase::SendTimeoutMS`[protected]`

| Definition at line 109 of file serverbase.h. Referenced by CheckConfig(), MutableServerBase::CheckConfig(), HandleConfigLine(), and WormServerBase().

char WormServerBase::ServerIPAddr[20]`[protected]`

| Definition at line 106 of file serverbase.h. Referenced by Listener().

int WormServerBase::ServerPort`[protected]`

| Definition at line 107 of file serverbase.h. Referenced by CheckConfig(), MutableServerBase::CheckConfig(), HandleConfigLine(), and WormServerBase().

bool WormServerBase::SocketDebug`[protected]`

| Definition at line 104 of file serverbase.h. Referenced by HandleConfigLine(), and WormServerBase().

SERVICETHREAD_MAP WormServerBase::ThreadsInfo`[protected]`

| Definition at line 167 of file serverbase.h. Referenced by MutableServerBase::ClientServicer(), Listener(), ListenForMsg(), and MutableServerBase::TransmitRequest().

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

- serverbase.h
- serverbase.cpp