FARGOS/VISTA Object Management Environment Core
..
|
Implements HTTPnotificationReceiverInterface to maintain a history of events and log lines which are to be published via HTTP. More...
#include <HTTPembeddedServer.hpp>
Public Member Functions | |
HTTPstatusLog () | |
virtual | ~HTTPstatusLog () |
int | emitLineAsHTTPevent (IO_Processor *controller, uint64_t eventId, const char *eventType, const unsigned char *lineData, uint32_t lineLen, const char *additional) |
int | emitLogLineAsHTTPevent (IO_Processor *controller, uint32_t relLine, const char *additional) |
void | addHTTPsession (HTTP_SessionRecord *rec, uint64_t fromTime=0) |
void | removeHTTPsession (HTTP_SessionRecord *rec) |
virtual void | receiveNotice (const unsigned char *bfr, uint32_t bfrLen, const char *eventType="log") override |
Abstract interface to deliver formatted message. More... | |
const HTTPeventStateRecord * | locateEventRecord (const void *obj, const char *eventType) const |
Find an event state record for the indicated object and event type. More... | |
HTTPeventStateRecord * | findOrCreateEventRecord (const void *obj, const char *eventType) |
Find an event state record for the indicated object and event type. More... | |
void | publishEventState (const HTTPeventStateRecord *rec) |
void | publishKeepAlive () |
![]() | |
HTTPnotificationReceiverInterface () | |
~HTTPnotificationReceiverInterface () | |
Static Public Member Functions | |
static void | becomeEventStream (HTTP_SessionRecord *session, HTTPstatusLog *statusLog) |
Static convenience routine to take over an existing HTTP session and turn it into an event forwarder connected to the specified HTTPstatusLog object. More... | |
Protected Types | |
enum | { MAX_LINES_HISTORY = 8192 } |
typedef std::map< HTTPstatusRecordKey, HTTPeventStateRecord, ltHTTPstatusRecordKey > | statusEventMap_t |
Protected Member Functions | |
int | dumpLinesFromTime (HTTP_SessionRecord *rec, uint64_t fromTime) |
int | dumpEventsFromTime (HTTP_SessionRecord *rec, uint64_t fromTime) |
Static Protected Member Functions | |
static int | forwardBuffer (SharedBufferAllocRecord *rec, IO_Processor *controller) |
IO_Processor-compatible processing routine used to forward buffer contents to a connect client. More... | |
Protected Attributes | |
struct { | |
const unsigned char * iov_base | |
size_t iov_len | |
char eventType [24] | |
} | lineContent [MAX_LINES_HISTORY] |
time_t | lineAddedAtTime [MAX_LINES_HISTORY] |
uint32_t | linesAdded |
uint32_t | eventRecordsCreated |
TimedMutex | sessionMutex |
std::list< HTTP_SessionRecord * > | currentHTTPsessions |
statusEventMap_t | statusEvents |
Implements HTTPnotificationReceiverInterface to maintain a history of events and log lines which are to be published via HTTP.
|
protected |
|
inline |
References eventRecordsCreated, lineContent, linesAdded, and MAX_LINES_HISTORY.
|
inlinevirtual |
void HTTPstatusLog::addHTTPsession | ( | HTTP_SessionRecord * | rec, |
uint64_t | fromTime = 0 |
||
) |
References app(), HTTP_SessionRecord::controller, currentHTTPsessions, IO_Processor::descriptor, dumpEventsFromTime(), dumpLinesFromTime(), fd, LOG_COMPONENT_CERR, LOG_ENDLINE, OS_SOCKET_TYPE, sessionMutex, SOCKET_CAST, and TimedMutex::unlock().
Referenced by becomeEventStream().
|
static |
Static convenience routine to take over an existing HTTP session and turn it into an event forwarder connected to the specified HTTPstatusLog object.
NOTE: this routine does not return until the remote client closes the connection.
References addHTTPsession(), IO_Processor::BOTH_THREADS, HTTP_SessionRecord::closeWhenRequestComplete, HTTP_SessionRecord::controller, IO_Processor::descriptor, IO_Processor::desiredThreadState, EINTR, errno, forwardBuffer(), IFLOG_WHEN, LOG_CERR, LOG_ENDLINE, IO_Processor_Statistics::packetsProcessed, IO_Processor::PROCESS_THREAD, IO_Processor::READ_THREAD, removeHTTPsession(), IO_Processor::setProcessRoutine(), IO_Processor::setThreadMode(), SOCKET_CAST, IO_Processor::statistics, IO_Processor::stopThread(), IO_Processor::waitForThreadExit(), and IO_Processor::waitForThreadStart().
|
protected |
References HTTP_SessionRecord::controller, emitLineAsHTTPevent(), HTTPeventStateRecord::eventType, HTTP_SessionRecord::interestedInEvent(), HTTPeventStateRecord::lineData, HTTPeventStateRecord::lineLength, sessionMutex, statusEvents, TimedMutex::unlock(), and HTTPeventStateRecord::updateTime.
Referenced by addHTTPsession().
|
protected |
References HTTP_SessionRecord::controller, emitLogLineAsHTTPevent(), linesAdded, and MAX_LINES_HISTORY.
Referenced by addHTTPsession().
int HTTPstatusLog::emitLineAsHTTPevent | ( | IO_Processor * | controller, |
uint64_t | eventId, | ||
const char * | eventType, | ||
const unsigned char * | lineData, | ||
uint32_t | lineLen, | ||
const char * | additional | ||
) |
References BufferRegion::allocateBlock(), IO_Processor::bfrManager, SharedBufferAllocRecord_32::blockLen, IO_Processor::bufferAddress(), IO_Processor_Statistics::bytesRead, eventType, IO_Processor::noteDataToProcess(), IO_Processor_Statistics::packetsRead, IO_Processor::statistics, and SharedBufferAllocRecord_32::usedLen.
Referenced by dumpEventsFromTime(), emitLogLineAsHTTPevent(), and publishEventState().
|
inline |
References emitLineAsHTTPevent(), eventType, iov_len, and lineContent.
Referenced by dumpLinesFromTime(), and receiveNotice().
HTTPeventStateRecord * HTTPstatusLog::findOrCreateEventRecord | ( | const void * | obj, |
const char * | eventType | ||
) |
Find an event state record for the indicated object and event type.
NOTE: this routine always returns a result; if no record currenty exists, then a new one will created.
References eventRecordsCreated, HTTPeventStateRecord::eventType, HTTPstatusRecordKey::eventType, eventType, HTTPeventStateRecord::extraData, HTTPeventStateRecord::lineData, HTTPstatusRecordKey::object, safe_strcpy, sessionMutex, statusEvents, and TimedMutex::unlock().
|
staticprotected |
IO_Processor-compatible processing routine used to forward buffer contents to a connect client.
IO_Processor-compatible processing routine used to forward buffer contents to connected client.
References IO_Processor::bufferAddress(), IO_Processor::descriptor, and SOCKET_CAST.
Referenced by becomeEventStream().
const HTTPeventStateRecord * HTTPstatusLog::locateEventRecord | ( | const void * | obj, |
const char * | eventType | ||
) | const |
Find an event state record for the indicated object and event type.
References HTTPstatusRecordKey::eventType, eventType, HTTPstatusRecordKey::object, safe_strcpy, sessionMutex, statusEvents, and TimedMutex::unlock().
void HTTPstatusLog::publishEventState | ( | const HTTPeventStateRecord * | rec | ) |
References HTTP_SessionRecord::controller, currentHTTPsessions, emitLineAsHTTPevent(), HTTPeventStateRecord::eventType, HTTP_SessionRecord::interestedInEvent(), HTTPeventStateRecord::lineData, HTTPeventStateRecord::lineLength, HTTPeventStateRecord::MAX_STATUS_LINE_LENGTH, OME_EXPECT_FALSE, sessionMutex, TimedMutex::unlock(), and HTTPeventStateRecord::updateTime.
void HTTPstatusLog::publishKeepAlive | ( | ) |
References currentHTTPsessions, sessionMutex, SOCKET_CAST, and TimedMutex::unlock().
|
overridevirtual |
Abstract interface to deliver formatted message.
bfr | points to the start of the message content |
bfrLen | indicates the length of the message |
eventType | is normally "log" |
Implements HTTPnotificationReceiverInterface.
References currentHTTPsessions, emitLogLineAsHTTPevent(), eventType, iov_base, lineAddedAtTime, lineContent, linesAdded, MAX_LINES_HISTORY, and safe_strcpy.
void HTTPstatusLog::removeHTTPsession | ( | HTTP_SessionRecord * | rec | ) |
References app(), HTTP_SessionRecord::controller, currentHTTPsessions, IO_Processor::descriptor, fd, LOG_COMPONENT_CERR, LOG_ENDLINE, OS_SOCKET_TYPE, sessionMutex, SOCKET_CAST, and TimedMutex::unlock().
Referenced by becomeEventStream().
|
protected |
Referenced by addHTTPsession(), publishEventState(), publishKeepAlive(), receiveNotice(), and removeHTTPsession().
|
protected |
Referenced by findOrCreateEventRecord(), and HTTPstatusLog().
char HTTPstatusLog::eventType[24] |
Referenced by emitLineAsHTTPevent(), emitLogLineAsHTTPevent(), findOrCreateEventRecord(), locateEventRecord(), and receiveNotice().
const unsigned char* HTTPstatusLog::iov_base |
Referenced by receiveNotice().
size_t HTTPstatusLog::iov_len |
Referenced by emitLogLineAsHTTPevent().
|
protected |
Referenced by receiveNotice().
struct { ... } HTTPstatusLog::lineContent[MAX_LINES_HISTORY] |
Referenced by emitLogLineAsHTTPevent(), HTTPstatusLog(), and receiveNotice().
|
protected |
Referenced by dumpLinesFromTime(), HTTPstatusLog(), and receiveNotice().
|
mutableprotected |
|
protected |
Referenced by dumpEventsFromTime(), findOrCreateEventRecord(), and locateEventRecord().
![]() | Generated: Fri Jul 31 2020 18:19:16
Support Information |