
/**
@file log_filter.h
@brief Data type definition, macro definition and declaration processing.
*/


/********************************************************************************************
Multi-Inlcude-Prevent Section
********************************************************************************************/
#ifndef _LOG_FILTER_H_
#define _LOG_FILTER_H_

/********************************************************************************************
Debug Switch Definition Section
********************************************************************************************/


/********************************************************************************************
Include File Section
********************************************************************************************/
#include "ecarx_queue.h"
#include "log_event.h"
#include "log.h"
/********************************************************************************************
Macro Definition Section
********************************************************************************************/
#if 0
#define MK_FILTER_LIST(filterQ)       \
static FilterQueue filterQ  =\
{\
.FilterListDecide = xFilterSetDecide,\
.FilterInit = vFilterInit,\
.FilterRegister = vFilterRegister,\
.FilterUnregister = vFilterUnregister,\
}
#endif
#define MK_FILTER_LIST(filterQ)       \
static FilterQueue filterQ  =\
{\
	.FilterListDecide = xFilterSetDecide,\
	.FilterInit = vFilterInit,\
	.FilterRegister = vFilterRegister,\
	.FilterUnregister = vFilterUnregister,\
}


typedef struct filterq FilterQueue_t;

/********************************************************************************************
Structure Type Declaration Section
********************************************************************************************/

typedef enum
{
    DENY = -1,
    NEUTRAL = 0,
    ACCEPT = 1
} Decision;
typedef struct
{
    QUEUE entry;		/*link to filter list*/
    Decision (* _Decide)(LoggingEvent *event);
} Filter;

typedef struct filterq FilterQueue;
struct filterq
{
    QUEUE List;
    Decision (*FilterListDecide)(QUEUE *filterlist,  LoggingEvent *event);
    void (*FilterInit)(FilterQueue *list);
    void (*FilterRegister)(FilterQueue *list, Filter *filter);
    void (*FilterUnregister)(Filter *list);
};
#if 0
typedef enum
{
    DENY = -1,
    NEUTRAL = 0,
    ACCEPT = 1
} Decision;

typedef struct
{
    QUEUE entry;		/*link to filter list*/
    Decision (* _Decide)(LoggingEvent *event);
} Filter;



struct filterq
{
    QUEUE List;
    Decision (*FilterListDecide)(QUEUE *filterlist,  LoggingEvent *event);
    void (*FilterInit)(FilterQueue_t *list);
    void (*FilterRegister)(FilterQueue_t *list, Filter *filter);
    void (*FilterUnregister)(Filter *list);
};
#endif
/********************************************************************************************
Prototype Declaration Section                                   
********************************************************************************************/
//extern Decision pfFilterSetDecide(QUEUE *filterlist,  LoggingEvent *event);
//extern void pfFilterInit(FilterQueue_t *flist);
//extern void pfFilterRegister(FilterQueue_t *flist, Filter *filter);
//extern void pfFilterUnregister(Filter *filter);
Decision xFilterSetDecide(QUEUE *filterlist,  LoggingEvent *event);
void vFilterInit(FilterQueue *flist);
void vFilterRegister(FilterQueue *flist, Filter *filter);
void vFilterUnregister(Filter *filter);
#endif


