libiec61850  1.5.3
Data Structures | Typedefs | Functions
Service provider interface (SPI) for log storage implementations

Data Structures

struct  LogStorage
 

Typedefs

typedef bool(* LogEntryCallback) (void *parameter, uint64_t timestamp, uint64_t entryID, bool moreFollow)
 Will be called for each new LogEntry by the getEntries and getEntriesAfter functions. More...
 
typedef bool(* LogEntryDataCallback) (void *parameter, const char *dataRef, uint8_t *data, int dataSize, uint8_t reasonCode, bool moreFollow)
 Will be called for each new LogEntryData by the getEntries and getEntriesAfter functions. More...
 

Functions

LIB61850_API void LogStorage_setMaxLogEntries (LogStorage self, int maxEntries)
 Set the maximum number of log entries for this log. More...
 
LIB61850_API int LogStorage_getMaxLogEntries (LogStorage self)
 Get the maximum allowed number of log entries for this log. More...
 
LIB61850_API uint64_t LogStorage_addEntry (LogStorage self, uint64_t timestamp)
 Add an entry to the log. More...
 
LIB61850_API bool LogStorage_addEntryData (LogStorage self, uint64_t entryID, const char *dataRef, uint8_t *data, int dataSize, uint8_t reasonCode)
 Add new entry data to an existing log entry. More...
 
LIB61850_API bool LogStorage_getEntries (LogStorage self, uint64_t startingTime, uint64_t endingTime, LogEntryCallback entryCallback, LogEntryDataCallback entryDataCallback, void *parameter)
 Get log entries specified by a time range. More...
 
LIB61850_API bool LogStorage_getEntriesAfter (LogStorage self, uint64_t startingTime, uint64_t entryID, LogEntryCallback entryCallback, LogEntryDataCallback entryDataCallback, void *parameter)
 Get log entries specified by a start log entry. More...
 
LIB61850_API bool LogStorage_getOldestAndNewestEntries (LogStorage self, uint64_t *newEntry, uint64_t *newEntryTime, uint64_t *oldEntry, uint64_t *oldEntryTime)
 Get the entry time and entryID of the oldest and the newest log entries. More...
 
LIB61850_API void LogStorage_destroy (LogStorage self)
 Destroy the LogStorage instance and free all related resources. More...
 

Detailed Description

This interface has to be implemented by the log storage provider. The Log storage provider has to provide a specific constructor that creates an instance of LogStorage by allocating the required memory for the struct sLogStorage data structure and populate the function pointers with provider specific implementation functions.

Typedef Documentation

◆ LogEntryCallback

typedef bool(* LogEntryCallback) (void *parameter, uint64_t timestamp, uint64_t entryID, bool moreFollow)

Will be called for each new LogEntry by the getEntries and getEntriesAfter functions.

Parameters
parameter- a user provided parameter that is passed to the callback handler
timestamp- the entry timestamp of the LogEntry
entryID- the entryID of the LogEntry
moreFollow- more data will follow - if false, the data is not valid and no more data will follow
Returns
true ready to receive new data, false abort operation

◆ LogEntryDataCallback

typedef bool(* LogEntryDataCallback) (void *parameter, const char *dataRef, uint8_t *data, int dataSize, uint8_t reasonCode, bool moreFollow)

Will be called for each new LogEntryData by the getEntries and getEntriesAfter functions.

Parameters
parameter- a user provided parameter that is passed to the callback handler
dataRef- the data reference of the LogEntryData
data- the data content as an unstructured binary data block
dataSize- the size of the binary data block
reasonCode- the reasonCode of the LogEntryData
moreFollow- more data will follow - if false, the data is not valid and no more data will follow
Returns
true ready to receive new data, false abort operation

Function Documentation

◆ LogStorage_addEntry()

LIB61850_API uint64_t LogStorage_addEntry ( LogStorage  self,
uint64_t  timestamp 
)

Add an entry to the log.

Parameters
selfthe pointer of the LogStorage instance
timestampthe entry time of the new entry
Returns
the entryID of the new entry

◆ LogStorage_addEntryData()

LIB61850_API bool LogStorage_addEntryData ( LogStorage  self,
uint64_t  entryID,
const char *  dataRef,
uint8_t *  data,
int  dataSize,
uint8_t  reasonCode 
)

Add new entry data to an existing log entry.

Parameters
selfthe pointer of the LogStorage instance
entryIDthe ID of the log entry where the data will be added
dataRefthe data reference of the log entry data
datathe data content as an unstructured binary data block
dataSize- the size of the binary data block
reasonCode- the reasonCode of the LogEntryData
Returns
true if the entry data was successfully added, false otherwise

◆ LogStorage_destroy()

LIB61850_API void LogStorage_destroy ( LogStorage  self)

Destroy the LogStorage instance and free all related resources.

Parameters
selfthe pointer of the LogStorage instance

◆ LogStorage_getEntries()

LIB61850_API bool LogStorage_getEntries ( LogStorage  self,
uint64_t  startingTime,
uint64_t  endingTime,
LogEntryCallback  entryCallback,
LogEntryDataCallback  entryDataCallback,
void *  parameter 
)

Get log entries specified by a time range.

Parameters
selfthe pointer of the LogStorage instance
startingTimestart time of the time range
endingTimeend time of the time range
entryCallbackcallback function to be called for each new log entry
entryDataCallbackcallback function to be called for each new log entry data
parameter- a user provided parameter that is passed to the callback handler
Returns
true if the request has been successful, false otherwise

◆ LogStorage_getEntriesAfter()

LIB61850_API bool LogStorage_getEntriesAfter ( LogStorage  self,
uint64_t  startingTime,
uint64_t  entryID,
LogEntryCallback  entryCallback,
LogEntryDataCallback  entryDataCallback,
void *  parameter 
)

Get log entries specified by a start log entry.

The request will return all log entries that where entered into the log after the log entry specified by startingTime and entryID.

Parameters
selfthe pointer of the LogStorage instance
startingTimetimestamp of the start log entry
entryIDentryID of the start log entry
entryCallbackcallback function to be called for each new log entry
entryDataCallbackcallback function to be called for each new log entry data
parameter- a user provided parameter that is passed to the callback handler
Returns
true if the request has been successful, false otherwise

◆ LogStorage_getMaxLogEntries()

LIB61850_API int LogStorage_getMaxLogEntries ( LogStorage  self)

Get the maximum allowed number of log entries for this log.

Parameters
selfthe pointer of the LogStorage instance
Returns
the maximum number of log entries

◆ LogStorage_getOldestAndNewestEntries()

LIB61850_API bool LogStorage_getOldestAndNewestEntries ( LogStorage  self,
uint64_t *  newEntry,
uint64_t *  newEntryTime,
uint64_t *  oldEntry,
uint64_t *  oldEntryTime 
)

Get the entry time and entryID of the oldest and the newest log entries.

This function is used to update the log status information in the LCB

Parameters
selfthe pointer of the LogStorage instance
newEntrypointer to store the entryID of the newest entry
newEntryTimepointer to store the entry time of the newest entry
oldEntrypointer to store the entryID of the oldest entry
oldEntryTimepointer to store the entry time of the oldest entry

◆ LogStorage_setMaxLogEntries()

LIB61850_API void LogStorage_setMaxLogEntries ( LogStorage  self,
int  maxEntries 
)

Set the maximum number of log entries for this log.

Parameters
selfthe pointer of the LogStorage instance
maxEntriesthe maximum number of log entries