logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit 276c29a382eba143d93778c45f869c2e291315e6
parent 8332142fb386406bdf09f16ef54b4a06295a7fbd
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 15 Oct 2018 11:34:16 +0200

Move maps of countries and continents to separate files

Diffstat:
MCMakeLists.txt | 2+-
Msrc/config.c | 530+------------------------------------------------------------------------------
Msrc/config.h | 6+-----
Asrc/continents.c | 33+++++++++++++++++++++++++++++++++
Asrc/continents.h | 21+++++++++++++++++++++
Asrc/countries.c | 521+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/countries.h | 22++++++++++++++++++++++
Msrc/logswan.c | 4+++-
Msrc/output.c | 4+++-
9 files changed, 606 insertions(+), 537 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -40,7 +40,7 @@ include_directories(${JANSSON_INCLUDE_DIRS}) set(CMAKE_BUILD_TYPE Release) set(DEPS deps/hll/hll.c deps/MurmurHash3/MurmurHash3.c) -set(SRC src/logswan.c src/config.c src/output.c src/parse.c) +set(SRC src/logswan.c src/config.c src/continents.c src/countries.c src/output.c src/parse.c) if(NOT HAVE_PLEDGE) set (SRC ${SRC} compat/pledge.c) diff --git a/src/config.c b/src/config.c @@ -5,541 +5,13 @@ /* https://www.logswan.org */ /* */ /* Created: 2015-05-31 */ -/* Last Updated: 2018-08-05 */ +/* Last Updated: 2018-10-15 */ /* */ /* Logswan is released under the BSD 2-Clause license. */ /* See LICENSE file for details. */ /* */ /*****************************************************************************/ -char *continentsId[] = { - "AF", - "AN", - "AS", - "EU", - "NA", - "OC", - "SA" -}; - -char *continentsNames[] = { - "Africa", - "Antarctica", - "Asia", - "Europe", - "North America", - "Oceania", - "South America" -}; - -char *countriesId[] = { - "AD", - "AE", - "AF", - "AG", - "AI", - "AL", - "AM", - "AN", - "AO", - "AQ", - "AR", - "AS", - "AT", - "AU", - "AW", - "AX", - "AZ", - "BA", - "BB", - "BD", - "BE", - "BF", - "BG", - "BH", - "BI", - "BJ", - "BL", - "BM", - "BN", - "BO", - "BQ", - "BR", - "BS", - "BT", - "BV", - "BW", - "BY", - "BZ", - "CA", - "CC", - "CD", - "CF", - "CG", - "CH", - "CI", - "CK", - "CL", - "CM", - "CN", - "CO", - "CR", - "CU", - "CV", - "CW", - "CX", - "CY", - "CZ", - "DE", - "DJ", - "DK", - "DM", - "DO", - "DZ", - "EC", - "EE", - "EG", - "EH", - "ER", - "ES", - "ET", - "FI", - "FJ", - "FK", - "FM", - "FO", - "FR", - "GA", - "GB", - "GD", - "GE", - "GF", - "GG", - "GH", - "GI", - "GL", - "GM", - "GN", - "GP", - "GQ", - "GR", - "GS", - "GT", - "GU", - "GW", - "GY", - "HK", - "HM", - "HN", - "HR", - "HT", - "HU", - "ID", - "IE", - "IL", - "IM", - "IN", - "IO", - "IQ", - "IR", - "IS", - "IT", - "JE", - "JM", - "JO", - "JP", - "KE", - "KG", - "KH", - "KI", - "KM", - "KN", - "KP", - "KR", - "KW", - "KY", - "KZ", - "LA", - "LB", - "LC", - "LI", - "LK", - "LR", - "LS", - "LT", - "LU", - "LV", - "LY", - "MA", - "MC", - "MD", - "ME", - "MF", - "MG", - "MH", - "MK", - "ML", - "MM", - "MN", - "MO", - "MP", - "MQ", - "MR", - "MS", - "MT", - "MU", - "MV", - "MW", - "MX", - "MY", - "MZ", - "NA", - "NC", - "NE", - "NF", - "NG", - "NI", - "NL", - "NO", - "NP", - "NR", - "NU", - "NZ", - "OM", - "PA", - "PE", - "PF", - "PG", - "PH", - "PK", - "PL", - "PM", - "PN", - "PR", - "PS", - "PT", - "PW", - "PY", - "QA", - "RE", - "RO", - "RS", - "RU", - "RW", - "SA", - "SB", - "SC", - "SD", - "SE", - "SG", - "SH", - "SI", - "SJ", - "SK", - "SL", - "SM", - "SN", - "SO", - "SR", - "SS", - "ST", - "SV", - "SX", - "SY", - "SZ", - "TC", - "TD", - "TF", - "TG", - "TH", - "TJ", - "TK", - "TL", - "TM", - "TN", - "TO", - "TR", - "TT", - "TV", - "TW", - "TZ", - "UA", - "UG", - "UM", - "US", - "UY", - "UZ", - "VA", - "VC", - "VE", - "VG", - "VI", - "VN", - "VU", - "WF", - "WS", - "XK", - "YE", - "YT", - "ZA", - "ZM", - "ZW" -}; - -char *countriesNames[] = { - "Andorra", - "United Arab Emirates", - "Afghanistan", - "Antigua and Barbuda", - "Anguilla", - "Albania", - "Armenia", - "Netherlands Antilles", - "Angola", - "Antarctica", - "Argentina", - "American Samoa", - "Austria", - "Australia", - "Aruba", - "Aland", - "Azerbaijan", - "Bosnia and Herzegovina", - "Barbados", - "Bangladesh", - "Belgium", - "Burkina Faso", - "Bulgaria", - "Bahrain", - "Burundi", - "Benin", - "Saint Barthelemy", - "Bermuda", - "Brunei", - "Bolivia", - "Bonaire", - "Brazil", - "Bahamas", - "Bhutan", - "Bouvet Island", - "Botswana", - "Belarus", - "Belize", - "Canada", - "Cocos (Keeling) Islands", - "Democratic Republic of the Congo", - "Central African Republic", - "Republic of the Congo", - "Switzerland", - "Ivory Coast", - "Cook Islands", - "Chile", - "Cameroon", - "China", - "Colombia", - "Costa Rica", - "Cuba", - "Cape Verde", - "Curacao", - "Christmas Island", - "Cyprus", - "Czech Republic", - "Germany", - "Djibouti", - "Denmark", - "Dominica", - "Dominican Republic", - "Algeria", - "Ecuador", - "Estonia", - "Egypt", - "Western Sahara", - "Eritrea", - "Spain", - "Ethiopia", - "Finland", - "Fiji", - "Falkland Islands", - "Micronesia", - "Faroe Islands", - "France", - "Gabon", - "United Kingdom", - "Grenada", - "Georgia", - "French Guiana", - "Guernsey", - "Ghana", - "Gibraltar", - "Greenland", - "Gambia", - "Guinea", - "Guadeloupe", - "Equatorial Guinea", - "Greece", - "South Georgia and the South Sandwich Islands", - "Guatemala", - "Guam", - "Guinea-Bissau", - "Guyana", - "Hong Kong", - "Heard Island and McDonald Islands", - "Honduras", - "Croatia", - "Haiti", - "Hungary", - "Indonesia", - "Ireland", - "Israel", - "Isle of Man", - "India", - "British Indian Ocean Territory", - "Iraq", - "Iran", - "Iceland", - "Italy", - "Jersey", - "Jamaica", - "Jordan", - "Japan", - "Kenya", - "Kyrgyzstan", - "Cambodia", - "Kiribati", - "Comoros", - "Saint Kitts and Nevis", - "North Korea", - "South Korea", - "Kuwait", - "Cayman Islands", - "Kazakhstan", - "Laos", - "Lebanon", - "Saint Lucia", - "Liechtenstein", - "Sri Lanka", - "Liberia", - "Lesotho", - "Lithuania", - "Luxembourg", - "Latvia", - "Libya", - "Morocco", - "Monaco", - "Moldova", - "Montenegro", - "Saint Martin", - "Madagascar", - "Marshall Islands", - "Macedonia", - "Mali", - "Myanmar", - "Mongolia", - "Macao", - "Northern Mariana Islands", - "Martinique", - "Mauritania", - "Montserrat", - "Malta", - "Mauritius", - "Maldives", - "Malawi", - "Mexico", - "Malaysia", - "Mozambique", - "Namibia", - "New Caledonia", - "Niger", - "Norfolk Island", - "Nigeria", - "Nicaragua", - "Netherlands", - "Norway", - "Nepal", - "Nauru", - "Niue", - "New Zealand", - "Oman", - "Panama", - "Peru", - "French Polynesia", - "Papua New Guinea", - "Philippines", - "Pakistan", - "Poland", - "Saint Pierre and Miquelon", - "Pitcairn Islands", - "Puerto Rico", - "Palestine", - "Portugal", - "Palau", - "Paraguay", - "Qatar", - "Reunion", - "Romania", - "Serbia", - "Russia", - "Rwanda", - "Saudi Arabia", - "Solomon Islands", - "Seychelles", - "Sudan", - "Sweden", - "Singapore", - "Saint Helena", - "Slovenia", - "Svalbard and Jan Mayen", - "Slovakia", - "Sierra Leone", - "San Marino", - "Senegal", - "Somalia", - "Suriname", - "South Sudan", - "Sao Tome and Principe", - "El Salvador", - "Sint Maarten", - "Syria", - "Swaziland", - "Turks and Caicos Islands", - "Chad", - "French Southern Territories", - "Togo", - "Thailand", - "Tajikistan", - "Tokelau", - "East Timor", - "Turkmenistan", - "Tunisia", - "Tonga", - "Turkey", - "Trinidad and Tobago", - "Tuvalu", - "Taiwan", - "Tanzania", - "Ukraine", - "Uganda", - "U.S. Minor Outlying Islands", - "United States", - "Uruguay", - "Uzbekistan", - "Vatican City", - "Saint Vincent and the Grenadines", - "Venezuela", - "British Virgin Islands", - "U.S. Virgin Islands", - "Vietnam", - "Vanuatu", - "Wallis and Futuna", - "Samoa", - "Kosovo", - "Yemen", - "Mayotte", - "South Africa", - "Zambia", - "Zimbabwe" -}; - char *methodsNames[] = { "GET", "POST", diff --git a/src/config.h b/src/config.h @@ -5,7 +5,7 @@ /* https://www.logswan.org */ /* */ /* Created: 2015-05-31 */ -/* Last Updated: 2018-08-05 */ +/* Last Updated: 2018-10-15 */ /* */ /* Logswan is released under the BSD 2-Clause license. */ /* See LICENSE file for details. */ @@ -28,10 +28,6 @@ enum { PROTOCOLS = 3 }; -extern char *continentsId[]; -extern char *continentsNames[]; -extern char *countriesId[]; -extern char *countriesNames[]; extern char *methodsNames[]; extern char *protocolsNames[]; diff --git a/src/continents.c b/src/continents.c @@ -0,0 +1,33 @@ +/*****************************************************************************/ +/* */ +/* Logswan 2.0.2 */ +/* Copyright (c) 2015-2018, Frederic Cambus */ +/* https://www.logswan.org */ +/* */ +/* Created: 2015-05-31 */ +/* Last Updated: 2018-10-15 */ +/* */ +/* Logswan is released under the BSD 2-Clause license. */ +/* See LICENSE file for details. */ +/* */ +/*****************************************************************************/ + +char *continentsId[] = { + "AF", + "AN", + "AS", + "EU", + "NA", + "OC", + "SA" +}; + +char *continentsNames[] = { + "Africa", + "Antarctica", + "Asia", + "Europe", + "North America", + "Oceania", + "South America" +}; diff --git a/src/continents.h b/src/continents.h @@ -0,0 +1,21 @@ +/*****************************************************************************/ +/* */ +/* Logswan 2.0.2 */ +/* Copyright (c) 2015-2018, Frederic Cambus */ +/* https://www.logswan.org */ +/* */ +/* Created: 2015-05-31 */ +/* Last Updated: 2018-10-15 */ +/* */ +/* Logswan is released under the BSD 2-Clause license. */ +/* See LICENSE file for details. */ +/* */ +/*****************************************************************************/ + +#ifndef CONTINENTS_H +#define CONTINENTS_H + +extern char *continentsId[]; +extern char *continentsNames[]; + +#endif /* CONTINENTS */ diff --git a/src/countries.c b/src/countries.c @@ -0,0 +1,521 @@ +/*****************************************************************************/ +/* */ +/* Logswan 2.0.2 */ +/* Copyright (c) 2015-2018, Frederic Cambus */ +/* https://www.logswan.org */ +/* */ +/* Created: 2015-05-31 */ +/* Last Updated: 2018-10-15 */ +/* */ +/* Logswan is released under the BSD 2-Clause license. */ +/* See LICENSE file for details. */ +/* */ +/*****************************************************************************/ + +char *countriesId[] = { + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AN", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW" +}; + +char *countriesNames[] = { + "Andorra", + "United Arab Emirates", + "Afghanistan", + "Antigua and Barbuda", + "Anguilla", + "Albania", + "Armenia", + "Netherlands Antilles", + "Angola", + "Antarctica", + "Argentina", + "American Samoa", + "Austria", + "Australia", + "Aruba", + "Aland", + "Azerbaijan", + "Bosnia and Herzegovina", + "Barbados", + "Bangladesh", + "Belgium", + "Burkina Faso", + "Bulgaria", + "Bahrain", + "Burundi", + "Benin", + "Saint Barthelemy", + "Bermuda", + "Brunei", + "Bolivia", + "Bonaire", + "Brazil", + "Bahamas", + "Bhutan", + "Bouvet Island", + "Botswana", + "Belarus", + "Belize", + "Canada", + "Cocos (Keeling) Islands", + "Democratic Republic of the Congo", + "Central African Republic", + "Republic of the Congo", + "Switzerland", + "Ivory Coast", + "Cook Islands", + "Chile", + "Cameroon", + "China", + "Colombia", + "Costa Rica", + "Cuba", + "Cape Verde", + "Curacao", + "Christmas Island", + "Cyprus", + "Czech Republic", + "Germany", + "Djibouti", + "Denmark", + "Dominica", + "Dominican Republic", + "Algeria", + "Ecuador", + "Estonia", + "Egypt", + "Western Sahara", + "Eritrea", + "Spain", + "Ethiopia", + "Finland", + "Fiji", + "Falkland Islands", + "Micronesia", + "Faroe Islands", + "France", + "Gabon", + "United Kingdom", + "Grenada", + "Georgia", + "French Guiana", + "Guernsey", + "Ghana", + "Gibraltar", + "Greenland", + "Gambia", + "Guinea", + "Guadeloupe", + "Equatorial Guinea", + "Greece", + "South Georgia and the South Sandwich Islands", + "Guatemala", + "Guam", + "Guinea-Bissau", + "Guyana", + "Hong Kong", + "Heard Island and McDonald Islands", + "Honduras", + "Croatia", + "Haiti", + "Hungary", + "Indonesia", + "Ireland", + "Israel", + "Isle of Man", + "India", + "British Indian Ocean Territory", + "Iraq", + "Iran", + "Iceland", + "Italy", + "Jersey", + "Jamaica", + "Jordan", + "Japan", + "Kenya", + "Kyrgyzstan", + "Cambodia", + "Kiribati", + "Comoros", + "Saint Kitts and Nevis", + "North Korea", + "South Korea", + "Kuwait", + "Cayman Islands", + "Kazakhstan", + "Laos", + "Lebanon", + "Saint Lucia", + "Liechtenstein", + "Sri Lanka", + "Liberia", + "Lesotho", + "Lithuania", + "Luxembourg", + "Latvia", + "Libya", + "Morocco", + "Monaco", + "Moldova", + "Montenegro", + "Saint Martin", + "Madagascar", + "Marshall Islands", + "Macedonia", + "Mali", + "Myanmar", + "Mongolia", + "Macao", + "Northern Mariana Islands", + "Martinique", + "Mauritania", + "Montserrat", + "Malta", + "Mauritius", + "Maldives", + "Malawi", + "Mexico", + "Malaysia", + "Mozambique", + "Namibia", + "New Caledonia", + "Niger", + "Norfolk Island", + "Nigeria", + "Nicaragua", + "Netherlands", + "Norway", + "Nepal", + "Nauru", + "Niue", + "New Zealand", + "Oman", + "Panama", + "Peru", + "French Polynesia", + "Papua New Guinea", + "Philippines", + "Pakistan", + "Poland", + "Saint Pierre and Miquelon", + "Pitcairn Islands", + "Puerto Rico", + "Palestine", + "Portugal", + "Palau", + "Paraguay", + "Qatar", + "Reunion", + "Romania", + "Serbia", + "Russia", + "Rwanda", + "Saudi Arabia", + "Solomon Islands", + "Seychelles", + "Sudan", + "Sweden", + "Singapore", + "Saint Helena", + "Slovenia", + "Svalbard and Jan Mayen", + "Slovakia", + "Sierra Leone", + "San Marino", + "Senegal", + "Somalia", + "Suriname", + "South Sudan", + "Sao Tome and Principe", + "El Salvador", + "Sint Maarten", + "Syria", + "Swaziland", + "Turks and Caicos Islands", + "Chad", + "French Southern Territories", + "Togo", + "Thailand", + "Tajikistan", + "Tokelau", + "East Timor", + "Turkmenistan", + "Tunisia", + "Tonga", + "Turkey", + "Trinidad and Tobago", + "Tuvalu", + "Taiwan", + "Tanzania", + "Ukraine", + "Uganda", + "U.S. Minor Outlying Islands", + "United States", + "Uruguay", + "Uzbekistan", + "Vatican City", + "Saint Vincent and the Grenadines", + "Venezuela", + "British Virgin Islands", + "U.S. Virgin Islands", + "Vietnam", + "Vanuatu", + "Wallis and Futuna", + "Samoa", + "Kosovo", + "Yemen", + "Mayotte", + "South Africa", + "Zambia", + "Zimbabwe" +}; diff --git a/src/countries.h b/src/countries.h @@ -0,0 +1,22 @@ +/*****************************************************************************/ +/* */ +/* Logswan 2.0.2 */ +/* Copyright (c) 2015-2018, Frederic Cambus */ +/* https://www.logswan.org */ +/* */ +/* Created: 2015-05-31 */ +/* Last Updated: 2018-10-15 */ +/* */ +/* Logswan is released under the BSD 2-Clause license. */ +/* See LICENSE file for details. */ +/* */ +/*****************************************************************************/ + +#ifndef COUNTRIES_H +#define COUNTRIES_H + +extern char *countriesId[]; +extern char *countriesNames[]; + +#endif /* COUNTRIES */ + diff --git a/src/logswan.c b/src/logswan.c @@ -5,7 +5,7 @@ /* https://www.logswan.org */ /* */ /* Created: 2015-05-31 */ -/* Last Updated: 2018-08-05 */ +/* Last Updated: 2018-10-15 */ /* */ /* Logswan is released under the BSD 2-Clause license. */ /* See LICENSE file for details. */ @@ -36,6 +36,8 @@ #include "compat.h" #include "config.h" +#include "continents.h" +#include "countries.h" #include "hll.h" #include "output.h" #include "parse.h" diff --git a/src/output.c b/src/output.c @@ -5,7 +5,7 @@ /* https://www.logswan.org */ /* */ /* Created: 2015-05-31 */ -/* Last Updated: 2018-08-05 */ +/* Last Updated: 2018-10-15 */ /* */ /* Logswan is released under the BSD 2-Clause license. */ /* See LICENSE file for details. */ @@ -17,6 +17,8 @@ #include <jansson.h> #include "config.h" +#include "continents.h" +#include "countries.h" #include "output.h" char