| 1 |
/* The var object. |
| 2 |
* |
| 3 |
* Copyright 2008-2026 Adiscon GmbH. |
| 4 |
* |
| 5 |
* This file is part of the rsyslog runtime library. |
| 6 |
* |
| 7 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 |
* you may not use this file except in compliance with the License. |
| 9 |
* You may obtain a copy of the License at |
| 10 |
* |
| 11 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
* -or- |
| 13 |
* see COPYING.ASL20 in the source distribution |
| 14 |
* |
| 15 |
* Unless required by applicable law or agreed to in writing, software |
| 16 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 17 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 |
* See the License for the specific language governing permissions and |
| 19 |
* limitations under the License. |
| 20 |
*/ |
| 21 |
#ifndef INCLUDED_VAR_H |
| 22 |
#define INCLUDED_VAR_H |
| 23 |
|
| 24 |
#include "stringbuf.h" |
| 25 |
|
| 26 |
/* data types */ |
| 27 |
typedef enum { |
| 28 |
VARTYPE_NONE = 0, /* currently no value set */ |
| 29 |
VARTYPE_STR = 1, |
| 30 |
VARTYPE_NUMBER = 2, |
| 31 |
VARTYPE_SYSLOGTIME = 3 |
| 32 |
} varType_t; |
| 33 |
|
| 34 |
/* the var object */ |
| 35 |
typedef struct var_s { |
| 36 |
BEGINobjInstance |
| 37 |
; /* Data to implement generic object - MUST be the first data element! */ |
| 38 |
cstr_t *pcsName; |
| 39 |
varType_t varType; |
| 40 |
union { |
| 41 |
number_t num; |
| 42 |
es_str_t *str; |
| 43 |
cstr_t *pStr; |
| 44 |
syslogTime_t vSyslogTime; |
| 45 |
} val; |
| 46 |
} var_t; |
| 47 |
|
| 48 |
|
| 49 |
/* interfaces */ |
| 50 |
BEGINinterface(var) /* name must also be changed in ENDinterface macro! */ |
| 51 |
INTERFACEObjDebugPrint(var); |
| 52 |
rsRetVal (*Construct)(var_t **ppThis); |
| 53 |
rsRetVal (*ConstructFinalize)(var_t __attribute__((unused)) * pThis); |
| 54 |
rsRetVal (*Destruct)(var_t **ppThis); |
| 55 |
ENDinterface(var) |
| 56 |
#define varCURR_IF_VERSION 2 /* increment whenever you change the interface above! */ |
| 57 |
/* v2 - 2011-07-15/rger: on the way to remove var */ |
| 58 |
|
| 59 |
|
| 60 |
/* prototypes */ |
| 61 |
PROTOTYPEObjFull(var); |
| 62 |
PROTOTYPEObjDebugPrint(var); |
| 63 |
|
| 64 |
#endif /* #ifndef INCLUDED_VAR_H */ |