FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
HTTPstatusLog Class Reference

Implements HTTPnotificationReceiverInterface to maintain a history of events and log lines which are to be published via HTTP. More...

#include <HTTPembeddedServer.hpp>

+ Inheritance diagram for HTTPstatusLog:

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 HTTPeventStateRecordlocateEventRecord (const void *obj, const char *eventType) const
 Find an event state record for the indicated object and event type. More...
 
HTTPeventStateRecordfindOrCreateEventRecord (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 ()
 
- Public Member Functions inherited from HTTPnotificationReceiverInterface
 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, ltHTTPstatusRecordKeystatusEventMap_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
 

Detailed Description

Implements HTTPnotificationReceiverInterface to maintain a history of events and log lines which are to be published via HTTP.

Member Typedef Documentation

◆ statusEventMap_t

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
MAX_LINES_HISTORY 

Constructor & Destructor Documentation

◆ HTTPstatusLog()

HTTPstatusLog::HTTPstatusLog ( )
inline

◆ ~HTTPstatusLog()

virtual HTTPstatusLog::~HTTPstatusLog ( )
inlinevirtual

Member Function Documentation

◆ addHTTPsession()

◆ becomeEventStream()

◆ dumpEventsFromTime()

◆ dumpLinesFromTime()

int HTTPstatusLog::dumpLinesFromTime ( HTTP_SessionRecord rec,
uint64_t  fromTime 
)
protected

◆ emitLineAsHTTPevent()

int HTTPstatusLog::emitLineAsHTTPevent ( IO_Processor controller,
uint64_t  eventId,
const char *  eventType,
const unsigned char *  lineData,
uint32_t  lineLen,
const char *  additional 
)

◆ emitLogLineAsHTTPevent()

int HTTPstatusLog::emitLogLineAsHTTPevent ( IO_Processor controller,
uint32_t  relLine,
const char *  additional 
)
inline

◆ findOrCreateEventRecord()

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().

◆ forwardBuffer()

int HTTPstatusLog::forwardBuffer ( SharedBufferAllocRecord rec,
IO_Processor controller 
)
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().

◆ locateEventRecord()

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().

◆ publishEventState()

◆ publishKeepAlive()

void HTTPstatusLog::publishKeepAlive ( )

◆ receiveNotice()

void HTTPstatusLog::receiveNotice ( const unsigned char *  bfr,
uint32_t  bfrLen,
const char *  eventType = "log" 
)
overridevirtual

Abstract interface to deliver formatted message.

Parameters
bfrpoints to the start of the message content
bfrLenindicates the length of the message
eventTypeis normally "log"

Implements HTTPnotificationReceiverInterface.

References currentHTTPsessions, emitLogLineAsHTTPevent(), eventType, iov_base, lineAddedAtTime, lineContent, linesAdded, MAX_LINES_HISTORY, and safe_strcpy.

◆ removeHTTPsession()

Member Data Documentation

◆ currentHTTPsessions

std::list<HTTP_SessionRecord *> HTTPstatusLog::currentHTTPsessions
protected

◆ eventRecordsCreated

uint32_t HTTPstatusLog::eventRecordsCreated
protected

◆ eventType

◆ iov_base

const unsigned char* HTTPstatusLog::iov_base

Referenced by receiveNotice().

◆ iov_len

size_t HTTPstatusLog::iov_len

Referenced by emitLogLineAsHTTPevent().

◆ lineAddedAtTime

time_t HTTPstatusLog::lineAddedAtTime[MAX_LINES_HISTORY]
protected

Referenced by receiveNotice().

◆ lineContent

struct { ... } HTTPstatusLog::lineContent[MAX_LINES_HISTORY]

◆ linesAdded

uint32_t HTTPstatusLog::linesAdded
protected

◆ sessionMutex

◆ statusEvents

statusEventMap_t HTTPstatusLog::statusEvents
protected

The documentation for this class was generated from the following files:
Generated: Fri Jul 31 2020 18:19:16
Support Information