<commit_before>#ifndef SRC_LIB_COMMON_LIMITS_H_
#define SRC_LIB_COMMON_LIMITS_H_

/*
*
* Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
*
* This file is part of Orion Context Broker.
*
* Orion Context Broker is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Orion Context Broker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
* General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
*
* For those usages not covered by this license please contact with
* iot_support at tid dot es
*
* Author: <NAME>
*/



/* ****************************************************************************
*
* Service/Tenant definitions - 
*/
#define SERVICE_NAME_MAX_LEN            50
#define SERVICE_NAME_MAX_LEN_STRING    "50"



/* ****************************************************************************
*
* Service Path definitions - 
*
* The formula for SERVICE_PATH_MAX_TOTAL needs a little explanation. Considering
*
* Fiware-ServicePath: /A/B, /C/D
*
* The +1 if for the '/' in each level, the +2 is the extra characters assuming that the
* separation between tokens is ', ' (this is just an heuristic, as HTTP header could include
* more whitespace, but probably the final value is so large that it suffices most of the
* cases and don't mind in the case of truncated very long service path, from a logs point
* of view).
*
*/
#define SERVICE_PATH_MAX_COMPONENTS       10
#define SERVICE_PATH_MAX_LEVELS           10
#define SERVICE_PATH_MAX_COMPONENT_LEN    50
#define SERVICE_PATH_MAX_TOTAL            (((SERVICE_PATH_MAX_COMPONENT_LEN + 1) * SERVICE_PATH_MAX_LEVELS) + 2) * SERVICE_PATH_MAX_COMPONENTS



/* ****************************************************************************
*
* Others -
*
*/
#define IP_LENGTH_MAX           15     // Based on xxx.xxx.xxx.xxx
#define STRING_SIZE_FOR_INT     16     // Room enough for an integer
#define STRING_SIZE_FOR_DOUBLE  64     // Room enough for a double
#define CORRELATOR_ID_SIZE      36     // Max size of a UUIDv4 string
#define MAX_PORT                65535  // Max port number (MAXSHORT)



/* *****************************************************************************
*
* DB_AND_SERVICE_NAME_MAX_LEN - <commit_msg>better comment for MAX_PORT<commit_after>#ifndef SRC_LIB_COMMON_LIMITS_H_
#define SRC_LIB_COMMON_LIMITS_H_

/*
*
* Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
*
* This file is part of Orion Context Broker.
*
* Orion Context Broker is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Orion Context Broker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
* General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
*
* For those usages not covered by this license please contact with
* iot_support at tid dot es
*
* Author: <NAME>
*/



/* ****************************************************************************
*
* Service/Tenant definitions - 
*/
#define SERVICE_NAME_MAX_LEN            50
#define SERVICE_NAME_MAX_LEN_STRING    "50"



/* ****************************************************************************
*
* Service Path definitions - 
*
* The formula for SERVICE_PATH_MAX_TOTAL needs a little explanation. Considering
*
* Fiware-ServicePath: /A/B, /C/D
*
* The +1 if for the '/' in each level, the +2 is the extra characters assuming that the
* separation between tokens is ', ' (this is just an heuristic, as HTTP header could include
* more whitespace, but probably the final value is so large that it suffices most of the
* cases and don't mind in the case of truncated very long service path, from a logs point
* of view).
*
*/
#define SERVICE_PATH_MAX_COMPONENTS       10
#define SERVICE_PATH_MAX_LEVELS           10
#define SERVICE_PATH_MAX_COMPONENT_LEN    50
#define SERVICE_PATH_MAX_TOTAL            (((SERVICE_PATH_MAX_COMPONENT_LEN + 1) * SERVICE_PATH_MAX_LEVELS) + 2) * SERVICE_PATH_MAX_COMPONENTS



/* ****************************************************************************
*
* Others -
*
*/
#define IP_LENGTH_MAX           15     // Based on xxx.xxx.xxx.xxx
#define STRING_SIZE_FOR_INT     16     // Room enough for an integer
#define STRING_SIZE_FOR_DOUBLE  64     // Room enough for a double
#define CORRELATOR_ID_SIZE      36     // Max size of a UUIDv4 string
#define MAX_PORT                65535  // Max port number (== 0xFFFF)



/* *****************************************************************************
*
* DB_AND_SERVICE_NAME_MAX_LEN - 
{'fraction_non_alphanumeric': 0.1745645251919835, 'fraction_numerical': 0.012549166510582506, 'mean_word_length': 4.1198465963566635, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7114660', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1444, 'n_words': 577}