parser.h (goaccess-1.7) | : | parser.h (goaccess-1.7.1) | ||
---|---|---|---|---|
/** | /** | |||
* ______ ___ | * ______ ___ | |||
* / ____/___ / | _____________ __________ | * / ____/___ / | _____________ __________ | |||
* / / __/ __ \/ /| |/ ___/ ___/ _ \/ ___/ ___/ | * / / __/ __ \/ /| |/ ___/ ___/ _ \/ ___/ ___/ | |||
* / /_/ / /_/ / ___ / /__/ /__/ __(__ |__ ) | * / /_/ / /_/ / ___ / /__/ /__/ __(__ |__ ) | |||
* \____/\____/_/ |_\___/\___/\___/____/____/ | * \____/\____/_/ |_\___/\___/\___/____/____/ | |||
* | * | |||
* The MIT License (MIT) | * The MIT License (MIT) | |||
* Copyright (c) 2009-2022 Gerardo Orellana <hello @ goaccess.io> | * Copyright (c) 2009-2023 Gerardo Orellana <hello @ goaccess.io> | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the rights | * in the Software without restriction, including without limitation the rights | |||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
* copies of the Software, and to permit persons to whom the Software is | * copies of the Software, and to permit persons to whom the Software is | |||
* furnished to do so, subject to the following conditions: | * furnished to do so, subject to the following conditions: | |||
* | * | |||
* The above copyright notice and this permission notice shall be included in al l | * The above copyright notice and this permission notice shall be included in al l | |||
* copies or substantial portions of the Software. | * copies or substantial portions of the Software. | |||
skipping to change at line 47 | skipping to change at line 47 | |||
#define MAX_LOG_ERRORS 20 | #define MAX_LOG_ERRORS 20 | |||
#define READ_BYTES 4096u | #define READ_BYTES 4096u | |||
#define MAX_BATCH_LINES 8192u /* max number of lines to read per batch before a reflow */ | #define MAX_BATCH_LINES 8192u /* max number of lines to read per batch before a reflow */ | |||
#define LINE_LEN 23 | #define LINE_LEN 23 | |||
#define ERROR_LEN 255 | #define ERROR_LEN 255 | |||
#define REF_SITE_LEN 511 /* maximum length of a referring site */ | #define REF_SITE_LEN 511 /* maximum length of a referring site */ | |||
#define CACHE_STATUS_LEN 7 | #define CACHE_STATUS_LEN 7 | |||
#define HASH_HEX 64 | #define HASH_HEX 64 | |||
#define SPEC_TOKN_NUL 0x1 | #define ERR_SPEC_TOKN_NUL 0x1 | |||
#define SPEC_TOKN_INV 0x2 | #define ERR_SPEC_TOKN_INV 0x2 | |||
#define SPEC_SFMT_MIS 0x3 | #define ERR_SPEC_SFMT_MIS 0x3 | |||
#define SPEC_LINE_INV 0x4 | #define ERR_SPEC_LINE_INV 0x4 | |||
#define ERR_LOG_NOT_FOUND 0x5 | ||||
#define ERR_LOG_REALLOC_FAILURE 0x6 | ||||
#include "commons.h" | #include "commons.h" | |||
#include "gslist.h" | #include "gslist.h" | |||
/* Log properties. Note: This is per line parsed */ | /* Log properties. Note: This is per line parsed */ | |||
typedef struct GLogItem_ { | typedef struct GLogItem_ { | |||
char *agent; | char *agent; | |||
char *browser; | char *browser; | |||
char *browser_type; | char *browser_type; | |||
char *continent; | char *continent; | |||
skipping to change at line 148 | skipping to change at line 150 | |||
FILE *pipe; | FILE *pipe; | |||
} GLog; | } GLog; | |||
/* Container for all logs */ | /* Container for all logs */ | |||
typedef struct Logs_ { | typedef struct Logs_ { | |||
uint8_t restored:1; | uint8_t restored:1; | |||
uint8_t load_from_disk_only:1; | uint8_t load_from_disk_only:1; | |||
uint64_t *processed; | uint64_t *processed; | |||
uint64_t offset; | uint64_t offset; | |||
int size; /* num items */ | int size; /* num items */ | |||
int idx; | ||||
char *filename; | char *filename; | |||
GLog *glog; | GLog *glog; | |||
} Logs; | } Logs; | |||
/* Raw data field type */ | /* Raw data field type */ | |||
typedef enum { | typedef enum { | |||
U32, | U32, | |||
STR | STR | |||
} datatype; | } datatype; | |||
skipping to change at line 181 | skipping to change at line 184 | |||
datatype type; | datatype type; | |||
int idx; /* first level index */ | int idx; /* first level index */ | |||
int size; /* total num of items on ht */ | int size; /* total num of items on ht */ | |||
} GRawData; | } GRawData; | |||
char *extract_by_delim (char **str, const char *end); | char *extract_by_delim (char **str, const char *end); | |||
char *fgetline (FILE * fp); | char *fgetline (FILE * fp); | |||
char **test_format (Logs * logs, int *len); | char **test_format (Logs * logs, int *len); | |||
int parse_log (Logs * logs, int dry_run); | int parse_log (Logs * logs, int dry_run); | |||
int pre_process_log (GLog * glog, char *line, int dry_run); | int pre_process_log (GLog * glog, char *line, int dry_run); | |||
int set_glog (Logs * logs, const char *filename); | ||||
int set_initial_persisted_data (GLog * glog, FILE * fp, const char *fn); | int set_initial_persisted_data (GLog * glog, FILE * fp, const char *fn); | |||
int set_log (Logs * logs, const char *value); | ||||
void free_logerrors (GLog * glog); | void free_logerrors (GLog * glog); | |||
void free_logs (Logs * logs); | void free_logs (Logs * logs); | |||
void free_raw_data (GRawData * raw_data); | void free_raw_data (GRawData * raw_data); | |||
void output_logerrors (void); | void output_logerrors (void); | |||
void reset_struct (Logs * logs); | void reset_struct (Logs * logs); | |||
GLogItem *init_log_item (GLog * glog); | GLogItem *init_log_item (GLog * glog); | |||
GRawDataItem *new_grawdata_item (unsigned int size); | GRawDataItem *new_grawdata_item (unsigned int size); | |||
GRawData *new_grawdata (void); | GRawData *new_grawdata (void); | |||
Logs *init_logs (int size); | Logs *init_logs (int size); | |||
Logs *new_logs (int size); | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
5 lines changed or deleted | 11 lines changed or added |