1 /** 2 * ______ ___ 3 * / ____/___ / | _____________ __________ 4 * / / __/ __ \/ /| |/ ___/ ___/ _ \/ ___/ ___/ 5 * / /_/ / /_/ / ___ / /__/ /__/ __(__ |__ ) 6 * \____/\____/_/ |_\___/\___/\___/____/____/ 7 * 8 * The MIT License (MIT) 9 * Copyright (c) 2009-2020 Gerardo Orellana <hello @ goaccess.io> 10 * 11 * Permission is hereby granted, free of charge, to any person obtaining a copy 12 * of this software and associated documentation files (the "Software"), to deal 13 * in the Software without restriction, including without limitation the rights 14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 * copies of the Software, and to permit persons to whom the Software is 16 * furnished to do so, subject to the following conditions: 17 * 18 * The above copyright notice and this permission notice shall be included in all 19 * copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 * SOFTWARE. 28 */ 29 30 #ifndef GSTORAGE_H_INCLUDED 31 #define GSTORAGE_H_INCLUDED 32 33 #include "commons.h" 34 #include "parser.h" 35 36 /* Total number of storage metrics (GSMetric) */ 37 #define GSMTRC_TOTAL 19 38 #define DB_PATH "/tmp" 39 40 /* Enumerated Storage Metrics */ 41 typedef enum GSMetric_ { 42 MTRC_KEYMAP, 43 MTRC_ROOTMAP, 44 MTRC_DATAMAP, 45 MTRC_UNIQMAP, 46 MTRC_ROOT, 47 MTRC_HITS, 48 MTRC_VISITORS, 49 MTRC_BW, 50 MTRC_CUMTS, 51 MTRC_MAXTS, 52 MTRC_METHODS, 53 MTRC_PROTOCOLS, 54 MTRC_AGENTS, 55 MTRC_METADATA, 56 MTRC_UNIQUE_KEYS, 57 MTRC_AGENT_KEYS, 58 MTRC_AGENT_VALS, 59 MTRC_CNT_VALID, 60 MTRC_CNT_BW, 61 } GSMetric; 62 63 GMetrics *new_gmetrics (void); 64 void free_gmetrics (GMetrics * metric); 65 66 uint32_t *i322ptr (uint32_t val); 67 uint64_t *uint642ptr (uint64_t val); 68 69 char *get_mtr_str (GSMetric metric); 70 void set_module_totals (GPercTotals * totals); 71 void set_data_metrics (GMetrics * ometrics, GMetrics ** nmetrics, GPercTotals totals); 72 73 #endif // for #ifndef GSTORAGE_H 74