"Fossies" - the Fresh Open Source Software Archive

Member "rsyslog-8.1911.0/action.h" (2 Oct 2019, 5260 Bytes) of package /linux/misc/rsyslog-8.1911.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "action.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 8.1903.0_vs_8.1904.0.

    1 /* action.h
    2  * Header file for the action object
    3  *
    4  * File begun on 2007-08-06 by RGerhards (extracted from syslogd.c, which
    5  * was under BSD license at the time of rsyslog fork)
    6  *
    7  * Copyright 2007-2018 Adiscon GmbH.
    8  *
    9  * This file is part of rsyslog.
   10  *
   11  * Licensed under the Apache License, Version 2.0 (the "License");
   12  * you may not use this file except in compliance with the License.
   13  * You may obtain a copy of the License at
   14  *
   15  *       http://www.apache.org/licenses/LICENSE-2.0
   16  *       -or-
   17  *       see COPYING.ASL20 in the source distribution
   18  *
   19  * Unless required by applicable law or agreed to in writing, software
   20  * distributed under the License is distributed on an "AS IS" BASIS,
   21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   22  * See the License for the specific language governing permissions and
   23  * limitations under the License.
   24  */
   25 #ifndef ACTION_H_INCLUDED
   26 #define ACTION_H_INCLUDED 1
   27 
   28 #include "syslogd-types.h"
   29 #include "queue.h"
   30 
   31 /* external data */
   32 extern int glbliActionResumeRetryCount;
   33 extern int bActionReportSuspension;
   34 extern int bActionReportSuspensionCont;
   35 
   36 
   37 /* the following struct defines the action object data structure
   38  */
   39 struct action_s {
   40     time_t  f_time;     /* used for "max. n messages in m seconds" processing */
   41     time_t  tActNow;    /* the current time for an action execution. Initially set to -1 and
   42                    populated on an as-needed basis. This is a performance optimization. */
   43     time_t  tLastExec;  /* time this action was last executed */
   44     int iActionNbr; /* this action's number (ID) */
   45     sbool   bExecWhenPrevSusp;/* execute only when previous action is suspended? */
   46     sbool   bWriteAllMarkMsgs;
   47     /* should all mark msgs be written (not matter how recent the action was executed)? */
   48     sbool   bReportSuspension;/* should suspension (and reactivation) of the action reported */
   49     sbool   bReportSuspensionCont;
   50     sbool   bDisabled;
   51     sbool   isTransactional;
   52     sbool   bCopyMsg;
   53     int iSecsExecOnceInterval; /* if non-zero, minimum seconds to wait until action is executed again */
   54     time_t  ttResumeRtry;   /* when is it time to retry the resume? */
   55     int iResumeInterval;/* resume interval for this action */
   56     int iResumeIntervalMax;/* maximum resume interval for this action --> -1: unbounded */
   57     int iResumeRetryCount;/* how often shall we retry a suspended action? (-1 --> eternal) */
   58     int iNbrNoExec; /* number of matches that did not yet yield to an exec */
   59     int iExecEveryNthOccur;/* execute this action only every n-th occurence (with n=0,1 -> always) */
   60     int     iExecEveryNthOccurTO;/* timeout for n-th occurence feature */
   61     time_t  tLastOccur; /* time last occurence was seen (for timing them out) */
   62     struct modInfo_s *pMod;/* pointer to output module handling this selector */
   63     void    *pModData;  /* pointer to module data - content is module-specific */
   64     sbool   bRepMsgHasMsg;  /* "message repeated..." has msg fragment in it (0-no, 1-yes) */
   65     rsRetVal (*submitToActQ)(action_t *, wti_t*, smsg_t*);/* function submit message to action queue */
   66     rsRetVal (*qConstruct)(struct queue_s *pThis);
   67     sbool   bUsesMsgPassingMode;
   68     sbool   bNeedReleaseBatch; /* do we need to release batch ressources? Depends on ParamPassig modes... */
   69     int iNumTpls;   /* number of array entries for template element below */
   70     struct template **ppTpl;/* array of template to use - strings must be passed to doAction
   71                  * in this order. */
   72     paramPassing_t *peParamPassing; /* mode of parameter passing to action for that template */
   73     qqueue_t *pQueue;   /* action queue */
   74     pthread_mutex_t mutAction; /* primary action mutex */
   75     uchar *pszName;     /* action name */
   76     DEF_ATOMIC_HELPER_MUT(mutCAS)
   77     /* error file */
   78     const char *pszErrFile;
   79     int fdErrFile;
   80     pthread_mutex_t mutErrFile;
   81     /* external stat file system */
   82     const char *pszExternalStateFile;
   83     /* for per-worker HUP processing */
   84     pthread_mutex_t mutWrkrDataTable; /* protects table structures */
   85     void **wrkrDataTable;
   86     int wrkrDataTableSize;
   87     int nWrkr;
   88     /* for statistics subsystem */
   89     statsobj_t *statsobj;
   90     STATSCOUNTER_DEF(ctrProcessed, mutCtrProcessed)
   91     STATSCOUNTER_DEF(ctrFail, mutCtrFail)
   92     STATSCOUNTER_DEF(ctrSuspend, mutCtrSuspend)
   93     STATSCOUNTER_DEF(ctrSuspendDuration, mutCtrSuspendDuration)
   94     STATSCOUNTER_DEF(ctrResume, mutCtrResume)
   95 };
   96 
   97 
   98 /* function prototypes
   99  */
  100 rsRetVal actionConstruct(action_t **ppThis);
  101 rsRetVal actionConstructFinalize(action_t *pThis, struct nvlst *lst);
  102 rsRetVal actionDestruct(action_t *pThis);
  103 rsRetVal actionSetGlobalResumeInterval(int iNewVal);
  104 rsRetVal actionDoAction(action_t *pAction);
  105 rsRetVal actionWriteToAction(action_t *pAction, smsg_t *pMsg, wti_t*);
  106 rsRetVal actionCallHUPHdlr(action_t *pAction);
  107 rsRetVal actionClassInit(void);
  108 rsRetVal addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringRequest_t *pOMSR,
  109     struct cnfparamvals *actParams, struct nvlst *lst);
  110 rsRetVal activateActions(void);
  111 rsRetVal actionNewInst(struct nvlst *lst, action_t **ppAction);
  112 rsRetVal actionProcessCnf(struct cnfobj *o);
  113 void actionCommitAllDirect(wti_t *pWti);
  114 void actionRemoveWorker(action_t *const pAction, void *const actWrkrData);
  115 void releaseDoActionParams(action_t * const pAction, wti_t * const pWti, int action_destruct);
  116 
  117 /* external data */
  118 extern int iActionNbr;
  119 
  120 #endif /* #ifndef ACTION_H_INCLUDED */