LTP GCOV extension - code coverage report
Current view: directory - src/utils/logger - min_logger.c
Test: min.info
Date: 2009-06-18 Instrumented lines: 487
Code covered: 76.6 % Executed lines: 373

       1                 : /*
       2                 :  * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
       3                 :  * and/or its subsidiary(-ies).
       4                 :  * Contact: Konrad Marek Zapalowicz
       5                 :  * Contact e-mail: DG.MIN-Support@nokia.com
       6                 :  * 
       7                 :  * This program is free software: you can redistribute it and/or modify it 
       8                 :  * under the terms of the GNU General Public License as published by the Free 
       9                 :  * Software Foundation, version 2 of the License. 
      10                 :  * 
      11                 :  * This program is distributed in the hope that it will be useful, but WITHOUT 
      12                 :  * ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or 
      13                 :  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General  Public License for
      14                 :  * more details. You should have received a copy of the GNU General Public 
      15                 :  * License along with this program. If not,  see 
      16                 :  * <http://www.gnu.org/licenses/>.
      17                 :  */
      18                 : 
      19                 : 
      20                 : /**
      21                 :  *  @file       min_logger.c
      22                 :  *  @version    0.1
      23                 :  *  @brief      This file contains implementation of MIN logger API
      24                 :  */
      25                 : 
      26                 : /* ------------------------------------------------------------------------- */
      27                 : /* INCLUDE FILES */
      28                 : #include <limits.h>
      29                 : 
      30                 : #include <min_logger.h>
      31                 : #include <min_logger_common.h>
      32                 : /* ------------------------------------------------------------------------- */
      33                 : /* EXTERNAL DATA STRUCTURES */
      34                 : extern MinLogger *__logger__;
      35                 : extern Text *__component_name__;
      36                 : /* ------------------------------------------------------------------------- */
      37                 : /* EXTERNAL FUNCTION PROTOTYPES */
      38                 : /* None */
      39                 : 
      40                 : /* ------------------------------------------------------------------------- */
      41                 : /* CONSTANTS */
      42                 : /* None */
      43                 : 
      44                 : /* ------------------------------------------------------------------------- */
      45                 : /* MACROS */
      46                 : /* None */
      47                 : 
      48                 : /* ------------------------------------------------------------------------- */
      49                 : /* LOCAL CONSTANTS AND MACROS */
      50                 : /* None */
      51                 : 
      52                 : /* ------------------------------------------------------------------------- */
      53                 : /* MODULE DATA STRUCTURES */
      54                 : /* None */
      55                 : 
      56                 : /* ------------------------------------------------------------------------- */
      57                 : /* LOCAL FUNCTION PROTOTYPES */
      58                 : /* ------------------------------------------------------------------------- */
      59                 : LOCAL void      mnl_overwrite_settings (struct logger_settings_t *ls,
      60                 :                                         TSChar * path, TSChar * file,
      61                 :                                         TSLoggerType * loggertype,
      62                 :                                         unsigned int *output,
      63                 :                                         TSBool * overwrite,
      64                 :                                         TSBool * withtimestamp,
      65                 :                                         TSBool * withlinebreak,
      66                 :                                         TSBool * witheventranking,
      67                 :                                         TSBool * pididtologfile,
      68                 :                                         TSBool * createlogdir,
      69                 :                                         TSBool * unicode,
      70                 :                                         TLogLevel * loglevel);
      71                 : /* ------------------------------------------------------------------------- */
      72                 : LOCAL MinTxtLogger *stl_create (const TSChar * path, const TSChar * file,
      73                 :                                  TSLoggerType loggertype, unsigned int output,
      74                 :                                  TSBool overwrite, TSBool withtimestamp,
      75                 :                                  TSBool withlinebreak,
      76                 :                                  TSBool witheventranking,
      77                 :                                  TSBool pididtologfile, TSBool createlogdir,
      78                 :                                  unsigned int staticbuffersize,
      79                 :                                  TSBool unicode);
      80                 : /* ------------------------------------------------------------------------- */
      81                 : LOCAL void      stl_destroy (MinTxtLogger ** stl);
      82                 : /* ------------------------------------------------------------------------- */
      83                 : LOCAL int       stl_send (struct logger_typeinfo_t *lt, int style,
      84                 :                           const TSChar * msg);
      85                 : /* ------------------------------------------------------------------------- */
      86                 : LOCAL MinHtmlLogger *mhl_create (const TSChar * path, const TSChar * file,
      87                 :                                   TSLoggerType loggertype,
      88                 :                                   unsigned int output, TSBool overwrite,
      89                 :                                   TSBool withtimestamp, TSBool withlinebreak,
      90                 :                                   TSBool witheventranking,
      91                 :                                   TSBool pididtologfile, TSBool createlogdir,
      92                 :                                   unsigned int staticbuffersize,
      93                 :                                   TSBool unicode);
      94                 : /* ------------------------------------------------------------------------- */
      95                 : LOCAL void      mhl_destroy (MinHtmlLogger ** shl);
      96                 : /* ------------------------------------------------------------------------- */
      97                 : LOCAL int       mhl_send (struct logger_typeinfo_t *lt, int style,
      98                 :                           const TSChar * msg);
      99                 : /* ------------------------------------------------------------------------- */
     100                 : LOCAL void      mhl_start_html_page (struct output_typeinfo_t *outtype,
     101                 :                                      const TSChar * file,
     102                 :                                      TSBool pididtologfile);
     103                 : /* ------------------------------------------------------------------------- */
     104                 : LOCAL void      mhl_end_html_page (struct output_typeinfo_t *outtype);
     105                 : /* ------------------------------------------------------------------------- */
     106                 : LOCAL void      mhl_style_starting (struct output_typeinfo_t *outtype,
     107                 :                                     int style, TSBool * timestamp,
     108                 :                                     TSBool * eventranking);
     109                 : /* ------------------------------------------------------------------------- */
     110                 : LOCAL void      mhl_style_ending (struct output_typeinfo_t *outtype,
     111                 :                                   int style);
     112                 : /* ------------------------------------------------------------------------- */
     113                 : LOCAL MinDataLogger *mdl_create (const TSChar * path, const TSChar * file,
     114                 :                                   TSLoggerType loggertype,
     115                 :                                   unsigned int output, TSBool overwrite,
     116                 :                                   TSBool withtimestamp, TSBool withlinebreak,
     117                 :                                   TSBool witheventranking,
     118                 :                                   TSBool pididtologfile, TSBool createlogdir,
     119                 :                                   unsigned int staticbuffersize,
     120                 :                                   TSBool unicode);
     121                 : /* ------------------------------------------------------------------------- */
     122                 : LOCAL void      mdl_destroy (MinDataLogger ** sdl);
     123                 : /* ------------------------------------------------------------------------- */
     124                 : LOCAL int       mdl_send (struct logger_typeinfo_t *lt, int style,
     125                 :                           const TSChar * msg);
     126                 : /* ------------------------------------------------------------------------- */
     127                 : /* FORWARD DECLARATIONS */
     128                 : /* None */
     129                 : 
     130                 : /* ==================== LOCAL FUNCTIONS ==================================== */
     131                 : /* ------------------------------------------------------------------------- */
     132                 : LOCAL void mnl_overwrite_settings (struct logger_settings_t *ls,
     133                 :                                    TSChar * path, TSChar * file,
     134                 :                                    TSLoggerType * loggertype,
     135                 :                                    unsigned int *output, TSBool * overwrite,
     136                 :                                    TSBool * withtimestamp,
     137                 :                                    TSBool * withlinebreak,
     138                 :                                    TSBool * witheventranking,
     139                 :                                    TSBool * pididtologfile,
     140                 :                                    TSBool * createlogdir, TSBool * unicode,
     141                 :                                    TSStyle * loglevel )
     142             343 : {
     143             343 :         if (ls == INITPTR) {
     144               0 :                 goto EXIT;
     145                 :         }
     146             343 :         if (path == INITPTR) {
     147               0 :                 goto EXIT;
     148                 :         }
     149             343 :         if (file == INITPTR) {
     150               0 :                 goto EXIT;
     151                 :         }
     152             343 :         if (loggertype == INITPTR) {
     153               0 :                 goto EXIT;
     154                 :         }
     155             343 :         if (output == INITPTR) {
     156               0 :                 goto EXIT;
     157                 :         }
     158             343 :         if (overwrite == INITPTR) {
     159               0 :                 goto EXIT;
     160                 :         }
     161             343 :         if (withtimestamp == INITPTR) {
     162               0 :                 goto EXIT;
     163                 :         }
     164             343 :         if (withlinebreak == INITPTR) {
     165               0 :                 goto EXIT;
     166                 :         }
     167             343 :         if (witheventranking == INITPTR) {
     168               0 :                 goto EXIT;
     169                 :         }
     170             343 :         if (pididtologfile == INITPTR) {
     171               0 :                 goto EXIT;
     172                 :         }
     173             343 :         if (createlogdir == INITPTR) {
     174               0 :                 goto EXIT;
     175                 :         }
     176             343 :         if (unicode == INITPTR) {
     177               0 :                 goto EXIT;
     178                 :         }
     179             343 :         if (loglevel == INITPTR) {
     180               0 :                 goto EXIT;
     181                 :         }
     182                 : 
     183             343 :         if (ls->is_defined_.path_ == ESTrue) {
     184             340 :                 STRCPY (path, ls->emulator_path_,
     185                 :                         strlen (ls->emulator_path_));
     186                 :         }
     187             343 :         if (ls->is_defined_.format_ == ESTrue) {
     188             340 :                 *loggertype = ls->emulator_format_;
     189                 :         }
     190             343 :         if (ls->is_defined_.output_ == ESTrue) {
     191             340 :                 *output = ls->emulator_output_;
     192                 :         }
     193                 : 
     194                 :         /* Rest of the overwrited values */
     195             343 :         if (ls->is_defined_.overwrite_ == ESTrue) {
     196             340 :                 *overwrite = ls->overwrite_;
     197                 :         }
     198             343 :         if (ls->is_defined_.time_stamp_ == ESTrue) {
     199             340 :                 *withtimestamp = ls->time_stamp_;
     200                 :         }
     201             343 :         if (ls->is_defined_.line_break_ == ESTrue) {
     202             340 :                 *withlinebreak = ls->line_break_;
     203                 :         }
     204             343 :         if (ls->is_defined_.event_ranking_ == ESTrue) {
     205             340 :                 *witheventranking = ls->event_ranking_;
     206                 :         }
     207             343 :         if (ls->is_defined_.pidid_ == ESTrue) {
     208             340 :                 *pididtologfile = ls->pidid_;
     209                 :         }
     210             343 :         if (ls->is_defined_.pidid_ == ESTrue) {
     211             340 :                 *pididtologfile = ls->pidid_;
     212                 :         }
     213             343 :         if (ls->is_defined_.create_log_dir_ == ESTrue) {
     214             340 :                 *createlogdir = ls->create_log_dir_;
     215                 :         }
     216             343 :         if (ls->is_defined_.unicode_ == ESTrue) {
     217               0 :                 *unicode = ls->unicode_;
     218                 :         }
     219             343 :         if (ls->is_defined_.loglevel_ == ESTrue) {
     220               0 :                 *loglevel = ls->loglevel_;
     221                 :         }
     222                 : 
     223             343 :       EXIT:
     224                 :         return;
     225                 : }
     226                 : 
     227                 : /* ------------------------------------------------------------------------- */
     228                 : LOCAL MinTxtLogger *stl_create (const TSChar * path, const TSChar * file,
     229                 :                                  TSLoggerType loggertype, unsigned int output,
     230                 :                                  TSBool overwrite, TSBool withtimestamp,
     231                 :                                  TSBool withlinebreak,
     232                 :                                  TSBool witheventranking,
     233                 :                                  TSBool pididtologfile, TSBool createlogdir,
     234                 :                                  unsigned int staticbuffersize,
     235                 :                                  TSBool unicode)
     236             343 : {
     237             343 :         MinTxtLogger  *retval = NEW (MinTxtLogger);
     238             343 :         struct output_typeinfo_t *out = INITPTR;
     239                 : 
     240             343 :         retval->type_ = ESTxt;
     241             343 :         retval->send_ = stl_send;
     242             343 :         retval->output_ = dl_list_create ();
     243                 : 
     244             343 :         if (output & ESFile) {
     245                 :                 /* create file output plugin */
     246             343 :                 out = (struct output_typeinfo_t *)
     247                 :                     fo_create (MinOutputPluginParams);
     248             343 :                 dl_list_add (retval->output_, (void *)out);
     249                 :         }
     250             343 :         if (output & ESSyslog) {
     251                 :                 /* create syslog output plugin */
     252             340 :                 out = (struct output_typeinfo_t *)
     253                 :                     so_create (MinOutputPluginParams);
     254             340 :                 dl_list_add (retval->output_, (void *)out);
     255                 :         }
     256             343 :         if (output & ESNull || (dl_list_size (retval->output_) == 0)) {
     257                 :                 /* create null output plugin */
     258                 :                 /* it never fails! */
     259             340 :                 out = (struct output_typeinfo_t *)
     260                 :                     no_create (MinOutputPluginParams);
     261             340 :                 dl_list_add (retval->output_, (void *)out);
     262                 :         }
     263                 : 
     264             343 :         return retval;
     265                 : }
     266                 : 
     267                 : /* ------------------------------------------------------------------------- */
     268                 : LOCAL void stl_destroy (MinTxtLogger ** stl)
     269             226 : {
     270             226 :         DLListIterator  it = DLListNULLIterator;
     271             226 :         struct output_typeinfo_t *o = INITPTR;
     272                 : 
     273             226 :         if (*stl == INITPTR) {
     274               0 :                 goto EXIT;
     275                 :         }
     276                 : 
     277                 :         /* destroy all output plugins */
     278             226 :         it = dl_list_head ((*stl)->output_);
     279            1124 :         while (it != DLListNULLIterator) {
     280             672 :                 o = (struct output_typeinfo_t *)dl_list_data (it);
     281             672 :                 o->destroy_ (&o);
     282             672 :                 dl_list_remove_it (it);
     283             672 :                 it = dl_list_head ((*stl)->output_);
     284                 :         }
     285             226 :         dl_list_free (&(*stl)->output_);
     286             226 :         DELETE (*stl);
     287             226 :       EXIT:
     288                 :         return;
     289                 : }
     290                 : 
     291                 : /* ------------------------------------------------------------------------- */
     292                 : LOCAL int stl_send (struct logger_typeinfo_t *lt, int style,
     293                 :                     const TSChar * msg)
     294            2627 : {
     295            2627 :         int retval = ENOERR;
     296            2627 :         MinTxtLogger *stl = INITPTR;
     297            2627 :         DLListIterator it = DLListNULLIterator;
     298            2627 :         struct output_typeinfo_t *outtype = INITPTR;
     299            2627 :         Text *message = INITPTR;
     300            2627 :         unsigned int loglevel = style & 0xFFF80;
     301            2627 :         if (lt == INITPTR) { retval = -1; goto EXIT; }
     302            2627 :         if (msg == INITPTR) { retval = -1; goto EXIT; }
     303            2627 :         if (loglevel == 0x0) { loglevel = ESInfo; }
     304            2627 :         message = tx_create("");
     305            2627 :         if( loglevel & ESFatal ) { tx_c_append(message,"FATAL"); }
     306            2618 :         else if( loglevel & ESError ){ tx_c_append(message,"ERROR"); }
     307            2518 :         else if( loglevel & ESWarning ){ tx_c_append(message,"WARNING"); }
     308            2426 :         else if( loglevel & ESInfo ){ tx_c_append(message,"INFO"); }
     309               0 :         else if( loglevel & ESNotice ){ tx_c_append(message,"NOTICE"); }
     310               0 :         else if( loglevel & ESDebug ){ tx_c_append(message,"DEBUG"); }
     311               0 :         else if( loglevel & ESTrace ){ tx_c_append(message,"TRACE"); }
     312            2627 :         tx_c_append(message,msg);
     313            2627 :         stl = (MinTxtLogger *) lt;
     314                 :         /* Log message through all of outputs */
     315            2627 :         it = dl_list_head (stl->output_);
     316           13135 :         while (it != DLListNULLIterator) {
     317            7881 :                 outtype = (struct output_typeinfo_t *)dl_list_data (it);
     318            7881 :                 outtype->write_ (outtype, ESTrue, ESTrue, ESTrue,
     319                 :                                  tx_share_buf(message));
     320            7881 :                 it = dl_list_next (it);
     321                 :         }
     322                 :         /* Clean up */
     323            2627 :         tx_destroy(&message);
     324            2627 :       EXIT:
     325            2627 :         return retval;
     326                 : }
     327                 : 
     328                 : /* ------------------------------------------------------------------------- */
     329                 : LOCAL MinHtmlLogger *mhl_create (const TSChar * path, const TSChar * file,
     330                 :                                   TSLoggerType loggertype,
     331                 :                                   unsigned int output, TSBool overwrite,
     332                 :                                   TSBool withtimestamp, TSBool withlinebreak,
     333                 :                                   TSBool witheventranking,
     334                 :                                   TSBool pididtologfile, TSBool createlogdir,
     335                 :                                   unsigned int staticbuffersize,
     336                 :                                   TSBool unicode)
     337              17 : {
     338              17 :         MinHtmlLogger *retval = NEW (MinHtmlLogger);
     339              17 :         struct output_typeinfo_t *out = INITPTR;
     340                 : 
     341              17 :         retval->type_ = ESHtml;
     342              17 :         retval->send_ = mhl_send;
     343              17 :         retval->output_ = dl_list_create ();
     344                 : 
     345              17 :         if (output & ESFile) {
     346                 :                 /* create file output plugin */
     347              17 :                 out = (struct output_typeinfo_t *)
     348                 :                     fo_create (MinOutputPluginParams);
     349              17 :                 dl_list_add (retval->output_, (void *)out);
     350              17 :                 mhl_start_html_page (out, file, pididtologfile);
     351                 :         }
     352              17 :         if (output & ESSyslog) {
     353                 :                 /* create syslog output plugin */
     354               0 :                 out = (struct output_typeinfo_t *)
     355                 :                     so_create (MinOutputPluginParams);
     356               0 :                 dl_list_add (retval->output_, (void *)out);
     357               0 :                 mhl_start_html_page (out, file, pididtologfile);
     358                 :         }
     359              17 :         if (output & ESNull || (dl_list_size (retval->output_) == 0)) {
     360                 :                 /* create null output plugin */
     361                 :                 /* it never fails! */
     362               0 :                 out = (struct output_typeinfo_t *)
     363                 :                     no_create (MinOutputPluginParams);
     364               0 :                 dl_list_add (retval->output_, (void *)out);
     365                 :         }
     366                 : 
     367              17 :         return retval;
     368                 : }
     369                 : 
     370                 : /* ------------------------------------------------------------------------- */
     371                 : LOCAL void mhl_destroy (MinHtmlLogger ** shl)
     372              17 : {
     373              17 :         DLListIterator  it = DLListNULLIterator;
     374              17 :         struct output_typeinfo_t *o = INITPTR;
     375                 : 
     376              17 :         if (*shl == INITPTR) {
     377               0 :                 goto EXIT;
     378                 :         }
     379                 : 
     380                 :         /* destroy all output plugins */
     381              17 :         it = dl_list_head ((*shl)->output_);
     382              51 :         while (it != DLListNULLIterator) {
     383              17 :                 o = (struct output_typeinfo_t *)dl_list_data (it);
     384              17 :                 mhl_end_html_page (o);
     385              17 :                 o->destroy_ (&o);
     386              17 :                 dl_list_remove_it (it);
     387              17 :                 it = dl_list_head ((*shl)->output_);
     388                 :         }
     389                 : 
     390              17 :         DELETE (*shl);
     391              17 :       EXIT:
     392                 :         return;
     393                 : }
     394                 : 
     395                 : /* ------------------------------------------------------------------------- */
     396                 : LOCAL int mhl_send (struct logger_typeinfo_t *lt, int style,
     397                 :                     const TSChar * msg)
     398              21 : {
     399              21 :         int             retval = ENOERR;
     400              21 :         MinHtmlLogger *shl = INITPTR;
     401              21 :         DLListIterator  it = DLListNULLIterator;
     402              21 :         struct output_typeinfo_t *outtype = INITPTR;
     403              21 :         TSBool          timestamp = ESTrue;
     404              21 :         TSBool          eventranking = ESTrue;
     405                 : 
     406              21 :         if (lt == INITPTR) {
     407               0 :                 retval = -1;
     408               0 :                 goto EXIT;
     409                 :         }
     410              21 :         if (msg == INITPTR) {
     411               0 :                 retval = -1;
     412               0 :                 goto EXIT;
     413                 :         }
     414                 : 
     415              21 :         shl = (MinHtmlLogger *) lt;
     416                 : 
     417                 :         /* Log message through all of outputs */
     418              21 :         it = dl_list_head (shl->output_);
     419              63 :         while (it != DLListNULLIterator) {
     420              21 :                 outtype = (struct output_typeinfo_t *)dl_list_data (it);
     421                 : 
     422              21 :                 mhl_style_starting (outtype, style, &timestamp,
     423                 :                                     &eventranking);
     424              21 :                 outtype->write_ (outtype, timestamp, ESTrue, eventranking,
     425                 :                                  msg);
     426              21 :                 mhl_style_ending (outtype, style);
     427              21 :                 it = dl_list_next (it);
     428                 :         }
     429              21 :       EXIT:
     430              21 :         return retval;
     431                 : }
     432                 : 
     433                 : /* ------------------------------------------------------------------------- */
     434                 : LOCAL void mhl_start_html_page (struct output_typeinfo_t *outtype,
     435                 :                                 const TSChar * file, TSBool pididtologfile)
     436              17 : {
     437              17 :         TSChar         *title = NEW2 (TSChar, MaxFileName + 1);
     438                 : 
     439                 :         /* If the title size is over the MaxFileName rest of the title
     440                 :            will cut. */
     441              17 :         STRCPY (title, file, MaxFileName);
     442                 : 
     443                 :         /* Add process id to title if enough space and test file is given and 
     444                 :            pididtologfile is true */
     445              17 :         if (strlen (title) < (MaxFileName - 5) && strlen (file) > 0 &&
     446                 :             pididtologfile) {
     447                 :                 /* Appends id in hexadesimal format */
     448               1 :                 sprintf (title, "%s_%x", title, getpid ());
     449                 :         }
     450                 : 
     451                 :         /* Html character encoding */
     452              17 :         outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     453                 :                          "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
     454                 : 
     455                 :         /* According to HTML standards, each HTML document requires a document
     456                 :            type declaration */
     457              17 :         outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     458                 :                          "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0  \
     459                 :                         Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/ \
     460                 :                         xhtml1-strict.dtd\">\n");
     461                 : 
     462                 :         /* Html start tags to whole page and header section */
     463              17 :         outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     464                 :                          "<html xmlns=\"http://www.w3.org/1999/xhtml\"   \
     465                 :                         xml:lang=\"en\" lang=\"en\">\n");
     466                 : 
     467                 :         /* Html header and title start tags */
     468              17 :         outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     469                 :                          "<head>\n<title>");
     470                 : 
     471                 :         /* Html file title */
     472              17 :         outtype->write_ (outtype, ESFalse, ESFalse, ESFalse, title);
     473                 : 
     474                 :         /* Html header and title end tags and start tag to body section
     475                 :            Style tag defines user styles */
     476              17 :         outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     477                 :                          "</title>\n<style type=\"text/css\">\n          \
     478                 :                         .green { color: #009900; }\n                    \
     479                 :                         .red { color: #FF0000; }\n                      \
     480                 :                         .blue { color: #3333FF; }\n                     \
     481                 :                         .bold { font-weight: bold; }\n                  \
     482                 :                         .cursive { font-style: italic; }\n              \
     483                 :                         .underline { text-decoration: underline; }\n    \
     484                 :                         </style>\n</head>\n<body>\n<p>\n");
     485                 : 
     486              17 :         DELETE (title);
     487              17 : }
     488                 : 
     489                 : /* ------------------------------------------------------------------------- */
     490                 : LOCAL void mhl_end_html_page (struct output_typeinfo_t *outtype)
     491              17 : {
     492                 :         /* Html page and body section end tags */
     493              17 :         outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     494                 :                          "\n</p>\n</body>\n</html>\n");
     495              17 : }
     496                 : 
     497                 : /* ------------------------------------------------------------------------- */
     498                 : LOCAL void mhl_style_starting (struct output_typeinfo_t *outtype, int style,
     499                 :                                TSBool * timestamp, TSBool * eventranking)
     500              21 : {
     501              21 :         if (0x00020 <= style || /* ESRed, 0x00020 => 32 */
     502                 :             0x00040 <= style || /* ESImportant, 0x00040 => 64 */
     503                 :             0x00080 <= style || /* ESWarning, 0x00080 => 128 */
     504                 :             0x00100 <= style) { /* ESError, 0x00100 => 256 */
     505               6 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     506                 :                                  "<span class=\"red\">");
     507               6 :                 if (0x00100 <= style) { /* ESError, 0x00100 >= 256 */
     508               3 :                         outtype->write_ (outtype, *timestamp, ESFalse,
     509                 :                                          *eventranking, "ERROR...");
     510               3 :                         style -= 0x00100;
     511               3 :                         *timestamp = ESFalse;
     512               3 :                         *eventranking = ESFalse;
     513                 :                 }
     514               6 :                 if (0x00080 <= style) { /* ESWarning, 0x00080 >= 128 */
     515               2 :                         outtype->write_ (outtype, *timestamp, ESFalse,
     516                 :                                          *eventranking, "WARNING...");
     517               2 :                         style -= 0x00080;
     518               2 :                         *timestamp = ESFalse;
     519               2 :                         *eventranking = ESFalse;
     520                 :                 }
     521               6 :                 if (0x00040 <= style) { /* ESImportant, 0x00040 >= 64 */
     522               4 :                         outtype->write_ (outtype, *timestamp, ESFalse,
     523                 :                                          *eventranking, "IMPORTANT...");
     524               4 :                         style -= 0x00040;
     525               4 :                         *timestamp = ESFalse;
     526               4 :                         *eventranking = ESFalse;
     527                 :                 }
     528               6 :                 if (0x00020 <= style) {
     529               3 :                         style -= 0x00020;
     530                 :                 }
     531                 :         }
     532                 :         /* ESGreen, 0x00010 => 16 */
     533              21 :         if (0x00010 <= style) {
     534               4 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     535                 :                                  "<span class=\"green\">");
     536               4 :                 style -= 0x00010;
     537                 :         }
     538                 :         /* ESBlue, 0x00008 => 8 */
     539              21 :         if (0x00008 <= style) {
     540               4 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     541                 :                                  "<span class=\"blue\">");
     542               4 :                 style -= 0x00008;
     543                 :         }
     544                 :         /* ESUnderline, 0x00004 => 4 */
     545              21 :         if (0x00004 <= style) {
     546               5 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     547                 :                                  "<span class=\"underline\">");
     548               5 :                 style -= 0x00004;
     549                 :         }
     550                 :         /* ESCursive, 0x00002 => 2 */
     551              21 :         if (0x00002 <= style) {
     552               5 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     553                 :                                  "<span class=\"cursive\">");
     554               5 :                 style -= 0x00002;
     555                 :         }
     556                 :         /* ESBold, 0x00001 => 1 */
     557              21 :         if (0x00001 <= style) {
     558               4 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     559                 :                                  "<span class=\"bold\">");
     560               4 :                 style -= 0x00001;
     561                 :         }
     562              21 : }
     563                 : 
     564                 : /* ------------------------------------------------------------------------- */
     565                 : LOCAL void mhl_style_ending (struct output_typeinfo_t *outtype, int style)
     566              21 : {
     567              21 :         if (0x00020 <= style || /* ESRed, 0x00020 => 32 */
     568                 :             0x00040 <= style || /* ESImportant, 0x00040 => 64 */
     569                 :             0x00080 <= style || /* ESWarning, 0x00080 => 128 */
     570                 :             0x00100 <= style) { /* ESError, 0x00100 => 256 */
     571               6 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     572                 :                                  "</span>");
     573               6 :                 if (0x00100 <= style) {
     574               3 :                         style -= 0x00100;
     575                 :                 }
     576               6 :                 if (0x00080 <= style) {
     577               2 :                         style -= 0x00080;
     578                 :                 }
     579               6 :                 if (0x00040 <= style) {
     580               4 :                         style -= 0x00040;
     581                 :                 }
     582               6 :                 if (0x00020 <= style) {
     583               3 :                         style -= 0x00020;
     584                 :                 }
     585                 :         }
     586                 :         /* ESGreen, 0x00010 => 16 */
     587              21 :         if (0x00010 <= style) {
     588               4 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     589                 :                                  "</span>");
     590               4 :                 style -= 0x00010;
     591                 :         }
     592                 :         /* ESBlue, 0x00008 => 8 */
     593              21 :         if (0x00008 <= style) {
     594               4 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     595                 :                                  "</span>");
     596               4 :                 style -= 0x00008;
     597                 :         }
     598                 :         /* ESUnderline, 0x00004 => 4 */
     599              21 :         if (0x00004 <= style) {
     600               5 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     601                 :                                  "</span>");
     602               5 :                 style -= 0x00004;
     603                 :         }
     604                 :         /* ESCursive, 0x00002 => 2 */
     605              21 :         if (0x00002 <= style) {
     606               5 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     607                 :                                  "</span>");
     608               5 :                 style -= 0x00002;
     609                 :         }
     610                 :         /* EBold, 0x00001 => 1 */
     611              21 :         if (0x00001 <= style) {
     612               4 :                 outtype->write_ (outtype, ESFalse, ESFalse, ESFalse,
     613                 :                                  "</span>");
     614               4 :                 style -= 0x00001;
     615                 :         }
     616              21 : }
     617                 : 
     618                 : /* ------------------------------------------------------------------------- */
     619                 : LOCAL MinDataLogger *mdl_create (const TSChar * path, const TSChar * file,
     620                 :                                   TSLoggerType loggertype,
     621                 :                                   unsigned int output, TSBool overwrite,
     622                 :                                   TSBool withtimestamp, TSBool withlinebreak,
     623                 :                                   TSBool witheventranking,
     624                 :                                   TSBool pididtologfile, TSBool createlogdir,
     625                 :                                   unsigned int staticbuffersize,
     626                 :                                   TSBool unicode)
     627               1 : {
     628               1 :         MinDataLogger *retval = NEW (MinDataLogger);
     629               1 :         struct output_typeinfo_t *out = INITPTR;
     630                 : 
     631               1 :         retval->type_ = ESData;
     632               1 :         retval->send_ = mdl_send;
     633               1 :         retval->output_ = dl_list_create ();
     634                 : 
     635                 :         /* Time stamp not allowed in data logging */
     636               1 :         withtimestamp = ESFalse;
     637                 :         /* Line break not allowed in data logging */
     638               1 :         withlinebreak = ESFalse;
     639                 :         /* Event ranking not allowed in data logging */
     640               1 :         witheventranking = ESFalse;
     641                 :         /* For data type unicode is not allowed */
     642               1 :         unicode = ESFalse;
     643                 : 
     644               1 :         if (output & ESFile) {
     645                 :                 /* create file output plugin */
     646               1 :                 out = (struct output_typeinfo_t *)
     647                 :                     fo_create (MinOutputPluginParams);
     648               1 :                 dl_list_add (retval->output_, (void *)out);
     649                 :         }
     650               1 :         if (output & ESSyslog) {
     651                 :                 /* create syslog output plugin */
     652               0 :                 out = (struct output_typeinfo_t *)
     653                 :                     so_create (MinOutputPluginParams);
     654               0 :                 dl_list_add (retval->output_, (void *)out);
     655                 :         }
     656               1 :         if (output & ESNull || (dl_list_size (retval->output_) == 0)) {
     657                 :                 /* create null output plugin */
     658                 :                 /* it never fails! */
     659               0 :                 out = (struct output_typeinfo_t *)
     660                 :                     no_create (MinOutputPluginParams);
     661               0 :                 dl_list_add (retval->output_, (void *)out);
     662                 :         }
     663                 : 
     664               1 :         return retval;
     665                 : }
     666                 : 
     667                 : /* ------------------------------------------------------------------------- */
     668                 : LOCAL void mdl_destroy (MinDataLogger ** sdl)
     669               1 : {
     670               1 :         DLListIterator  it = DLListNULLIterator;
     671               1 :         struct output_typeinfo_t *o = INITPTR;
     672                 : 
     673               1 :         if (*sdl == INITPTR) {
     674               0 :                 goto EXIT;
     675                 :         }
     676                 : 
     677                 :         /* destroy all output plugins */
     678               1 :         it = dl_list_head ((*sdl)->output_);
     679               3 :         while (it != DLListNULLIterator) {
     680               1 :                 o = (struct output_typeinfo_t *)dl_list_data (it);
     681               1 :                 o->destroy_ (&o);
     682               1 :                 dl_list_remove_it (it);
     683               1 :                 it = dl_list_head ((*sdl)->output_);
     684                 :         }
     685                 : 
     686               1 :         DELETE (*sdl);
     687               1 :       EXIT:
     688                 :         return;
     689                 : }
     690                 : 
     691                 : /* ------------------------------------------------------------------------- */
     692                 : LOCAL int mdl_send (struct logger_typeinfo_t *lt, int style,
     693                 :                     const TSChar * msg)
     694               1 : {
     695               1 :         int             retval = ENOERR;
     696               1 :         MinDataLogger *sdl = INITPTR;
     697               1 :         DLListIterator  it = DLListNULLIterator;
     698               1 :         struct output_typeinfo_t *outtype = INITPTR;
     699                 : 
     700               1 :         if (lt == INITPTR) {
     701               0 :                 retval = -1;
     702               0 :                 goto EXIT;
     703                 :         }
     704               1 :         if (msg == INITPTR) {
     705               0 :                 retval = -1;
     706               0 :                 goto EXIT;
     707                 :         }
     708                 : 
     709               1 :         sdl = (MinDataLogger *) lt;
     710                 : 
     711                 :         /* Log message through all of outputs */
     712               1 :         it = dl_list_head (sdl->output_);
     713               3 :         while (it != DLListNULLIterator) {
     714               1 :                 outtype = (struct output_typeinfo_t *)dl_list_data (it);
     715               1 :                 outtype->write_ (outtype, ESFalse, ESTrue, ESFalse, msg);
     716               1 :                 it = dl_list_next (it);
     717                 :         }
     718               1 :       EXIT:
     719               1 :         return retval;
     720                 : }
     721                 : 
     722                 : /* ======================== FUNCTIONS ====================================== */
     723                 : /* ------------------------------------------------------------------------- */
     724                 : MinLogger     *mnl_create (const TSChar * path, const TSChar * file,
     725                 :                             unsigned int loggertype, unsigned int output,
     726                 :                             TSBool overwrite, TSBool withtimestamp,
     727                 :                             TSBool withlinebreak, TSBool witheventranking,
     728                 :                             TSBool pididtologfile, TSBool createlogdir,
     729                 :                             unsigned int staticbuffersize, TSBool unicode)
     730             343 : {
     731             343 :         MinLogger     *retval = INITPTR;
     732             343 :         struct logger_typeinfo_t *endpoint = INITPTR;
     733             343 :         int             shmid = 0;
     734             343 :         void           *shmaddr = INITPTR;
     735             343 :         int             ret = ENOERR;
     736             343 :         unsigned int    logtypebackup = 0;
     737                 :         struct logger_settings_t settings;
     738             343 :         TSChar         *c = INITPTR;
     739                 :         TSChar          npath[PATH_MAX];
     740                 :         TSChar          nfile[NAME_MAX];
     741             343 :         TSStyle         loglevel = ESInfo;
     742                 : 
     743             343 :         memset (npath,'\0',PATH_MAX);
     744             343 :         memset (nfile,'\0',NAME_MAX);
     745                 : 
     746             343 :         if (path == INITPTR) {
     747               0 :                 goto EXIT;
     748                 :         }
     749             343 :         if (file == INITPTR) {
     750               0 :                 goto EXIT;
     751                 :         }
     752                 : 
     753             343 :         STRCPY (npath, path, PATH_MAX);
     754             343 :         STRCPY (nfile, file, NAME_MAX);
     755                 : 
     756                 :         /* NOTE unicode now not supported */
     757             343 :         unicode = ESFalse;
     758                 : 
     759                 :         /* 1. Here we should contact the settings system and get settings
     760                 :          *    for logger. */
     761             343 :         shmid = sm_create ((int)'a', sizeof (struct logger_settings_t));
     762             343 :         if (shmid == -1) {
     763               0 :                 MIN_WARN ("SHM segment not created");
     764               0 :                 return retval;
     765                 :         } else {
     766             343 :                 shmaddr = sm_attach (shmid);
     767             343 :                 if (shmaddr == INITPTR) {
     768               0 :                         MIN_WARN ("Could not attach to shared memory segment");
     769                 :                 }
     770             343 :                 ret =
     771                 :                     sm_read (shmaddr, &settings,
     772                 :                              sizeof (struct logger_settings_t));
     773                 :         }
     774             343 :         sm_detach (shmaddr);
     775                 : 
     776             343 :         if (ret == ENOERR) {
     777             343 :                 mnl_overwrite_settings (&settings, npath, nfile, &loggertype,
     778                 :                                         &output, &overwrite, &withtimestamp,
     779                 :                                         &withlinebreak, &witheventranking,
     780                 :                                         &pididtologfile, &createlogdir,
     781                 :                                         &unicode,&loglevel);
     782                 :         } else {
     783               0 :                 MIN_WARN ("Could not read from shared memory segment");
     784                 :         }
     785                 : 
     786                 :         /* Because we are using multiple logging facilities we are skipping the
     787                 :          * extension. That will cause logging facility to add its own extension
     788                 :          */
     789             343 :         c = strrchr (nfile, '.');
     790             343 :         if (c != NULL)
     791             343 :                 *c = '\0';
     792                 : 
     793                 :         /* 2. Create logger according to the settings. */
     794             343 :         retval = NEW (MinLogger);
     795             343 :         retval->endpoint_ = dl_list_create ();
     796             343 :         retval->loglevel_ = loglevel;
     797                 : 
     798                 :         /* 3. Create endpoints */
     799             343 :         if (loggertype & ESTxt) {
     800                 :                 /* Create TXT endpoint */
     801             343 :                 logtypebackup = loggertype;
     802             343 :                 loggertype = ESTxt;
     803             343 :                 endpoint = (struct logger_typeinfo_t *)
     804                 :                     stl_create (MinCreateLoggerParams);
     805             343 :                 dl_list_add (retval->endpoint_, (void *)endpoint);
     806             343 :                 loggertype = logtypebackup;
     807                 :         }
     808             343 :         if (loggertype & ESData) {
     809                 :                 /* Create DATA endpoint */
     810               0 :                 logtypebackup = loggertype;
     811               0 :                 loggertype = ESData;
     812               0 :                 endpoint = (struct logger_typeinfo_t *)
     813                 :                     mdl_create (MinCreateLoggerParams);
     814               0 :                 dl_list_add (retval->endpoint_, (void *)endpoint);
     815               0 :                 loggertype = logtypebackup;
     816                 :         }
     817             343 :         if (loggertype & ESHtml) {
     818                 :                 /* Create HTML endpoint */
     819               0 :                 logtypebackup = loggertype;
     820               0 :                 loggertype = ESHtml;
     821               0 :                 endpoint = (struct logger_typeinfo_t *)
     822                 :                     mhl_create (MinCreateLoggerParams);
     823               0 :                 dl_list_add (retval->endpoint_, (void *)endpoint);
     824               0 :                 loggertype = logtypebackup;
     825                 :         }
     826             343 :       EXIT:
     827             343 :         return retval;
     828                 : }
     829                 : 
     830                 : /* ------------------------------------------------------------------------- */
     831                 : void mnl_destroy (MinLogger ** mnl)
     832             226 : {
     833             226 :         DLListIterator  it = INITPTR;
     834             226 :         struct logger_typeinfo_t *logtype = INITPTR;
     835             226 :         struct min_txt_logger_t *txtlog = INITPTR;
     836             226 :         struct min_html_logger_t *htmllog = INITPTR;
     837             226 :         struct min_data_logger_t *datalog = INITPTR;
     838                 : 
     839             226 :         if (*mnl == INITPTR) {
     840               0 :                 goto EXIT;
     841                 :         }
     842                 : 
     843                 :         /* Clear endpoints */
     844             226 :         it = dl_list_head ((*mnl)->endpoint_);
     845             678 :         while (it != DLListNULLIterator) {
     846                 :                 /* free endpoint */
     847             226 :                 logtype = (struct logger_typeinfo_t *)dl_list_data (it);
     848                 : 
     849                 :                 /* call destroy method for each type */
     850             226 :                 switch (logtype->type_) {
     851                 :                 case ESTxt:
     852             226 :                         txtlog = (struct min_txt_logger_t *)logtype;
     853             226 :                         stl_destroy (&txtlog);
     854             226 :                         break;
     855                 :                 case ESData:
     856               0 :                         datalog = (struct min_data_logger_t *)logtype;
     857               0 :                         mdl_destroy (&datalog);
     858               0 :                         break;
     859                 :                 case ESHtml:
     860               0 :                         htmllog = (struct min_html_logger_t *)logtype;
     861               0 :                         mhl_destroy (&htmllog);
     862               0 :                         break;
     863                 :                 default:
     864               0 :                         MIN_WARN ("%s:%s:%d - Unknown log type [%d]",
     865                 :                                      __FILE__, __FUNCTION__, __LINE__,
     866                 :                                      logtype->type_);
     867                 :                 }
     868                 : 
     869                 :                 /* remove from list */
     870             226 :                 dl_list_remove_it (it);
     871             226 :                 it = dl_list_head ((*mnl)->endpoint_);
     872                 :         }
     873                 : 
     874             226 :         dl_list_free (&(*mnl)->endpoint_);
     875             226 :         DELETE (*mnl);
     876             226 :       EXIT:
     877                 :         return;
     878                 : }
     879                 : 
     880                 : /* ------------------------------------------------------------------------- */
     881                 : int mnl_log (MinLogger * mnl, TSStyle style, const TSChar * format, ...)
     882           14496 : {
     883           14496 :         int             retval = ENOERR;
     884           14496 :         DLListIterator  it = INITPTR;
     885           14496 :         struct logger_typeinfo_t *logtype = INITPTR;
     886                 :         char            msg[MaxLogMessage];
     887           14496 :         memset (msg, '\0', MaxLogMessage);
     888           14496 :         TLogLevel loglevel = style & 0xFFF80;
     889           14496 :         if (loglevel==0x00000) { loglevel = ESInfo; }
     890                 : 
     891           14496 :         if (mnl == INITPTR) {
     892               0 :                 retval = -1;
     893               0 :                 goto EXIT;
     894                 :         }
     895           14496 :         if (format == INITPTR) {
     896               0 :                 retval = -1;
     897               0 :                 goto EXIT;
     898                 :         }
     899           14496 :         if (loglevel > mnl->loglevel_) {
     900           11869 :                 goto EXIT;
     901                 :         }
     902                 : 
     903                 :         /* Process the extra arguments */
     904                 :         va_list         vl;
     905            2627 :         va_start (vl, format);
     906            2627 :         vsnprintf (msg, MaxLogMessage-1, format, vl);
     907            2627 :         va_end (vl);
     908                 : 
     909                 :         /* Log message through all of endpoints */
     910            2627 :         it = dl_list_head (mnl->endpoint_);
     911            7881 :         while (it != DLListNULLIterator) {
     912            2627 :                 logtype = (struct logger_typeinfo_t *)dl_list_data (it);
     913            2627 :                 logtype->send_ (logtype, style, msg);
     914            2627 :                 it = dl_list_next (it);
     915                 :         }
     916           14496 :       EXIT:
     917           14496 :         return retval;
     918                 : }
     919                 : 
     920                 : /* ------------------------------------------------------------------------- */
     921                 : int vmnl_log (MinLogger * mnl, TSStyle style, const TSChar * format, 
     922                 :               va_list vl)
     923               0 : {
     924               0 :         int             retval = ENOERR;
     925               0 :         DLListIterator  it = INITPTR;
     926               0 :         struct logger_typeinfo_t *logtype = INITPTR;
     927                 :         char            msg[MaxLogMessage];
     928               0 :         memset (msg, '\0', MaxLogMessage);
     929               0 :         TLogLevel loglevel = style & 0xFFF80;
     930               0 :         if (loglevel==0x00000) { loglevel = ESInfo; }
     931                 : 
     932               0 :         if (mnl == INITPTR) {
     933               0 :                 retval = -1;
     934               0 :                 goto EXIT;
     935                 :         }
     936               0 :         if (format == INITPTR) {
     937               0 :                 retval = -1;
     938               0 :                 goto EXIT;
     939                 :         }
     940               0 :         if (loglevel > mnl->loglevel_) {
     941               0 :                 goto EXIT;
     942                 :         }
     943                 : 
     944                 :         /* Process the extra arguments */
     945               0 :         vsnprintf (msg, MaxLogMessage-1, format, vl);
     946                 : 
     947                 :         /* Log message through all of endpoints */
     948               0 :         it = dl_list_head (mnl->endpoint_);
     949               0 :         while (it != DLListNULLIterator) {
     950               0 :                 logtype = (struct logger_typeinfo_t *)dl_list_data (it);
     951               0 :                 logtype->send_ (logtype, style, msg);
     952               0 :                 it = dl_list_next (it);
     953                 :         }
     954               0 :       EXIT:
     955               0 :         return retval;
     956                 : }
     957                 : 
     958                 : 
     959                 : /* ------------------------------------------------------------------------- */
     960                 : void mnl_write_delimiter (MinLogger * mnl)
     961               0 : {
     962                 :         char            delim[61];
     963               0 :         int             ret = ENOERR;
     964                 : 
     965               0 :         if (mnl == INITPTR) {
     966               0 :                 goto EXIT;
     967                 :         }
     968                 : 
     969               0 :         memset (delim, '#', 60);
     970               0 :         delim[60] = '\0';
     971                 : 
     972               0 :         ret = mnl_log (mnl, ESNoStyle, "%s", delim);
     973               0 :         if (ret == -1) {
     974               0 :                 MIN_WARN ("%s:%s:%d - Writing of delimiter failed",
     975                 :                            __FILE__, __FUNCTION__, __LINE__);
     976                 :         }
     977               0 :       EXIT:
     978                 :         return;
     979                 : }
     980                 : 
     981                 : /* ------------------------------------------------------------------------- */
     982                 : void mnl_write_own_delimiter (MinLogger * mnl, const TSChar c,
     983                 :                               unsigned int t)
     984               0 : {
     985               0 :         TSChar         *delim = INITPTR;
     986               0 :         int             ret = ENOERR;
     987               0 :         if (mnl == INITPTR) {
     988               0 :                 goto EXIT;
     989                 :         }
     990                 : 
     991               0 :         delim = NEW2 (TSChar, t + 1);
     992               0 :         memset (delim, c, t);
     993               0 :         delim[t] = '\0';
     994                 : 
     995               0 :         ret = mnl_log (mnl, ESNoStyle, "%s", delim);
     996               0 :         if (ret == -1) {
     997               0 :                 MIN_WARN ("%s:%s:%d - Writing of delimiter failed",
     998                 :                            __FILE__, __FUNCTION__, __LINE__);
     999                 :         }
    1000                 : 
    1001               0 :         DELETE (delim);
    1002               0 :       EXIT:
    1003                 :         return;
    1004                 : }
    1005                 : 
    1006                 : /* ------------------------------------------------------------------------- */
    1007                 : unsigned int mnl_output_type (MinLogger * mnl)
    1008               6 : {
    1009               6 :         unsigned int    retval = 0;
    1010               6 :         DLListIterator  it = DLListNULLIterator;
    1011               6 :         DLListIterator  it2 = DLListNULLIterator;
    1012               6 :         struct logger_typeinfo_t *lt = INITPTR;
    1013               6 :         struct output_typeinfo_t *ot = INITPTR;
    1014                 : 
    1015               6 :         if (mnl == INITPTR) {
    1016               0 :                 goto EXIT;
    1017                 :         }
    1018                 : 
    1019               6 :         it = dl_list_head (mnl->endpoint_);
    1020              18 :         while (it != DLListNULLIterator) {
    1021               6 :                 lt = (struct logger_typeinfo_t *)dl_list_data (it);
    1022               6 :                 it2 = dl_list_head (lt->output_);
    1023              20 :                 while (it2 != DLListNULLIterator) {
    1024               8 :                         ot = (struct output_typeinfo_t *)dl_list_data (it2);
    1025               8 :                         retval |= ot->output_type_;
    1026               8 :                         it2 = dl_list_next (it2);
    1027                 :                 }
    1028               6 :                 it = dl_list_next (it);
    1029                 :         }
    1030               6 :       EXIT:
    1031               6 :         return retval;
    1032                 : }
    1033                 : 
    1034                 : /* ------------------------------------------------------------------------- */
    1035                 : unsigned int mnl_logger_type (MinLogger * mnl)
    1036               6 : {
    1037               6 :         unsigned int    retval = 0;
    1038               6 :         DLListIterator  it = DLListNULLIterator;
    1039               6 :         struct logger_typeinfo_t *lt = INITPTR;
    1040                 : 
    1041               6 :         if (mnl == INITPTR) {
    1042               0 :                 goto EXIT;
    1043                 :         }
    1044                 : 
    1045               6 :         it = dl_list_head (mnl->endpoint_);
    1046              20 :         while (it != DLListNULLIterator) {
    1047               8 :                 lt = (struct logger_typeinfo_t *)dl_list_data (it);
    1048               8 :                 retval |= lt->type_;
    1049               8 :                 it = dl_list_next (it);
    1050                 :         }
    1051               6 :       EXIT:
    1052               6 :         return retval;
    1053                 : }
    1054                 : 
    1055                 : /* ------------------------------------------------------------------------- */
    1056                 : MinLogger *mnl_get_logger_instance()
    1057           15327 : {
    1058           15327 :         return __logger__;
    1059                 : }
    1060                 : /* ------------------------------------------------------------------------- */
    1061                 : char* mnl_get_component_name()
    1062           14496 : {
    1063           14496 :         if (__component_name__==INITPTR) { return INITPTR; }
    1064           14496 :         else { return tx_share_buf(__component_name__); }
    1065                 : }
    1066                 : /* ------------------------------------------------------------------------- */
    1067                 : /* ================= TESTS FOR LOCAL FUNCTIONS ============================= */
    1068                 : #ifdef MIN_UNIT_TEST
    1069                 : #include "min_logger.tests"
    1070                 : #endif                          /* MIN_UNIT_TEST */
    1071                 : /* End of file */

Generated by: LTP GCOV extension version 1.6