SCOM Serial Communication Protocol
0.5.2
|
Packet filtering API. More...
Go to the source code of this file.
Data Structures | |
struct | SCOMFilterDesc |
Actual definition of the SCOM frame filter descriptor structure. More... | |
Macros | |
#define | SCOM_DECLARE_FILTER_FRAME_POOL(name, size) |
Typedefs | |
typedef struct SCOMFilterFrame | SCOMFilterFrame |
Type declaration of the SCOM frame filter. More... | |
typedef struct SCOMFilterDesc | SCOMFilterDesc |
Type declaration of the SCOM frame filter descriptor. More... | |
typedef struct SCOMFilterDesc * | SCOMFilter |
Utility type being a pointer to a SCOM frame filter descriptor. More... | |
typedef bool(* | SCOMFilterMatchFunc )(SCOMDataLink scom, SCOMFilter filter, SCOMFrame *frame) |
Type defining a function that performs filter matching (returns 1 when frame matches filter, 0 otherwise) More... | |
Functions | |
bool | SCOM_FilteringFrameReceptionHandler (SCOMDataLink scom, SCOMFrame *frame) |
SCOMResult | SCOM_InsertFilter (SCOMDataLink scom, SCOMFilter filter) |
SCOMResult | SCOM_RemoveFilter (SCOMDataLink scom, SCOMFilter filter) |
SCOMResult | SCOM_InitFiltering (SCOMDataLink scom) |
SCOMResult | SCOM_DeinitFiltering (SCOMDataLink scom) |
void | SCOM_FilterProc (SCOMDataLink scom) |
SCOMResult | SCOM_RunFilteringThread (SCOMDataLink scom) |
void | SCOM_StopFilteringThread (SCOMDataLink scom) |
Packet filtering API.
Frame filtering for the SCOM Serial communication protocol.
Definition in file scom_filtering.h.
#define SCOM_DECLARE_FILTER_FRAME_POOL | ( | name, | |
size | |||
) |
This macro create filter buffer structure.
name | - buffer name |
size | - number of SCOMbuffer size |
Definition at line 28 of file scom_filtering.h.
typedef struct SCOMFilterDesc* SCOMFilter |
Utility type being a pointer to a SCOM frame filter descriptor.
Definition at line 41 of file scom_filtering.h.
typedef struct SCOMFilterDesc SCOMFilterDesc |
Type declaration of the SCOM frame filter descriptor.
Definition at line 38 of file scom_filtering.h.
typedef struct SCOMFilterFrame SCOMFilterFrame |
Type declaration of the SCOM frame filter.
Definition at line 35 of file scom_filtering.h.
typedef bool(* SCOMFilterMatchFunc)(SCOMDataLink scom, SCOMFilter filter, SCOMFrame *frame) |
Type defining a function that performs filter matching (returns 1 when frame matches filter, 0 otherwise)
Definition at line 44 of file scom_filtering.h.
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().