"Fossies" - the Fresh Open Source Software Archive

Member "sarg-2.4.0/include/readlog.h" (30 Jan 2017, 2108 Bytes) of package /linux/privat/sarg-2.4.0.tar.gz:


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

    1 #ifndef READLOG_HEADER
    2 #define READLOG_HEADER
    3 
    4 /*!
    5 \brief Possible return codes for the functions parsing the input log.
    6 */
    7 enum ReadLogReturnCodeEnum
    8 {
    9     //! Line successfuly read.
   10     RLRC_NoError,
   11     //! Line is known and should be ignored.
   12     RLRC_Ignore,
   13     //! Unknown line format.
   14     RLRC_Unknown,
   15     //! Error encountered during the parsing of the file.
   16     RLRC_InternalError,
   17 
   18     RLRC_LastRetCode //!< last entry of the list.
   19 };
   20 
   21 /*!
   22 \brief Data read from an input log file.
   23 */
   24 struct ReadLogStruct
   25 {
   26     //! The time corresponding to the entry.
   27     struct tm EntryTime;
   28     //! The IP address connecting to internet.
   29     const char *Ip;
   30     //! The user's name.
   31     const char *User;
   32     /*!
   33     The URL of the visited site.
   34 
   35     The pointer may be NULL if the URL doesn't exists in the log file.
   36     */
   37     char *Url;
   38     //! Time necessary to process the user's request.
   39     long int ElapsedTime;
   40     //! Number of transfered bytes.
   41     long long int DataSize;
   42     //! HTTP code returned to the user for the entry.
   43     char *HttpCode;
   44     //! HTTP method or NULL if the information is not stored in the log.
   45     char *HttpMethod;
   46     //! Useragent string or NULL if it isn't available
   47     const char *UserAgent;
   48 };
   49 
   50 /*!
   51 \brief Functions to read a log file.
   52 */
   53 struct ReadLogProcessStruct
   54 {
   55     //! The name of the log file processed by this object.
   56     const char *Name;
   57     //! Inform the module about the reading of a new file.
   58     void (*NewFile)(const char *FileName);
   59     //! Funtion to read one entry from the log.
   60     enum ReadLogReturnCodeEnum (*ReadEntry)(char *Line,struct ReadLogStruct *Entry);
   61 };
   62 
   63 /*!
   64  * \brief Persistant data to parse a log line.
   65  */
   66 struct LogLineStruct
   67 {
   68     const struct ReadLogProcessStruct *current_format;
   69     int current_format_idx;
   70     int successive_errors;
   71     int total_errors;
   72     const char *file_name;
   73 };
   74 
   75 //! Opaque object used to parse a log line.
   76 typedef struct LogLineStruct *LogLineObject;
   77 
   78 void LogLine_Init(struct LogLineStruct *log_line);
   79 void LogLine_File(struct LogLineStruct *log_line,const char *file_name);
   80 enum ReadLogReturnCodeEnum LogLine_Parse(struct LogLineStruct *log_line,struct ReadLogStruct *log_entry,char *linebuf);
   81 
   82 #endif //READLOG_HEADER