File: log_core.hpp

package info (click to toggle)
raidutils 0.0.6-23
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,840 kB
  • sloc: cpp: 39,794; ansic: 22,774; sh: 8,306; makefile: 19
file content (362 lines) | stat: -rw-r--r-- 9,933 bytes parent folder | download | duplicates (9)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
/* Copyright (c) 1996-2004, Adaptec Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * - Neither the name of the Adaptec Corporation nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __LOG_CORE_HPP
#define __LOG_CORE_HPP

//File - LOG_CORE.HPP
//***************************************************************************
//
//Description: some of the most common things for the logger
//
//
//Author: Bill Smith
//Date: 10/3/95
//
//Editors:
//
//Remarks:
//
//
//***************************************************************************


//Include Files -------------------------------------------------------------

#include "eng_std.h"
#include "osd_util.h"

// SNMP trap event info
#include "trapdef.h"

#ifdef _DPT_NETWARE
#include <conio.h>
#endif

#ifdef __UNIX__
#include "funcs.h"
#endif

//Definitions - Defines & Constants -----------------------------------------

#define TRUE 1
#define FALSE 0
#if !defined __MWERKS__
#if !defined false
#define false FALSE
#endif
#if !defined true
#define true TRUE
# endif
#endif

// ini file string constants

// name of the ini file
#define INI_NAME "dptelog.ini"

#define GLOBAL_GROUP_STR "Global Group"

// max length of a filename
const uSHORT MAX_FILENAME_LEN = 129;

// the size of the to engine buffers
const uLONG TO_ENG_BUFF_SIZE = 0x4000;

// size of the global engine buffer, this is the max size
// we should ever try to use, its big...  16k
const uLONG GLOB_ENG_BUFF_SIZE = 0x4000;

//
// Logger_C types
//

const uLONG MGR_TYPE =			0x80000000;

// event logging object types
const uLONG LOGGER_TYPE_EVENT = 0x00000000;

// event logger mgr
const uLONG LOGGER_TYPE_EVENT_MGR = LOGGER_TYPE_EVENT | MGR_TYPE;

// stats logger
const uLONG LOGGER_TYPE_STATS = 0x00000001;

// stats mgr
const uLONG LOGGER_TYPE_STATS_MGR = LOGGER_TYPE_STATS | MGR_TYPE;

// heart bet logger
const uLONG LOGGER_TYPE_HB = 0x00000002;

// heartbeat log mgr
const uLONG LOGGER_TYPE_HB_MGR =  LOGGER_TYPE_HB | MGR_TYPE;

// unknown logger type
const uLONG LOGGER_TYPE_UNKNOWN = 0xffffffff;



// broadcaster types

// debug broadcaster
const uLONG BROADCASTER_TYPE_DEBUG = 		0x0000000A;
// debug broadcaster MGR
const uLONG BROADCASTER_TYPE_DEBUG_MGR = 	BROADCASTER_TYPE_DEBUG | MGR_TYPE;

// sys log broadcasters
const uLONG BROADCASTER_TYPE_SYSLOG =		0x0000000B;
const uLONG BROADCASTER_TYPE_SYSLOG_MGR = BROADCASTER_TYPE_SYSLOG | MGR_TYPE;

// window broadcasters
const uLONG BROADCASTER_TYPE_WINDOW = 		0x0000000C;
const uLONG BROADCASTER_TYPE_WINDOW_MGR = BROADCASTER_TYPE_WINDOW | MGR_TYPE;

// a broadcast module interface opject
const uLONG BROADCAST_TYPE_MODULE =			0x0000000D;

// the NT event viewer broadcaster
const uLONG BROADCASTER_TYPE_NT_EVENT =	0x0000000E;
const uLONG BROADCASTER_TYPE_NT_EVENT_MGR = BROADCASTER_TYPE_NT_EVENT | MGR_TYPE;

// the nt message broadcaster
const uLONG BROADCASTER_TYPE_NT_MSG 	=	0x0000000F;
const uLONG BROADCASTER_TYPE_NT_MSG_MGR = BROADCASTER_TYPE_NT_MSG | MGR_TYPE;

// the netware message broadcaster
const uLONG BROADCASTER_TYPE_NW_MSG 	=	0x00000010;
const uLONG BROADCASTER_TYPE_NW_MSG_MGR = BROADCASTER_TYPE_NW_MSG | MGR_TYPE;

// the nw console printf mananger
const uLONG BROADCASTER_TYPE_CONSOLE  	=	0x00000011;
const uLONG BROADCASTER_TYPE_CONSOLE_MGR = BROADCASTER_TYPE_CONSOLE | MGR_TYPE;

// the mail broadcaster
const uLONG BROADCASTER_TYPE_MAIL  	=	0x00000012;
const uLONG BROADCASTER_TYPE_MAIL_MGR   =  BROADCASTER_TYPE_MAIL | MGR_TYPE;

// the mail broadcaster
const uLONG BROADCASTER_TYPE_DEVICE_WRITE       =       0x00000013;
const uLONG BROADCASTER_TYPE_DEVICE_WRITE_MGR   =  BROADCASTER_TYPE_DEVICE_WRITE | MGR_TYPE;

// the mail broadcaster
const uLONG BROADCASTER_TYPE_USER_WRITE         =       0x00000014;
const uLONG BROADCASTER_TYPE_USER_WRITE_MGR   =  BROADCASTER_TYPE_USER_WRITE | MGR_TYPE;

// the MAPI broadcaster
const uLONG BROADCASTER_TYPE_MAPI       =       0x00000015;
const uLONG BROADCASTER_TYPE_MAPI_MGR   =  BROADCASTER_TYPE_MAPI | MGR_TYPE;

// the SNMP broadcaster
const uLONG BROADCASTER_TYPE_SNMP  	=	0x00000016;
const uLONG BROADCASTER_TYPE_SNMP_MGR   =  BROADCASTER_TYPE_SNMP | MGR_TYPE;

// the AIX log file broadcaster
const uLONG BROADCASTER_TYPE_AIXLOG	=       0x00000017;
const uLONG BROADCASTER_TYPE_AIXLOG_MGR = BROADCASTER_TYPE_AIXLOG | MGR_TYPE;

// the NT audio file broadcaster
const uLONG BROADCASTER_TYPE_AUDIO	=       0x00000018;
const uLONG BROADCASTER_TYPE_AUDIO_MGR = BROADCASTER_TYPE_AUDIO | MGR_TYPE;

// the MAPI broadcaster
const uLONG BROADCASTER_TYPE_TAPI       =       0x00000019;
const uLONG BROADCASTER_TYPE_TAPI_MGR   =  BROADCASTER_TYPE_TAPI | MGR_TYPE;

// the XMT_EVT broadcaster
const uLONG BROADCASTER_TYPE_XMT_EVT  	=	0x0000001b;
const uLONG BROADCASTER_TYPE_XMT_EVT_MGR   =  BROADCASTER_TYPE_XMT_EVT | MGR_TYPE;
//
// errors
//

// error creating an object
const uLONG ERR_LOGGER_MEM =                    0x00000001;

// error opening a log file
const uLONG ERR_OPEN_LOG_FILE =		0x00000002;

// required deivce for this log mgr to operate properly does
// not exists
const uLONG ERR_REQUIRED_DEVICE =	0x00000004;

// errors initializing the engine

// incompatablie
const uLONG ERR_NOT_COMPAT =			0x00000008;

// can't open, ie find
const uLONG ERR_OPEN_ENGINE =			0x00000010;

// modules didn't load
const uLONG ERR_LOADING_MODULE =		0x00000020;

// the FW in the hba was less that what is required for stats logging
const uLONG ERR_SLOG_FW_VERSION =	0x00000040;

// there was an error creating a semaphore
const uLONG ERR_SEM_CREATE      =   0x00000080;

// could not create the AIX error template
const uLONG ERR_AIX_LOGGER      =   0x00000100;


//
// broadcaster specialty flags
const uLONG SPFLG_OS2_WININTIALIZE = 0x00000001;

// the number of possible machines/users we will broadcast to
#define MAX_NUM_BROADCAST_USERS 10
#define MAX_USERNAME_LEN 50

//Definitions - Structure & Typedef -----------------------------------------

//struct - LoggerID_S - start
//===========================================================================
//
//Description: this is the Logger ID structure
//
//
//
//---------------------------------------------------------------------------
struct LoggerID_S
{
	// tag and a type similar to dptID_S
	uLONG tag, type;
};
// - end

//class - LogError_C - start
//===========================================================================
//
//Description: goes the error handling
//
//
//
//---------------------------------------------------------------------------
class LogError_C
{
	public:

		LogError_C()
			{ errorFlags = 0; };

		virtual ~LogError_C() {};

		// get errors
		uLONG GetError()
			{ return(errorFlags); };

		// set the error flag
		void SetError(uLONG x)
			{ errorFlags |= x; }

	private:

		// error flags
		uLONG errorFlags;
};
// - end

//class - LoggerCore_C - start
//===========================================================================
//
//Description: used to have logger tags and logger types
//
//
//
//---------------------------------------------------------------------------
class LoggerCore_C : public LogError_C
{
	public:

		// used to assign the logger type
		LoggerCore_C(uLONG newType)
		{
			// assign the tag and increment it
			id.tag = nextTag++;

			//assign the type
			id.type = newType;
		}

		// returns the tag assigned by the logger
		DPT_TAG_T GetLoggerTag()
			{ return(id.tag); };

		// return the logger type
		uLONG GetLoggerType()
			{ return(id.type); };

		// return the id
		LoggerID_S * GetID()			// possibly pass in engine buffer or memcpy passed
			{ return(&id); };		// in pointer

	private:

		// logger id structure
		LoggerID_S id;

		// the number of the next tag to be assigned
		static DPT_TAG_T nextTag;
};

//struct - AdditionEventInfo_S - start
//===========================================================================
//
//Description: this is additional event info sent to the broadcaster that needs
//					to be filled in before they get it
//
//
//
//---------------------------------------------------------------------------
struct AdditionalEventInfo_S
{
	// SNMP trap info for both the actual and resultant events
	snmpTrapVars_S actualTrap;
	snmpTrapVars_S resultantTrap;

};
// - end




//Variables - External ------------------------------------------------------


//Variables - Global --------------------------------------------------------


//Variables - File Scope ----------------------------------------------------


//Prototypes - function -----------------------------------------------------


#endif