#include <ipa_mod.h>


           API   IPA .    IPA   ``''. ,   ,    , ,      IPA   IPA .

             API:

       ipa_memfunc API  1 (IPA_MEMFUNC_API_VERSION);
       ipa_ac_mod API  1 (IPA_AC_MOD_API_VERSION);
       ipa_db_mod API  1 (IPA_DB_MOD_API_VERSION);
       ipa_st_mod API  1 (IPA_ST_MOD_API_VERSION).

            u_int,   unsigned int,      <ipa_mod.h>.

          .

               foobar-x.y.z.so.        dlopen(3)   ,  IPA  foobar_ac_mod, foo-
       bar_db_mod  foobar_st_mod       ,    .      ,     IPA .

          (void *) (struct ipa_XX_mod *).  struct ipa_XX_mod  API  IPA   .

             .       , .

       -   .

             .   ,       -   ,    .  ,   -    ,   .   fork(2)      IPC,      -
       IPC   .

         ,  ( SIGALRM,   ), ,  IPA ,    .    ,      .

               ,   IPA  ,      .        ,          .

             ,   .  ,  .         .         API,  ,       .

        IPA   ,   ,       .       ipa_memfunc, IPA ,     .

          ,    .

            .

       API       .  ipa_memfunc   .  .  ipa_memfunc.

            ipa_memfunc:  ,      ,   mzone     marray.

         mem_*          (malloc(3),  calloc(3), realloc(3), free(3), strdup(3)
       vasprintf(3),    ).   .  mem_*       mem_free.      ,  mem_type ( ),  .
       mem_type     mem_type_new.

       -      . -      .  marray_*  mzone_*    mem_*.

         ipa_memfunc     mem_*, marray_* mzone_*.   ,  .
           int     (*memfunc_init)(void);
           void    (*memfunc_deinit)(int foreign);
           ipa_mem_type *m_parser;
           ipa_mem_type *(*mem_type_new)(const char *name, const char *desc,
                       u_int flags);
           void    *(*mem_malloc)(size_t size, ipa_mem_type *mem_type);
           void    *(*mem_calloc)(size_t number, size_t size,
                       ipa_mem_type *mem_type);
           void    *(*mem_realloc)(void *ptr, size_t size,
                       ipa_mem_type *mem_type);
           char    *(*mem_strdup)(const char *str, ipa_mem_type *mem_type);
           int     (*mem_vasprintf)(ipa_mem_type *mem_type, char **bufp,
                       const char *format, va_list ap);
           void    (*mem_free)(void *ptr, ipa_mem_type *mem_type);
           ipa_marray *(*marray_init)(const char *name, const char *desc,
                       u_int flags, void **arr, size_t isize, u_int nitems,
                       u_int nalloc);
           void    (*marray_deinit)(ipa_marray *marray);
           int     (*marray_alloc)(ipa_marray *marray, u_int *idxp,
                       int fixed);
           void    (*marray_free)(ipa_marray *marray, u_int idx);
           void    (*marray_minimize)(ipa_marray *marray);
           int     (*marray_check_index)(ipa_marray *marray, u_int idx);
           u_int   (*marray_nused)(ipa_marray *marray);
           ipa_mzone *(*mzone_init)(const char *name, const char *desc,
                       u_int flags, size_t isize, u_int nitems, u_int nalloc);
           void    (*mzone_deinit)(ipa_mzone *mzone);
           void    *(*mzone_alloc)(ipa_mzone *mzone);
           void    (*mzone_free)(ipa_mzone *mzone, void *ptr);
           u_int   (*mzone_nused)(ipa_mzone *mzone);
       } ipa_memfunc;

       api_ver
               API ipa_memfunc, API  IPA_MEMFUNC_API_VERSION   .

       memfunc_init
               ipa_memfunc .

       memfunc_deinit
               mzone  marray, ipa_memfunc.   foreign   ,    . ,        .

       m_parser
                 mem_type  .

       mem_type_new
                 mem_type,   name        mem_type,   desc      (    )    flags
              mem_type.        IPA_MEMFUNC_FLAG_PTHREAD,        mem_type     .
              mem_type  NULL  .

       mem_malloc
               malloc(3).

               free(3).

       marray_init
                marray,  name    marray,    ,   marray    .     marray   <mod-
              ule_name>:<marray_name>.  desc     (    ).   flags       marray,
              IPA_MEMFUNC_FLAG_PTHREAD,      ,      marray      . arr  . isize
              .  nitems   ,   .  nalloc    ,    ,    marray  .         ,    1.
              marray  NULL,   - . ,     arr   marray_alloc  marray_free.

       marray_deinit
                 marray.  ,  IPA marray ,     ,  ,    marray   , , ,   .  mar-
              ray  NULL,      .

       marray_alloc
                     marray.   fixed    ,   *idxp     marray,    *idxp.     0,
              -1,   .      fixed.

       marray_free
                    idx  marray.

       marray_minimize
                ,  marray.  ,   marray_alloc  marray_free     .

       marray_check_index
                       idx marray      ,   0,   .

       marray_nused
                    marray.

       mzone_init
                 mzone,   name     mzone,     ,   mzone    .     mzone   <mod-
              ule_name>:<mzone_name>. desc    (   ).  flags    ,  marray_init,
              mzone  IPA_MEMFUNC_FLAG_OPTIMIZE,     ,  mzone   . isize  mzone.
              nitems   ,    . nalloc ,   ,   mzone  .        ,     1.    mzone
              NULL,   - .

       mzone_deinit
                  mzone.   ,  IPA mzone ,     ,  ,    mzone   , , ,   .  mzone
              NULL,      .

       mzone_alloc
                  mzone.      NULL,   .

       mzone_free
                   ptr  mzone.

       mzone_nused
                    mzone.

          .

         ,     ,  IPA     ,  -.         , IPA ,   , ipa_memfunc:
           void    (*print_sect_begin)(void);
           void    (*print_sect_end)(void);
           void    (*open_log)(void);
           void    (*close_log)(void);
           void    (*logmsg)(const char *mod_name, int priority, int code,
                       const char *format, va_list ap);
           void    (*logconferr)(const char *mod_name, int code,
                       const char *format, va_list ap);
           int     (*local_sym_add)(char *sym, char *val, int copy_flag);
           int     (*local_sym_del)(cost char *sym);
           int     (*global_sym_add)(char *sym, char *val, int copy_flag);
           int     (*global_sym_del)(cost char *sym);
       } ipa_suppfunc;

       print_string
                   .

       print_bytes
                 .

       print_time
                 .

       print_value
                    ,      64-     ,      value_type      IPA_CONF_TYPE_BYTES,
              IPA_CONF_TYPE_TIME  IPA_CONF_TYPE_UINT64 .

       print_boolean
                  .

       print_space
                   ,      .

       set_indent
                  , indent,     .

       print_param_name
                   param, prefix.      , prefix    NULL.

       print_param_args
               vprintf(3)     ,         .

       print_param_end
                       .

       print_sect_name
                   sect prefix.      , prefix    NULL.

       print_sect_args
               vprintf(3)     ,         .

       print_sect_end

       local_sym_add
                   sym   val,  copy_flag   ,       sym   val      ,   .     0,
              -1,     .

       local_sym_del
                   sym.      sym,   -1, 0.        ,   IPA   .

       global_sym_add
               local_sym_add,    .

       global_sym_del
               local_sym_del,    .

         .

        ipa_conf_sect   :

       typedef struct {
           const char      *sect_name;
           u_int           sect_id;
           int             arg_nargs;
           const char      *arg_pattern;
           regex_t         *arg_regexp;
           u_int           arg_type;
           const u_int     *sect_where;
           int             (*arg_parse)(void *arg);
       } ipa_conf_sect;

       sect_name
               .

       sect_id
               ,     .      IPA_CONF_SECT_CUSTOM_OFFSET.

       arg_nargs
                .     0,    .  ,        , .

       arg_pattern
               POSIX ( ).     ,      NULL.

       arg_regexp
                   regex_t.  arg_pattern  NULL,        NULL.   .      arg_pat-
              tern,   arg_pattern  NULL.

       arg_type
               .   :

              IPA_CONF_TYPE_INT32    - int32_t;
              IPA_CONF_TYPE_UINT32   - uint32_t;
              IPA_CONF_TYPE_INT64    - int64_t;
              IPA_CONF_TYPE_UINT64   - uint64_t;
              IPA_CONF_SECT_ROOT   -  ;
              IPA_CONF_SECT_GLOBAL -  global;
              IPA_CONF_SECT_RULE   -  rule;
              IPA_CONF_SECT_LIMIT  -  limit;
              IPA_CONF_SECT_THRESHOLD -  threshold;
              IPA_CONF_SECT_AUTORULE -  autorule;
              IPA_CONF_SECT_RULEPAT  -  rulepat.

       arg_parse
                   .     NULL,      . arg  ,     arg_type arg_parse     :

              IPA_CONF_TYPE_INT32   - *(int32_t *)arg;
              IPA_CONF_TYPE_UINT32  - *(uint32_t *)arg;
              IPA_CONF_TYPE_INT64   - *(int64_t *)arg;
              IPA_CONF_TYPE_UINT64  - *(uint64_t *)arg;
              IPA_CONF_TYPE_STRING  - *(char **)arg;
              IPA_CONF_TYPE_BYTES   - *(uint64_t *)arg;
              IPA_CONF_TYPE_TIME    - *(uint64_t *)arg;
              IPA_CONF_TYPE_VALUE   - *(uint64_t *)arg, *((uint64_t *)arg + 1)
              IPA_CONF_TYPE_BOOLEAN - *(int *)arg;
              IPA_CONF_TYPE_MISC    - *(char **)arg.

                arg_type  IPA_CONF_TYPE_STRING,  arg    , ( ),      mem_malloc
              mem_type   m_parser         mem_free.    arg_parse     ,    arg.
              arg_type  IPA_CONF_TYPE_MISC,  arg   ,  arg     ` '.    arg_type
              IPA_CONF_TYPE_VALUE,      arg      ,        IPA_CONF_TYPE_BYTES,
              IPA_CONF_TYPE_TIME  IPA_CONF_TYPE_UINT64,     .

         .

        ipa_conf_param   :

       typedef struct {
           const char      *param_name;
           int             arg_nargs;
           const char      *arg_pattern;
           regex_t         *arg_regexp;
           u_int           arg_type;
           const u_int     *param_where;
           int             (*arg_parse)(void *arg);
       } ipa_conf_param;

       param_name
               .

       arg_nargs
               .

       arg_pattern
               .

       arg_regexp

       typedef struct tm ipa_tm;

            ipa_tm   : tm_year,  tm_mon,  tm_mday,  tm_hour,  tm_min,  tm_sec.
       . tm_year      tm_mon .

        .

           ipa_limit_state:

       struct ipa_limit_state {
           uint64_t    lim;
           uint64_t    cnt;
           u_int       event_date_set;
           ipa_tm      event_date[IPA_LIMIT_EVENT_NUM];
       };

       lim      limit.

       cnt      .

       event_date_set
                     ,     event_date,      IPA_LIMIT_EVENT_xxx     event_date
              IPA_LIMIT_EVENT_xxx_SET  event_date_set.

       event_date
                  .    :

              IPA_LIMIT_EVENT_START - ,    ;

              IPA_LIMIT_EVENT_RESTART - ,  ;

              IPA_LIMIT_EVENT_RESTART_EXEC - ,  ;

              IPA_LIMIT_EVENT_REACH  - ,    ;

              IPA_LIMIT_EVENT_REACH_EXEC - ,  ;

              IPA_LIMIT_EVENT_EXPIRE - ,      ,    ;

              IPA_LIMIT_EVENT_EXPIRE_EXEC - , ,       .

              IPA_LIMIT_EVENT_UPDATED - ,       .

        .

           ipa_threshold_state:

       struct ipa_threshold_state {
           uint64_t    thr;
           uint64_t    cnt;
           ipa_tm      tm_from;

       API     IPA ipa_ac_mod:

       struct ipa_ac_mod {
           u_int           api_ver;
           u_int           mod_flags;
           const char      *ac_name;
           const ipa_suppfunc *suppfunc;
           const ipa_memfunc *memfunc;
           const char      *conf_prefix;
           ipa_conf_sect   *conf_sect_tbl;
           ipa_conf_param  *conf_param_tbl;
           int             (*conf_init)(void);
           int             (*conf_deinit)(void);
           int             (*conf_event)(u_int event, u_int no,
                               const void *arg);
           int             (*conf_mimic_real)(void);
           int             (*conf_inherit)(u_int rulepatno, u_int ruleno,
                               const char *rule_name);
           void            (*conf_show)(u_int sect_id, u_int no);
           int             (*ac_pre_init)(void)
           int             (*ac_init_autorule)(u_int autoruleno,
                               const char *autorule_name);
           int             (*ac_init_dynrule)(u_int autoruleno, u_int ruleno,
                               const char *rule_name);
           int             (*ac_init_statrule)(u_int ruleno,
                               const char *rule_name);
           int             (*ac_init)(void);
           int             (*ac_deinit_rule)(u_int ruleno);
           int             (*ac_deinit_autorule)(u_int autoruleno);
           int             (*ac_deinit)(void);
           int             (*ac_get_stat)(void);
           int             (*ac_get_rule_stat)(u_int stat_generation,
                               int newstat, u_int ruleno, int *addition,
                               uint64_t *chunk);
           int             (*ac_set_autorule_active)(u_int autoruleno,
                               int active);
           int             (*ac_set_rule_active)(u_int ruleno, int active);
           int             (*ac_set_limit_active)(u_int ruleno, u_int limitno,
                               int active);
           int             (*ac_set_threshold_active)(u_int ruleno,
                               u_int thresholdno, int active);
           int             (*ac_limit_event)(u_int ruleno, u_int limitno,
                               u_int event);
           int             (*ac_threshold_event)(u_int ruleno,
                               u_int thresholdno, u_int event);
           int             (*ac_create_rule)(const char *mod_name,
                               u_int autoruleno, u_int *ruleno,
                               const char *rule_name, const char *rule_info);
           void            (*ac_delete_rule)(const char *mod_name,
                               u_int ruleno);
       };


       conf_prefix
                    .

       conf_sect_tbl
                 ipa_conf_sect ,  .        sect_name  NULL.

       conf_param_tbl
                 ipa_conf_param ,  .  param_name  NULL.

       conf_init
                  ,   .

       conf_deinit
                  , .

       conf_event
                  ,   . conf_event   .      .  :

              IPA_CONF_EVENT_GLOBAL_BEGIN -   global;

              IPA_CONF_EVENT_GLOBAL_END -   global;

              IPA_CONF_EVENT_RULE_BEGIN -   rule, arg  (const char *),  no   ,
              0;

              IPA_CONF_EVENT_RULE_END -   rule;

              IPA_CONF_EVENT_LIMIT_BEGIN -    limit, arg  (const char *), no ,
              0;

              IPA_CONF_EVENT_LIMIT_END -   limit;

              IPA_CONF_EVENT_THRESHOLD_BEGIN -          threshold,         arg
              (const char *), no ,   0;

              IPA_CONF_EVENT_THRESHOLD_END -   threshold;

              IPA_CONF_EVENT_AUTORULE_BEGIN -            autorule,         arg
              (const char *), no     ,   0;

              IPA_CONF_EVENT_AUTORULE_END -   autorule;

              IPA_CONF_EVENT_RULEPAT_BEGIN -      rulepat,    arg        POSIX
              (const char *), no     ,   0;

              IPA_CONF_EVENT_RULEPAT_END -   rulepat;

              IPA_CONF_EVENT_CUSTOM_SECT_BEGIN -    , no    ;

              IPA_CONF_EVENT_CUSTOM_SECT_END -    .

                    .        .        ac_init*.

       ac_init_autorule
                ,     .  autoruleno   , autorule_name   .

       ac_init_dynrule
                 ,  .  autoruleno   ,  ruleno    , rule_name   .     rule_name
              ac_deinit_rule   .    , ac_create_rule  ac_get_stat.

       ac_init_statrule
                  ac_init_dynrule,       .

       ac_init
                     ac_init* (  ac_init_dynrule, ac_create_rule).

       ac_deinit_rule
                   ,  .     ,   ac_init_*rule    .   .

       ac_deinit_autorule
                   ,  .     ,   ac_init_autorule    .

       ac_deinit
                   .    ,   ac_*init   .      ac_deinit_*.

       ac_get_stat
                    ac_get_rule_stat.      ,      ac_get_stat      .

       ac_get_rule_stat
                      ruleno.   stat_generation     (.   ).   newstat  ,     ,
              (,       ).    chunk       *addition      ,        ,      ,    .
              ac_get_rule_stat.    ,    , .

       ac_set_autorule_active
                      .    active  ,    ,   .

       ac_set_rule_active
               ,   .

       ac_set_limit_active
               ,   .

       ac_set_threshold_active
               ,   .

       ac_limit_event
                      .   event  :

              IPA_LIMIT_EVENT_RESTART -  ;
              IPA_LIMIT_EVENT_REACH  -  ;
              IPA_LIMIT_EVENT_EXPIRE -   ;
              IPA_LIMIT_EVENT_STARTUP_IF_REACHED -   ;
              IPA_LIMIT_EVENT_STARTUP_IF_NOT_REACHED -    ;
              rule_name     ,   rule_info     ,        ,     ,        .   -  ,
              ac_init_dynrule.

                 0,     , -2         -1   -  ,       -1 ac_get_stat.

       ac_delete_rule
                 .

                      ac_get_stat      ruleno    ac_create_rule.  mod_name   (
              ).      - ac_deinit_rule.

                 - ,     0.      ,   -1,     -1  ac_get_stat.

        - ,  ac_create_rule, ,  0,      -1.

           -  ,  ,    ,      NULL.

        -   ,       ( NULL).

       API   .

       API      IPA ipa_db_mod:

       struct ipa_db_mod {
           u_int           api_ver;
           u_int           mod_flags;
           const char      *db_name;
           const ipa_suppfunc *suppfunc;
           const ipa_memfunc *memfunc;
           const char      *conf_prefix;
           ipa_conf_sect   *conf_sect_tbl;
           ipa_conf_param  *conf_param_tbl;
           int             (*conf_init)(void);
           int             (*conf_deinit)(void);
           int             (*conf_event)(u_int event, u_int no,
                               const void *arg);
           int             (*conf_mimic_real)(void);
           int             (*conf_inherit)(u_int rulepatno, u_int ruleno,
                               const char *rule_name);
           void            (*conf_show)(u_int sect_id, u_int no);
           int             (*db_pre_init)(void);
           int             (*db_init_dynrule)(u_int autoruleno, u_int ruleno,
                               const char *rule_name, const char *rule_info);
           int             (*db_init_statrule)(u_int ruleno,
                               const char *rule_name, const char *rule_info);
           int             (*db_init_dynlimit)(u_int autoruleno, u_int ruleno,
                               const char *rule_name, const char *rule_info,
                               u_int limitno, const char *limit_name,
                               const char *limit_info);
           int             (*db_init_statlimit)(u_int ruleno,
                               const char *rule_name, const char *rule_info,
                               u_int limitno, const char *limit_name,
                               const struct ipa_limit_state *state,
                               int new_state);
           int             (*db_get_threshold_state)(u_int ruleno,
                               u_int thresholdno,
                               struct ipa_threshold_state *state);
           int             (*db_set_threshold_state)(u_int ruleno,
                               u_int thresholdno,
                               const struct ipa_threshold_state *state);
           int             (*db_deinit_threshold)(u_int ruleno,
                               u_int thresholdno);
           int             (*db_deinit_limit)(u_int ruleno, u_int limitno);
           int             (*db_deinit_rule)(u_int ruleno);
           int             (*db_deinit)(void);
           int             (*db_append_rule)(u_int ruleno,
                               const uint64_t *cnt, const ipa_tm *ctm);
           int             (*db_update_rule)(u_int ruleno,
                               const uint64_t *cnt, const ipa_tm *ctm);
           int             (*db_update_limit)(u_int ruleno, u_int limitno,
                               const uint64_t *value, const ipa_tm *ctm);
           int             (*db_limit_event)(u_int ruleno, u_int limitno,
                               u_int event, const ipa_tm *etm,
                               const ipa_tm *ctm);
           int             (*db_update_threshold)(u_int ruleno,
                               u_int thresholdno, const uint64_t *cnt,
                               const ipa_tm *tm_from,
                               const ipa_tm *tm_updated);
           int             (*db_set_rule_active)(u_int ruleno, int active);
           int             (*db_set_limit_active)(u_int ruleno, u_int limitno,
                               int active);
           int             (*db_set_threshold_active)(u_int ruleno, u_int
                               thresholdno, int active);
       }

       api_ver
               API   , API  IPA_DB_MOD_API_VERSION   .         API.

       mod_flags
               .

       db_name
                 .

       suppfunc
               .

       memfunc
               .

       conf_prefix
               .

       conf_sect_tbl
       conf_mimic_real
               .

       conf_inherit
               .

       conf_show
               .

       db_pre_init
                    .        .      db_init*.

       db_init_dynrule
                 ,  .  autoruleno   ,  ruleno    , rule_name   , rule_info   .
              rule_name        db_deinit_rule   .

       db_init_statrule
                  db_init_dynrule,    .

       db_init_dynlimit
                 ,    .   limitno        ,   limit_name       limit_info     .
              db_init_dynrule.                rule_name             limit_name
              db_deinit_limit   .          ,  ,    db_init_dynrule  .        ,
              db_init_dynrule    .

       db_init_statlimit
                  db_init_dynlimit, .

       db_init_dynthreshold
                 ,  . thresholdno      , threshold_name     threshold_info   .
              db_init_dynrule.               rule_name          threshold_name
              db_deinit_threshold    .         ,      ,   db_init_dynrule    .
              ,  db_init_dynrule    .

       db_init_threshold
                  db_init_dynthreshold, .

       db_init
                     db_init_stat*.

       db_get_limit_state
                    .      (,   ), lim  state     .

       db_set_limit_state
                    .  new_state  ,          ,       .

       db_get_threshold_state
                    .      (,   ), thr  state     .

       db_set_threshold_state
                    .

               . cnt       .  ctm    .    db_update_rule.

       db_update_rule
                        .  cnt      , ctm  .

       db_update_limit
                      . cnt     , ctm    .       IPA_LIMIT_EVENT_UPDATED.

       db_update_threshold
                      . cnt     , tm_from  tm_updated    .

       db_limit_event
                       event     .            .     etm        ,     ctm     .
              IPA_LIMIT_EVENT_UPDATED.                       IPA_LIMIT_EVENT_:
              RESTART_EXEC, REACH, REACH_EXEC, EXPIRE  EXPIRE_EXEC.

       db_set_rule_active
                 ac_set_rule_active.  ,  db_append_rule    db_update_rule.

       db_set_limit_active
                 ac_set_limit_active.

       db_set_threshold_active
                 ac_set_threshold_active.

        -    ,       0,   -1.

               ,  ,        db_init_dyn*   NULL.        ,  ,      db_init_stat*
       NULL.

               db_get_limit_state,   db_get_threshold_state,   db_set_*active,
       NULL.

        -   ,       ( NULL).

       API  .

       API     IPA ipa_st_mod:

       struct ipa_entity_desc {
           char            *name;
           char            *info;
       };

       struct ipa_rule_stat {
           u_int           year;
           unsigned char   mon;
           unsigned char   mday;
           unsigned char   h1, m1, s1;
           unsigned char   h2, m2, s2;
           uint64_t        cnt;
       };
           int             (*conf_mimic_real)(void);
           int             (*conf_inherit)(u_int rulepatno, u_int ruleno,
                               const char *rule_name);
           void            (*conf_show)(u_int sect_id, u_int no);
           int             (*st_pre_init)(void);
           int             (*st_init_rule)(u_int ruleno,
                               const char *rule_name);
           int             (*st_init_limit)(u_int ruleno,
                               const char *rule_name, u_int limitno,
                               const char *limit_name);
           int             (*st_init_threshold)(u_int ruleno,
                               const char *rule_name, u_int thresholdno,
                               const char *threshold_name);
           int             (*st_init)(void);
           int             (*st_deinit_threshold)(u_int ruleno,
                               u_int thresholdno);
           int             (*st_deinit_limit)(u_int ruleno, u_int limitno);
           int             (*st_deinit_rule)(u_int ruleno);
           int             (*st_deinit)(void);
           int             (*st_get_rule_info)(u_int ruleno,
                               ipa_mem_type *mem_type, char **infop);
           int             (*st_get_limit_info)(u_int ruleno, u_int limitno,
                               ipa_mem_type *mem_type, char **infop);
           int             (*st_get_threshold_info)(u_int ruleno,
                               u_int thresholdno, ipa_mem_type *mem_type,
                               char **infop);
           int             (*st_get_rules_list)(const char *pat,
                               const regex_t *pat_reg, ipa_mem_type *mem_type,
                               u_int *n, struct ipa_entity_desc **bufp);
           int             (*st_get_limits_list)(u_int ruleno, const char *pat,
                               const regex_t *pat_reg, ipa_mem_type *mem_type,
                               u_int *n, struct ipa_entity_desc **bufp);
           int             (*st_get_thresholds_list)(u_int ruleno,
                               const char *pat, const regex_t *pat_reg,
                               ipa_mem_type *mem_type, u_int *n,
                               struct ipa_entity_desc **bufp);
           int             (*st_get_rule_stat)(u_int ruleno, const ipa_tm *tm1,
                               const ipa_tm *tm2, int exact,
                               ipa_mem_type *mem_type, u_int *n,
                               struct ipa_rule_stat **bufp);
           int             (*st_get_limit_stat)(u_int ruleno, u_int limitno,
                               const ipa_tm *tm1, const ipa_tm *tm2,
                               ipa_mem_type *mem_type, u_int *n,
                               struct ipa_limit_state **bufp);
           int             (*st_get_threshold_stat)(u_int ruleno,
                               u_int thresholdno,
                               struct ipa_threshold_state *buf);
       };

       api_ver
               API API  IPA_ST_MOD_API_VERSION   .         API.


       conf_sect_tbl
               .

       conf_param_tbl
               .

       conf_init
               .

       conf_deinit
               .

       conf_event
               .

       conf_mimic_real
               .

       conf_inherit
               .

       conf_show
               .

       st_pre_init
                    .        .         st_init*.

       st_init_rule
                   ,       .    ruleno     ,   rule_name     .       rule_name
              st_deinit_rule   .      ,      ,  (    ).

       st_init_limit
                 ,      .   limitno       ,  limit_name     .        rule_name
              limit_name  st_deinit_limit    .     ,     , st_init_rule      .
              ,  st_init_rule  .  st_init_rule    / ,       / ,    ( / ).

       st_init_threshold
                ,     .  thresholdno      , threshold_name   .       rule_name
              threshold_name  st_deinit_threshold    .    ,     , st_init_rule
              .      ,  st_init_rule  .  st_init_rule    / ,       / ,    (  /
              ).

       st_init
                     st_init*.

       st_deinit_threshold
                   ,  .     ,   st_init_threshold     .

       st_deinit_limit
                   ,  .     ,   st_init_limit     .

                  st_get_rule_info,   .

       st_get_rules_list
                        .     POSIX  pat   NULL,      ,   (pat_reg       pat).
              struct ipa_entity_desc   *bufp,  *n.      ,  *bufp     NULL.

       st_get_limits_list
                  st_get_rules_list,   .

       st_get_thresholds_list
                  st_get_rules_list,   .

       st_get_rule_stat
                          ruleno        tm1     tm2.    exact    ,   ,       .
              struct ipa_rule_stat     *bufp,       *n.    ,  *bufp      NULL.

                 struct ipa_rule_stat   year, mon  mday        (      ,     ).
              t1, m1  s1   , t2, m2  s1  . cnt     .

       st_get_limit_stat
                       limitno    ruleno,   tm1  tm2.   struct ipa_limit_state
              *bufp,         *n.      ,    *bufp    NULL.   tm1   NULL,   .  ,
              lim   *bufp  .

       st_get_threshold_stat
               thresholdno    ruleno.     ,      thr  buf  .

        -    ,       0,   -1.

            -   ,  NULL.

        -    mem_type,    ipa_memfunc    mem_type.

        -   ,       ( NULL).



       ipa(8), ipactl(8), ipastat(8), ipa.conf(5), ipastat.conf(5)


       Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>


          - , , ,    email.



                                  16  2005 .                        IPA_MOD(3)

Man(1) output converted with man2html