SCOM Serial Communication Protocol
0.5.2
|
Packet filtering API. More...
Go to the source code of this file.
Macros | |
#define | HAL_LOG_CHANNEL SCOM |
#define | HAL_LOG_SUBCHANNEL FILTERING |
#define | SCOM_FILTERING_ACCESS_GUARD_TIMEOUT 5000 |
#define | SCOM_FILTER_PROC_PERIOD 40 |
Functions | |
bool | SCOM_FilteringFrameReceptionHandler (SCOMDataLink scom, SCOMFrame *frame) |
void | SCOM_FilterProc (SCOMDataLink scom) |
SCOMResult | SCOM_InsertFilter (SCOMDataLink scom, SCOMFilter filter) |
SCOMResult | SCOM_RemoveFilter (SCOMDataLink scom, SCOMFilter filter) |
SCOMResult | SCOM_InitFiltering (SCOMDataLink scom) |
SCOMResult | SCOM_DeinitFiltering (SCOMDataLink scom) |
SCOMResult | SCOM_RunFilteringThread (SCOMDataLink scom) |
void | SCOM_StopFilteringThread (SCOMDataLink scom) |
Packet filtering API.
Definition in file scom_filtering.c.
#define HAL_LOG_CHANNEL SCOM |
Definition at line 9 of file scom_filtering.c.
#define HAL_LOG_SUBCHANNEL FILTERING |
Definition at line 10 of file scom_filtering.c.
#define SCOM_FILTER_PROC_PERIOD 40 |
Definition at line 23 of file scom_filtering.c.
#define SCOM_FILTERING_ACCESS_GUARD_TIMEOUT 5000 |
Definition at line 19 of file scom_filtering.c.
Referenced by SCOM_DeinitFiltering(), SCOM_FilterProc(), SCOM_InitFiltering(), SCOM_InsertFilter(), and SCOM_RemoveFilter().
SCOMResult SCOM_DeinitFiltering | ( | SCOMDataLink | scom | ) |
Deinitialize filter structure.
scom | SCOM handle |
SCOM_RESULT_OK | |
SCOM_ERROR | when SCOM handle not exist |
Definition at line 206 of file scom_filtering.c.
References SCOMDataLinkDesc::accessGuard, SCOM_ERROR, SCOM_FILTERING_ACCESS_GUARD_TIMEOUT, and SCOM_RESULT_OK.
Referenced by SCOM_ScanAndRun().
bool SCOM_FilteringFrameReceptionHandler | ( | SCOMDataLink | scom, |
SCOMFrame * | frame | ||
) |
Function used as a native SCOM frame reception handler when frame filtering capabilities are required. In order to enable filtering capabilities, this function shall be passed to the SCOM_SetFrameReceptionHandlerFunc after SCOM initialization. This function is never called directly - it is used internally by the SCOM protocol.
scom | SCOM handle |
frame | pointer to the received frame |
Definition at line 29 of file scom_filtering.c.
Referenced by SCOM_InitFiltering().
void SCOM_FilterProc | ( | SCOMDataLink | scom | ) |
This function must be called periodically.
scom | SCOM handle |
Definition at line 45 of file scom_filtering.c.
References SCOMDataLinkDesc::accessGuard, SCOMFilterDesc::filter_match_function, SCOM_FILTERING_ACCESS_GUARD_TIMEOUT, SCOM_GetReceivedFrame(), SCOM_UnlockFrame(), and HAL_PACKED::type.
SCOMResult SCOM_InitFiltering | ( | SCOMDataLink | scom | ) |
Initialize filter structure.
scom | SCOM handle |
SCOM_RESULT_OK | when structure was initialized successfully |
SCOM_RESULT_OK | when an error occurred, for example framePool pointer is equal NULL |
Definition at line 167 of file scom_filtering.c.
References SCOMDataLinkDesc::accessGuard, SCOMDataLinkDesc::frameBuffer, SCOMFrameBuffer::rxFrameQueue, SCOM_ERROR, SCOM_FILTERING_ACCESS_GUARD_TIMEOUT, SCOM_FilteringFrameReceptionHandler(), SCOM_MAX_FRAME_FILTERS, SCOM_RESULT_OK, SCOM_SetFrameReceptionHandlerFunc(), and SCOMFrameQueue::size.
Referenced by SCOM_ScanAndRun().
SCOMResult SCOM_InsertFilter | ( | SCOMDataLink | scom, |
SCOMFilter | filter | ||
) |
Inserts the provided filter into a SCOM filter chain.
scom | SCOM handle |
filter | SCOM filter |
SCOM_RESULT_OK | when filter was properly installed |
SCOM_FILTER_LIST_FULL | when the filter list is full and cannot accept more filters (consider increasing the SCOM_MAX_FRAME_FILTERS definition) |
Definition at line 101 of file scom_filtering.c.
References SCOMDataLinkDesc::accessGuard, SCOM_FILTER_LIST_FULL, SCOM_FILTERING_ACCESS_GUARD_TIMEOUT, and SCOM_RESULT_OK.
Referenced by SCOM_GetIdentity(), SCOM_ServiceTransaction(), SCOM_Transaction(), and SCOM_WaitForDevice().
SCOMResult SCOM_RemoveFilter | ( | SCOMDataLink | scom, |
SCOMFilter | filter | ||
) |
Removes the filter from the SCOM filter chain.
scom | SCOM handle |
filter | SCOM filter |
Definition at line 134 of file scom_filtering.c.
References SCOMDataLinkDesc::accessGuard, SCOM_ERROR, SCOM_FILTERING_ACCESS_GUARD_TIMEOUT, and SCOM_RESULT_OK.
Referenced by SCOM_GetIdentity(), SCOM_ServiceTransaction(), SCOM_Transaction(), and SCOM_WaitForDevice().
SCOMResult SCOM_RunFilteringThread | ( | SCOMDataLink | scom | ) |
Creates and starts the thread that periodically calls the SCOM_FilterProc function, that actually runs the filtering engine.
scom | SCOM descriptor |
Definition at line 261 of file scom_filtering.c.
References SCOM_ERROR, and SCOM_RESULT_OK.
Referenced by SCOM_ScanAndRun().
void SCOM_StopFilteringThread | ( | SCOMDataLink | scom | ) |
Stops the thread, previously started with SCOM_RunFilteringThread.
scom | SCOM descriptor |
Definition at line 279 of file scom_filtering.c.
Referenced by SCOM_ScanAndRun().