aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common/report/distributor.h
blob: bb7a3fda87441d2cdcb47f9b67c12e7e06db2a69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef __RDISTRIBUTOR_H__
#define __RDISTRIBUTOR_H__

/* The following enum is to inform about the kind of message format. For example:
 * MESSAGE_FORMAT: this is a message
 * REPORT_FORMAT: distributor.h.7, Error: this is a message. 0, (0x0,0x1)   */
typedef enum { MESSAGE_FORMAT, REPORT_FORMAT } FormatType;

/* Use the following macro in order to get the private severity as the         */
/* severity parameter from one of the Report routines                             */
#define GET_PRIVATE_SEVERITY(handle) (DistributorHandle)((handle)>>5)

/* The mask of currently enabled severity. */
extern bool filterTest(ErrorSeverity severity);

extern STATUS distibutorInit( int priority, int maxMsgs, int maxDestinations );

extern STATUS reportDistribute(FormatType format,
                               char    *message,
                               char            *FileName,
                               int             LineNumber,
                               int           errorCode, 
                               ErrorSeverity severity,
                               int           parameter1, 
                               int           parameter2);


/***************************************************************************
 *
 *  Name        : ReportStrCmp
 *
 *  Function    : compare between two string with case-insensitive.
 *
 *  Notes       : 
 *
 *  Return value: TRUE - strings are identical; FALSE - otherwise
 **************************************************************************/
extern bool ReportStrCmp(const char *str1, const char *str2);


/***************************************************************************
 *
 *  Name        : IsNameExistsInDistributorTable
 *
 *  Function    : Check if a given name is already found in the table 
 *                of the private severities
 *
 *  Notes       : 
 *
 *  Return value: TRUE if found; FALSE otherwise
 **************************************************************************/
extern bool IsNameExistsInDistributorTable(const char *name);

/***************************************************************************
 *
 *  Name        : ReportGetDistributorHandleByName
 *
 *  Function    : Get the severity handle given the severity's name
 *
 *  Notes       : 
 *
 *  Return value: the handle; or -1 if no such name
 **************************************************************************/
extern DistributorHandle ReportGetDistributorHandleByName(const char *distributorName);


/***************************************************************************
 *
 *  Name        : GetDistributorParamsByHandle
 *
 *  Function    : Get the private severity details according to its handle
 *
 *  Parameters  : DistributorHandle - table entry
 *                name - buffer to contain the private severity's name
 *                IsActive - FALSE if the private severity 
 *
 *  Notes       : The name field must exceeds 10 bytes long
 *
 *  Return value: OK or ERROR and then:
 *                errno = REPORT_ERROR_ILLEGAL_PARAMETER if no such entry
 *                errno = REPORT_ERROR_FILTER_NOT_ALIVE if the private
 *                        severity has already removed (and thus it is no 
 *                        no longer exists until re-added).
 **************************************************************************/
extern STATUS GetDistributorParamsByHandle(uint32_t DistributorHandle,
                                               char *name,
                                               bool *IsActive);
/*	Total message length w/o message text in bytes 
   (for reportMsgFormat function ) */
#define REPORT_MSG_FORMAT_LEN	61

#endif   /* __RDISTRIBUTOR_H__ */