diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..08a9bd35381 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,7 @@ +* @centreon/owners-cpp + +.github/** @centreon/owners-pipelines +packaging/** @centreon/owners-pipelines +selinux/** @centreon/owners-pipelines + +tests/** @centreon/owners-robot-e2e diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2f20441e411..882e3438310 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -15,11 +15,11 @@ Please include a short resume of the changes and what is the purpose of PR. Any ## Target serie -- [ ] 21.10.x - [ ] 22.04.x - [ ] 22.10.x - [ ] 23.04.x -- [ ] 23.10.x (master) +- [ ] 23.10.x +- [ ] 24.04.x (master)

How this pull request can be tested ?

diff --git a/.github/actions/delivery/action.yml b/.github/actions/delivery/action.yml index 5670e7b09ab..a9ae5f3c240 100644 --- a/.github/actions/delivery/action.yml +++ b/.github/actions/delivery/action.yml @@ -36,12 +36,12 @@ runs: echo "extfile=deb" >> $GITHUB_ENV - name: Use cache files - uses: actions/cache@v3 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: path: ./*.${{ env.extfile }} key: ${{ inputs.cache_key }} - - uses: jfrog/setup-jfrog-cli@v3 + - uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 env: JF_URL: https://centreon.jfrog.io JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} diff --git a/.github/actions/package/action.yml b/.github/actions/package/action.yml index 0b95d964bbe..3e12de73d08 100644 --- a/.github/actions/package/action.yml +++ b/.github/actions/package/action.yml @@ -76,7 +76,7 @@ runs: shell: bash - name: Cache packages - uses: actions/cache/save@v3 + uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: path: ./*.${{ inputs.package_extension }} key: ${{ inputs.cache_key }} diff --git a/.github/actions/promote-to-stable/action.yml b/.github/actions/promote-to-stable/action.yml index ed663baa648..f61b16d27dc 100644 --- a/.github/actions/promote-to-stable/action.yml +++ b/.github/actions/promote-to-stable/action.yml @@ -26,7 +26,7 @@ inputs: runs: using: "composite" steps: - - uses: jfrog/setup-jfrog-cli@v3 + - uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 env: JF_URL: https://centreon.jfrog.io JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} @@ -39,9 +39,17 @@ runs: echo "[DEBUG] - Minor version: ${{ inputs.minor_version }}" echo "[DEBUG] - Distrib: ${{ inputs.distrib }}" + # Cloud specific promote + # delivery by default to onprem, override to internal if base branch is master + if [[ $GITHUB_BASE_REF == "master" ]]; then + ROOT_REPO_PATH="rpm-standard-internal" + else + ROOT_REPO_PATH="rpm-standard" + fi + for ARCH in "noarch" "x86_64"; do echo "[DEBUG] - Get artifactory path of $ARCH testing artifacts to promote to stable." - SRC_PATHS=$(jf rt s --include-dirs rpm-standard/${{ inputs.major_version }}/${{ inputs.distrib }}/testing/$ARCH/${{ inputs.module_name }}/*.rpm | jq -r '.[].path') + SRC_PATHS=$(jf rt s --include-dirs $ROOT_REPO_PATH/${{ inputs.major_version }}/${{ inputs.distrib }}/testing/$ARCH/${{ inputs.module_name }}/*.rpm | jq -r '.[].path') if [[ ${SRC_PATHS[@]} ]]; then for SRC_PATH in ${SRC_PATHS[@]}; do echo "[DEBUG] - Source path found: $SRC_PATH" @@ -51,13 +59,18 @@ runs: continue fi echo "[DEBUG] - Build $ARCH artifactory target path." - TARGET_PATH="rpm-standard/${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/RPMS/${{ inputs.module_name }}/" + TARGET_PATH="$ROOT_REPO_PATH/${{ inputs.major_version }}/${{ inputs.distrib }}/${{ inputs.stability }}/$ARCH/RPMS/${{ inputs.module_name }}/" echo "[DEBUG] - Target path: $TARGET_PATH" echo "[DEBUG] - Promoting $ARCH testing artifacts to stable." for ARTIFACT in ${SRC_PATHS[@]}; do - echo "[DEBUG] - Promoting $ARTIFACT to stable on artifactory." - jf rt cp $ARTIFACT $TARGET_PATH --flat=true + echo "[DEBUG] - Downloading $ARTIFACT from TESTING." + jf rt download $ARTIFACT --flat + done + for ARTIFACT_DL in $(dir|grep -E "*.rpm"); do + echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH." + jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --flat done + rm -f *.rpm done shell: bash @@ -86,7 +99,15 @@ runs: echo "[DEBUG] - Promoting DEB testing artifacts to stable." for ARTIFACT in ${SRC_PATHS[@]}; do - echo "[DEBUG] - Promoting $ARTIFACT to stable." - jf rt cp $ARTIFACT $TARGET_PATH --flat=true + echo "[DEBUG] - Downloading $ARTIFACT from TESTING." + jf rt download $ARTIFACT --flat done + + for ARTIFACT_DL in $(dir|grep -E "*.deb"); do + ARCH=$(echo $ARTIFACT_DL | cut -d '_' -f3 | cut -d '.' -f1) + echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH." + jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" + done + + rm -f *.deb shell: bash diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index b6b0d85885a..bf3891050d4 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -56,4 +56,4 @@ runs: --header 'Content-Type: application/json' \ --data ''$VERSION_DATA'' - shell: bash \ No newline at end of file + shell: bash diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..3db635e65a3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: weekly + open-pull-requests-limit: 10 + labels: + - 'dependencies' + - 'gha' diff --git a/.github/docker/Dockerfile.centreon-collect-alma8 b/.github/docker/Dockerfile.centreon-collect-alma8 index 9406c331f0f..5e09d3a516b 100644 --- a/.github/docker/Dockerfile.centreon-collect-alma8 +++ b/.github/docker/Dockerfile.centreon-collect-alma8 @@ -36,7 +36,6 @@ dnf install -y cmake \ MariaDB-server \ gnutls-devel \ libgcrypt-devel \ - libssh2-devel \ lua-devel \ make \ perl-ExtUtils-Embed.noarch \ @@ -56,7 +55,7 @@ dnf install -y cmake \ dnf update libarchive -pip3 install conan==1.57.0 --prefix=/usr --upgrade +pip3 install conan==1.61.0 --prefix=/usr --upgrade rm -rf ~/.conan/profiles/default EOF @@ -66,7 +65,7 @@ COPY conanfile.txt . RUN <> /etc/yum.conf +echo 'assumeyes=1' >> /etc/yum.conf +sed -i 's/best=True/best=False/g' /etc/dnf/dnf.conf +dnf install -y dnf-plugins-core +dnf config-manager --set-enabled crb + +dnf install -y epel-release + +dnf --best install -y \ + gcc \ + gcc-c++ \ + gdb \ + git \ + openssh-server \ + mariadb-server \ + mariadb \ + gnutls \ + libgcrypt \ + lua \ + perl-ExtUtils-Embed \ + python3 \ + python3-devel \ + python3-pip \ + perl-Thread-Queue \ + rrdtool \ + perl \ + procps-ng \ + zstd \ + psmisc \ + sudo + +echo "install robot and dependencies" + +pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil +pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 + +cd /tmp/collect + +.github/scripts/collect-prepare-test-robot.sh mariadb + +/bin/rm -rf /tmp/collect + +EOF + diff --git a/.github/docker/Dockerfile.centreon-collect-debian-bullseye b/.github/docker/Dockerfile.centreon-collect-debian-bullseye index 248a07dcfda..1ae20485815 100644 --- a/.github/docker/Dockerfile.centreon-collect-debian-bullseye +++ b/.github/docker/Dockerfile.centreon-collect-debian-bullseye @@ -49,7 +49,7 @@ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3 get-pip.py -pip3 install conan==1.57.0 +pip3 install conan==1.61.0 ln -s /usr/local/bin/conan /usr/bin/conan rm -rf ~/.conan/profiles/default @@ -60,7 +60,7 @@ COPY conanfile.txt . RUN <> /etc/yum.conf +echo 'assumeyes=1' >> /etc/yum.conf +sed -i 's/best=True/best=False/g' /etc/dnf/dnf.conf +dnf install -y dnf-plugins-core +dnf config-manager --set-enabled crb + +dnf install -y epel-release + +dnf --best install -y gcc \ + gcc-c++ \ + gdb \ + git \ + openssh-server \ + mysql-server \ + mysql \ + gnutls \ + libgcrypt \ + lua \ + perl-ExtUtils-Embed \ + python3 \ + python3-devel \ + python3-pip \ + perl-Thread-Queue \ + rrdtool \ + perl \ + procps-ng \ + zstd \ + psmisc \ + sudo \ + iproute + +echo "install robot and dependencies" + +pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil +pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 + +cd /tmp/collect + +.github/scripts/collect-prepare-test-robot.sh mysql + +/bin/rm -rf /tmp/collect + +EOF diff --git a/.github/scripts/collect-prepare-test-robot.sh b/.github/scripts/collect-prepare-test-robot.sh new file mode 100755 index 00000000000..e0eb711bfb3 --- /dev/null +++ b/.github/scripts/collect-prepare-test-robot.sh @@ -0,0 +1,95 @@ +#!/bin/bash +set -e +set -x + + +database_type=$1 + +. /etc/os-release +distrib=${ID} +distrib=$(echo $distrib | tr '[:lower:]' '[:upper:]') + + +echo "########################### Configure sshd ###########################" +ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" << /dev/null 2>&1 & + else + mkdir -p /run/mysqld + chown mysql:mysql /run/mysqld + mariadbd --socket=/run/mysqld/mysqld.sock --user=root > /dev/null 2>&1 & + fi + sleep 5 + + echo "########################### Init centreon database ############################" + + mysql -e "CREATE USER IF NOT EXISTS 'centreon'@'localhost' IDENTIFIED BY 'centreon';" + mysql -e "CREATE USER IF NOT EXISTS 'root_centreon'@'localhost' IDENTIFIED BY 'centreon';" +fi + +mysql -e "GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,DROP,INDEX,ALTER,LOCK TABLES,CREATE TEMPORARY TABLES, EVENT,CREATE VIEW ON *.* TO 'centreon'@'localhost';" +mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'root_centreon'@'localhost'" + +cat resources/centreon.sql | sed "s/DBNameConf/centreon/g" > /tmp/centreon.sql + +mysql -u root_centreon -pcentreon < resources/centreon_storage.sql +mysql -u root_centreon -pcentreon < /tmp/centreon.sql + +cd tests + +if [ "$distrib" = "ALMALINUX" ]; then + dnf groupinstall -y "Development Tools" + dnf install -y python3-devel +else + apt-get update + apt-get install -y build-essential + apt-get install -y python3-dev +fi + + +echo "########################## Install centreon collect ###########################" +cd .. +echo "Installation..." +if [ "$distrib" = "ALMALINUX" ]; then + dnf clean all + rm -f ./*-selinux-*.rpm # avoid to install selinux packages which are dependent to centreon-common-selinux + dnf install -y ./*.rpm +else + apt-get update +# apt-get install -y ./*.deb +fi + + +if [ $database_type == 'mysql' ]; then + killall -w mysqldtoto +else + killall -w mariadbd +fi + +cd .. + +\rm -rf * + diff --git a/.github/scripts/collect-test-robot.sh b/.github/scripts/collect-test-robot.sh index da38d9aa372..fae6945272a 100755 --- a/.github/scripts/collect-test-robot.sh +++ b/.github/scripts/collect-test-robot.sh @@ -6,6 +6,8 @@ export RUN_ENV=docker test_file=$1 database_type=$2 +#this env variable is a json that contains some test params +export TESTS_PARAMS='$3' . /etc/os-release distrib=${ID} @@ -24,75 +26,25 @@ if [ ${database_type} == 'mysql' ] && [ ! -f tests/${test_file}.mysql ]; then exit 0 fi -echo "########################### Configure and start sshd ###########################" -ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" << /dev/null 2>&1 & else - mkdir -p /run/mysqld - chown mysql:mysql /run/mysqld mariadbd --socket=/run/mysqld/mysqld.sock --user=root > /dev/null 2>&1 & fi sleep 5 - echo "########################### Init centreon database ############################" - - mysql -e "CREATE USER IF NOT EXISTS 'centreon'@'localhost' IDENTIFIED BY 'centreon';" - mysql -e "CREATE USER IF NOT EXISTS 'root_centreon'@'localhost' IDENTIFIED BY 'centreon';" -fi - -mysql -e "GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,DROP,INDEX,ALTER,LOCK TABLES,CREATE TEMPORARY TABLES, EVENT,CREATE VIEW ON *.* TO 'centreon'@'localhost';" -mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'root_centreon'@'localhost'" - -cat resources/centreon.sql | sed "s/DBNameConf/centreon/g" > /tmp/centreon.sql - -mysql -u root_centreon -pcentreon < resources/centreon_storage.sql -mysql -u root_centreon -pcentreon < /tmp/centreon.sql - -#remove git dubious ownership -git config --global --add safe.directory $PWD - -echo "########################### Install Robot Framework ###########################" -cd tests -pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil - -if [ "$distrib" = "ALMALINUX" ]; then - dnf groupinstall -y "Development Tools" - dnf install -y python3-devel -else - apt-get update - apt-get install -y build-essential - apt-get install -y python3-dev fi -pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 echo "########################## Install centreon collect ###########################" -cd .. echo "Installation..." if [ "$distrib" = "ALMALINUX" ]; then dnf clean all @@ -103,9 +55,13 @@ else apt-get install -y ./*.deb fi + ulimit -c unlimited echo '/tmp/core.%p' > /proc/sys/kernel/core_pattern +#remove git dubious ownership +/usr/bin/git config --global --add safe.directory $PWD + echo "##### Starting tests #####" cd tests ./init-proto.sh diff --git a/.github/scripts/collect-unit-tests.sh b/.github/scripts/collect-unit-tests.sh index 79787f82d94..6ccf25a4b2c 100755 --- a/.github/scripts/collect-unit-tests.sh +++ b/.github/scripts/collect-unit-tests.sh @@ -6,11 +6,11 @@ rm -rf /src/build mkdir /src/build cd /src/build/ -conan install .. -s compiler.cppstd=14 -s compiler.libcxx=libstdc++11 --build=missing +conan install .. -s compiler.cppstd=17 -s compiler.libcxx=libstdc++11 --build=missing if [ $(cat /etc/issue | awk '{print $1}') = "Debian" ] ; then - CXXFLAGS="-Wall -Wextra" cmake -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DWITH_CENTREON_CLIB_INCLUDE_DIR=../clib/inc/ -DWITH_CENTREON_CLIB_LIBRARIES=centreon-clib/libcentreon_clib.so -DCMAKE_BUILD_TYPE=Debug -DWITH_PREFIX=/usr -DWITH_PREFIX_BIN=/usr/sbin -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker -DWITH_PREFIX_CONF_BROKER=/etc/centreon-broker -DWITH_PREFIX_LIB_BROKER=/usr/lib64/nagios -DWITH_PREFIX_CONF_ENGINE=/etc/centreon-engine -DWITH_PREFIX_LIB_ENGINE=/usr/lib64/centreon-engine -DWITH_PREFIX_LIB_CLIB=/usr/lib64/ -DWITH_RW_DIR=/var/lib/centreon-engine/rw -DWITH_VAR_DIR=/var/log/centreon-engine -DWITH_MODULE_SIMU=On .. + CXXFLAGS="-Wall -Wextra" cmake -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DWITH_CENTREON_CLIB_INCLUDE_DIR=../clib/inc/ -DWITH_CENTREON_CLIB_LIBRARIES=centreon-clib/libcentreon_clib.so -DCMAKE_BUILD_TYPE=Debug -DWITH_PREFIX=/usr -DWITH_PREFIX_BIN=/usr/sbin -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker -DWITH_PREFIX_CONF_BROKER=/etc/centreon-broker -DWITH_PREFIX_LIB_BROKER=/usr/lib64/nagios -DWITH_PREFIX_CONF_ENGINE=/etc/centreon-engine -DWITH_PREFIX_LIB_ENGINE=/usr/lib64/centreon-engine -DWITH_PREFIX_LIB_CLIB=/usr/lib64/ -DWITH_RW_DIR=/var/lib/centreon-engine/rw -DWITH_VAR_DIR=/var/log/centreon-engine -DWITH_MODULE_SIMU=On -DNG=On .. else - CXXFLAGS="-Wall -Wextra" cmake3 -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DWITH_CENTREON_CLIB_INCLUDE_DIR=../clib/inc/ -DWITH_CENTREON_CLIB_LIBRARIES=centreon-clib/libcentreon_clib.so -DCMAKE_BUILD_TYPE=Debug -DWITH_PREFIX=/usr -DWITH_PREFIX_BIN=/usr/sbin -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker -DWITH_PREFIX_CONF_BROKER=/etc/centreon-broker -DWITH_PREFIX_LIB_BROKER=/usr/lib64/nagios -DWITH_PREFIX_CONF_ENGINE=/etc/centreon-engine -DWITH_PREFIX_LIB_ENGINE=/usr/lib64/centreon-engine -DWITH_PREFIX_LIB_CLIB=/usr/lib64/ -DWITH_RW_DIR=/var/lib/centreon-engine/rw -DWITH_VAR_DIR=/var/log/centreon-engine -DWITH_MODULE_SIMU=On .. + CXXFLAGS="-Wall -Wextra" cmake3 -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DWITH_CENTREON_CLIB_INCLUDE_DIR=../clib/inc/ -DWITH_CENTREON_CLIB_LIBRARIES=centreon-clib/libcentreon_clib.so -DCMAKE_BUILD_TYPE=Debug -DWITH_PREFIX=/usr -DWITH_PREFIX_BIN=/usr/sbin -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker -DWITH_PREFIX_CONF_BROKER=/etc/centreon-broker -DWITH_PREFIX_LIB_BROKER=/usr/lib64/nagios -DWITH_PREFIX_CONF_ENGINE=/etc/centreon-engine -DWITH_PREFIX_LIB_ENGINE=/usr/lib64/centreon-engine -DWITH_PREFIX_LIB_CLIB=/usr/lib64/ -DWITH_RW_DIR=/var/lib/centreon-engine/rw -DWITH_VAR_DIR=/var/log/centreon-engine -DWITH_MODULE_SIMU=On -DNG=On .. fi #Build diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 42a391e17a2..e9b57c04346 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Download actionlint id: get_actionlint @@ -38,3 +38,40 @@ jobs: -pyflakes= \ -color shell: bash + yaml-lint: + runs-on: ubuntu-22.04 + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install Yaml + run: | + pip install yamllint==1.32.0 + + - name: Add Yaml Lint Rules + run: | + cat <>./yamllint_rules.yml + extends: default + + rules: + document-start: disable + line-length: disable + truthy: + check-keys: false + level: error + indentation: + spaces: 2 + indent-sequences: true + check-multi-line-strings: false + comments: + ignore-shebangs: true + min-spaces-from-content: 1 + comments-indentation: disable + new-lines: + type: unix + new-line-at-end-of-file: enable + EOF + + - name: Lint YAML files + run: | + yamllint -c ./yamllint_rules.yml ./.github/actions/ ./.github/workflows/ diff --git a/.github/workflows/centreon-collect.yml b/.github/workflows/centreon-collect.yml index d1496855a0b..b339f222923 100644 --- a/.github/workflows/centreon-collect.yml +++ b/.github/workflows/centreon-collect.yml @@ -46,22 +46,6 @@ jobs: get-version: uses: ./.github/workflows/get-version.yml - veracode-analysis: - needs: [get-version] - uses: ./.github/workflows/veracode-analysis.yml - with: - module_name: centreon-collect - major_version: ${{ needs.get-version.outputs.version }} - minor_version: ${{ needs.get-version.outputs.patch }} - stability: ${{ needs.get-version.outputs.stability }} - img_version: ${{ needs.get-version.outputs.img_version }} - secrets: - veracode_api_id: ${{ secrets.VERACODE_API_ID_COLL }} - veracode_api_key: ${{ secrets.VERACODE_API_KEY_COLL }} - veracode_srcclr_token: ${{ secrets.VERACODE_SRCCLR_TOKEN }} - docker_registry_id: ${{ secrets.DOCKER_REGISTRY_ID }} - docker_registry_passwd: ${{ secrets.DOCKER_REGISTRY_PASSWD }} - unit-test: needs: [get-version] if: ${{ ! contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }} @@ -75,10 +59,10 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Login to Registry - uses: docker/login-action@v2 + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 with: registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} username: ${{ secrets.DOCKER_REGISTRY_ID }} @@ -106,11 +90,11 @@ jobs: deliver-sources: runs-on: [self-hosted, common] needs: [get-version, package] - if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }} + if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' }} steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: path: centreon-collect @@ -141,7 +125,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Publish RPM packages uses: ./.github/actions/delivery @@ -170,7 +154,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Publish DEB packages uses: ./.github/actions/delivery @@ -184,7 +168,7 @@ jobs: promote: needs: [get-version] - if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) }} + if: ${{ contains(fromJson('["stable"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' }} runs-on: [self-hosted, common] strategy: matrix: @@ -192,7 +176,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Promote ${{ matrix.distrib }} to stable uses: ./.github/actions/promote-to-stable diff --git a/.github/workflows/docker-builder.yml b/.github/workflows/docker-builder.yml index f23175eabb4..7fa2db996a0 100644 --- a/.github/workflows/docker-builder.yml +++ b/.github/workflows/docker-builder.yml @@ -30,18 +30,39 @@ jobs: - runner: collect dockerfile: centreon-collect-alma8 image: centreon-collect-alma8 + tag: ${{ needs.get-version.outputs.img_version }} - runner: collect dockerfile: centreon-collect-alma9 image: centreon-collect-alma9 + tag: ${{ needs.get-version.outputs.img_version }} + - runner: collect + dockerfile: centreon-collect-alma9-test + image: centreon-collect-alma9-test + tag: ${{ needs.get-version.outputs.test_img_version }} - runner: collect dockerfile: centreon-collect-mysql-alma9 image: centreon-collect-mysql-alma9 + tag: ${{ needs.get-version.outputs.img_version }} + - runner: collect + dockerfile: centreon-collect-mysql-alma9-test + image: centreon-collect-mysql-alma9-test + tag: ${{ needs.get-version.outputs.test_img_version }} - runner: collect dockerfile: centreon-collect-debian-bullseye image: centreon-collect-debian-bullseye + tag: ${{ needs.get-version.outputs.img_version }} + - runner: collect + dockerfile: centreon-collect-debian-bullseye-test + image: centreon-collect-debian-bullseye-test + tag: ${{ needs.get-version.outputs.test_img_version }} - runner: collect-arm64 dockerfile: centreon-collect-debian-bullseye image: centreon-collect-debian-bullseye-arm64 + tag: ${{ needs.get-version.outputs.img_version }} + - runner: collect-arm64 + dockerfile: centreon-collect-debian-bullseye-test + image: centreon-collect-debian-bullseye-arm64-test + tag: ${{ needs.get-version.outputs.test_img_version }} runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.runner)) }} @@ -49,25 +70,26 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Login to Registry - uses: docker/login-action@v2 + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 with: registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} username: ${{ secrets.DOCKER_REGISTRY_ID }} password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} - name: Login to Proxy Registry - uses: docker/login-action@v2 + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 with: registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }} username: ${{ secrets.DOCKER_REGISTRY_ID }} password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} - - uses: docker/setup-buildx-action@v2 + - uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0 - - uses: docker/build-push-action@v3 + - name: Build image ${{ matrix.image }}:${{ matrix.tag }} + uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1 with: file: .github/docker/Dockerfile.${{ matrix.dockerfile }} context: . @@ -75,4 +97,4 @@ jobs: platforms: ${{ contains(matrix.runner, 'arm') && 'linux/arm64' || 'linux/amd64' }} pull: true push: true - tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:${{ needs.get-version.outputs.img_version }} + tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:${{ matrix.tag }} diff --git a/.github/workflows/get-version.yml b/.github/workflows/get-version.yml index add097da665..117ade3c9fb 100644 --- a/.github/workflows/get-version.yml +++ b/.github/workflows/get-version.yml @@ -4,6 +4,9 @@ on: img_version: description: "docker image version (conan checksum)" value: ${{ jobs.get-version.outputs.img_version }} + test_img_version: + description: "test docker image version (checksum of database sql, script and dockerfiles)" + value: ${{ jobs.get-version.outputs.test_img_version }} version: description: "major version" value: ${{ jobs.get-version.outputs.version }} @@ -25,6 +28,7 @@ jobs: runs-on: ubuntu-22.04 outputs: img_version: ${{ steps.get_version.outputs.img_version }} + test_img_version: ${{ steps.get_version.outputs.test_img_version }} version: ${{ steps.get_version.outputs.version }} patch: ${{ steps.get_version.outputs.patch }} release: ${{ steps.get_version.outputs.release }} @@ -32,14 +36,31 @@ jobs: environment: ${{ steps.get_version.outputs.env }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: install gh cli on self-hosted runner + run: | + if ! command -v gh &> /dev/null; then + echo "Installing GH CLI." + type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg + sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + sudo apt update + sudo apt install gh -y + else + echo "GH CLI is already installed." + fi + shell: bash - id: get_version run: | - IMG_VERSION=$(md5sum conanfile.txt | awk '{print substr($1, 0, 8)}') + IMG_VERSION=$( cat `ls .github/docker/Dockerfile.centreon-collect-* | grep -v test` conanfile.txt | md5sum | awk '{print substr($1, 0, 8)}') + TEST_IMG_VERSION=$(cat .github/docker/Dockerfile.centreon-collect-*-test .github/scripts/collect-prepare-test-robot.sh resources/*.sql | md5sum | cut -c1-8) VERSION=$(awk '$1 ~ "COLLECT_MAJOR" {maj=substr($2, 1, length($2)-1)} $1 ~ "COLLECT_MINOR" {min=substr($2, 1, length($2)-1) ; print maj "." min}' CMakeLists.txt) PATCH=$(awk '$1 ~ "COLLECT_PATCH" {print substr($2, 1, length($2) - 1)}' CMakeLists.txt) echo "img_version=$IMG_VERSION" >> $GITHUB_OUTPUT + echo "test_img_version=$TEST_IMG_VERSION" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT echo "patch=$PATCH" >> $GITHUB_OUTPUT @@ -50,9 +71,22 @@ jobs: fi case "$BRANCHNAME" in - master | [2-9][0-9].[0-9][0-9].x | release* | hotfix*) + master | [2-9][0-9].[0-9][0-9].x) echo "release=1" >> $GITHUB_OUTPUT ;; + release* | hotfix*) + # Handle workflow_dispatch run triggers + GITHUB_RELEASE_BRANCH_BASE_REF_NAME="$(gh pr view $BRANCHNAME -q .baseRefName --json headRefName,baseRefName,state)" + echo "GITHUB_RELEASE_BRANCH_BASE_REF_NAME is: $GITHUB_RELEASE_BRANCH_BASE_REF_NAME" + GITHUB_RELEASE_BRANCH_PR_STATE="$(gh pr view $BRANCHNAME -q .state --json headRefName,baseRefName,state)" + echo "GITHUB_RELEASE_BRANCH_PR_STATE is: $GITHUB_RELEASE_BRANCH_PR_STATE" + if [[ "$GITHUB_RELEASE_BRANCH_BASE_REF_NAME" == "master" ]] && [[ "$GITHUB_RELEASE_BRANCH_PR_STATE" == "OPEN" ]]; then + # This case is specific to cloud release + echo "release=`date +%s`.`echo ${{ github.sha }} | cut -c -7`" >> $GITHUB_OUTPUT + else + echo "release=1" >> $GITHUB_OUTPUT + fi + ;; *) echo "release=`date +%s`.`echo ${{ github.sha }} | cut -c -7`" >> $GITHUB_OUTPUT ;; @@ -79,3 +113,5 @@ jobs: echo "env=$VERSION-$ENV" >> $GITHUB_OUTPUT echo "GH_ENV: $VERSION-$ENV" shell: bash + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/package-collect.yml b/.github/workflows/package-collect.yml index 9a7d3eb8a24..c3b7a82f152 100644 --- a/.github/workflows/package-collect.yml +++ b/.github/workflows/package-collect.yml @@ -18,7 +18,6 @@ on: jobs: package: - strategy: fail-fast: false matrix: @@ -46,6 +45,13 @@ jobs: runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.runner)) }} + env: + SCCACHE_PATH: "/usr/bin/sccache" + SCCACHE_BUCKET: "centreon-github-sccache" + SCCACHE_REGION: "eu-west-1" + AWS_ACCESS_KEY_ID: ${{ secrets.COLLECT_S3_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.COLLECT_S3_SECRET_KEY }} + container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:${{ inputs.img_version }} credentials: @@ -56,7 +62,26 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install sccache + run: | + if [ "${{ matrix.package_extension }}" = "deb" ]; then + apt-get update + apt-get install -y wget + elif [ "${{ matrix.package_extension }}" = "rpm" ]; then + dnf install -y wget + fi + if [ "${{ matrix.arch }}" = "amd64" ]; then + wget https://github.com/mozilla/sccache/releases/download/v0.7.4/sccache-v0.7.4-x86_64-unknown-linux-musl.tar.gz + tar xzf sccache-v0.7.4-x86_64-unknown-linux-musl.tar.gz + mv sccache-v0.7.4-x86_64-unknown-linux-musl/sccache /usr/bin/ + elif [ "${{ matrix.arch }}" = "arm64" ]; then + wget https://github.com/mozilla/sccache/releases/download/v0.7.4/sccache-v0.7.4-aarch64-unknown-linux-musl.tar.gz + tar xzf sccache-v0.7.4-aarch64-unknown-linux-musl.tar.gz + mv sccache-v0.7.4-aarch64-unknown-linux-musl/sccache /usr/bin/ + fi + ${SCCACHE_PATH} --start-server - name: Generate selinux binaries if: ${{ matrix.package_extension == 'rpm' }} @@ -77,9 +102,9 @@ jobs: - name: Compile sources run: | - sudo pip3 install conan==1.57.0 --prefix=/usr --upgrade + sudo pip3 install conan==1.61.0 --prefix=/usr --upgrade - sudo conan install . -s compiler.cppstd=14 -s compiler.libcxx=libstdc++11 --build=missing + sudo conan install . -s compiler.cppstd=17 -s compiler.libcxx=libstdc++11 --build=missing CMAKE="cmake3" if [ "${{ matrix.package_extension }}" = "deb" ]; then @@ -104,11 +129,22 @@ jobs: -DWITH_CREATE_FILES=OFF \ -DWITH_CONFIG_FILES=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DNG=ON \ + -DCMAKE_C_COMPILER_LAUNCHER=${SCCACHE_PATH} \ + -DCMAKE_CXX_COMPILER_LAUNCHER=${SCCACHE_PATH} \ . sudo ninja shell: bash + - name: Cache statistics + run: ${SCCACHE_PATH} --show-stats + shell: bash + + - name: Stop sccache server + run: ${SCCACHE_PATH} --stop-server + shell: bash + - name: Generate debug files run: | for file in $(find ./{lib/*.so,bin} -type f); do @@ -139,7 +175,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension}} diff --git a/.github/workflows/rebase-master.yml b/.github/workflows/rebase-master.yml index 44caf04f357..c2241297a0e 100644 --- a/.github/workflows/rebase-master.yml +++ b/.github/workflows/rebase-master.yml @@ -16,7 +16,7 @@ jobs: if: github.event.pull_request.merged == true steps: - name: git checkout - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 token: ${{ secrets.CENTREON_TECHNIQUE_PAT }} diff --git a/.github/workflows/rebase-version.yml b/.github/workflows/rebase-version.yml index 164dc622163..4be9a45361f 100644 --- a/.github/workflows/rebase-version.yml +++ b/.github/workflows/rebase-version.yml @@ -16,7 +16,7 @@ jobs: if: github.event.pull_request.merged == true steps: - name: git checkout - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 token: ${{ secrets.CENTREON_TECHNIQUE_PAT }} diff --git a/.github/workflows/release-collect.yml b/.github/workflows/release-collect.yml index b49a2afc231..f91fab7a47f 100644 --- a/.github/workflows/release-collect.yml +++ b/.github/workflows/release-collect.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 diff --git a/.github/workflows/robot-nightly.yml b/.github/workflows/robot-nightly.yml index 02353da2f79..0816720af8d 100644 --- a/.github/workflows/robot-nightly.yml +++ b/.github/workflows/robot-nightly.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - run: | gh workflow run robot-nightly.yml -r "dev-23.10.x" @@ -30,6 +30,21 @@ jobs: get-version: uses: ./.github/workflows/get-version.yml + veracode-analysis: + needs: [get-version] + uses: ./.github/workflows/veracode-analysis.yml + with: + module_name: centreon-collect + major_version: ${{ needs.get-version.outputs.version }} + minor_version: ${{ needs.get-version.outputs.patch }} + img_version: ${{ needs.get-version.outputs.img_version }} + secrets: + veracode_api_id: ${{ secrets.VERACODE_API_ID_COLL }} + veracode_api_key: ${{ secrets.VERACODE_API_KEY_COLL }} + veracode_srcclr_token: ${{ secrets.VERACODE_SRCCLR_TOKEN }} + docker_registry_id: ${{ secrets.DOCKER_REGISTRY_ID }} + docker_registry_passwd: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + package: needs: [get-version] uses: ./.github/workflows/package-collect.yml @@ -42,42 +57,60 @@ jobs: robot-test: needs: [get-version, package] + strategy: fail-fast: false matrix: include: - distrib: el9 - image: centreon-collect-alma9 + image: centreon-collect-alma9-test package_extension: rpm arch: amd64 database_type: mariadb + test_group_name: robot_test-mariadb-el9-amd64 + tests_params: '{}' - distrib: el9 - image: centreon-collect-mysql-alma9 + image: centreon-collect-mysql-alma9-test package_extension: rpm arch: amd64 database_type: mysql + test_group_name: robot_test-mysql-el9-amd64 + tests_params: '{}' - distrib: bullseye - image: centreon-collect-debian-bullseye-arm64 + image: centreon-collect-debian-bullseye-arm64-test package_extension: deb arch: arm64 database_type: mariadb - name: robot test ${{ matrix.database_type }} ${{ matrix.distrib }} ${{ matrix.arch }} + test_group_name: robot_test-mariadb-el9-arm64 + tests_params: '{}' + - distrib: el9 + image: centreon-collect-alma9-test + package_extension: rpm + arch: amd64 + database_type: mariadb + test_group_name: robot_test-mariadb-el9-amd64-grpc + tests_params: '{"default_transport":"grpc","default_bbdo_version":"3.1.0"}' + + name: ${{ matrix.test_group_name }} uses: ./.github/workflows/robot-test.yml with: distrib: ${{ matrix.distrib }} arch: ${{ matrix.arch }} image: ${{ matrix.image }} + image_test: ${{ matrix.image }}:${{ needs.get-version.outputs.test_img_version }} image_version: ${{ needs.get-version.outputs.img_version }} package_cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-centreon-collect-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }} package_cache_path: ./*.${{ matrix.package_extension}} database_type: ${{ matrix.database_type }} + tests_params: ${{matrix.tests_params}} + test_group_name: ${{matrix.test_group_name}} secrets: registry_username: ${{ secrets.DOCKER_REGISTRY_ID }} registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} collect_s3_access_key: ${{ secrets.COLLECT_S3_ACCESS_KEY }} collect_s3_secret_key: ${{ secrets.COLLECT_S3_SECRET_KEY }} - + deliver-rpm: if: ${{ contains(fromJson('["unstable"]'), needs.get-version.outputs.stability) }} needs: [robot-test, get-version] @@ -89,7 +122,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Publish RPM packages uses: ./.github/actions/delivery @@ -116,7 +149,7 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Publish DEB packages uses: ./.github/actions/delivery diff --git a/.github/workflows/robot-test.yml b/.github/workflows/robot-test.yml index 3f87f26baa5..27d5bebf90a 100644 --- a/.github/workflows/robot-test.yml +++ b/.github/workflows/robot-test.yml @@ -10,6 +10,9 @@ on: image: required: true type: string + image_test: + required: true + type: string image_version: required: true type: string @@ -22,6 +25,12 @@ on: database_type: required: true type: string + tests_params: + required: true + type: string + test_group_name: + required: true + type: string secrets: registry_username: required: true @@ -34,14 +43,51 @@ on: jobs: + test-image-to-cache: + runs-on: ${{ contains(inputs.image, 'arm') && fromJson('["self-hosted", "collect-arm64"]') || 'ubuntu-22.04' }} + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Login to Registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} + username: ${{ secrets.registry_username }} + password: ${{ secrets.registry_password }} + + - name: Login to Proxy Registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }} + username: ${{ secrets.registry_username }} + password: ${{ secrets.registry_password }} + + - name: load image + run: | + docker pull ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image_test}} + shell: bash + + - name: image to disk + run: | + docker save -o /tmp/${{inputs.image}} ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image_test}} + shell: bash + + - name: image to cache + uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 + with: + path: /tmp/${{inputs.image}} + key: ${{inputs.image_test}} + robot-test-list: + needs: [test-image-to-cache] runs-on: ubuntu-22.04 outputs: features: ${{ steps.list-features.outputs.features }} steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: List features id: list-features @@ -52,57 +98,70 @@ jobs: robot-test: needs: [robot-test-list] runs-on: ${{ contains(inputs.image, 'arm') && fromJson('["self-hosted", "collect-arm64"]') || 'ubuntu-22.04' }} - container: - image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}}:${{ inputs.image_version }} - options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined - credentials: - username: ${{ secrets.registry_username }} - password: ${{ secrets.registry_password }} strategy: fail-fast: false matrix: feature: ${{ fromJson(needs.robot-test-list.outputs.features) }} - name: ${{ matrix.feature }} ${{inputs.database_type}} + name: ${{ matrix.feature }} ${{inputs.test_group_name}} steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 + - name: Restore image + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 + with: + path: /tmp/${{inputs.image}} + key: ${{inputs.image_test}} + fail-on-cache-miss: true + - name: Restore packages - uses: actions/cache@v3 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: path: ${{ inputs.package_cache_path }} key: ${{ inputs.package_cache_key }} fail-on-cache-miss: true + - name: load image + run: | + docker load --input /tmp/${{ inputs.image }} + - name: Test ${{ matrix.feature }} - run: bash ./.github/scripts/collect-test-robot.sh ${{ matrix.feature }} ${{inputs.database_type}} - shell: bash + run: | + docker run --rm --privileged --ulimit core=-1 --security-opt seccomp=unconfined \ + -v $(pwd):/test_collect \ + --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ + --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ + --env AWS_BUCKET=centreon-collect-robot-report \ + --workdir /test_collect \ + ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image_test}} \ + ./.github/scripts/collect-test-robot.sh \ + ${{ matrix.feature }} ${{inputs.database_type}} ${{inputs.tests_params}} + env: AWS_ACCESS_KEY_ID: ${{ secrets.collect_s3_access_key }} AWS_SECRET_ACCESS_KEY: ${{ secrets.collect_s3_secret_key }} - AWS_BUCKET: centreon-collect-robot-report - name: Move reports if: ${{ failure() }} run: | mkdir reports - FILE_PREFIX=`echo "${{ matrix.feature }}" | sed -e "s#/#__#g"`-${{inputs.database_type}} + FILE_PREFIX=`echo "${{ matrix.feature }}" | sed -e "s#/#__#g"`-${{inputs.test_group_name}} if [ -d tests/failed ] ; then - mv tests/log.html reports/$FILE_PREFIX-log.html - mv tests/output.xml reports/$FILE_PREFIX-output.xml - mv tests/failed reports/$FILE_PREFIX-failed + cp -rp tests/failed reports/$FILE_PREFIX-failed + cp tests/log.html reports/$FILE_PREFIX-log.html + cp tests/output.xml reports/$FILE_PREFIX-output.xml fi - name: Upload Test Results if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: - name: robot-test-reports-${{inputs.database_type}}-${{ inputs.distrib }}-${{ inputs.arch }} + name: reports-${{inputs.test_group_name}} path: reports retention-days: 1 @@ -112,12 +171,12 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Download Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: - name: robot-test-reports-${{inputs.database_type}}-${{ inputs.distrib }}-${{ inputs.arch }} + name: reports-${{inputs.test_group_name}} path: reports - uses: actions/setup-python@v4 @@ -131,7 +190,7 @@ jobs: shell: bash - name: Send report to commit - uses: joonvena/robotframework-reporter-action@v2.1 + uses: joonvena/robotframework-reporter-action@413a90b26bb8a49eebc51af51f1631500ef0339d # v2.3 with: gh_access_token: ${{ secrets.GITHUB_TOKEN }} report_path: reports diff --git a/.github/workflows/veracode-analysis.yml b/.github/workflows/veracode-analysis.yml index 90b11c9c0f6..43952f3436c 100644 --- a/.github/workflows/veracode-analysis.yml +++ b/.github/workflows/veracode-analysis.yml @@ -11,9 +11,6 @@ on: minor_version: required: true type: string - stability: - required: true - type: string img_version: required: true type: string @@ -33,7 +30,6 @@ jobs: build: name: Binary preparation runs-on: [self-hosted, collect] - if: github.event_name != 'pull_request' && (inputs.stability == 'stable' || inputs.stability == 'unstable') container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/centreon-collect-alma9:${{ inputs.img_version }} credentials: @@ -41,7 +37,7 @@ jobs: password: ${{ secrets.docker_registry_passwd }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Compiling Cpp sources run: | @@ -49,12 +45,13 @@ jobs: mkdir build cd build - sudo pip3 install conan==1.57.0 --prefix=/usr --upgrade - sudo conan install .. -s compiler.cppstd=14 -s compiler.libcxx=libstdc++11 --build=missing + sudo pip3 install conan==1.61.0 --prefix=/usr --upgrade + sudo conan install .. -s compiler.cppstd=17 -s compiler.libcxx=libstdc++11 --build=missing sudo cmake \ -G "Ninja" \ -DCMAKE_CXX_FLAGS="-gdwarf-2 -g3 -O0 -fno-builtin" \ + -DDEBUG_ROBOT=OFF \ -DWITH_TESTING=OFF \ -DWITH_BENCH=OFF \ -DWITH_MODULE_SIMU=OFF \ @@ -69,14 +66,23 @@ jobs: -DWITH_DAEMONS=ON \ -DWITH_CREATE_FILES=OFF \ -DWITH_CONFIG_FILES=ON \ + -DNG=ON \ .. sudo ninja + echo "[DEBUG] - Find compiled files" + find ./ -name "*.so" + echo "[DEBUG] - Build size" + du -sh ./lib/*.so | sort -rh + - name: Binary preparation run: | echo "[INFO] - Keeping only compiled files" - find ./build -type f -not \( -name "*.so" -o -name "*.h" -o -name "*.cc" -o -name "*.hpp" \) -delete + # preserve binaries from cleaning + mv ./build/bin ./ + find ./build -type f -not \( -name "*.so" \) -delete + mv ./bin ./build echo "[INFO] - Removing veracode exclusions" if [[ -f ".veracode-exclusions" ]]; then @@ -90,18 +96,21 @@ jobs: elif [[ -z "$LINE" ]]; then echo "[INFO] - empty directive. Skipping this line" else - echo "[WARN] - target to exclude not found. Skipping: '$LINE'" + echo "::warning::Target to exclude from analysis not found. Skipping: '$LINE'" fi done else - echo "[WARN] - No '.veracode-exclusions' file found for this module. Skipping exclusion step" + echo "::warning::No '.veracode-exclusions' file found for this module. Skipping exclusion step" fi + echo "[INFO] - Keeping only build's non empty folders" + find ./build -empty -type d -delete + ls -la ./build echo "[INFO] - Generating the tarball" tar cvzf "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary.tar.gz" build - name: Cache - uses: actions/cache/save@v3 + uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: path: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary.tar.gz" key: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary" @@ -113,15 +122,13 @@ jobs: steps: - name: Promote latest scan - # Only last develop should be promoted to policy scan if: github.ref_name == 'develop' - env: VERACODE_API_ID: "${{ secrets.veracode_api_id }}" VERACODE_API_SECRET: "${{ secrets.veracode_api_key }}" # Action forked as API calls hardcoded '.com' route - uses: sc979/veracode-sandboxes-helper@v0.2 + uses: sc979/veracode-sandboxes-helper@cf67241c27cbe6405ad8705111121ece9a48c4ff # v0.2 # Promote should not fail if sandbox was not found. continue-on-error: true with: @@ -131,7 +138,7 @@ jobs: delete-on-promote: false - name: Get build binary - uses: actions/cache/restore@v3 + uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: path: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary.tar.gz" key: "${{ inputs.module_name }}-${{ github.sha }}-${{ github.run_id }}-veracode-binary" @@ -148,8 +155,6 @@ jobs: createprofile: true createsandbox: true sandboxname: "${{ github.ref_name }}" - #scantimeout: 120 includenewmodules: true scanallnonfataltoplevelmodules: true deleteincompletescan: 2 - scanpollinginterval: 120 # time between two checks in seconds / [30 to 120] diff --git a/.veracode-exclusions b/.veracode-exclusions index 49e09c0ea80..ae5b950d44e 100644 --- a/.veracode-exclusions +++ b/.veracode-exclusions @@ -35,3 +35,4 @@ engine/src/simumod/coder.pl grpc/centreon-rpc-client.py tests packaging +/root/.conan/ diff --git a/.version b/.version new file mode 100644 index 00000000000..9a1d1d75c3b --- /dev/null +++ b/.version @@ -0,0 +1,2 @@ +MAJOR=24.04 +MINOR=0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 935229c2312..273ca6aedef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,8 +123,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm") endif() # Version. -set(COLLECT_MAJOR 23) -set(COLLECT_MINOR 10) +set(COLLECT_MAJOR 24) +set(COLLECT_MINOR 04) set(COLLECT_PATCH 0) set(COLLECT_VERSION "${COLLECT_MAJOR}.${COLLECT_MINOR}.${COLLECT_PATCH}") add_definitions(-DCENTREON_CONNECTOR_VERSION=\"${COLLECT_VERSION}\") diff --git a/bbdo/CMakeLists.txt b/bbdo/CMakeLists.txt index a9a27c522a4..bd7c2a736c7 100644 --- a/bbdo/CMakeLists.txt +++ b/bbdo/CMakeLists.txt @@ -78,6 +78,19 @@ add_library(pb_extcmd_lib STATIC extcmd.pb.cc extcmd.pb.h) add_dependencies(pb_extcmd_lib target_extcmd target_header) set_target_properties(pb_extcmd_lib PROPERTIES POSITION_INDEPENDENT_CODE ON) +add_library(pb_rebuild_message_lib STATIC rebuild_message.pb.cc + rebuild_message.pb.h) +add_dependencies(pb_rebuild_message_lib target_rebuild_message target_header) +set_target_properties(pb_rebuild_message_lib + PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(pb_remove_graph_message_lib STATIC remove_graph_message.pb.cc + remove_graph_message.pb.h) +add_dependencies(pb_remove_graph_message_lib target_remove_graph_message + target_header) +set_target_properties(pb_remove_graph_message_lib + PROPERTIES POSITION_INDEPENDENT_CODE ON) + macro(get_protobuf_files name) set_source_files_properties("${CMAKE_SOURCE_DIR}/bbdo/${name}.pb.cc" PROPERTIES GENERATED TRUE) diff --git a/bbdo/bam.proto b/bbdo/bam.proto index f27498d83cd..64084f86811 100644 --- a/bbdo/bam.proto +++ b/bbdo/bam.proto @@ -29,12 +29,14 @@ enum State { UNKNOWN = 3; } +/*io::bam, bam::de_pb_inherited_downtime*/ message InheritedDowntime { BBDOHeader header = 1; uint32 ba_id = 2; bool in_downtime = 3; } +/*io::bam, bam::de_pb_ba_status*/ message BaStatus { uint32 ba_id = 2; bool in_downtime = 3; @@ -47,6 +49,7 @@ message BaStatus { string output = 10; } +/*io::bam, bam::de_pb_ba_event*/ message BaEvent { uint32 ba_id = 1; double first_level = 2; @@ -56,6 +59,7 @@ message BaEvent { State status = 6; } +/*io::bam, bam::de_pb_kpi_event*/ message KpiEvent { uint32 ba_id = 1; uint64 start_time = 2; @@ -68,17 +72,20 @@ message KpiEvent { State status = 9; } +/*io::bam, bam::de_pb_dimension_bv_event*/ message DimensionBvEvent { uint32 bv_id = 1; string bv_name = 2; string bv_description = 3; } +/*io::bam, bam::de_pb_dimension_ba_bv_relation_event*/ message DimensionBaBvRelationEvent { uint32 ba_id = 1; uint32 bv_id = 2; } +/*io::bam, bam::de_pb_dimension_timeperiod*/ message DimensionTimeperiod { uint32 id = 1; string name = 2; @@ -91,6 +98,7 @@ message DimensionTimeperiod { string sunday = 9; } +/*io::bam, bam::de_pb_dimension_ba_event*/ message DimensionBaEvent { uint32 ba_id = 1; string ba_name = 2; @@ -101,6 +109,7 @@ message DimensionBaEvent { uint32 sla_duration_warn = 7; } +/*io::bam, bam::de_pb_dimension_kpi_event*/ message DimensionKpiEvent { uint32 kpi_id = 1; uint32 ba_id = 2; @@ -120,6 +129,7 @@ message DimensionKpiEvent { double impact_unknown = 16; } +/*io::bam, bam::de_pb_kpi_status*/ message KpiStatus { uint32 kpi_id = 1; bool in_downtime = 2; @@ -136,6 +146,7 @@ message KpiStatus { bool valid = 13; } +/*io::bam, bam::de_pb_ba_duration_event*/ message BaDurationEvent { uint32 ba_id = 1; int64 real_start_time = 2; @@ -147,12 +158,14 @@ message BaDurationEvent { bool timeperiod_is_default = 8; } +/*io::bam, bam::de_pb_dimension_ba_timeperiod_relation*/ message DimensionBaTimeperiodRelation { uint32 ba_id = 1; uint32 timeperiod_id = 2; bool is_default = 3; } +/*io::bam, bam::de_pb_dimension_truncate_table_signal*/ message DimensionTruncateTableSignal { bool update_started = 1; } \ No newline at end of file diff --git a/bbdo/bam/ba_duration_event.cc b/bbdo/bam/ba_duration_event.cc index 12b909b87a7..9e4076a1f78 100644 --- a/bbdo/bam/ba_duration_event.cc +++ b/bbdo/bam/ba_duration_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/ba_duration_event.hh" diff --git a/bbdo/bam/ba_duration_event.hh b/bbdo/bam/ba_duration_event.hh index 47a4eb58823..abe26b3877e 100644 --- a/bbdo/bam/ba_duration_event.hh +++ b/bbdo/bam/ba_duration_event.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014, 2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_DURATION_EVENT_HH #define CCB_BAM_BA_DURATION_EVENT_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class ba_duration_event ba_duration_event.hh * "com/centreon/broker/bam/ba_duration_event.hh" @@ -62,8 +59,6 @@ class ba_duration_event : public io::data { private: void _internal_copy(ba_duration_event const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_BA_DURATION_EVENT_HH diff --git a/bbdo/bam/ba_event.cc b/bbdo/bam/ba_event.cc index b8f32ba5df4..6bd19805df1 100644 --- a/bbdo/bam/ba_event.cc +++ b/bbdo/bam/ba_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/ba_event.hh" diff --git a/bbdo/bam/ba_event.hh b/bbdo/bam/ba_event.hh index 735584dff58..af16073ec2f 100644 --- a/bbdo/bam/ba_event.hh +++ b/bbdo/bam/ba_event.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_EVENT_HH #define CCB_BAM_BA_EVENT_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class ba_event ba_event.hh "com/centreon/broker/bam/ba_event.hh" * @brief Ba event @@ -58,8 +55,6 @@ class ba_event : public io::data { private: void _internal_copy(ba_event const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_BA_EVENT_HH diff --git a/bbdo/bam/ba_status.cc b/bbdo/bam/ba_status.cc index 7b6d56ed1f4..d62bdddd8a7 100644 --- a/bbdo/bam/ba_status.cc +++ b/bbdo/bam/ba_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/ba_status.hh" diff --git a/bbdo/bam/ba_status.hh b/bbdo/bam/ba_status.hh index 9b429d60127..209ee02258c 100644 --- a/bbdo/bam/ba_status.hh +++ b/bbdo/bam/ba_status.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014, 2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_STATUS_HH #define CCB_BAM_BA_STATUS_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class ba_status ba_status.hh "com/centreon/broker/bam/ba_status.hh" * @brief Update status of a BA. @@ -61,8 +58,6 @@ class ba_status : public io::data { private: void _internal_copy(ba_status const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_BA_STATUS_HH diff --git a/bbdo/bam/dimension_ba_bv_relation_event.cc b/bbdo/bam/dimension_ba_bv_relation_event.cc index 48e9b7eaccc..ca96b7c87f9 100644 --- a/bbdo/bam/dimension_ba_bv_relation_event.cc +++ b/bbdo/bam/dimension_ba_bv_relation_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_ba_bv_relation_event.hh" diff --git a/bbdo/bam/dimension_ba_bv_relation_event.hh b/bbdo/bam/dimension_ba_bv_relation_event.hh index 22b8fd8b97c..1b79c87d2f1 100644 --- a/bbdo/bam/dimension_ba_bv_relation_event.hh +++ b/bbdo/bam/dimension_ba_bv_relation_event.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_DIMENSION_BA_BV_RELATION_EVENT_HH #define CCB_BAM_DIMENSION_BA_BV_RELATION_EVENT_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class dimension_ba_bv_relation_event dimension_ba_bv_relation_event.hh * "com/centreon/broker/bam/dimension_ba_bv_relation_event.hh" @@ -58,8 +55,6 @@ class dimension_ba_bv_relation_event : public io::data { private: void _internal_copy(dimension_ba_bv_relation_event const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_DIMENSION_BA_BV_RELATION_EVENT_HH diff --git a/bbdo/bam/dimension_ba_event.cc b/bbdo/bam/dimension_ba_event.cc index f6518c5d59f..bc124013379 100644 --- a/bbdo/bam/dimension_ba_event.cc +++ b/bbdo/bam/dimension_ba_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_ba_event.hh" diff --git a/bbdo/bam/dimension_ba_event.hh b/bbdo/bam/dimension_ba_event.hh index e7eaf7126a6..ac1ea83057a 100644 --- a/bbdo/bam/dimension_ba_event.hh +++ b/bbdo/bam/dimension_ba_event.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_DIMENSION_BA_EVENT_HH #define CCB_BAM_DIMENSION_BA_EVENT_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class dimension_ba_event dimension_ba_event.hh * "com/centreon/broker/bam/dimension_ba_event.hh" @@ -61,8 +58,6 @@ class dimension_ba_event : public io::data { private: void _internal_copy(dimension_ba_event const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_DIMENSION_BA_EVENT_HH diff --git a/bbdo/bam/dimension_ba_timeperiod_relation.cc b/bbdo/bam/dimension_ba_timeperiod_relation.cc index 82f19ab6dfe..1429c449227 100644 --- a/bbdo/bam/dimension_ba_timeperiod_relation.cc +++ b/bbdo/bam/dimension_ba_timeperiod_relation.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_ba_timeperiod_relation.hh" diff --git a/bbdo/bam/dimension_ba_timeperiod_relation.hh b/bbdo/bam/dimension_ba_timeperiod_relation.hh index 19279893c1c..f116a873aa5 100644 --- a/bbdo/bam/dimension_ba_timeperiod_relation.hh +++ b/bbdo/bam/dimension_ba_timeperiod_relation.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_DIMENSION_BA_TIMEPERIOD_RELATION_HH #define CCB_BAM_DIMENSION_BA_TIMEPERIOD_RELATION_HH @@ -24,11 +24,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class dimension_ba_timeperiod_relation dimension_ba_timeperiod_relation.hh * "com/centreon/broker/bam/dimension_ba_timeperiod_relation.hh" @@ -58,8 +55,6 @@ class dimension_ba_timeperiod_relation : public io::data { private: void _internal_copy(dimension_ba_timeperiod_relation const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_DIMENSION_BA_TIMEPERIOD_RELATION_HH diff --git a/bbdo/bam/dimension_bv_event.cc b/bbdo/bam/dimension_bv_event.cc index d13e2d810e2..a35c020c0a8 100644 --- a/bbdo/bam/dimension_bv_event.cc +++ b/bbdo/bam/dimension_bv_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_bv_event.hh" diff --git a/bbdo/bam/dimension_bv_event.hh b/bbdo/bam/dimension_bv_event.hh index bddd022948c..3ee958b42e9 100644 --- a/bbdo/bam/dimension_bv_event.hh +++ b/bbdo/bam/dimension_bv_event.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_DIMENSION_BV_EVENT_HH #define CCB_BAM_DIMENSION_BV_EVENT_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class dimension_bv_event dimension_bv_event.hh * "com/centreon/broker/bam/dimension_bv_event.hh" @@ -57,8 +54,6 @@ class dimension_bv_event : public io::data { private: void _internal_copy(dimension_bv_event const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_DIMENSION_BV_EVENT_HH diff --git a/bbdo/bam/dimension_kpi_event.cc b/bbdo/bam/dimension_kpi_event.cc index 7a48fa6189f..f63ba81d1ab 100644 --- a/bbdo/bam/dimension_kpi_event.cc +++ b/bbdo/bam/dimension_kpi_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015,2019-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015,2019-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_kpi_event.hh" diff --git a/bbdo/bam/dimension_kpi_event.hh b/bbdo/bam/dimension_kpi_event.hh index da054ee072f..1e3e5ced45a 100644 --- a/bbdo/bam/dimension_kpi_event.hh +++ b/bbdo/bam/dimension_kpi_event.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014,2019-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014,2019-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_DIMENSION_KPI_EVENT_HH #define CCB_BAM_DIMENSION_KPI_EVENT_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class dimension_kpi_event dimension_kpi_event.hh * "com/centreon/broker/bam/dimension_kpi_event.hh" @@ -67,8 +64,6 @@ class dimension_kpi_event : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_DIMENSION_KPI_EVENT_HH diff --git a/bbdo/bam/dimension_timeperiod.cc b/bbdo/bam/dimension_timeperiod.cc index 9efdea77897..b6177b8bc5b 100644 --- a/bbdo/bam/dimension_timeperiod.cc +++ b/bbdo/bam/dimension_timeperiod.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_timeperiod.hh" diff --git a/bbdo/bam/dimension_timeperiod.hh b/bbdo/bam/dimension_timeperiod.hh index 5d88005f08d..3febad2583c 100644 --- a/bbdo/bam/dimension_timeperiod.hh +++ b/bbdo/bam/dimension_timeperiod.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_DIMENSION_TIMEPERIOD_HH #define CCB_BAM_DIMENSION_TIMEPERIOD_HH @@ -24,11 +24,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class dimension_timeperiod dimension_timeperiod.hh * "com/centreon/broker/bam/dimension_timeperiod.hh" @@ -59,8 +56,6 @@ class dimension_timeperiod : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_DIMENSION_TIMEPERIOD_HH diff --git a/bbdo/bam/dimension_truncate_table_signal.cc b/bbdo/bam/dimension_truncate_table_signal.cc index 4f79afe6a57..6f808c20d0a 100644 --- a/bbdo/bam/dimension_truncate_table_signal.cc +++ b/bbdo/bam/dimension_truncate_table_signal.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2020 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_truncate_table_signal.hh" diff --git a/bbdo/bam/dimension_truncate_table_signal.hh b/bbdo/bam/dimension_truncate_table_signal.hh index 003504f1e90..adf2107af4c 100644 --- a/bbdo/bam/dimension_truncate_table_signal.hh +++ b/bbdo/bam/dimension_truncate_table_signal.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_DIMENSION_TRUNCATE_TABLE_SIGNAL_HH #define CCB_BAM_DIMENSION_TRUNCATE_TABLE_SIGNAL_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class dimension_truncate_table_signal dimension_truncate_table_signal.hh * "com/centreon/broker/bam/dimension_truncate_table_signal.hh" @@ -57,8 +54,6 @@ class dimension_truncate_table_signal : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_DIMENSION_TRUNCATE_TABLE_SIGNAL_HH diff --git a/bbdo/bam/inherited_downtime.cc b/bbdo/bam/inherited_downtime.cc index 3aa997c1811..d6ebdc10b39 100644 --- a/bbdo/bam/inherited_downtime.cc +++ b/bbdo/bam/inherited_downtime.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/inherited_downtime.hh" diff --git a/bbdo/bam/inherited_downtime.hh b/bbdo/bam/inherited_downtime.hh index 0b4e79fa965..45b7265fb46 100644 --- a/bbdo/bam/inherited_downtime.hh +++ b/bbdo/bam/inherited_downtime.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014, 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_INHERITED_DOWNTIME_HH #define CCB_BAM_INHERITED_DOWNTIME_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class ba_status ba_status.hh "com/centreon/broker/bam/ba_status.hh" * @brief Update status of a BA. @@ -55,8 +52,6 @@ class inherited_downtime : public io::data { private: void _internal_copy(inherited_downtime const& other); }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_INHERITED_DOWNTIME_HH diff --git a/bbdo/bam/kpi_event.cc b/bbdo/bam/kpi_event.cc index 9b61e580f1c..3dabcf0ca64 100644 --- a/bbdo/bam/kpi_event.cc +++ b/bbdo/bam/kpi_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/kpi_event.hh" diff --git a/bbdo/bam/kpi_event.hh b/bbdo/bam/kpi_event.hh index 278b477ddb2..5936e662f4f 100644 --- a/bbdo/bam/kpi_event.hh +++ b/bbdo/bam/kpi_event.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014, 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_KPI_EVENT_HH #define CCB_BAM_KPI_EVENT_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class kpi_event kpi_event.hh "com/centreon/broker/bam/kpi_event.hh" * @brief Kpi event @@ -60,8 +57,6 @@ class kpi_event : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_KPI_EVENT_HH diff --git a/bbdo/bam/kpi_status.cc b/bbdo/bam/kpi_status.cc index 3771469e1e8..e1f7c5bef83 100644 --- a/bbdo/bam/kpi_status.cc +++ b/bbdo/bam/kpi_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/kpi_status.hh" diff --git a/bbdo/bam/kpi_status.hh b/bbdo/bam/kpi_status.hh index 9a82a831388..77b2c225aa0 100644 --- a/bbdo/bam/kpi_status.hh +++ b/bbdo/bam/kpi_status.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_KPI_STATUS_HH #define CCB_BAM_KPI_STATUS_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class kpi_status kpi_status.hh "com/centreon/broker/bam/kpi_status.hh" * @brief Update status of a KPI. @@ -63,8 +60,6 @@ class kpi_status : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_KPI_STATUS_HH diff --git a/bbdo/bam/rebuild.cc b/bbdo/bam/rebuild.cc index 1ba21101857..4bc4e5693c6 100644 --- a/bbdo/bam/rebuild.cc +++ b/bbdo/bam/rebuild.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/rebuild.hh" diff --git a/bbdo/bam/rebuild.hh b/bbdo/bam/rebuild.hh index 7030d910356..b965bcf3ec7 100644 --- a/bbdo/bam/rebuild.hh +++ b/bbdo/bam/rebuild.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_REBUILD_HH #define CCB_BAM_REBUILD_HH @@ -24,11 +24,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { /** * @class rebuild rebuild.hh "com/centreon/broker/bam/rebuild.hh" * @brief ask for a rebuild. @@ -52,8 +49,6 @@ class rebuild : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_REBUILD_HH diff --git a/bbdo/bam/state.hh b/bbdo/bam/state.hh index 061d0615d7d..def67c46e81 100644 --- a/bbdo/bam/state.hh +++ b/bbdo/bam/state.hh @@ -1,30 +1,27 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2021 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_STATE_HH #define CCB_BAM_STATE_HH #include "bbdo/bam.pb.h" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace bam { +namespace com::centreon::broker::bam { enum state { state_ok = 0, state_warning = 1, @@ -35,8 +32,6 @@ enum state { constexpr std::array state_str{"OK", "WARNING", "CRITICAL", "UNKNOWN"}; -} // namespace bam - -CCB_END() +} // namespace com::centreon::broker::bam #endif // !CCB_BAM_STATE_HH diff --git a/bbdo/bbdo.proto b/bbdo/bbdo.proto index 9c676965d42..cc4aa5f6553 100644 --- a/bbdo/bbdo.proto +++ b/bbdo/bbdo.proto @@ -20,12 +20,14 @@ syntax = "proto3"; package com.centreon.broker; + message Bbdo { uint32 major = 1; uint32 minor = 2; uint32 patch = 3; } +/*io::bbdo, bbdo::de_welcome*/ message Welcome { Bbdo version = 1; string extensions = 2; @@ -33,10 +35,11 @@ message Welcome { string poller_name = 4; } - +/*io::bbdo, bbdo::de_pb_ack*/ message Ack { uint32 acknowledged_events = 1; } +/*io::bbdo, bbdo::de_pb_stop*/ message Stop { } \ No newline at end of file diff --git a/bbdo/bbdo/ack.cc b/bbdo/bbdo/ack.cc index f86ffdff5ae..06ef1ff0c9c 100644 --- a/bbdo/bbdo/ack.cc +++ b/bbdo/bbdo/ack.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bbdo/ack.hh" diff --git a/bbdo/bbdo/ack.hh b/bbdo/bbdo/ack.hh index d96fe869407..6a3427d57ea 100644 --- a/bbdo/bbdo/ack.hh +++ b/bbdo/bbdo/ack.hh @@ -25,11 +25,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace bbdo { +namespace com::centreon::broker::bbdo { /** * @class ack ack.hh "com/centreon/broker/bbdo/ack.hh" * @brief An ack event sent between two bbdo's endpoint. @@ -58,8 +55,6 @@ class ack : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bbdo - -CCB_END() +} // namespace com::centreon::broker::bbdo #endif // !CCB_BBDO_VERSION_RESPONSE_HH diff --git a/bbdo/bbdo/bbdo_version.hh b/bbdo/bbdo/bbdo_version.hh index 4b46b5ba8be..c05581c77ef 100644 --- a/bbdo/bbdo/bbdo_version.hh +++ b/bbdo/bbdo/bbdo_version.hh @@ -1,29 +1,25 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BBDO_VERSION_HH #define CCB_BBDO_VERSION_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace bbdo { +namespace com::centreon::broker::bbdo { union bbdo_version { struct { @@ -43,8 +39,6 @@ union bbdo_version { : patch(ptch), minor_v(min), major_v(maj) {} }; -} // namespace bbdo - -CCB_END() +} // namespace com::centreon::broker::bbdo #endif diff --git a/bbdo/bbdo/stop.cc b/bbdo/bbdo/stop.cc index bc270c2fc68..ca0ff2877fe 100644 --- a/bbdo/bbdo/stop.cc +++ b/bbdo/bbdo/stop.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bbdo/stop.hh" diff --git a/bbdo/bbdo/stop.hh b/bbdo/bbdo/stop.hh index ee6ea4b5af5..0074f402e6b 100644 --- a/bbdo/bbdo/stop.hh +++ b/bbdo/bbdo/stop.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BBDO_STOP_HH #define CCB_BBDO_STOP_HH @@ -25,11 +25,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace bbdo { +namespace com::centreon::broker::bbdo { /** * @class stop stop.hh "com/centreon/broker/bbdo/stop.hh" * @brief An stop event sent between two bbdo's endpoint. @@ -57,8 +54,6 @@ class stop : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bbdo - -CCB_END() +} // namespace com::centreon::broker::bbdo #endif // !CCB_BBDO_STOP_HH diff --git a/bbdo/bbdo/version_response.cc b/bbdo/bbdo/version_response.cc index c799184d716..6724fef4522 100644 --- a/bbdo/bbdo/version_response.cc +++ b/bbdo/bbdo/version_response.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bbdo/version_response.hh" diff --git a/bbdo/bbdo/version_response.hh b/bbdo/bbdo/version_response.hh index 384df3f78b9..669be85b480 100644 --- a/bbdo/bbdo/version_response.hh +++ b/bbdo/bbdo/version_response.hh @@ -26,11 +26,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace bbdo { +namespace com::centreon::broker::bbdo { /** * @class version_response version_response.hh * "com/centreon/broker/bbdo/version_response.hh" @@ -63,8 +60,6 @@ class version_response : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace bbdo - -CCB_END() +} // namespace com::centreon::broker::bbdo #endif // !CCB_BBDO_VERSION_RESPONSE_HH diff --git a/bbdo/events.hh b/bbdo/events.hh index 40690def059..feaf399629c 100644 --- a/bbdo/events.hh +++ b/bbdo/events.hh @@ -39,21 +39,21 @@ enum data_category { internal = 65535 }; constexpr uint16_t category_id(const char* name) { - if (absl::string_view("neb", 3) == name) + if (std::string_view("neb", 3) == name) return neb; - if (absl::string_view("bbdo", 4) == name) + if (std::string_view("bbdo", 4) == name) return bbdo; - if (absl::string_view("storage", 7) == name) + if (std::string_view("storage", 7) == name) return storage; - if (absl::string_view("internal", 8) == name) + if (std::string_view("internal", 8) == name) return internal; - if (absl::string_view("bam", 3) == name) + if (std::string_view("bam", 3) == name) return bam; - if (absl::string_view("extcmd", 6) == name) + if (std::string_view("extcmd", 6) == name) return extcmd; - if (absl::string_view("dumper", 6) == name) + if (std::string_view("dumper", 6) == name) return dumper; - if (absl::string_view("generator", 9) == name) + if (std::string_view("generator", 9) == name) return generator; return none; } @@ -101,7 +101,7 @@ enum data_element { de_custom_variable, de_custom_variable_status, de_downtime, - de_event_handler = 6, + de_event_handler = 6, // unused de_flapping_status = 7, // unused de_host_check = 8, de_host_dependency = 9, @@ -142,6 +142,12 @@ enum data_element { de_pb_instance = 44, de_pb_acknowledgement = 45, de_pb_responsive_instance = 46, + de_pb_host_dependency = 47, + de_pb_service_dependency = 48, + de_pb_host_group = 49, + de_pb_host_group_member = 50, + de_pb_service_group = 51, + de_pb_service_group_member = 52 }; } // namespace neb namespace storage { diff --git a/bbdo/extcmd.proto b/bbdo/extcmd.proto index efeec742e01..f0cadaf0397 100644 --- a/bbdo/extcmd.proto +++ b/bbdo/extcmd.proto @@ -36,6 +36,7 @@ message TimePoint { * from engine to dest with several timepoints (one per muxer) * */ +/*io::extcmd, extcmd::de_pb_bench*/ message Bench { uint32 id = 1; repeated TimePoint points = 2; diff --git a/bbdo/neb.proto b/bbdo/neb.proto index 65cfc597b41..2dccce236d4 100644 --- a/bbdo/neb.proto +++ b/bbdo/neb.proto @@ -41,6 +41,7 @@ enum AckType { STICKY = 2; } +/*io::neb, neb::de_pb_service*/ message Service { uint64 host_id = 1; uint64 service_id = 2; @@ -159,6 +160,7 @@ message Service { /** * @brief Message sent in BBDO 3.0.0 instead of neb::service_status */ +/*io::neb, neb::de_pb_service_status*/ message ServiceStatus { uint64 host_id = 1; uint64 service_id = 2; @@ -225,6 +227,7 @@ message ServiceStatus { * * Only used with BBDO 3.0 */ +/*io::neb, neb::de_pb_adaptive_service*/ message AdaptiveService { uint64 host_id = 1; uint64 service_id = 2; @@ -246,6 +249,7 @@ message AdaptiveService { optional string notification_period = 17; } +/*io::neb, neb::de_pb_host*/ message Host { uint64 host_id = 1; @@ -352,6 +356,7 @@ message Host { /** * @brief Message sent in BBDO 3.0.0 instead of neb::service_status */ +/*io::neb, neb::de_pb_host_status*/ message HostStatus { uint64 host_id = 1; @@ -408,6 +413,7 @@ message HostStatus { * * Only used with BBDO 3.0 */ +/*io::neb, neb::de_pb_adaptive_host*/ message AdaptiveHost { uint64 host_id = 1; @@ -428,6 +434,7 @@ message AdaptiveHost { optional string notification_period = 16; } +/*io::neb, neb::de_pb_comment*/ message Comment { BBDOHeader header = 1; @@ -470,6 +477,7 @@ message Comment { * @brief A downtime is applied on a resource when we don't want notifications * concerning bad states on this resource. */ +/*io::neb, neb::de_pb_downtime*/ message Downtime { enum DowntimeType { NOT_USED = 0; @@ -497,6 +505,7 @@ message Downtime { bool fixed = 18; } +/*io::neb, neb::de_pb_custom_variable*/ message CustomVariable { enum VarType { HOST = 0; @@ -521,7 +530,8 @@ enum CheckType { CheckPassive = 1; } -message Check { +/*io::neb, neb::de_pb_host_check*/ +message HostCheck { BBDOHeader header = 1; bool active_checks_enabled = 2; @@ -529,9 +539,21 @@ message Check { string command_line = 4; uint64 host_id = 5; uint64 next_check = 6; - uint64 service_id = 7; } +/*io::neb, neb::de_pb_service_check*/ +message ServiceCheck { + BBDOHeader header = 1; + + bool active_checks_enabled = 2; + CheckType check_type = 3; + string command_line = 4; + uint64 host_id = 5; + uint64 next_check = 6; + uint64 service_id = 7; +} + +/*io::neb, neb::de_pb_log_entry*/ message LogEntry { enum LogType { SOFT = 0; @@ -569,6 +591,7 @@ message LogEntry { int32 retry = 13; } +/*io::neb, neb::de_pb_instance_status*/ message InstanceStatus { BBDOHeader header = 1; @@ -590,6 +613,7 @@ message InstanceStatus { uint64 instance_id = 17; } +/*io::neb, neb::de_pb_instance*/ message Instance { BBDOHeader header = 1; @@ -603,6 +627,7 @@ message Instance { string version = 9; } +/*io::neb, neb::de_pb_responsive_instance*/ message ResponsiveInstance { BBDOHeader header = 1; @@ -610,6 +635,7 @@ message ResponsiveInstance { bool responsive = 3; } +/*io::neb, neb::de_pb_acknowledgement*/ message Acknowledgement { uint64 host_id = 1; uint64 service_id = 2; @@ -628,3 +654,78 @@ message Acknowledgement { bool persistent_comment = 11; uint32 state = 12; } + +/*io::neb, neb::de_pb_host_dependency*/ +message HostDependency { + BBDOHeader header = 1; + + string dependency_period= 2; + uint64 dependent_host_id = 3; + bool enabled = 4; + string execution_failure_options = 5; + uint64 host_id = 6; + bool inherits_parent = 7; + string notification_failure_options = 8; +} + + +/*io::neb, neb::de_pb_service_dependency*/ +message ServiceDependency { + BBDOHeader header = 1; + + string dependency_period= 2; + uint64 dependent_host_id = 3; + bool enabled = 4; + string execution_failure_options = 5; + uint64 host_id = 6; + bool inherits_parent = 7; + string notification_failure_options = 8; + uint64 dependent_service_id = 9; + uint64 service_id = 10; +} + +/*io::neb, neb::de_pb_host_group*/ +message HostGroup { + BBDOHeader header = 1; + + bool enabled = 2; + uint64 hostgroup_id = 3; + string name = 4; + uint64 poller_id = 5; +} + + +/*io::neb, neb::de_pb_service_group*/ +message ServiceGroup { + BBDOHeader header = 1; + + bool enabled = 2; + uint64 servicegroup_id = 3; + string name = 4; + uint64 poller_id = 5; +} + + +/*io::neb, neb::de_pb_host_group_member*/ +message HostGroupMember { + BBDOHeader header = 1; + + bool enabled = 2; + uint64 hostgroup_id = 3; + string name = 4; + uint64 host_id = 5; + uint64 poller_id = 6; +} + +/*io::neb, neb::de_pb_service_group_member*/ +message ServiceGroupMember { + BBDOHeader header = 1; + + bool enabled = 2; + uint64 servicegroup_id = 3; + string name = 4; + uint64 host_id = 5; + uint64 poller_id = 6; + uint64 service_id = 7; +} + diff --git a/bbdo/rebuild_message.proto b/bbdo/rebuild_message.proto index 72d34775606..afc1e410747 100644 --- a/bbdo/rebuild_message.proto +++ b/bbdo/rebuild_message.proto @@ -15,6 +15,7 @@ message Timeserie { uint32 rrd_retention = 4; } +/*io::storage, storage::de_rebuild_message*/ message RebuildMessage { enum State { START = 0; diff --git a/bbdo/remove_graph_message.proto b/bbdo/remove_graph_message.proto index e8de80544bd..8c35c876890 100644 --- a/bbdo/remove_graph_message.proto +++ b/bbdo/remove_graph_message.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package com.centreon.broker; +/*io::storage, storage::de_remove_graph_message*/ message RemoveGraphMessage { repeated uint64 index_ids = 1; repeated uint64 metric_ids = 2; diff --git a/bbdo/severity.proto b/bbdo/severity.proto index 3ce06ca99bb..44781d3af1c 100644 --- a/bbdo/severity.proto +++ b/bbdo/severity.proto @@ -35,6 +35,7 @@ package com.centreon.broker; * relations between resources of our poller and this severity. And only if the * severity is no more used at all, we can remove it. */ +/*io::neb, neb::de_pb_severity*/ message Severity { uint64 id = 1; enum Action { diff --git a/bbdo/storage.proto b/bbdo/storage.proto index 294070f7bf5..9c097a3a089 100644 --- a/bbdo/storage.proto +++ b/bbdo/storage.proto @@ -20,6 +20,7 @@ syntax = "proto3"; package com.centreon.broker; +/*io::storage, storage::de_pb_metric*/ message Metric { enum ValueType { GAUGE = 0; @@ -39,6 +40,7 @@ message Metric { uint64 service_id = 12; } +/*io::storage, storage::de_pb_status*/ message Status { uint64 index_id = 1; uint32 interval = 2; @@ -49,12 +51,14 @@ message Status { uint64 service_id = 7; } +/*io::storage, storage::de_pb_index_mapping*/ message IndexMapping { uint64 index_id = 1; uint64 host_id = 2; uint64 service_id = 3; } +/*io::storage, storage::de_pb_metric_mapping*/ message MetricMapping { uint64 index_id = 1; uint64 metric_id = 2; diff --git a/bbdo/storage/index_mapping.cc b/bbdo/storage/index_mapping.cc index 78c91c156be..b9ab76f9fc0 100644 --- a/bbdo/storage/index_mapping.cc +++ b/bbdo/storage/index_mapping.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2009-2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2009-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "bbdo/storage/index_mapping.hh" @@ -36,8 +36,7 @@ index_mapping::index_mapping() * @param host_id * @param service_id */ -index_mapping::index_mapping(uint64_t index_id, - uint32_t host_id, +index_mapping::index_mapping(uint64_t index_id, uint32_t host_id, uint32_t service_id) : io::data(index_mapping::static_type()), index_id{index_id}, @@ -46,20 +45,15 @@ index_mapping::index_mapping(uint64_t index_id, // Mapping. mapping::entry const index_mapping::entries[] = { - mapping::entry(&index_mapping::index_id, - "index_id", + mapping::entry(&index_mapping::index_id, "index_id", mapping::entry::invalid_on_zero), - mapping::entry(&index_mapping::host_id, - "host_id", + mapping::entry(&index_mapping::host_id, "host_id", mapping::entry::invalid_on_zero), - mapping::entry(&index_mapping::service_id, - "service_id", + mapping::entry(&index_mapping::service_id, "service_id", mapping::entry::invalid_on_zero), mapping::entry()}; // Operations. -static io::data* new_index_mapping() { - return new index_mapping; -} +static io::data* new_index_mapping() { return new index_mapping; } io::event_info::event_operations const index_mapping::operations = { &new_index_mapping, nullptr, nullptr}; diff --git a/bbdo/storage/index_mapping.hh b/bbdo/storage/index_mapping.hh index 9c5ce73fa40..553334b4fdb 100644 --- a/bbdo/storage/index_mapping.hh +++ b/bbdo/storage/index_mapping.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2015 - 2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015 - 2020 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_STORAGE_INDEX_MAPPING_HH #define CCB_STORAGE_INDEX_MAPPING_HH @@ -23,12 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker::storage { -namespace storage { /** * @class index_mapping index_mapping.hh * "com/centreon/broker/storage/index_mapping.hh" @@ -55,8 +53,6 @@ class index_mapping : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace storage - -CCB_END() +} // namespace com::centreon::broker::storage #endif // !CCB_STORAGE_INDEX_MAPPING_HH diff --git a/bbdo/storage/metric.cc b/bbdo/storage/metric.cc index 023d4bde2e2..84d9cd89d07 100644 --- a/bbdo/storage/metric.cc +++ b/bbdo/storage/metric.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013, 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013, 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/storage/metric.hh" diff --git a/bbdo/storage/metric.hh b/bbdo/storage/metric.hh index b5d6a4367aa..6a7d4ea9d07 100644 --- a/bbdo/storage/metric.hh +++ b/bbdo/storage/metric.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_STORAGE_METRIC_HH #define CCB_STORAGE_METRIC_HH @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace storage { +namespace com::centreon::broker::storage { /** * @class metric metric.hh "com/centreon/broker/storage/metric.hh" * @brief Metric information. @@ -39,16 +36,9 @@ namespace storage { class metric : public io::data { public: metric(); - metric(uint32_t host_id, - uint32_t service_id, - const std::string& name, - timestamp time, - uint32_t interval, - bool is_for_rebuild, - uint32_t metric_id, - int32_t rrd_len, - double value, - int16_t value_type); + metric(uint32_t host_id, uint32_t service_id, const std::string& name, + timestamp time, uint32_t interval, bool is_for_rebuild, + uint32_t metric_id, int32_t rrd_len, double value, int16_t value_type); metric(const metric&) = delete; ~metric() noexcept = default; metric& operator=(const metric&) = delete; @@ -78,8 +68,6 @@ class metric : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace storage - -CCB_END() +} // namespace com::centreon::broker::storage #endif // !CCB_STORAGE_METRIC_HH diff --git a/bbdo/storage/metric_mapping.cc b/bbdo/storage/metric_mapping.cc index 92f9c43f060..d5335d0713d 100644 --- a/bbdo/storage/metric_mapping.cc +++ b/bbdo/storage/metric_mapping.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/storage/metric_mapping.hh" diff --git a/bbdo/storage/metric_mapping.hh b/bbdo/storage/metric_mapping.hh index 125e5366b60..690ac03c358 100644 --- a/bbdo/storage/metric_mapping.hh +++ b/bbdo/storage/metric_mapping.hh @@ -23,12 +23,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace storage { +namespace com::centreon::broker::storage { /** * @class metric_mapping metric_mapping.hh * "com/centreon/broker/storage/metric_mapping.hh" @@ -58,8 +55,6 @@ class metric_mapping : public io::data { private: void _internal_copy(metric_mapping const& s); }; -} // namespace storage - -CCB_END() +} // namespace com::centreon::broker::storage #endif // !CCB_STORAGE_METRIC_MAPPING_HH diff --git a/bbdo/storage/remove_graph.cc b/bbdo/storage/remove_graph.cc index ebbdc78757a..a5eba898212 100644 --- a/bbdo/storage/remove_graph.cc +++ b/bbdo/storage/remove_graph.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/storage/remove_graph.hh" diff --git a/bbdo/storage/remove_graph.hh b/bbdo/storage/remove_graph.hh index cce4bf796d4..9323013f8e4 100644 --- a/bbdo/storage/remove_graph.hh +++ b/bbdo/storage/remove_graph.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2012-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_STORAGE_REMOVE_GRAPH_HH #define CCB_STORAGE_REMOVE_GRAPH_HH @@ -23,11 +23,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace storage { +namespace com::centreon::broker::storage { /** * @class remove_graph remove_graph.hh * "com/centreon/broker/storage/remove_graph.hh" @@ -52,8 +49,6 @@ class remove_graph : public io::data { static mapping::entry const entries[]; static io::event_info::event_operations const operations; }; -} // namespace storage - -CCB_END() +} // namespace com::centreon::broker::storage #endif // !CCB_STORAGE_REMOVE_GRAPH_HH diff --git a/bbdo/storage/status.cc b/bbdo/storage/status.cc index 189f92ea9e4..4df212c9785 100644 --- a/bbdo/storage/status.cc +++ b/bbdo/storage/status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/storage/status.hh" diff --git a/bbdo/storage/status.hh b/bbdo/storage/status.hh index 22665e17714..70883acba91 100644 --- a/bbdo/storage/status.hh +++ b/bbdo/storage/status.hh @@ -24,12 +24,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() - -namespace storage { +namespace com::centreon::broker::storage { /** * @class status status.hh "com/centreon/broker/storage/status.hh" * @brief Status data used to generate status graphs. @@ -51,12 +48,8 @@ class status : public io::data { static io::event_info::event_operations const operations; status(); - status(timestamp const& time, - uint64_t index_id, - uint32_t interval, - bool is_for_rebuild, - timestamp const& rrd_len, - int16_t state); + status(timestamp const& time, uint64_t index_id, uint32_t interval, + bool is_for_rebuild, timestamp const& rrd_len, int16_t state); status(status const& s); ~status(); @@ -67,8 +60,6 @@ class status : public io::data { return io::events::data_type::value; } }; -} // namespace storage - -CCB_END() +} // namespace com::centreon::broker::storage #endif // !CCB_STORAGE_STATUS_HH diff --git a/bbdo/tag.proto b/bbdo/tag.proto index 2622b78db42..d12898d8470 100644 --- a/bbdo/tag.proto +++ b/bbdo/tag.proto @@ -41,6 +41,7 @@ enum TagType { HOSTCATEGORY = 3; } +/*io::neb, neb::de_pb_tag*/ message Tag { uint64 id = 1; enum Action { diff --git a/broker/bam/CMakeLists.txt b/broker/bam/CMakeLists.txt index 7fc67f822a0..8e121e90823 100644 --- a/broker/bam/CMakeLists.txt +++ b/broker/bam/CMakeLists.txt @@ -22,7 +22,10 @@ set(SRC_DIR "${PROJECT_SOURCE_DIR}/bam/src") set(TEST_DIR "${PROJECT_SOURCE_DIR}/bam/test") include_directories( ${INC_DIR} ${PROJECT_SOURCE_DIR}/core/inc ${PROJECT_SOURCE_DIR}/core/sql/inc - ${PROJECT_SOURCE_DIR}/neb/inc) + ${PROJECT_SOURCE_DIR}/neb/inc + ${PROJECT_SOURCE_DIR}/core/src +) + set(INC_DIR "${INC_DIR}/com/centreon/broker/bam") # BAM module. diff --git a/broker/bam/inc/com/centreon/broker/bam/availability_builder.hh b/broker/bam/inc/com/centreon/broker/bam/availability_builder.hh index 694163be334..6105d32547d 100644 --- a/broker/bam/inc/com/centreon/broker/bam/availability_builder.hh +++ b/broker/bam/inc/com/centreon/broker/bam/availability_builder.hh @@ -19,11 +19,10 @@ #ifndef CCB_BAM_AVAILABILITY_BUILDER_HH #define CCB_BAM_AVAILABILITY_BUILDER_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/time/timeperiod.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -89,6 +88,6 @@ class availability_builder { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_AVAILABILITY_BUILDER_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/availability_thread.hh b/broker/bam/inc/com/centreon/broker/bam/availability_thread.hh index 8e061d3dcad..71a31f7371a 100644 --- a/broker/bam/inc/com/centreon/broker/bam/availability_thread.hh +++ b/broker/bam/inc/com/centreon/broker/bam/availability_thread.hh @@ -22,13 +22,12 @@ #include "com/centreon/broker/bam/availability_builder.hh" #include "com/centreon/broker/bam/timeperiod_map.hh" #include "com/centreon/broker/io/data.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" #include "com/centreon/broker/sql/mysql.hh" #include "com/centreon/broker/time/timeperiod.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { class database_query; @@ -91,6 +90,6 @@ class availability_thread final { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_AVAILABILITY_THREAD_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/ba.hh b/broker/bam/inc/com/centreon/broker/bam/ba.hh index 00e83bc057f..1ea060933a9 100644 --- a/broker/bam/inc/com/centreon/broker/bam/ba.hh +++ b/broker/bam/inc/com/centreon/broker/bam/ba.hh @@ -28,10 +28,9 @@ #include "com/centreon/broker/bam/internal.hh" #include "com/centreon/broker/bam/service_listener.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -103,9 +102,12 @@ class ba : public computable, public service_listener { int _recompute_count{0}; static double _normalize(double d); - virtual bool _apply_impact(kpi* kpi_ptr, impact_info& impact) = 0; + virtual void _apply_impact(kpi* kpi_ptr, impact_info& impact) = 0; virtual void _unapply_impact(kpi* kpi_ptr, impact_info& impact) = 0; - virtual void _recompute(); + virtual bool _apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) = 0; std::shared_ptr _generate_ba_status(bool state_changed) const; std::shared_ptr _generate_virtual_service_status() const; @@ -127,7 +129,7 @@ class ba : public computable, public service_listener { uint32_t get_id() const; uint32_t get_host_id() const; uint32_t get_service_id() const; - bool get_in_downtime() const; + bool in_downtime() const; timestamp get_last_kpi_update() const; std::string const& get_name() const; virtual std::string get_output() const = 0; @@ -158,6 +160,6 @@ class ba : public computable, public service_listener { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_BA_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/ba_best.hh b/broker/bam/inc/com/centreon/broker/bam/ba_best.hh index db4e93c4069..d9fe2efb0fd 100644 --- a/broker/bam/inc/com/centreon/broker/bam/ba_best.hh +++ b/broker/bam/inc/com/centreon/broker/bam/ba_best.hh @@ -1,27 +1,27 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_BEST_HH #define CCB_BAM_BA_BEST_HH #include "com/centreon/broker/bam/ba.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -44,9 +44,12 @@ class ba_best : public ba { void _commit_initial_events(io::stream* visitor); protected: - bool _apply_impact(kpi* kpi_ptr, impact_info& impact) override; + void _apply_impact(kpi* kpi_ptr, impact_info& impact) override; void _unapply_impact(kpi* kpi_ptr, impact_info& impact) override; - void _recompute() override; + bool _apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) override; public: ba_best(uint32_t id, @@ -60,6 +63,6 @@ class ba_best : public ba { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_BA_BEST_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/ba_impact.hh b/broker/bam/inc/com/centreon/broker/bam/ba_impact.hh index bf997d984b4..0a9e3ccd295 100644 --- a/broker/bam/inc/com/centreon/broker/bam/ba_impact.hh +++ b/broker/bam/inc/com/centreon/broker/bam/ba_impact.hh @@ -1,27 +1,27 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_IMPACT_HH #define CCB_BAM_BA_IMPACT_HH #include "com/centreon/broker/bam/ba.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -35,9 +35,15 @@ class kpi; * of value. */ class ba_impact : public ba { + void _recompute(); + protected: - bool _apply_impact(kpi* kpi_ptr, impact_info& impact) override; + void _apply_impact(kpi* kpi_ptr, impact_info& impact) override; void _unapply_impact(kpi* kpi_ptr, impact_info& impact) override; + bool _apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) override; public: ba_impact(uint32_t id, @@ -53,6 +59,6 @@ class ba_impact : public ba { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_BA_IMPACT_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/ba_ratio_number.hh b/broker/bam/inc/com/centreon/broker/bam/ba_ratio_number.hh index d4a70bf5d60..fd66c9d5d81 100644 --- a/broker/bam/inc/com/centreon/broker/bam/ba_ratio_number.hh +++ b/broker/bam/inc/com/centreon/broker/bam/ba_ratio_number.hh @@ -1,27 +1,27 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_RATIO_NUMBER_HH #define CCB_BAM_BA_RATIO_NUMBER_HH #include "com/centreon/broker/bam/ba.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -35,9 +35,12 @@ class kpi; * of value. */ class ba_ratio_number : public ba { - bool _apply_impact(kpi* kpi_ptr, impact_info& impact) override; + void _apply_impact(kpi* kpi_ptr, impact_info& impact) override; void _unapply_impact(kpi* kpi_ptr, impact_info& impact) override; - void _recompute() override; + bool _apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) override; public: ba_ratio_number(uint32_t id, @@ -51,6 +54,6 @@ class ba_ratio_number : public ba { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_BA_RATIO_NUMBER_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/ba_ratio_percent.hh b/broker/bam/inc/com/centreon/broker/bam/ba_ratio_percent.hh index b33dc849005..75ad69245df 100644 --- a/broker/bam/inc/com/centreon/broker/bam/ba_ratio_percent.hh +++ b/broker/bam/inc/com/centreon/broker/bam/ba_ratio_percent.hh @@ -1,27 +1,27 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_RATIO_PERCENT_HH #define CCB_BAM_BA_RATIO_PERCENT_HH #include "com/centreon/broker/bam/ba.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -35,9 +35,12 @@ class kpi; * of value. */ class ba_ratio_percent : public ba { - bool _apply_impact(kpi* kpi_ptr, ba::impact_info& impact) override; + void _apply_impact(kpi* kpi_ptr, ba::impact_info& impact) override; void _unapply_impact(kpi* kpi_ptr, ba::impact_info& impact) override; - void _recompute() override; + bool _apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) override; public: ba_ratio_percent(uint32_t id, @@ -51,6 +54,6 @@ class ba_ratio_percent : public ba { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_BA_RATIO_PERCENT_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/ba_svc_mapping.hh b/broker/bam/inc/com/centreon/broker/bam/ba_svc_mapping.hh index 193f48bbc83..b252a460b0b 100644 --- a/broker/bam/inc/com/centreon/broker/bam/ba_svc_mapping.hh +++ b/broker/bam/inc/com/centreon/broker/bam/ba_svc_mapping.hh @@ -19,9 +19,8 @@ #ifndef CCB_BAM_BA_SVC_MAPPING_HH #define CCB_BAM_BA_SVC_MAPPING_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -45,6 +44,6 @@ class ba_svc_mapping { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BA_SVC_MAPPING_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/ba_worst.hh b/broker/bam/inc/com/centreon/broker/bam/ba_worst.hh index 095505e1534..9cd5cf05744 100644 --- a/broker/bam/inc/com/centreon/broker/bam/ba_worst.hh +++ b/broker/bam/inc/com/centreon/broker/bam/ba_worst.hh @@ -1,27 +1,27 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_BA_WORST_HH #define CCB_BAM_BA_WORST_HH #include "com/centreon/broker/bam/ba.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -44,9 +44,12 @@ class ba_worst : public ba { void _commit_initial_events(io::stream* visitor); protected: - bool _apply_impact(kpi* kpi_ptr, impact_info& impact) override; + void _apply_impact(kpi* kpi_ptr, impact_info& impact) override; void _unapply_impact(kpi* kpi_ptr, impact_info& impact) override; - void _recompute() override; + bool _apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) override; public: ba_worst(uint32_t id, @@ -60,6 +63,6 @@ class ba_worst : public ba { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_BA_WORST_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_and.hh b/broker/bam/inc/com/centreon/broker/bam/bool_and.hh index d23c99bdb18..9835bd26d57 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_and.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_and.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_AND_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -49,6 +48,6 @@ class bool_and : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_AND_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_binary_operator.hh b/broker/bam/inc/com/centreon/broker/bam/bool_binary_operator.hh index 7676564a101..b4ae59d3f54 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_binary_operator.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_binary_operator.hh @@ -21,11 +21,10 @@ #include "com/centreon/broker/bam/bool_value.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #define COMPARE_EPSILON 0.0001 -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -62,6 +61,6 @@ class bool_binary_operator : public bool_value { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_BINARY_OPERATOR_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_call.hh b/broker/bam/inc/com/centreon/broker/bam/bool_call.hh index f7841026201..a1ba84a2563 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_call.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_call.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/bam/bool_expression.hh" #include "com/centreon/broker/bam/bool_value.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -53,6 +52,6 @@ class bool_call : public bool_value { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_CALL_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_constant.hh b/broker/bam/inc/com/centreon/broker/bam/bool_constant.hh index f44c183b6bb..752712c78a8 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_constant.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_constant.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_CONSTANT_HH #include "com/centreon/broker/bam/bool_value.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -51,6 +50,6 @@ class bool_constant : public bool_value { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_CONSTANT_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_equal.hh b/broker/bam/inc/com/centreon/broker/bam/bool_equal.hh index 61b8f7f9642..38539bf83ff 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_equal.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_equal.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_EQUAL_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -44,6 +43,6 @@ class bool_equal : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_EQUAL_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_expression.hh b/broker/bam/inc/com/centreon/broker/bam/bool_expression.hh index 0cba39906a9..26de689e934 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_expression.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_expression.hh @@ -22,10 +22,9 @@ #include "bbdo/bam/state.hh" #include "com/centreon/broker/bam/computable.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "impact_values.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -61,6 +60,6 @@ class bool_expression : public computable { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_EXPRESSION_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_less_than.hh b/broker/bam/inc/com/centreon/broker/bam/bool_less_than.hh index abd15b37968..b0bdafbc686 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_less_than.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_less_than.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_LESS_THAN_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -47,6 +46,6 @@ class bool_less_than : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_LESS_THAN_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_more_than.hh b/broker/bam/inc/com/centreon/broker/bam/bool_more_than.hh index 8dfe51243cb..cac67e53351 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_more_than.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_more_than.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_MORE_THAN_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -46,6 +45,6 @@ class bool_more_than : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_MORE_THAN_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_not.hh b/broker/bam/inc/com/centreon/broker/bam/bool_not.hh index a4a16f46c8b..8e4adefed8d 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_not.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_not.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/bam/bool_value.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -56,6 +55,6 @@ class bool_not : public bool_value { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_NOT_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_not_equal.hh b/broker/bam/inc/com/centreon/broker/bam/bool_not_equal.hh index 170125c2507..181edcc4206 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_not_equal.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_not_equal.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_NOT_EQUAL_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -45,6 +44,6 @@ class bool_not_equal : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_NOT_EQUAL_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_operation.hh b/broker/bam/inc/com/centreon/broker/bam/bool_operation.hh index 9f99253660a..734688901c6 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_operation.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_operation.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_OPERATION_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -55,6 +54,6 @@ class bool_operation : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_OR_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_or.hh b/broker/bam/inc/com/centreon/broker/bam/bool_or.hh index 9462ca65c80..06e99fe70d4 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_or.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_or.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_OR_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -49,6 +48,6 @@ class bool_or : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_OR_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_service.hh b/broker/bam/inc/com/centreon/broker/bam/bool_service.hh index f876837a277..b41bc708e3b 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_service.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_service.hh @@ -22,10 +22,9 @@ #include "com/centreon/broker/bam/bool_value.hh" #include "com/centreon/broker/bam/service_listener.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -68,6 +67,6 @@ class bool_service : public bool_value, public service_listener { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_SERVICE_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_value.hh b/broker/bam/inc/com/centreon/broker/bam/bool_value.hh index cd7c7b661fe..c4d89f5d27c 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_value.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_value.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_VALUE_HH #include "com/centreon/broker/bam/computable.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -46,6 +45,6 @@ class bool_value : public computable { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_VALUE_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/bool_xor.hh b/broker/bam/inc/com/centreon/broker/bam/bool_xor.hh index 4fbe48057b5..830e22fbd74 100644 --- a/broker/bam/inc/com/centreon/broker/bam/bool_xor.hh +++ b/broker/bam/inc/com/centreon/broker/bam/bool_xor.hh @@ -20,9 +20,8 @@ #define CCB_BAM_BOOL_XOR_HH #include "com/centreon/broker/bam/bool_binary_operator.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -44,6 +43,6 @@ class bool_xor : public bool_binary_operator { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_BOOL_XOR_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/computable.hh b/broker/bam/inc/com/centreon/broker/bam/computable.hh index 68eff9a4534..25319d12ae0 100644 --- a/broker/bam/inc/com/centreon/broker/bam/computable.hh +++ b/broker/bam/inc/com/centreon/broker/bam/computable.hh @@ -1,5 +1,5 @@ -/* - * Copyright 2014, 2023 Centreon +/** + * Copyright 2014, 2023-2024 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +20,9 @@ #define CCB_BAM_COMPUTABLE_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -73,6 +72,6 @@ class computable { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_COMPUTABLE_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/ba.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/ba.hh index 4b86a76dd10..e2c763f606e 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/ba.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/ba.hh @@ -24,10 +24,9 @@ #include "com/centreon/broker/bam/configuration/state.hh" #include "com/centreon/broker/bam/service_book.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations. namespace neb { @@ -80,6 +79,6 @@ class ba { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONFIGURATION_APPLIER_BA_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/bool_expression.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/bool_expression.hh index c52a50a28f3..d351229cc3c 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/bool_expression.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/bool_expression.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/bam/configuration/bool_expression.hh" #include "com/centreon/broker/bam/configuration/state.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declarations. @@ -72,6 +71,6 @@ class bool_expression { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONFIGURATION_APPLIER_BOOL_EXPRESSION_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/kpi.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/kpi.hh index 0215c250db0..4328ec82308 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/kpi.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/kpi.hh @@ -23,9 +23,8 @@ #include "com/centreon/broker/bam/configuration/state.hh" #include "com/centreon/broker/bam/kpi.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -80,6 +79,6 @@ class kpi { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONFIGURATION_APPLIER_KPI_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/state.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/state.hh index 7b83a7641a0..a4f7951469e 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/applier/state.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/applier/state.hh @@ -23,9 +23,8 @@ #include "com/centreon/broker/bam/configuration/applier/bool_expression.hh" #include "com/centreon/broker/bam/configuration/applier/kpi.hh" #include "com/centreon/broker/bam/service_book.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -78,6 +77,6 @@ class state { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONFIGURATION_APPLIER_STATE_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/ba.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/ba.hh index ff9ad7e5837..45b0cf701be 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/ba.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/ba.hh @@ -20,9 +20,8 @@ #define CCB_BAM_CONFIGURATION_BA_HH #include "com/centreon/broker/bam/internal.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { namespace configuration { @@ -94,6 +93,6 @@ class ba { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONFIGURATION_BA_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/bool_expression.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/bool_expression.hh index 7960802e8a6..7f7a88ecaa2 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/bool_expression.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/bool_expression.hh @@ -19,9 +19,8 @@ #ifndef BAM_CCB_CONFIGURATION_BOOL_EXPRESSION_HH #define BAM_CCB_CONFIGURATION_BOOL_EXPRESSION_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { namespace configuration { @@ -64,6 +63,6 @@ class bool_expression { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONFIGURATION_BOOL_EXPRESSION_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/kpi.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/kpi.hh index 2de9e92abe6..4bb02974a42 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/kpi.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/kpi.hh @@ -20,9 +20,8 @@ #define CCB_BAM_CONFIGURATION_KPI_HH #include "com/centreon/broker/bam/internal.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { namespace configuration { @@ -52,6 +51,7 @@ class kpi { double _impact_critical; double _impact_unknown; KpiEvent _event; + std::string _name; public: kpi(uint32_t id = 0, @@ -69,10 +69,9 @@ class kpi { bool ignoreacknowledgement = false, double warning = 0, double critical = 0, - double unknown = 0); - kpi(kpi const& other); - ~kpi(); - kpi& operator=(kpi const& other); + double unknown = 0, + const std::string& name = ""); + bool operator==(kpi const& other) const; bool operator!=(kpi const& other) const; @@ -97,6 +96,7 @@ class kpi { double get_impact_critical() const; double get_impact_unknown() const; const KpiEvent& get_opened_event() const; + const std::string get_name() const { return _name; } void set_id(uint32_t id); void set_state_type(short state_type); @@ -119,6 +119,6 @@ class kpi { } // namespace configuration } // namespace bam -CCB_END() +} #endif // CCB_BAM_CONFIGURATION_KPI_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/reader_exception.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/reader_exception.hh index eb6082db8eb..c77b560113b 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/reader_exception.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/reader_exception.hh @@ -21,7 +21,7 @@ #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { namespace configuration { @@ -45,6 +45,6 @@ class reader_exception : public com::centreon::exceptions::msg_fmt { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_CONFIGURATION_READER_EXCEPTION_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/reader_v2.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/reader_v2.hh index 7e319a4c9a4..438ea7fd56f 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/reader_v2.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/reader_v2.hh @@ -20,10 +20,9 @@ #define CCB_BAM_CONFIGURATION_READER_V2_HH #include "com/centreon/broker/bam/configuration/state.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. class mysql; @@ -61,6 +60,6 @@ class reader_v2 { } // namespace configuration } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONFIGURATION_READER_V2_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/configuration/state.hh b/broker/bam/inc/com/centreon/broker/bam/configuration/state.hh index 780310f7100..f752da38b35 100644 --- a/broker/bam/inc/com/centreon/broker/bam/configuration/state.hh +++ b/broker/bam/inc/com/centreon/broker/bam/configuration/state.hh @@ -24,9 +24,8 @@ #include "com/centreon/broker/bam/configuration/bool_expression.hh" #include "com/centreon/broker/bam/configuration/kpi.hh" #include "com/centreon/broker/bam/hst_svc_mapping.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { namespace configuration { @@ -73,6 +72,6 @@ class state { } // namespace configuration } // namespace bam -CCB_END() +} #endif // ! CCB_BAM_CONFIGURATION_STATE_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/connector.hh b/broker/bam/inc/com/centreon/broker/bam/connector.hh index 9040fb546ac..09a0359e35d 100644 --- a/broker/bam/inc/com/centreon/broker/bam/connector.hh +++ b/broker/bam/inc/com/centreon/broker/bam/connector.hh @@ -20,10 +20,9 @@ #define CCB_BAM_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -67,6 +66,6 @@ class connector : public io::endpoint { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_CONNECTOR_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/event_cache_visitor.hh b/broker/bam/inc/com/centreon/broker/bam/event_cache_visitor.hh index 4a893fff3cb..161a2061ab0 100644 --- a/broker/bam/inc/com/centreon/broker/bam/event_cache_visitor.hh +++ b/broker/bam/inc/com/centreon/broker/bam/event_cache_visitor.hh @@ -20,9 +20,8 @@ #define CCB_BAM_EVENT_CACHE_VISITOR_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -50,6 +49,6 @@ class event_cache_visitor : public io::stream { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_EVENT_CACHE_VISITOR_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/exp_builder.hh b/broker/bam/inc/com/centreon/broker/bam/exp_builder.hh index e7fabd2a3ac..8bdfa7ebbd9 100644 --- a/broker/bam/inc/com/centreon/broker/bam/exp_builder.hh +++ b/broker/bam/inc/com/centreon/broker/bam/exp_builder.hh @@ -23,9 +23,8 @@ #include "com/centreon/broker/bam/bool_service.hh" #include "com/centreon/broker/bam/exp_parser.hh" #include "com/centreon/broker/bam/hst_svc_mapping.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -65,6 +64,6 @@ class exp_builder { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_EXP_BUILDER_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/exp_parser.hh b/broker/bam/inc/com/centreon/broker/bam/exp_parser.hh index 9a75018ef49..b31f1a7f3d0 100644 --- a/broker/bam/inc/com/centreon/broker/bam/exp_parser.hh +++ b/broker/bam/inc/com/centreon/broker/bam/exp_parser.hh @@ -19,9 +19,8 @@ #ifndef CCB_BAM_EXP_PARSER_HH #define CCB_BAM_EXP_PARSER_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -55,6 +54,6 @@ class exp_parser { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_EXP_PARSER_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/exp_tokenizer.hh b/broker/bam/inc/com/centreon/broker/bam/exp_tokenizer.hh index fc1380e6462..9fa9b98b366 100644 --- a/broker/bam/inc/com/centreon/broker/bam/exp_tokenizer.hh +++ b/broker/bam/inc/com/centreon/broker/bam/exp_tokenizer.hh @@ -19,9 +19,8 @@ #ifndef CCB_BAM_EXP_TOKENIZER_HH #define CCB_BAM_EXP_TOKENIZER_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -57,6 +56,6 @@ class exp_tokenizer { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_EXP_TOKENIZER_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/factory.hh b/broker/bam/inc/com/centreon/broker/bam/factory.hh index 274c300f317..328dd1e86dd 100644 --- a/broker/bam/inc/com/centreon/broker/bam/factory.hh +++ b/broker/bam/inc/com/centreon/broker/bam/factory.hh @@ -20,9 +20,8 @@ #define CCB_BAM_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -46,6 +45,6 @@ class factory : public io::factory { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_FACTORY_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/hst_svc_mapping.hh b/broker/bam/inc/com/centreon/broker/bam/hst_svc_mapping.hh index ccaac18cbf1..e2b392e2dd6 100644 --- a/broker/bam/inc/com/centreon/broker/bam/hst_svc_mapping.hh +++ b/broker/bam/inc/com/centreon/broker/bam/hst_svc_mapping.hh @@ -21,9 +21,8 @@ #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -59,6 +58,6 @@ class hst_svc_mapping { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_HST_SVC_MAPPING_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/impact_values.hh b/broker/bam/inc/com/centreon/broker/bam/impact_values.hh index d96ca3459c2..34cc2c8daa6 100644 --- a/broker/bam/inc/com/centreon/broker/bam/impact_values.hh +++ b/broker/bam/inc/com/centreon/broker/bam/impact_values.hh @@ -1,28 +1,27 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014, 2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_IMPACT_VALUES_HH #define CCB_BAM_IMPACT_VALUES_HH #include "bbdo/bam/state.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -61,6 +60,6 @@ class impact_values { }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_IMPACT_VALUES_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/internal.hh b/broker/bam/inc/com/centreon/broker/bam/internal.hh index c78bdb46203..80a771c6dd9 100644 --- a/broker/bam/inc/com/centreon/broker/bam/internal.hh +++ b/broker/bam/inc/com/centreon/broker/bam/internal.hh @@ -1,30 +1,30 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BAM_INTERNAL_HH #define CCB_BAM_INTERNAL_HH #include "bbdo/bam.pb.h" +#include "broker.pb.h" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/io/protobuf.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { using pb_inherited_downtime = @@ -78,6 +78,15 @@ using pb_dimension_truncate_table_signal = } // namespace bam -CCB_END() +/* We have to declare the pb_ba_info also here because we don't control the + * order things are created. If the bam stream is created before brokerrpc, its + * muxer will be declared with known events (so without pb_ba_info) and if we + * want pb_ba_info to be known, thenwe have to force its declaration. */ +namespace extcmd { +using pb_ba_info = + io::protobuf; +} // namespace extcmd + +} // namespace com::centreon::broker #endif diff --git a/broker/bam/inc/com/centreon/broker/bam/kpi.hh b/broker/bam/inc/com/centreon/broker/bam/kpi.hh index ac1f2f315ad..68ba1188c7a 100644 --- a/broker/bam/inc/com/centreon/broker/bam/kpi.hh +++ b/broker/bam/inc/com/centreon/broker/bam/kpi.hh @@ -22,10 +22,9 @@ #include "com/centreon/broker/bam/computable.hh" #include "com/centreon/broker/bam/internal.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declarations. @@ -45,11 +44,12 @@ class kpi : public computable { const uint32_t _ba_id; absl::optional _event; std::vector _initial_events; + std::string _name; void _event_init(); public: - kpi(uint32_t kpi_id, uint32_t ba_id); + kpi(uint32_t kpi_id, uint32_t ba_id, const std::string& name); virtual ~kpi() noexcept = default; kpi& operator=(const kpi&) = delete; kpi(const kpi&) = delete; @@ -62,11 +62,12 @@ class kpi : public computable { virtual void visit(io::stream* visitor) = 0; virtual bool in_downtime() const; virtual bool ok_state() const = 0; + const std::string& get_name() const { return _name; }; void commit_initial_events(io::stream* visitor); }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_KPI_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/kpi_ba.hh b/broker/bam/inc/com/centreon/broker/bam/kpi_ba.hh index a515fc45434..4139b726748 100644 --- a/broker/bam/inc/com/centreon/broker/bam/kpi_ba.hh +++ b/broker/bam/inc/com/centreon/broker/bam/kpi_ba.hh @@ -24,9 +24,8 @@ #include "com/centreon/broker/bam/internal.hh" #include "com/centreon/broker/bam/kpi.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -57,7 +56,7 @@ class kpi_ba : public kpi { const timestamp& event_start_time); public: - kpi_ba(uint32_t kpi_id, uint32_t ba_id); + kpi_ba(uint32_t kpi_id, uint32_t ba_id, const std::string& ba_name); ~kpi_ba() noexcept = default; kpi_ba(const kpi_ba&) = delete; kpi_ba& operator=(const kpi_ba&) = delete; @@ -79,6 +78,6 @@ class kpi_ba : public kpi { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_KPI_BA_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/kpi_boolexp.hh b/broker/bam/inc/com/centreon/broker/bam/kpi_boolexp.hh index c9b424c7c36..9bda69d77eb 100644 --- a/broker/bam/inc/com/centreon/broker/bam/kpi_boolexp.hh +++ b/broker/bam/inc/com/centreon/broker/bam/kpi_boolexp.hh @@ -22,10 +22,9 @@ #include "bbdo/bam/state.hh" #include "com/centreon/broker/bam/kpi.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "impact_values.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { // Forward declaration. @@ -49,7 +48,7 @@ class kpi_boolexp : public kpi { void _open_new_event(io::stream* visitor, int impact, state state); public: - kpi_boolexp(uint32_t kpi_id, uint32_t ba_id); + kpi_boolexp(uint32_t kpi_id, uint32_t ba_id, const std::string& bool_name); ~kpi_boolexp() noexcept = default; kpi_boolexp(const kpi_boolexp&) = delete; kpi_boolexp& operator=(const kpi_boolexp&) = delete; @@ -68,6 +67,6 @@ class kpi_boolexp : public kpi { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_KPI_BOOLEXP_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/kpi_service.hh b/broker/bam/inc/com/centreon/broker/bam/kpi_service.hh index aac1446cd7c..7a93fc0f0de 100644 --- a/broker/bam/inc/com/centreon/broker/bam/kpi_service.hh +++ b/broker/bam/inc/com/centreon/broker/bam/kpi_service.hh @@ -25,10 +25,9 @@ #include "com/centreon/broker/bam/kpi.hh" #include "com/centreon/broker/bam/service_listener.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -61,7 +60,8 @@ class kpi_service : public service_listener, public kpi { kpi_service(uint32_t kpi_id, uint32_t ba_id, uint32_t host_id, - uint32_t service_id); + uint32_t service_id, + const std::string& host_serv); ~kpi_service() noexcept = default; kpi_service(const kpi_service&) = delete; kpi_service& operator=(const kpi_service&) = delete; @@ -104,10 +104,10 @@ class kpi_service : public service_listener, public kpi { bool ok_state() const override; void update_from(computable* child, io::stream* visitor) override; std::string object_info() const override; - void dump(std::ofstream& output) const; + void dump(std::ofstream& output) const override; }; } // namespace bam -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BAM_KPI_SERVICE_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/monitoring_stream.hh b/broker/bam/inc/com/centreon/broker/bam/monitoring_stream.hh index 64f708f4450..e1aa396f9f8 100644 --- a/broker/bam/inc/com/centreon/broker/bam/monitoring_stream.hh +++ b/broker/bam/inc/com/centreon/broker/bam/monitoring_stream.hh @@ -22,13 +22,12 @@ #include #include "com/centreon/broker/bam/configuration/applier/state.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" #include "com/centreon/broker/sql/mysql.hh" #include "com/centreon/broker/sql/mysql_multi_insert.hh" #include "com/centreon/broker/sql/mysql_stmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace extcmd { using pb_ba_info = @@ -123,6 +122,6 @@ class monitoring_stream : public io::stream { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_MONITORING_STREAM_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/reporting_stream.hh b/broker/bam/inc/com/centreon/broker/bam/reporting_stream.hh index 2d652c364f0..95fb6d38f09 100644 --- a/broker/bam/inc/com/centreon/broker/bam/reporting_stream.hh +++ b/broker/bam/inc/com/centreon/broker/bam/reporting_stream.hh @@ -24,11 +24,10 @@ #include "com/centreon/broker/bam/internal.hh" #include "com/centreon/broker/bam/timeperiod_map.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/mysql_multi_insert.hh" #include "com/centreon/broker/time/timeperiod.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. class database_config; @@ -139,6 +138,6 @@ class reporting_stream : public io::stream { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_REPORTING_STREAM_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/service_book.hh b/broker/bam/inc/com/centreon/broker/bam/service_book.hh index 1b8686ab249..d2a0a77f93e 100644 --- a/broker/bam/inc/com/centreon/broker/bam/service_book.hh +++ b/broker/bam/inc/com/centreon/broker/bam/service_book.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/bam/service_listener.hh" #include "com/centreon/broker/io/stream.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations. namespace neb { @@ -73,6 +73,6 @@ class service_book { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_SERVICE_BOOK_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/service_listener.hh b/broker/bam/inc/com/centreon/broker/bam/service_listener.hh index 1971e2c07fb..b312c584490 100644 --- a/broker/bam/inc/com/centreon/broker/bam/service_listener.hh +++ b/broker/bam/inc/com/centreon/broker/bam/service_listener.hh @@ -20,10 +20,9 @@ #define CCB_BAM_SERVICE_LISTENER_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations. namespace neb { @@ -67,6 +66,6 @@ class service_listener { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_SERVICE_LISTENER_HH diff --git a/broker/bam/inc/com/centreon/broker/bam/timeperiod_map.hh b/broker/bam/inc/com/centreon/broker/bam/timeperiod_map.hh index 0f5e0e21a40..5219c74aeea 100644 --- a/broker/bam/inc/com/centreon/broker/bam/timeperiod_map.hh +++ b/broker/bam/inc/com/centreon/broker/bam/timeperiod_map.hh @@ -19,10 +19,9 @@ #ifndef CCB_BAM_TIMEPERIOD_MAP_HH #define CCB_BAM_TIMEPERIOD_MAP_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/time/timeperiod.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bam { /** @@ -53,6 +52,6 @@ class timeperiod_map { }; } // namespace bam -CCB_END() +} #endif // !CCB_BAM_TIMEPERIOD_MAP_HH diff --git a/broker/bam/src/availability_builder.cc b/broker/bam/src/availability_builder.cc index ec11f363779..64e41c92534 100644 --- a/broker/bam/src/availability_builder.cc +++ b/broker/bam/src/availability_builder.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/availability_builder.hh" diff --git a/broker/bam/src/availability_thread.cc b/broker/bam/src/availability_thread.cc index 6a4f8224f8b..f88336b49e6 100644 --- a/broker/bam/src/availability_thread.cc +++ b/broker/bam/src/availability_thread.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/availability_thread.hh" diff --git a/broker/bam/src/ba.cc b/broker/bam/src/ba.cc index 83c3d980367..ecc1ffaa49d 100644 --- a/broker/bam/src/ba.cc +++ b/broker/bam/src/ba.cc @@ -1,5 +1,5 @@ -/* - * Copyright 2014-2016, 2021-2023 Centreon +/** + * Copyright 2014-2016, 2021-2024 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include "com/centreon/broker/bam/ba.hh" #include + #include #include "com/centreon/broker/bam/impact_values.hh" @@ -76,7 +77,7 @@ ba::ba(uint32_t id, void ba::add_impact(std::shared_ptr const& impact) { auto it = _impacts.find(impact.get()); if (it == _impacts.end()) { - impact_info& ii(_impacts[impact.get()]); + impact_info& ii = _impacts[impact.get()]; ii.kpi_ptr = impact; impact->impact_hard(ii.hard_impact); impact->impact_soft(ii.soft_impact); @@ -131,7 +132,7 @@ uint32_t ba::get_service_id() const { * * @return True if the BA is in downtime, false otherwise. */ -bool ba::get_in_downtime() const { +bool ba::in_downtime() const { return _in_downtime; } @@ -425,26 +426,6 @@ void ba::_open_new_event(io::stream* visitor, } } -/** - * @brief Recompute all impacts. - * - * This method was created to prevent the real values to derive to - * much from their true value due to the caching system. - */ -void ba::_recompute() { - _acknowledgement_hard = 0.0; - _acknowledgement_soft = 0.0; - _downtime_hard = 0.0; - _downtime_soft = 0.0; - _level_hard = 100.0; - _level_soft = 100.0; - for (std::unordered_map::iterator it(_impacts.begin()), - end(_impacts.end()); - it != end; ++it) - _apply_impact(it->first, it->second); - _recompute_count = 0; -} - /** * Commit the initial events of this ba. * @@ -527,7 +508,7 @@ std::shared_ptr ba::_generate_ba_status( auto ret{std::make_shared()}; BaStatus& status = ret->mut_obj(); status.set_ba_id(get_id()); - status.set_in_downtime(get_in_downtime()); + status.set_in_downtime(in_downtime()); if (_event) status.set_last_state_change(_event->obj().start_time()); else @@ -631,74 +612,52 @@ void ba::set_level_warning(double level) { } /** - * @brief Update this computable with the child modifications. + * @brief Update this computable with the child modifications. This function is + * called only if child has changes. And it will notify its parents only if it + * also changes. * * @param child The child that changed. * @param visitor The visitor to handle events. */ void ba::update_from(computable* child, io::stream* visitor) { auto logger = log_v2::bam(); - logger->trace("ba::update_from"); - auto it = _impacts.find(static_cast(child)); - if (it != _impacts.end()) { - // Get impact. - impact_values new_hard_impact; - impact_values new_soft_impact; - it->second.kpi_ptr->impact_hard(new_hard_impact); - it->second.kpi_ptr->impact_soft(new_soft_impact); - bool kpi_in_downtime(it->second.kpi_ptr->in_downtime()); - - // Logging. - SPDLOG_LOGGER_DEBUG( - logger, - "BAM: BA {}, '{}' is getting notified of child update (KPI {}, impact " - "{}, last state change {}, downtime {})", - _id, _name, it->second.kpi_ptr->get_id(), new_hard_impact.get_nominal(), - it->second.kpi_ptr->get_last_state_change(), kpi_in_downtime); - - // If the new impact is the same as the old, don't update. - if (it->second.hard_impact == new_hard_impact && - it->second.soft_impact == new_soft_impact && - it->second.in_downtime == kpi_in_downtime) { - SPDLOG_LOGGER_DEBUG( - logger, - "BAM: BA {} has no changes since last update: hard impact: (ack: {}, " - "dwnt: {}, nominal: {}), downtime: {}", - _id, new_hard_impact.get_acknowledgement(), - new_hard_impact.get_nominal(), new_hard_impact.get_downtime(), - kpi_in_downtime); - return; - } - timestamp last_state_change(it->second.kpi_ptr->get_last_state_change()); - if (!last_state_change.is_null()) - _last_kpi_update = std::max(_last_kpi_update, last_state_change); - - // Discard old data. - _unapply_impact(it->first, it->second); - - // Apply new data. - SPDLOG_LOGGER_TRACE( - log_v2::bam(), - "BAM: BA {} changes: hard impact changed {}, soft impact changed {}, " - "downtime {} => {}", - _id, it->second.hard_impact != new_hard_impact, - it->second.soft_impact != new_soft_impact, it->second.in_downtime, - kpi_in_downtime); - it->second.hard_impact = new_hard_impact; - it->second.soft_impact = new_soft_impact; - it->second.in_downtime = kpi_in_downtime; - bool changed = _apply_impact(it->first, it->second); - SPDLOG_LOGGER_TRACE(log_v2::bam(), "BA has changed: {}", changed); - - // Check for inherited downtimes. - _compute_inherited_downtime(visitor); - - // Generate status event. - visit(visitor); - - if (changed) - notify_parents_of_change(visitor); - } + logger->trace("ba::update_from (BA {})", _id); + // Get impact. + impact_values new_hard_impact; + impact_values new_soft_impact; + kpi* kpi_child = static_cast(child); + kpi_child->impact_hard(new_hard_impact); + kpi_child->impact_soft(new_soft_impact); + bool kpi_in_downtime(kpi_child->in_downtime()); + bool previous_in_downtime = _in_downtime; + + // Logging. + SPDLOG_LOGGER_DEBUG( + logger, + "BAM: BA {}, '{}' is getting notified of child update (KPI {}, impact " + "{}, last state change {}, downtime {})", + _id, _name, kpi_child->get_id(), new_hard_impact.get_nominal(), + kpi_child->get_last_state_change(), kpi_in_downtime); + + timestamp last_state_change(kpi_child->get_last_state_change()); + if (!last_state_change.is_null()) + _last_kpi_update = std::max(_last_kpi_update, last_state_change); + + // Apply new data. + SPDLOG_LOGGER_TRACE(log_v2::bam(), "BAM: BA {} updated from KPI {}", _id, + kpi_child->get_id()); + bool changed = _apply_changes(kpi_child, new_hard_impact, new_soft_impact, + kpi_in_downtime); + SPDLOG_LOGGER_TRACE(log_v2::bam(), "BA has changed: {}", changed); + + // Check for inherited downtimes. + _compute_inherited_downtime(visitor); + + // Generate status event. + visit(visitor); + + if (changed || _in_downtime != previous_in_downtime) + notify_parents_of_change(visitor); } /** @@ -708,8 +667,8 @@ void ba::update_from(computable* child, io::stream* visitor) { * @return A multiline strings with various informations. */ std::string ba::object_info() const { - return fmt::format("BA {}\nname: {}\nstate: {}", _id, _name, - get_state_hard()); + return fmt::format("BA {}\nname: {}\nstate: {}\ndowntime: {}", _id, _name, + get_state_hard(), _in_downtime); } /** diff --git a/broker/bam/src/ba_best.cc b/broker/bam/src/ba_best.cc index 6b9ea4660f0..ef52a7aa8de 100644 --- a/broker/bam/src/ba_best.cc +++ b/broker/bam/src/ba_best.cc @@ -1,24 +1,25 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/bam/ba_best.hh" #include + #include #include "bbdo/bam/ba_status.hh" @@ -96,29 +97,54 @@ state ba_best::get_state_soft() const { * * @param[in] impact Impact information. */ -bool ba_best::_apply_impact(kpi* kpi_ptr __attribute__((unused)), +void ba_best::_apply_impact(kpi* kpi_ptr [[maybe_unused]], ba::impact_info& impact) { - const std::array order{0, 3, 4, 2, 1}; - - auto is_state_better = [&](short current_state, short new_state) -> bool { + auto is_state_better = [](short current_state, short new_state) -> bool { + const std::array order{0, 3, 4, 2, 1}; assert((unsigned int)current_state < order.size()); assert((unsigned int)new_state < order.size()); return order[new_state] < order[current_state]; }; if (_dt_behaviour == configuration::ba::dt_ignore_kpi && impact.in_downtime) - return false; + return; - bool retval = false; - if (is_state_better(_computed_soft_state, impact.soft_impact.get_state())) { + if (is_state_better(_computed_soft_state, impact.soft_impact.get_state())) _computed_soft_state = impact.soft_impact.get_state(); - retval = true; - } - if (is_state_better(_computed_hard_state, impact.hard_impact.get_state())) { + if (is_state_better(_computed_hard_state, impact.hard_impact.get_state())) _computed_hard_state = impact.hard_impact.get_state(); - retval = true; +} + +/** + * Apply some impact. This method is more complete than _apply_impact(). + * It takes as argument a child kpi and its impact. This child is already + * known, so its previous impact is replaced by the new one. + * In other words, this method makes almost the same work as _unapply_impact() + * and the _apply_impact() ; the difference is that it returns true if the BA + * really changed. + * + * @param[in] impact Impact information. + * @return True if the BA changes, False otherwise. + */ +bool ba_best::_apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) { + state previous_state = _computed_hard_state; + + _computed_soft_state = _computed_hard_state = state_critical; + + // We recompute all impacts... + for (auto it = _impacts.begin(), end = _impacts.end(); it != end; ++it) { + if (it->first == child) { + it->second.hard_impact = new_hard_impact; + it->second.soft_impact = new_soft_impact; + it->second.in_downtime = in_downtime; + } + _apply_impact(it->first, it->second); } - return retval; + + return _computed_hard_state != previous_state; } /** @@ -174,11 +200,3 @@ std::string ba_best::get_output() const { std::string ba_best::get_perfdata() const { return {}; } - -void ba_best::_recompute() { - _computed_soft_state = state_critical; - _computed_hard_state = state_critical; - for (auto it = _impacts.begin(), end = _impacts.end(); it != end; ++it) - _apply_impact(it->first, it->second); - _recompute_count = 0; -} diff --git a/broker/bam/src/ba_impact.cc b/broker/bam/src/ba_impact.cc index 1321935767e..970955e0307 100644 --- a/broker/bam/src/ba_impact.cc +++ b/broker/bam/src/ba_impact.cc @@ -1,24 +1,25 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/bam/ba_impact.hh" #include + #include #include "bbdo/bam/ba_status.hh" @@ -99,7 +100,7 @@ state ba_impact::get_state_soft() const { * * @param[in] impact Impact information. */ -bool ba_impact::_apply_impact(kpi* kpi_ptr __attribute__((unused)), +void ba_impact::_apply_impact(kpi* kpi_ptr [[maybe_unused]], ba::impact_info& impact) { // Adjust values. _acknowledgement_hard += impact.hard_impact.get_acknowledgement(); @@ -108,12 +109,23 @@ bool ba_impact::_apply_impact(kpi* kpi_ptr __attribute__((unused)), _downtime_soft += impact.soft_impact.get_downtime(); if (_dt_behaviour == configuration::ba::dt_ignore_kpi && impact.in_downtime) - return false; - bool retval = impact.hard_impact.get_nominal() != 0 || - impact.soft_impact.get_nominal() != 0; + return; _level_hard -= impact.hard_impact.get_nominal(); _level_soft -= impact.soft_impact.get_nominal(); - return retval; +} + +bool ba_impact::_apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) { + int32_t previous_level = _level_hard; + auto it = _impacts.find(child); + _unapply_impact(child, it->second); + it->second.hard_impact = new_hard_impact; + it->second.soft_impact = new_soft_impact; + it->second.in_downtime = in_downtime; + _apply_impact(child, it->second); + return previous_level != _level_hard; } /** @@ -169,7 +181,7 @@ std::string ba_impact::get_output() const { for (auto it = _impacts.begin(), end = _impacts.end(); it != end; ++it) { if (it->second.hard_impact.get_nominal() > eps) { lst.emplace_back(fmt::format( - "KPI{} (impact: {})", it->first->get_id(), + "KPI {} (impact: {})", it->first->get_name(), static_cast(it->second.hard_impact.get_nominal()))); } } @@ -233,3 +245,23 @@ std::string ba_impact::get_perfdata() const { "BA_Level={};{};{};0;100", static_cast(_normalize(_level_hard)), static_cast(_level_warning), static_cast(_level_critical)); } + +/** + * @brief Recompute all impacts. + * + * This method was created to prevent the real values to derive to + * much from their true value due to the caching system. + */ +void ba_impact::_recompute() { + _acknowledgement_hard = 0.0; + _acknowledgement_soft = 0.0; + _downtime_hard = 0.0; + _downtime_soft = 0.0; + _level_hard = 100.0; + _level_soft = 100.0; + for (std::unordered_map::iterator it = _impacts.begin(), + end = _impacts.end(); + it != end; ++it) + _apply_impact(it->first, it->second); + _recompute_count = 0; +} diff --git a/broker/bam/src/ba_ratio_number.cc b/broker/bam/src/ba_ratio_number.cc index c8218be6bcc..4977e563a29 100644 --- a/broker/bam/src/ba_ratio_number.cc +++ b/broker/bam/src/ba_ratio_number.cc @@ -1,24 +1,25 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/bam/ba_ratio_number.hh" #include + #include #include "bbdo/bam/ba_status.hh" @@ -32,6 +33,8 @@ using namespace com::centreon::broker; using namespace com::centreon::broker::bam; +static constexpr double eps = 0.000001; + /** * Constructor. * @@ -87,21 +90,15 @@ state ba_ratio_number::get_state_soft() const { * * @param[in] impact Impact information. */ -bool ba_ratio_number::_apply_impact(kpi* kpi_ptr __attribute__((unused)), +void ba_ratio_number::_apply_impact(kpi* kpi_ptr [[maybe_unused]], ba::impact_info& impact) { if (_dt_behaviour == configuration::ba::dt_ignore_kpi && impact.in_downtime) - return false; + return; - bool retval = false; - if (impact.soft_impact.get_state() == state_critical) { + if (impact.soft_impact.get_state() == state_critical) _level_soft++; - retval = true; - } - if (impact.hard_impact.get_state() == state_critical) { + if (impact.hard_impact.get_state() == state_critical) _level_hard++; - retval = true; - } - return retval; } /** @@ -111,7 +108,7 @@ bool ba_ratio_number::_apply_impact(kpi* kpi_ptr __attribute__((unused)), */ void ba_ratio_number::_unapply_impact(kpi* kpi_ptr, ba::impact_info& impact - __attribute__((unused))) { + [[maybe_unused]]) { _level_soft = 0.; _level_hard = 0.; @@ -123,14 +120,37 @@ void ba_ratio_number::_unapply_impact(kpi* kpi_ptr, _apply_impact(it->first, it->second); } -void ba_ratio_number::_recompute() { - _level_hard = 0.0; - _level_soft = 0.0f; - for (std::unordered_map::iterator it(_impacts.begin()), - end(_impacts.end()); - it != end; ++it) +/** + * Apply some child changes. This method is more complete than _apply_impact(). + * It takes as argument a child kpi and its impact. This child is already + * known, so its previous impact is replaced by the new one. + * In other words, this method makes almost the same work as _unapply_impact() + * and the _apply_impact() ; the difference is that it returns true if the BA + * really changed. + * + * @param[in] impact Impact information. + * @return True if the BA changes, False otherwise. + */ +bool ba_ratio_number::_apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) { + double previous_level = _level_hard; + _level_soft = 0.; + _level_hard = 0.; + + // We recompute all impact, except the one to unapply... + for (std::unordered_map::iterator it = _impacts.begin(), + end = _impacts.end(); + it != end; ++it) { + if (it->first == child) { + it->second.hard_impact = new_hard_impact; + it->second.soft_impact = new_soft_impact; + it->second.in_downtime = in_downtime; + } _apply_impact(it->first, it->second); - _recompute_count = 0; + } + return std::abs(previous_level - _level_hard) > eps; } /** diff --git a/broker/bam/src/ba_ratio_percent.cc b/broker/bam/src/ba_ratio_percent.cc index da3804df5d6..4c4b2e0fb37 100644 --- a/broker/bam/src/ba_ratio_percent.cc +++ b/broker/bam/src/ba_ratio_percent.cc @@ -1,24 +1,25 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/bam/ba_ratio_percent.hh" #include + #include #include "bbdo/bam/ba_status.hh" @@ -32,6 +33,8 @@ using namespace com::centreon::broker; using namespace com::centreon::broker::bam; +static constexpr double eps = 0.000001; + /** * Constructor. * @@ -89,21 +92,15 @@ state ba_ratio_percent::get_state_soft() const { * * @param[in] impact Impact information. */ -bool ba_ratio_percent::_apply_impact(kpi* kpi_ptr __attribute__((unused)), +void ba_ratio_percent::_apply_impact(kpi* kpi_ptr [[maybe_unused]], ba::impact_info& impact) { if (_dt_behaviour == configuration::ba::dt_ignore_kpi && impact.in_downtime) - return false; + return; - bool retval = false; - if (impact.soft_impact.get_state() == state_critical) { + if (impact.soft_impact.get_state() == state_critical) _level_soft++; - retval = true; - } - if (impact.hard_impact.get_state() == state_critical) { + if (impact.hard_impact.get_state() == state_critical) _level_hard++; - retval = true; - } - return retval; } /** @@ -125,14 +122,37 @@ void ba_ratio_percent::_unapply_impact(kpi* kpi_ptr, _apply_impact(it->first, it->second); } -void ba_ratio_percent::_recompute() { - _level_hard = 0.0; - _level_soft = 0.0; - for (std::unordered_map::iterator it(_impacts.begin()), - end(_impacts.end()); - it != end; ++it) +/** + * Apply some child changes. This method is more complete than _apply_impact(). + * It takes as argument a child kpi and its impact. This child is already + * known, so its previous impact is replaced by the new one. + * In other words, this method makes almost the same work as _unapply_impact() + * and the _apply_impact() ; the difference is that it returns true if the BA + * really changed. + * + * @param[in] impact Impact information. + * @return True if the BA changes, False otherwise. + */ +bool ba_ratio_percent::_apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool in_downtime) { + double previous_level = _level_hard; + _level_soft = 0.; + _level_hard = 0.; + + // We recompute all impact, except the one to unapply... + for (std::unordered_map::iterator it = _impacts.begin(), + end = _impacts.end(); + it != end; ++it) { + if (it->first == child) { + it->second.hard_impact = new_hard_impact; + it->second.soft_impact = new_soft_impact; + it->second.in_downtime = in_downtime; + } _apply_impact(it->first, it->second); - _recompute_count = 0; + } + return std::abs(previous_level - _level_hard) > eps; } /** diff --git a/broker/bam/src/ba_svc_mapping.cc b/broker/bam/src/ba_svc_mapping.cc index 4aff684dac8..88a70e5691f 100644 --- a/broker/bam/src/ba_svc_mapping.cc +++ b/broker/bam/src/ba_svc_mapping.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/ba_worst.cc b/broker/bam/src/ba_worst.cc index 956e8a8e503..2954cfc1326 100644 --- a/broker/bam/src/ba_worst.cc +++ b/broker/bam/src/ba_worst.cc @@ -1,24 +1,25 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2022-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/bam/ba_worst.hh" #include + #include #include "bbdo/bam/ba_status.hh" @@ -96,29 +97,59 @@ state ba_worst::get_state_soft() const { * * @param[in] impact Impact information. */ -bool ba_worst::_apply_impact(kpi* kpi_ptr [[maybe_unused]], +void ba_worst::_apply_impact(kpi* kpi_ptr [[maybe_unused]], ba::impact_info& impact) { - const std::array order{0, 3, 4, 2, 1}; - - auto is_state_worse = [&](short current_state, short new_state) -> bool { + auto is_state_worse = [](short current_state, short new_state) -> bool { + const std::array order{0, 3, 4, 2, 1}; assert((unsigned int)current_state < order.size()); assert((unsigned int)new_state < order.size()); return order[new_state] > order[current_state]; }; if (_dt_behaviour == configuration::ba::dt_ignore_kpi && impact.in_downtime) - return false; + return; - bool retval = false; - if (is_state_worse(_computed_soft_state, impact.soft_impact.get_state())) { + if (is_state_worse(_computed_soft_state, impact.soft_impact.get_state())) _computed_soft_state = impact.soft_impact.get_state(); - retval = true; - } - if (is_state_worse(_computed_hard_state, impact.hard_impact.get_state())) { + if (is_state_worse(_computed_hard_state, impact.hard_impact.get_state())) _computed_hard_state = impact.hard_impact.get_state(); - retval = true; +} + +/** + * @brief Apply some child changes. This method is more complete than + * _apply_impact(). It takes as argument a child kpi and its impact. This child + * is already known, so its previous impact is replaced by the new one. In other + * words, this method makes almost the same work as _unapply_impact() and the + * _apply_impact() ; the difference is that it returns true if the BA really + * changed. + * + * @param child The kpi that changed + * @param new_hard_impact The new hard impact for this child. + * @param new_soft_impact The new soft impact for this child. + * @param child_in_downtime The child is in downtime (or not). + * + * @return True if the BA changes, False otherwise. + */ +bool ba_worst::_apply_changes(kpi* child, + const impact_values& new_hard_impact, + const impact_values& new_soft_impact, + bool child_in_downtime) { + state previous_state = _computed_hard_state; + + _computed_soft_state = _computed_hard_state = state_ok; + + // We recompute all impacts... + for (auto it = _impacts.begin(), end = _impacts.end(); it != end; ++it) { + /* The changed child is updated in _impacts */ + if (it->first == child) { + it->second.hard_impact = new_hard_impact; + it->second.soft_impact = new_soft_impact; + it->second.in_downtime = child_in_downtime; + } + _apply_impact(it->first, it->second); } - return retval; + + return _computed_hard_state != previous_state; } /** @@ -150,8 +181,8 @@ std::string ba_worst::get_output() const { state state = it->second.hard_impact.get_state(); assert(static_cast(state) < 4); if (state != state_ok) { - retval.emplace_back(fmt::format("KPI{} is in {} state", - it->first->get_id(), state_str[state])); + retval.emplace_back(fmt::format( + "KPI {} is in {} state", it->first->get_name(), state_str[state])); } } return retval; @@ -189,11 +220,3 @@ std::string ba_worst::get_output() const { std::string ba_worst::get_perfdata() const { return {}; } - -void ba_worst::_recompute() { - _computed_soft_state = state_ok; - _computed_hard_state = state_ok; - for (auto it = _impacts.begin(), end = _impacts.end(); it != end; ++it) - _apply_impact(it->first, it->second); - _recompute_count = 0; -} diff --git a/broker/bam/src/bool_and.cc b/broker/bam/src/bool_and.cc index b7827e41946..b4bfd08c393 100644 --- a/broker/bam/src/bool_and.cc +++ b/broker/bam/src/bool_and.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_call.cc b/broker/bam/src/bool_call.cc index 61d7e1fc30f..d9ef598ede9 100644 --- a/broker/bam/src/bool_call.cc +++ b/broker/bam/src/bool_call.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_constant.cc b/broker/bam/src/bool_constant.cc index 35306713e33..5db05c3c153 100644 --- a/broker/bam/src/bool_constant.cc +++ b/broker/bam/src/bool_constant.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_equal.cc b/broker/bam/src/bool_equal.cc index 471fcb3d9a9..290b1d59788 100644 --- a/broker/bam/src/bool_equal.cc +++ b/broker/bam/src/bool_equal.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_expression.cc b/broker/bam/src/bool_expression.cc index ddae66dbd62..91786490f2f 100644 --- a/broker/bam/src/bool_expression.cc +++ b/broker/bam/src/bool_expression.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2021-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_less_than.cc b/broker/bam/src/bool_less_than.cc index e2c6ecac6b6..ec6090d4285 100644 --- a/broker/bam/src/bool_less_than.cc +++ b/broker/bam/src/bool_less_than.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2021-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_more_than.cc b/broker/bam/src/bool_more_than.cc index 7b1a65bce18..2f6b25e340a 100644 --- a/broker/bam/src/bool_more_than.cc +++ b/broker/bam/src/bool_more_than.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_not.cc b/broker/bam/src/bool_not.cc index f012089888a..f0b8be0f03c 100644 --- a/broker/bam/src/bool_not.cc +++ b/broker/bam/src/bool_not.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2022-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_not_equal.cc b/broker/bam/src/bool_not_equal.cc index 4879a96d3de..77de82ca2a2 100644 --- a/broker/bam/src/bool_not_equal.cc +++ b/broker/bam/src/bool_not_equal.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2016-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_operation.cc b/broker/bam/src/bool_operation.cc index fb01d18872b..12bef11453b 100644 --- a/broker/bam/src/bool_operation.cc +++ b/broker/bam/src/bool_operation.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_or.cc b/broker/bam/src/bool_or.cc index 0c15a6cbc72..f85d11d3a3e 100644 --- a/broker/bam/src/bool_or.cc +++ b/broker/bam/src/bool_or.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2021, 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_service.cc b/broker/bam/src/bool_service.cc index 406f29cc4fd..deda9bfede3 100644 --- a/broker/bam/src/bool_service.cc +++ b/broker/bam/src/bool_service.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2021-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/bool_value.cc b/broker/bam/src/bool_value.cc index 8979e7a3fd6..a4e7191de70 100644 --- a/broker/bam/src/bool_value.cc +++ b/broker/bam/src/bool_value.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/bool_value.hh" diff --git a/broker/bam/src/bool_xor.cc b/broker/bam/src/bool_xor.cc index 258b52bbcb3..69bf05d54d3 100644 --- a/broker/bam/src/bool_xor.cc +++ b/broker/bam/src/bool_xor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014, 2022-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/computable.cc b/broker/bam/src/computable.cc index b4ebea097bb..af9871894b3 100644 --- a/broker/bam/src/computable.cc +++ b/broker/bam/src/computable.cc @@ -1,5 +1,5 @@ -/* - * Copyright 2014-2023 Centreon +/** + * Copyright 2014-2024 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ */ #include "com/centreon/broker/bam/computable.hh" + #include "com/centreon/broker/log_v2.hh" using namespace com::centreon::broker::bam; @@ -27,6 +28,9 @@ using namespace com::centreon::broker::bam; * @param[in] parent Parent node. */ void computable::add_parent(std::shared_ptr const& parent) { + for (auto it = _parents.begin(), end = _parents.end(); it != end; ++it) + if (it->lock().get() == parent.get()) + return; _parents.push_back(std::weak_ptr(parent)); } diff --git a/broker/bam/src/configuration/applier/ba.cc b/broker/bam/src/configuration/applier/ba.cc index aef6d67e0b5..8442b3e1421 100644 --- a/broker/bam/src/configuration/applier/ba.cc +++ b/broker/bam/src/configuration/applier/ba.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/configuration/applier/ba.hh" diff --git a/broker/bam/src/configuration/applier/bool_expression.cc b/broker/bam/src/configuration/applier/bool_expression.cc index 6c6d938961a..74bc6f13cc2 100644 --- a/broker/bam/src/configuration/applier/bool_expression.cc +++ b/broker/bam/src/configuration/applier/bool_expression.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/bool_expression.hh" diff --git a/broker/bam/src/configuration/applier/kpi.cc b/broker/bam/src/configuration/applier/kpi.cc index 83fb3edd414..568cc914ea3 100644 --- a/broker/bam/src/configuration/applier/kpi.cc +++ b/broker/bam/src/configuration/applier/kpi.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/configuration/applier/kpi.hh" @@ -267,11 +267,12 @@ std::shared_ptr applier::kpi::_new_kpi( std::shared_ptr my_kpi; if (cfg.is_service()) { log_v2::bam()->info( - "BAM: creating new KPI {} of service ({}, {}) impacting BA {}", - cfg.get_id(), cfg.get_host_id(), cfg.get_service_id(), cfg.get_ba_id()); - auto obj{std::make_shared(cfg.get_id(), cfg.get_ba_id(), - cfg.get_host_id(), - cfg.get_service_id())}; + "BAM: creating new KPI {} of service {} ({}, {}) impacting BA {}", + cfg.get_id(), cfg.get_name(), cfg.get_host_id(), cfg.get_service_id(), + cfg.get_ba_id()); + auto obj{std::make_shared( + cfg.get_id(), cfg.get_ba_id(), cfg.get_host_id(), cfg.get_service_id(), + cfg.get_name())}; obj->set_acknowledged(cfg.is_acknowledged()); obj->set_downtimed(cfg.is_downtimed()); obj->set_impact_critical(cfg.get_impact_critical()); @@ -282,21 +283,21 @@ std::shared_ptr applier::kpi::_new_kpi( _book->listen(cfg.get_host_id(), cfg.get_service_id(), obj.get()); my_kpi = std::static_pointer_cast(obj); } else if (cfg.is_ba()) { - log_v2::bam()->info("BAM: creating new KPI {} of BA {} impacting BA {}", - cfg.get_id(), cfg.get_indicator_ba_id(), + log_v2::bam()->info("BAM: creating new KPI {} of BA {}:{} impacting BA {}", + cfg.get_id(), cfg.get_indicator_ba_id(), cfg.get_name(), cfg.get_ba_id()); - std::shared_ptr obj( - std::make_shared(cfg.get_id(), cfg.get_ba_id())); + std::shared_ptr obj(std::make_shared( + cfg.get_id(), cfg.get_ba_id(), cfg.get_name())); obj->set_impact_critical(cfg.get_impact_critical()); obj->set_impact_unknown(cfg.get_impact_unknown()); obj->set_impact_warning(cfg.get_impact_warning()); my_kpi = std::static_pointer_cast(obj); } else if (cfg.is_boolexp()) { log_v2::bam()->info( - "BAM: creating new KPI {} of boolean expression {} impacting BA {}", - cfg.get_id(), cfg.get_boolexp_id(), cfg.get_ba_id()); - std::shared_ptr obj( - std::make_shared(cfg.get_id(), cfg.get_ba_id())); + "BAM: creating new KPI {} of boolean expression {}:{} impacting BA {}", + cfg.get_id(), cfg.get_boolexp_id(), cfg.get_name(), cfg.get_ba_id()); + std::shared_ptr obj(std::make_shared( + cfg.get_id(), cfg.get_ba_id(), cfg.get_name())); obj->set_impact(cfg.get_impact_critical()); my_kpi = std::static_pointer_cast(obj); } else diff --git a/broker/bam/src/configuration/applier/state.cc b/broker/bam/src/configuration/applier/state.cc index b269b173c87..e2b118ec352 100644 --- a/broker/bam/src/configuration/applier/state.cc +++ b/broker/bam/src/configuration/applier/state.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/src/configuration/ba.cc b/broker/bam/src/configuration/ba.cc index 9d70aa50ac7..8749f947202 100644 --- a/broker/bam/src/configuration/ba.cc +++ b/broker/bam/src/configuration/ba.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/configuration/ba.hh" diff --git a/broker/bam/src/configuration/bool_expression.cc b/broker/bam/src/configuration/bool_expression.cc index 3d30656f385..c9cb3bfb043 100644 --- a/broker/bam/src/configuration/bool_expression.cc +++ b/broker/bam/src/configuration/bool_expression.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/configuration/bool_expression.hh" diff --git a/broker/bam/src/configuration/kpi.cc b/broker/bam/src/configuration/kpi.cc index 82b844ba394..fbd6fab817b 100644 --- a/broker/bam/src/configuration/kpi.cc +++ b/broker/bam/src/configuration/kpi.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/configuration/kpi.hh" @@ -41,7 +41,8 @@ kpi::kpi(uint32_t id, bool ignore_acknowledgement, double warning, double critical, - double unknown) + double unknown, + const std::string& name) : _id(id), _state_type(state_type), _host_id(host_id), @@ -57,71 +58,13 @@ kpi::kpi(uint32_t id, _ignore_acknowledgement(ignore_acknowledgement), _impact_warning(warning), _impact_critical(critical), - _impact_unknown(unknown) { + _impact_unknown(unknown), + _name(name) { _event.set_kpi_id(_id); _event.set_ba_id(_ba_id); _event.set_start_time(::time(nullptr)); } -/** - * Copy constructor. - * - * @param[in] other The copy. - */ -kpi::kpi(kpi const& other) - : _id(other._id), - _state_type(other._state_type), - _host_id(other._host_id), - _service_id(other._service_id), - _ba_id(other._ba_id), - _indicator_ba_id(other._indicator_ba_id), - _meta_id(other._meta_id), - _boolexp_id(other._boolexp_id), - _status(other._status), - _downtimed(other._downtimed), - _acknowledged(other._acknowledged), - _ignore_downtime(other._ignore_downtime), - _ignore_acknowledgement(other._ignore_acknowledgement), - _impact_warning(other._impact_warning), - _impact_critical(other._impact_critical), - _impact_unknown(other._impact_unknown), - _event(other._event) {} - -/** - * Destructor. - */ -kpi::~kpi() {} - -/** - * Assignment operator. - * - * @param[in] other The copy. - * - * @return This object. - */ -kpi& kpi::operator=(kpi const& other) { - if (&other != this) { - _id = other._id; - _state_type = other._state_type; - _host_id = other._host_id; - _service_id = other._service_id; - _ba_id = other._ba_id; - _indicator_ba_id = other._indicator_ba_id; - _meta_id = other._meta_id; - _boolexp_id = other._boolexp_id; - _status = other._status; - _downtimed = other._downtimed; - _acknowledged = other._acknowledged; - _ignore_downtime = other._ignore_downtime; - _ignore_acknowledgement = other._ignore_acknowledgement; - _impact_warning = other._impact_warning; - _impact_critical = other._impact_critical; - _impact_unknown = other._impact_unknown; - _event = other._event; - } - return *this; -} - /** * @brief more efficient than MessageDifferencier * diff --git a/broker/bam/src/configuration/reader_v2.cc b/broker/bam/src/configuration/reader_v2.cc index ceb49a5d01c..56f4102cd69 100644 --- a/broker/bam/src/configuration/reader_v2.cc +++ b/broker/bam/src/configuration/reader_v2.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/configuration/reader_v2.hh" @@ -90,7 +90,10 @@ void reader_v2::_load(state::kpis& kpis) { "g.average_impact)," " COALESCE(COALESCE(k.drop_unknown, uu.impact), " "g.average_impact)," - " k.last_state_change, k.in_downtime, k.last_impact" + " k.last_state_change, k.in_downtime, k.last_impact," + " kpiba.name AS ba_name, mbb.name AS boolean_name, " + " CONCAT(hst.host_name, '/', serv.service_description) AS " + "service_name" " FROM mod_bam_kpi AS k" " INNER JOIN mod_bam AS mb" " ON k.id_ba = mb.ba_id" @@ -107,6 +110,14 @@ void reader_v2::_load(state::kpis& kpis) { " WHERE activate='1'" " GROUP BY id_ba) AS g" " ON k.id_ba=g.id_ba" + " LEFT JOIN mod_bam as kpiba" + " ON k.id_indicator_ba=kpiba.ba_id" + " LEFT JOIN mod_bam_boolean AS mbb" + " ON mbb.boolean_id= k.boolean_id" + " LEFT JOIN service as serv" + " ON k.service_id = serv.service_id" + " LEFT JOIN host as hst" + " ON k.host_id = hst.host_id" " WHERE k.activate='1'" " AND mb.activate='1'" " AND pr.poller_id={}", @@ -117,16 +128,28 @@ void reader_v2::_load(state::kpis& kpis) { try { database::mysql_result res(future.get()); while (_mysql.fetch_row(res)) { + std::string kpi_name; + uint32_t service_id = res.value_as_u32(3); + uint32_t boolean_id = res.value_as_u32(7); + uint32_t id_indicator_ba = res.value_as_u32(5); + + if (service_id > 0) + kpi_name = "Service " + res.value_as_str(21); + else if (boolean_id > 0) + kpi_name = "Boolean rule " + res.value_as_str(20); + else + kpi_name = "Business Activity " + res.value_as_str(19); + // KPI object. uint32_t kpi_id(res.value_as_u32(0)); kpis[kpi_id] = kpi(kpi_id, // ID. res.value_as_i32(1), // State type. res.value_as_u32(2), // Host ID. - res.value_as_u32(3), // Service ID. + service_id, // Service ID. res.value_as_u32(4), // BA ID. - res.value_as_u32(5), // BA indicator ID. + id_indicator_ba, // BA indicator ID. res.value_as_u32(6), // Meta-service ID. - res.value_as_u32(7), // Boolean expression ID. + boolean_id, // Boolean expression ID. res.value_as_i32(8), // Status. res.value_as_f32(9), // Downtimed. res.value_as_f32(10), // Acknowledged. @@ -134,7 +157,8 @@ void reader_v2::_load(state::kpis& kpis) { res.value_as_bool(12), // Ignore acknowledgement. res.value_as_f64(13), // Warning. res.value_as_f64(14), // Critical. - res.value_as_f64(15)); // Unknown. + res.value_as_f64(15), // Unknown. + kpi_name); // KPI state. if (!res.value_is_null(16)) { diff --git a/broker/bam/src/configuration/state.cc b/broker/bam/src/configuration/state.cc index 764cf881714..9905c879b47 100644 --- a/broker/bam/src/configuration/state.cc +++ b/broker/bam/src/configuration/state.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/configuration/state.hh" diff --git a/broker/bam/src/connector.cc b/broker/bam/src/connector.cc index 6a2f83f2076..6d33845ade3 100644 --- a/broker/bam/src/connector.cc +++ b/broker/bam/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021, 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021, 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/connector.hh" diff --git a/broker/bam/src/event_cache_visitor.cc b/broker/bam/src/event_cache_visitor.cc index 6242ad6bc4f..57f98fa6675 100644 --- a/broker/bam/src/event_cache_visitor.cc +++ b/broker/bam/src/event_cache_visitor.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/event_cache_visitor.hh" diff --git a/broker/bam/src/exp_builder.cc b/broker/bam/src/exp_builder.cc index df218096b99..923714dba08 100644 --- a/broker/bam/src/exp_builder.cc +++ b/broker/bam/src/exp_builder.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/exp_builder.hh" diff --git a/broker/bam/src/exp_parser.cc b/broker/bam/src/exp_parser.cc index 81bbaa3bc25..3841747d803 100644 --- a/broker/bam/src/exp_parser.cc +++ b/broker/bam/src/exp_parser.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/exp_parser.hh" diff --git a/broker/bam/src/exp_tokenizer.cc b/broker/bam/src/exp_tokenizer.cc index c7536aba439..448c6e10680 100644 --- a/broker/bam/src/exp_tokenizer.cc +++ b/broker/bam/src/exp_tokenizer.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/exp_tokenizer.hh" diff --git a/broker/bam/src/factory.cc b/broker/bam/src/factory.cc index 9ebce4e907e..e7781556bf9 100644 --- a/broker/bam/src/factory.cc +++ b/broker/bam/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2016, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2016, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/factory.hh" diff --git a/broker/bam/src/hst_svc_mapping.cc b/broker/bam/src/hst_svc_mapping.cc index 40ac81ff8ac..70887131558 100644 --- a/broker/bam/src/hst_svc_mapping.cc +++ b/broker/bam/src/hst_svc_mapping.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/hst_svc_mapping.hh" diff --git a/broker/bam/src/impact_values.cc b/broker/bam/src/impact_values.cc index d576fc623fc..7bd1d37b5ee 100644 --- a/broker/bam/src/impact_values.cc +++ b/broker/bam/src/impact_values.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/impact_values.hh" diff --git a/broker/bam/src/kpi.cc b/broker/bam/src/kpi.cc index 02ad2d7d725..03082745f24 100644 --- a/broker/bam/src/kpi.cc +++ b/broker/bam/src/kpi.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/kpi.hh" @@ -29,7 +29,8 @@ static constexpr double eps = 0.000001; /** * Constructor. */ -kpi::kpi(uint32_t kpi_id, uint32_t ba_id) : _id(kpi_id), _ba_id(ba_id) {} +kpi::kpi(uint32_t kpi_id, uint32_t ba_id, const std::string& name) + : _id(kpi_id), _ba_id(ba_id), _name(name) {} /** * Get KPI ID. diff --git a/broker/bam/src/kpi_ba.cc b/broker/bam/src/kpi_ba.cc index 6a154db3867..463447dcd14 100644 --- a/broker/bam/src/kpi_ba.cc +++ b/broker/bam/src/kpi_ba.cc @@ -1,5 +1,5 @@ -/* - * Copyright 2014-2015, 2021-2023 Centreon +/** + * Copyright 2014-2015, 2021-2024 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,8 @@ using namespace com::centreon::broker::bam; /** * Default constructor. */ -kpi_ba::kpi_ba(uint32_t kpi_id, uint32_t ba_id) : kpi(kpi_id, ba_id) {} +kpi_ba::kpi_ba(uint32_t kpi_id, uint32_t ba_id, const std::string& ba_name) + : kpi(kpi_id, ba_id, ba_name) {} /** * Get the impact introduced by a CRITICAL state of the BA. @@ -145,7 +146,7 @@ void kpi_ba::visit(io::stream* visitor) { last_ba_update); } // If state changed, close event and open a new one. - else if (_ba->get_in_downtime() != _event->in_downtime() || + else if (_ba->in_downtime() != _event->in_downtime() || ba_state != _event->status()) { _event->set_end_time(last_ba_update.get_time_t()); visitor->write(std::make_shared(*_event)); @@ -240,7 +241,7 @@ void kpi_ba::_open_new_event(io::stream* visitor, _event->set_start_time(event_start_time.get_time_t()); _event->set_end_time(-1); _event->set_impact_level(impact); - _event->set_in_downtime(_ba->get_in_downtime()); + _event->set_in_downtime(_ba->in_downtime()); _event->set_output(_ba->get_output()); _event->set_perfdata(_ba->get_perfdata()); _event->set_status(com::centreon::broker::State(ba_state)); @@ -263,7 +264,7 @@ bool kpi_ba::ok_state() const { * @return True if this KPI is in downtime. */ bool kpi_ba::in_downtime() const { - return _ba->get_in_downtime(); + return _ba->in_downtime(); } /** @@ -305,7 +306,7 @@ std::string kpi_ba::object_info() const { * @param output An output stream. */ void kpi_ba::dump(std::ofstream& output) const { - output << fmt::format("\"{}\" -> \"{}\"", object_info(), _ba->get_id()); + output << fmt::format("\"{}\" -> \"{}\"", object_info(), _ba->object_info()); _ba->dump(output); dump_parents(output); } diff --git a/broker/bam/src/kpi_boolexp.cc b/broker/bam/src/kpi_boolexp.cc index 4bd64f53af1..7731ac4ac2e 100644 --- a/broker/bam/src/kpi_boolexp.cc +++ b/broker/bam/src/kpi_boolexp.cc @@ -28,8 +28,10 @@ using namespace com::centreon::broker::bam; /** * Default constructor. */ -kpi_boolexp::kpi_boolexp(uint32_t kpi_id, uint32_t ba_id) - : kpi(kpi_id, ba_id) {} +kpi_boolexp::kpi_boolexp(uint32_t kpi_id, + uint32_t ba_id, + const std::string& bool_name) + : kpi(kpi_id, ba_id, bool_name) {} /** * Return true if in downtime. diff --git a/broker/bam/src/kpi_service.cc b/broker/bam/src/kpi_service.cc index 3fe4326aa87..d66ccb2fe50 100644 --- a/broker/bam/src/kpi_service.cc +++ b/broker/bam/src/kpi_service.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2014-2015, 2021-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,8 +42,9 @@ static bool time_is_undefined(uint64_t t) { kpi_service::kpi_service(uint32_t kpi_id, uint32_t ba_id, uint32_t host_id, - uint32_t service_id) - : kpi(kpi_id, ba_id), + uint32_t service_id, + const std::string& host_serv) + : kpi(kpi_id, ba_id, host_serv), _host_id(host_id), _service_id(service_id), _acknowledged(false), @@ -718,8 +719,9 @@ void kpi_service::update_from(computable* child [[maybe_unused]], * @return A multiline strings with various informations. */ std::string kpi_service::object_info() const { - return fmt::format("KPI {} with service ({}, {})\nstate: {}", get_id(), - get_host_id(), get_service_id(), get_state_hard()); + return fmt::format("KPI {} with service ({}, {})\nstate: {}\ndowntime: {}", + get_id(), get_host_id(), get_service_id(), + get_state_hard(), _downtimed); } /** diff --git a/broker/bam/src/main.cc b/broker/bam/src/main.cc index 17c24d5afb3..888485e1490 100644 --- a/broker/bam/src/main.cc +++ b/broker/bam/src/main.cc @@ -1,20 +1,21 @@ -/* -** Copyright 2011-2015, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2015, 2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ + #include "bbdo/bam/ba_duration_event.hh" #include "bbdo/bam/ba_status.hh" #include "bbdo/bam/dimension_ba_bv_relation_event.hh" @@ -169,6 +170,10 @@ void broker_module_init(void const* arg) { e.register_event(bam::pb_dimension_truncate_table_signal::static_type(), "DimensionTruncateTableSignal", &bam::pb_dimension_truncate_table_signal::operations); + /* Let's register the ba_info event to be sure it is declared in case + * brokerrpc is not already instanciated. */ + e.register_event(make_type(io::extcmd, extcmd::de_ba_info), "ba_info", + &extcmd::pb_ba_info::operations); } } } diff --git a/broker/bam/src/reporting_stream.cc b/broker/bam/src/reporting_stream.cc index 267b4067c55..dc7eb59ed2e 100644 --- a/broker/bam/src/reporting_stream.cc +++ b/broker/bam/src/reporting_stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015,2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015,2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/bam/src/service_book.cc b/broker/bam/src/service_book.cc index 49162bdbeef..3144ce54626 100644 --- a/broker/bam/src/service_book.cc +++ b/broker/bam/src/service_book.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/service_book.hh" diff --git a/broker/bam/src/service_listener.cc b/broker/bam/src/service_listener.cc index 91238966b59..d4d033be5aa 100644 --- a/broker/bam/src/service_listener.cc +++ b/broker/bam/src/service_listener.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/service_listener.hh" diff --git a/broker/bam/src/timeperiod_map.cc b/broker/bam/src/timeperiod_map.cc index 5784af8ff55..63f7cb7b39b 100644 --- a/broker/bam/src/timeperiod_map.cc +++ b/broker/bam/src/timeperiod_map.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/timeperiod_map.hh" diff --git a/broker/bam/test/ba/kpi_ba.cc b/broker/bam/test/ba/kpi_ba.cc index e3cae43916b..fe1e517d1f2 100644 --- a/broker/bam/test/ba/kpi_ba.cc +++ b/broker/bam/test/ba/kpi_ba.cc @@ -1,24 +1,26 @@ -/* -** Copyright 2021-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2021-2024 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/bam/kpi_ba.hh" + #include #include + #include "com/centreon/broker/bam/ba_impact.hh" #include "com/centreon/broker/bam/ba_worst.hh" #include "com/centreon/broker/bam/configuration/applier/state.hh" @@ -80,7 +82,8 @@ TEST_F(KpiBA, KpiBa) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -94,11 +97,11 @@ TEST_F(KpiBA, KpiBa) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -158,7 +161,7 @@ TEST_F(KpiBA, KpiBa) { ASSERT_EQ(it->end_time, -1); ASSERT_EQ(test_ba->get_output(), "Status is CRITICAL - At least one KPI is in a CRITICAL state: " - "KPI3 is in CRITICAL state"); + "KPI ba 2 is in CRITICAL state"); /* No perfdata on Worst BA */ ASSERT_EQ(test_ba->get_perfdata(), ""); } @@ -187,7 +190,8 @@ TEST_F(KpiBA, KpiBaPb) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -201,11 +205,11 @@ TEST_F(KpiBA, KpiBaPb) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -285,11 +289,15 @@ TEST_F(KpiBA, KpiBaDt) { test_ba_child->set_name("test-ba-child"); test_ba_child->set_downtime_behaviour(bam::configuration::ba::dt_inherit); - std::vector> kpis; + absl::FixedArray, 2> kpis{ + std::make_shared(1, 2, 3, 1, + fmt::format("service {}", 0)), + std::make_shared(2, 2, 3, 2, + fmt::format("service {}", 1)), + }; /* Construction of kpi_services */ - for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + for (auto& s : kpis) { s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -299,15 +307,14 @@ TEST_F(KpiBA, KpiBaDt) { // test_ba_child->add_impact(s); // s->add_parent(test_ba_child); - kpis.push_back(s); } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -324,9 +331,9 @@ TEST_F(KpiBA, KpiBaDt) { test_ba->add_impact(kpi_ba_child); kpi_ba_child->add_parent(test_ba); - for (int i = 0; i < 2; i++) { - test_ba_child->add_impact(kpis[i]); - kpis[i]->add_parent(test_ba_child); + for (auto& k : kpis) { + test_ba_child->add_impact(k); + k->add_parent(test_ba_child); } time_t now{time(nullptr)}; @@ -369,6 +376,8 @@ TEST_F(KpiBA, KpiBaDt) { /* ba2 set to critical, event open because there was no previous * state */ auto it = events.rbegin(); + + test_ba->dump("/tmp/test_ba.dot"); ASSERT_EQ(it->typ, test_visitor::test_event::ba); ASSERT_EQ(it->ba_id, 1u); ASSERT_TRUE(it->in_downtime); @@ -399,7 +408,8 @@ TEST_F(KpiBA, KpiBaDtPb) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -413,11 +423,11 @@ TEST_F(KpiBA, KpiBaDtPb) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -510,7 +520,8 @@ TEST_F(KpiBA, KpiBaDtOff) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -524,11 +535,11 @@ TEST_F(KpiBA, KpiBaDtOff) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -591,7 +602,7 @@ TEST_F(KpiBA, KpiBaDtOff) { dt->was_started = true; dt->was_cancelled = true; kpis[0]->service_update(dt, _visitor.get()); - ASSERT_TRUE(!test_ba->get_in_downtime()); + ASSERT_TRUE(!test_ba->in_downtime()); auto events = _visitor->queue(); @@ -630,7 +641,8 @@ TEST_F(KpiBA, KpiBaDtOffPb) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -644,11 +656,11 @@ TEST_F(KpiBA, KpiBaDtOffPb) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -717,7 +729,7 @@ TEST_F(KpiBA, KpiBaDtOffPb) { dt_obj.set_cancelled(true); kpis[0]->service_update(dt, _visitor.get()); } - ASSERT_TRUE(!test_ba->get_in_downtime()); + ASSERT_TRUE(!test_ba->in_downtime()); auto events = _visitor->queue(); @@ -756,7 +768,8 @@ TEST_F(KpiBA, KpiBaOkDtOff) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -770,11 +783,11 @@ TEST_F(KpiBA, KpiBaOkDtOff) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -821,7 +834,7 @@ TEST_F(KpiBA, KpiBaOkDtOff) { dt->actual_end_time = -1; dt->was_started = true; kpis[0]->service_update(dt, _visitor.get()); - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); /* Let's remove the downtime from the service. */ dt = std::make_shared(); @@ -833,7 +846,7 @@ TEST_F(KpiBA, KpiBaOkDtOff) { dt->was_started = true; dt->was_cancelled = true; kpis[0]->service_update(dt, _visitor.get()); - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); } /** @@ -860,7 +873,8 @@ TEST_F(KpiBA, KpiBaOkDtOffPb) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -874,11 +888,11 @@ TEST_F(KpiBA, KpiBaOkDtOffPb) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -928,7 +942,7 @@ TEST_F(KpiBA, KpiBaOkDtOffPb) { dt_obj.set_started(true); kpis[0]->service_update(dt, _visitor.get()); } - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); /* Let's remove the downtime from the service. */ dt = std::make_shared(); @@ -943,7 +957,7 @@ TEST_F(KpiBA, KpiBaOkDtOffPb) { dt_obj.set_cancelled(true); kpis[0]->service_update(dt, _visitor.get()); } - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); } /** @@ -974,7 +988,8 @@ TEST_F(KpiBA, KpiBaWorstImpact) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -986,12 +1001,12 @@ TEST_F(KpiBA, KpiBaWorstImpact) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); kpi_ba_child->set_impact_unknown(27); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); @@ -1070,7 +1085,8 @@ TEST_F(KpiBA, KpiBaWorstImpactPb) { /* Construction of kpi_services */ for (int i = 0; i < 2; i++) { - auto s = std::make_shared(i + 1, 2, 3, 1 + i); + auto s = std::make_shared(i + 1, 2, 3, 1 + i, + fmt::format("service {}", i)); s->set_downtimed(false); s->set_impact_critical(100); s->set_impact_unknown(0); @@ -1082,12 +1098,12 @@ TEST_F(KpiBA, KpiBaWorstImpactPb) { } /* Construction of kpi_ba */ - auto kpi_ba_child = std::make_shared(3, 2); + auto kpi_ba_child = std::make_shared(3, 2, "ba 2"); kpi_ba_child->set_impact_critical(100); kpi_ba_child->set_impact_warning(75); kpi_ba_child->set_impact_unknown(27); - auto kpi_ba = std::make_shared(4, 1); + auto kpi_ba = std::make_shared(4, 1, "ba 1"); kpi_ba->set_impact_critical(100); kpi_ba->set_impact_warning(75); diff --git a/broker/bam/test/ba/kpi_service.cc b/broker/bam/test/ba/kpi_service.cc index 7954c41ac00..a0a017bea86 100644 --- a/broker/bam/test/ba/kpi_service.cc +++ b/broker/bam/test/ba/kpi_service.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/kpi_service.hh" @@ -73,7 +73,7 @@ TEST_F(BamBA, KpiServiceRecompute) { test_ba->set_level_warning(25); std::shared_ptr kpi{ - std::make_shared(1, 1, 1, 1)}; + std::make_shared(1, 1, 1, 1, "host_1/serv_1")}; kpi->set_impact_critical(100.0); kpi->set_state_hard(bam::state_ok); @@ -97,7 +97,7 @@ TEST_F(BamBA, KpiServiceRecompute) { /* Here is an occasion to checkout output from ba when it is critical */ ASSERT_EQ(test_ba->get_output(), "Status is CRITICAL - Level = 0 - 1 KPI out of 1 impacts the " - "BA for 100 points - KPI1 (impact: 100)"); + "BA for 100 points - KPI host_1/serv_1 (impact: 100)"); ASSERT_EQ(test_ba->get_perfdata(), "BA_Level=0;25;0;0;100"); } } @@ -128,7 +128,8 @@ TEST_F(BamBA, KpiServiceImpactState) { std::vector results{0, 0, 1, 1, 1, 2}; for (int i = 0; i < 3; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared( + i + 1, 1, i + 1, 1, fmt::format("host_{}/serv_1", i + 1)); s->set_impact_warning(10); s->set_impact_critical(20); s->set_state_hard(bam::state_ok); @@ -165,14 +166,14 @@ TEST_F(BamBA, KpiServiceImpactState) { * totally */ ASSERT_EQ(test_ba->get_output(), "Status is OK - Level = 90 (warn: 70 - crit: 40) - 1 KPI " - "out of 3 impacts the BA: KPI1 (impact: 10)"); + "out of 3 impacts the BA: KPI host_1/serv_1 (impact: 10)"); ASSERT_EQ(test_ba->get_perfdata(), "BA_Level=90;70;40;0;100"); } else if (j == 2) { /* Here is an occasion to test get_output for a status WARNING */ std::regex re( "Status is WARNING - Level = 70 - 3 KPIs out of 3 impact " - "the BA for 30 points - KPI. \\(impact: 10\\), KPI. \\(impact: " - "10\\), KPI. \\(impact: 10\\)"); + "the BA for 30 points - KPI.+ \\(impact: 10\\), KPI.+ \\(impact: " + "10\\), KPI.+ \\(impact: 10\\)"); ASSERT_TRUE(std::regex_search(test_ba->get_output(), re)); ASSERT_EQ(test_ba->get_perfdata(), "BA_Level=70;70;40;0;100"); } @@ -248,7 +249,8 @@ TEST_F(BamBA, KpiServiceBestState) { std::vector results{0, 0, 1, 1, 1, 2}; for (size_t i = 0; i < 3; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_ok); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -305,7 +307,8 @@ TEST_F(BamBA, KpiServiceWorstState) { std::vector results{1, 1, 1, 2, 2, 2}; for (int i = 0; i < 3; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_impact_warning(10); s->set_impact_critical(20); s->set_state_hard(bam::state_ok); @@ -403,7 +406,8 @@ TEST_F(BamBA, KpiServiceRatioNum) { std::stack results{{2, 1, 1, 0}}; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_ok); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -459,7 +463,8 @@ TEST_F(BamBA, KpiServiceRatioPercent) { std::stack results({2, 1, 0, 0}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_ok); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -500,7 +505,8 @@ TEST_F(BamBA, KpiServiceDtInheritAllCritical) { std::stack results({true, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -531,7 +537,7 @@ TEST_F(BamBA, KpiServiceDtInheritAllCritical) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } } @@ -547,7 +553,8 @@ TEST_F(BamBA, KpiServiceDtInheritAllCriticalPb) { std::stack results({true, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -580,7 +587,7 @@ TEST_F(BamBA, KpiServiceDtInheritAllCriticalPb) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } } @@ -596,7 +603,8 @@ TEST_F(BamBA, KpiServiceDtInheritOneOK) { std::stack results({false, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); if (i == 0) s->set_state_hard(bam::state_ok); else @@ -631,7 +639,7 @@ TEST_F(BamBA, KpiServiceDtInheritOneOK) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } @@ -651,7 +659,8 @@ TEST_F(BamBA, KpiServiceDtInheritOneOKPb) { std::stack results({false, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); if (i == 0) s->set_state_hard(bam::state_ok); else @@ -688,7 +697,7 @@ TEST_F(BamBA, KpiServiceDtInheritOneOKPb) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } @@ -708,7 +717,8 @@ TEST_F(BamBA, KpiServiceIgnoreDt) { std::stack results({false, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -739,7 +749,7 @@ TEST_F(BamBA, KpiServiceIgnoreDt) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } } @@ -755,7 +765,8 @@ TEST_F(BamBA, KpiServiceIgnoreDtPb) { std::stack results({false, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -789,7 +800,7 @@ TEST_F(BamBA, KpiServiceIgnoreDtPb) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } } @@ -805,7 +816,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpi) { std::stack results({false, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -836,7 +848,7 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpi) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } } @@ -852,7 +864,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiPb) { std::stack results({false, false, false, false}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -886,7 +899,7 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiPb) { kpis[j]->service_update(dt, _visitor.get()); short val = results.top(); - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); results.pop(); } } @@ -907,7 +920,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiImpact) { results.push(2); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); if (i == 3) s->set_state_hard(bam::state_ok); else @@ -961,7 +975,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiImpactPb) { std::stack results({0, 0, 1, 2}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); if (i == 3) s->set_state_hard(bam::state_ok); else @@ -1016,7 +1031,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiBest) { std::stack results({0, 2, 1, 0}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); switch (i) { case 0: case 1: @@ -1072,7 +1088,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiBestPb) { std::stack results({0, 2, 1, 0}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); switch (i) { case 0: case 1: @@ -1132,7 +1149,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiWorst) { std::stack results({0, 0, 1, 2}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); switch (i) { case 0: case 1: @@ -1188,7 +1206,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiWorstPb) { std::stack results({0, 0, 1, 2}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); switch (i) { case 0: case 1: @@ -1249,7 +1268,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiRatio) { std::stack results({0, 1, 2, 2}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1296,7 +1316,8 @@ TEST_F(BamBA, KpiServiceDtIgnoreKpiRatioPb) { std::stack results({0, 1, 2, 2}); for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1347,7 +1368,8 @@ TEST_F(BamBA, KpiServiceDt) { std::vector results{false, false, false, true}; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1379,7 +1401,7 @@ TEST_F(BamBA, KpiServiceDt) { kpis[j]->service_update(dt, _visitor.get()); short val = *it; - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); ++it; } @@ -1493,7 +1515,7 @@ TEST_F(BamBA, KpiServiceDt) { ++it; } while (it->typ != test_visitor::test_event::kpi); } - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); } TEST_F(BamBA, KpiServiceDtPb) { @@ -1507,7 +1529,8 @@ TEST_F(BamBA, KpiServiceDtPb) { std::vector results{false, false, false, true}; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1542,7 +1565,7 @@ TEST_F(BamBA, KpiServiceDtPb) { kpis[j]->service_update(dt, _visitor.get()); short val = *it; - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); ++it; } @@ -1656,7 +1679,7 @@ TEST_F(BamBA, KpiServiceDtPb) { ++it; } while (it->typ != test_visitor::test_event::kpi); } - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); } TEST_F(BamBA, KpiServiceDtInherited_set) { @@ -1670,7 +1693,8 @@ TEST_F(BamBA, KpiServiceDtInherited_set) { std::vector results{false, false, false, true}; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1702,7 +1726,7 @@ TEST_F(BamBA, KpiServiceDtInherited_set) { kpis[j]->service_update(dt, _visitor.get()); short val = *it; - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); ++it; } @@ -1714,7 +1738,7 @@ TEST_F(BamBA, KpiServiceDtInherited_set) { dt->was_started = true; kpis[0]->service_update(dt, _visitor.get()); } - ASSERT_TRUE(test_ba->get_in_downtime()); + ASSERT_TRUE(test_ba->in_downtime()); } TEST_F(BamBA, KpiServiceDtInherited_setPb) { @@ -1728,7 +1752,8 @@ TEST_F(BamBA, KpiServiceDtInherited_setPb) { std::vector results{false, false, false, true}; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1763,7 +1788,7 @@ TEST_F(BamBA, KpiServiceDtInherited_setPb) { kpis[j]->service_update(dt, _visitor.get()); short val = *it; - ASSERT_EQ(test_ba->get_in_downtime(), val); + ASSERT_EQ(test_ba->in_downtime(), val); ++it; } @@ -1775,7 +1800,7 @@ TEST_F(BamBA, KpiServiceDtInherited_setPb) { dt_obj.set_started(true); kpis[0]->service_update(dt, _visitor.get()); } - ASSERT_TRUE(test_ba->get_in_downtime()); + ASSERT_TRUE(test_ba->in_downtime()); } TEST_F(BamBA, KpiServiceDtInherited_unset) { @@ -1788,7 +1813,8 @@ TEST_F(BamBA, KpiServiceDtInherited_unset) { std::vector> kpis; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1820,7 +1846,7 @@ TEST_F(BamBA, KpiServiceDtInherited_unset) { kpis[j]->service_update(dt, _visitor.get()); } - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); } TEST_F(BamBA, KpiServiceDtInherited_unsetPb) { @@ -1833,7 +1859,8 @@ TEST_F(BamBA, KpiServiceDtInherited_unsetPb) { std::vector> kpis; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1866,7 +1893,7 @@ TEST_F(BamBA, KpiServiceDtInherited_unsetPb) { kpis[j]->service_update(dt, _visitor.get()); } - ASSERT_FALSE(test_ba->get_in_downtime()); + ASSERT_FALSE(test_ba->in_downtime()); } TEST_F(BamBA, KpiServiceAcknowledgement) { @@ -1879,7 +1906,8 @@ TEST_F(BamBA, KpiServiceAcknowledgement) { std::vector> kpis; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); @@ -1926,7 +1954,8 @@ TEST_F(BamBA, KpiServiceAcknowledgementPb) { std::vector> kpis; for (int i = 0; i < 4; i++) { - auto s = std::make_shared(i + 1, 1, i + 1, 1); + auto s = std::make_shared(i + 1, 1, i + 1, 1, + fmt::format("service {}", i)); s->set_state_hard(bam::state_critical); s->set_state_soft(s->get_state_hard()); test_ba->add_impact(s); diff --git a/broker/bam/test/configuration/applier-boolexp.cc b/broker/bam/test/configuration/applier-boolexp.cc index 60659b4763c..277c913ef33 100644 --- a/broker/bam/test/configuration/applier-boolexp.cc +++ b/broker/bam/test/configuration/applier-boolexp.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2018 Centreon ** ** Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/bam/test/exp_builder/availability_builder.cc b/broker/bam/test/exp_builder/availability_builder.cc index 4dae1d48d0c..9f92361f8e4 100644 --- a/broker/bam/test/exp_builder/availability_builder.cc +++ b/broker/bam/test/exp_builder/availability_builder.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/availability_builder.hh" #include diff --git a/broker/bam/test/exp_builder/exp_builder.cc b/broker/bam/test/exp_builder/exp_builder.cc index b9c9e186605..17962d5f824 100644 --- a/broker/bam/test/exp_builder/exp_builder.cc +++ b/broker/bam/test/exp_builder/exp_builder.cc @@ -638,7 +638,7 @@ TEST_F(BamExpBuilder, KpiBoolexpWithService) { exp->set_expression(b); b->add_parent(exp); - auto kpi = std::make_shared(1, 1); + auto kpi = std::make_shared(1, 1, "test_boool_exp"); kpi->link_boolexp(exp); exp->add_parent(kpi); @@ -682,7 +682,7 @@ TEST_F(BamExpBuilder, KpiBoolexpReversedImpactWithService) { exp->set_expression(b); b->add_parent(exp); - auto kpi = std::make_shared(1, 1); + auto kpi = std::make_shared(1, 1, "test_boool_exp"); kpi->link_boolexp(exp); exp->add_parent(kpi); @@ -902,7 +902,7 @@ TEST_F(BamExpBuilder, BoolexpKpiServiceAndBoolExpression) { exp->set_expression(b); b->add_parent(exp); - auto kpi = std::make_shared(1, 1); + auto kpi = std::make_shared(1, 1, "test_boool_exp"); kpi->set_impact(100); kpi->link_boolexp(exp); exp->add_parent(kpi); @@ -1008,7 +1008,7 @@ TEST_F(BamExpBuilder, BoolexpKpiServiceAndBoolExpressionAndOperator) { exp->set_expression(b); b->add_parent(exp); - auto kpi = std::make_shared(1, 1); + auto kpi = std::make_shared(1, 1, "test_boool_exp"); kpi->set_impact(100); kpi->link_boolexp(exp); exp->add_parent(kpi); diff --git a/broker/bam/test/exp_parser/get_postfix.cc b/broker/bam/test/exp_parser/get_postfix.cc index 43a6557aa49..847e08f4dc2 100644 --- a/broker/bam/test/exp_parser/get_postfix.cc +++ b/broker/bam/test/exp_parser/get_postfix.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/bam/test/exp_tokenizer/next.cc b/broker/bam/test/exp_tokenizer/next.cc index 429947db89a..575181737b5 100644 --- a/broker/bam/test/exp_tokenizer/next.cc +++ b/broker/bam/test/exp_tokenizer/next.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/bam/test/monitoring_stream.cc b/broker/bam/test/monitoring_stream.cc index d59e8745357..b40d0ef5fd9 100644 --- a/broker/bam/test/monitoring_stream.cc +++ b/broker/bam/test/monitoring_stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bam/monitoring_stream.hh" diff --git a/broker/bam/test/test-visitor.hh b/broker/bam/test/test-visitor.hh index 59d2ba1b420..973843acd7d 100644 --- a/broker/bam/test/test-visitor.hh +++ b/broker/bam/test/test-visitor.hh @@ -26,7 +26,7 @@ #include "com/centreon/broker/bam/internal.hh" #include "com/centreon/broker/io/stream.hh" -CCB_BEGIN() +namespace com::centreon::broker { class test_visitor : public io::stream { public: class test_event { @@ -148,6 +148,6 @@ class test_visitor : public io::stream { } } }; -CCB_END() +} #endif // !CCB_TEST_VISITOR_HH diff --git a/broker/bam/test/time/check_timeperiod.cc b/broker/bam/test/time/check_timeperiod.cc index c5da7f935ed..634c7c87eee 100644 --- a/broker/bam/test/time/check_timeperiod.cc +++ b/broker/bam/test/time/check_timeperiod.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/core/inc/com/centreon/broker/bbdo/acceptor.hh b/broker/core/inc/com/centreon/broker/bbdo/acceptor.hh index e5e02f78a46..66ecb05f7ae 100644 --- a/broker/core/inc/com/centreon/broker/bbdo/acceptor.hh +++ b/broker/core/inc/com/centreon/broker/bbdo/acceptor.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2013,2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013,2015,2017-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BBDO_ACCEPTOR_HH #define CCB_BBDO_ACCEPTOR_HH @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/endpoint.hh" #include "com/centreon/broker/io/extension.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. namespace processing { @@ -47,15 +47,14 @@ class acceptor : public io::endpoint { time_t _timeout; uint32_t _ack_limit; std::list> _extensions; + const bool _grpc_serialized; public: - acceptor(std::string name, - bool negotiate, - time_t timeout, - bool one_peer_retention_mode = false, - bool coarse = false, + acceptor(std::string name, bool negotiate, time_t timeout, + bool one_peer_retention_mode = false, bool coarse = false, uint32_t ack_limit = 1000, - std::list>&& extensions = {}); + std::list>&& extensions = {}, + bool grpc_serialized = false); ~acceptor() noexcept; acceptor(const acceptor&) = delete; acceptor& operator=(const acceptor&) = delete; @@ -70,6 +69,6 @@ class acceptor : public io::endpoint { }; } // namespace bbdo -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_BBDO_ACCEPTOR_HH diff --git a/broker/core/inc/com/centreon/broker/bbdo/connector.hh b/broker/core/inc/com/centreon/broker/bbdo/connector.hh index eb949126ba7..934938bdb84 100644 --- a/broker/core/inc/com/centreon/broker/bbdo/connector.hh +++ b/broker/core/inc/com/centreon/broker/bbdo/connector.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2013,2015,2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013,2015,2017, 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BBDO_CONNECTOR_HH #define CCB_BBDO_CONNECTOR_HH @@ -22,9 +22,8 @@ #include "com/centreon/broker/io/endpoint.hh" #include "com/centreon/broker/io/extension.hh" -CCB_BEGIN() +namespace com::centreon::broker::bbdo { -namespace bbdo { /** * @class connector connector.hh "com/centreon/broker/bbdo/connector.hh" * @brief BBDO connector. @@ -38,23 +37,20 @@ class connector : public io::endpoint { time_t _timeout; uint32_t _ack_limit; std::list> _extensions; + const bool _grpc_serialized; std::shared_ptr _open(std::shared_ptr stream); public: - connector(bool negotiate, - time_t timeout, - bool connector_is_input, - bool coarse = false, - uint32_t ack_limit = 1000, - std::list>&& extensions = {}); + connector(bool negotiate, time_t timeout, bool connector_is_input, + bool coarse = false, uint32_t ack_limit = 1000, + std::list>&& extensions = {}, + bool grpc_serialized = false); ~connector() noexcept = default; connector(const connector&) = delete; connector& operator=(const connector&) = delete; std::shared_ptr open() override; }; -} // namespace bbdo - -CCB_END() +} // namespace com::centreon::broker::bbdo #endif // !CCB_BBDO_CONNECTOR_HH diff --git a/broker/core/inc/com/centreon/broker/bbdo/factory.hh b/broker/core/inc/com/centreon/broker/bbdo/factory.hh index 60787db2a65..ad38b720071 100644 --- a/broker/core/inc/com/centreon/broker/bbdo/factory.hh +++ b/broker/core/inc/com/centreon/broker/bbdo/factory.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BBDO_FACTORY_HH #define CCB_BBDO_FACTORY_HH @@ -22,9 +22,8 @@ #include "com/centreon/broker/io/extension.hh" #include "com/centreon/broker/io/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker::bbdo { -namespace bbdo { /** * @class factory factory.hh "com/centreon/broker/bbdo/factory.hh" * @brief BBDO protocol factory. @@ -42,13 +41,10 @@ class factory : public io::factory { factory& operator=(factory const& other) = delete; bool has_endpoint(config::endpoint& cfg, io::extension* ext) override; io::endpoint* new_endpoint( - config::endpoint& cfg, - bool& is_acceptor, + config::endpoint& cfg, bool& is_acceptor, std::shared_ptr cache = std::shared_ptr()) const override; }; -} // namespace bbdo - -CCB_END() +} // namespace com::centreon::broker::bbdo #endif // !CCB_BBDO_FACTORY_HH diff --git a/broker/core/inc/com/centreon/broker/bbdo/internal.hh b/broker/core/inc/com/centreon/broker/bbdo/internal.hh index 454bf35d2b5..440ce2e182f 100644 --- a/broker/core/inc/com/centreon/broker/bbdo/internal.hh +++ b/broker/core/inc/com/centreon/broker/bbdo/internal.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2013,2017,2020-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013,2017,2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BBDO_INTERNAL_HH #define CCB_BBDO_INTERNAL_HH @@ -23,16 +23,14 @@ #include "bbdo/events.hh" #include "bbdo/extcmd.pb.h" #include "com/centreon/broker/io/protobuf.hh" -#include "com/centreon/broker/namespace.hh" #define BBDO_VERSION_MAJOR 2 #define BBDO_VERSION_MINOR 0 #define BBDO_VERSION_PATCH 0 constexpr uint32_t BBDO_HEADER_SIZE = 16u; -CCB_BEGIN() +namespace com::centreon::broker::bbdo { -namespace bbdo { using pb_welcome = com::centreon::broker::io::protobuf; @@ -45,14 +43,14 @@ using pb_stop = com::centreon::broker::io::protobuf; -using pb_bench = com::centreon::broker::io:: - protobuf; +using pb_bench = + com::centreon::broker::io::protobuf; // Load/unload of BBDO protocol. void load(); void unload(); -} // namespace bbdo -CCB_END() +} // namespace com::centreon::broker::bbdo #endif // !CCB_BBDO_INTERNAL_HH diff --git a/broker/core/inc/com/centreon/broker/bbdo/stream.hh b/broker/core/inc/com/centreon/broker/bbdo/stream.hh index 31afbd3f7e9..264e0b4e440 100644 --- a/broker/core/inc/com/centreon/broker/bbdo/stream.hh +++ b/broker/core/inc/com/centreon/broker/bbdo/stream.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2013,2017-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013,2017-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_BBDO_STREAM_HH #define CCB_BBDO_STREAM_HH @@ -23,9 +23,7 @@ #include "com/centreon/broker/io/extension.hh" #include "com/centreon/broker/io/stream.hh" -CCB_BEGIN() - -namespace bbdo { +namespace com::centreon::broker::bbdo { /** * @class stream stream.hh "com/centreon/broker/bbdo/stream.hh" * @brief BBDO stream. @@ -64,9 +62,7 @@ class stream : public io::stream { std::deque> _buf; public: - buffer(uint32_t event_id, - uint32_t source_id, - uint32_t dest_id, + buffer(uint32_t event_id, uint32_t source_id, uint32_t dest_id, std::vector&& v) : _event_id(event_id), _source_id(source_id), _dest_id(dest_id) { _buf.push_back(v); @@ -90,8 +86,7 @@ class stream : public io::stream { } ~buffer() noexcept = default; - bool matches(uint32_t event_id, - uint32_t source_id, + bool matches(uint32_t event_id, uint32_t source_id, uint32_t dest_id) const noexcept { return event_id == _event_id && source_id == _source_id && dest_id == _dest_id; @@ -99,12 +94,10 @@ class stream : public io::stream { std::vector to_vector() { size_t s = 0; - for (auto& v : _buf) - s += v.size(); + for (auto& v : _buf) s += v.size(); std::vector retval; retval.reserve(s); - for (auto& v : _buf) - retval.insert(retval.end(), v.begin(), v.end()); + for (auto& v : _buf) retval.insert(retval.end(), v.begin(), v.end()); _buf.clear(); return retval; } @@ -137,6 +130,14 @@ class stream : public io::stream { uint32_t _ack_limit; uint32_t _events_received_since_last_ack; time_t _last_sent_ack; + const bool _grpc_serialized; + + /** + * @brief when we bypass bbdo serialization, we store object received by grpc + * layer in this queue + * + */ + std::deque> _grpc_serialized_queue; /** * It is possible to mix bbdo stream with others like tls or compression. @@ -156,7 +157,7 @@ class stream : public io::stream { public: enum negotiation_type { negotiate_first = 1, negotiate_second, negotiated }; - stream(bool is_input, + stream(bool is_input, bool grpc_serialized = false, const std::list>& extensions = {}); ~stream(); stream(const stream&) = delete; @@ -176,8 +177,6 @@ class stream : public io::stream { void send_event_acknowledgement(); std::list get_running_config(); }; -} // namespace bbdo - -CCB_END() +} // namespace com::centreon::broker::bbdo #endif // !CCB_BBDO_STREAM_HH diff --git a/broker/core/inc/com/centreon/broker/broker_impl.hh b/broker/core/inc/com/centreon/broker/broker_impl.hh index db15ca2c6ff..2b919a43dbd 100644 --- a/broker/core/inc/com/centreon/broker/broker_impl.hh +++ b/broker/core/inc/com/centreon/broker/broker_impl.hh @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020-2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,9 +23,8 @@ #include "broker.grpc.pb.h" #include "broker/core/src/broker.pb.h" #include "com/centreon/broker/io/protobuf.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * Here is a declaration of pb_rebuild_graphs which is a bbdo event we use @@ -124,6 +123,6 @@ class broker_impl final : public Broker::Service { public: void set_broker_name(const std::string& s); }; -CCB_END() +} // namespace com::centreon::broker #endif // CENTREON_BROKER_CORE_SRC_BROKERIMPL_HH_ diff --git a/broker/core/inc/com/centreon/broker/brokerrpc.hh b/broker/core/inc/com/centreon/broker/brokerrpc.hh index 8f01b19c961..a5fa349b3b3 100644 --- a/broker/core/inc/com/centreon/broker/brokerrpc.hh +++ b/broker/core/inc/com/centreon/broker/brokerrpc.hh @@ -1,5 +1,5 @@ -/* - * Copyright 2020-2021 Centreon (https://www.centreon.com/) +/** + * Copyright 2020-2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,10 @@ #define CENTREON_BROKER_CORE_SRC_BROKERRPC_HH_ #include + #include "com/centreon/broker/broker_impl.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class brokerrpc brokerrpc.hh "com/centreon/broker/brokerrpc.hh" @@ -35,8 +35,7 @@ class brokerrpc final { std::unique_ptr _server; public: - brokerrpc(const std::string& address, - uint16_t port, + brokerrpc(const std::string& address, uint16_t port, std::string const& broker_name); brokerrpc() = delete; brokerrpc(const brokerrpc&) = delete; @@ -44,6 +43,6 @@ class brokerrpc final { void shutdown(); }; -CCB_END() +} // namespace com::centreon::broker #endif // CENTREON_BROKER_CORE_SRC_BROKERRPC_HH_ diff --git a/broker/core/inc/com/centreon/broker/cache/global_cache.hh b/broker/core/inc/com/centreon/broker/cache/global_cache.hh index e28ab1523bd..a5981da910b 100644 --- a/broker/core/inc/com/centreon/broker/cache/global_cache.hh +++ b/broker/core/inc/com/centreon/broker/cache/global_cache.hh @@ -20,9 +20,8 @@ #define CCB_GLOBAL_CACHE_HH #include "bbdo/tag.pb.h" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace cache { @@ -48,11 +47,11 @@ using string = using host_serv_pair = std::pair; -inline bool operator==(const string& left, const absl::string_view& right) { +inline bool operator==(const string& left, const std::string_view& right) { return left.compare(0, right.length(), right.data()) == 0; } -inline bool operator!=(const string& left, const absl::string_view& right) { +inline bool operator!=(const string& left, const std::string_view& right) { return left.compare(0, right.length(), right.data()) != 0; } @@ -80,7 +79,7 @@ struct metric_info { struct resource_info { resource_info(const char_allocator& char_alloc) : name(char_alloc) {} - resource_info(const absl::string_view& nam, + resource_info(const std::string_view& nam, uint64_t res_id, uint64_t sev_id, @@ -114,7 +113,7 @@ struct resource_info { * When you insert data, you must catch interprocess::bad_allo and call * allocation_exception_handler to grow file outside any lock * @code {.c++} - * void global_cache_data::add_service_group(uint64_t group, + * void global_cache_data::add_service_to_group(uint64_t group, * uint64_t host, * uint64_t service) { * try { @@ -123,7 +122,7 @@ struct resource_info { * } catch (const interprocess::bad_alloc& e) { * SPDLOG_LOGGER_DEBUG(log_v2::core(), "file full => grow"); * allocation_exception_handler(); - * add_service_group(group, host, service); + * add_service_to_group(group, host, service); * } *} * @endcode @@ -150,7 +149,7 @@ class global_cache : public std::enable_shared_from_this { void allocation_exception_handler(); - virtual void managed_map(bool create) {} + virtual void managed_map(bool create [[maybe_unused]]) {} public: using pointer = std::shared_ptr; @@ -182,13 +181,13 @@ class global_cache : public std::enable_shared_from_this { virtual void set_metric_info(uint64_t metric_id, uint64_t index_id, - const absl::string_view& name, - const absl::string_view& unit, + const std::string_view& name, + const std::string_view& unit, double min, double max) = 0; virtual void store_instance(uint64_t instance_id, - const absl::string_view& instance_name) = 0; + const std::string_view& instance_name) = 0; /** * @brief As we don't have access to the repeated TagInfo type, we fill @@ -197,13 +196,13 @@ class global_cache : public std::enable_shared_from_this { */ virtual void store_host(uint64_t host_id, - const absl::string_view& host_name, + const std::string_view& host_name, uint64_t resource_id, uint64_t severity_id) = 0; virtual void store_service(uint64_t host_id, uint64_t service_id, - const absl::string_view& service_description, + const std::string_view& service_description, uint64_t resource_id, uint64_t severity_id) = 0; @@ -225,17 +224,22 @@ class global_cache : public std::enable_shared_from_this { virtual const string* get_instance_name(uint64_t instance_id) const = 0; - virtual void add_host_group(uint64_t group, uint64_t host) = 0; + virtual void add_host_to_group(uint64_t group, + uint64_t host, + uint64_t poller_id) = 0; virtual void remove_host_from_group(uint64_t group, uint64_t host) = 0; - virtual void remove_host_group(uint64_t group) = 0; + virtual void remove_host_group_members(uint64_t group, + uint64_t poller_id) = 0; - virtual void add_service_group(uint64_t group, - uint64_t host, - uint64_t service) = 0; + virtual void add_service_to_group(uint64_t group, + uint64_t host, + uint64_t service, + uint64_t poller_id) = 0; virtual void remove_service_from_group(uint64_t group, uint64_t host, uint64_t service) = 0; - virtual void remove_service_group(uint64_t group) = 0; + virtual void remove_service_group_members(uint64_t group, + uint64_t poller_id) = 0; virtual void append_service_group(uint64_t host, uint64_t service, @@ -243,7 +247,7 @@ class global_cache : public std::enable_shared_from_this { virtual void append_host_group(uint64_t host, std::ostream& request_body) = 0; virtual void add_tag(uint64_t tag_id, - const absl::string_view& tag_name, + const std::string_view& tag_name, TagType tag_type, uint64_t poller_id) = 0; @@ -273,6 +277,6 @@ class global_cache : public std::enable_shared_from_this { }; // namespace cache -CCB_END() +} // namespace com::centreon::broker #endif diff --git a/broker/core/inc/com/centreon/broker/cache/global_cache_data.hh b/broker/core/inc/com/centreon/broker/cache/global_cache_data.hh index c7fa3fe92b6..2a59da41ef4 100644 --- a/broker/core/inc/com/centreon/broker/cache/global_cache_data.hh +++ b/broker/core/inc/com/centreon/broker/cache/global_cache_data.hh @@ -30,7 +30,7 @@ #include "global_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace cache { @@ -42,22 +42,22 @@ namespace multi_index = boost::multi_index; * */ struct string_string_view_equal { - bool operator()(const string& left, const absl::string_view& right) const { + bool operator()(const string& left, const std::string_view& right) const { return left.compare(0, right.length(), right.data()) == 0; } - bool operator()(const absl::string_view& left, const string& right) const { + bool operator()(const std::string_view& left, const string& right) const { return right.compare(0, left.length(), left.data()) == 0; } }; struct string_string_view_hash { size_t operator()(const string& left) const { - return absl::Hash()( - absl::string_view(left.c_str(), left.length())); + return absl::Hash()( + std::string_view(left.c_str(), left.length())); } - size_t operator()(const absl::string_view& left) const { - return absl::Hash()(left); + size_t operator()(const std::string_view& left) const { + return absl::Hash()(left); } }; @@ -107,6 +107,7 @@ class global_cache_data : public global_cache { struct host_group_element { uint64_t host; uint64_t group; + uint64_t poller_id; inline bool operator<(const host_group_element& right) const { if (host != right.host) { return host < right.host; @@ -129,6 +130,7 @@ class global_cache_data : public global_cache { struct service_group_element { host_serv_pair serv; uint64_t group; + uint64_t poller_id; inline bool operator<(const service_group_element& right) const { if (serv != right.serv) { return serv < right.serv; @@ -229,22 +231,22 @@ class global_cache_data : public global_cache { void set_metric_info(uint64_t metric_id, uint64_t index_id, - const absl::string_view& name, - const absl::string_view& unit, + const std::string_view& name, + const std::string_view& unit, double min, double max) override; void store_instance(uint64_t instance_id, - const absl::string_view& instance_name) override; + const std::string_view& instance_name) override; void store_host(uint64_t host_id, - const absl::string_view& host_name, + const std::string_view& host_name, uint64_t resource_id, uint64_t severity_id) override; void store_service(uint64_t host_id, uint64_t service_id, - const absl::string_view& service_description, + const std::string_view& service_description, uint64_t resource_id, uint64_t severity_id) override; @@ -265,17 +267,22 @@ class global_cache_data : public global_cache { const string* get_instance_name(uint64_t instance_id) const override; - virtual void add_host_group(uint64_t group, uint64_t host) override; + virtual void add_host_to_group(uint64_t group, + uint64_t host, + uint64_t poller_id) override; virtual void remove_host_from_group(uint64_t group, uint64_t host) override; - virtual void remove_host_group(uint64_t group) override; + virtual void remove_host_group_members(uint64_t group, + uint64_t poller_id) override; - virtual void add_service_group(uint64_t group, - uint64_t host, - uint64_t service) override; + virtual void add_service_to_group(uint64_t group, + uint64_t host, + uint64_t service, + uint64_t poller_id) override; virtual void remove_service_from_group(uint64_t group, uint64_t host, uint64_t service) override; - virtual void remove_service_group(uint64_t group) override; + virtual void remove_service_group_members(uint64_t group, + uint64_t poller_id) override; virtual void append_service_group(uint64_t host, uint64_t service, std::ostream& request_body) override; @@ -283,7 +290,7 @@ class global_cache_data : public global_cache { std::ostream& request_body) override; void add_tag(uint64_t tag_id, - const absl::string_view& tag_name, + const std::string_view& tag_name, TagType tag_type, uint64_t poller_id) override; @@ -310,6 +317,6 @@ class global_cache_data : public global_cache { }; // namespace cache -CCB_END() +} // namespace com::centreon::broker #endif diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_deserializer.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_deserializer.hh index 2518a0d8d9b..76e55fb864b 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_deserializer.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_deserializer.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/ceof/ceof_iterator.hh" #include "com/centreon/broker/ceof/ceof_visitor.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -43,6 +42,6 @@ class ceof_deserializer : public ceof_visitor { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_DESERIALIZER_HH diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_iterator.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_iterator.hh index f97156d0afb..e5c9de4dfef 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_iterator.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_iterator.hh @@ -20,9 +20,8 @@ #define CCB_CEOF_CEOF_ITERATOR_HH #include "com/centreon/broker/ceof/ceof_token.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -58,6 +57,6 @@ class ceof_iterator { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_ITERATOR_HH diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_parser.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_parser.hh index 59ad739bfb0..08b23b9749c 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_parser.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_parser.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/ceof/ceof_iterator.hh" #include "com/centreon/broker/ceof/ceof_token.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -47,6 +46,6 @@ class ceof_parser { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_PARSER_HH diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_serializable.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_serializable.hh index 0aa26cc199b..4bec8d95485 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_serializable.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_serializable.hh @@ -22,9 +22,8 @@ #include "com/centreon/broker/ceof/ceof_iterator.hh" #include "com/centreon/broker/ceof/ceof_visitor.hh" #include "com/centreon/broker/ceof/ceof_writer.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -40,6 +39,6 @@ class ceof_serializable { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_SERIALIZABLE_HH diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_serializer.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_serializer.hh index 0fddf40cd33..0547d907089 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_serializer.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_serializer.hh @@ -22,9 +22,8 @@ #include "com/centreon/broker/ceof/ceof_serializable.hh" #include "com/centreon/broker/ceof/ceof_visitor.hh" #include "com/centreon/broker/ceof/ceof_writer.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -45,6 +44,6 @@ class ceof_serializer : public ceof_visitor { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_SERIALIZER_HH diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_token.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_token.hh index c78e48645b6..a9f62a9c58b 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_token.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_token.hh @@ -19,9 +19,7 @@ #ifndef CCB_CEOF_CEOF_TOKEN_HH #define CCB_CEOF_CEOF_TOKEN_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -56,6 +54,6 @@ class ceof_token { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_TOKEN_HH diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_visitor.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_visitor.hh index 536df399adf..cf9667cba19 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_visitor.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_visitor.hh @@ -19,9 +19,7 @@ #ifndef CCB_CEOF_CEOF_VISITOR_HH #define CCB_CEOF_CEOF_VISITOR_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -85,6 +83,6 @@ class ceof_visitor { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_WRITER_HH diff --git a/broker/core/inc/com/centreon/broker/ceof/ceof_writer.hh b/broker/core/inc/com/centreon/broker/ceof/ceof_writer.hh index 891f19b2d52..8c432a46f76 100644 --- a/broker/core/inc/com/centreon/broker/ceof/ceof_writer.hh +++ b/broker/core/inc/com/centreon/broker/ceof/ceof_writer.hh @@ -19,9 +19,7 @@ #ifndef CCB_CEOF_CEOF_WRITER_HH #define CCB_CEOF_CEOF_WRITER_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() +namespace com::centreon::broker { namespace ceof { /** @@ -47,6 +45,6 @@ class ceof_writer { }; } // namespace ceof -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CEOF_CEOF_WRITER_HH diff --git a/broker/core/inc/com/centreon/broker/compression/factory.hh b/broker/core/inc/com/centreon/broker/compression/factory.hh index 68bfe61cdd9..b889c4e0680 100644 --- a/broker/core/inc/com/centreon/broker/compression/factory.hh +++ b/broker/core/inc/com/centreon/broker/compression/factory.hh @@ -20,9 +20,8 @@ #define CCB_COMPRESSION_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace compression { /** @@ -50,6 +49,6 @@ class factory : public io::factory { }; } // namespace compression -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_COMPRESSION_FACTORY_HH diff --git a/broker/core/inc/com/centreon/broker/compression/opener.hh b/broker/core/inc/com/centreon/broker/compression/opener.hh index 857df17b3f7..7542745b37c 100644 --- a/broker/core/inc/com/centreon/broker/compression/opener.hh +++ b/broker/core/inc/com/centreon/broker/compression/opener.hh @@ -20,9 +20,8 @@ #define CCB_COMPRESSION_OPENER_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace compression { /** @@ -46,6 +45,6 @@ class opener : public io::endpoint { }; } // namespace compression -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_COMPRESSION_OPENER_HH diff --git a/broker/core/inc/com/centreon/broker/compression/stack_array.hh b/broker/core/inc/com/centreon/broker/compression/stack_array.hh index e10cf4f8809..d5f4a53f49d 100644 --- a/broker/core/inc/com/centreon/broker/compression/stack_array.hh +++ b/broker/core/inc/com/centreon/broker/compression/stack_array.hh @@ -19,9 +19,7 @@ #ifndef CCB_COMPRESSION_STACK_ARRAY_HH #define CCB_COMPRESSION_STACK_ARRAY_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() +namespace com::centreon::broker { namespace compression { /** @@ -49,6 +47,6 @@ class stack_array { }; } // namespace compression -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_COMPRESSION_STACK_ARRAY_HH diff --git a/broker/core/inc/com/centreon/broker/compression/stream.hh b/broker/core/inc/com/centreon/broker/compression/stream.hh index ce182974b01..4c97ede35e4 100644 --- a/broker/core/inc/com/centreon/broker/compression/stream.hh +++ b/broker/core/inc/com/centreon/broker/compression/stream.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/compression/stack_array.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace compression { /** @@ -58,6 +57,6 @@ class stream : public io::stream { }; } // namespace compression -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_COMPRESSION_STREAM_HH diff --git a/broker/core/inc/com/centreon/broker/compression/zlib.hh b/broker/core/inc/com/centreon/broker/compression/zlib.hh index 61d9b7e2674..56362030829 100644 --- a/broker/core/inc/com/centreon/broker/compression/zlib.hh +++ b/broker/core/inc/com/centreon/broker/compression/zlib.hh @@ -19,9 +19,7 @@ #ifndef CCB_COMPRESSION_ZLIB_HH #define CCB_COMPRESSION_ZLIB_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() +namespace com::centreon::broker { namespace compression { /** @@ -39,6 +37,6 @@ class zlib { }; } // namespace compression -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_COMPRESSION_ZLIB_HH diff --git a/broker/core/inc/com/centreon/broker/config/applier/endpoint.hh b/broker/core/inc/com/centreon/broker/config/applier/endpoint.hh index 3cc462f267d..a4baacd7a2a 100644 --- a/broker/core/inc/com/centreon/broker/config/applier/endpoint.hh +++ b/broker/core/inc/com/centreon/broker/config/applier/endpoint.hh @@ -20,9 +20,8 @@ #define CCB_CONFIG_APPLIER_ENDPOINT_HH #include "com/centreon/broker/multiplexing/muxer_filter.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations. namespace io { @@ -88,6 +87,6 @@ class endpoint { } // namespace applier } // namespace config -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CONFIG_APPLIER_ENDPOINT_HH diff --git a/broker/core/inc/com/centreon/broker/config/applier/init.hh b/broker/core/inc/com/centreon/broker/config/applier/init.hh index 7cc530278a7..8e840d96159 100644 --- a/broker/core/inc/com/centreon/broker/config/applier/init.hh +++ b/broker/core/inc/com/centreon/broker/config/applier/init.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/config/state.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace config { namespace applier { @@ -35,6 +35,6 @@ void init(size_t n_thread, } // namespace applier } // namespace config -CCB_END() +} // namespace com::centreon::broker #endif /* !CCB_CONFIG_APPLIER_INIT_HH_ */ diff --git a/broker/core/inc/com/centreon/broker/config/applier/modules.hh b/broker/core/inc/com/centreon/broker/config/applier/modules.hh index e2c244a1558..e370d74f841 100644 --- a/broker/core/inc/com/centreon/broker/config/applier/modules.hh +++ b/broker/core/inc/com/centreon/broker/config/applier/modules.hh @@ -20,11 +20,10 @@ #define CCB_CONFIG_APPLIER_MODULES_HH #include "com/centreon/broker/modules/handle.hh" -#include "com/centreon/broker/namespace.hh" using handle = com::centreon::broker::modules::handle; -CCB_BEGIN() +namespace com::centreon::broker { namespace config { namespace applier { @@ -61,6 +60,6 @@ class modules { } // namespace applier } // namespace config -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CONFIG_APPLIER_MODULES_HH diff --git a/broker/core/inc/com/centreon/broker/config/applier/state.hh b/broker/core/inc/com/centreon/broker/config/applier/state.hh index 095a42c9cda..54e5edcc289 100644 --- a/broker/core/inc/com/centreon/broker/config/applier/state.hh +++ b/broker/core/inc/com/centreon/broker/config/applier/state.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2012, 2021-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2012, 2021-2022 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_CONFIG_APPLIER_STATE_HH #define CCB_CONFIG_APPLIER_STATE_HH @@ -24,7 +24,7 @@ #include "com/centreon/broker/config/applier/modules.hh" #include "com/centreon/broker/config/state.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace config { namespace applier { @@ -83,6 +83,6 @@ class state { } // namespace applier } // namespace config -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_CONFIG_APPLIER_STATE_HH diff --git a/broker/core/inc/com/centreon/broker/config/endpoint.hh b/broker/core/inc/com/centreon/broker/config/endpoint.hh index b30e7c4ab49..52914ad3de7 100644 --- a/broker/core/inc/com/centreon/broker/config/endpoint.hh +++ b/broker/core/inc/com/centreon/broker/config/endpoint.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2009-2013,2015-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_CONFIG_ENDPOINT_HH #define CCB_CONFIG_ENDPOINT_HH @@ -23,9 +23,7 @@ #include "com/centreon/broker/multiplexing/muxer.hh" -CCB_BEGIN() - -namespace config { +namespace com::centreon::broker::config { /** * @class endpoint endpoint.hh "com/centreon/broker/config/endpoint.hh" * @brief Hold configuration of an endpoint. @@ -67,8 +65,6 @@ class endpoint { bool cache_enabled; nlohmann::json cfg; }; -} // namespace config - -CCB_END() +} // namespace com::centreon::broker::config #endif // !CCB_CONFIG_ENDPOINT_HH diff --git a/broker/core/inc/com/centreon/broker/config/parser.hh b/broker/core/inc/com/centreon/broker/config/parser.hh index 0981acdcc3d..e6bbb93bd2a 100644 --- a/broker/core/inc/com/centreon/broker/config/parser.hh +++ b/broker/core/inc/com/centreon/broker/config/parser.hh @@ -1,33 +1,32 @@ -/* -** Copyright 2011-2013,2015,2017-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013,2015,2017-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_CONFIG_PARSER_HH #define CCB_CONFIG_PARSER_HH #include + #include + #include "com/centreon/broker/config/state.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() - -namespace config { +namespace com::centreon::broker::config { /** * @class parser parser.hh "com/centreon/broker/config/parser.hh" * @brief Parse configuration file. @@ -38,8 +37,7 @@ namespace config { class parser { void _get_generic_endpoint_configuration(const nlohmann::json& elem, endpoint& e); - void _parse_endpoint(const nlohmann::json& elem, - endpoint& e, + void _parse_endpoint(const nlohmann::json& elem, endpoint& e, std::string& module); public: @@ -65,7 +63,7 @@ class parser { return {ret}; else if (ret.is_string()) { T tmp; - if (!absl::SimpleAtoi(ret.get(), &tmp)) + if (!absl::SimpleAtoi(ret.get(), &tmp)) throw exceptions::msg_fmt( "config parser: cannot parse key '{}': " "the string value must contain an integer", @@ -89,14 +87,11 @@ class parser { template <> absl::optional parser::check_and_read( - const nlohmann::json& elem, - const std::string& key); + const nlohmann::json& elem, const std::string& key); template <> absl::optional parser::check_and_read(const nlohmann::json& elem, const std::string& key); -} // namespace config - -CCB_END() +} // namespace com::centreon::broker::config #endif // !CCB_CONFIG_PARSER_HH diff --git a/broker/core/inc/com/centreon/broker/config/state.hh b/broker/core/inc/com/centreon/broker/config/state.hh index 6ba7cd5cf5f..1893013ff28 100644 --- a/broker/core/inc/com/centreon/broker/config/state.hh +++ b/broker/core/inc/com/centreon/broker/config/state.hh @@ -25,9 +25,7 @@ #include "bbdo/bbdo/bbdo_version.hh" #include "com/centreon/broker/config/endpoint.hh" -CCB_BEGIN() - -namespace config { +namespace com::centreon::broker::config { /** * @class state state.hh "com/centreon/broker/config/state.hh" @@ -149,8 +147,6 @@ class state { stats_exporter_conf& mut_stats_exporter(); const stats_exporter_conf& get_stats_exporter() const; }; -} // namespace config - -CCB_END() +} // namespace com::centreon::broker::config #endif // !CCB_CONFIG_STATE_HH diff --git a/broker/core/inc/com/centreon/broker/exceptions/config.hh b/broker/core/inc/com/centreon/broker/exceptions/config.hh index 153dc9ca853..fd59779cc69 100644 --- a/broker/core/inc/com/centreon/broker/exceptions/config.hh +++ b/broker/core/inc/com/centreon/broker/exceptions/config.hh @@ -19,10 +19,9 @@ #ifndef CC_EXCEPTIONS_CONFIG_HH #define CC_EXCEPTIONS_CONFIG_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace exceptions { /** @@ -42,6 +41,6 @@ class config : public com::centreon::exceptions::msg_fmt { }; } // namespace exceptions -CCB_END() +} #endif // !CC_EXCEPTIONS_CONFIG_HH diff --git a/broker/core/inc/com/centreon/broker/exceptions/connection_closed.hh b/broker/core/inc/com/centreon/broker/exceptions/connection_closed.hh index f03cb8c6712..09d8f396f21 100644 --- a/broker/core/inc/com/centreon/broker/exceptions/connection_closed.hh +++ b/broker/core/inc/com/centreon/broker/exceptions/connection_closed.hh @@ -19,10 +19,9 @@ #ifndef CCB_EXCEPTIONS_CONNECTION_CLOSED_HH #define CCB_EXCEPTIONS_CONNECTION_CLOSED_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace exceptions { /** @@ -44,6 +43,6 @@ class connection_closed : public com::centreon::exceptions::msg_fmt { }; } // namespace exceptions -CCB_END() +} #endif // !CCB_EXCEPTIONS_CONNECTION_CLOSED_HH diff --git a/broker/core/inc/com/centreon/broker/exceptions/corruption.hh b/broker/core/inc/com/centreon/broker/exceptions/corruption.hh index 4d8fe08545e..8e339d5f48c 100644 --- a/broker/core/inc/com/centreon/broker/exceptions/corruption.hh +++ b/broker/core/inc/com/centreon/broker/exceptions/corruption.hh @@ -1,30 +1,27 @@ -/* -** Copyright 2009-2011,2017,2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2009-2011,2017,2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_EXCEPTIONS_CORRUPTION_HH #define CCB_EXCEPTIONS_CORRUPTION_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() - -namespace exceptions { +namespace com::centreon::broker::exceptions { /** * @class corruption corruption.hh * "com/centreon/broker/exceptions/corruption.hh" @@ -43,8 +40,6 @@ class corruption : public com::centreon::exceptions::msg_fmt { ~corruption() noexcept {} corruption& operator=(const corruption&) = delete; }; -} // namespace exceptions - -CCB_END() +} // namespace com::centreon::broker::exceptions #endif // !CCB_EXCEPTIONS_CORRUPTION_HH diff --git a/broker/core/inc/com/centreon/broker/exceptions/deprecated.hh b/broker/core/inc/com/centreon/broker/exceptions/deprecated.hh index f339ee92d14..18e7314c3ec 100644 --- a/broker/core/inc/com/centreon/broker/exceptions/deprecated.hh +++ b/broker/core/inc/com/centreon/broker/exceptions/deprecated.hh @@ -19,10 +19,9 @@ #ifndef CCB_EXCEPTIONS_DEPRECATED_HH #define CCB_EXCEPTIONS_DEPRECATED_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace exceptions { /** @@ -44,6 +43,6 @@ class deprecated : public com::centreon::exceptions::msg_fmt { }; } // namespace exceptions -CCB_END() +} #endif // !CCB_EXCEPTIONS_DEPRECATED_HH diff --git a/broker/core/inc/com/centreon/broker/exceptions/interrupt.hh b/broker/core/inc/com/centreon/broker/exceptions/interrupt.hh index 162fdcdc25d..aa7da7e89cf 100644 --- a/broker/core/inc/com/centreon/broker/exceptions/interrupt.hh +++ b/broker/core/inc/com/centreon/broker/exceptions/interrupt.hh @@ -19,9 +19,8 @@ #ifndef CCB_EXCEPTIONS_INTERRUPT_HH #define CCB_EXCEPTIONS_INTERRUPT_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace exceptions { /** @@ -39,6 +38,6 @@ class interrupt : public std::exception { }; } // namespace exceptions -CCB_END() +} #endif // !CCB_EXCEPTIONS_INTERRUPT_HH diff --git a/broker/core/inc/com/centreon/broker/exceptions/shutdown.hh b/broker/core/inc/com/centreon/broker/exceptions/shutdown.hh index a819faa4459..71781c8b533 100644 --- a/broker/core/inc/com/centreon/broker/exceptions/shutdown.hh +++ b/broker/core/inc/com/centreon/broker/exceptions/shutdown.hh @@ -19,10 +19,9 @@ #ifndef CCB_EXCEPTIONS_SHUTDOWN_HH #define CCB_EXCEPTIONS_SHUTDOWN_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace exceptions { /** @@ -43,6 +42,6 @@ class shutdown : public com::centreon::exceptions::msg_fmt { }; } // namespace exceptions -CCB_END() +} #endif // !CCB_EXCEPTIONS_SHUTDOWN_HH diff --git a/broker/core/inc/com/centreon/broker/exceptions/timeout.hh b/broker/core/inc/com/centreon/broker/exceptions/timeout.hh index 3b944dba2fa..36e5962fe72 100644 --- a/broker/core/inc/com/centreon/broker/exceptions/timeout.hh +++ b/broker/core/inc/com/centreon/broker/exceptions/timeout.hh @@ -1,29 +1,25 @@ -/* -** Copyright 2015,2017,2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015,2017,2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_EXCEPTIONS_TIMEOUT_HH #define CCB_EXCEPTIONS_TIMEOUT_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace exceptions { +namespace com::centreon::broker::exceptions { /** * @class timeout timeout.hh "com/centreon/broker/exceptions/timeout.hh" * @brief Timeout exception. @@ -36,8 +32,6 @@ class timeout : public std::exception { timeout(const timeout& e) : std::exception(e) {} timeout& operator=(const timeout&) = delete; }; -} // namespace exceptions - -CCB_END() +} // namespace com::centreon::broker::exceptions #endif // !CCB_EXCEPTIONS_TIMEOUT_HH diff --git a/broker/core/inc/com/centreon/broker/file/cfile.hh b/broker/core/inc/com/centreon/broker/file/cfile.hh index e4aa4e072ac..d2dd2b479cd 100644 --- a/broker/core/inc/com/centreon/broker/file/cfile.hh +++ b/broker/core/inc/com/centreon/broker/file/cfile.hh @@ -20,9 +20,8 @@ #define CCB_FILE_CFILE_HH #include "com/centreon/broker/file/fs_file.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace file { /** @@ -54,6 +53,6 @@ class cfile : public fs_file { }; } // namespace file -CCB_END() +} #endif // !CCB_FILE_CFILE_HH diff --git a/broker/core/inc/com/centreon/broker/file/directory_event.hh b/broker/core/inc/com/centreon/broker/file/directory_event.hh index 08171ab8e46..4c00c7e042d 100644 --- a/broker/core/inc/com/centreon/broker/file/directory_event.hh +++ b/broker/core/inc/com/centreon/broker/file/directory_event.hh @@ -19,9 +19,8 @@ #ifndef CCB_FILE_DIRECTORY_EVENT_HH #define CCB_FILE_DIRECTORY_EVENT_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace file { /** @@ -53,6 +52,6 @@ class directory_event { }; } // namespace file -CCB_END() +} #endif // !CCB_FILE_DIRECTORY_EVENT_HH diff --git a/broker/core/inc/com/centreon/broker/file/directory_watcher.hh b/broker/core/inc/com/centreon/broker/file/directory_watcher.hh index 8b284088323..cc846e499ff 100644 --- a/broker/core/inc/com/centreon/broker/file/directory_watcher.hh +++ b/broker/core/inc/com/centreon/broker/file/directory_watcher.hh @@ -20,9 +20,8 @@ #define CCB_FILE_DIRECTORY_WATCHER_HH #include "com/centreon/broker/file/directory_event.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace file { /** @@ -55,6 +54,6 @@ class directory_watcher { }; } // namespace file -CCB_END() +} #endif // !CCB_FILE_DIRECTORY_WATCHER_HH diff --git a/broker/core/inc/com/centreon/broker/file/disk_accessor.hh b/broker/core/inc/com/centreon/broker/file/disk_accessor.hh index e7969fe28c6..317b8a7f5cc 100644 --- a/broker/core/inc/com/centreon/broker/file/disk_accessor.hh +++ b/broker/core/inc/com/centreon/broker/file/disk_accessor.hh @@ -19,9 +19,8 @@ #ifndef CCB_FILE_DISK_ACCESSOR_HH #define CCB_FILE_DISK_ACCESSOR_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace file { /** @@ -53,6 +52,6 @@ class disk_accessor { }; } // namespace file -CCB_END() +} #endif // !CCB_FILE_DISK_ACCESSOR_HH diff --git a/broker/core/inc/com/centreon/broker/file/factory.hh b/broker/core/inc/com/centreon/broker/file/factory.hh index 0a74d3071a6..e0d537374cd 100644 --- a/broker/core/inc/com/centreon/broker/file/factory.hh +++ b/broker/core/inc/com/centreon/broker/file/factory.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/extension.hh" #include "com/centreon/broker/io/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace file { /** @@ -47,6 +47,6 @@ class factory : public io::factory { }; } // namespace file -CCB_END() +} #endif // !CCB_FILE_FACTORY_HH diff --git a/broker/core/inc/com/centreon/broker/file/fifo.hh b/broker/core/inc/com/centreon/broker/file/fifo.hh index 2575095b626..a90b060ee56 100644 --- a/broker/core/inc/com/centreon/broker/file/fifo.hh +++ b/broker/core/inc/com/centreon/broker/file/fifo.hh @@ -20,9 +20,8 @@ #define CCB_FILE_FIFO_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace file { /** @@ -48,6 +47,6 @@ class fifo { }; } // namespace file -CCB_END() +} #endif // !CCB_FILE_FIFO_HH diff --git a/broker/core/inc/com/centreon/broker/file/fs_file.hh b/broker/core/inc/com/centreon/broker/file/fs_file.hh index 522fa43312c..a4f55380281 100644 --- a/broker/core/inc/com/centreon/broker/file/fs_file.hh +++ b/broker/core/inc/com/centreon/broker/file/fs_file.hh @@ -1,29 +1,25 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2017,2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_FILE_FS_FILE_HH #define CCB_FILE_FS_FILE_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace file { +namespace com::centreon::broker::file { /** * @class fs_file fs_file.hh "com/centreon/broker/file/fs_file.hh" * @brief File system (on-disk) file. @@ -64,8 +60,6 @@ class fs_file_factory { fs_file::open_mode mode) = 0; virtual ~fs_file_factory(){}; }; -} // namespace file - -CCB_END() +} // namespace com::centreon::broker::file #endif // !CCB_FILE_FS_FILE_HH diff --git a/broker/core/inc/com/centreon/broker/file/opener.hh b/broker/core/inc/com/centreon/broker/file/opener.hh index d25f7512e52..a9dfcb1564b 100644 --- a/broker/core/inc/com/centreon/broker/file/opener.hh +++ b/broker/core/inc/com/centreon/broker/file/opener.hh @@ -20,9 +20,8 @@ #define CCB_FILE_OPENER_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace file { /** @@ -49,6 +48,6 @@ class opener : public io::endpoint { }; } // namespace file -CCB_END() +} #endif // !CCB_FILE_OPENER_HH diff --git a/broker/core/inc/com/centreon/broker/file/splitter.hh b/broker/core/inc/com/centreon/broker/file/splitter.hh index d3460efa2b9..d5a6cab01e5 100644 --- a/broker/core/inc/com/centreon/broker/file/splitter.hh +++ b/broker/core/inc/com/centreon/broker/file/splitter.hh @@ -1,30 +1,27 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2017,2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_FILE_SPLITTER_HH #define CCB_FILE_SPLITTER_HH #include "com/centreon/broker/file/fs_file.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace file { +namespace com::centreon::broker::file { /** * @class splitter splitter.hh "com/centreon/broker/file/splitter.hh" * @brief Manage multi-file splitting. @@ -80,8 +77,7 @@ class splitter : public fs_file { bool _open_write_file(); public: - splitter(const std::string& path, - uint32_t max_file_size = 100000000u, + splitter(const std::string& path, uint32_t max_file_size = 100000000u, bool auto_delete = false); ~splitter(); splitter(const splitter&) = delete; @@ -102,8 +98,6 @@ class splitter : public fs_file { long get_woffset() const; size_t max_file_size() const; }; -} // namespace file - -CCB_END() +} // namespace com::centreon::broker::file #endif // !CCB_FILE_SPLITTER_HH diff --git a/broker/core/inc/com/centreon/broker/file/stream.hh b/broker/core/inc/com/centreon/broker/file/stream.hh index 982d9cdf387..cb79de092b6 100644 --- a/broker/core/inc/com/centreon/broker/file/stream.hh +++ b/broker/core/inc/com/centreon/broker/file/stream.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2015,2017, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2015,2017, 2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_FILE_STREAM_HH #define CCB_FILE_STREAM_HH @@ -22,11 +22,8 @@ #include "broker.pb.h" #include "com/centreon/broker/file/splitter.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace file { +namespace com::centreon::broker::file { /** * @class stream stream.hh "com/centreon/broker/file/stream.hh" * @brief File stream. @@ -48,10 +45,8 @@ class stream : public io::stream { void _update_stats(); public: - stream(const std::string& path, - QueueFileStats* s, - uint32_t max_file_size = 100000000u, - bool auto_delete = false); + stream(const std::string& path, QueueFileStats* s, + uint32_t max_file_size = 100000000u, bool auto_delete = false); ~stream() noexcept = default; stream(const stream&) = delete; stream& operator=(const stream&) = delete; @@ -63,8 +58,6 @@ class stream : public io::stream { int32_t stop() override; uint32_t max_file_size() const; }; -} // namespace file - -CCB_END() +} // namespace com::centreon::broker::file #endif // !CCB_FILE_STREAM_HH diff --git a/broker/core/inc/com/centreon/broker/instance_broadcast.hh b/broker/core/inc/com/centreon/broker/instance_broadcast.hh index 0caa90902fc..c613e1a311f 100644 --- a/broker/core/inc/com/centreon/broker/instance_broadcast.hh +++ b/broker/core/inc/com/centreon/broker/instance_broadcast.hh @@ -23,9 +23,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class instance_broadcast instance_broadcast.hh @@ -64,6 +63,6 @@ class instance_broadcast : public io::data { void _internal_copy(instance_broadcast const& other); }; -CCB_END() +} #endif // !CCB_INSTANCE_BROADCAST_HH diff --git a/broker/core/inc/com/centreon/broker/io/data.hh b/broker/core/inc/com/centreon/broker/io/data.hh index dcd6cbeafc3..9aa2e6ae5f5 100644 --- a/broker/core/inc/com/centreon/broker/io/data.hh +++ b/broker/core/inc/com/centreon/broker/io/data.hh @@ -19,11 +19,7 @@ #ifndef CCB_IO_DATA_HH #define CCB_IO_DATA_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace io { +namespace com::centreon::broker::io { /** * @class data data.hh "com/centreon/broker/io/data.hh" * @brief Data abstraction. @@ -93,9 +89,7 @@ inline std::ostream& operator<<(std::ostream& s, const data::dump_json& d) { using data_read_handler = std::function&)>; -} // namespace io - -CCB_END() +} // namespace com::centreon::broker::io namespace fmt { template <> diff --git a/broker/core/inc/com/centreon/broker/io/endpoint.hh b/broker/core/inc/com/centreon/broker/io/endpoint.hh index a39108c6db5..35577ceb934 100644 --- a/broker/core/inc/com/centreon/broker/io/endpoint.hh +++ b/broker/core/inc/com/centreon/broker/io/endpoint.hh @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011-2012, 2021, 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,9 +23,8 @@ #include "com/centreon/broker/io/stream.hh" #include "com/centreon/broker/multiplexing/muxer_filter.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. class persistent_cache; @@ -73,6 +72,6 @@ class endpoint { }; } // namespace io -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_IO_ENDPOINT_HH diff --git a/broker/core/inc/com/centreon/broker/io/event_info.hh b/broker/core/inc/com/centreon/broker/io/event_info.hh index 9f683b932f6..9d64aae0cf6 100644 --- a/broker/core/inc/com/centreon/broker/io/event_info.hh +++ b/broker/core/inc/com/centreon/broker/io/event_info.hh @@ -1,29 +1,27 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_IO_EVENT_INFO_HH #define CCB_IO_EVENT_INFO_HH #include -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. namespace mapping { @@ -65,10 +63,8 @@ class event_info { * @param[in] entries Event property mapping. * @param[in] table_v2 SQL table of event in version 2.x (if any). */ - event_info(std::string const& name, - event_operations const* ops, - mapping::entry const* entries, - std::string const& table_v2) + event_info(std::string const& name, event_operations const* ops, + mapping::entry const* entries, std::string const& table_v2) : _mapping(entries), _name(name), _ops(ops), _table_v2(table_v2) {} /** * Copy constructor. @@ -89,6 +85,6 @@ class event_info { }; } // namespace io -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_IO_EVENT_INFO_HH diff --git a/broker/core/inc/com/centreon/broker/io/events.hh b/broker/core/inc/com/centreon/broker/io/events.hh index 6c968da34dc..8ef55719005 100644 --- a/broker/core/inc/com/centreon/broker/io/events.hh +++ b/broker/core/inc/com/centreon/broker/io/events.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2013-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_IO_EVENTS_HH #define CCB_IO_EVENTS_HH @@ -22,9 +22,7 @@ #include "bbdo/events.hh" #include "com/centreon/broker/io/event_info.hh" -CCB_BEGIN() - -namespace io { +namespace com::centreon::broker::io { /** * @class events events.hh "com/centreon/broker/io/events.hh" * @brief Data events registration. @@ -61,8 +59,7 @@ class events { event_info::event_operations const* ops = nullptr, mapping::entry const* entries = nullptr, std::string const& table_v2 = std::string()); - uint32_t register_event(uint32_t type_id, - std::string const& name, + uint32_t register_event(uint32_t type_id, std::string const& name, event_info::event_operations const* ops, const std::string& table); @@ -81,8 +78,6 @@ class events { events_container _elements; }; -} // namespace io - -CCB_END() +} // namespace com::centreon::broker::io #endif // !CCB_IO_EVENTS_HH diff --git a/broker/core/inc/com/centreon/broker/io/extension.hh b/broker/core/inc/com/centreon/broker/io/extension.hh index 604b6175d48..b7a08deec0e 100644 --- a/broker/core/inc/com/centreon/broker/io/extension.hh +++ b/broker/core/inc/com/centreon/broker/io/extension.hh @@ -1,29 +1,25 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_IO_EXTENSION_HH #define CCB_IO_EXTENSION_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace io { +namespace com::centreon::broker::io { /** * @class extension extension.hh "com/centreon/broker/bbdo/extension.hh" @@ -85,7 +81,6 @@ class extension { bool is_optional() const { return _optional; } bool is_mandatory() const { return _mandatory; } }; -} // namespace io +} // namespace com::centreon::broker::io -CCB_END() #endif /* !CCB_IO_EXTENSION_HH */ diff --git a/broker/core/inc/com/centreon/broker/io/factory.hh b/broker/core/inc/com/centreon/broker/io/factory.hh index af47da645e9..b6cb3648715 100644 --- a/broker/core/inc/com/centreon/broker/io/factory.hh +++ b/broker/core/inc/com/centreon/broker/io/factory.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_IO_FACTORY_HH #define CCB_IO_FACTORY_HH @@ -24,9 +24,7 @@ #include "com/centreon/broker/io/extension.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() - -namespace io { +namespace com::centreon::broker::io { /** * @class factory factory.hh "com/centreon/broker/io/factory.hh" * @brief Endpoint factory. @@ -55,17 +53,15 @@ class factory { */ virtual bool has_endpoint(config::endpoint& cfg, io::extension* ext) = 0; virtual endpoint* new_endpoint( - config::endpoint& cfg, - bool& is_acceptor, + config::endpoint& cfg, bool& is_acceptor, std::shared_ptr cache = std::shared_ptr()) const = 0; virtual std::shared_ptr new_stream( - std::shared_ptr substream, - bool is_acceptor, + std::shared_ptr substream, bool is_acceptor, const std::unordered_map& options); -}; -} // namespace io -CCB_END() + static bool direct_grpc_serialized(const config::endpoint& cfg); +}; +} // namespace com::centreon::broker::io #endif // !CCB_IO_FACTORY_HH diff --git a/broker/core/inc/com/centreon/broker/io/limit_endpoint.hh b/broker/core/inc/com/centreon/broker/io/limit_endpoint.hh index 9562352a6ec..a3453578141 100644 --- a/broker/core/inc/com/centreon/broker/io/limit_endpoint.hh +++ b/broker/core/inc/com/centreon/broker/io/limit_endpoint.hh @@ -21,7 +21,7 @@ #include "endpoint.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace io { @@ -44,6 +44,6 @@ class limit_endpoint : public endpoint { } // namespace io -CCB_END() +} #endif // !CCB_IO_LIMIT_ENDPOINT_HH diff --git a/broker/core/inc/com/centreon/broker/io/protobuf.hh b/broker/core/inc/com/centreon/broker/io/protobuf.hh index 14277c9ccf9..ecd105d816e 100644 --- a/broker/core/inc/com/centreon/broker/io/protobuf.hh +++ b/broker/core/inc/com/centreon/broker/io/protobuf.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_IO_PROTOBUF_HH #define CCB_IO_PROTOBUF_HH @@ -22,13 +22,12 @@ #include #include #include + #include "com/centreon/broker/io/data.hh" #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() - -namespace io { +namespace com::centreon::broker::io { /** * @class data protobuf.hh "com/centreon/broker/io/protobuf.hh" * @brief Data abstraction. @@ -54,6 +53,8 @@ class protobuf_base : public data { protobuf_base(uint32_t typ, google::protobuf::Message* msg) : data(typ), _msg{msg} {} + void set_message(google::protobuf::Message* msg) { _msg = msg; } + public: enum attribute { always_valid = 0, @@ -107,6 +108,18 @@ class protobuf : public protobuf_base { */ protobuf(const T& o) : protobuf_base(Typ, &_obj), _obj(o) {} + /** + * @brief Construct a new protobuf object + * same as previous constructor except that it accepts two more parameters + * @param o + * @param src_id source_id + * @param dest_id destination_id + */ + protobuf(const T& o, uint32_t src_id, uint32_t dest_id) : protobuf(o) { + source_id = src_id; + destination_id = dest_id; + } + protobuf(const protobuf& to_clone) : protobuf_base(Typ, &_obj) { _obj.CopyFrom(to_clone._obj); } @@ -168,11 +181,11 @@ class protobuf : public protobuf_base { return retval.release(); } - const T& obj() const { return _obj; } + virtual const T& obj() const { return _obj; } - T& mut_obj() { return _obj; } + virtual T& mut_obj() { return _obj; } - void set_obj(T&& obj) { _obj = std::move(obj); } + virtual void set_obj(T&& obj) { _obj = std::move(obj); } void dump(std::ostream& s) const override; void dump_more_detail(std::ostream& s) const override; @@ -191,13 +204,14 @@ const io::event_info::event_operations protobuf::operations{ template bool protobuf::operator==(const protobuf& to_cmp) const { - return google::protobuf::util::MessageDifferencer::Equals(_obj, to_cmp._obj); + return google::protobuf::util::MessageDifferencer::Equals(this->obj(), + (&to_cmp)->obj()); } template void protobuf::dump(std::ostream& s) const { data::dump(s); - std::string dump{_obj.ShortDebugString()}; + std::string dump{this->obj().ShortDebugString()}; if (dump.size() > 200) { dump.resize(200); s << fmt::format(" content:'{}...'", dump); @@ -208,17 +222,16 @@ void protobuf::dump(std::ostream& s) const { template void protobuf::dump_more_detail(std::ostream& s) const { data::dump(s); - s << " content:'" << _obj.ShortDebugString() << '\''; + s << " content:'" << this->obj().ShortDebugString() << '\''; } template void protobuf::dump_to_json(std::ostream& s) const { std::string json_dump; - google::protobuf::util::MessageToJsonString(_obj, &json_dump); + google::protobuf::util::MessageToJsonString(this->obj(), &json_dump); s << " content:'" << json_dump << '\''; } -} // namespace io -CCB_END() +} // namespace com::centreon::broker::io #endif // !CCB_IO_PROTOBUF_HH diff --git a/broker/core/inc/com/centreon/broker/io/protocols.hh b/broker/core/inc/com/centreon/broker/io/protocols.hh index e911dc20112..7103c3f8168 100644 --- a/broker/core/inc/com/centreon/broker/io/protocols.hh +++ b/broker/core/inc/com/centreon/broker/io/protocols.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/io/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace io { /** @@ -60,6 +60,6 @@ class protocols { }; } // namespace io -CCB_END() +} #endif // !CCB_IO_PROTOCOLS_HH diff --git a/broker/core/inc/com/centreon/broker/io/raw.hh b/broker/core/inc/com/centreon/broker/io/raw.hh index 2bcfd7ed98e..d5f91c6b352 100644 --- a/broker/core/inc/com/centreon/broker/io/raw.hh +++ b/broker/core/inc/com/centreon/broker/io/raw.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013, 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_IO_RAW_HH #define CCB_IO_RAW_HH @@ -22,11 +22,8 @@ #include "bbdo/events.hh" #include "com/centreon/broker/io/data.hh" #include "com/centreon/broker/io/events.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace io { +namespace com::centreon::broker::io { /** * @class raw raw.hh "io/raw.hh" * @brief Raw byte array. @@ -63,8 +60,6 @@ class raw : public data { std::ostream& operator<<(std::ostream& s, const raw& d); -} // namespace io - -CCB_END() +} // namespace com::centreon::broker::io #endif // !CCB_IO_RAW_HH diff --git a/broker/core/inc/com/centreon/broker/io/stream.hh b/broker/core/inc/com/centreon/broker/io/stream.hh index e94b8b18345..f0d4076256a 100644 --- a/broker/core/inc/com/centreon/broker/io/stream.hh +++ b/broker/core/inc/com/centreon/broker/io/stream.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2013,2015,2017-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013,2015,2017-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_IO_STREAM_HH #define CCB_IO_STREAM_HH @@ -22,11 +22,8 @@ #include #include "com/centreon/broker/io/data.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace io { +namespace com::centreon::broker::io { /** * @class stream stream.hh "com/centreon/broker/io/stream.hh" * @brief Class used to exchange data. @@ -77,8 +74,6 @@ class stream { virtual bool wait_for_all_events_written(unsigned ms_timeout); }; -} // namespace io - -CCB_END() +} // namespace com::centreon::broker::io #endif // !CCB_IO_STREAM_HH diff --git a/broker/core/inc/com/centreon/broker/log_v2.hh b/broker/core/inc/com/centreon/broker/log_v2.hh index 0ead1dd0f1a..4869ce9a7d0 100644 --- a/broker/core/inc/com/centreon/broker/log_v2.hh +++ b/broker/core/inc/com/centreon/broker/log_v2.hh @@ -1,28 +1,27 @@ -/* -** Copyright 2020-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CENTREON_BROKER_CORE_INC_COM_CENTREON_BROKER_LOG_V2_HH_ #define CENTREON_BROKER_CORE_INC_COM_CENTREON_BROKER_LOG_V2_HH_ #include "com/centreon/broker/config/state.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/engine/log_v2_base.hh" -CCB_BEGIN() +namespace com::centreon::broker { class log_v2 : public com::centreon::engine::log_v2_base { std::atomic_bool _running; @@ -154,6 +153,6 @@ class log_v2 : public com::centreon::engine::log_v2_base { void set_level(const std::string& logger, const std::string& level); }; -CCB_END(); +} // namespace com::centreon::broker #endif // CENTREON_BROKER_CORE_INC_COM_CENTREON_BROKER_LOG_V2_HH_ diff --git a/broker/core/inc/com/centreon/broker/mapping/entry.hh b/broker/core/inc/com/centreon/broker/mapping/entry.hh index 324e645c9b0..3eab648fdef 100644 --- a/broker/core/inc/com/centreon/broker/mapping/entry.hh +++ b/broker/core/inc/com/centreon/broker/mapping/entry.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2012,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2012,2015-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MAPPING_ENTRY_HH #define CCB_MAPPING_ENTRY_HH @@ -23,7 +23,7 @@ #include "com/centreon/broker/mapping/property.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace mapping { /** @@ -58,11 +58,8 @@ class entry { * @param serialize Is this property sent to the database. */ template - entry(std::string(T::*prop), - char const* name, - size_t max_len, - uint32_t attr = always_valid, - bool serialize = true) + entry(std::string(T::*prop), char const* name, size_t max_len, + uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), _serialize(serialize), @@ -78,9 +75,7 @@ class entry { * @param[in] prop Property. */ template - entry(bool(T::*prop), - char const* name, - uint32_t attr = always_valid, + entry(bool(T::*prop), char const* name, uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), @@ -97,9 +92,7 @@ class entry { * @param[in] prop Property. */ template - entry(double(T::*prop), - char const* name, - uint32_t attr = always_valid, + entry(double(T::*prop), char const* name, uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), @@ -116,9 +109,7 @@ class entry { * @param[in] prop Property. */ template - entry(uint32_t(T::*prop), - char const* name, - uint32_t attr = always_valid, + entry(uint32_t(T::*prop), char const* name, uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), @@ -135,9 +126,7 @@ class entry { * @param[in] prop Property. */ template - entry(uint64_t(T::*prop), - char const* name, - uint32_t attr = always_valid, + entry(uint64_t(T::*prop), char const* name, uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), @@ -154,9 +143,7 @@ class entry { * @param[in] prop Property. */ template - entry(int(T::*prop), - char const* name, - uint32_t attr = always_valid, + entry(int(T::*prop), char const* name, uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), @@ -173,10 +160,8 @@ class entry { * @param[in] prop Property. */ template - entry(unsigned short(T::*prop), - const char* name, - uint32_t attr = always_valid, - bool serialize = true) + entry(unsigned short(T::*prop), const char* name, + uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), _serialize(serialize), @@ -192,9 +177,7 @@ class entry { * @param[in] prop Property. */ template - entry(short(T::*prop), - char const* name, - uint32_t attr = always_valid, + entry(short(T::*prop), char const* name, uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), @@ -210,9 +193,7 @@ class entry { * @param[in] name Entry name. */ template - entry(timestamp(T::*prop), - char const* name, - uint32_t attr = always_valid, + entry(timestamp(T::*prop), char const* name, uint32_t attr = always_valid, bool serialize = true) : _attribute(attr), _name_v2(name), @@ -290,6 +271,6 @@ class entry { }; } // namespace mapping -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_MAPPING_ENTRY_HH diff --git a/broker/core/inc/com/centreon/broker/mapping/property.hh b/broker/core/inc/com/centreon/broker/mapping/property.hh index b6a4ff34465..cf9b489629e 100644 --- a/broker/core/inc/com/centreon/broker/mapping/property.hh +++ b/broker/core/inc/com/centreon/broker/mapping/property.hh @@ -1,29 +1,28 @@ -/* -** Copyright 2011, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011, 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MAPPING_PROPERTY_HH #define CCB_MAPPING_PROPERTY_HH #include "com/centreon/broker/mapping/source.hh" -CCB_BEGIN() +namespace com::centreon::broker::mapping { -namespace mapping { /** * @class property property.hh "com/centreon/broker/mapping/property.hh" * @brief Internal property-mapping class. @@ -169,8 +168,7 @@ class property : public source { * * @return String property. */ - std::string const& get_string(io::data const& d, - size_t* max_len + std::string const& get_string(io::data const& d, size_t* max_len __attribute__((unused))) override { return static_cast(&d)->*(_prop.q); } @@ -334,14 +332,11 @@ class sproperty : public property { * @return String property. */ std::string const& get_string(io::data const& d, size_t* max_len) { - if (max_len) - *max_len = _max_len; + if (max_len) *max_len = _max_len; return property::get_string(d, max_len); } }; -} // namespace mapping - -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_MAPPING_PROPERTY_HH diff --git a/broker/core/inc/com/centreon/broker/mapping/source.hh b/broker/core/inc/com/centreon/broker/mapping/source.hh index a0db0f46c27..a8bfebb8c6c 100644 --- a/broker/core/inc/com/centreon/broker/mapping/source.hh +++ b/broker/core/inc/com/centreon/broker/mapping/source.hh @@ -1,31 +1,29 @@ -/* -** Copyright 2011 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011,2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MAPPING_SOURCE_HH #define CCB_MAPPING_SOURCE_HH #include "com/centreon/broker/io/data.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker::mapping { -namespace mapping { /** * @class source source.hh "com/centreon/broker/mapping/source.hh" * @brief Internal mapping class. @@ -79,8 +77,7 @@ class source { virtual void set_ulong(io::data& d, uint64_t value) = 0; virtual void set_ushort(io::data& d, unsigned short value) = 0; }; -} // namespace mapping -CCB_END() +} // namespace com::centreon::broker::mapping #endif // !CCB_MAPPING_SOURCE_HH diff --git a/broker/core/inc/com/centreon/broker/misc/buffer.hh b/broker/core/inc/com/centreon/broker/misc/buffer.hh index 41994a12b1e..4cf6eb8f786 100644 --- a/broker/core/inc/com/centreon/broker/misc/buffer.hh +++ b/broker/core/inc/com/centreon/broker/misc/buffer.hh @@ -20,9 +20,8 @@ #define _CCB_MISC_BUFFER_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { /** @@ -188,6 +187,6 @@ class buffer { }; } // namespace misc -CCB_END() +} #endif /* !_CCB_MISC_BUFFER_HH */ diff --git a/broker/core/inc/com/centreon/broker/misc/diagnostic.hh b/broker/core/inc/com/centreon/broker/misc/diagnostic.hh index c3b172b8174..7119f8f71ff 100644 --- a/broker/core/inc/com/centreon/broker/misc/diagnostic.hh +++ b/broker/core/inc/com/centreon/broker/misc/diagnostic.hh @@ -19,9 +19,8 @@ #ifndef CCB_MISC_DIAGNOSTIC_HH #define CCB_MISC_DIAGNOSTIC_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { /** @@ -42,6 +41,6 @@ class diagnostic { }; } // namespace misc -CCB_END() +} #endif // !CCB_MISC_DIAGNOSTIC_HH diff --git a/broker/core/inc/com/centreon/broker/misc/fifo_client.hh b/broker/core/inc/com/centreon/broker/misc/fifo_client.hh index 6b763918c28..dc5f735bd08 100644 --- a/broker/core/inc/com/centreon/broker/misc/fifo_client.hh +++ b/broker/core/inc/com/centreon/broker/misc/fifo_client.hh @@ -19,9 +19,8 @@ #ifndef _CCB_MISC_FIFO_CLIENT_HH #define _CCB_MISC_FIFO_CLIENT_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { /** @@ -88,6 +87,6 @@ class fifo_client { }; } // namespace misc -CCB_END() +} #endif /* !_CCB_MISC_FIFO_CLIENT */ diff --git a/broker/core/inc/com/centreon/broker/misc/filesystem.hh b/broker/core/inc/com/centreon/broker/misc/filesystem.hh index 1de0299022c..4af884f8d97 100644 --- a/broker/core/inc/com/centreon/broker/misc/filesystem.hh +++ b/broker/core/inc/com/centreon/broker/misc/filesystem.hh @@ -1,30 +1,25 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MISC_FILESYSTEM_HH #define CCB_MISC_FILESYSTEM_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace misc { -namespace filesystem { +namespace com::centreon::broker::misc::filesystem { std::list dir_content(std::string const& path, bool recursive); std::list dir_content_with_filter(std::string const& path, std::string const& filter); @@ -34,8 +29,6 @@ bool mkpath(std::string const& path); int64_t file_size(const std::string& path) noexcept; bool writable(const std::string& name); bool readable(const std::string& name); -} // namespace filesystem -} // namespace misc +} // namespace com::centreon::broker::misc::filesystem -CCB_END() #endif /* CCB_MISC_FILESYSTEM_HH */ diff --git a/broker/core/inc/com/centreon/broker/misc/math.hh b/broker/core/inc/com/centreon/broker/misc/math.hh index d19aec63c36..74cb9d7ce64 100644 --- a/broker/core/inc/com/centreon/broker/misc/math.hh +++ b/broker/core/inc/com/centreon/broker/misc/math.hh @@ -19,9 +19,8 @@ #ifndef CCB_MISC_MATH_HH #define CCB_MISC_MATH_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { /** @@ -73,6 +72,6 @@ bool least_squares(std::array, N> const& pts, } } // namespace misc -CCB_END() +} #endif // !CCB_MISC_MATH_HH diff --git a/broker/core/inc/com/centreon/broker/misc/mfifo.hh b/broker/core/inc/com/centreon/broker/misc/mfifo.hh index c243e2ffbb4..fd2dd1489f7 100644 --- a/broker/core/inc/com/centreon/broker/misc/mfifo.hh +++ b/broker/core/inc/com/centreon/broker/misc/mfifo.hh @@ -19,9 +19,8 @@ #define CCB_MISC_FIFO_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { @@ -136,6 +135,6 @@ class mfifo { }; } // namespace misc -CCB_END() +} #endif /* !CCB_MISC_FIFO_HH */ diff --git a/broker/core/inc/com/centreon/broker/misc/misc.hh b/broker/core/inc/com/centreon/broker/misc/misc.hh index 26907f3379c..f862f9f6c1f 100644 --- a/broker/core/inc/com/centreon/broker/misc/misc.hh +++ b/broker/core/inc/com/centreon/broker/misc/misc.hh @@ -1,31 +1,28 @@ /* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ + * Copyright 2015-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MISC_MISC_HH #define CCB_MISC_MISC_HH #include "com/centreon/broker/misc/perfdata.hh" #include "com/centreon/broker/multiplexing/muxer_filter.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace misc { +namespace com::centreon::broker::misc { std::string temp_path(); std::list split(std::string const& str, char sep); uint16_t crc16_ccitt(char const* data, uint32_t data_len); @@ -33,19 +30,17 @@ std::string exec(std::string const& cmd); int32_t exec_process(char const** argv, bool wait_for_completion); std::vector from_hex(std::string const& str); std::string dump_filters(const multiplexing::muxer_filter& filters); -std::list parse_perfdata(uint32_t host_id, - uint32_t service_id, +std::list parse_perfdata(uint32_t host_id, uint32_t service_id, const char* str); #if DEBUG_ROBOT void debug(const std::string& content); #endif -} // namespace misc #if DEBUG_ROBOT -#define DEBUG(content) misc::debug(content) +#define DEBUG(content) debug(content) #else #define DEBUG(content) #endif -CCB_END() +} // namespace com::centreon::broker::misc #endif // !CCB_MISC_MISC_HH diff --git a/broker/core/inc/com/centreon/broker/misc/perfdata.hh b/broker/core/inc/com/centreon/broker/misc/perfdata.hh index 65a9922ff58..81ee30bb138 100644 --- a/broker/core/inc/com/centreon/broker/misc/perfdata.hh +++ b/broker/core/inc/com/centreon/broker/misc/perfdata.hh @@ -1,29 +1,25 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MISC_PERFDATA_HH #define CCB_MISC_PERFDATA_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace misc { +namespace com::centreon::broker::misc { /** * @class perfdata perfdata.hh "com/centreon/broker/misc/perfdata.hh" * @brief Store perfdata values. @@ -89,12 +85,8 @@ class perfdata { * @return Metric value. */ // Inlined after profiling for performance. -inline double perfdata::value() const noexcept { - return _value; -} -} // namespace misc - -CCB_END() +inline double perfdata::value() const noexcept { return _value; } +} // namespace com::centreon::broker::misc bool operator==(com::centreon::broker::misc::perfdata const& left, com::centreon::broker::misc::perfdata const& right); diff --git a/broker/core/inc/com/centreon/broker/misc/processing_speed_computer.hh b/broker/core/inc/com/centreon/broker/misc/processing_speed_computer.hh index 69ada2a1d51..0057c55c6c4 100644 --- a/broker/core/inc/com/centreon/broker/misc/processing_speed_computer.hh +++ b/broker/core/inc/com/centreon/broker/misc/processing_speed_computer.hh @@ -19,9 +19,8 @@ #ifndef CCB_MISC_PROCESSING_SPEED_COMPUTER_HH #define CCB_MISC_PROCESSING_SPEED_COMPUTER_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { /** @@ -49,6 +48,6 @@ class processing_speed_computer { }; } // namespace misc -CCB_END() +} #endif // !CCB_MISC_PROCESSING_SPEED_COMPUTER_HH diff --git a/broker/core/inc/com/centreon/broker/misc/shared_mutex.hh b/broker/core/inc/com/centreon/broker/misc/shared_mutex.hh index 338adc40b4f..f1dd07bbeb3 100644 --- a/broker/core/inc/com/centreon/broker/misc/shared_mutex.hh +++ b/broker/core/inc/com/centreon/broker/misc/shared_mutex.hh @@ -20,9 +20,8 @@ #define CCB_MISC_SHARED_MUTEX_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { class shared_mutex { @@ -84,6 +83,6 @@ class read_lock { } // namespace misc -CCB_END() +} #endif /* CCB_MISC_SHARED_MUTEX_HH */ diff --git a/broker/core/inc/com/centreon/broker/misc/string.hh b/broker/core/inc/com/centreon/broker/misc/string.hh index fa8d7396aea..2ee2db16d8e 100644 --- a/broker/core/inc/com/centreon/broker/misc/string.hh +++ b/broker/core/inc/com/centreon/broker/misc/string.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MISC_STRING_HH #define CCB_MISC_STRING_HH @@ -23,14 +23,8 @@ #include -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace misc { -namespace string { -inline std::string& replace(std::string& str, - std::string const& old_str, +namespace com::centreon::broker::misc::string { +inline std::string& replace(std::string& str, std::string const& old_str, std::string const& new_str) { std::size_t pos(str.find(old_str, 0)); while (pos != std::string::npos) { @@ -58,11 +52,9 @@ std::string check_string_utf8(const std::string& str) noexcept; */ template fmt::string_view truncate(const T& str, size_t s) { - if (s >= str.size()) - return fmt::string_view(str); + if (s >= str.size()) return fmt::string_view(str); if (s > 0) - while ((str[s] & 0xc0) == 0x80) - s--; + while ((str[s] & 0xc0) == 0x80) s--; return fmt::string_view(str.data(), s); } @@ -71,9 +63,6 @@ std::string escape(const std::string& str, size_t s); std::string debug_buf(const char* data, int32_t size, int max_len = 10); -} // namespace string -} // namespace misc - -CCB_END() +} // namespace com::centreon::broker::misc::string #endif // !CCB_MISC_STRING_HH diff --git a/broker/core/inc/com/centreon/broker/misc/time.hh b/broker/core/inc/com/centreon/broker/misc/time.hh index 549076c2261..45e5096ed16 100644 --- a/broker/core/inc/com/centreon/broker/misc/time.hh +++ b/broker/core/inc/com/centreon/broker/misc/time.hh @@ -19,14 +19,13 @@ #ifndef CCB_MISC_TIME_HH #define CCB_MISC_TIME_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { std::time_t start_of_day(time_t when); } -CCB_END() +} #endif /* !CCB_MISC_TIME_HH */ diff --git a/broker/core/inc/com/centreon/broker/misc/trash.hh b/broker/core/inc/com/centreon/broker/misc/trash.hh index 45b72460163..d7c550db62f 100644 --- a/broker/core/inc/com/centreon/broker/misc/trash.hh +++ b/broker/core/inc/com/centreon/broker/misc/trash.hh @@ -20,9 +20,8 @@ #define CCB_MISC_TRASH_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { /** @@ -104,6 +103,6 @@ void trash::refresh_time_to_erase(const element_pointer& to_update, } // namespace misc -CCB_END() +} #endif // !CCB_MISC_TOKENIZER_HH diff --git a/broker/core/inc/com/centreon/broker/misc/uuid.hh b/broker/core/inc/com/centreon/broker/misc/uuid.hh index eb4f51d7e2f..c6e6c6502d0 100644 --- a/broker/core/inc/com/centreon/broker/misc/uuid.hh +++ b/broker/core/inc/com/centreon/broker/misc/uuid.hh @@ -20,9 +20,8 @@ #define CCB_MISC_UUID_HH_ #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { @@ -46,6 +45,6 @@ class Uuid { }; } // namespace misc -CCB_END() +} #endif // CCB_MISC_UUID_HH_ diff --git a/broker/core/inc/com/centreon/broker/misc/variant.hh b/broker/core/inc/com/centreon/broker/misc/variant.hh index 2481f4df86d..e1d2ef85f5b 100644 --- a/broker/core/inc/com/centreon/broker/misc/variant.hh +++ b/broker/core/inc/com/centreon/broker/misc/variant.hh @@ -19,9 +19,8 @@ #ifndef CCB_MISC_VARIANT_HH_ #define CCB_MISC_VARIANT_HH_ -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace misc { /** @@ -81,6 +80,6 @@ class variant { }; } // namespace misc -CCB_END() +} #endif /* !CCB_MISC_VARIANT_HH */ diff --git a/broker/core/inc/com/centreon/broker/modules/handle.hh b/broker/core/inc/com/centreon/broker/modules/handle.hh index bde12164d05..04cf2998f2d 100644 --- a/broker/core/inc/com/centreon/broker/modules/handle.hh +++ b/broker/core/inc/com/centreon/broker/modules/handle.hh @@ -1,30 +1,27 @@ -/* -** Copyright 2011-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013, 2021-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MODULES_HANDLE_HH #define CCB_MODULES_HANDLE_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace modules { +namespace com::centreon::broker::modules { /** * @class handle handle.hh "com/centreon/broker/modules/handle.hh" * @brief Plugin library handle. @@ -56,8 +53,6 @@ class handle { static constexpr const char* versionning{"broker_module_version"}; static constexpr const char* parents_list{"broker_module_parents"}; }; -} // namespace modules - -CCB_END() +} // namespace com::centreon::broker::modules #endif // !CCB_MODULES_HANDLE_HH diff --git a/broker/core/inc/com/centreon/broker/persistent_cache.hh b/broker/core/inc/com/centreon/broker/persistent_cache.hh index 0ddfb54f45d..e206d720324 100644 --- a/broker/core/inc/com/centreon/broker/persistent_cache.hh +++ b/broker/core/inc/com/centreon/broker/persistent_cache.hh @@ -1,29 +1,28 @@ -/* -** Copyright 2014-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2014-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_PERSISTENT_CACHE_HH #define CCB_PERSISTENT_CACHE_HH #include "com/centreon/broker/io/data.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class persistent_cache persistent_cache.hh @@ -55,6 +54,5 @@ class persistent_cache { const std::string& get_cache_file() const; }; -CCB_END() - +} // namespace com::centreon::broker #endif // !CCB_PERSISTENT_CACHE_HH diff --git a/broker/core/inc/com/centreon/broker/persistent_file.hh b/broker/core/inc/com/centreon/broker/persistent_file.hh index 138b1d60caf..24bc81de876 100644 --- a/broker/core/inc/com/centreon/broker/persistent_file.hh +++ b/broker/core/inc/com/centreon/broker/persistent_file.hh @@ -1,29 +1,28 @@ -/* -** Copyright 2015,2017, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015,2017, 2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_PERSISTENT_FILE_HH #define CCB_PERSISTENT_FILE_HH #include "com/centreon/broker/file/stream.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class persistent_file persistent_file.hh @@ -49,6 +48,6 @@ class persistent_file : public io::stream { int32_t stop() override; }; -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_PERSISTENT_FILE_HH diff --git a/broker/core/inc/com/centreon/broker/pool.hh b/broker/core/inc/com/centreon/broker/pool.hh index c9e693142bf..8d4f45f1794 100644 --- a/broker/core/inc/com/centreon/broker/pool.hh +++ b/broker/core/inc/com/centreon/broker/pool.hh @@ -19,9 +19,8 @@ #define CENTREON_BROKER_CORE_INC_COM_CENTREON_BROKER_POOL_HH_ #include "broker.pb.h" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @brief The Broker's thread pool. @@ -107,6 +106,6 @@ class pool { double get_last_check_latency(); }; -CCB_END() +} #endif // CENTREON_BROKER_CORE_INC_COM_CENTREON_BROKER_POOL_HH_ diff --git a/broker/core/inc/com/centreon/broker/processing/acceptor.hh b/broker/core/inc/com/centreon/broker/processing/acceptor.hh index 62dda83933a..4708ba9aec7 100644 --- a/broker/core/inc/com/centreon/broker/processing/acceptor.hh +++ b/broker/core/inc/com/centreon/broker/processing/acceptor.hh @@ -1,29 +1,28 @@ -/* -** Copyright 2015-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_PROCESSING_ACCEPTOR_HH #define CCB_PROCESSING_ACCEPTOR_HH #include "com/centreon/broker/multiplexing/muxer_filter.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/processing/endpoint.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. namespace io { @@ -71,8 +70,7 @@ class acceptor : public endpoint { virtual uint32_t _get_queued_events() const override; public: - acceptor(std::shared_ptr endp, - std::string const& name, + acceptor(std::shared_ptr endp, std::string const& name, const multiplexing::muxer_filter& r_filter, const multiplexing::muxer_filter& w_filter); acceptor(const acceptor&) = delete; @@ -87,6 +85,6 @@ class acceptor : public endpoint { }; } // namespace processing -CCB_END() +} #endif // !CCB_PROCESSING_ACCEPTOR_HH diff --git a/broker/core/inc/com/centreon/broker/processing/endpoint.hh b/broker/core/inc/com/centreon/broker/processing/endpoint.hh index 5d1add72888..cb3bdcd6fc3 100644 --- a/broker/core/inc/com/centreon/broker/processing/endpoint.hh +++ b/broker/core/inc/com/centreon/broker/processing/endpoint.hh @@ -19,10 +19,9 @@ #ifndef CCB_PROCESSING_ENDPOINT_HH #define CCB_PROCESSING_ENDPOINT_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/processing/stat_visitable.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace processing { class endpoint : public stat_visitable { @@ -41,6 +40,6 @@ class endpoint : public stat_visitable { }; } // namespace processing -CCB_END() +} #endif /* CCB_PROCESSING_ENDPOINT_HH */ diff --git a/broker/core/inc/com/centreon/broker/processing/failover.hh b/broker/core/inc/com/centreon/broker/processing/failover.hh index 2e862d1e3be..3b533c5d216 100644 --- a/broker/core/inc/com/centreon/broker/processing/failover.hh +++ b/broker/core/inc/com/centreon/broker/processing/failover.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/endpoint.hh" #include "com/centreon/broker/io/stream.hh" #include "com/centreon/broker/multiplexing/muxer.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/processing/acceptor.hh" #include "com/centreon/broker/processing/endpoint.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations. namespace io { @@ -110,6 +109,6 @@ class failover : public endpoint { }; } // namespace processing -CCB_END() +} #endif // !CCB_PROCESSING_FAILOVER_HH diff --git a/broker/core/inc/com/centreon/broker/processing/feeder.hh b/broker/core/inc/com/centreon/broker/processing/feeder.hh index afd43ae102d..2d265be775e 100644 --- a/broker/core/inc/com/centreon/broker/processing/feeder.hh +++ b/broker/core/inc/com/centreon/broker/processing/feeder.hh @@ -22,10 +22,9 @@ #include #include "com/centreon/broker/multiplexing/muxer.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/processing/stat_visitable.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. namespace io { @@ -102,6 +101,6 @@ class feeder : public stat_visitable, }; } // namespace processing -CCB_END() +} #endif // !CCB_PROCESSING_FEEDER_HH diff --git a/broker/core/inc/com/centreon/broker/processing/stat_visitable.hh b/broker/core/inc/com/centreon/broker/processing/stat_visitable.hh index 091a4f9274b..aadccf125fb 100644 --- a/broker/core/inc/com/centreon/broker/processing/stat_visitable.hh +++ b/broker/core/inc/com/centreon/broker/processing/stat_visitable.hh @@ -24,7 +24,7 @@ #include "com/centreon/broker/misc/processing_speed_computer.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace processing { constexpr unsigned idle_microsec_wait_idle_thread_delay = 100000; @@ -67,6 +67,6 @@ class stat_visitable { }; } // namespace processing -CCB_END() +} #endif // !CCB_PROCESSING_STAT_VISITABLE_HH diff --git a/broker/core/inc/com/centreon/broker/stats/center.hh b/broker/core/inc/com/centreon/broker/stats/center.hh index 3fa54253d1a..a61f9721d19 100644 --- a/broker/core/inc/com/centreon/broker/stats/center.hh +++ b/broker/core/inc/com/centreon/broker/stats/center.hh @@ -1,30 +1,27 @@ -/* -** Copyright 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2020-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #ifndef CCB_STATS_CENTER_HH #define CCB_STATS_CENTER_HH #include "broker.pb.h" -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() -namespace stats { +namespace com::centreon::broker::stats { /** * @brief Centralize Broker statistics. * @@ -67,12 +64,9 @@ class center { EngineStats* register_engine(); ConflictManagerStats* register_conflict_manager(); void unregister_muxer(const std::string& name); - void update_muxer(std::string name, - std::string queue_file, - uint32_t size, + void update_muxer(std::string name, std::string queue_file, uint32_t size, uint32_t unack); - void init_queue_file(std::string muxer, - std::string queue_file, + void init_queue_file(std::string muxer, std::string queue_file, uint32_t max_file_size); bool muxer_stats(const std::string& name, MuxerStats* response); @@ -149,8 +143,6 @@ class center { } }; -} // namespace stats - -CCB_END() +} // namespace com::centreon::broker::stats #endif /* !CCB_STATS_CENTER_HH */ diff --git a/broker/core/inc/com/centreon/broker/stats/helper.hh b/broker/core/inc/com/centreon/broker/stats/helper.hh index 4d661772e5d..a80c653c20f 100644 --- a/broker/core/inc/com/centreon/broker/stats/helper.hh +++ b/broker/core/inc/com/centreon/broker/stats/helper.hh @@ -1,38 +1,33 @@ -/* -** Copyright 2020 -2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CENTREON_BROKER_CORE_INC_COM_CENTREON_STATS_HELPER_HH_ #define CENTREON_BROKER_CORE_INC_COM_CENTREON_STATS_HELPER_HH_ #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN(); - -namespace stats { +namespace com::centreon::broker::stats { void get_generic_stats(nlohmann::json& object) noexcept; void get_mysql_stats(nlohmann::json& object) noexcept; void get_loaded_module_stats(std::vector& object) noexcept; bool get_endpoint_stats(std::vector& object); -}; // namespace stats - -CCB_END(); +} // namespace com::centreon::broker::stats #endif // CENTREON_BROKER_CORE_INC_COM_CENTREON_STATS_HELPER_HH_ diff --git a/broker/core/inc/com/centreon/broker/time/daterange.hh b/broker/core/inc/com/centreon/broker/time/daterange.hh index 76dcf9cc5a8..8168784fb2f 100644 --- a/broker/core/inc/com/centreon/broker/time/daterange.hh +++ b/broker/core/inc/com/centreon/broker/time/daterange.hh @@ -19,12 +19,11 @@ #ifndef CCB_CORE_TIME_DATERANGE_HH #define CCB_CORE_TIME_DATERANGE_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/time/ptr_typedef.hh" #include "com/centreon/broker/time/time_info.hh" #include "com/centreon/broker/time/timerange.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace time { /** @@ -123,6 +122,6 @@ class daterange { }; } // namespace time -CCB_END() +} #endif // !CCB_CORE_TIME_DATERANGE_HH diff --git a/broker/core/inc/com/centreon/broker/time/time_info.hh b/broker/core/inc/com/centreon/broker/time/time_info.hh index 5ab83ad051f..0ee7e8e9f50 100644 --- a/broker/core/inc/com/centreon/broker/time/time_info.hh +++ b/broker/core/inc/com/centreon/broker/time/time_info.hh @@ -19,9 +19,8 @@ #ifndef CCB_CORE_TIME_TIME_INFO_HH #define CCB_CORE_TIME_TIME_INFO_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace time { /** @@ -35,6 +34,6 @@ struct time_info { }; } // namespace time -CCB_END() +} #endif // !CCB_CORE_TIME_TIME_INFO_HH diff --git a/broker/core/inc/com/centreon/broker/time/timeperiod.hh b/broker/core/inc/com/centreon/broker/time/timeperiod.hh index 232ea458ce7..5523ac9bb02 100644 --- a/broker/core/inc/com/centreon/broker/time/timeperiod.hh +++ b/broker/core/inc/com/centreon/broker/time/timeperiod.hh @@ -19,11 +19,10 @@ #ifndef CCB_CORE_TIME_TIMEPERIOD_HH #define CCB_CORE_TIME_TIMEPERIOD_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/time/daterange.hh" #include "com/centreon/broker/time/timerange.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace time { /** @@ -121,6 +120,6 @@ class timeperiod { }; } // namespace time -CCB_END() +} #endif // !CCB_CORE_TIME_TIMEPERIOD_HH diff --git a/broker/core/inc/com/centreon/broker/time/timerange.hh b/broker/core/inc/com/centreon/broker/time/timerange.hh index b4bb27e68c2..efea5e01924 100644 --- a/broker/core/inc/com/centreon/broker/time/timerange.hh +++ b/broker/core/inc/com/centreon/broker/time/timerange.hh @@ -19,9 +19,8 @@ #ifndef CCB_CORE_TIME_TIMERANGE_HH #define CCB_CORE_TIME_TIMERANGE_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace time { /** @@ -65,6 +64,6 @@ class timerange { }; } // namespace time -CCB_END() +} #endif // !CCB_CORE_TIME_TIMERANGE_HH diff --git a/broker/core/inc/com/centreon/broker/time/timezone_locker.hh b/broker/core/inc/com/centreon/broker/time/timezone_locker.hh index b9eef0d0fb5..3571288e4d1 100644 --- a/broker/core/inc/com/centreon/broker/time/timezone_locker.hh +++ b/broker/core/inc/com/centreon/broker/time/timezone_locker.hh @@ -19,9 +19,8 @@ #ifndef CCB_CORE_TIME_TIMEZONE_LOCKER_HH #define CCB_CORE_TIME_TIMEZONE_LOCKER_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace time { /** @@ -43,6 +42,6 @@ class timezone_locker { }; } // namespace time -CCB_END() +} #endif // !CCB_CORE_TIME_TIMEZONE_LOCKER_HH diff --git a/broker/core/inc/com/centreon/broker/time/timezone_manager.hh b/broker/core/inc/com/centreon/broker/time/timezone_manager.hh index 00ad7d8afda..33e074d9b28 100644 --- a/broker/core/inc/com/centreon/broker/time/timezone_manager.hh +++ b/broker/core/inc/com/centreon/broker/time/timezone_manager.hh @@ -19,9 +19,8 @@ #ifndef CCB_CORE_TIME_TIMEZONE_MANAGER_HH #define CCB_CORE_TIME_TIMEZONE_MANAGER_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace time { /** @@ -68,6 +67,6 @@ class timezone_manager { }; } // namespace time -CCB_END() +} #endif // !CCB_CORE_TIME_TIMEZONE_MANAGER_HH diff --git a/broker/core/inc/com/centreon/broker/timestamp.hh b/broker/core/inc/com/centreon/broker/timestamp.hh index 16b099027b7..23b170cf330 100644 --- a/broker/core/inc/com/centreon/broker/timestamp.hh +++ b/broker/core/inc/com/centreon/broker/timestamp.hh @@ -1,28 +1,27 @@ -/* -** Copyright 2012,2015-2016, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2012,2015-2016, 2021 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_TIMESTAMP_HH #define CCB_TIMESTAMP_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class timestamp timestamp.hh "com/centreon/broker/timestamp.hh" @@ -69,8 +68,7 @@ struct timestamp { * @return This object. */ timestamp& operator=(const timestamp& right) { - if (this != &right) - _sec = right._sec; + if (this != &right) _sec = right._sec; return *this; } @@ -161,9 +159,9 @@ inline std::istream& operator>>(std::istream& stream, timestamp& ts) { std::time_t s; stream >> s; ts = timestamp(s); - return (stream); + return stream; } -CCB_END() +} // namespace com::centreon::broker #endif // !CCB_TIMESTAMP_HH diff --git a/broker/core/inc/com/centreon/broker/vars.hh.in b/broker/core/inc/com/centreon/broker/vars.hh.in index f07326680a7..4c7746ffdf9 100644 --- a/broker/core/inc/com/centreon/broker/vars.hh.in +++ b/broker/core/inc/com/centreon/broker/vars.hh.in @@ -19,14 +19,13 @@ #ifndef CBB_VARS_HH # define CBB_VARS_HH -# include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Paths. # define PREFIX_BIN "@PREFIX_BIN@" # define PREFIX_VAR "@PREFIX_VAR@" -CCB_END() +} #endif // !CBB_VARS_HH diff --git a/broker/core/inc/com/centreon/broker/version.hh.in b/broker/core/inc/com/centreon/broker/version.hh.in index 6227f813bca..62198225fdd 100644 --- a/broker/core/inc/com/centreon/broker/version.hh.in +++ b/broker/core/inc/com/centreon/broker/version.hh.in @@ -1,19 +1,27 @@ -/* -** Copyright 2013,2015 Merethis -** -** All rights reserved. -*/ +/** + * Copyright 2013-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_VERSION_HH # define CCB_VERSION_HH -# include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - # define CENTREON_BROKER_VERSION_INCLUDE "@CENTREON_BROKER_VERSION@" -namespace version { +namespace com::centreon::broker::version { // Compile-time values. unsigned int const major = @COLLECT_MAJOR@; unsigned int const minor = @COLLECT_MINOR@; @@ -21,6 +29,4 @@ namespace version { char const* const string = "@CENTREON_BROKER_VERSION@"; } -CCB_END() - #endif // !CCB_VERSION_HH diff --git a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/engine.hh b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/engine.hh index 75ec3e96869..0b3e0f6c9eb 100644 --- a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/engine.hh +++ b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/engine.hh @@ -1,5 +1,5 @@ -/* - * Copyright 2009-2012,2015,2019-2021 Centreon +/** + * Copyright 2009-2012,2015,2019-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,10 @@ #ifndef CCB_MULTIPLEXING_ENGINE_HH #define CCB_MULTIPLEXING_ENGINE_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/persistent_cache.hh" #include "com/centreon/broker/stats/center.hh" -CCB_BEGIN() - -namespace multiplexing { +namespace com::centreon::broker::multiplexing { // Forward declaration. class muxer; namespace detail { @@ -113,8 +110,6 @@ class engine { void subscribe(const std::shared_ptr& subscriber); void unsubscribe_muxer(const muxer* subscriber); }; -} // namespace multiplexing - -CCB_END() +} // namespace com::centreon::broker::multiplexing #endif // !CCB_MULTIPLEXING_ENGINE_HH diff --git a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer.hh b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer.hh index 21a75f8db3e..55480354b7b 100644 --- a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer.hh +++ b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer.hh @@ -1,32 +1,31 @@ -/* -** Copyright 2009-2017-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2009-2017-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MULTIPLEXING_MUXER_HH #define CCB_MULTIPLEXING_MUXER_HH #include + #include "com/centreon/broker/multiplexing/engine.hh" #include "com/centreon/broker/multiplexing/muxer_filter.hh" #include "com/centreon/broker/persistent_file.hh" -CCB_BEGIN() - -namespace multiplexing { +namespace com::centreon::broker::multiplexing { /** * @class muxer muxer.hh "com/centreon/broker/multiplexing/muxer.hh" * @brief Receive and send events from/to the multiplexing engine. @@ -83,10 +82,8 @@ class muxer : public io::stream { void _update_stats(void) noexcept; - muxer(std::string name, - const std::shared_ptr& parent, - const muxer_filter& r_filter, - const muxer_filter& w_filter, + muxer(std::string name, const std::shared_ptr& parent, + const muxer_filter& r_filter, const muxer_filter& w_filter, bool persistent = false); public: @@ -107,8 +104,7 @@ class muxer : public io::stream { void publish(const std::deque>& event); bool read(std::shared_ptr& event, time_t deadline) override; template - bool read(container& to_fill, - size_t max_to_read, + bool read(container& to_fill, size_t max_to_read, read_handler&& handler) noexcept; const std::string& read_filters_as_str() const; const std::string& write_filters_as_str() const; @@ -141,8 +137,7 @@ class muxer : public io::stream { * events as soon as data will be available */ template -bool muxer::read(container& to_fill, - size_t max_to_read, +bool muxer::read(container& to_fill, size_t max_to_read, read_handler&& handler) noexcept { std::unique_lock lock(_mutex); @@ -163,8 +158,6 @@ bool muxer::read(container& to_fill, } } -} // namespace multiplexing - -CCB_END() +} // namespace com::centreon::broker::multiplexing #endif // !CCB_MULTIPLEXING_MUXER_HH diff --git a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer_filter.hh b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer_filter.hh index 0d01d8bf2fb..38aa5301b36 100644 --- a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer_filter.hh +++ b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/muxer_filter.hh @@ -20,11 +20,8 @@ #define CCB_MULTIPLEXING_MUXER_FILTER_HH #include "bbdo/events.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace multiplexing { +namespace com::centreon::broker::multiplexing { namespace detail { constexpr uint64_t all_events = 0xFFFFFFFFFFFFFFFF; @@ -171,8 +168,7 @@ class muxer_filter { const uint64_t* other_mask = other._mask; for (uint64_t* to_compare = _mask; to_compare < _mask + max_filter_category; ++to_compare, ++other_mask) { - if (*to_compare != *other_mask) - return false; + if (*to_compare != *other_mask) return false; } return true; } @@ -254,8 +250,6 @@ class muxer_filter { } }; -} // namespace multiplexing - -CCB_END() +} // namespace com::centreon::broker::multiplexing #endif diff --git a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/publisher.hh b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/publisher.hh index c0f82752d57..e24c114ba01 100644 --- a/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/publisher.hh +++ b/broker/core/multiplexing/inc/com/centreon/broker/multiplexing/publisher.hh @@ -1,30 +1,27 @@ -/* -** Copyright 2011-2013, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013, 2020-2021 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_MULTIPLEXING_PUBLISHER_HH #define CCB_MULTIPLEXING_PUBLISHER_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace multiplexing { +namespace com::centreon::broker::multiplexing { /** * @class publisher publisher.hh * "com/centreon/broker/multiplexing/publisher.hh" @@ -47,8 +44,6 @@ class publisher : public io::stream { int32_t write(const std::deque>& to_publish); int32_t stop() override; }; -} // namespace multiplexing - -CCB_END() +} // namespace com::centreon::broker::multiplexing #endif // !CCB_MULTIPLEXING_PUBLISHER_HH diff --git a/broker/core/multiplexing/src/engine.cc b/broker/core/multiplexing/src/engine.cc index 40e93461ebe..f59dae2506a 100644 --- a/broker/core/multiplexing/src/engine.cc +++ b/broker/core/multiplexing/src/engine.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2009-2013,2015, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2009-2013,2015, 2020-2021 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/multiplexing/engine.hh" @@ -307,10 +307,7 @@ std::string engine::_cache_file_path() const { return retval; } -CCB_BEGIN() - -namespace multiplexing { -namespace detail { +namespace com::centreon::broker::multiplexing::detail { /** * @brief The goal of this class is to do the completion job once all muxer has @@ -343,9 +340,7 @@ class callback_caller { } }; -} // namespace detail -} // namespace multiplexing -CCB_END() +} // namespace com::centreon::broker::multiplexing::detail /** * @brief diff --git a/broker/core/multiplexing/src/muxer.cc b/broker/core/multiplexing/src/muxer.cc index 6f431bd17e3..1e02aab8ee4 100644 --- a/broker/core/multiplexing/src/muxer.cc +++ b/broker/core/multiplexing/src/muxer.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015-2017,2019-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015-2017,2019-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/multiplexing/muxer.hh" diff --git a/broker/core/multiplexing/src/publisher.cc b/broker/core/multiplexing/src/publisher.cc index 32ebc85838b..326181bf6c7 100644 --- a/broker/core/multiplexing/src/publisher.cc +++ b/broker/core/multiplexing/src/publisher.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/multiplexing/publisher.hh" diff --git a/broker/core/multiplexing/test/engine/hooker.cc b/broker/core/multiplexing/test/engine/hooker.cc index 6927740e072..bd9acc481c0 100644 --- a/broker/core/multiplexing/test/engine/hooker.cc +++ b/broker/core/multiplexing/test/engine/hooker.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/multiplexing/test/engine/start_stop.cc b/broker/core/multiplexing/test/engine/start_stop.cc index 2ab93bd0c9e..41776f99be2 100644 --- a/broker/core/multiplexing/test/engine/start_stop.cc +++ b/broker/core/multiplexing/test/engine/start_stop.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/multiplexing/test/muxer/read.cc b/broker/core/multiplexing/test/muxer/read.cc index 01161c003b3..140b801d75c 100644 --- a/broker/core/multiplexing/test/muxer/read.cc +++ b/broker/core/multiplexing/test/muxer/read.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/multiplexing/test/publisher/read.cc b/broker/core/multiplexing/test/publisher/read.cc index 3255d98a15f..b9b4da85ab4 100644 --- a/broker/core/multiplexing/test/publisher/read.cc +++ b/broker/core/multiplexing/test/publisher/read.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/multiplexing/test/publisher/write.cc b/broker/core/multiplexing/test/publisher/write.cc index 377f25865f9..f6ca3ee52e1 100644 --- a/broker/core/multiplexing/test/publisher/write.cc +++ b/broker/core/multiplexing/test/publisher/write.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh b/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh index a03a751d1d4..f9afd89149f 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh @@ -19,9 +19,8 @@ #ifndef CCB_DATABASE_CONFIG_HH #define CCB_DATABASE_CONFIG_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. namespace config { @@ -111,7 +110,7 @@ class database_config { std::ostream& operator<<(std::ostream& s, const database_config cfg); -CCB_END() +} namespace fmt { // formatter specializations for fmt diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql.hh index 7443e072e44..1cdba2159a4 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql.hh @@ -20,7 +20,7 @@ #include "com/centreon/broker/sql/mysql_connection.hh" -CCB_BEGIN() +namespace com::centreon::broker { using my_error = database::mysql_error; /** @@ -102,6 +102,6 @@ class mysql { bool _support_bulk_statement; }; -CCB_END() +} #endif // CCB_MYSQL_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind.hh index 80a8dc2f046..3c4c1891242 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind.hh @@ -23,7 +23,7 @@ #include "com/centreon/broker/sql/mysql_bind_base.hh" #include "com/centreon/broker/sql/mysql_column.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations class mysql; @@ -295,6 +295,6 @@ class mysql_bind : public mysql_bind_base { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_BIND_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh index a9699fbb8db..ebcc72bdd38 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh @@ -20,9 +20,8 @@ #define CCB_MYSQL_BIND_BASE_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations class mysql; @@ -57,6 +56,6 @@ class mysql_bind_base { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_BIND_BASE_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_result.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_result.hh index 69d0079361b..3c594f746ce 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_result.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_result.hh @@ -23,7 +23,7 @@ #include "com/centreon/broker/sql/mysql_bind_base.hh" #include "com/centreon/broker/sql/mysql_column.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations class mysql; @@ -287,6 +287,6 @@ class mysql_bind_result : public mysql_bind_base { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_BIND_RESULT_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_bind.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_bind.hh index 23ed05b28ba..ce0d3f0ac32 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_bind.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_bind.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/sql/mysql_bind_base.hh" #include "com/centreon/broker/sql/mysql_column.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations class mysql; @@ -310,6 +310,6 @@ class mysql_bulk_bind : public mysql_bind_base { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_BULK_BIND_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_stmt.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_stmt.hh index 15f31c32ee4..d8c27e0bbae 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_stmt.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bulk_stmt.hh @@ -23,7 +23,7 @@ #include "com/centreon/broker/sql/mysql_bulk_bind.hh" #include "com/centreon/broker/sql/mysql_stmt_base.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace database { class mysql_bulk_stmt : public mysql_stmt_base { @@ -214,6 +214,6 @@ class mysql_bulk_stmt : public mysql_stmt_base { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_BULK_STMT_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh index f02dbac02fb..feae2d3f3e6 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh @@ -22,9 +22,8 @@ #include #include #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace database { class mysql_column { @@ -238,6 +237,6 @@ class mysql_column { } // namespace database -CCB_END() +} #endif // CCB_DATABASE_MYSQL_COLUMN_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh index c3a0b8b196b..305feb778d8 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh @@ -29,7 +29,7 @@ #include "com/centreon/broker/sql/stats.hh" #include "com/centreon/broker/stats/center.hh" -CCB_BEGIN() +namespace com::centreon::broker { using my_error = database::mysql_error; @@ -201,6 +201,6 @@ class mysql_connection { void stop(); }; -CCB_END() +} #endif // CCB_MYSQL_CONNECTION_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_error.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_error.hh index da7eb403db2..c17474ce168 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_error.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_error.hh @@ -21,9 +21,8 @@ #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace database { /** @@ -228,6 +227,6 @@ class mysql_error { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_ERROR_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_manager.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_manager.hh index ca3c9f96c55..4a17ff813a5 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_manager.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_manager.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/sql/mysql_error.hh" #include "com/centreon/broker/stats/center.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class mysql_manager mysql_manager.hh @@ -86,6 +86,6 @@ class mysql_manager { size_t connections_count() const; }; -CCB_END() +} #endif // CCB_MYSQL_MANAGER_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_multi_insert.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_multi_insert.hh index a20d187e4bb..2af840142ed 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_multi_insert.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_multi_insert.hh @@ -24,7 +24,7 @@ #include "com/centreon/broker/sql/mysql_bulk_stmt.hh" #include "com/centreon/broker/sql/mysql_stmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace database { @@ -212,6 +212,6 @@ class bulk_or_multi { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_MULTI_INSERT_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_result.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_result.hh index 92dfa47c3cd..d1223823370 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_result.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_result.hh @@ -20,7 +20,7 @@ #include "com/centreon/broker/sql/mysql_bind_result.hh" -CCB_BEGIN() +namespace com::centreon::broker { class mysql_connection; @@ -74,6 +74,6 @@ class mysql_result { }; } // namespace database -CCB_END() +} #endif // CCB_MYSQL_RESULT_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt.hh index 8a08e97bbac..faa75762602 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/sql/mysql_stmt_base.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace database { class mysql_stmt : public mysql_stmt_base { @@ -208,6 +208,6 @@ class mysql_stmt : public mysql_stmt_base { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_STMT_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt_base.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt_base.hh index 909802684e0..ddc559ac524 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt_base.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_stmt_base.hh @@ -23,7 +23,7 @@ #include "com/centreon/broker/log_v2.hh" #include "com/centreon/broker/sql/mysql_bind.hh" -CCB_BEGIN() +namespace com::centreon::broker { typedef absl::flat_hash_map mysql_bind_mapping; @@ -414,6 +414,6 @@ class mysql_stmt_base { } // namespace database -CCB_END() +} #endif // CCB_MYSQL_STMT_BASE_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_task.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_task.hh index 3c9bb2f3c4e..107e71b7a11 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_task.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_task.hh @@ -24,7 +24,7 @@ using msg_fmt = com::centreon::exceptions::msg_fmt; -CCB_BEGIN() +namespace com::centreon::broker { typedef int (*mysql_callback)(MYSQL* conn, void* data); @@ -214,6 +214,6 @@ class mysql_task_statement_int : public mysql_task { }; } // namespace database -CCB_END() +} #endif // CCB_MYSQL_TASK_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/query_preparator.hh b/broker/core/sql/inc/com/centreon/broker/sql/query_preparator.hh index 90ddc4d7a2e..2beaf51abdd 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/query_preparator.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/query_preparator.hh @@ -19,10 +19,9 @@ #ifndef CCB_QUERY_PREPARATOR_HH #define CCB_QUERY_PREPARATOR_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/mysql.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class query_preparator query_preparator.hh @@ -112,6 +111,6 @@ class query_preparator { const std::string& table); }; -CCB_END() +} #endif // !CCB_QUERY_PREPARATOR_HH diff --git a/broker/core/sql/inc/com/centreon/broker/sql/stats.hh b/broker/core/sql/inc/com/centreon/broker/sql/stats.hh index a576ccc0940..d5673c4f249 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/stats.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/stats.hh @@ -22,7 +22,7 @@ #include #include "com/centreon/broker/config/applier/state.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace sql { @@ -221,6 +221,6 @@ class stats { } // namespace sql -CCB_END() +} #endif /* !CCB_STATS_HH */ diff --git a/broker/core/sql/src/database_config.cc b/broker/core/sql/src/database_config.cc index 86a2aa60830..dabff29240a 100644 --- a/broker/core/sql/src/database_config.cc +++ b/broker/core/sql/src/database_config.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/database_config.hh" @@ -24,7 +24,7 @@ using namespace com::centreon::broker; -CCB_BEGIN() +namespace com::centreon::broker { std::ostream& operator<<(std::ostream& s, const database_config cfg) { s << cfg.get_type() << ": " << cfg.get_user() << '@'; if (cfg.get_socket().empty()) { @@ -39,7 +39,7 @@ std::ostream& operator<<(std::ostream& s, const database_config cfg) { return s; } -CCB_END() +} /** * Default constructor. diff --git a/broker/core/sql/src/mysql.cc b/broker/core/sql/src/mysql.cc index 3aa43a70ec2..9d5c053b63d 100644 --- a/broker/core/sql/src/mysql.cc +++ b/broker/core/sql/src/mysql.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include @@ -388,13 +388,13 @@ void mysql::_get_server_infos() { _server_version = future.get(); } - std::vector v = + std::vector v = absl::StrSplit(_server_version, absl::ByAnyChar(".-")); if (v.size() >= 4) { int32_t major; int32_t minor; int32_t patch; - absl::string_view server = v[3]; + std::string_view server = v[3]; if (absl::SimpleAtoi(v[0], &major) && absl::SimpleAtoi(v[1], &minor) && absl::SimpleAtoi(v[2], &patch)) { log_v2::sql()->info("connected to '{}' Server, version {}.{}.{}", diff --git a/broker/core/sql/src/mysql_bind.cc b/broker/core/sql/src/mysql_bind.cc index 60327c5cfc1..4216f3f99e3 100644 --- a/broker/core/sql/src/mysql_bind.cc +++ b/broker/core/sql/src/mysql_bind.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_bind.hh" diff --git a/broker/core/sql/src/mysql_bind_base.cc b/broker/core/sql/src/mysql_bind_base.cc index 429392a85ed..faa2ec8d865 100644 --- a/broker/core/sql/src/mysql_bind_base.cc +++ b/broker/core/sql/src/mysql_bind_base.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_bind_base.hh" diff --git a/broker/core/sql/src/mysql_bind_result.cc b/broker/core/sql/src/mysql_bind_result.cc index 919aac63ef6..d1473124cce 100644 --- a/broker/core/sql/src/mysql_bind_result.cc +++ b/broker/core/sql/src/mysql_bind_result.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_bind_result.hh" diff --git a/broker/core/sql/src/mysql_bulk_bind.cc b/broker/core/sql/src/mysql_bulk_bind.cc index 361661b299a..6c7b5c11bc1 100644 --- a/broker/core/sql/src/mysql_bulk_bind.cc +++ b/broker/core/sql/src/mysql_bulk_bind.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018, 2021-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018, 2021-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_bulk_bind.hh" diff --git a/broker/core/sql/src/mysql_bulk_stmt.cc b/broker/core/sql/src/mysql_bulk_stmt.cc index e60767a62eb..b87ab21ba12 100644 --- a/broker/core/sql/src/mysql_bulk_stmt.cc +++ b/broker/core/sql/src/mysql_bulk_stmt.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_bulk_stmt.hh" diff --git a/broker/core/sql/src/mysql_column.cc b/broker/core/sql/src/mysql_column.cc index 929a3f12da9..763c267a3dc 100644 --- a/broker/core/sql/src/mysql_column.cc +++ b/broker/core/sql/src/mysql_column.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_column.hh" diff --git a/broker/core/sql/src/mysql_connection.cc b/broker/core/sql/src/mysql_connection.cc index 1e813e2ca0c..db18b4e50f3 100644 --- a/broker/core/sql/src/mysql_connection.cc +++ b/broker/core/sql/src/mysql_connection.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/core/sql/src/mysql_manager.cc b/broker/core/sql/src/mysql_manager.cc index dfbeb878d5b..dbc4bef13d1 100644 --- a/broker/core/sql/src/mysql_manager.cc +++ b/broker/core/sql/src/mysql_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_manager.hh" diff --git a/broker/core/sql/src/mysql_multi_insert.cc b/broker/core/sql/src/mysql_multi_insert.cc index 2469f4911aa..60e07dca0c1 100644 --- a/broker/core/sql/src/mysql_multi_insert.cc +++ b/broker/core/sql/src/mysql_multi_insert.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_multi_insert.hh" diff --git a/broker/core/sql/src/mysql_result.cc b/broker/core/sql/src/mysql_result.cc index ea859f7aca2..113499de80f 100644 --- a/broker/core/sql/src/mysql_result.cc +++ b/broker/core/sql/src/mysql_result.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_result.hh" diff --git a/broker/core/sql/src/mysql_stmt.cc b/broker/core/sql/src/mysql_stmt.cc index 0ca81b7abe0..171690548be 100644 --- a/broker/core/sql/src/mysql_stmt.cc +++ b/broker/core/sql/src/mysql_stmt.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_stmt.hh" diff --git a/broker/core/sql/src/mysql_stmt_base.cc b/broker/core/sql/src/mysql_stmt_base.cc index b1c7d3e661d..3ef1e39f730 100644 --- a/broker/core/sql/src/mysql_stmt_base.cc +++ b/broker/core/sql/src/mysql_stmt_base.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/mysql_stmt_base.hh" diff --git a/broker/core/sql/src/query_preparator.cc b/broker/core/sql/src/query_preparator.cc index 6f5fd63de7d..d4168180570 100644 --- a/broker/core/sql/src/query_preparator.cc +++ b/broker/core/sql/src/query_preparator.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015, 2020-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015, 2020-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/query_preparator.hh" diff --git a/broker/core/sql/src/stats.cc b/broker/core/sql/src/stats.cc index ce9edb10cbe..cebeb8d7fb1 100644 --- a/broker/core/sql/src/stats.cc +++ b/broker/core/sql/src/stats.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/stats.hh" diff --git a/broker/core/sql/src/table_max_size.py b/broker/core/sql/src/table_max_size.py index 08a887fe775..f2eb56b8714 100644 --- a/broker/core/sql/src/table_max_size.py +++ b/broker/core/sql/src/table_max_size.py @@ -1,20 +1,20 @@ #!/usr/bin/python3 """ -** Copyright 2019-2020 Centreon -** -** Licensed under the Apache License, Version 2.0(the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +* Copyright 2019-2020 Centreon +* +* Licensed under the Apache License, Version 2.0(the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com """ import sys @@ -109,12 +109,10 @@ def print_dbg(s): #ifndef __TABLE_MAX_SIZE_HH__ #define __TABLE_MAX_SIZE_HH__ -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() +namespace com::centreon::broker { """) # fp.write(enum) fp.write(cols) - fp.write("\n\nCCB_END()\n\n#endif /* __TABLE_MAX_SIZE_HH__ */") + fp.write("\n\n}\n\n#endif /* __TABLE_MAX_SIZE_HH__ */") diff --git a/broker/core/src/bbdo/acceptor.cc b/broker/core/src/bbdo/acceptor.cc index a9e2d26412b..df44f7cdeab 100644 --- a/broker/core/src/bbdo/acceptor.cc +++ b/broker/core/src/bbdo/acceptor.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bbdo/acceptor.hh" @@ -52,7 +52,8 @@ acceptor::acceptor(std::string name, bool one_peer_retention_mode, bool coarse, uint32_t ack_limit, - std::list>&& extensions) + std::list>&& extensions, + bool grpc_serialized) : io::endpoint(!one_peer_retention_mode, {}), _coarse(coarse), _name(std::move(name)), @@ -60,7 +61,8 @@ acceptor::acceptor(std::string name, _is_output(one_peer_retention_mode), _timeout(timeout), _ack_limit(ack_limit), - _extensions{extensions} { + _extensions{extensions}, + _grpc_serialized(grpc_serialized) { if (_timeout == (time_t)-1 || _timeout == 0) _timeout = 3; } @@ -87,7 +89,8 @@ std::shared_ptr acceptor::open() { if (u) { assert(!_coarse); // if _is_output, the stream is an output - auto my_bbdo = std::make_unique(!_is_output, _extensions); + auto my_bbdo = std::make_unique( + !_is_output, _grpc_serialized, _extensions); my_bbdo->set_substream(std::move(u)); my_bbdo->set_coarse(_coarse); my_bbdo->set_negotiate(_negotiate); diff --git a/broker/core/src/bbdo/connector.cc b/broker/core/src/bbdo/connector.cc index 5a0dbcab959..13320a4ad33 100644 --- a/broker/core/src/bbdo/connector.cc +++ b/broker/core/src/bbdo/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2015,2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2015,2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bbdo/connector.hh" @@ -45,7 +45,8 @@ connector::connector(bool negotiate, bool connector_is_input, bool coarse, uint32_t ack_limit, - std::list>&& extensions) + std::list>&& extensions, + bool grpc_serialized) : io::endpoint{false, {}}, _is_input{connector_is_input}, _coarse{coarse}, @@ -53,7 +54,8 @@ connector::connector(bool negotiate, // FIXME DBR: why this trick? _timeout(timeout == -1 || timeout == 0 ? 3 : timeout), _ack_limit{ack_limit}, - _extensions{std::move(extensions)} {} + _extensions{std::move(extensions)}, + _grpc_serialized(grpc_serialized) {} /** * Open the connector. @@ -68,7 +70,6 @@ std::shared_ptr connector::open() { if (_from) // Open lower layer connection and add our own layer. retval = _open(_from->open()); - return retval; } @@ -82,7 +83,8 @@ std::shared_ptr connector::_open( std::unique_ptr bbdo_stream; if (stream) { // if _is_input, the stream is an input - bbdo_stream = std::make_unique(_is_input, _extensions); + bbdo_stream = std::make_unique(_is_input, _grpc_serialized, + _extensions); bbdo_stream->set_substream(stream); bbdo_stream->set_coarse(_coarse); bbdo_stream->set_negotiate(_negotiate); diff --git a/broker/core/src/bbdo/factory.cc b/broker/core/src/bbdo/factory.cc index 4a4d3947c66..161205b4506 100644 --- a/broker/core/src/bbdo/factory.cc +++ b/broker/core/src/bbdo/factory.cc @@ -1,25 +1,27 @@ -/* -** Copyright 2013,2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013,2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ -#include "com/centreon/broker/bbdo/factory.hh" +#include #include "com/centreon/broker/bbdo/acceptor.hh" #include "com/centreon/broker/bbdo/connector.hh" +#include "com/centreon/broker/bbdo/factory.hh" +#include "com/centreon/broker/config/applier/state.hh" #include "com/centreon/broker/config/parser.hh" #include "com/centreon/broker/io/protocols.hh" #include "com/centreon/broker/log_v2.hh" @@ -78,26 +80,27 @@ io::endpoint* factory::new_endpoint( // Return value. std::unique_ptr retval; + std::map::const_iterator it; // Coarse endpoint ? bool coarse = false; - { - auto it = cfg.params.find("coarse"); - if (it != cfg.params.end()) { - if (!absl::SimpleAtob(it->second, &coarse)) { - log_v2::bbdo()->error( - "factory: cannot parse the 'coarse' boolean: the content is '{}'", - it->second); - coarse = false; - } + it = cfg.params.find("coarse"); + if (it != cfg.params.end()) { + if (!absl::SimpleAtob(it->second, &coarse)) { + log_v2::bbdo()->error( + "factory: cannot parse the 'coarse' boolean: the content is '{}'", + it->second); + coarse = false; } } + // only grpc serialization? + bool grpc_serialized = direct_grpc_serialized(cfg); + // Negotiation allowed ? bool negotiate = false; std::list> extensions; if (!coarse) { - std::map::const_iterator it( - cfg.params.find("negotiation")); + it = cfg.params.find("negotiation"); if (it == cfg.params.end() || it->second != "no") negotiate = true; extensions = _extensions(cfg); @@ -105,24 +108,19 @@ io::endpoint* factory::new_endpoint( // Ack limit. uint32_t ack_limit{1000}; - { - std::map::const_iterator it( - cfg.params.find("ack_limit")); - if (it != cfg.params.end() && !absl::SimpleAtoi(it->second, &ack_limit)) { - log_v2::bbdo()->error( - "BBDO: Bad value for ack_limit, it must be an integer."); - ack_limit = 1000; - } + it = cfg.params.find("ack_limit"); + if (it != cfg.params.end() && !absl::SimpleAtoi(it->second, &ack_limit)) { + log_v2::bbdo()->error( + "BBDO: Bad value for ack_limit, it must be an integer."); + ack_limit = 1000; } // Create object. std::string host; - { - std::map::const_iterator it{ - cfg.params.find("host")}; - if (it != cfg.params.end()) - host = it->second; - } + + it = cfg.params.find("host"); + if (it != cfg.params.end()) + host = it->second; /* The substream is an acceptor (usually the substream a TCP acceptor */ if (is_acceptor) { @@ -130,12 +128,13 @@ io::endpoint* factory::new_endpoint( // When the connection is made to the map server, no retention is needed, // otherwise we want it. bool keep_retention{false}; - auto it = cfg.params.find("retention"); + it = cfg.params.find("retention"); if (it != cfg.params.end()) { if (cfg.type == "bbdo_server") { if (!absl::SimpleAtob(it->second, &keep_retention)) { log_v2::bbdo()->error( - "BBDO: cannot parse the 'retention' boolean: its content is '{}'", + "BBDO: cannot parse the 'retention' boolean: its content is " + "'{}'", it->second); keep_retention = false; } @@ -167,7 +166,7 @@ io::endpoint* factory::new_endpoint( retval = std::make_unique( cfg.name, negotiate, cfg.read_timeout, acceptor_is_output, coarse, - ack_limit, std::move(extensions)); + ack_limit, std::move(extensions), grpc_serialized); if (acceptor_is_output && keep_retention) is_acceptor = false; log_v2::bbdo()->debug("BBDO: new acceptor {}", cfg.name); @@ -175,7 +174,7 @@ io::endpoint* factory::new_endpoint( bool connector_is_input = cfg.get_io_type() == config::endpoint::input; retval = std::make_unique( negotiate, cfg.read_timeout, connector_is_input, coarse, ack_limit, - std::move(extensions)); + std::move(extensions), grpc_serialized); log_v2::bbdo()->debug("BBDO: new connector {}", cfg.name); } return retval.release(); diff --git a/broker/core/src/bbdo/internal.cc b/broker/core/src/bbdo/internal.cc index 176139c6fb5..2eb6f32e946 100644 --- a/broker/core/src/bbdo/internal.cc +++ b/broker/core/src/bbdo/internal.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bbdo/internal.hh" diff --git a/broker/core/src/bbdo/stream.cc b/broker/core/src/bbdo/stream.cc index b3dfc05e8ac..796e3e1c14c 100644 --- a/broker/core/src/bbdo/stream.cc +++ b/broker/core/src/bbdo/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013,2015,2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013,2015,2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/bbdo/stream.hh" @@ -598,9 +598,14 @@ static io::raw* serialize(const io::data& e) { } /** - * Default constructor. + * @brief Construct a new stream::stream object + * + * @param is_input true if we receive bbdo events such as broker input + * @param grpc_serialized true if serialization is done by grpc stream only + * @param extensions */ stream::stream(bool is_input, + bool grpc_serialized, const std::list>& extensions) : io::stream("BBDO"), _skipped(0), @@ -614,7 +619,8 @@ stream::stream(bool is_input, _events_received_since_last_ack(0), _last_sent_ack(time(nullptr)), _extensions{extensions}, - _bbdo_version(config::applier::state::instance().get_bbdo_version()) { + _bbdo_version(config::applier::state::instance().get_bbdo_version()), + _grpc_serialized(grpc_serialized) { SPDLOG_LOGGER_DEBUG(log_v2::core(), "create bbdo stream {:p}", static_cast(this)); } @@ -650,14 +656,14 @@ int32_t stream::stop() { } } - _substream->stop(); - /* We acknowledge peer about received events. */ log_v2::core()->info("bbdo stream stopped with {} events acknowledged", _events_received_since_last_ack); if (_events_received_since_last_ack) send_event_acknowledgement(); + _substream->stop(); + /* We return the number of events handled by our stream. */ int32_t retval = _acknowledged_events; _acknowledged_events = 0; @@ -928,7 +934,7 @@ void stream::negotiate(stream::negotiation_type neg) { log_v2::bbdo(), "BBDO: we have extensions '{}' and peer has '{}'", extensions, fmt::string_view(peer_extensions.data(), peer_extensions.size())); - std::list peer_ext{absl::StrSplit(peer_extensions, ' ')}; + std::list peer_ext{absl::StrSplit(peer_extensions, ' ')}; for (auto& ext : _extensions) { // Find matching extension in peer extension list. auto peer_it{std::find(peer_ext.begin(), peer_ext.end(), ext->name())}; @@ -1152,6 +1158,12 @@ bool stream::_read_any(std::shared_ptr& d, time_t deadline) { for (;;) { /* Maybe we have to complete the header. */ _read_packet(BBDO_HEADER_SIZE, deadline); + if (!_grpc_serialized_queue.empty()) { + d = _grpc_serialized_queue.front(); + SPDLOG_LOGGER_TRACE(log_v2::bbdo(), "read event: {}", *d); + _grpc_serialized_queue.pop_front(); + return true; + } // Packet size is now at least BBDO_HEADER_SIZE and maybe contains // already a full BBDO packet. @@ -1195,6 +1207,7 @@ bool stream::_read_any(std::shared_ptr& d, time_t deadline) { // It is time to finish to read the packet. _read_packet(BBDO_HEADER_SIZE + packet_size, deadline); + // Now, _packet contains at least BBDO_HEADER_SIZE + packet_size bytes. std::vector content; @@ -1324,6 +1337,8 @@ bool stream::_read_any(std::shared_ptr& d, time_t deadline) { * just not finished, and so no data are lost. Received packets are BBDO packets * or maybe pieces of BBDO packets, so we keep vectors as is because usually a * vector should just represent a packet. + * In case of event serialized only by grpc stream, we store it in + * _grpc_serialized_queue * * @param size The wanted final size * @param deadline A time_t. @@ -1334,14 +1349,20 @@ void stream::_read_packet(size_t size, time_t deadline) { std::shared_ptr d; bool timeout = !_substream->read(d, deadline); - if (d && d->type() == io::raw::static_type()) { - std::vector& new_v = std::static_pointer_cast(d)->_buffer; - if (!new_v.empty()) { - if (_packet.size() == 0) { - _packet = std::move(new_v); - new_v.clear(); - } else - _packet.insert(_packet.end(), new_v.begin(), new_v.end()); + if (d) { + if (d->type() == io::raw::static_type()) { + std::vector& new_v = + std::static_pointer_cast(d)->_buffer; + if (!new_v.empty()) { + if (_packet.size() == 0) { + _packet = std::move(new_v); + new_v.clear(); + } else + _packet.insert(_packet.end(), new_v.begin(), new_v.end()); + } + } else { + _grpc_serialized_queue.push_back(d); + return; } } if (timeout) { @@ -1407,14 +1428,17 @@ void stream::statistics(nlohmann::json& tree) const { void stream::_write(const std::shared_ptr& d) { assert(d); - // Check if data exists. - std::shared_ptr serialized(serialize(*d)); - if (serialized) { - SPDLOG_LOGGER_TRACE(log_v2::bbdo(), - "BBDO: serialized event of type {} to {} bytes", - d->type(), serialized->size()); - _substream->write(serialized); - } + if (!_grpc_serialized || !std::dynamic_pointer_cast(d)) { + // Check if data exists. + std::shared_ptr serialized(serialize(*d)); + if (serialized) { + SPDLOG_LOGGER_TRACE(log_v2::bbdo(), + "BBDO: serialized event of type {} to {} bytes", + d->type(), serialized->size()); + _substream->write(serialized); + } + } else + _substream->write(d); } /** diff --git a/broker/core/src/broker_impl.cc b/broker/core/src/broker_impl.cc index dc87fd269e8..359187644ce 100644 --- a/broker/core/src/broker_impl.cc +++ b/broker/core/src/broker_impl.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020-2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/src/brokerrpc.cc b/broker/core/src/brokerrpc.cc index 6419763f0c0..cc9ae58b4f2 100644 --- a/broker/core/src/brokerrpc.cc +++ b/broker/core/src/brokerrpc.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019-2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -50,6 +50,10 @@ brokerrpc::brokerrpc(const std::string& address, e.register_event(make_type(io::bbdo, bbdo::de_remove_poller), "remove_poller", &bbdo::pb_remove_poller::operations); + /* Let's register the ba_info event. */ + e.register_event(make_type(io::extcmd, extcmd::de_ba_info), "ba_info", + &extcmd::pb_ba_info::operations); + _service.set_broker_name(broker_name); std::string server_address{fmt::format("{}:{}", address, port)}; grpc::ServerBuilder builder; diff --git a/broker/core/src/cache/global_cache.cc b/broker/core/src/cache/global_cache.cc index 65a7df2fd7f..ccb789de107 100644 --- a/broker/core/src/cache/global_cache.cc +++ b/broker/core/src/cache/global_cache.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/cache/global_cache_data.hh" @@ -27,7 +27,7 @@ using namespace com::centreon::broker::cache; global_cache::lock::lock() : _lock(&global_cache::_instance->_protect) {} inline std::string operator+(const std::string& left, - const absl::string_view& to_append) { + const std::string_view& to_append) { std::string ret(left); ret.append(to_append.data(), to_append.length()); return ret; diff --git a/broker/core/src/cache/global_cache_data.cc b/broker/core/src/cache/global_cache_data.cc index a6cd89f7677..876f064069f 100644 --- a/broker/core/src/cache/global_cache_data.cc +++ b/broker/core/src/cache/global_cache_data.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/cache/global_cache_data.hh" #include "com/centreon/broker/log_v2.hh" @@ -63,8 +63,8 @@ void global_cache_data::managed_map(bool create) { */ void global_cache_data::set_metric_info(uint64_t metric_id, uint64_t index_id, - const absl::string_view& name, - const absl::string_view& unit, + const std::string_view& name, + const std::string_view& unit, double min, double max) { try { @@ -105,7 +105,7 @@ void global_cache_data::set_metric_info(uint64_t metric_id, * @param instance_name */ void global_cache_data::store_instance(uint64_t instance_id, - const absl::string_view& instance_name) { + const std::string_view& instance_name) { try { absl::WriterMutexLock l(&_protect); auto exist = _id_to_instance->find(instance_id); @@ -137,7 +137,7 @@ void global_cache_data::store_instance(uint64_t instance_id, * @param severity_id */ void global_cache_data::store_host(uint64_t host_id, - const absl::string_view& host_name, + const std::string_view& host_name, uint64_t resource_id, uint64_t severity_id) { try { @@ -177,7 +177,7 @@ void global_cache_data::store_host(uint64_t host_id, void global_cache_data::store_service( uint64_t host_id, uint64_t service_id, - const absl::string_view& service_description, + const std::string_view& service_description, uint64_t resource_id, uint64_t severity_id) { try { @@ -239,15 +239,18 @@ void global_cache_data::set_index_mapping(uint64_t index_id, * * @param group * @param host + * @param poller_id */ -void global_cache_data::add_host_group(uint64_t group, uint64_t host) { +void global_cache_data::add_host_to_group(uint64_t group, + uint64_t host, + uint64_t poller_id) { try { absl::WriterMutexLock l(&_protect); - _host_group->emplace(host_group_element{host, group}); + _host_group->emplace(host_group_element{host, group, poller_id}); } catch (const interprocess::bad_alloc& e) { SPDLOG_LOGGER_DEBUG(log_v2::core(), "file full => grow"); allocation_exception_handler(); - add_host_group(group, host); + add_host_to_group(group, host, poller_id); } } @@ -263,13 +266,22 @@ void global_cache_data::remove_host_from_group(uint64_t group, uint64_t host) { } /** - * @brief remove host group + * @brief remove all members of an host group and poller * - * @param group + * @param group id of the group + * @param poller_id id of the poller */ -void global_cache_data::remove_host_group(uint64_t group) { +void global_cache_data::remove_host_group_members(uint64_t group, + uint64_t poller_id) { absl::WriterMutexLock l(&_protect); - _host_group->get<1>().erase(group); + auto range_iters = _host_group->get<1>().equal_range(group); + while (range_iters.first != range_iters.second) { + if (range_iters.first->poller_id == poller_id) { + range_iters.first = _host_group->get<1>().erase(range_iters.first); + } else { + ++range_iters.first; + } + } } /** @@ -278,17 +290,20 @@ void global_cache_data::remove_host_group(uint64_t group) { * @param group * @param host * @param service + * @param poller_id */ -void global_cache_data::add_service_group(uint64_t group, - uint64_t host, - uint64_t service) { +void global_cache_data::add_service_to_group(uint64_t group, + uint64_t host, + uint64_t service, + uint64_t poller_id) { try { absl::WriterMutexLock l(&_protect); - _service_group->emplace(service_group_element{{host, service}, group}); + _service_group->emplace( + service_group_element{{host, service}, group, poller_id}); } catch (const interprocess::bad_alloc& e) { SPDLOG_LOGGER_DEBUG(log_v2::core(), "file full => grow"); allocation_exception_handler(); - add_service_group(group, host, service); + add_service_to_group(group, host, service, poller_id); } } @@ -307,13 +322,22 @@ void global_cache_data::remove_service_from_group(uint64_t group, } /** - * @brief remove a service group + * @brief remove all members of a service group and a poller * - * @param group + * @param group id of a group + * @param poller_id id of the poller */ -void global_cache_data::remove_service_group(uint64_t group) { +void global_cache_data::remove_service_group_members(uint64_t group, + uint64_t poller_id) { absl::WriterMutexLock l(&_protect); - _service_group->get<1>().erase(group); + auto range_iters = _service_group->get<1>().equal_range(group); + while (range_iters.first != range_iters.second) { + if (range_iters.first->poller_id == poller_id) { + range_iters.first = _service_group->get<1>().erase(range_iters.first); + } else { + ++range_iters.first; + } + } } /** @@ -325,7 +349,7 @@ void global_cache_data::remove_service_group(uint64_t group) { * @param poller_id */ void global_cache_data::add_tag(uint64_t tag_id, - const absl::string_view& tag_name, + const std::string_view& tag_name, TagType tag_type, uint64_t poller_id) { try { diff --git a/broker/core/src/compression/factory.cc b/broker/core/src/compression/factory.cc index d3f5015dd47..17a3bd601f2 100644 --- a/broker/core/src/compression/factory.cc +++ b/broker/core/src/compression/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/compression/factory.hh" @@ -42,6 +42,9 @@ using namespace com::centreon::broker::compression; */ bool factory::has_endpoint(config::endpoint& cfg, io::extension* ext) { if (ext) { + if (direct_grpc_serialized(cfg)) { + return false; + } if (cfg.type == "bbdo_server" || cfg.type == "bbdo_client") { auto it = cfg.params.find("transport_protocol"); if (it != cfg.params.end()) { diff --git a/broker/core/src/compression/opener.cc b/broker/core/src/compression/opener.cc index 118de63d012..de607b712b8 100644 --- a/broker/core/src/compression/opener.cc +++ b/broker/core/src/compression/opener.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012, 2021-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012, 2021-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/compression/opener.hh" diff --git a/broker/core/src/compression/stack_array.cc b/broker/core/src/compression/stack_array.cc index 6651507086f..7b505cd6cd8 100644 --- a/broker/core/src/compression/stack_array.cc +++ b/broker/core/src/compression/stack_array.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/compression/stack_array.hh" diff --git a/broker/core/src/compression/stream.cc b/broker/core/src/compression/stream.cc index 09783971b2a..8eb80233af9 100644 --- a/broker/core/src/compression/stream.cc +++ b/broker/core/src/compression/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/compression/stream.hh" diff --git a/broker/core/src/compression/zlib.cc b/broker/core/src/compression/zlib.cc index 045b1d01330..b5ab78e3c16 100644 --- a/broker/core/src/compression/zlib.cc +++ b/broker/core/src/compression/zlib.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/compression/zlib.hh" diff --git a/broker/core/src/config/applier/endpoint.cc b/broker/core/src/config/applier/endpoint.cc index ec2732e075d..ccff0c017a3 100644 --- a/broker/core/src/config/applier/endpoint.cc +++ b/broker/core/src/config/applier/endpoint.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2015,2017-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2015,2017-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/config/applier/endpoint.hh" diff --git a/broker/core/src/config/applier/init.cc b/broker/core/src/config/applier/init.cc index 1ce7e7afea1..2e99435cca1 100644 --- a/broker/core/src/config/applier/init.cc +++ b/broker/core/src/config/applier/init.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2021-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2021-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/core/src/config/applier/modules.cc b/broker/core/src/config/applier/modules.cc index 14825abcb5f..50e65f44e03 100644 --- a/broker/core/src/config/applier/modules.cc +++ b/broker/core/src/config/applier/modules.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/config/applier/modules.hh" diff --git a/broker/core/src/config/applier/state.cc b/broker/core/src/config/applier/state.cc index b8875029d55..3805ea74048 100644 --- a/broker/core/src/config/applier/state.cc +++ b/broker/core/src/config/applier/state.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2015-2016, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2015-2016, 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/config/applier/state.hh" diff --git a/broker/core/src/config/endpoint.cc b/broker/core/src/config/endpoint.cc index 56615aa3416..eaab7df2f8b 100644 --- a/broker/core/src/config/endpoint.cc +++ b/broker/core/src/config/endpoint.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/config/endpoint.hh" diff --git a/broker/core/src/config/parser.cc b/broker/core/src/config/parser.cc index f063d627bf6..55d46e09cd2 100644 --- a/broker/core/src/config/parser.cc +++ b/broker/core/src/config/parser.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2015,2017-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2015,2017-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/config/parser.hh" @@ -100,7 +100,7 @@ absl::optional parser::check_and_read(const nlohmann::json& elem, return {ret}; else if (ret.is_string()) { bool tmp; - if (!absl::SimpleAtob(ret.get(), &tmp)) + if (!absl::SimpleAtob(ret.get(), &tmp)) throw msg_fmt( "config parser: cannot parse key '{}': the string value must " "contain a boolean (1/0, yes/no, true/false)", @@ -212,7 +212,7 @@ state parser::parse(std::string const& file) { } else if (it.key() == "bbdo_version" && it.value().is_string()) { std::string version = json_document["centreonBroker"]["bbdo_version"] .get(); - std::list v = absl::StrSplit(version, '.'); + std::list v = absl::StrSplit(version, '.'); if (v.size() != 3) throw msg_fmt("config parser: cannot parse bbdo_version '{}'", version); diff --git a/broker/core/src/config/state.cc b/broker/core/src/config/state.cc index c3b46205756..08b4ca8f0fe 100644 --- a/broker/core/src/config/state.cc +++ b/broker/core/src/config/state.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/config/state.hh" diff --git a/broker/core/src/file/cfile.cc b/broker/core/src/file/cfile.cc index e34aa09696d..ce638b7c8ba 100644 --- a/broker/core/src/file/cfile.cc +++ b/broker/core/src/file/cfile.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012,2016-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012,2016-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/cfile.hh" diff --git a/broker/core/src/file/directory_event.cc b/broker/core/src/file/directory_event.cc index 3dbc799e964..9b330bb910f 100644 --- a/broker/core/src/file/directory_event.cc +++ b/broker/core/src/file/directory_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/directory_event.hh" diff --git a/broker/core/src/file/directory_watcher.cc b/broker/core/src/file/directory_watcher.cc index 756e439b162..fb318a12cd1 100644 --- a/broker/core/src/file/directory_watcher.cc +++ b/broker/core/src/file/directory_watcher.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/directory_watcher.hh" diff --git a/broker/core/src/file/disk_accessor.cc b/broker/core/src/file/disk_accessor.cc index f585d71358e..444e0d6a9ea 100644 --- a/broker/core/src/file/disk_accessor.cc +++ b/broker/core/src/file/disk_accessor.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/disk_accessor.hh" #include "com/centreon/broker/log_v2.hh" diff --git a/broker/core/src/file/factory.cc b/broker/core/src/file/factory.cc index da3667f55d9..7fcf70f0982 100644 --- a/broker/core/src/file/factory.cc +++ b/broker/core/src/file/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2016-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2016-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/factory.hh" diff --git a/broker/core/src/file/fifo.cc b/broker/core/src/file/fifo.cc index 8ff305a247c..88d3890f38a 100644 --- a/broker/core/src/file/fifo.cc +++ b/broker/core/src/file/fifo.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/fifo.hh" diff --git a/broker/core/src/file/opener.cc b/broker/core/src/file/opener.cc index 363085d3245..f298acb107a 100644 --- a/broker/core/src/file/opener.cc +++ b/broker/core/src/file/opener.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/opener.hh" diff --git a/broker/core/src/file/splitter.cc b/broker/core/src/file/splitter.cc index 0a944823015..b94868e4792 100644 --- a/broker/core/src/file/splitter.cc +++ b/broker/core/src/file/splitter.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/src/file/stream.cc b/broker/core/src/file/stream.cc index f799c4fb5ba..853a2bbe7ac 100644 --- a/broker/core/src/file/stream.cc +++ b/broker/core/src/file/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/file/stream.hh" diff --git a/broker/core/src/instance_broadcast.cc b/broker/core/src/instance_broadcast.cc index bfe9c05b53d..25f0a59cb14 100644 --- a/broker/core/src/instance_broadcast.cc +++ b/broker/core/src/instance_broadcast.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/instance_broadcast.hh" diff --git a/broker/core/src/io/data.cc b/broker/core/src/io/data.cc index 4dc9154ab7c..c0412b7e4b8 100644 --- a/broker/core/src/io/data.cc +++ b/broker/core/src/io/data.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/data.hh" @@ -89,4 +89,4 @@ void data::dump_more_detail(std::ostream& s) const { * * @param s */ -void data::dump_to_json(std::ostream& s) const {} +void data::dump_to_json(std::ostream& s [[maybe_unused]]) const {} diff --git a/broker/core/src/io/endpoint.cc b/broker/core/src/io/endpoint.cc index bcc53b12a52..4538c5a1198 100644 --- a/broker/core/src/io/endpoint.cc +++ b/broker/core/src/io/endpoint.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/endpoint.hh" diff --git a/broker/core/src/io/events.cc b/broker/core/src/io/events.cc index 70ac2e80592..8f318195b1c 100644 --- a/broker/core/src/io/events.cc +++ b/broker/core/src/io/events.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2013, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2013, 2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/io/events.hh" diff --git a/broker/core/src/io/factory.cc b/broker/core/src/io/factory.cc index a4d5949635a..74bc320a0eb 100644 --- a/broker/core/src/io/factory.cc +++ b/broker/core/src/io/factory.cc @@ -1,21 +1,24 @@ -/* -** Copyright 2011-2013,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ +#include + +#include "com/centreon/broker/config/applier/state.hh" #include "com/centreon/broker/io/factory.hh" #include "com/centreon/broker/log_v2.hh" #include "com/centreon/exceptions/msg_fmt.hh" @@ -47,3 +50,17 @@ std::shared_ptr factory::new_stream( "negotiation"); return nullptr; } + +bool factory::direct_grpc_serialized(const config::endpoint& cfg) { + if (cfg.type == "bbdo_client" || cfg.type == "bbdo_server") { + auto it = cfg.params.find("transport_protocol"); + if (it != cfg.params.end()) { + return absl::EqualsIgnoreCase(it->second, "grpc") && + config::applier::state::instance() + .get_bbdo_version() + .total_version >= + bbdo::bbdo_version(3, 1, 0).total_version; + } + } + return false; +} \ No newline at end of file diff --git a/broker/core/src/io/limit_endpoint.cc b/broker/core/src/io/limit_endpoint.cc index e11d6d9b5b1..8acf8f1c318 100644 --- a/broker/core/src/io/limit_endpoint.cc +++ b/broker/core/src/io/limit_endpoint.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/limit_endpoint.hh" diff --git a/broker/core/src/io/protocols.cc b/broker/core/src/io/protocols.cc index df2e7867d4c..ba846ce4619 100644 --- a/broker/core/src/io/protocols.cc +++ b/broker/core/src/io/protocols.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/protocols.hh" diff --git a/broker/core/src/io/raw.cc b/broker/core/src/io/raw.cc index d27fc573b7f..fd838c13a02 100644 --- a/broker/core/src/io/raw.cc +++ b/broker/core/src/io/raw.cc @@ -1,36 +1,33 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/io/raw.hh" #include "com/centreon/broker/log_v2.hh" -CCB_BEGIN() +namespace com::centreon::broker::io { -namespace io { std::ostream& operator<<(std::ostream& s, const raw& d) { s << static_cast(d) << " buffer_length:" << d.size(); return s; } -}; // namespace io - -CCB_END() +} // namespace com::centreon::broker::io using namespace com::centreon::broker::io; @@ -74,29 +71,17 @@ raw& raw::operator=(raw const& r) { return *this; } -void raw::resize(size_t s) { - _buffer.resize(s); -} +void raw::resize(size_t s) { _buffer.resize(s); } -char* raw::data() { - return &_buffer[0]; -} +char* raw::data() { return &_buffer[0]; } -char const* raw::const_data() const { - return &_buffer[0]; -} +char const* raw::const_data() const { return &_buffer[0]; } -size_t raw::size() const { - return _buffer.size(); -} +size_t raw::size() const { return _buffer.size(); } -std::vector& raw::get_buffer() { - return _buffer; -} +std::vector& raw::get_buffer() { return _buffer; } -bool raw::empty() const { - return _buffer.empty(); -} +bool raw::empty() const { return _buffer.empty(); } // void raw::append(const char* msg) { // _buffer.insert(_buffer.end(), msg, msg + strlen(msg)); diff --git a/broker/core/src/io/stream.cc b/broker/core/src/io/stream.cc index ab341bed86b..d3bf0d575b1 100644 --- a/broker/core/src/io/stream.cc +++ b/broker/core/src/io/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2015,2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2015,2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/stream.hh" diff --git a/broker/core/src/log_v2.cc b/broker/core/src/log_v2.cc index c940b4841be..7f34aed1fa5 100644 --- a/broker/core/src/log_v2.cc +++ b/broker/core/src/log_v2.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2020-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2020-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/log_v2.hh" diff --git a/broker/core/src/main.cc b/broker/core/src/main.cc index fd44437bc1e..f2ac1ace17f 100644 --- a/broker/core/src/main.cc +++ b/broker/core/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015,2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015,2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/core/src/mapping/entry.cc b/broker/core/src/mapping/entry.cc index fd0bd0d982e..accb17b8ee2 100644 --- a/broker/core/src/mapping/entry.cc +++ b/broker/core/src/mapping/entry.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/mapping/entry.hh" diff --git a/broker/core/src/misc/diagnostic.cc b/broker/core/src/misc/diagnostic.cc index a076b064cec..2adfa3ac9ef 100644 --- a/broker/core/src/misc/diagnostic.cc +++ b/broker/core/src/misc/diagnostic.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/misc/diagnostic.hh" diff --git a/broker/core/src/misc/filesystem.cc b/broker/core/src/misc/filesystem.cc index 8b9c5658e83..0e708ec5947 100644 --- a/broker/core/src/misc/filesystem.cc +++ b/broker/core/src/misc/filesystem.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/misc/filesystem.hh" diff --git a/broker/core/src/misc/misc.cc b/broker/core/src/misc/misc.cc index 811140f82df..7bac57214e2 100644 --- a/broker/core/src/misc/misc.cc +++ b/broker/core/src/misc/misc.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/misc/misc.hh" diff --git a/broker/core/src/misc/parse_perfdata.cc b/broker/core/src/misc/parse_perfdata.cc index 24eb62e9247..0b91babd163 100644 --- a/broker/core/src/misc/parse_perfdata.cc +++ b/broker/core/src/misc/parse_perfdata.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2017-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2017-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/core/src/misc/perfdata.cc b/broker/core/src/misc/perfdata.cc index 0d384663a01..501c59ba71e 100644 --- a/broker/core/src/misc/perfdata.cc +++ b/broker/core/src/misc/perfdata.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/misc/perfdata.hh" diff --git a/broker/core/src/misc/processing_speed_computer.cc b/broker/core/src/misc/processing_speed_computer.cc index 54336b0ba08..47e6302dec3 100644 --- a/broker/core/src/misc/processing_speed_computer.cc +++ b/broker/core/src/misc/processing_speed_computer.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013,2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013,2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/misc/processing_speed_computer.hh" diff --git a/broker/core/src/misc/string.cc b/broker/core/src/misc/string.cc index da81a4080d7..263f6cbe9fd 100644 --- a/broker/core/src/misc/string.cc +++ b/broker/core/src/misc/string.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/misc/string.hh" diff --git a/broker/core/src/misc/time.cc b/broker/core/src/misc/time.cc index acecdbb1ac6..5f19959c6ae 100644 --- a/broker/core/src/misc/time.cc +++ b/broker/core/src/misc/time.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/misc/time.hh" diff --git a/broker/core/src/misc/uuid.cc b/broker/core/src/misc/uuid.cc index 54196ea2ca9..7cce1cbeaad 100644 --- a/broker/core/src/misc/uuid.cc +++ b/broker/core/src/misc/uuid.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/core/src/misc/variant.cc b/broker/core/src/misc/variant.cc index 20aa106ee86..06504de860b 100644 --- a/broker/core/src/misc/variant.cc +++ b/broker/core/src/misc/variant.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/src/modules/handle.cc b/broker/core/src/modules/handle.cc index a4541f5b99d..08e33d2c872 100644 --- a/broker/core/src/modules/handle.cc +++ b/broker/core/src/modules/handle.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2015, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2015, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/modules/handle.hh" diff --git a/broker/core/src/persistent_cache.cc b/broker/core/src/persistent_cache.cc index c348a541bbe..6560156ce1c 100644 --- a/broker/core/src/persistent_cache.cc +++ b/broker/core/src/persistent_cache.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020-2021 Centreon (https://www.centreon.com/) ** ** Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/src/persistent_file.cc b/broker/core/src/persistent_file.cc index c7ae8b2f898..2d2f9a687b4 100644 --- a/broker/core/src/persistent_file.cc +++ b/broker/core/src/persistent_file.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015,2017, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015,2017, 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/persistent_file.hh" diff --git a/broker/core/src/pool.cc b/broker/core/src/pool.cc index 1dad3b1b0b8..e93292e15d2 100644 --- a/broker/core/src/pool.cc +++ b/broker/core/src/pool.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020-2022 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/src/processing/acceptor.cc b/broker/core/src/processing/acceptor.cc index 6bbd19cd31d..44b0c97f94c 100644 --- a/broker/core/src/processing/acceptor.cc +++ b/broker/core/src/processing/acceptor.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/processing/acceptor.hh" diff --git a/broker/core/src/processing/failover.cc b/broker/core/src/processing/failover.cc index 471bd19c976..54e9a17b5e4 100644 --- a/broker/core/src/processing/failover.cc +++ b/broker/core/src/processing/failover.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/processing/failover.hh" diff --git a/broker/core/src/processing/feeder.cc b/broker/core/src/processing/feeder.cc index 58f16effedf..6488ea7e8da 100644 --- a/broker/core/src/processing/feeder.cc +++ b/broker/core/src/processing/feeder.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2015,2017, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2015,2017, 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/processing/feeder.hh" diff --git a/broker/core/src/processing/stat_visitable.cc b/broker/core/src/processing/stat_visitable.cc index ea189a3fb19..e6bdb0a14c0 100644 --- a/broker/core/src/processing/stat_visitable.cc +++ b/broker/core/src/processing/stat_visitable.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/processing/stat_visitable.hh" diff --git a/broker/core/src/stats/center.cc b/broker/core/src/stats/center.cc index 814f1ae6cfd..d16167d59be 100644 --- a/broker/core/src/stats/center.cc +++ b/broker/core/src/stats/center.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2020-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2020-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/stats/center.hh" diff --git a/broker/core/src/stats/helper.cc b/broker/core/src/stats/helper.cc index d2c9665e9c9..5dbf5014e82 100644 --- a/broker/core/src/stats/helper.cc +++ b/broker/core/src/stats/helper.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/stats/helper.hh" diff --git a/broker/core/src/time/daterange.cc b/broker/core/src/time/daterange.cc index e74e5fff5cf..3b5834b893b 100644 --- a/broker/core/src/time/daterange.cc +++ b/broker/core/src/time/daterange.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/time/daterange.hh" diff --git a/broker/core/src/time/timeperiod.cc b/broker/core/src/time/timeperiod.cc index 9611975a14b..48a73bfabbd 100644 --- a/broker/core/src/time/timeperiod.cc +++ b/broker/core/src/time/timeperiod.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/time/timeperiod.hh" diff --git a/broker/core/src/time/timerange.cc b/broker/core/src/time/timerange.cc index 4f5e637bb4f..9ded9800162 100644 --- a/broker/core/src/time/timerange.cc +++ b/broker/core/src/time/timerange.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/time/timerange.hh" @@ -190,7 +190,7 @@ bool timerange::to_time_t(struct tm const& midnight, return (true); } -static bool _build_time_t(const absl::string_view& time_str, uint64_t& ret) { +static bool _build_time_t(const std::string_view& time_str, uint64_t& ret) { const char* endc = time_str.data() + time_str.size(); const char* begin_str = time_str.data(); char* endptr; @@ -241,18 +241,17 @@ bool timerange::build_timeranges_from_string(const std::string& line, if (line.empty()) return true; - std::list timeranges_str{absl::StrSplit(line, ',')}; + std::list timeranges_str{absl::StrSplit(line, ',')}; for (auto& t : timeranges_str) { size_t pos = t.find('-'); if (pos == std::string::npos) return false; uint64_t start_time; - if (!_build_time_t(absl::string_view(t.data(), pos), start_time)) + if (!_build_time_t(std::string_view(t.data(), pos), start_time)) return false; uint64_t end_time; - if (!_build_time_t( - absl::string_view(t.data() + pos + 1, t.size() - pos - 1), - end_time)) + if (!_build_time_t(std::string_view(t.data() + pos + 1, t.size() - pos - 1), + end_time)) return false; timeranges.emplace_front(start_time, end_time); } diff --git a/broker/core/src/time/timezone_locker.cc b/broker/core/src/time/timezone_locker.cc index 6c85d43a571..f71d343a143 100644 --- a/broker/core/src/time/timezone_locker.cc +++ b/broker/core/src/time/timezone_locker.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/time/timezone_locker.hh" diff --git a/broker/core/src/time/timezone_manager.cc b/broker/core/src/time/timezone_manager.cc index d0723ed35b5..788d0502fea 100644 --- a/broker/core/src/time/timezone_manager.cc +++ b/broker/core/src/time/timezone_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/time/timezone_manager.hh" diff --git a/broker/core/test/bbdo/category.cc b/broker/core/test/bbdo/category.cc index 7e2677b435c..7bc9cf0152e 100644 --- a/broker/core/test/bbdo/category.cc +++ b/broker/core/test/bbdo/category.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/bbdo/input_buffer/erase.cc b/broker/core/test/bbdo/input_buffer/erase.cc index 4b697f78453..29cb6426614 100644 --- a/broker/core/test/bbdo/input_buffer/erase.cc +++ b/broker/core/test/bbdo/input_buffer/erase.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/bbdo/input_buffer/extract.cc b/broker/core/test/bbdo/input_buffer/extract.cc index d4bdb28668c..08304655db4 100644 --- a/broker/core/test/bbdo/input_buffer/extract.cc +++ b/broker/core/test/bbdo/input_buffer/extract.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/bbdo/output.cc b/broker/core/test/bbdo/output.cc index 170ef3913ca..8772ee910dc 100644 --- a/broker/core/test/bbdo/output.cc +++ b/broker/core/test/bbdo/output.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/bbdo/read.cc b/broker/core/test/bbdo/read.cc index 65db5cdb8e1..06d2c126f54 100644 --- a/broker/core/test/bbdo/read.cc +++ b/broker/core/test/bbdo/read.cc @@ -1,4 +1,4 @@ -///* +///** //** Copyright 2015 Centreon //** //** Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/cache/global_cache_test.cc b/broker/core/test/cache/global_cache_test.cc index ced5d1a7ae4..7762b2de690 100644 --- a/broker/core/test/cache/global_cache_test.cc +++ b/broker/core/test/cache/global_cache_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -154,9 +154,9 @@ TEST_F(global_cache_test, Group) { obj->store_service(ii, ii + 1, fmt::format("service_{}", ii), ii + 10000000, 2); for (unsigned jj = 0; jj < 10; ++jj) - obj->add_host_group(ii / 10 + jj, ii); + obj->add_host_to_group(ii / 10 + jj, ii, ii & 1); for (unsigned jj = 0; jj < 10; ++jj) - obj->add_service_group(ii / 10 + 1000 + jj, ii, ii + 1); + obj->add_service_to_group(ii / 10 + 1000 + jj, ii, ii + 1, ii & 1); } // check host groups @@ -192,12 +192,27 @@ TEST_F(global_cache_test, Group) { ASSERT_EQ(serv_grp.str(), "1001,1002,1003,1004,1005,1006,1007,1008,1009"); } - obj->remove_service_group(1005); + // service group remove from poller 0 but not from poller 1 + obj->remove_service_group_members(1005, 0); { std::ostringstream serv_grp; obj->append_service_group(0, 1, serv_grp); ASSERT_EQ(serv_grp.str(), "1001,1002,1003,1004,1006,1007,1008,1009"); } + { + std::ostringstream serv_grp; + obj->append_service_group(1, 2, serv_grp); + ASSERT_EQ(serv_grp.str(), + "1000,1001,1002,1003,1004,1005,1006,1007,1008,1009"); + } + + // remove from all pollers + obj->remove_service_group_members(1005, 1); + { + std::ostringstream serv_grp; + obj->append_service_group(1, 2, serv_grp); + ASSERT_EQ(serv_grp.str(), "1000,1001,1002,1003,1004,1006,1007,1008,1009"); + } obj->remove_host_from_group(10, 55); { @@ -206,12 +221,23 @@ TEST_F(global_cache_test, Group) { ASSERT_EQ(host_grp.str(), "5,6,7,8,9,11,12,13,14"); } - obj->remove_host_group(13); + obj->remove_host_group_members(13, 1); { std::ostringstream host_grp; obj->append_host_group(55, host_grp); ASSERT_EQ(host_grp.str(), "5,6,7,8,9,11,12,14"); } + { + std::ostringstream host_grp; + obj->append_host_group(54, host_grp); + ASSERT_EQ(host_grp.str(), "5,6,7,8,9,10,11,12,13,14"); + } + obj->remove_host_group_members(13, 0); + { + std::ostringstream host_grp; + obj->append_host_group(54, host_grp); + ASSERT_EQ(host_grp.str(), "5,6,7,8,9,10,11,12,14"); + } } TEST_F(global_cache_test, Tag) { diff --git a/broker/core/test/ceof/ceof_parser/parse.cc b/broker/core/test/ceof/ceof_parser/parse.cc index fe20c255c5e..8c77d7a5873 100644 --- a/broker/core/test/ceof/ceof_parser/parse.cc +++ b/broker/core/test/ceof/ceof_parser/parse.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/compression/stream/read.cc b/broker/core/test/compression/stream/read.cc index 3858b9d31aa..10cd25b4fef 100644 --- a/broker/core/test/compression/stream/read.cc +++ b/broker/core/test/compression/stream/read.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/compression/stream/write.cc b/broker/core/test/compression/stream/write.cc index 16ce298ae3b..40f4a9bbc64 100644 --- a/broker/core/test/compression/stream/write.cc +++ b/broker/core/test/compression/stream/write.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/compression/zlib/zlib.cc b/broker/core/test/compression/zlib/zlib.cc index 4139b972e70..186c5e9b3c8 100644 --- a/broker/core/test/compression/zlib/zlib.cc +++ b/broker/core/test/compression/zlib/zlib.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/config/init.cc b/broker/core/test/config/init.cc index cd9d33c618f..a8dab72b0df 100644 --- a/broker/core/test/config/init.cc +++ b/broker/core/test/config/init.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/config/parser.cc b/broker/core/test/config/parser.cc index 0f3375fb426..77663274d6b 100644 --- a/broker/core/test/config/parser.cc +++ b/broker/core/test/config/parser.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/exceptions.cc b/broker/core/test/exceptions.cc index e369922c132..bd0a28d42f7 100644 --- a/broker/core/test/exceptions.cc +++ b/broker/core/test/exceptions.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/disk_accessor.cc b/broker/core/test/file/disk_accessor.cc index 421a5c8bf8d..c344975282e 100644 --- a/broker/core/test/file/disk_accessor.cc +++ b/broker/core/test/file/disk_accessor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/splitter/concurrent.cc b/broker/core/test/file/splitter/concurrent.cc index 340c8b6524c..a6bd3a018a4 100644 --- a/broker/core/test/file/splitter/concurrent.cc +++ b/broker/core/test/file/splitter/concurrent.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/splitter/default.cc b/broker/core/test/file/splitter/default.cc index 32ca85dcccc..3ec1373cb34 100644 --- a/broker/core/test/file/splitter/default.cc +++ b/broker/core/test/file/splitter/default.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/splitter/more_than_max_size.cc b/broker/core/test/file/splitter/more_than_max_size.cc index d204d0af972..d415aa165af 100644 --- a/broker/core/test/file/splitter/more_than_max_size.cc +++ b/broker/core/test/file/splitter/more_than_max_size.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/splitter/permission_denied.cc b/broker/core/test/file/splitter/permission_denied.cc index 3b7bb9a7826..746585d1c1b 100644 --- a/broker/core/test/file/splitter/permission_denied.cc +++ b/broker/core/test/file/splitter/permission_denied.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/splitter/resume.cc b/broker/core/test/file/splitter/resume.cc index d6608ad14ff..53e6a4b58f7 100644 --- a/broker/core/test/file/splitter/resume.cc +++ b/broker/core/test/file/splitter/resume.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/splitter/split.cc b/broker/core/test/file/splitter/split.cc index b540d536dfa..a9a974bd7c3 100644 --- a/broker/core/test/file/splitter/split.cc +++ b/broker/core/test/file/splitter/split.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/splitter/split_limited.cc b/broker/core/test/file/splitter/split_limited.cc index 13dd70bcc01..d4da4d17cc7 100644 --- a/broker/core/test/file/splitter/split_limited.cc +++ b/broker/core/test/file/splitter/split_limited.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/stream/max_size.cc b/broker/core/test/file/stream/max_size.cc index 78f7c91aa2e..b3cee0ebe90 100644 --- a/broker/core/test/file/stream/max_size.cc +++ b/broker/core/test/file/stream/max_size.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/stream/mixed.cc b/broker/core/test/file/stream/mixed.cc index 50b68981f54..62b36563fd0 100644 --- a/broker/core/test/file/stream/mixed.cc +++ b/broker/core/test/file/stream/mixed.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/stream/read.cc b/broker/core/test/file/stream/read.cc index 2cabfd326fa..3d06836f38e 100644 --- a/broker/core/test/file/stream/read.cc +++ b/broker/core/test/file/stream/read.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/file/stream/write.cc b/broker/core/test/file/stream/write.cc index 6eee51692f7..3b71a3e49be 100644 --- a/broker/core/test/file/stream/write.cc +++ b/broker/core/test/file/stream/write.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/io.cc b/broker/core/test/io.cc index 1711af7b231..44a2c5907c6 100644 --- a/broker/core/test/io.cc +++ b/broker/core/test/io.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/main.cc b/broker/core/test/main.cc index 8567cdb7d20..a2c870f9b40 100644 --- a/broker/core/test/main.cc +++ b/broker/core/test/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/misc/buffer.cc b/broker/core/test/misc/buffer.cc index 4d1e4979484..02481c4e9a3 100644 --- a/broker/core/test/misc/buffer.cc +++ b/broker/core/test/misc/buffer.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/misc/exec.cc b/broker/core/test/misc/exec.cc index b28ef92052f..2c8146dbfdc 100644 --- a/broker/core/test/misc/exec.cc +++ b/broker/core/test/misc/exec.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/misc/filesystem.cc b/broker/core/test/misc/filesystem.cc index 628b8d2b28b..66adf91ee69 100644 --- a/broker/core/test/misc/filesystem.cc +++ b/broker/core/test/misc/filesystem.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/misc/math.cc b/broker/core/test/misc/math.cc index 743aae86674..7be61635898 100644 --- a/broker/core/test/misc/math.cc +++ b/broker/core/test/misc/math.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/misc/misc.cc b/broker/core/test/misc/misc.cc index c7c4f0eab12..83576650c74 100644 --- a/broker/core/test/misc/misc.cc +++ b/broker/core/test/misc/misc.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/misc/perfdata.cc b/broker/core/test/misc/perfdata.cc index 4f77a2ad6d5..2ec05aca785 100644 --- a/broker/core/test/misc/perfdata.cc +++ b/broker/core/test/misc/perfdata.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/misc/string.cc b/broker/core/test/misc/string.cc index c681882b88b..947157ba219 100644 --- a/broker/core/test/misc/string.cc +++ b/broker/core/test/misc/string.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/modules/bad_version_module.cc b/broker/core/test/modules/bad_version_module.cc index c561494dddf..5f8dba3823b 100644 --- a/broker/core/test/modules/bad_version_module.cc +++ b/broker/core/test/modules/bad_version_module.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/modules/module.cc b/broker/core/test/modules/module.cc index 5c8e597e8ec..3fcd61ec720 100644 --- a/broker/core/test/modules/module.cc +++ b/broker/core/test/modules/module.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/modules/null_module.cc b/broker/core/test/modules/null_module.cc index 9b290efb6be..6aa5c62a362 100644 --- a/broker/core/test/modules/null_module.cc +++ b/broker/core/test/modules/null_module.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/mysql/mysql.cc b/broker/core/test/mysql/mysql.cc index be5724fd3f5..e1c583b7534 100644 --- a/broker/core/test/mysql/mysql.cc +++ b/broker/core/test/mysql/mysql.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2022-2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1365,7 +1365,7 @@ TEST_F(DatabaseStorageTest, CheckBulkStatement) { "centreon", "centreon_storage", 5, true, 5); auto ms{std::make_unique(db_cfg)}; std::string version = ms->get_server_version(); - std::vector arr = + std::vector arr = absl::StrSplit(version, absl::ByAnyChar(".-")); ASSERT_TRUE(arr.size() >= 4u); uint32_t major; @@ -1374,7 +1374,7 @@ TEST_F(DatabaseStorageTest, CheckBulkStatement) { EXPECT_TRUE(absl::SimpleAtoi(arr[0], &major)); EXPECT_TRUE(absl::SimpleAtoi(arr[1], &minor)); EXPECT_TRUE(absl::SimpleAtoi(arr[2], &patch)); - absl::string_view server_name(arr[3]); + std::string_view server_name(arr[3]); if (ms->support_bulk_statement()) { std::string query1{"DROP TABLE IF EXISTS ut_test"}; std::string query2{ diff --git a/broker/core/test/processing/acceptor.cc b/broker/core/test/processing/acceptor.cc index 6e38dd81bc2..d6fe11f95c1 100644 --- a/broker/core/test/processing/acceptor.cc +++ b/broker/core/test/processing/acceptor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/processing/feeder.cc b/broker/core/test/processing/feeder.cc index b0ce60ec0da..acddf538967 100644 --- a/broker/core/test/processing/feeder.cc +++ b/broker/core/test/processing/feeder.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020-2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/processing/temporary_endpoint.hh b/broker/core/test/processing/temporary_endpoint.hh index 703528b77db..5580526328c 100644 --- a/broker/core/test/processing/temporary_endpoint.hh +++ b/broker/core/test/processing/temporary_endpoint.hh @@ -23,7 +23,7 @@ #include "com/centreon/broker/io/endpoint.hh" #include "temporary_stream.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class temporary_endpoint temporary_endpoint.hh @@ -72,6 +72,6 @@ class temporary_endpoint : public io::endpoint { } }; -CCB_END() +} #endif // !CCB_TEMPORARY_ENDPOINT_HH diff --git a/broker/core/test/processing/temporary_stream.hh b/broker/core/test/processing/temporary_stream.hh index 1e488d1271e..3f7ff4e7789 100644 --- a/broker/core/test/processing/temporary_stream.hh +++ b/broker/core/test/processing/temporary_stream.hh @@ -21,10 +21,9 @@ #define CCB_TEMPORARY_STREAM_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { /** * @class temporary_stream temporary_stream.hh @@ -83,6 +82,6 @@ class temporary_stream : public io::stream { int32_t stop() override { return 0; } }; -CCB_END() +} #endif // !CCB_TEMPORARY_STREAM_HH diff --git a/broker/core/test/rpc/brokerrpc.cc b/broker/core/test/rpc/brokerrpc.cc index 25aa8e79e9b..4ad26b197e4 100644 --- a/broker/core/test/rpc/brokerrpc.cc +++ b/broker/core/test/rpc/brokerrpc.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/rpc/client.cc b/broker/core/test/rpc/client.cc index 905bb3b2f64..5dcea1f54ab 100644 --- a/broker/core/test/rpc/client.cc +++ b/broker/core/test/rpc/client.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/test_server.cc b/broker/core/test/test_server.cc index d9686e972a5..9795982a6c1 100644 --- a/broker/core/test/test_server.cc +++ b/broker/core/test/test_server.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/core/test/time/timerange.cc b/broker/core/test/time/timerange.cc index 99c6ecdd502..f1d2a5bb00a 100644 --- a/broker/core/test/time/timerange.cc +++ b/broker/core/test/time/timerange.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/generator/inc/com/centreon/broker/generator/dummy.hh b/broker/generator/inc/com/centreon/broker/generator/dummy.hh index 29a9899a912..c610c0a7108 100644 --- a/broker/generator/inc/com/centreon/broker/generator/dummy.hh +++ b/broker/generator/inc/com/centreon/broker/generator/dummy.hh @@ -24,9 +24,8 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace generator { /** @@ -61,6 +60,6 @@ class dummy : public io::data { }; } // namespace generator -CCB_END() +} #endif // !CCB_GENERATOR_DUMMY_HH diff --git a/broker/generator/inc/com/centreon/broker/generator/endpoint.hh b/broker/generator/inc/com/centreon/broker/generator/endpoint.hh index de9f6f31de2..4ae474bd689 100644 --- a/broker/generator/inc/com/centreon/broker/generator/endpoint.hh +++ b/broker/generator/inc/com/centreon/broker/generator/endpoint.hh @@ -20,9 +20,8 @@ #define CCB_GENERATOR_ENDPOINT_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace generator { /** @@ -47,6 +46,6 @@ class endpoint : public io::endpoint { }; } // namespace generator -CCB_END() +} #endif // !CCB_GENERATOR_ENDPOINT_HH diff --git a/broker/generator/inc/com/centreon/broker/generator/factory.hh b/broker/generator/inc/com/centreon/broker/generator/factory.hh index 76760fd88e0..56d4ae7735c 100644 --- a/broker/generator/inc/com/centreon/broker/generator/factory.hh +++ b/broker/generator/inc/com/centreon/broker/generator/factory.hh @@ -20,9 +20,8 @@ #define CCB_GENERATOR_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace generator { /** @@ -45,6 +44,6 @@ class factory : public io::factory { }; } // namespace generator -CCB_END() +} #endif // !CCB_GENERATOR_FACTORY_HH diff --git a/broker/generator/inc/com/centreon/broker/generator/internal.hh b/broker/generator/inc/com/centreon/broker/generator/internal.hh index 6c020438c66..60e646d31e8 100644 --- a/broker/generator/inc/com/centreon/broker/generator/internal.hh +++ b/broker/generator/inc/com/centreon/broker/generator/internal.hh @@ -19,13 +19,13 @@ #ifndef CCB_GENERATOR_INTERNAL_HH #define CCB_GENERATOR_INTERNAL_HH -CCB_BEGIN() +namespace com::centreon::broker { namespace generator { // Data elements. enum data_element { de_dummy = 1 }; } // namespace generator -CCB_END() +} #endif // !CCB_GENERATOR_INTERNAL_HH diff --git a/broker/generator/inc/com/centreon/broker/generator/receiver.hh b/broker/generator/inc/com/centreon/broker/generator/receiver.hh index d04268ea0e7..ff1d487ff7c 100644 --- a/broker/generator/inc/com/centreon/broker/generator/receiver.hh +++ b/broker/generator/inc/com/centreon/broker/generator/receiver.hh @@ -19,9 +19,8 @@ #ifndef CCB_GENERATOR_RECEIVER_HH #define CCB_GENERATOR_RECEIVER_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace generator { /** @@ -45,6 +44,6 @@ class receiver : public io::stream { }; } // namespace generator -CCB_END() +} #endif // !CCB_GENERATOR_RECEIVER_HH diff --git a/broker/generator/inc/com/centreon/broker/generator/sender.hh b/broker/generator/inc/com/centreon/broker/generator/sender.hh index af22019f357..2256b0ac7be 100644 --- a/broker/generator/inc/com/centreon/broker/generator/sender.hh +++ b/broker/generator/inc/com/centreon/broker/generator/sender.hh @@ -20,9 +20,8 @@ #define CCB_GENERATOR_SENDER_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace generator { /** @@ -46,6 +45,6 @@ class sender : public io::stream { }; } // namespace generator -CCB_END() +} #endif // !CCB_GENERATOR_SENDER_HH diff --git a/broker/generator/src/dummy.cc b/broker/generator/src/dummy.cc index 28e3c788fbf..a116ef8fb16 100644 --- a/broker/generator/src/dummy.cc +++ b/broker/generator/src/dummy.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/generator/dummy.hh" diff --git a/broker/generator/src/endpoint.cc b/broker/generator/src/endpoint.cc index 6cf307350a8..f690c1a19c3 100644 --- a/broker/generator/src/endpoint.cc +++ b/broker/generator/src/endpoint.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/generator/endpoint.hh" diff --git a/broker/generator/src/factory.cc b/broker/generator/src/factory.cc index bfcbd91064f..569e848dd09 100644 --- a/broker/generator/src/factory.cc +++ b/broker/generator/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/generator/factory.hh" diff --git a/broker/generator/src/main.cc b/broker/generator/src/main.cc index 7ba2cc4d15f..a33f529ec3d 100644 --- a/broker/generator/src/main.cc +++ b/broker/generator/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/generator/dummy.hh" diff --git a/broker/generator/src/receiver.cc b/broker/generator/src/receiver.cc index f34e0d43e3d..0d376cef4d7 100644 --- a/broker/generator/src/receiver.cc +++ b/broker/generator/src/receiver.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/generator/receiver.hh" diff --git a/broker/generator/src/sender.cc b/broker/generator/src/sender.cc index 4b7ccaeee37..60d3346f6a2 100644 --- a/broker/generator/src/sender.cc +++ b/broker/generator/src/sender.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/generator/sender.hh" diff --git a/broker/graphite/inc/com/centreon/broker/graphite/connector.hh b/broker/graphite/inc/com/centreon/broker/graphite/connector.hh index cad9f0bb471..5e18c82f928 100644 --- a/broker/graphite/inc/com/centreon/broker/graphite/connector.hh +++ b/broker/graphite/inc/com/centreon/broker/graphite/connector.hh @@ -20,10 +20,9 @@ #define CCB_GRAPHITE_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace graphite { /** @@ -59,6 +58,6 @@ class connector : public io::endpoint { }; } // namespace graphite -CCB_END() +} #endif // !CCB_GRAPHITE_CONNECTOR_HH diff --git a/broker/graphite/inc/com/centreon/broker/graphite/factory.hh b/broker/graphite/inc/com/centreon/broker/graphite/factory.hh index add73a9deba..dfade5ea0b5 100644 --- a/broker/graphite/inc/com/centreon/broker/graphite/factory.hh +++ b/broker/graphite/inc/com/centreon/broker/graphite/factory.hh @@ -20,9 +20,8 @@ #define CCB_GRAPHITE_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace graphite { /** @@ -46,6 +45,6 @@ class factory : public io::factory { }; } // namespace graphite -CCB_END() +} #endif // !CCB_GRAPHITE_FACTORY_HH diff --git a/broker/graphite/inc/com/centreon/broker/graphite/internal.hh b/broker/graphite/inc/com/centreon/broker/graphite/internal.hh index e99128f1e2d..92cdeb31d2c 100644 --- a/broker/graphite/inc/com/centreon/broker/graphite/internal.hh +++ b/broker/graphite/inc/com/centreon/broker/graphite/internal.hh @@ -23,7 +23,7 @@ #include "bbdo/storage.pb.h" #include "com/centreon/broker/io/protobuf.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { using pb_index_mapping = @@ -38,6 +38,6 @@ using pb_status = io::protobuf; } // namespace storage -CCB_END() +} #endif // !CCB_GRAPHITE_INTERNAL_HH diff --git a/broker/graphite/inc/com/centreon/broker/graphite/macro_cache.hh b/broker/graphite/inc/com/centreon/broker/graphite/macro_cache.hh index b8107be41b0..ed0c64af037 100644 --- a/broker/graphite/inc/com/centreon/broker/graphite/macro_cache.hh +++ b/broker/graphite/inc/com/centreon/broker/graphite/macro_cache.hh @@ -22,13 +22,12 @@ #include #include "com/centreon/broker/graphite/internal.hh" #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/host.hh" #include "com/centreon/broker/neb/instance.hh" #include "com/centreon/broker/neb/service.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace graphite { /** @@ -75,6 +74,6 @@ class macro_cache { }; } // namespace graphite -CCB_END() +} #endif // !CCB_GRAPHITE_MACRO_CACHE_HH diff --git a/broker/graphite/inc/com/centreon/broker/graphite/query.hh b/broker/graphite/inc/com/centreon/broker/graphite/query.hh index 28509c775d2..1c7140c2afc 100644 --- a/broker/graphite/inc/com/centreon/broker/graphite/query.hh +++ b/broker/graphite/inc/com/centreon/broker/graphite/query.hh @@ -20,9 +20,8 @@ #define CCB_GRAPHITE_QUERY_HH #include "com/centreon/broker/graphite/macro_cache.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace graphite { /** @@ -82,6 +81,6 @@ class query { }; } // namespace graphite -CCB_END() +} #endif // !CCB_GRAPHITE_QUERY_HH diff --git a/broker/graphite/inc/com/centreon/broker/graphite/stream.hh b/broker/graphite/inc/com/centreon/broker/graphite/stream.hh index e5df3ffb8a9..6ba0c55c08d 100644 --- a/broker/graphite/inc/com/centreon/broker/graphite/stream.hh +++ b/broker/graphite/inc/com/centreon/broker/graphite/stream.hh @@ -24,9 +24,8 @@ #include "com/centreon/broker/graphite/macro_cache.hh" #include "com/centreon/broker/graphite/query.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. class database_config; @@ -95,6 +94,6 @@ class stream : public io::stream { }; } // namespace graphite -CCB_END() +} #endif // !CCB_GRAPHITE_STREAM_HH diff --git a/broker/graphite/src/connector.cc b/broker/graphite/src/connector.cc index 473060effa7..055fc5b3a24 100644 --- a/broker/graphite/src/connector.cc +++ b/broker/graphite/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/graphite/connector.hh" diff --git a/broker/graphite/src/factory.cc b/broker/graphite/src/factory.cc index e03570676f8..f1939972b12 100644 --- a/broker/graphite/src/factory.cc +++ b/broker/graphite/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/graphite/factory.hh" diff --git a/broker/graphite/src/macro_cache.cc b/broker/graphite/src/macro_cache.cc index 3bc8b72e28a..c9e6f062ff1 100644 --- a/broker/graphite/src/macro_cache.cc +++ b/broker/graphite/src/macro_cache.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2015, 2019 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2015, 2019 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/graphite/macro_cache.hh" diff --git a/broker/graphite/src/main.cc b/broker/graphite/src/main.cc index a1efae63810..bba5f6c99f6 100644 --- a/broker/graphite/src/main.cc +++ b/broker/graphite/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/storage/index_mapping.hh" diff --git a/broker/graphite/src/query.cc b/broker/graphite/src/query.cc index d8f9b5cd62b..7287c420209 100644 --- a/broker/graphite/src/query.cc +++ b/broker/graphite/src/query.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/graphite/query.hh" diff --git a/broker/graphite/src/stream.cc b/broker/graphite/src/stream.cc index a59783e52f5..5aedb77ee38 100644 --- a/broker/graphite/src/stream.cc +++ b/broker/graphite/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/graphite/stream.hh" diff --git a/broker/graphite/test/factory.cc b/broker/graphite/test/factory.cc index 091ef3815dd..01b10a33639 100644 --- a/broker/graphite/test/factory.cc +++ b/broker/graphite/test/factory.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/graphite/test/query.cc b/broker/graphite/test/query.cc index aeb032cebee..1aee949183c 100644 --- a/broker/graphite/test/query.cc +++ b/broker/graphite/test/query.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/graphite/test/stream.cc b/broker/graphite/test/stream.cc index bd6a28d4123..aba4f1a1f0a 100644 --- a/broker/graphite/test/stream.cc +++ b/broker/graphite/test/stream.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/grpc/CMakeLists.txt b/broker/grpc/CMakeLists.txt index c2090e11b23..055f6b15d2f 100644 --- a/broker/grpc/CMakeLists.txt +++ b/broker/grpc/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_DIR "${PROJECT_SOURCE_DIR}/grpc") set(INC_DIR "${MODULE_DIR}/inc/com/centreon/broker/grpc") set(SRC_DIR "${MODULE_DIR}/src") set(TEST_DIR "${MODULE_DIR}/test") -include_directories(${MODULE_DIR}/inc ${SRC_DIR}) +include_directories(${MODULE_DIR}/inc ${SRC_DIR} ${CMAKE_SOURCE_DIR}/bbdo) # Sources. set(SOURCES @@ -34,7 +34,8 @@ set(SOURCES "${SRC_DIR}/server.cc" "${SRC_DIR}/stream.cc" "${SRC_DIR}/grpc_stream.grpc.pb.cc" - "${SRC_DIR}/grpc_stream.pb.cc") + "${SRC_DIR}/grpc_stream.pb.cc" + "${SRC_DIR}/grpc_bridge.cc") # Headers. set(HEADERS "${INC_DIR}/acceptor.hh" @@ -54,17 +55,47 @@ set(GRPC PARENT_SCOPE) add_library(${GRPC} SHARED ${SOURCES} ${HEADERS}) set_target_properties(${GRPC} PROPERTIES PREFIX "") -target_link_libraries(${GRPC} CONAN_PKG::spdlog) +target_link_libraries( + ${GRPC} + "-Wl,--whole-archive" + pb_neb_lib + pb_storage_lib + pb_bbdo_lib + pb_severity_lib + pb_tag_lib + pb_bam_lib + pb_extcmd_lib + pb_rebuild_message_lib + pb_remove_graph_message_lib + pb_header_lib + "-Wl,--no-whole-archive" + CONAN_PKG::spdlog) target_precompile_headers(${GRPC} PRIVATE precomp_inc/precomp.hh) -# include_directories($(Boost_INCLUDE_DIRS)) + +file( + GLOB bbdo_files + LIST_DIRECTORIES false + ${CMAKE_SOURCE_DIR}/bbdo/*.proto) + +add_custom_command( + OUTPUT ${MODULE_DIR}/grpc_stream.proto ${MODULE_DIR}/src/grpc_bridge.cc + COMMENT "Generating grpc_stream.proto from bbdo protobuf files" + DEPENDS ${bbdo_files} + COMMAND + python3 ARGS ${MODULE_DIR}/generate_proto.py -f + ${MODULE_DIR}/grpc_stream.proto -c ${MODULE_DIR}/src/grpc_bridge.cc -d + ${CMAKE_SOURCE_DIR}/bbdo + VERBATIM) add_custom_command( OUTPUT "${SRC_DIR}/grpc_stream.pb.cc" "${SRC_DIR}/grpc_stream.pb.h" DEPENDS ${MODULE_DIR}/grpc_stream.proto COMMENT "Generating interface files of grpc_stream.proto" - COMMAND ${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${SRC_DIR} - --proto_path=${MODULE_DIR} grpc_stream.proto + COMMAND + ${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${SRC_DIR} + --proto_path=${MODULE_DIR} --proto_path=${CMAKE_SOURCE_DIR}/bbdo + grpc_stream.proto VERBATIM) add_custom_command( @@ -74,7 +105,8 @@ add_custom_command( COMMAND ${Protobuf_PROTOC_EXECUTABLE} ARGS --grpc_out=${SRC_DIR} --plugin=protoc-gen-grpc=${CONAN_BIN_DIRS_GRPC}/grpc_cpp_plugin - --proto_path=${MODULE_DIR} grpc_stream.proto + --proto_path=${MODULE_DIR} --proto_path=${CMAKE_SOURCE_DIR}/bbdo + grpc_stream.proto VERBATIM) # Testing. diff --git a/broker/grpc/generate_proto.py b/broker/grpc/generate_proto.py new file mode 100755 index 00000000000..7dc4790a104 --- /dev/null +++ b/broker/grpc/generate_proto.py @@ -0,0 +1,258 @@ +#!/usr/bin/python3 +""" +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0(the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com +""" + +from os import listdir +from os.path import isfile, join +import re +import argparse + + +file_begin_content = """syntax = "proto3"; + +""" + +file_message_centreon_event = """ +message CentreonEvent { + oneof content { + bytes buffer = 1; + +""" + +cc_file_begin_content = """ +/** + * Copyright 2023 Centreon (https://www.centreon.com/) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + * + * + * File generated by generate_proto.py + * + */ + + + +#include "grpc_stream.pb.h" +#include "com/centreon/broker/io/protobuf.hh" + +#include "com/centreon/broker/grpc/channel.hh" + +using namespace com::centreon::broker; + +namespace com::centreon::broker::grpc { +namespace detail { + +/** + * @brief the goal of this class is to not copy protobuf object + * event created by grpc receive layer is embedded in this object subclass of + * io::protobuf + * + * @tparam T A Protobuf message + * @tparam Typ The type to associate to this class as a BBDO type. + */ +template +class received_protobuf : public io::protobuf { + public: + typedef const T& (grpc_event_type::*const_accessor)() const; + typedef T* (grpc_event_type::*mutable_accessor)(); + + private: + event_ptr _received; + const_accessor _const_access; + mutable_accessor _mutable_access; + + public: + /** + * @brief Construct a new received protobuf object + * + * @param received object created by grpc layer + * @param const_access accessor to const T such as grpc_event_type::welcome_() + * @param mutable_access accessor to T such as + * grpc_event_type::mutable_welcome_() + */ + received_protobuf(const event_ptr received, + const_accessor const_access, + mutable_accessor mutable_access) + : _received(received), + _const_access(const_access), + _mutable_access(mutable_access) { + io::data::source_id = received->source_id(); + io::data::destination_id = received->destination_id(); + io::protobuf_base::set_message(((*_received).*_mutable_access)()); + } + + const T& obj() const override{ return ((*_received).*_const_access)(); } + + T& mut_obj() override { return *((*_received).*_mutable_access)(); } + + void set_obj(T&& obj) override { + throw com::centreon::exceptions::msg_fmt("unauthorized usage {}", + typeid(*this).name()); + } +}; + +} // namespace detail + +""" + + +cc_file_protobuf_to_event_function = """ +/** + * @brief this function creates a io::protobuf_object from grpc received message + * + * @param stream_content message received + * @return std::shared_ptr shared_ptr>, null if + * unknown content received + */ +std::shared_ptr protobuf_to_event(const event_ptr & stream_content) { + switch(stream_content->content_case()) { +""" + +cc_file_create_event_with_data_function = """ + +/** + * @brief this function create a event_with_data structure that will be send on grpc. + * stream_content don't have a copy of event, so event mustn't be + * deleted before stream_content + * + * @param event to send + * @return object used for send on the wire + */ +std::shared_ptr create_event_with_data(const std::shared_ptr & event) { + std::shared_ptr ret; + switch(event->type()) { +""" +cc_file_create_event_with_data_function_end = """ + default: + SPDLOG_LOGGER_ERROR(log_v2::grpc(), "unknown event type: {}", *event); + } + if (ret) { + ret->grpc_event.set_destination_id(event->destination_id); + ret->grpc_event.set_source_id(event->source_id); + } + return ret; +} +""" + + +parser = argparse.ArgumentParser( + prog='generate_proto.py', description='generate grpc_stream.proto file by referencing message found in protobuf files') +parser.add_argument('-f', '--proto_file', + help='outputs files use by grpc module', required=True) +parser.add_argument('-c', '--cc_file', + help='output source file that must be compiled and linked int target library', required=True) +parser.add_argument('-d', '--proto_directory', + help='directory where to find protobuf files', required=True, action='append') + +args = parser.parse_args() + +message_parser = r'^message\s+(\w+)\s+\{' +io_protobuf_parser = r'\/\*\s*(\w+::\w+\s*,\s*\w+::\w+)\s*\*\/' + +one_of_index = 2 + +for directory in args.proto_directory: + proto_files = [f for f in listdir( + directory) if f[-6:] == ".proto" and isfile(join(directory, f))] + for file in proto_files: + with open(join(directory, file)) as proto_file: + messages = [] + io_protobuf_match = None + for line in proto_file.readlines(): + m = re.match(message_parser, line) + if m is not None and io_protobuf_match is not None: + messages.append([m.group(1), io_protobuf_match.group(1)]) + io_protobuf_match = None + else: + io_protobuf_match = re.match(io_protobuf_parser, line) + + if len(messages) > 0: + file_begin_content += f"import \"{file}\";\n" + for mess, id in messages: + # proto file + file_message_centreon_event += f" {mess} {mess}_ = {one_of_index};\n" + one_of_index += 1 + lower_mess = mess.lower() + # cc file + cc_file_protobuf_to_event_function += f""" case ::stream::CentreonEvent::k{mess}: + return std::make_shared>( + stream_content, &grpc_event_type::{lower_mess}_, + &grpc_event_type::mutable_{lower_mess}_); +""" + cc_file_create_event_with_data_function += f""" case make_type({id}): + ret = std::make_shared( + event, reinterpret_cast( + &grpc_event_type::release_{lower_mess}_)); + ret->grpc_event.set_allocated_{lower_mess}_(&std::static_pointer_cast>(event)->mut_obj()); + break; + +""" + +with open(args.proto_file, 'w', encoding="utf-8") as fp: + fp.write(file_begin_content) + fp.write(""" + +package com.centreon.broker.stream; + +""") + fp.write(file_message_centreon_event) + fp.write(""" + } + uint32 destination_id = 126; + uint32 source_id = 127; +} + +service centreon_bbdo { + //emitter connect to receiver + rpc exchange(stream CentreonEvent) returns (stream CentreonEvent) {} +} + +""") + +with open(args.cc_file, 'w') as fp: + fp.write(cc_file_begin_content) + fp.write(cc_file_protobuf_to_event_function) + fp.write(""" default: + SPDLOG_LOGGER_ERROR(log_v2::grpc(), "unknown content type: {} => ignored", + stream_content->content_case()); + return std::shared_ptr(); + } +} + + +""") + fp.write(cc_file_create_event_with_data_function) + fp.write(cc_file_create_event_with_data_function_end) + fp.write(""" + +} // namespace com::centreon::broker::grpc + +""") diff --git a/broker/grpc/grpc_stream.proto b/broker/grpc/grpc_stream.proto deleted file mode 100644 index ffaf13cc3df..00000000000 --- a/broker/grpc/grpc_stream.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -package com.centreon.broker.stream; - - -message centreon_event { - oneof content { - bytes buffer = 1; - } -} - -service centreon_bbdo { - //emitter connect to receiver - rpc exchange(stream centreon_event) returns (stream centreon_event) {} -} diff --git a/broker/grpc/inc/com/centreon/broker/grpc/acceptor.hh b/broker/grpc/inc/com/centreon/broker/grpc/acceptor.hh index 7b9a317830d..dd7a2f72fc5 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/acceptor.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/acceptor.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/endpoint.hh" #include "grpc_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { @@ -46,6 +46,6 @@ class acceptor : public io::endpoint { bool is_ready() const override; }; }; // namespace grpc -CCB_END() +} #endif // !CCB_GRPC_ACCEPTOR_HH diff --git a/broker/grpc/inc/com/centreon/broker/grpc/channel.hh b/broker/grpc/inc/com/centreon/broker/grpc/channel.hh index bc48974e209..86090df11c5 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/channel.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/channel.hh @@ -29,7 +29,7 @@ struct detail_centreon_event; std::ostream& operator<<(std::ostream&, const detail_centreon_event&); } // namespace grpc namespace stream { -std::ostream& operator<<(std::ostream&, const centreon_event&); +std::ostream& operator<<(std::ostream&, const CentreonEvent&); } // namespace stream } // namespace broker } // namespace centreon @@ -37,10 +37,10 @@ std::ostream& operator<<(std::ostream&, const centreon_event&); namespace centreon_grpc = com::centreon::broker::grpc; namespace centreon_stream = com::centreon::broker::stream; -using grpc_event_type = centreon_stream::centreon_event; +using grpc_event_type = centreon_stream::CentreonEvent; using event_ptr = std::shared_ptr; -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { @@ -48,9 +48,9 @@ using channel_ptr = std::shared_ptr<::grpc::Channel>; using uint64_vector = std::vector; struct detail_centreon_event { - detail_centreon_event(const centreon_stream::centreon_event& todump) + detail_centreon_event(const centreon_stream::CentreonEvent& todump) : to_dump(todump) {} - const centreon_stream::centreon_event& to_dump; + const centreon_stream::CentreonEvent& to_dump; }; const std::string authorization_header("authorization"); @@ -69,23 +69,55 @@ constexpr uint32_t calc_accept_all_compression_mask() { * */ class channel : public std::enable_shared_from_this { + public: + /** + * @brief we pass our protobuf objects to grpc_event without copy + * so we must avoid that grpc_event delete message of protobuf object + * This the goal of this struct. + * At destruction, it releases protobuf object from grpc_event. + * Destruction of protobuf object is the job of shared_ptr + */ + struct event_with_data { + using pointer = std::shared_ptr; + grpc_event_type grpc_event; + std::shared_ptr bbdo_event; + typedef google::protobuf::Message* (grpc_event_type::*releaser_type)(); + releaser_type releaser; + + event_with_data() : releaser(nullptr) {} + + event_with_data(const std::shared_ptr& bbdo_evt, + releaser_type relser) + : bbdo_event(bbdo_evt), releaser(relser) {} + + event_with_data(const event_with_data&) = delete; + event_with_data& operator=(const event_with_data&) = delete; + + ~event_with_data() { + if (releaser) { + (grpc_event.*releaser)(); + } + } + }; + private: channel& operator=(const channel&) = delete; channel(const channel&) = delete; protected: - using event_queue = std::list; + using read_queue = std::deque; + using write_queue = std::deque; const std::string _class_name; /// read section - event_queue _read_queue; + read_queue _read_queue; bool _read_pending; event_ptr _read_current; // write section - event_queue _write_queue; - event_ptr _write_current; + write_queue _write_queue; + event_with_data::pointer _write_current; bool _write_pending; bool _error; @@ -101,7 +133,7 @@ class channel : public std::enable_shared_from_this { void start_read(bool first_read); void start_write(); - virtual void start_write(const event_ptr&) = 0; + virtual void start_write(const event_with_data::pointer&) = 0; virtual void start_read(event_ptr&, bool first_read) = 0; void on_write_done(bool ok); @@ -118,6 +150,7 @@ class channel : public std::enable_shared_from_this { virtual void shutdown() = 0; bool is_down() const { return _error || _thrown; }; bool is_alive() const { return !_error && !_thrown; } + grpc_config::pointer get_conf() const { return _conf; } std::pair read(time_t deadline) { return read(system_clock::from_time_t(deadline)); @@ -127,7 +160,7 @@ class channel : public std::enable_shared_from_this { } std::pair read(const system_clock::time_point& deadline); - int write(const event_ptr&); + int write(const event_with_data::pointer&); int flush(); virtual int stop(); @@ -135,12 +168,12 @@ class channel : public std::enable_shared_from_this { }; } // namespace grpc -CCB_END() +} namespace fmt { // formatter specializations for fmt template <> -struct formatter : ostream_formatter {}; +struct formatter : ostream_formatter {}; template <> struct formatter : ostream_formatter {}; diff --git a/broker/grpc/inc/com/centreon/broker/grpc/client.hh b/broker/grpc/inc/com/centreon/broker/grpc/client.hh index ccaf360ca63..fea5f671a35 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/client.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/client.hh @@ -21,7 +21,7 @@ #include "channel.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { /** @@ -31,8 +31,8 @@ namespace grpc { */ class client : public channel, public ::grpc::ClientBidiReactor< - ::com::centreon::broker::stream::centreon_event, - ::com::centreon::broker::stream::centreon_event> { + ::com::centreon::broker::stream::CentreonEvent, + ::com::centreon::broker::stream::CentreonEvent> { channel_ptr _channel; std::unique_ptr _stub; std::unique_ptr<::grpc::ClientContext> _context; @@ -48,7 +48,7 @@ class client : public channel, client(const grpc_config::pointer& conf); void start_read(event_ptr& to_read, bool first_read) override; - void start_write(const event_ptr& to_send) override; + void start_write(const event_with_data::pointer& to_send) override; void remove_hold(); @@ -71,6 +71,6 @@ class client : public channel, } // namespace grpc -CCB_END() +} #endif // !CCB_GRPC_STREAM_HH diff --git a/broker/grpc/inc/com/centreon/broker/grpc/connector.hh b/broker/grpc/inc/com/centreon/broker/grpc/connector.hh index 1b58d78c82a..cf3e1e37875 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/connector.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/connector.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/limit_endpoint.hh" #include "grpc_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { class connector : public io::limit_endpoint { @@ -40,6 +40,6 @@ class connector : public io::limit_endpoint { }; }; // namespace grpc -CCB_END() +} #endif // !CCB_GRPC_CONNECTOR_HH diff --git a/broker/grpc/inc/com/centreon/broker/grpc/factory.hh b/broker/grpc/inc/com/centreon/broker/grpc/factory.hh index 535588765f1..86d4e8af29e 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/factory.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/factory.hh @@ -20,9 +20,8 @@ #define CCB_GRPC_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { /** @@ -51,6 +50,6 @@ class factory : public io::factory { }; } // namespace grpc -CCB_END() +} #endif // !CCB_GRPC_FACTORY_HH diff --git a/broker/core/inc/com/centreon/broker/namespace.hh b/broker/grpc/inc/com/centreon/broker/grpc/grpc_bridge.hh similarity index 58% rename from broker/core/inc/com/centreon/broker/namespace.hh rename to broker/grpc/inc/com/centreon/broker/grpc/grpc_bridge.hh index 167b657c6de..91eadf4520b 100644 --- a/broker/core/inc/com/centreon/broker/namespace.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/grpc_bridge.hh @@ -1,5 +1,5 @@ /* -** Copyright 2011-2012 Centreon +** Copyright 2022 Centreon ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -16,23 +16,22 @@ ** For more information : contact@centreon.com */ -#ifndef CCB_NAMESPACE_HH -#define CCB_NAMESPACE_HH - -#ifdef CCB_BEGIN -#undef CCB_BEGIN -#endif // CCB_BEGIN -#define CCB_BEGIN() \ - namespace com { \ - namespace centreon { \ - namespace broker { - -#ifdef CCB_END -#undef CCB_END -#endif // CCB_END -#define CCB_END() \ - } \ - } \ - } - -#endif // !CCB_NAMESPACE_HH +#ifndef CCB_GRPC_BRIDGE_HH +#define CCB_GRPC_BRIDGE_HH + +#include "com/centreon/broker/io/protobuf.hh" +#include "grpc_stream.pb.h" + +namespace com::centreon::broker { + +namespace grpc { +std::shared_ptr protobuf_to_event(const event_ptr& stream_content); + +std::shared_ptr create_event_with_data( + const std::shared_ptr& event); + +}; // namespace grpc + +} + +#endif diff --git a/broker/grpc/inc/com/centreon/broker/grpc/grpc_config.hh b/broker/grpc/inc/com/centreon/broker/grpc/grpc_config.hh index 2c1fc7b2181..61b7230a07f 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/grpc_config.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/grpc_config.hh @@ -19,7 +19,7 @@ #ifndef CCB_GRPC_CONFIG_HH #define CCB_GRPC_CONFIG_HH -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { class grpc_config { @@ -27,23 +27,31 @@ class grpc_config { enum compression_active { NO = 0, AUTO = 1, YES = 2 }; private: - std::string _hostport; - bool _crypted = false; - std::string _certificate, _cert_key, _ca_cert, _authorization; - // grpc_compression_level _compress_level; - std::string _ca_name; - compression_active _compress; - int _second_keepalive_interval; + const std::string _hostport; + const bool _crypted = false; + const std::string _certificate, _cert_key, _ca_cert, _authorization; + const std::string _ca_name; + const compression_active _compress; + const int _second_keepalive_interval; + /** + * @brief when _grpc_serialized is set, bbdo events are sent on the wire + * without bbdo stream serialization + * + */ + const bool _grpc_serialized; public: using pointer = std::shared_ptr; - grpc_config() : _compress(NO), _second_keepalive_interval(30) {} + grpc_config() + : _compress(NO), + _second_keepalive_interval(30), + _grpc_serialized(false) {} grpc_config(const std::string& hostp) : _hostport(hostp), - _crypted(false), _compress(NO), - _second_keepalive_interval(30) {} + _second_keepalive_interval(30), + _grpc_serialized(false) {} grpc_config(const std::string& hostp, bool crypted, const std::string& certificate, @@ -52,7 +60,8 @@ class grpc_config { const std::string& authorization, const std::string& ca_name, compression_active compression, - int second_keepalive_interval = 30) + int second_keepalive_interval, + bool grpc_serialized) : _hostport(hostp), _crypted(crypted), _certificate(certificate), @@ -61,7 +70,8 @@ class grpc_config { _authorization(authorization), _ca_name(ca_name), _compress(compression), - _second_keepalive_interval(second_keepalive_interval) {} + _second_keepalive_interval(second_keepalive_interval), + _grpc_serialized(grpc_serialized) {} constexpr const std::string& get_hostport() const { return _hostport; } constexpr bool is_crypted() const { return _crypted; } @@ -73,14 +83,13 @@ class grpc_config { } const std::string& get_ca_name() const { return _ca_name; } constexpr compression_active get_compression() const { return _compress; } + constexpr bool get_grpc_serialized() const { return _grpc_serialized; } int get_second_keepalive_interval() const { return _second_keepalive_interval; } - - friend class factory; }; }; // namespace grpc -CCB_END() +} #endif // !CCB_GRPC_CONFIG_HH diff --git a/broker/grpc/inc/com/centreon/broker/grpc/server.hh b/broker/grpc/inc/com/centreon/broker/grpc/server.hh index 41c4f761225..cf4025667b5 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/server.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/server.hh @@ -25,7 +25,7 @@ namespace grpc { class Server; } -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { @@ -52,7 +52,7 @@ class accepted_service void start(); void start_read(event_ptr&, bool first_read) override; - void start_write(const event_ptr&) override; + void start_write(const event_with_data::pointer&) override; int stop() override; void shutdown() override; @@ -101,6 +101,6 @@ class server : public centreon_stream::centreon_bbdo::Service, } // namespace grpc -CCB_END() +} #endif // !CCB_GRPC_STREAM_HH diff --git a/broker/grpc/inc/com/centreon/broker/grpc/stream.hh b/broker/grpc/inc/com/centreon/broker/grpc/stream.hh index 975ea3adf21..3db5c242975 100644 --- a/broker/grpc/inc/com/centreon/broker/grpc/stream.hh +++ b/broker/grpc/inc/com/centreon/broker/grpc/stream.hh @@ -21,7 +21,7 @@ #include "channel.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace grpc { @@ -33,6 +33,8 @@ class stream : public io::stream { std::shared_ptr _channel; + grpc_config::pointer _conf; + public: stream(const grpc_config::pointer& conf); stream(const std::shared_ptr&); @@ -58,6 +60,6 @@ class stream : public io::stream { }; } // namespace grpc -CCB_END() +} #endif // !CCB_GRPC_STREAM_HH diff --git a/broker/grpc/src/acceptor.cc b/broker/grpc/src/acceptor.cc index b6b0c4e7a9f..7c3f5730a8a 100644 --- a/broker/grpc/src/acceptor.cc +++ b/broker/grpc/src/acceptor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/grpc/src/channel.cc b/broker/grpc/src/channel.cc index 73f3e46a0e0..c936b06c35e 100644 --- a/broker/grpc/src/channel.cc +++ b/broker/grpc/src/channel.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,17 +37,22 @@ using channel_trash_type = com::centreon::broker::misc::trash; static channel_trash_type* _trash(new channel_trash_type); -namespace com { -namespace centreon { -namespace broker { +namespace com::centreon::broker { namespace stream { std::ostream& operator<<(std::ostream& st, - const centreon_stream::centreon_event& to_dump) { + const centreon_stream::CentreonEvent& to_dump) { if (to_dump.IsInitialized()) { if (to_dump.has_buffer()) { st << "buff: " << com::centreon::broker::misc::string::debug_buf( to_dump.buffer().data(), to_dump.buffer().length(), 20); + } else { + std::string dump{to_dump.ShortDebugString()}; + if (dump.size() > 200) { + dump.resize(200); + st << fmt::format(" content:'{}...'", dump); + } else + st << " content:'" << dump << '\''; } } return st; @@ -62,14 +67,14 @@ std::ostream& operator<<(std::ostream& st, << com::centreon::broker::misc::string::debug_buf( to_dump.to_dump.buffer().data(), to_dump.to_dump.buffer().length(), 100); + } else { + st << " content:'" << to_dump.to_dump.ShortDebugString() << '\''; } } return st; } } // namespace grpc -} // namespace broker -} // namespace centreon -} // namespace com +} // namespace com::centreon::broker channel::channel(const std::string& class_name, const grpc_config::pointer& conf) @@ -175,7 +180,7 @@ void channel::on_read_done(bool ok) { /*************************************************************** * write section ***************************************************************/ -int channel::write(const event_ptr& to_send) { +int channel::write(const event_with_data::pointer& to_send) { if (is_down()) { throw(exceptions::connection_closed("{} connection is down", __PRETTY_FUNCTION__)); @@ -189,7 +194,7 @@ int channel::write(const event_ptr& to_send) { } void channel::start_write() { - event_ptr write_current; + event_with_data::pointer write_current; { lock_guard l(_protect); if (_write_pending) { @@ -201,7 +206,12 @@ void channel::start_write() { _write_pending = true; write_current = _write_current = _write_queue.front(); } - SPDLOG_LOGGER_DEBUG(log_v2::grpc(), "write: {}", *write_current); + if (write_current->bbdo_event) + SPDLOG_LOGGER_TRACE(log_v2::grpc(), "write: {}", + *write_current->bbdo_event); + else + SPDLOG_LOGGER_TRACE(log_v2::grpc(), "write: {}", write_current->grpc_event); + start_write(write_current); } @@ -211,7 +221,12 @@ void channel::on_write_done(bool ok) { { lock_guard l(_protect); _write_pending = false; - SPDLOG_LOGGER_DEBUG(log_v2::grpc(), "write done: {}", *_write_current); + if (_write_current->bbdo_event) + SPDLOG_LOGGER_TRACE(log_v2::grpc(), "write done: {}", + *_write_current->bbdo_event); + else + SPDLOG_LOGGER_TRACE(log_v2::grpc(), "write done: {}", + _write_current->grpc_event); _write_queue.pop_front(); data_to_write = !_write_queue.empty(); @@ -222,7 +237,12 @@ void channel::on_write_done(bool ok) { } } else { lock_guard l(_protect); - SPDLOG_LOGGER_ERROR(log_v2::grpc(), "write failed: {}", *_write_current); + if (_write_current->bbdo_event) + SPDLOG_LOGGER_ERROR(log_v2::grpc(), "write failed: {}", + *_write_current->bbdo_event); + else + SPDLOG_LOGGER_ERROR(log_v2::grpc(), "write failed: {}", + _write_current->grpc_event); _error = true; } } diff --git a/broker/grpc/src/client.cc b/broker/grpc/src/client.cc index a55b8993d51..b1fa7a44bb0 100644 --- a/broker/grpc/src/client.cc +++ b/broker/grpc/src/client.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -134,10 +134,10 @@ void client::OnReadDone(bool ok) { on_read_done(ok); } -void client::start_write(const event_ptr& to_send) { +void client::start_write(const event_with_data::pointer& to_send) { std::lock_guard l(_hold_mutex); if (_hold_to_remove) { - StartWrite(to_send.get()); + StartWrite(&to_send->grpc_event); } } diff --git a/broker/grpc/src/connector.cc b/broker/grpc/src/connector.cc index d622b004180..82e9ad80f26 100644 --- a/broker/grpc/src/connector.cc +++ b/broker/grpc/src/connector.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/grpc/src/factory.cc b/broker/grpc/src/factory.cc index 4d3f27018ca..46907bcbc34 100644 --- a/broker/grpc/src/factory.cc +++ b/broker/grpc/src/factory.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -219,28 +219,32 @@ io::endpoint* factory::new_endpoint( } } + std::string hostport; + if (host.empty()) { + is_acceptor = true; + hostport = fmt::format("0.0.0.0:{}", port); + } else { + is_acceptor = false; + hostport = fmt::format("{}:{}", host, port); + } + grpc_config::pointer conf(std::make_shared( - "", encrypted, certificate, certificate_key, certificate_authority, - authorization, ca_name, enable_compression, keepalive_interval)); + hostport, encrypted, certificate, certificate_key, certificate_authority, + authorization, ca_name, enable_compression, keepalive_interval, + direct_grpc_serialized(cfg))); std::unique_ptr endp; - if (host.empty()) - is_acceptor = true; - else - is_acceptor = false; // Acceptor. if (is_acceptor) { log_v2::grpc()->debug("GRPC: encryption {} on gRPC server port {}", encrypted ? "enabled" : "disabled", port); - conf->_hostport = fmt::format("0.0.0.0:{}", port); endp = std::make_unique(conf); } // Connector. else { log_v2::grpc()->debug("GRPC: encryption {} on gRPC client port {}", encrypted ? "enabled" : "disabled", port); - conf->_hostport = fmt::format("{}:{}", host, port); endp = std::make_unique(conf); } @@ -433,21 +437,25 @@ io::endpoint* factory::_new_endpoint_bbdo_cs( } } + std::string hostport; + if (cfg.type == "bbdo_server") { + is_acceptor = true; + hostport = fmt::format("0.0.0.0:{}", port); + } else { + is_acceptor = false; + hostport = fmt::format("{}:{}", host, port); + } + grpc_config::pointer conf(std::make_shared( - "", encryption, certificate, private_key, ca_certificate, authorization, - ca_name, enable_compression, keepalive_interval)); + hostport, encryption, certificate, private_key, ca_certificate, + authorization, ca_name, enable_compression, keepalive_interval, + direct_grpc_serialized(cfg))); // Acceptor. std::unique_ptr endp; - if (cfg.type == "bbdo_server") - is_acceptor = true; - else if (cfg.type == "bbdo_client") - is_acceptor = false; - if (is_acceptor) { log_v2::grpc()->debug("GRPC: encryption {} on gRPC server port {}", encryption ? "enabled" : "disabled", port); - conf->_hostport = fmt::format("{}:{}", host, port); endp = std::make_unique(conf); } @@ -455,7 +463,6 @@ io::endpoint* factory::_new_endpoint_bbdo_cs( else { log_v2::grpc()->debug("GRPC: encryption {} on gRPC client port {}", encryption ? "enabled" : "disabled", port); - conf->_hostport = fmt::format("{}:{}", host, port); endp = std::make_unique(conf); } diff --git a/broker/grpc/src/main.cc b/broker/grpc/src/main.cc index 9e186c0d9c4..540b542c1b8 100644 --- a/broker/grpc/src/main.cc +++ b/broker/grpc/src/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/grpc/src/server.cc b/broker/grpc/src/server.cc index e6b76f7dcb0..1033a293595 100644 --- a/broker/grpc/src/server.cc +++ b/broker/grpc/src/server.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,7 +75,7 @@ void accepted_service::OnReadDone(bool ok) { on_read_done(ok); } -void accepted_service::start_write(const event_ptr& to_send) { +void accepted_service::start_write(const event_with_data::pointer& to_send) { if (*_server_finished || _thrown) { bool expected = false; if (_finished_called.compare_exchange_strong(expected, true)) { @@ -84,7 +84,7 @@ void accepted_service::start_write(const event_ptr& to_send) { Finish(::grpc::Status(::grpc::CANCELLED, "start_write server finished")); } } else { - StartWrite(to_send.get()); + StartWrite(&to_send->grpc_event); } } @@ -117,8 +117,8 @@ server::server(const grpc_config::pointer& conf) : _conf(conf) { void server::start() { ::grpc::Service::MarkMethodCallback( 0, new ::grpc::internal::CallbackBidiHandler< - ::com::centreon::broker::stream::centreon_event, - ::com::centreon::broker::stream::centreon_event>( + ::com::centreon::broker::stream::CentreonEvent, + ::com::centreon::broker::stream::CentreonEvent>( [me = shared_from_this()](::grpc::CallbackServerContext* context) { return me->exchange(context); })); diff --git a/broker/grpc/src/stream.cc b/broker/grpc/src/stream.cc index 13b5271479a..9fa79d796e3 100644 --- a/broker/grpc/src/stream.cc +++ b/broker/grpc/src/stream.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +22,7 @@ #include "com/centreon/broker/grpc/stream.hh" #include "com/centreon/broker/grpc/client.hh" +#include "com/centreon/broker/grpc/grpc_bridge.hh" #include "com/centreon/broker/grpc/server.hh" #include "com/centreon/exceptions/msg_fmt.hh" @@ -38,13 +39,16 @@ struct formatter : ostream_formatter {}; } // namespace fmt com::centreon::broker::grpc::stream::stream(const grpc_config::pointer& conf) - : io::stream("GRPC"), _accept(false) { + : io::stream("GRPC"), _accept(false), _conf(conf) { _channel = client::create(conf); } com::centreon::broker::grpc::stream::stream( const std::shared_ptr& accepted) - : io::stream("GRPC"), _accept(true), _channel(accepted) {} + : io::stream("GRPC"), + _accept(true), + _channel(accepted), + _conf(_channel->get_conf()) {} com::centreon::broker::grpc::stream::~stream() noexcept { if (_channel) @@ -62,7 +66,8 @@ com::centreon::broker::grpc::stream::~stream() noexcept { SPDLOG_LOGGER_TRACE(log_v2::grpc(), "receive:{}", \ *std::static_pointer_cast(d)); \ } else { \ - return false; \ + d = protobuf_to_event(read_res.first); \ + return d ? true : false; \ } \ } else { \ if (_channel->is_down()) { \ @@ -92,11 +97,17 @@ int32_t com::centreon::broker::grpc::stream::write( if (_channel->is_down()) throw msg_fmt("Connection lost"); - event_ptr to_send(std::make_shared()); + channel::event_with_data::pointer to_send; - std::shared_ptr raw_src = std::static_pointer_cast(d); - to_send->mutable_buffer()->assign(raw_src->_buffer.begin(), - raw_src->_buffer.end()); + if (_conf->get_grpc_serialized() && + std::dynamic_pointer_cast(d)) { // no bbdo serialize + to_send = create_event_with_data(d); + } else { + to_send = std::make_shared(); + std::shared_ptr raw_src = std::static_pointer_cast(d); + to_send->grpc_event.mutable_buffer()->assign(raw_src->_buffer.begin(), + raw_src->_buffer.end()); + } return _channel->write(to_send); } diff --git a/broker/grpc/test/acceptor.cc b/broker/grpc/test/acceptor.cc index 28f9a66be76..6188aec7f1f 100644 --- a/broker/grpc/test/acceptor.cc +++ b/broker/grpc/test/acceptor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -229,7 +229,7 @@ TEST_F(GrpcTlsTest, TlsStreamBadCaHostname) { auto conf{std::make_shared( "0.0.0.0:4141", true, read_file("/tmp/server.crt"), read_file("/tmp/server.key"), read_file("/tmp/client.crt"), "", - "centreon", grpc_config::NO)}; + "centreon", grpc_config::NO, 30, false)}; auto a{std::make_unique(conf)}; /* Nominal case, cbd is acceptor and read on the socket */ @@ -246,7 +246,7 @@ TEST_F(GrpcTlsTest, TlsStreamBadCaHostname) { auto conf{std::make_shared( "localhost:4141", true, read_file("/tmp/client.crt"), read_file("/tmp/client.key"), read_file("/tmp/server.crt"), "", - "bad_name", grpc_config::NO)}; + "bad_name", grpc_config::NO, 30, false)}; auto c{std::make_unique(conf)}; /* Nominal case, centengine is connector and write on the socket */ diff --git a/broker/grpc/test/channel_test.cc b/broker/grpc/test/channel_test.cc index 5c197c05352..43f6a613461 100644 --- a/broker/grpc/test/channel_test.cc +++ b/broker/grpc/test/channel_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,11 +41,13 @@ static com::centreon::broker::grpc::grpc_config::pointer conf1( class channel_test : public channel { public: - using event_cont = std::multimap; - event_cont sent; + using event_send_cont = std::multimap; + event_send_cont sent; std::queue to_read; - event_cont readen; + using event_read_cont = std::multimap; + event_read_cont readen; using pointer = std::shared_ptr; pointer shared_from_this() { @@ -55,7 +57,7 @@ class channel_test : public channel { channel_test(const grpc_config::pointer& conf) : channel("channel_test", conf) {} - void start_write(const event_ptr& to_send) override { + void start_write(const channel::event_with_data::pointer& to_send) override { pool::io_context().post( [me = shared_from_this()]() { me->simul_on_write(); }); } @@ -94,7 +96,7 @@ TEST_F(grpc_channel_tester, write_all) { channel->start(); for (int ii = 0; ii < 100; ++ii) { - channel->write(std::make_shared()); + channel->write(std::make_shared()); } std::this_thread::sleep_for(std::chrono::milliseconds(10)); ASSERT_EQ((channel->sent.size()), 100); @@ -182,10 +184,11 @@ TEST_F(grpc_channel_tester, throw_write_after_failure) { int failure_ind = channel->failure_ind = rand() % 100 + 10; for (int32_t ii = 0; ii <= failure_ind; ++ii) { - channel->write(std::make_shared()); + channel->write(std::make_shared()); } std::this_thread::sleep_for(std::chrono::milliseconds(20)); - ASSERT_THROW(channel->write(std::make_shared()), msg_fmt); + ASSERT_THROW(channel->write(std::make_shared()), + msg_fmt); ASSERT_THROW(channel->read(std::chrono::milliseconds(1)), msg_fmt); } diff --git a/broker/grpc/test/factory_test.cc b/broker/grpc/test/factory_test.cc index a5f0412472e..823015f3454 100644 --- a/broker/grpc/test/factory_test.cc +++ b/broker/grpc/test/factory_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/grpc/test/grpc_test_include.hh b/broker/grpc/test/grpc_test_include.hh index 1f077d03027..06fa88476da 100644 --- a/broker/grpc/test/grpc_test_include.hh +++ b/broker/grpc/test/grpc_test_include.hh @@ -43,10 +43,11 @@ using time_point = system_clock::time_point; using duration = system_clock::duration; using unique_lock = std::unique_lock; +#include "com/centreon/broker/log_v2.hh" + #include "com/centreon/broker/grpc/acceptor.hh" #include "com/centreon/broker/grpc/stream.hh" #include "com/centreon/broker/io/raw.hh" -#include "com/centreon/broker/log_v2.hh" #include "com/centreon/broker/pool.hh" #include "com/centreon/exceptions/msg_fmt.hh" diff --git a/broker/grpc/test/stream_test.cc b/broker/grpc/test/stream_test.cc index 9633b5953f3..9706ac939ff 100644 --- a/broker/grpc/test/stream_test.cc +++ b/broker/grpc/test/stream_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,7 +34,9 @@ com::centreon::broker::grpc::grpc_config::pointer conf( "", "my_aut", "", - com::centreon::broker::grpc::grpc_config::NO)); + com::centreon::broker::grpc::grpc_config::NO, + 30, + false)); static constexpr unsigned relay_listen_port = 5123u; static constexpr unsigned server_listen_port = 5124u; @@ -344,7 +346,9 @@ com::centreon::broker::grpc::grpc_config::pointer conf_crypted_server1234( read_file("tests/grpc_test_keys/ca_1234.crt"), "my_auth", "", - com::centreon::broker::grpc::grpc_config::NO)); + com::centreon::broker::grpc::grpc_config::NO, + 30, + false)); com::centreon::broker::grpc::grpc_config::pointer conf_crypted_client1234( std::make_shared( @@ -355,7 +359,9 @@ com::centreon::broker::grpc::grpc_config::pointer conf_crypted_client1234( read_file("tests/grpc_test_keys/ca_1234.crt"), "my_auth", "", - com::centreon::broker::grpc::grpc_config::NO)); + com::centreon::broker::grpc::grpc_config::NO, + 30, + false)); class grpc_test_server_crypted : public ::testing::TestWithParam { protected: @@ -418,7 +424,9 @@ com::centreon::broker::grpc::grpc_config::pointer read_file("tests/grpc_test_keys/ca_1234.crt"), "my_auth_pasbon", "", - com::centreon::broker::grpc::grpc_config::NO)); + com::centreon::broker::grpc::grpc_config::NO, + 30, + false)); TEST_P(grpc_test_server_crypted, ServerToClientWithKeyAndBadAuthorization) { com::centreon::broker::grpc::stream client(conf_crypted_client1234_bad_auth); diff --git a/broker/http_client/inc/com/centreon/broker/http_client/http_client.hh b/broker/http_client/inc/com/centreon/broker/http_client/http_client.hh index c70308163f8..8ceb626f325 100644 --- a/broker/http_client/inc/com/centreon/broker/http_client/http_client.hh +++ b/broker/http_client/inc/com/centreon/broker/http_client/http_client.hh @@ -23,7 +23,7 @@ class client_test; -CCB_BEGIN() +namespace com::centreon::broker { namespace http_client { /** @@ -149,6 +149,6 @@ void client::visit_queue(visitor_type& visitor) const { } // namespace http_client -CCB_END() +} #endif // CCB_HTTP_CLIENT_CLIENT_HH__ diff --git a/broker/http_client/inc/com/centreon/broker/http_client/http_config.hh b/broker/http_client/inc/com/centreon/broker/http_client/http_config.hh index f77fed3aa29..c24c82b2005 100644 --- a/broker/http_client/inc/com/centreon/broker/http_client/http_config.hh +++ b/broker/http_client/inc/com/centreon/broker/http_client/http_config.hh @@ -19,7 +19,7 @@ #ifndef CCB_HTTP_CLIENT_CONFIG_HH__ #define CCB_HTTP_CLIENT_CONFIG_HH__ -CCB_BEGIN() +namespace com::centreon::broker { namespace http_client { /** @@ -101,7 +101,7 @@ class http_config { }; // namespace http_client -CCB_END() +} namespace fmt { template <> diff --git a/broker/http_client/inc/com/centreon/broker/http_client/http_connection.hh b/broker/http_client/inc/com/centreon/broker/http_client/http_connection.hh index 260c5f9e537..198405214ab 100644 --- a/broker/http_client/inc/com/centreon/broker/http_client/http_connection.hh +++ b/broker/http_client/inc/com/centreon/broker/http_client/http_connection.hh @@ -21,7 +21,7 @@ #include "http_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace http_client { /** @@ -209,7 +209,7 @@ class http_connection : public connection_base { } // namespace http_client -CCB_END() +} namespace fmt { diff --git a/broker/http_client/inc/com/centreon/broker/http_client/https_connection.hh b/broker/http_client/inc/com/centreon/broker/http_client/https_connection.hh index 27b1241e587..1fff51f1e09 100644 --- a/broker/http_client/inc/com/centreon/broker/http_client/https_connection.hh +++ b/broker/http_client/inc/com/centreon/broker/http_client/https_connection.hh @@ -21,7 +21,7 @@ #include "http_connection.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace http_client { /** @@ -80,6 +80,6 @@ class https_connection : public connection_base { } // namespace http_client -CCB_END() +} #endif // CCB_HTTPS_CLIENT_CONNEXION_HH__ diff --git a/broker/http_client/precomp_inc/precomp.hh b/broker/http_client/precomp_inc/precomp.hh index 5da49b0bebf..07c1e1cc6d0 100644 --- a/broker/http_client/precomp_inc/precomp.hh +++ b/broker/http_client/precomp_inc/precomp.hh @@ -38,7 +38,6 @@ #include #include -#include "com/centreon/broker/namespace.hh" #include "com/centreon/exceptions/msg_fmt.hh" using system_clock = std::chrono::system_clock; diff --git a/broker/http_client/src/http_client.cc b/broker/http_client/src/http_client.cc index abb4e4b1cc9..2fbcbf060b9 100644 --- a/broker/http_client/src/http_client.cc +++ b/broker/http_client/src/http_client.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/http_client/src/http_connection.cc b/broker/http_client/src/http_connection.cc index aa7bcbdb979..eabdc412d8a 100644 --- a/broker/http_client/src/http_connection.cc +++ b/broker/http_client/src/http_connection.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/http_client/src/https_connection.cc b/broker/http_client/src/https_connection.cc index b6162b01b6e..b6928f6f07a 100644 --- a/broker/http_client/src/https_connection.cc +++ b/broker/http_client/src/https_connection.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,10 +29,9 @@ using namespace com::centreon::broker::http_client; namespace beast = boost::beast; -CCB_BEGIN() +namespace com::centreon::broker { -namespace http_client { -namespace detail { +namespace http_client::detail { /** * @brief to avoid read certificate on each request, this singleton do the job * it maintains a certificate cache @@ -120,10 +119,9 @@ void certificate_cache::clean() { } } -} // namespace detail -}; // namespace http_client +}; // namespace http_client::detail -CCB_END() +} // namespace com::centreon::broker /** * @brief Construct a new https connection::https connection object diff --git a/broker/http_client/test/http_client_test.cc b/broker/http_client/test/http_client_test.cc index 3912997441a..0ba7f92acaf 100644 --- a/broker/http_client/test/http_client_test.cc +++ b/broker/http_client/test/http_client_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,6 @@ #include #include "com/centreon/broker/log_v2.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/pool.hh" #include "com/centreon/common/defer.hh" diff --git a/broker/http_client/test/http_connection_test.cc b/broker/http_client/test/http_connection_test.cc index 74732dbf857..50065059056 100644 --- a/broker/http_client/test/http_connection_test.cc +++ b/broker/http_client/test/http_connection_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ #include #include "com/centreon/broker/log_v2.hh" -#include "com/centreon/broker/namespace.hh" using system_clock = std::chrono::system_clock; using time_point = system_clock::time_point; @@ -252,9 +251,14 @@ TEST(http_keepalive_test, KeepAliveWithTimeout) { *********************************************************************/ class session_base : public std::enable_shared_from_this { + protected: + std::shared_ptr _logger; + public: using pointer = std::shared_ptr; - virtual ~session_base() { SPDLOG_LOGGER_TRACE(log_v2::tcp(), "end session"); } + + session_base() : _logger(log_v2::tcp()) {} + virtual ~session_base() { SPDLOG_LOGGER_TRACE(_logger, "end session"); } virtual void on_receive(const beast::error_code& err, const request_ptr& request) = 0; @@ -281,10 +285,10 @@ class http_session : public session_base { [me = shared_from_this(), request](const beast::error_code& err, std::size_t bytes_received) { if (err) { - SPDLOG_LOGGER_ERROR(log_v2::tcp(), "fail recv {}", err.message()); + SPDLOG_LOGGER_ERROR(me->_logger, "fail recv {}", err.message()); me->shutdown(); } else { - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "recv {} bytes", bytes_received); + SPDLOG_LOGGER_TRACE(me->_logger, "recv {} bytes", bytes_received); me->on_receive(err, request); me->start_recv(); } @@ -302,18 +306,18 @@ class http_session : public session_base { } void start() override { - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "start a session"); + SPDLOG_LOGGER_TRACE(_logger, "start a session"); start_recv(); } void send_response(const response_ptr& resp) override { - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "send response"); + SPDLOG_LOGGER_TRACE(_logger, "send response"); beast::http::async_write( _stream, *resp, [me = shared_from_this(), resp](const beast::error_code& err, std::size_t bytes_sent) { if (err) { - SPDLOG_LOGGER_ERROR(log_v2::tcp(), "fail send response"); + SPDLOG_LOGGER_ERROR(me->_logger, "fail send response"); me->shutdown(); } }); @@ -336,10 +340,10 @@ class https_session : public session_base { [me = shared_from_this(), request](const beast::error_code& err, std::size_t bytes_received) { if (err) { - SPDLOG_LOGGER_ERROR(log_v2::tcp(), "fail recv {}", err.message()); + SPDLOG_LOGGER_ERROR(me->_logger, "fail recv {}", err.message()); me->shutdown(); } else { - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "recv {} bytes", bytes_received); + SPDLOG_LOGGER_TRACE(me->_logger, "recv {} bytes", bytes_received); me->on_receive(err, request); me->start_recv(); } @@ -357,7 +361,7 @@ class https_session : public session_base { } void start() override { - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "start a session"); + SPDLOG_LOGGER_TRACE(_logger, "start a session"); _stream.async_handshake( asio::ssl::stream_base::server, [me = shared_from_this()](const beast::error_code& err) { @@ -367,23 +371,23 @@ class https_session : public session_base { void on_handshake(const beast::error_code& err) { if (err) { - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "{} fail handshake {}", __FUNCTION__, + SPDLOG_LOGGER_TRACE(_logger, "{} fail handshake {}", __FUNCTION__, err.message()); shutdown(); return; } - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "handshake done"); + SPDLOG_LOGGER_TRACE(_logger, "handshake done"); start_recv(); } void send_response(const response_ptr& resp) override { - SPDLOG_LOGGER_TRACE(log_v2::tcp(), "send response"); + SPDLOG_LOGGER_TRACE(_logger, "send response"); beast::http::async_write( _stream, *resp, [me = shared_from_this(), resp](const beast::error_code& err, std::size_t bytes_sent) { if (err) { - SPDLOG_LOGGER_ERROR(log_v2::tcp(), "fail send response"); + SPDLOG_LOGGER_ERROR(me->_logger, "fail send response"); me->shutdown(); } }); @@ -399,6 +403,7 @@ class listener : public std::enable_shared_from_this { protected: std::shared_ptr _ssl_context; asio::ip::tcp::acceptor _acceptor; + std::shared_ptr _logger; void do_accept() { // The new connection gets its own strand @@ -409,10 +414,10 @@ class listener : public std::enable_shared_from_this { void on_accept(const beast::error_code& ec, asio::ip::tcp::socket socket) { if (ec) { - SPDLOG_LOGGER_ERROR(log_v2::tcp(), "fail accept"); + SPDLOG_LOGGER_ERROR(_logger, "fail accept"); return; } - SPDLOG_LOGGER_DEBUG(log_v2::tcp(), "accept a connection"); + SPDLOG_LOGGER_DEBUG(_logger, "accept a connection"); auto session = creator(std::move(socket), _ssl_context); session->start(); do_accept(); @@ -424,7 +429,8 @@ class listener : public std::enable_shared_from_this { listener(unsigned port) : _ssl_context(std::make_shared( asio::ssl::context::sslv23_server)), - _acceptor(*g_io_context, test_endpoint, true) { + _acceptor(*g_io_context, test_endpoint, true), + _logger(log_v2::tcp()) { load_server_certificate(*_ssl_context); } diff --git a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/column.hh b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/column.hh index 5e218c6bf10..b96b9705bea 100644 --- a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/column.hh +++ b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/column.hh @@ -19,9 +19,8 @@ #ifndef CCB_HTTP_TSDB_COLUMN_HH #define CCB_HTTP_TSDB_COLUMN_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace http_tsdb { /** @@ -52,6 +51,6 @@ class column { }; } // namespace http_tsdb -CCB_END() +} #endif // !CCB_HTTP_TSDB_COLUMN_HH diff --git a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/factory.hh b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/factory.hh index 45319281b6b..acb08f9192c 100644 --- a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/factory.hh +++ b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/factory.hh @@ -20,10 +20,9 @@ #define CCB_HTTP_TSDB_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" #include "http_tsdb_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace http_tsdb { @@ -56,6 +55,6 @@ class factory : public io::factory { }; } // namespace http_tsdb -CCB_END() +} #endif // !CCB_HTTP_TSDB_FACTORY_HH diff --git a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/http_tsdb_config.hh b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/http_tsdb_config.hh index b5e79fe3148..28345d663c4 100644 --- a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/http_tsdb_config.hh +++ b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/http_tsdb_config.hh @@ -22,7 +22,7 @@ #include "column.hh" #include "com/centreon/broker/http_client/http_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace http_tsdb { class http_tsdb_config : public http_client::http_config { @@ -71,6 +71,6 @@ class http_tsdb_config : public http_client::http_config { }; } // namespace http_tsdb -CCB_END() +} #endif diff --git a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/internal.hh b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/internal.hh index ff3748ebff5..487ad261f62 100644 --- a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/internal.hh +++ b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/internal.hh @@ -22,9 +22,8 @@ #include "bbdo/events.hh" #include "bbdo/storage.pb.h" #include "com/centreon/broker/io/protobuf.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { // Data elements. @@ -40,6 +39,6 @@ using pb_status = io::protobuf; } // namespace storage -CCB_END() +} #endif // !CCB_HTTP_TSDB_INTERNAL_HH diff --git a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/line_protocol_query.hh b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/line_protocol_query.hh index fc4865f2fed..a05c86d39e6 100644 --- a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/line_protocol_query.hh +++ b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/line_protocol_query.hh @@ -24,9 +24,8 @@ #include "com/centreon/broker/cache/global_cache.hh" #include "com/centreon/broker/http_tsdb/column.hh" #include "com/centreon/broker/http_tsdb/internal.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace http_tsdb { /** @@ -213,6 +212,6 @@ class line_protocol_query { }; } // namespace http_tsdb -CCB_END() +} #endif // !CCB_HTTP_TSDB_LINE_PROTOCOL_QUERY_HH diff --git a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/stream.hh b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/stream.hh index e982fbaa9e7..a65c73838b2 100644 --- a/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/stream.hh +++ b/broker/http_tsdb/inc/com/centreon/broker/http_tsdb/stream.hh @@ -21,7 +21,6 @@ #include "com/centreon/broker/http_client/http_client.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/persistent_cache.hh" #include "http_tsdb_config.hh" #include "internal.hh" @@ -29,7 +28,7 @@ namespace http_client = com::centreon::broker::http_client; -CCB_BEGIN() +namespace com::centreon::broker { namespace http_tsdb { @@ -156,6 +155,6 @@ class stream : public io::stream, public std::enable_shared_from_this { }; } // namespace http_tsdb -CCB_END() +} #endif // !CCB_HTTP_TSDB_STREAM_HH diff --git a/broker/http_tsdb/precomp_inc/precomp.hh b/broker/http_tsdb/precomp_inc/precomp.hh index e919f29a816..8a0bf1d0eab 100644 --- a/broker/http_tsdb/precomp_inc/precomp.hh +++ b/broker/http_tsdb/precomp_inc/precomp.hh @@ -45,7 +45,6 @@ #include #include -#include "com/centreon/broker/namespace.hh" // with this define boost::interprocess doesn't need Boost.DataTime #define BOOST_DATE_TIME_NO_LIB 1 #include diff --git a/broker/http_tsdb/src/column.cc b/broker/http_tsdb/src/column.cc index 1db219112d0..62331cb8749 100644 --- a/broker/http_tsdb/src/column.cc +++ b/broker/http_tsdb/src/column.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/http_tsdb/column.hh" diff --git a/broker/http_tsdb/src/factory.cc b/broker/http_tsdb/src/factory.cc index 6e377556e51..8a790ae5249 100644 --- a/broker/http_tsdb/src/factory.cc +++ b/broker/http_tsdb/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/http_tsdb/factory.hh" diff --git a/broker/http_tsdb/src/line_protocol_query.cc b/broker/http_tsdb/src/line_protocol_query.cc index ec0362cd3a5..f4617b299e4 100644 --- a/broker/http_tsdb/src/line_protocol_query.cc +++ b/broker/http_tsdb/src/line_protocol_query.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/http_tsdb/line_protocol_query.hh" diff --git a/broker/http_tsdb/src/stream.cc b/broker/http_tsdb/src/stream.cc index 73d7a08dcfb..5deb405ec6f 100644 --- a/broker/http_tsdb/src/stream.cc +++ b/broker/http_tsdb/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/http_tsdb/stream.hh" diff --git a/broker/http_tsdb/test/factory_test.cc b/broker/http_tsdb/test/factory_test.cc index 3ed57223874..3dc57db1818 100644 --- a/broker/http_tsdb/test/factory_test.cc +++ b/broker/http_tsdb/test/factory_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/http_tsdb/test/stream_test.cc b/broker/http_tsdb/test/stream_test.cc index 60efdf10b13..d8c22a78565 100644 --- a/broker/http_tsdb/test/stream_test.cc +++ b/broker/http_tsdb/test/stream_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,6 @@ using system_clock = std::chrono::system_clock; using time_point = system_clock::time_point; using duration = system_clock::duration; -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/file/disk_accessor.hh" #include "com/centreon/broker/http_tsdb/stream.hh" diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/column.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/column.hh index 0a78e155eb1..a9d2c665785 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/column.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/column.hh @@ -19,9 +19,8 @@ #ifndef CCB_INFLUXDB_COLUMN_HH #define CCB_INFLUXDB_COLUMN_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace influxdb { /** @@ -54,6 +53,6 @@ class column { }; } // namespace influxdb -CCB_END() +} #endif // !CCB_INFLUXDB_COLUMN_HH diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/connector.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/connector.hh index 10200b3b490..5d5be8e7296 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/connector.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/connector.hh @@ -21,10 +21,9 @@ #include "com/centreon/broker/influxdb/column.hh" #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace influxdb { /** @@ -65,6 +64,6 @@ class connector : public io::endpoint { }; } // namespace influxdb -CCB_END() +} #endif // !CCB_INFLUXDB_CONNECTOR_HH diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/factory.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/factory.hh index 7f2c6cc0650..3c79cddf489 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/factory.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/factory.hh @@ -20,9 +20,8 @@ #define CCB_INFLUXDB_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace influxdb { /** @@ -45,6 +44,6 @@ class factory : public io::factory { }; } // namespace influxdb -CCB_END() +} #endif // !CCB_INFLUXDB_FACTORY_HH diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/influxdb.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/influxdb.hh index f42db9a7aa5..1da1bf9b987 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/influxdb.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/influxdb.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2015-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015-2017 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_INFLUXDB_INFLUXDB_HH #define CCB_INFLUXDB_INFLUXDB_HH @@ -24,11 +24,8 @@ #include "com/centreon/broker/influxdb/influxdb.hh" #include "com/centreon/broker/influxdb/line_protocol_query.hh" #include "com/centreon/broker/influxdb/macro_cache.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() - -namespace influxdb { +namespace com::centreon::broker::influxdb { /** * @class influxdb influxdb.hh "com/centreon/broker/influxdb/influxdb.hh" * @brief Influxdb connection/query manager. @@ -38,15 +35,10 @@ namespace influxdb { */ class influxdb { public: - influxdb(std::string const& user, - std::string const& passwd, - std::string const& addr, - uint16_t port, - std::string const& db, - std::string const& status_ts, - std::vector const& status_cols, - std::string const& metric_ts, - std::vector const& metric_cols, + influxdb(std::string const& user, std::string const& passwd, + std::string const& addr, uint16_t port, std::string const& db, + std::string const& status_ts, std::vector const& status_cols, + std::string const& metric_ts, std::vector const& metric_cols, macro_cache const& cache); ~influxdb(); @@ -75,19 +67,14 @@ class influxdb { macro_cache const& _cache; void _connect_socket(); - bool _check_answer_string(std::string const& ans, - const std::string& addr, + bool _check_answer_string(std::string const& ans, const std::string& addr, uint16_t port); - void _create_queries(std::string const& user, - std::string const& passwd, - std::string const& db, - std::string const& status_ts, + void _create_queries(std::string const& user, std::string const& passwd, + std::string const& db, std::string const& status_ts, std::vector const& status_cols, std::string const& metric_ts, std::vector const& metric_cols); }; -} // namespace influxdb - -CCB_END() +} // namespace com::centreon::broker::influxdb #endif // !CCB_INFLUXDB_INFLUXDB12_HH diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/internal.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/internal.hh index 11d40c1af22..0cd8949aed8 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/internal.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/internal.hh @@ -22,9 +22,8 @@ #include "bbdo/events.hh" #include "bbdo/storage.pb.h" #include "com/centreon/broker/io/protobuf.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { // Data elements. @@ -41,6 +40,6 @@ using pb_status = } // namespace storage -CCB_END() +} #endif // !CCB_INFLUXDB_INTERNAL_HH diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/line_protocol_query.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/line_protocol_query.hh index 2680d81f855..b1d21789aa6 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/line_protocol_query.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/line_protocol_query.hh @@ -23,9 +23,8 @@ #include "bbdo/storage/status.hh" #include "com/centreon/broker/influxdb/column.hh" #include "com/centreon/broker/influxdb/macro_cache.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace influxdb { /** @@ -97,6 +96,6 @@ class line_protocol_query { }; } // namespace influxdb -CCB_END() +} #endif // !CCB_INFLUXDB_LINE_PROTOCOL_QUERY_HH diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/macro_cache.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/macro_cache.hh index 4c12938d839..4329ea29b64 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/macro_cache.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/macro_cache.hh @@ -22,12 +22,11 @@ #include #include "com/centreon/broker/influxdb/internal.hh" #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/host.hh" #include "com/centreon/broker/neb/instance.hh" #include "com/centreon/broker/neb/service.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace influxdb { /** @@ -74,6 +73,6 @@ class macro_cache { }; } // namespace influxdb -CCB_END() +} #endif // !CCB_INFLUXDB_MACRO_CACHE_HH diff --git a/broker/influxdb/inc/com/centreon/broker/influxdb/stream.hh b/broker/influxdb/inc/com/centreon/broker/influxdb/stream.hh index 8ade2144076..dbe00f55404 100644 --- a/broker/influxdb/inc/com/centreon/broker/influxdb/stream.hh +++ b/broker/influxdb/inc/com/centreon/broker/influxdb/stream.hh @@ -23,10 +23,9 @@ #include "com/centreon/broker/influxdb/influxdb.hh" #include "com/centreon/broker/influxdb/macro_cache.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. class database_config; @@ -80,6 +79,6 @@ class stream : public io::stream { }; } // namespace influxdb -CCB_END() +} #endif // !CCB_INFLUXDB_STREAM_HH diff --git a/broker/influxdb/src/column.cc b/broker/influxdb/src/column.cc index 8d8539c6c93..8a1a0b7ca0c 100644 --- a/broker/influxdb/src/column.cc +++ b/broker/influxdb/src/column.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/influxdb/column.hh" diff --git a/broker/influxdb/src/connector.cc b/broker/influxdb/src/connector.cc index 319acbf1e3a..46266612f25 100644 --- a/broker/influxdb/src/connector.cc +++ b/broker/influxdb/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/influxdb/connector.hh" diff --git a/broker/influxdb/src/factory.cc b/broker/influxdb/src/factory.cc index 0c22510f96b..4dc0f2ec576 100644 --- a/broker/influxdb/src/factory.cc +++ b/broker/influxdb/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/influxdb/factory.hh" diff --git a/broker/influxdb/src/influxdb.cc b/broker/influxdb/src/influxdb.cc index 6b2df62ed75..63d0de59cdb 100644 --- a/broker/influxdb/src/influxdb.cc +++ b/broker/influxdb/src/influxdb.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/influxdb/influxdb.hh" diff --git a/broker/influxdb/src/line_protocol_query.cc b/broker/influxdb/src/line_protocol_query.cc index 9da2b41c2d8..ff1c61910fa 100644 --- a/broker/influxdb/src/line_protocol_query.cc +++ b/broker/influxdb/src/line_protocol_query.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/influxdb/line_protocol_query.hh" diff --git a/broker/influxdb/src/macro_cache.cc b/broker/influxdb/src/macro_cache.cc index 2b85c8d5aa0..e3a2e1bb17d 100644 --- a/broker/influxdb/src/macro_cache.cc +++ b/broker/influxdb/src/macro_cache.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2015, 2019-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2015, 2019-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/influxdb/macro_cache.hh" diff --git a/broker/influxdb/src/main.cc b/broker/influxdb/src/main.cc index e74ff32eec3..bc962f8ec44 100644 --- a/broker/influxdb/src/main.cc +++ b/broker/influxdb/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2020-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2020-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/storage/index_mapping.hh" diff --git a/broker/influxdb/src/stream.cc b/broker/influxdb/src/stream.cc index b19ae3f6465..e06c28e2b05 100644 --- a/broker/influxdb/src/stream.cc +++ b/broker/influxdb/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/influxdb/stream.hh" diff --git a/broker/influxdb/test/column.cc b/broker/influxdb/test/column.cc index bec0bc3b460..460bd6de615 100644 --- a/broker/influxdb/test/column.cc +++ b/broker/influxdb/test/column.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/influxdb/test/factory.cc b/broker/influxdb/test/factory.cc index f3ce4defbff..010855d32ca 100644 --- a/broker/influxdb/test/factory.cc +++ b/broker/influxdb/test/factory.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/influxdb/test/influxdb.cc b/broker/influxdb/test/influxdb.cc index 82d9a1e25ca..dd2c6e3c90e 100644 --- a/broker/influxdb/test/influxdb.cc +++ b/broker/influxdb/test/influxdb.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/influxdb/test/line_protocol_query.cc b/broker/influxdb/test/line_protocol_query.cc index b3781910713..b616b535bba 100644 --- a/broker/influxdb/test/line_protocol_query.cc +++ b/broker/influxdb/test/line_protocol_query.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/influxdb/test/stream.cc b/broker/influxdb/test/stream.cc index 768348b04f5..9a9b16e6188 100644 --- a/broker/influxdb/test/stream.cc +++ b/broker/influxdb/test/stream.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/lua/inc/com/centreon/broker/lua/broker_cache.hh b/broker/lua/inc/com/centreon/broker/lua/broker_cache.hh index 144358c1b88..96536e43c1b 100644 --- a/broker/lua/inc/com/centreon/broker/lua/broker_cache.hh +++ b/broker/lua/inc/com/centreon/broker/lua/broker_cache.hh @@ -20,7 +20,6 @@ #define CCB_LUA_BROKER_CACHE_HH #include "com/centreon/broker/lua/macro_cache.hh" -#include "com/centreon/broker/namespace.hh" extern "C" { #include "lauxlib.h" @@ -28,7 +27,7 @@ extern "C" { #include "lualib.h" } -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -46,6 +45,6 @@ class broker_cache { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_BROKER_CACHE_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/broker_event.hh b/broker/lua/inc/com/centreon/broker/lua/broker_event.hh index d6a32775902..7c5b0d07bac 100644 --- a/broker/lua/inc/com/centreon/broker/lua/broker_event.hh +++ b/broker/lua/inc/com/centreon/broker/lua/broker_event.hh @@ -20,7 +20,6 @@ #define CCB_LUA_BROKER_EVENT_HH #include "com/centreon/broker/io/events.hh" -#include "com/centreon/broker/namespace.hh" extern "C" { #include "lauxlib.h" @@ -28,7 +27,7 @@ extern "C" { #include "lualib.h" } -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -56,6 +55,6 @@ class broker_event { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_BROKER_EVENT_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/broker_log.hh b/broker/lua/inc/com/centreon/broker/lua/broker_log.hh index 9e16779c0b2..43dec8e20c0 100644 --- a/broker/lua/inc/com/centreon/broker/lua/broker_log.hh +++ b/broker/lua/inc/com/centreon/broker/lua/broker_log.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/lua/luabinding.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -47,6 +47,6 @@ class broker_log { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_BROKER_LOG_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/broker_socket.hh b/broker/lua/inc/com/centreon/broker/lua/broker_socket.hh index 3406143c522..118bfd10a4b 100644 --- a/broker/lua/inc/com/centreon/broker/lua/broker_socket.hh +++ b/broker/lua/inc/com/centreon/broker/lua/broker_socket.hh @@ -19,7 +19,6 @@ #ifndef CCB_LUA_BROKER_SOCKET_HH #define CCB_LUA_BROKER_SOCKET_HH -#include "com/centreon/broker/namespace.hh" extern "C" { #include "lauxlib.h" @@ -27,7 +26,7 @@ extern "C" { #include "lualib.h" } -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -43,6 +42,6 @@ class broker_socket { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_BROKER_SOCKET_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/broker_utils.hh b/broker/lua/inc/com/centreon/broker/lua/broker_utils.hh index c5017a81c6f..959bb7b5002 100644 --- a/broker/lua/inc/com/centreon/broker/lua/broker_utils.hh +++ b/broker/lua/inc/com/centreon/broker/lua/broker_utils.hh @@ -19,7 +19,6 @@ #ifndef CCB_LUA_BROKER_UTILS_HH #define CCB_LUA_BROKER_UTILS_HH -#include "com/centreon/broker/namespace.hh" extern "C" { #include "lauxlib.h" @@ -27,7 +26,7 @@ extern "C" { #include "lualib.h" } -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -43,6 +42,6 @@ class broker_utils { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_BROKER_UTILS_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/connector.hh b/broker/lua/inc/com/centreon/broker/lua/connector.hh index 9c699d89614..ff7f273a3f4 100644 --- a/broker/lua/inc/com/centreon/broker/lua/connector.hh +++ b/broker/lua/inc/com/centreon/broker/lua/connector.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/endpoint.hh" #include "com/centreon/broker/misc/variant.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -49,6 +49,6 @@ class connector : public io::endpoint { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_CONNECTOR_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/factory.hh b/broker/lua/inc/com/centreon/broker/lua/factory.hh index 47e3a3a598b..2d7a8359c6c 100644 --- a/broker/lua/inc/com/centreon/broker/lua/factory.hh +++ b/broker/lua/inc/com/centreon/broker/lua/factory.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/io/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -45,6 +45,6 @@ class factory : public io::factory { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_FACTORY_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/internal.hh b/broker/lua/inc/com/centreon/broker/lua/internal.hh index d33a061ea82..888d06b6424 100644 --- a/broker/lua/inc/com/centreon/broker/lua/internal.hh +++ b/broker/lua/inc/com/centreon/broker/lua/internal.hh @@ -23,7 +23,7 @@ #include "bbdo/storage.pb.h" #include "com/centreon/broker/io/protobuf.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { using pb_index_mapping = @@ -33,6 +33,6 @@ using pb_metric_mapping = io::protobuf; } // namespace storage -CCB_END() +} #endif // !CCB_LUA_INTERNAL_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/luabinding.hh b/broker/lua/inc/com/centreon/broker/lua/luabinding.hh index 7b0271a4a8a..9f3e7ba0aeb 100644 --- a/broker/lua/inc/com/centreon/broker/lua/luabinding.hh +++ b/broker/lua/inc/com/centreon/broker/lua/luabinding.hh @@ -28,7 +28,7 @@ extern "C" { #include "lualib.h" } -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -125,6 +125,6 @@ void push_event_as_table(lua_State* L, io::data const& d); } // namespace lua -CCB_END() +} #endif // !CCB_LUA_LUA_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/macro_cache.hh b/broker/lua/inc/com/centreon/broker/lua/macro_cache.hh index e22a6d6c3ad..77845c33424 100644 --- a/broker/lua/inc/com/centreon/broker/lua/macro_cache.hh +++ b/broker/lua/inc/com/centreon/broker/lua/macro_cache.hh @@ -32,7 +32,7 @@ #include "com/centreon/broker/neb/service_group_member.hh" #include "com/centreon/broker/persistent_cache.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { /** @@ -43,18 +43,16 @@ class macro_cache { std::shared_ptr _cache; absl::flat_hash_map> _instances; absl::flat_hash_map> _hosts; - absl::flat_hash_map> _host_groups; - absl::btree_map, - std::shared_ptr> + absl::flat_hash_map> _host_groups; + absl::btree_map, std::shared_ptr> _host_group_members; absl::flat_hash_map, std::shared_ptr> _custom_vars; absl::flat_hash_map, std::shared_ptr> _services; - absl::flat_hash_map> - _service_groups; + absl::flat_hash_map> _service_groups; absl::btree_map, - std::shared_ptr> + std::shared_ptr> _service_group_members; absl::flat_hash_map> _index_mappings; @@ -87,17 +85,17 @@ class macro_cache { const std::string& get_action_url(uint64_t host_id, uint64_t service_id) const; int32_t get_severity(uint64_t host_id, uint64_t service_id) const; - absl::string_view get_check_command(uint64_t host_id, - uint64_t service_id = 0) const; + std::string_view get_check_command(uint64_t host_id, + uint64_t service_id = 0) const; const std::string& get_host_group_name(uint64_t id) const; absl::btree_map, - std::shared_ptr> const& + std::shared_ptr> const& get_host_group_members() const; const std::string& get_service_description(uint64_t host_id, uint64_t service_id) const; const std::string& get_service_group_name(uint64_t id) const; absl::btree_map, - std::shared_ptr> const& + std::shared_ptr> const& get_service_group_members() const; const std::string& get_instance(uint64_t instance_id) const; @@ -120,14 +118,18 @@ class macro_cache { void _process_pb_host(std::shared_ptr const& data); void _process_pb_adaptive_host(std::shared_ptr const& data); void _process_host_group(std::shared_ptr const& data); + void _process_pb_host_group(std::shared_ptr const& data); void _process_host_group_member(std::shared_ptr const& data); + void _process_pb_host_group_member(std::shared_ptr const& data); void _process_custom_variable(std::shared_ptr const& data); void _process_pb_custom_variable(std::shared_ptr const& data); void _process_service(std::shared_ptr const& data); void _process_pb_service(std::shared_ptr const& data); void _process_pb_adaptive_service(std::shared_ptr const& data); void _process_service_group(std::shared_ptr const& data); + void _process_pb_service_group(std::shared_ptr const& data); void _process_service_group_member(std::shared_ptr const& data); + void _process_pb_service_group_member(std::shared_ptr const& data); void _process_index_mapping(std::shared_ptr const& data); void _process_metric_mapping(std::shared_ptr const& data); void _process_dimension_ba_event(std::shared_ptr const& data); @@ -143,6 +145,6 @@ class macro_cache { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_MACRO_CACHE_HH diff --git a/broker/lua/inc/com/centreon/broker/lua/stream.hh b/broker/lua/inc/com/centreon/broker/lua/stream.hh index 3e0eaf3c914..86705e29567 100644 --- a/broker/lua/inc/com/centreon/broker/lua/stream.hh +++ b/broker/lua/inc/com/centreon/broker/lua/stream.hh @@ -25,7 +25,7 @@ #include "com/centreon/broker/lua/macro_cache.hh" #include "com/centreon/broker/misc/variant.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace lua { @@ -71,6 +71,6 @@ class stream : public io::stream { }; } // namespace lua -CCB_END() +} #endif // !CCB_LUA_STREAM_HH diff --git a/broker/lua/src/broker_cache.cc b/broker/lua/src/broker_cache.cc index 2284054b254..1c5b708d67e 100644 --- a/broker/lua/src/broker_cache.cc +++ b/broker/lua/src/broker_cache.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/broker_cache.hh" @@ -453,12 +453,27 @@ static int l_broker_cache_get_servicegroups(lua_State* L) { int i{1}; for (auto it(first), end(second); it != end; ++it) { lua_createtable(L, 0, 2); - lua_pushinteger(L, it->second->group_id); - lua_setfield(L, -2, "group_id"); + if (it->second->type() == neb::service_group_member::static_type()) { + const neb::service_group_member& sgm = + *std::static_pointer_cast(it->second); + + lua_pushinteger(L, sgm.group_id); + lua_setfield(L, -2, "group_id"); + + lua_pushstring(L, sgm.group_name.c_str()); + lua_setfield(L, -2, "group_name"); - lua_pushstring(L, it->second->group_name.c_str()); - lua_setfield(L, -2, "group_name"); + } else { + const ServiceGroupMember& sgm = + std::static_pointer_cast(it->second) + ->obj(); + lua_pushinteger(L, sgm.servicegroup_id()); + lua_setfield(L, -2, "group_id"); + + lua_pushstring(L, sgm.name().c_str()); + lua_setfield(L, -2, "group_name"); + } lua_rawseti(L, -2, i); ++i; } @@ -489,12 +504,25 @@ static int l_broker_cache_get_hostgroups(lua_State* L) { int i = 1; for (auto it(first); it != second; ++it) { lua_createtable(L, 0, 2); - lua_pushinteger(L, it->second->group_id); - lua_setfield(L, -2, "group_id"); - - lua_pushstring(L, it->second->group_name.c_str()); - lua_setfield(L, -2, "group_name"); - + std::shared_ptr evt = it->second; + if (it->second->type() == neb::host_group_member::static_type()) { + const neb::host_group_member& hgm = + *std::static_pointer_cast(it->second); + lua_pushinteger(L, hgm.group_id); + lua_setfield(L, -2, "group_id"); + + lua_pushstring(L, hgm.group_name.c_str()); + lua_setfield(L, -2, "group_name"); + } else { + const HostGroupMember& hgm = + std::static_pointer_cast(it->second) + ->obj(); + lua_pushinteger(L, hgm.hostgroup_id()); + lua_setfield(L, -2, "group_id"); + + lua_pushstring(L, hgm.name().c_str()); + lua_setfield(L, -2, "group_name"); + } lua_rawseti(L, -2, i); ++i; } @@ -625,7 +653,7 @@ static int32_t l_broker_cache_get_check_command(lua_State* L) { service_id = luaL_checkinteger(L, 3); try { - absl::string_view check_command = + std::string_view check_command = cache->get_check_command(host_id, service_id); lua_pushlstring(L, check_command.data(), check_command.size()); } catch (std::exception const& e) { diff --git a/broker/lua/src/broker_event.cc b/broker/lua/src/broker_event.cc index 378bcbfecf5..2c5644fde0c 100644 --- a/broker/lua/src/broker_event.cc +++ b/broker/lua/src/broker_event.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/broker_event.hh" diff --git a/broker/lua/src/broker_log.cc b/broker/lua/src/broker_log.cc index ac20ac1c9f9..7e92ea53b8d 100644 --- a/broker/lua/src/broker_log.cc +++ b/broker/lua/src/broker_log.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/broker_log.hh" diff --git a/broker/lua/src/broker_socket.cc b/broker/lua/src/broker_socket.cc index 52ef736a1ec..954d7865bce 100644 --- a/broker/lua/src/broker_socket.cc +++ b/broker/lua/src/broker_socket.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/broker_socket.hh" diff --git a/broker/lua/src/broker_utils.cc b/broker/lua/src/broker_utils.cc index 9f48eca87b5..c1cbcd4417f 100644 --- a/broker/lua/src/broker_utils.cc +++ b/broker/lua/src/broker_utils.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/broker_utils.hh" @@ -629,10 +629,10 @@ static int l_broker_parse_perfdata(lua_State* L) { for (auto const& pd : pds) { lua_pushlstring(L, pd.name().c_str(), pd.name().size()); if (full) { - absl::string_view name{pd.name()}; - absl::string_view metric; - absl::string_view fullinstance; - std::list subinstance; + std::string_view name{pd.name()}; + std::string_view metric; + std::string_view fullinstance; + std::list subinstance; lua_createtable(L, 0, 15); int find_sharp = name.find("#"); int find_tilde = name.find("~"); @@ -643,7 +643,7 @@ static int l_broker_parse_perfdata(lua_State* L) { fullinstance = name.substr(0, find_sharp); subinstance = absl::StrSplit(fullinstance, '~'); } - std::list metric_fields{absl::StrSplit(metric, '.')}; + std::list metric_fields{absl::StrSplit(metric, '.')}; lua_pushnumber(L, pd.value()); lua_setfield(L, -2, "value"); @@ -677,7 +677,7 @@ static int l_broker_parse_perfdata(lua_State* L) { lua_pushlstring(L, "subinstance", sizeof("subinstance") - 1); lua_createtable(L, 0, 1); i = 0; - for (std::list::const_iterator + for (std::list::const_iterator it(std::next(subinstance.begin())), end(subinstance.end()); it != end; ++it) { diff --git a/broker/lua/src/connector.cc b/broker/lua/src/connector.cc index e2e071f998c..c148a111302 100644 --- a/broker/lua/src/connector.cc +++ b/broker/lua/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017-2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017-2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/connector.hh" diff --git a/broker/lua/src/factory.cc b/broker/lua/src/factory.cc index 1ef0a64c03d..d2de4d39553 100644 --- a/broker/lua/src/factory.cc +++ b/broker/lua/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/factory.hh" diff --git a/broker/lua/src/luabinding.cc b/broker/lua/src/luabinding.cc index 4f69cdbb9fe..6fc6250830d 100644 --- a/broker/lua/src/luabinding.cc +++ b/broker/lua/src/luabinding.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/lua/src/macro_cache.cc b/broker/lua/src/macro_cache.cc index 39300d0c08c..5118a996b89 100644 --- a/broker/lua/src/macro_cache.cc +++ b/broker/lua/src/macro_cache.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2017-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2017-2022 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/lua/macro_cache.hh" #include "bbdo/bam/dimension_ba_bv_relation_event.hh" @@ -196,10 +196,10 @@ int32_t macro_cache::get_severity(uint64_t host_id, uint64_t service_id) const { * * @return A string view pointing to the check command. */ -absl::string_view macro_cache::get_check_command(uint64_t host_id, - uint64_t service_id) const { +std::string_view macro_cache::get_check_command(uint64_t host_id, + uint64_t service_id) const { /* Case of services */ - absl::string_view retval; + std::string_view retval; if (service_id) { auto found = _services.find({host_id, service_id}); if (found == _services.end()) @@ -355,8 +355,7 @@ std::string const& macro_cache::get_notes(uint64_t host_id, * * @return A std::map */ -const absl::btree_map, - std::shared_ptr>& +const absl::btree_map, std::shared_ptr>& macro_cache::get_host_group_members() const { return _host_group_members; } @@ -373,7 +372,12 @@ std::string const& macro_cache::get_host_group_name(uint64_t id) const { if (found == _host_groups.end()) throw msg_fmt("lua: could not find information on host group {}", id); - return found->second->name; + if (found->second->type() == neb::host_group::static_type()) + return std::static_pointer_cast(found->second)->name; + else + return std::static_pointer_cast(found->second) + ->obj() + .name(); } /** @@ -409,7 +413,7 @@ std::string const& macro_cache::get_service_description( * @return A map indexed by host_id/service_id/group_id. */ absl::btree_map, - std::shared_ptr> const& + std::shared_ptr> const& macro_cache::get_service_group_members() const { return _service_group_members; } @@ -426,7 +430,12 @@ std::string const& macro_cache::get_service_group_name(uint64_t id) const { if (found == _service_groups.end()) throw msg_fmt("lua: could not find information on service group {}", id); - return found->second->name; + if (found->second->type() == neb::service_group::static_type()) + return std::static_pointer_cast(found->second)->name; + else + return std::static_pointer_cast(found->second) + ->obj() + .name(); } /** @@ -521,9 +530,15 @@ void macro_cache::write(std::shared_ptr const& data) { case neb::host_group::static_type(): _process_host_group(data); break; + case neb::pb_host_group::static_type(): + _process_pb_host_group(data); + break; case neb::host_group_member::static_type(): _process_host_group_member(data); break; + case neb::pb_host_group_member::static_type(): + _process_pb_host_group_member(data); + break; case neb::service::static_type(): _process_service(data); break; @@ -536,9 +551,15 @@ void macro_cache::write(std::shared_ptr const& data) { case neb::service_group::static_type(): _process_service_group(data); break; + case neb::pb_service_group::static_type(): + _process_pb_service_group(data); + break; case neb::service_group_member::static_type(): _process_service_group_member(data); break; + case neb::pb_service_group_member::static_type(): + _process_pb_service_group_member(data); + break; case neb::custom_variable::static_type(): _process_custom_variable(data); break; @@ -727,10 +748,29 @@ void macro_cache::_process_pb_adaptive_host( void macro_cache::_process_host_group(std::shared_ptr const& data) { std::shared_ptr const& hg = std::static_pointer_cast(data); - SPDLOG_LOGGER_DEBUG(log_v2::lua(), "lua: processing host group '{}' of id {}", - hg->name, hg->id); + SPDLOG_LOGGER_DEBUG(log_v2::lua(), + "lua: processing host group '{}' of id {} enabled: {}", + hg->name, hg->id, hg->enabled); if (hg->enabled) - _host_groups[hg->id] = hg; + _host_groups[hg->id] = data; + //erasure is desactivated because a group cen be owned by several pollers +} + +/** + * Process a host group event. + * + * @param data The event. + */ +void macro_cache::_process_pb_host_group( + std::shared_ptr const& data) { + const HostGroup& hg = + std::static_pointer_cast(data)->obj(); + SPDLOG_LOGGER_DEBUG(log_v2::lua(), + "lua: processing pb host group '{}' of id {}, enabled {}", + hg.name(), hg.hostgroup_id(), hg.enabled()); + if (hg.enabled()) + _host_groups[hg.hostgroup_id()] = data; + //erasure is desactivated because a group cen be owned by several pollers } /** @@ -745,14 +785,34 @@ void macro_cache::_process_host_group_member( SPDLOG_LOGGER_DEBUG( log_v2::lua(), "lua: processing host group member (group_name: '{}', group_id: {}, " - "host_id: {})", - hgm->group_name, hgm->group_id, hgm->host_id); + "host_id: {}, enabled: {})", + hgm->group_name, hgm->group_id, hgm->host_id, hgm->enabled); if (hgm->enabled) - _host_group_members[{hgm->host_id, hgm->group_id}] = hgm; + _host_group_members[{hgm->host_id, hgm->group_id}] = data; else _host_group_members.erase({hgm->host_id, hgm->group_id}); } +/** + * Process a host group member event. + * + * @param data The event. + */ +void macro_cache::_process_pb_host_group_member( + std::shared_ptr const& data) { + const HostGroupMember& hgm = + std::static_pointer_cast(data)->obj(); + SPDLOG_LOGGER_DEBUG( + log_v2::lua(), + "lua: processing pb host group member (group_name: '{}', group_id: {}, " + "host_id: {}, enabled: {})", + hgm.name(), hgm.hostgroup_id(), hgm.host_id(), hgm.enabled()); + if (hgm.enabled()) + _host_group_members[{hgm.host_id(), hgm.hostgroup_id()}] = data; + else + _host_group_members.erase({hgm.host_id(), hgm.hostgroup_id()}); +} + /** * Process a service event. * @@ -886,7 +946,25 @@ void macro_cache::_process_service_group( "lua: processing service group '{}' of id {}", sg->name, sg->id); if (sg->enabled) - _service_groups[sg->id] = sg; + _service_groups[sg->id] = data; + //erasure is desactivated because a group cen be owned by several pollers +} + +/** + * Process a service group event. + * + * @param sg The event. + */ +void macro_cache::_process_pb_service_group( + std::shared_ptr const& data) { + const ServiceGroup& sg = + std::static_pointer_cast(data)->obj(); + SPDLOG_LOGGER_DEBUG(log_v2::lua(), + "lua: processing pb service group '{}' of id {}", + sg.name(), sg.servicegroup_id()); + if (sg.enabled()) + _service_groups[sg.servicegroup_id()] = data; + //erasure is desactivated because a group cen be owned by several pollers } /** @@ -900,8 +978,9 @@ void macro_cache::_process_service_group_member( SPDLOG_LOGGER_DEBUG( log_v2::lua(), "lua: processing service group member (group_name: {}, group_id: {}, " - "host_id: {}, service_id: {}", - sgm->group_name, sgm->group_id, sgm->host_id, sgm->service_id); + "host_id: {}, service_id: {}, enabled: {}", + sgm->group_name, sgm->group_id, sgm->host_id, sgm->service_id, + sgm->enabled); if (sgm->enabled) _service_group_members[std::make_tuple(sgm->host_id, sgm->service_id, sgm->group_id)] = sgm; @@ -910,6 +989,29 @@ void macro_cache::_process_service_group_member( std::make_tuple(sgm->host_id, sgm->service_id, sgm->group_id)); } +/** + * Process a service group member event. + * + * @param data The event. + */ +void macro_cache::_process_pb_service_group_member( + std::shared_ptr const& data) { + const ServiceGroupMember& sgm = + std::static_pointer_cast(data)->obj(); + SPDLOG_LOGGER_DEBUG( + log_v2::lua(), + "lua: processing pb service group member (group_name: {}, group_id: {}, " + "host_id: {}, service_id: {} enabled: {}", + sgm.name(), sgm.servicegroup_id(), sgm.host_id(), sgm.service_id(), + sgm.enabled()); + if (sgm.enabled()) + _service_group_members[std::make_tuple(sgm.host_id(), sgm.service_id(), + sgm.servicegroup_id())] = data; + else + _service_group_members.erase(std::make_tuple( + sgm.host_id(), sgm.service_id(), sgm.servicegroup_id())); +} + /** * Process an index mapping event. * diff --git a/broker/lua/src/main.cc b/broker/lua/src/main.cc index e9646dc05c5..00216e8718d 100644 --- a/broker/lua/src/main.cc +++ b/broker/lua/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/bam/dimension_ba_bv_relation_event.hh" diff --git a/broker/lua/src/stream.cc b/broker/lua/src/stream.cc index eeb7052d3ae..18113f90f65 100644 --- a/broker/lua/src/stream.cc +++ b/broker/lua/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/lua/stream.hh" diff --git a/broker/lua/test/lua.cc b/broker/lua/test/lua.cc index 06a1266eeb9..3153f45e2b5 100644 --- a/broker/lua/test/lua.cc +++ b/broker/lua/test/lua.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include @@ -206,7 +206,7 @@ TEST_F(LuaTest, SimpleScript) { bnd->write(svc); std::string result(ReadFile("/tmp/test.log")); - std::list lst{absl::StrSplit(result, '\n')}; + std::list lst{absl::StrSplit(result, '\n')}; // 85 lines and one empty line. ASSERT_EQ(lst.size(), 86u); size_t pos1 = result.find("INFO: init: address => 127.0.0.1"); @@ -247,7 +247,7 @@ TEST_F(LuaTest, WriteAcknowledgement) { std::string result{ReadFile("/tmp/test.log")}; { - std::list lst{absl::StrSplit(result, '\n')}; + std::list lst{absl::StrSplit(result, '\n')}; // 20 = 19 lines + 1 empty line std::cout << result << std::endl; ASSERT_EQ(lst.size(), 20u); @@ -4285,15 +4285,15 @@ TEST_F(LuaTest, ServiceObjectMatchBetweenBbdoVersions) { binding->write(svc); binding->write(svc1); std::string ret(ReadFile("/tmp/log")); - std::vector lst1 = absl::StrSplit(ret, '\n'); - std::vector lst2 = lst1; - std::list l1, l2; + std::vector lst1 = absl::StrSplit(ret, '\n'); + std::vector lst2 = lst1; + std::list l1, l2; for (auto& s : lst1) { - if (s.find(" * ") != absl::string_view::npos) + if (s.find(" * ") != std::string_view::npos) l1.emplace_back(s.substr(34)); } for (auto& s : lst2) { - if (s.find(" - ") != absl::string_view::npos) + if (s.find(" - ") != std::string_view::npos) l2.emplace_back(s.substr(34)); } @@ -4367,15 +4367,15 @@ TEST_F(LuaTest, HostObjectMatchBetweenBbdoVersions) { binding->write(hst); binding->write(hst1); std::string ret(ReadFile("/tmp/log")); - std::vector lst1 = absl::StrSplit(ret, '\n'); - std::vector lst2 = lst1; - std::list l1, l2; + std::vector lst1 = absl::StrSplit(ret, '\n'); + std::vector lst2 = lst1; + std::list l1, l2; for (auto& s : lst1) { - if (s.find(" * ") != absl::string_view::npos) + if (s.find(" * ") != std::string_view::npos) l1.emplace_back(s.substr(34)); } for (auto& s : lst2) { - if (s.find(" - ") != absl::string_view::npos) + if (s.find(" - ") != std::string_view::npos) l2.emplace_back(s.substr(34)); } @@ -4446,15 +4446,15 @@ TEST_F(LuaTest, ServiceStatusObjectMatchBetweenBbdoVersions) { binding->write(svc); binding->write(svc1); std::string ret(ReadFile("/tmp/log")); - std::vector lst1 = absl::StrSplit(ret, '\n'); - std::vector lst2 = lst1; - std::list l1, l2; + std::vector lst1 = absl::StrSplit(ret, '\n'); + std::vector lst2 = lst1; + std::list l1, l2; for (auto& s : lst1) { - if (s.find(" * ") != absl::string_view::npos) + if (s.find(" * ") != std::string_view::npos) l1.emplace_back(s.substr(34)); } for (auto& s : lst2) { - if (s.find(" - ") != absl::string_view::npos) + if (s.find(" - ") != std::string_view::npos) l2.emplace_back(s.substr(34)); } @@ -4523,15 +4523,15 @@ TEST_F(LuaTest, HostStatusObjectMatchBetweenBbdoVersions) { binding->write(hst); binding->write(hst1); std::string ret(ReadFile("/tmp/log")); - std::vector lst1 = absl::StrSplit(ret, '\n'); - std::vector lst2 = lst1; - std::list l1, l2; + std::vector lst1 = absl::StrSplit(ret, '\n'); + std::vector lst2 = lst1; + std::list l1, l2; for (auto& s : lst1) { - if (s.find(" * ") != absl::string_view::npos) + if (s.find(" * ") != std::string_view::npos) l1.emplace_back(s.substr(34)); } for (auto& s : lst2) { - if (s.find(" - ") != absl::string_view::npos) + if (s.find(" - ") != std::string_view::npos) l2.emplace_back(s.substr(34)); } diff --git a/broker/neb/inc/com/centreon/broker/neb/acknowledgement.hh b/broker/neb/inc/com/centreon/broker/neb/acknowledgement.hh index 69776bdc518..2049c3cdd41 100644 --- a/broker/neb/inc/com/centreon/broker/neb/acknowledgement.hh +++ b/broker/neb/inc/com/centreon/broker/neb/acknowledgement.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -77,6 +76,6 @@ class acknowledgement : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_ACKNOWLEDGEMENT_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/callback.hh b/broker/neb/inc/com/centreon/broker/neb/callback.hh index fc951ab7020..68184bf7fd1 100644 --- a/broker/neb/inc/com/centreon/broker/neb/callback.hh +++ b/broker/neb/inc/com/centreon/broker/neb/callback.hh @@ -19,9 +19,8 @@ #ifndef CCB_NEB_CALLBACK_HH #define CCB_NEB_CALLBACK_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -42,6 +41,6 @@ class callback { }; } // namespace neb -CCB_END() +} #endif /* !CCB_NEB_CALLBACK_HH */ diff --git a/broker/neb/inc/com/centreon/broker/neb/callbacks.hh b/broker/neb/inc/com/centreon/broker/neb/callbacks.hh index 8349bc1d7af..258be375725 100644 --- a/broker/neb/inc/com/centreon/broker/neb/callbacks.hh +++ b/broker/neb/inc/com/centreon/broker/neb/callbacks.hh @@ -19,9 +19,8 @@ #ifndef CCB_NEB_CALLBACKS_HH #define CCB_NEB_CALLBACKS_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { extern unsigned gl_mod_flags; @@ -34,12 +33,15 @@ int callback_pb_comment(int callback_type, void* data); int callback_custom_variable(int callback_type, void* data); int callback_pb_custom_variable(int callback_type, void* data); int callback_dependency(int callback_type, void* data); +int callback_pb_dependency(int callback_type, void* data); int callback_downtime(int callback_type, void* data); int callback_pb_downtime(int callback_type, void* data); int callback_external_command(int callback_type, void* data); int callback_pb_external_command(int callback_type, void* data); int callback_group(int callback_type, void* data); int callback_group_member(int callback_type, void* data); +int callback_pb_group(int callback_type, void* data); +int callback_pb_group_member(int callback_type, void* data); int callback_host(int callback_type, void* data); int callback_host_check(int callback_type, void* data); int callback_pb_host_check(int callback_type, void* data); @@ -68,6 +70,6 @@ int callback_pb_bench(int callback_type, void* data); void unregister_callbacks(); } // namespace neb -CCB_END() +} #endif // !CCB_NEB_CALLBACKS_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/check.hh b/broker/neb/inc/com/centreon/broker/neb/check.hh index df49b7e8db5..435f8eb4456 100644 --- a/broker/neb/inc/com/centreon/broker/neb/check.hh +++ b/broker/neb/inc/com/centreon/broker/neb/check.hh @@ -21,11 +21,10 @@ #include "com/centreon/broker/io/data.hh" #include "com/centreon/broker/io/events.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -57,6 +56,6 @@ class check : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_CHECK_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/comment.hh b/broker/neb/inc/com/centreon/broker/neb/comment.hh index cbaec2bf8cc..e50b7219146 100644 --- a/broker/neb/inc/com/centreon/broker/neb/comment.hh +++ b/broker/neb/inc/com/centreon/broker/neb/comment.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -69,6 +68,6 @@ class comment : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_COMMENT_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/custom_variable.hh b/broker/neb/inc/com/centreon/broker/neb/custom_variable.hh index 68d16fc7680..e71ab2b152b 100644 --- a/broker/neb/inc/com/centreon/broker/neb/custom_variable.hh +++ b/broker/neb/inc/com/centreon/broker/neb/custom_variable.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/custom_variable_status.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -59,6 +58,6 @@ class custom_variable : public custom_variable_status { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_CUSTOM_VARIABLE_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/custom_variable_status.hh b/broker/neb/inc/com/centreon/broker/neb/custom_variable_status.hh index b981ca86f8d..c4dd57843c6 100644 --- a/broker/neb/inc/com/centreon/broker/neb/custom_variable_status.hh +++ b/broker/neb/inc/com/centreon/broker/neb/custom_variable_status.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -63,6 +62,6 @@ class custom_variable_status : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_CUSTOM_VARIABLE_STATUS_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/dependency.hh b/broker/neb/inc/com/centreon/broker/neb/dependency.hh index a571ee66972..75c29c43af8 100644 --- a/broker/neb/inc/com/centreon/broker/neb/dependency.hh +++ b/broker/neb/inc/com/centreon/broker/neb/dependency.hh @@ -20,9 +20,8 @@ #define CCB_NEB_DEPENDENCY_HH #include "com/centreon/broker/io/data.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -55,6 +54,6 @@ class dependency : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_DEPENDENCY_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/downtime.hh b/broker/neb/inc/com/centreon/broker/neb/downtime.hh index 26d5e28003c..64c50828565 100644 --- a/broker/neb/inc/com/centreon/broker/neb/downtime.hh +++ b/broker/neb/inc/com/centreon/broker/neb/downtime.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -86,6 +85,6 @@ class downtime : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_DOWNTIME_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/engcmd/endpoint.hh b/broker/neb/inc/com/centreon/broker/neb/engcmd/endpoint.hh index e9f1c082e82..c778de5022c 100644 --- a/broker/neb/inc/com/centreon/broker/neb/engcmd/endpoint.hh +++ b/broker/neb/inc/com/centreon/broker/neb/engcmd/endpoint.hh @@ -20,9 +20,8 @@ #define CCB_ENGCMD_ENDPOINT_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { namespace engcmd { @@ -47,6 +46,6 @@ class endpoint : public io::endpoint { } // namespace engcmd } // namespace neb -CCB_END() +} #endif // !CCB_ENGCMD_FACTORY_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/engcmd/engine_command.hh b/broker/neb/inc/com/centreon/broker/neb/engcmd/engine_command.hh index f9e9cd9abb2..a4219abe0a4 100644 --- a/broker/neb/inc/com/centreon/broker/neb/engcmd/engine_command.hh +++ b/broker/neb/inc/com/centreon/broker/neb/engcmd/engine_command.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/extcmd/command_result.hh" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { namespace engcmd { @@ -57,6 +56,6 @@ class engine_command : public io::stream { } // namespace engcmd } // namespace neb -CCB_END() +} #endif // !CCB_ENGCMD_ENGINE_COMMAND_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/engcmd/factory.hh b/broker/neb/inc/com/centreon/broker/neb/engcmd/factory.hh index 0b429665b8b..257dba34deb 100644 --- a/broker/neb/inc/com/centreon/broker/neb/engcmd/factory.hh +++ b/broker/neb/inc/com/centreon/broker/neb/engcmd/factory.hh @@ -21,9 +21,8 @@ #include "com/centreon/broker/io/endpoint.hh" #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { namespace engcmd { @@ -48,6 +47,6 @@ class factory : public io::factory { } // namespace engcmd } // namespace neb -CCB_END() +} #endif // !CCB_ENGCMD_FACTORY_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/engcmd/internal.hh b/broker/neb/inc/com/centreon/broker/neb/engcmd/internal.hh index 151de4e977a..000381a1e9c 100644 --- a/broker/neb/inc/com/centreon/broker/neb/engcmd/internal.hh +++ b/broker/neb/inc/com/centreon/broker/neb/engcmd/internal.hh @@ -19,9 +19,8 @@ #ifndef CCB_NEB_ENGCMD_INTERNAL_HH #define CCB_NEB_ENGCMD_INTERNAL_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { namespace engcmd { @@ -32,6 +31,6 @@ void unload(); } // namespace engcmd } // namespace neb -CCB_END() +} #endif // !CCB_NEB_ENGCMD_INTERNAL_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/group.hh b/broker/neb/inc/com/centreon/broker/neb/group.hh index 915326706c1..2b0c05f2d0e 100644 --- a/broker/neb/inc/com/centreon/broker/neb/group.hh +++ b/broker/neb/inc/com/centreon/broker/neb/group.hh @@ -20,9 +20,8 @@ #define CCB_NEB_GROUP_HH #include "com/centreon/broker/io/data.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -53,6 +52,6 @@ class group : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_GROUP_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/group_member.hh b/broker/neb/inc/com/centreon/broker/neb/group_member.hh index 169f3b987d8..f41930b382d 100644 --- a/broker/neb/inc/com/centreon/broker/neb/group_member.hh +++ b/broker/neb/inc/com/centreon/broker/neb/group_member.hh @@ -20,9 +20,8 @@ #define CCB_NEB_GROUP_MEMBER_HH #include "com/centreon/broker/io/data.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -53,6 +52,6 @@ class group_member : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_GROUP_MEMBER_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host.hh b/broker/neb/inc/com/centreon/broker/neb/host.hh index fc16c64eb57..6b328e42a86 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host.hh @@ -22,12 +22,11 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/host_service.hh" #include "com/centreon/broker/neb/host_status.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -73,6 +72,6 @@ class host : public host_service, public host_status { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_check.hh b/broker/neb/inc/com/centreon/broker/neb/host_check.hh index 452172afc98..29cc98f2225 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_check.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_check.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/check.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -51,6 +50,6 @@ class host_check : public check { }; // namespace neb } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_CHECK_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_dependency.hh b/broker/neb/inc/com/centreon/broker/neb/host_dependency.hh index 3b1c9a38484..48ce4f62d82 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_dependency.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_dependency.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/dependency.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -51,6 +50,6 @@ class host_dependency : public dependency { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_DEPENDENCY_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_group.hh b/broker/neb/inc/com/centreon/broker/neb/host_group.hh index 3df05a29c99..f2eb5527299 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_group.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_group.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/group.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -50,6 +49,6 @@ class host_group : public group { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_GROUP_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_group_member.hh b/broker/neb/inc/com/centreon/broker/neb/host_group_member.hh index cdacfdd42dd..4b0df7caaf0 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_group_member.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_group_member.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/group_member.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -54,6 +53,6 @@ class host_group_member : public group_member { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_GROUP_MEMBER_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_parent.hh b/broker/neb/inc/com/centreon/broker/neb/host_parent.hh index 6e740cdb056..6a80aa518a7 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_parent.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_parent.hh @@ -23,10 +23,9 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -54,6 +53,6 @@ class host_parent : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_PARENT_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_service.hh b/broker/neb/inc/com/centreon/broker/neb/host_service.hh index 84206a71eba..bd06967adea 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_service.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_service.hh @@ -19,9 +19,8 @@ #ifndef CCB_NEB_HOST_SERVICE_HH #define CCB_NEB_HOST_SERVICE_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -71,6 +70,6 @@ class host_service { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_SERVICE_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_service_status.hh b/broker/neb/inc/com/centreon/broker/neb/host_service_status.hh index 17a1de2a4ba..5030c5699f9 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_service_status.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_service_status.hh @@ -19,11 +19,10 @@ #ifndef CCB_NEB_HOST_SERVICE_STATUS_HH #define CCB_NEB_HOST_SERVICE_STATUS_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/status.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -87,6 +86,6 @@ class host_service_status : public status { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_SERVICE_STATUS_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/host_status.hh b/broker/neb/inc/com/centreon/broker/neb/host_status.hh index f343c49bcc9..c7f504aefc3 100644 --- a/broker/neb/inc/com/centreon/broker/neb/host_status.hh +++ b/broker/neb/inc/com/centreon/broker/neb/host_status.hh @@ -22,12 +22,11 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/host_service_status.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -59,6 +58,6 @@ class host_status : public host_service_status { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_HOST_STATUS_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/instance.hh b/broker/neb/inc/com/centreon/broker/neb/instance.hh index 7da487fb217..5bd2f4d45b4 100644 --- a/broker/neb/inc/com/centreon/broker/neb/instance.hh +++ b/broker/neb/inc/com/centreon/broker/neb/instance.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -64,6 +63,6 @@ class instance : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_INSTANCE_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/instance_configuration.hh b/broker/neb/inc/com/centreon/broker/neb/instance_configuration.hh index b2e6683456f..8e311835ea2 100644 --- a/broker/neb/inc/com/centreon/broker/neb/instance_configuration.hh +++ b/broker/neb/inc/com/centreon/broker/neb/instance_configuration.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -60,6 +59,6 @@ class instance_configuration : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_INSTANCE_CONFIGURATION_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/instance_status.hh b/broker/neb/inc/com/centreon/broker/neb/instance_status.hh index d38eff6d33a..d5fdb19ed19 100644 --- a/broker/neb/inc/com/centreon/broker/neb/instance_status.hh +++ b/broker/neb/inc/com/centreon/broker/neb/instance_status.hh @@ -22,12 +22,11 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/neb/status.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -71,6 +70,6 @@ class instance_status : public status { }; } // namespace neb -CCB_END() +} #endif // !CCB_EVENTS_INSTANCE_STATUS_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/internal.hh b/broker/neb/inc/com/centreon/broker/neb/internal.hh index 796383a3886..ee28459ce91 100644 --- a/broker/neb/inc/com/centreon/broker/neb/internal.hh +++ b/broker/neb/inc/com/centreon/broker/neb/internal.hh @@ -26,10 +26,9 @@ #include "bbdo/tag.pb.h" #include "com/centreon/broker/io/protobuf.hh" #include "com/centreon/broker/multiplexing/publisher.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/callback.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { // Forward declaration. @@ -78,10 +77,10 @@ using pb_custom_variable_status = make_type(io::neb, neb::de_pb_custom_variable_status)>; using pb_host_check = - io::protobuf; + io::protobuf; using pb_service_check = - io::protobuf; + io::protobuf; using pb_log_entry = io::protobuf; @@ -101,8 +100,30 @@ using pb_acknowledgement = io::protobuf; +using pb_host_dependency = + io::protobuf; + +using pb_service_dependency = + io::protobuf; + +using pb_host_group = + io::protobuf; + +using pb_service_group = + io::protobuf; + +using pb_host_group_member = + io::protobuf; + +using pb_service_group_member = + io::protobuf; + } // namespace neb -CCB_END() +} #endif // !CCB_NEB_INTERNAL_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/log_entry.hh b/broker/neb/inc/com/centreon/broker/neb/log_entry.hh index ff653c14af3..81468d4b231 100644 --- a/broker/neb/inc/com/centreon/broker/neb/log_entry.hh +++ b/broker/neb/inc/com/centreon/broker/neb/log_entry.hh @@ -23,11 +23,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -89,6 +88,6 @@ class log_entry : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_LOG_ENTRY_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/node_events_connector.hh b/broker/neb/inc/com/centreon/broker/neb/node_events_connector.hh index 73778d02139..5ceafe341de 100644 --- a/broker/neb/inc/com/centreon/broker/neb/node_events_connector.hh +++ b/broker/neb/inc/com/centreon/broker/neb/node_events_connector.hh @@ -20,10 +20,9 @@ #define CCB_NEB_NODE_EVENTS_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -51,6 +50,6 @@ class node_events_connector : public io::endpoint { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_NODE_EVENTS_CONNECTOR_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/node_events_factory.hh b/broker/neb/inc/com/centreon/broker/neb/node_events_factory.hh index 9da4e3523f2..810ee16c338 100644 --- a/broker/neb/inc/com/centreon/broker/neb/node_events_factory.hh +++ b/broker/neb/inc/com/centreon/broker/neb/node_events_factory.hh @@ -20,9 +20,8 @@ #define CCB_NEB_NODE_EVENTS_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -47,6 +46,6 @@ class node_events_factory : public io::factory { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_NODE_EVENTS_FACTORY_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/responsive_instance.hh b/broker/neb/inc/com/centreon/broker/neb/responsive_instance.hh index 38afd42ace0..b3ca3c19a73 100644 --- a/broker/neb/inc/com/centreon/broker/neb/responsive_instance.hh +++ b/broker/neb/inc/com/centreon/broker/neb/responsive_instance.hh @@ -24,7 +24,7 @@ #include "com/centreon/broker/mapping/entry.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -56,6 +56,6 @@ class responsive_instance : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_RESPONSIVE_INSTANCE_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/service.hh b/broker/neb/inc/com/centreon/broker/neb/service.hh index 332268090d4..04d988a507b 100644 --- a/broker/neb/inc/com/centreon/broker/neb/service.hh +++ b/broker/neb/inc/com/centreon/broker/neb/service.hh @@ -22,12 +22,11 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/host_service.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/neb/service_status.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -72,6 +71,6 @@ class service : public host_service, public service_status { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_SERVICE_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/service_check.hh b/broker/neb/inc/com/centreon/broker/neb/service_check.hh index aaa854ddd72..97474467007 100644 --- a/broker/neb/inc/com/centreon/broker/neb/service_check.hh +++ b/broker/neb/inc/com/centreon/broker/neb/service_check.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/check.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -54,6 +53,6 @@ class service_check : public check { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_SERVICE_CHECK_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/service_dependency.hh b/broker/neb/inc/com/centreon/broker/neb/service_dependency.hh index ba28629f93d..adf3e7665ae 100644 --- a/broker/neb/inc/com/centreon/broker/neb/service_dependency.hh +++ b/broker/neb/inc/com/centreon/broker/neb/service_dependency.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/dependency.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -57,6 +56,6 @@ class service_dependency : public dependency { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_SERVICE_DEPENDENCY_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/service_group.hh b/broker/neb/inc/com/centreon/broker/neb/service_group.hh index a132330dd42..a626709421f 100644 --- a/broker/neb/inc/com/centreon/broker/neb/service_group.hh +++ b/broker/neb/inc/com/centreon/broker/neb/service_group.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/group.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -51,6 +50,6 @@ class service_group : public group { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_SERVICE_GROUP_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/service_group_member.hh b/broker/neb/inc/com/centreon/broker/neb/service_group_member.hh index 7271f1ea928..ca8be8c2d7a 100644 --- a/broker/neb/inc/com/centreon/broker/neb/service_group_member.hh +++ b/broker/neb/inc/com/centreon/broker/neb/service_group_member.hh @@ -22,11 +22,10 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/group_member.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -57,6 +56,6 @@ class service_group_member : public group_member { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_SERVICE_GROUP_MEMBER_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/service_status.hh b/broker/neb/inc/com/centreon/broker/neb/service_status.hh index 8810f38c291..c486e1b66a3 100644 --- a/broker/neb/inc/com/centreon/broker/neb/service_status.hh +++ b/broker/neb/inc/com/centreon/broker/neb/service_status.hh @@ -22,12 +22,11 @@ #include "com/centreon/broker/io/event_info.hh" #include "com/centreon/broker/io/events.hh" #include "com/centreon/broker/mapping/entry.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/host_service_status.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -63,6 +62,6 @@ class service_status : public host_service_status { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_SERVICE_STATUS_HH diff --git a/broker/neb/inc/com/centreon/broker/neb/status.hh b/broker/neb/inc/com/centreon/broker/neb/status.hh index 1675f56ff43..78d1b6bcddf 100644 --- a/broker/neb/inc/com/centreon/broker/neb/status.hh +++ b/broker/neb/inc/com/centreon/broker/neb/status.hh @@ -20,9 +20,8 @@ #define CCB_NEB_STATUS_HH #include "com/centreon/broker/io/data.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace neb { /** @@ -53,6 +52,6 @@ class status : public io::data { }; } // namespace neb -CCB_END() +} #endif // !CCB_NEB_STATUS_HH diff --git a/broker/neb/inc/com/centreon/clib/version.hh b/broker/neb/inc/com/centreon/clib/version.hh deleted file mode 100644 index 493aaa06b76..00000000000 --- a/broker/neb/inc/com/centreon/clib/version.hh +++ /dev/null @@ -1,50 +0,0 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CC_CLIB_VERSION_HH -#define CC_CLIB_VERSION_HH - -// Compile-time values. -#define CENTREON_CLIB_VERSION_MAJOR 21 -#define CENTREON_CLIB_VERSION_MINOR 04 -#define CENTREON_CLIB_VERSION_PATCH 2 -#define CENTREON_CLIB_VERSION_STRING "21.04.2" - -#include "com/centreon/namespace.hh" - -CC_BEGIN() - -namespace clib { -namespace version { -// Compile-time values. -unsigned int const major = 21; -unsigned int const minor = 04; -unsigned int const patch = 2; -char const* const string = "21.04.2"; - -// Run-time values. -unsigned int get_major() throw(); -unsigned int get_minor() throw(); -unsigned int get_patch() throw(); -char const* get_string() throw(); -} // namespace version -} // namespace clib - -CC_END() - -#endif // !CC_HANDLE_HH diff --git a/broker/neb/inc/com/centreon/clib/version.hh.in b/broker/neb/inc/com/centreon/clib/version.hh.in deleted file mode 100644 index dea870844df..00000000000 --- a/broker/neb/inc/com/centreon/clib/version.hh.in +++ /dev/null @@ -1,50 +0,0 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CC_CLIB_VERSION_HH -# define CC_CLIB_VERSION_HH - -// Compile-time values. -# define CENTREON_CLIB_VERSION_MAJOR @COLLECT_MAJOR@ -# define CENTREON_CLIB_VERSION_MINOR @COLLECT_MINOR@ -# define CENTREON_CLIB_VERSION_PATCH @COLLECT_PATCH@ -# define CENTREON_CLIB_VERSION_STRING "@CLIB_VERSION@" - -# include "com/centreon/namespace.hh" - -CC_BEGIN() - -namespace clib { - namespace version { - // Compile-time values. - unsigned int const major = @COLLECT_MAJOR@; - unsigned int const minor = @COLLECT_MINOR@; - unsigned int const patch = @COLLECT_PATCH@; - char const* const string = "@CLIB_VERSION@"; - - // Run-time values. - unsigned int get_major() noexcept; - unsigned int get_minor() noexcept; - unsigned int get_patch() noexcept; - char const* get_string() noexcept; - } -} - -CC_END() - -#endif // !CC_HANDLE_HH diff --git a/broker/neb/inc/com/centreon/clib_lock_guard.hh b/broker/neb/inc/com/centreon/clib_lock_guard.hh deleted file mode 100644 index 89bd7f838c5..00000000000 --- a/broker/neb/inc/com/centreon/clib_lock_guard.hh +++ /dev/null @@ -1,94 +0,0 @@ -/* -** Copyright 2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CC_CLIB_LOCK_GUARD_HH -#define CC_CLIB_LOCK_GUARD_HH - -#define DEBUG_CLIB - -#ifdef DEBUG_CLIB -template -class clib_lock_guard : public std::lock_guard { - static const constexpr char* filename = "/tmp/lock.log"; - const char* _msg; - - public: - explicit clib_lock_guard(M& m, const char* msg) - : std::lock_guard(m), _msg(msg) { - FILE* f = fopen(filename, "a+"); - fprintf(f, "lock_guard lock mutex '%s'\n", _msg); - fclose(f); - } - - ~clib_lock_guard() { - FILE* f = fopen(filename, "a+"); - fprintf(f, "lock_guard unlock mutex '%s'\n", _msg); - fclose(f); - } -}; - -template -class clib_unique_lock : public std::unique_lock { - static const constexpr char* filename = "/tmp/lock.log"; - const char* _msg; - - public: - explicit clib_unique_lock(M& m, const char* msg) - : std::unique_lock(m), _msg(msg) { - FILE* f = fopen(filename, "a+"); - fprintf(f, "unique_lock lock mutex '%s'\n", _msg); - fclose(f); - } - - ~clib_unique_lock() { - FILE* f = fopen(filename, "a+"); - fprintf(f, "unique_lock unlock mutex '%s'\n", _msg); - fclose(f); - } - - void lock() { - FILE* f = fopen(filename, "a+"); - fprintf(f, "unique_lock lock() mutex '%s'\n", _msg); - fclose(f); - std::unique_lock::lock(); - } - - void unlock() { - FILE* f = fopen(filename, "a+"); - fprintf(f, "unique_lock unlock() mutex '%s'\n", _msg); - fclose(f); - std::unique_lock::unlock(); - } -}; -#else -template -class clib_lock_guard : public std::lock_guard { - public: - explicit clib_lock_guard(M& m, const char* msg __attribute__((unused))) - : std::lock_guard(m) {} -}; - -template -class clib_unique_lock : public std::unique_lock { - public: - explicit clib_unique_lock(M& m, const char* msg __attribute__((unused))) - : std::unique_lock(m) {} -}; -#endif - -#endif /* !CC_CLIB_LOCK_GUARD_HH */ diff --git a/broker/neb/inc/com/centreon/exceptions/basic.hh b/broker/neb/inc/com/centreon/exceptions/basic.hh index f9a97e4fb7b..41614666693 100644 --- a/broker/neb/inc/com/centreon/exceptions/basic.hh +++ b/broker/neb/inc/com/centreon/exceptions/basic.hh @@ -21,7 +21,7 @@ #include "com/centreon/misc/stringifier.hh" -CC_BEGIN() +namespace com::centreon { namespace exceptions { /** @@ -51,7 +51,7 @@ class basic : public std::exception { }; } // namespace exceptions -CC_END() +} #if defined(__GNUC__) #define FUNCTION __PRETTY_FUNCTION__ diff --git a/broker/neb/inc/com/centreon/exceptions/interruption.hh b/broker/neb/inc/com/centreon/exceptions/interruption.hh index e3f25e3be25..b51360dafea 100644 --- a/broker/neb/inc/com/centreon/exceptions/interruption.hh +++ b/broker/neb/inc/com/centreon/exceptions/interruption.hh @@ -20,9 +20,8 @@ #define CC_EXCEPTIONS_INTERRUPTION_HH #include "com/centreon/exceptions/basic.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace exceptions { /** @@ -49,7 +48,7 @@ class interruption : public basic { }; } // namespace exceptions -CC_END() +} #if defined(__GNUC__) #define FUNCTION __PRETTY_FUNCTION__ diff --git a/broker/neb/inc/com/centreon/io/directory_entry.hh b/broker/neb/inc/com/centreon/io/directory_entry.hh index c41db444175..1437c46c332 100644 --- a/broker/neb/inc/com/centreon/io/directory_entry.hh +++ b/broker/neb/inc/com/centreon/io/directory_entry.hh @@ -21,9 +21,8 @@ #include "com/centreon/handle.hh" #include "com/centreon/io/file_entry.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace io { /** @@ -55,6 +54,6 @@ class directory_entry { }; } // namespace io -CC_END() +} #endif // !CC_IO_DIRECTORY_ENTRY_HH diff --git a/broker/neb/inc/com/centreon/io/file_entry.hh b/broker/neb/inc/com/centreon/io/file_entry.hh index 437a9d621db..3daa97804b1 100644 --- a/broker/neb/inc/com/centreon/io/file_entry.hh +++ b/broker/neb/inc/com/centreon/io/file_entry.hh @@ -22,13 +22,12 @@ #include #include #include "com/centreon/handle.hh" -#include "com/centreon/namespace.hh" #ifdef _WIN32 #define stat _stat #endif // _WIN32 -CC_BEGIN() +namespace com::centreon { namespace io { /** @@ -66,6 +65,6 @@ class file_entry { }; } // namespace io -CC_END() +} #endif // !CC_IO_FILE_ENTRY_HH diff --git a/broker/neb/inc/com/centreon/io/file_stream.hh b/broker/neb/inc/com/centreon/io/file_stream.hh index 219c8f5664f..b28988eb7f9 100644 --- a/broker/neb/inc/com/centreon/io/file_stream.hh +++ b/broker/neb/inc/com/centreon/io/file_stream.hh @@ -20,9 +20,8 @@ #define CC_IO_FILE_STREAM_HH #include "com/centreon/handle.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace io { /** @@ -63,6 +62,6 @@ class file_stream : public handle { }; } // namespace io -CC_END() +} #endif // !CC_IO_FILE_STREAM_HH diff --git a/broker/neb/inc/com/centreon/logging/backend.hh b/broker/neb/inc/com/centreon/logging/backend.hh index d57a652cb75..066458d723f 100644 --- a/broker/neb/inc/com/centreon/logging/backend.hh +++ b/broker/neb/inc/com/centreon/logging/backend.hh @@ -19,9 +19,8 @@ #ifndef CC_LOGGING_BACKEND_HH #define CC_LOGGING_BACKEND_HH -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { class stringifier; @@ -77,6 +76,6 @@ class backend { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_BACKEND_HH diff --git a/broker/neb/inc/com/centreon/logging/file.hh b/broker/neb/inc/com/centreon/logging/file.hh index c1db752101e..e66b27b354d 100644 --- a/broker/neb/inc/com/centreon/logging/file.hh +++ b/broker/neb/inc/com/centreon/logging/file.hh @@ -20,9 +20,8 @@ #define CC_LOGGING_FILE_HH #include "com/centreon/logging/backend.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { /** @@ -68,6 +67,6 @@ class file : public backend { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_FILE_HH diff --git a/broker/neb/inc/com/centreon/logging/logger.hh b/broker/neb/inc/com/centreon/logging/logger.hh index 69aced161ff..b74b0d83967 100644 --- a/broker/neb/inc/com/centreon/logging/logger.hh +++ b/broker/neb/inc/com/centreon/logging/logger.hh @@ -21,7 +21,7 @@ #include "com/centreon/logging/temp_logger.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { enum type_value { @@ -33,7 +33,7 @@ enum type_value { enum verbosity_level { low = 0, medium = 1, high = 2 }; } // namespace logging -CC_END() +} #define log_info(verbose) \ for (unsigned int __com_centreon_logging_define_ui(0); \ diff --git a/broker/neb/inc/com/centreon/logging/syslogger.hh b/broker/neb/inc/com/centreon/logging/syslogger.hh index 1326b44a547..d757ebfb92a 100644 --- a/broker/neb/inc/com/centreon/logging/syslogger.hh +++ b/broker/neb/inc/com/centreon/logging/syslogger.hh @@ -20,9 +20,8 @@ #define CC_LOGGING_SYSLOGGER_HH #include "com/centreon/logging/backend.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { /** @@ -55,6 +54,6 @@ class syslogger : public backend { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_SYSLOGGER_HH diff --git a/broker/neb/inc/com/centreon/misc/argument.hh b/broker/neb/inc/com/centreon/misc/argument.hh index d11669da9fa..93345f61f07 100644 --- a/broker/neb/inc/com/centreon/misc/argument.hh +++ b/broker/neb/inc/com/centreon/misc/argument.hh @@ -19,9 +19,8 @@ #ifndef CC_MISC_ARGUMENT_HH #define CC_MISC_ARGUMENT_HH -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { /** @@ -68,6 +67,6 @@ class argument { }; } // namespace misc -CC_END() +} #endif // !CC_MISC_ARGUMENT_HH diff --git a/broker/neb/inc/com/centreon/misc/get_options.hh b/broker/neb/inc/com/centreon/misc/get_options.hh index 483c89edbde..e93ec9e1f50 100644 --- a/broker/neb/inc/com/centreon/misc/get_options.hh +++ b/broker/neb/inc/com/centreon/misc/get_options.hh @@ -20,9 +20,8 @@ #define CC_MISC_GET_OPTIONS_HH #include "com/centreon/misc/argument.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { /** @@ -73,6 +72,6 @@ class get_options { }; } // namespace misc -CC_END() +} #endif // !CC_MISC_GET_OPTIONS_HH diff --git a/broker/neb/src/acknowledgement.cc b/broker/neb/src/acknowledgement.cc index c88dacdce05..049699f1b3c 100644 --- a/broker/neb/src/acknowledgement.cc +++ b/broker/neb/src/acknowledgement.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/acknowledgement.hh" diff --git a/broker/neb/src/broker.cc b/broker/neb/src/broker.cc index 3338093a97b..f20c06b0973 100644 --- a/broker/neb/src/broker.cc +++ b/broker/neb/src/broker.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015-2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015-2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/events.hh" @@ -175,11 +175,12 @@ void broker_module_init(void const* arg) { &neb::pb_custom_variable_status::operations, "customvariables"); - e.register_event(make_type(io::neb, neb::de_pb_host_check), "Check", + e.register_event(make_type(io::neb, neb::de_pb_host_check), "HostCheck", &neb::pb_host_check::operations, "hosts"); - e.register_event(make_type(io::neb, neb::de_pb_service_check), "Check", - &neb::pb_service_check::operations, "services"); + e.register_event(make_type(io::neb, neb::de_pb_service_check), + "ServiceCheck", &neb::pb_service_check::operations, + "services"); e.register_event(make_type(io::neb, neb::de_pb_log_entry), "LogEntry", &neb::pb_log_entry::operations, "logs"); @@ -197,6 +198,23 @@ void broker_module_init(void const* arg) { e.register_event(make_type(io::neb, neb::de_pb_acknowledgement), "Acknowledgement", &neb::pb_acknowledgement::operations, "acknowledgements"); + e.register_event(neb::pb_host_dependency::static_type(), "HostDependency", + &neb::pb_host_dependency::operations, + "hosts_hosts_dependencies"); + e.register_event(neb::pb_service_dependency::static_type(), + "ServiceDependency", + &neb::pb_service_dependency::operations, + "services_services_dependencies"); + e.register_event(neb::pb_host_group::static_type(), "HostGroup", + &neb::pb_host_group::operations, "hostgroups"); + e.register_event( + neb::pb_host_group_member::static_type(), "HostGroupMember", + &neb::pb_host_group_member::operations, "hosts_hostgroups"); + e.register_event(neb::pb_service_group::static_type(), "ServiceGroup", + &neb::pb_service_group::operations, "servicegroups"); + e.register_event( + neb::pb_service_group_member::static_type(), "ServiceGroupMember", + &neb::pb_service_group_member::operations, "services_servicegroups"); } } } diff --git a/broker/neb/src/callback.cc b/broker/neb/src/callback.cc index 8df18daf617..c5cf9ff52e4 100644 --- a/broker/neb/src/callback.cc +++ b/broker/neb/src/callback.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/callback.hh" diff --git a/broker/neb/src/callbacks.cc b/broker/neb/src/callbacks.cc index 599e9025b12..f24516e2ef4 100644 --- a/broker/neb/src/callbacks.cc +++ b/broker/neb/src/callbacks.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/callbacks.hh" @@ -129,12 +129,12 @@ static struct { uint32_t macro; int (*callback)(int, void*); } const gl_pb_engine_callbacks[] = { - {NEBCALLBACK_ADAPTIVE_DEPENDENCY_DATA, &neb::callback_dependency}, + {NEBCALLBACK_ADAPTIVE_DEPENDENCY_DATA, &neb::callback_pb_dependency}, {NEBCALLBACK_ADAPTIVE_HOST_DATA, &neb::callback_pb_host}, {NEBCALLBACK_ADAPTIVE_SERVICE_DATA, &neb::callback_pb_service}, {NEBCALLBACK_CUSTOM_VARIABLE_DATA, &neb::callback_pb_custom_variable}, - {NEBCALLBACK_GROUP_DATA, &neb::callback_group}, - {NEBCALLBACK_GROUP_MEMBER_DATA, &neb::callback_group_member}, + {NEBCALLBACK_GROUP_DATA, &neb::callback_pb_group}, + {NEBCALLBACK_GROUP_MEMBER_DATA, &neb::callback_pb_group_member}, {NEBCALLBACK_RELATION_DATA, &neb::callback_relation}, {NEBCALLBACK_BENCH_DATA, &neb::callback_pb_bench}}; @@ -773,7 +773,8 @@ int neb::callback_dependency(int callback_type, void* data) { if (!dep->get_dependent_hostname().empty() && !dep->get_dependent_service_description().empty()) { dep_ids = engine::get_host_and_service_id( - dep->get_hostname(), dep->get_service_description()); + dep->get_dependent_hostname(), + dep->get_dependent_service_description()); } else { SPDLOG_LOGGER_ERROR( log_v2::neb(), @@ -826,6 +827,160 @@ int neb::callback_dependency(int callback_type, void* data) { return 0; } +/** + * @brief Function that process dependency data. + * + * This function is called by Centreon Engine when some dependency data + * is available. + * + * @param[in] callback_type Type of the callback + * (NEBCALLBACK_ADAPTIVE_DEPENDENCY_DATA). + * @param[in] data A pointer to a + * nebstruct_adaptive_dependency_data + * containing the dependency data. + * + * @return 0 on success. + */ +int neb::callback_pb_dependency(int, void* data) { + // Log message. + SPDLOG_LOGGER_INFO(log_v2::neb(), "callbacks: generating dependency event"); + + // Input variables. + nebstruct_adaptive_dependency_data* nsadd( + static_cast(data)); + + // Host dependency. + if ((NEBTYPE_HOSTDEPENDENCY_ADD == nsadd->type) || + (NEBTYPE_HOSTDEPENDENCY_UPDATE == nsadd->type) || + (NEBTYPE_HOSTDEPENDENCY_DELETE == nsadd->type)) { + // Find IDs. + uint64_t host_id; + uint64_t dep_host_id; + + engine::hostdependency* dep( + static_cast(nsadd->object_ptr)); + if (!dep->get_hostname().empty()) { + host_id = engine::get_host_id(dep->get_hostname()); + } else { + SPDLOG_LOGGER_ERROR( + log_v2::neb(), + "callbacks: dependency callback called without valid host"); + host_id = 0; + } + if (!dep->get_dependent_hostname().empty()) { + dep_host_id = engine::get_host_id(dep->get_dependent_hostname()); + } else { + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks: dependency callback called without valid dependent " + "host"); + dep_host_id = 0; + } + + // Generate service dependency event. + auto hd{std::make_shared()}; + HostDependency& hst_dep = hd->mut_obj(); + hst_dep.set_host_id(host_id); + hst_dep.set_dependent_host_id(dep_host_id); + hst_dep.set_enabled(nsadd->type != NEBTYPE_HOSTDEPENDENCY_DELETE); + if (!dep->get_dependency_period().empty()) + hst_dep.set_dependency_period(dep->get_dependency_period()); + { + std::string options; + if (dep->get_fail_on_down()) + options.append("d"); + if (dep->get_fail_on_up()) + options.append("o"); + if (dep->get_fail_on_pending()) + options.append("p"); + if (dep->get_fail_on_unreachable()) + options.append("u"); + if (dep->get_dependency_type() == engine::dependency::notification) + hst_dep.set_notification_failure_options(options); + else if (dep->get_dependency_type() == engine::dependency::execution) + hst_dep.set_execution_failure_options(options); + } + hst_dep.set_inherits_parent(dep->get_inherits_parent()); + SPDLOG_LOGGER_INFO(log_v2::neb(), "callbacks: host {} depends on host {}", + dep_host_id, host_id); + + // Publish dependency event. + neb::gl_publisher.write(hd); + } + // Service dependency. + else if ((NEBTYPE_SERVICEDEPENDENCY_ADD == nsadd->type) || + (NEBTYPE_SERVICEDEPENDENCY_UPDATE == nsadd->type) || + (NEBTYPE_SERVICEDEPENDENCY_DELETE == nsadd->type)) { + // Find IDs. + std::pair ids; + std::pair dep_ids; + engine::servicedependency* dep( + static_cast(nsadd->object_ptr)); + if (!dep->get_hostname().empty() && + !dep->get_service_description().empty()) { + ids = engine::get_host_and_service_id(dep->get_hostname(), + dep->get_service_description()); + } else { + SPDLOG_LOGGER_ERROR( + log_v2::neb(), + "callbacks: dependency callback called without valid service"); + ids.first = 0; + ids.second = 0; + } + if (!dep->get_dependent_hostname().empty() && + !dep->get_dependent_service_description().empty()) { + dep_ids = engine::get_host_and_service_id( + dep->get_dependent_hostname(), + dep->get_dependent_service_description()); + } else { + SPDLOG_LOGGER_ERROR( + log_v2::neb(), + "callbacks: dependency callback called without valid dependent " + "service"); + dep_ids.first = 0; + dep_ids.second = 0; + } + + // Generate service dependency event. + auto sd{std::make_shared()}; + ServiceDependency& svc_dep = sd->mut_obj(); + svc_dep.set_host_id(ids.first); + svc_dep.set_service_id(ids.second); + svc_dep.set_dependent_host_id(dep_ids.first); + svc_dep.set_dependent_service_id(dep_ids.second); + svc_dep.set_enabled(nsadd->type != NEBTYPE_SERVICEDEPENDENCY_DELETE); + if (!dep->get_dependency_period().empty()) + svc_dep.set_dependency_period(dep->get_dependency_period()); + { + std::string options; + if (dep->get_fail_on_critical()) + options.append("c"); + if (dep->get_fail_on_ok()) + options.append("o"); + if (dep->get_fail_on_pending()) + options.append("p"); + if (dep->get_fail_on_unknown()) + options.append("u"); + if (dep->get_fail_on_warning()) + options.append("w"); + if (dep->get_dependency_type() == engine::dependency::notification) + svc_dep.set_notification_failure_options(options); + else if (dep->get_dependency_type() == engine::dependency::execution) + svc_dep.set_execution_failure_options(options); + } + svc_dep.set_inherits_parent(dep->get_inherits_parent()); + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks: service ({}, {}) depends on service ({}, {})", + dep_ids.first, dep_ids.second, ids.first, ids.second); + + // Publish dependency event. + neb::gl_publisher.write(sd); + } + + return 0; +} + /** * @brief Function that process downtime data. * @@ -1258,10 +1413,16 @@ int neb::callback_group(int callback_type, void* data) { // Send host group event. if (new_hg->id) { - SPDLOG_LOGGER_INFO( - log_v2::neb(), - "callbacks: new host group {} ('{}') on instance {}", new_hg->id, - new_hg->name, new_hg->poller_id); + if (new_hg->enabled) + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks: new host group {} ('{}') on instance {}", + new_hg->id, new_hg->name, new_hg->poller_id); + else + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks: disable host group {} ('{}') on instance {}", + new_hg->id, new_hg->name, new_hg->poller_id); neb::gl_publisher.write(new_hg); } } @@ -1283,10 +1444,16 @@ int neb::callback_group(int callback_type, void* data) { // Send service group event. if (new_sg->id) { - SPDLOG_LOGGER_INFO( - log_v2::neb(), - "callbacks:: new service group {} ('{}) on instance {}", - new_sg->id, new_sg->name, new_sg->poller_id); + if (new_sg->enabled) + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks:: new service group {} ('{}) on instance {}", + new_sg->id, new_sg->name, new_sg->poller_id); + else + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks:: disable service group {} ('{}) on instance {}", + new_sg->id, new_sg->name, new_sg->poller_id); neb::gl_publisher.write(new_sg); } } @@ -1298,6 +1465,107 @@ int neb::callback_group(int callback_type, void* data) { return 0; } +/** + * @brief Function that process group data. + * + * This function is called by Engine when some group data is available. + * + * @param[in] callback_type Type of the callback + * (NEBCALLBACK_GROUP_DATA). + * @param[in] data Pointer to a nebstruct_group_data + * containing the group data. + * + * @return 0 on success. + */ +int neb::callback_pb_group(int callback_type, void* data) { + // Log message. + (void)callback_type; + + // Input variable. + nebstruct_group_data const* group_data( + static_cast(data)); + + SPDLOG_LOGGER_INFO(log_v2::neb(), + "callbacks: generating pb group event type:{}", + group_data->type); + + // Host group. + if ((NEBTYPE_HOSTGROUP_ADD == group_data->type) || + (NEBTYPE_HOSTGROUP_UPDATE == group_data->type) || + (NEBTYPE_HOSTGROUP_DELETE == group_data->type)) { + engine::hostgroup const* host_group( + static_cast(group_data->object_ptr)); + if (!host_group->get_group_name().empty()) { + auto new_hg{std::make_shared()}; + new_hg->mut_obj().set_poller_id( + config::applier::state::instance().poller_id()); + new_hg->mut_obj().set_hostgroup_id(host_group->get_id()); + new_hg->mut_obj().set_enabled(group_data->type != + NEBTYPE_HOSTGROUP_DELETE && + !host_group->members.empty()); + new_hg->mut_obj().set_name( + misc::string::check_string_utf8(host_group->get_group_name())); + + // Send host group event. + if (host_group->get_id()) { + if (new_hg->obj().enabled()) + SPDLOG_LOGGER_INFO(log_v2::neb(), + "callbacks: new pb host group {} ('{}' {} " + "members) on instance {}", + host_group->get_id(), new_hg->obj().name(), + host_group->members.size(), + new_hg->obj().poller_id()); + else + SPDLOG_LOGGER_INFO(log_v2::neb(), + "callbacks: disable pb host group {} ('{}' {} " + "members) on instance {}", + host_group->get_id(), new_hg->obj().name(), + host_group->members.size(), + new_hg->obj().poller_id()); + + neb::gl_publisher.write(new_hg); + } + } + } + // Service group. + else if ((NEBTYPE_SERVICEGROUP_ADD == group_data->type) || + (NEBTYPE_SERVICEGROUP_UPDATE == group_data->type) || + (NEBTYPE_SERVICEGROUP_DELETE == group_data->type)) { + engine::servicegroup const* service_group( + static_cast(group_data->object_ptr)); + if (!service_group->get_group_name().empty()) { + auto new_sg{std::make_shared()}; + new_sg->mut_obj().set_poller_id( + config::applier::state::instance().poller_id()); + new_sg->mut_obj().set_servicegroup_id(service_group->get_id()); + new_sg->mut_obj().set_enabled(group_data->type != + NEBTYPE_SERVICEGROUP_DELETE && + !service_group->members.empty()); + new_sg->mut_obj().set_name( + misc::string::check_string_utf8(service_group->get_group_name())); + + // Send service group event. + if (service_group->get_id()) { + if (new_sg->obj().enabled()) + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks:: new pb service group {} ('{}) on instance {}", + service_group->get_id(), new_sg->obj().name(), + new_sg->obj().poller_id()); + else + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks:: disable pb service group {} ('{}) on instance {}", + service_group->get_id(), new_sg->obj().name(), + new_sg->obj().poller_id()); + + neb::gl_publisher.write(new_sg); + } + } + } + return 0; +} + /** * @brief Function that process group membership. * @@ -1407,6 +1675,116 @@ int neb::callback_group_member(int callback_type, void* data) { return 0; } +/** + * @brief Function that process group membership. + * + * This function is called by Engine when some group membership data is + * available. + * + * @param[in] callback_type Type of the callback + * (NEBCALLBACK_GROUPMEMBER_DATA). + * @param[in] data Pointer to a nebstruct_group_member_data + * containing membership data. + * + * @return 0 on success. + */ +int neb::callback_pb_group_member(int callback_type, void* data) { + // Log message. + SPDLOG_LOGGER_INFO(log_v2::neb(), + "callbacks: generating pb group member event"); + (void)callback_type; + + // Input variable. + nebstruct_group_member_data const* member_data( + static_cast(data)); + + // Host group member. + if ((member_data->type == NEBTYPE_HOSTGROUPMEMBER_ADD) || + (member_data->type == NEBTYPE_HOSTGROUPMEMBER_DELETE)) { + engine::host const* hst( + static_cast(member_data->object_ptr)); + engine::hostgroup const* hg( + static_cast(member_data->group_ptr)); + if (!hst->name().empty() && !hg->get_group_name().empty()) { + // Output variable. + auto hgmp{std::make_shared()}; + HostGroupMember& hgm = hgmp->mut_obj(); + hgm.set_hostgroup_id(hg->get_id()); + hgm.set_name(misc::string::check_string_utf8(hg->get_group_name())); + hgm.set_poller_id(config::applier::state::instance().poller_id()); + uint32_t host_id = engine::get_host_id(hst->name()); + if (host_id != 0 && hgm.hostgroup_id() != 0) { + hgm.set_host_id(host_id); + if (member_data->type == NEBTYPE_HOSTGROUPMEMBER_DELETE) { + SPDLOG_LOGGER_INFO(log_v2::neb(), + "callbacks: host {} is not a member of group " + "{} on instance {} " + "anymore", + hgm.host_id(), hgm.hostgroup_id(), + hgm.poller_id()); + hgm.set_enabled(false); + } else { + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks: host {} is a member of group {} on instance {}", + hgm.host_id(), hgm.hostgroup_id(), hgm.poller_id()); + hgm.set_enabled(true); + } + + // Send host group member event. + if (hgm.host_id() && hgm.hostgroup_id()) + neb::gl_publisher.write(hgmp); + } + } + } + // Service group member. + else if ((member_data->type == NEBTYPE_SERVICEGROUPMEMBER_ADD) || + (member_data->type == NEBTYPE_SERVICEGROUPMEMBER_DELETE)) { + engine::service const* svc( + static_cast(member_data->object_ptr)); + engine::servicegroup const* sg( + static_cast(member_data->group_ptr)); + if (!svc->description().empty() && !sg->get_group_name().empty() && + !svc->get_hostname().empty()) { + // Output variable. + auto sgmp{std::make_shared()}; + ServiceGroupMember& sgm = sgmp->mut_obj(); + sgm.set_servicegroup_id(sg->get_id()); + sgm.set_name(misc::string::check_string_utf8(sg->get_group_name())); + sgm.set_poller_id(config::applier::state::instance().poller_id()); + std::pair p; + p = engine::get_host_and_service_id(svc->get_hostname(), + svc->description()); + sgm.set_host_id(p.first); + sgm.set_service_id(p.second); + if (sgm.host_id() && sgm.service_id() && sgm.servicegroup_id()) { + if (member_data->type == NEBTYPE_SERVICEGROUPMEMBER_DELETE) { + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks: service ({},{}) is not a member of group {} on " + "instance {} anymore", + sgm.host_id(), sgm.service_id(), sgm.servicegroup_id(), + sgm.poller_id()); + sgm.set_enabled(false); + } else { + SPDLOG_LOGGER_INFO( + log_v2::neb(), + "callbacks: service ({}, {}) is a member of group {} on " + "instance {}", + sgm.host_id(), sgm.service_id(), sgm.servicegroup_id(), + sgm.poller_id()); + sgm.set_enabled(true); + } + + // Send service group member event. + if (sgm.host_id() && sgm.service_id() && sgm.servicegroup_id()) + neb::gl_publisher.write(sgmp); + } + } + } + return 0; +} + /** * @brief Function that process host data. * diff --git a/broker/neb/src/check.cc b/broker/neb/src/check.cc index 3131026d3d0..fc2e9589ff7 100644 --- a/broker/neb/src/check.cc +++ b/broker/neb/src/check.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2012 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2012 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/check.hh" diff --git a/broker/neb/src/comment.cc b/broker/neb/src/comment.cc index d9c427f7e93..982eb0bdafc 100644 --- a/broker/neb/src/comment.cc +++ b/broker/neb/src/comment.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015,2019-2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015,2019-2020 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/comment.hh" diff --git a/broker/neb/src/custom_variable.cc b/broker/neb/src/custom_variable.cc index fe69437e314..c66a7a00e48 100644 --- a/broker/neb/src/custom_variable.cc +++ b/broker/neb/src/custom_variable.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/custom_variable.hh" diff --git a/broker/neb/src/custom_variable_status.cc b/broker/neb/src/custom_variable_status.cc index 686665dd6d7..7cefe8dcdaa 100644 --- a/broker/neb/src/custom_variable_status.cc +++ b/broker/neb/src/custom_variable_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/custom_variable_status.hh" diff --git a/broker/neb/src/dependency.cc b/broker/neb/src/dependency.cc index 7e382f8e1e9..9af51cdfc1c 100644 --- a/broker/neb/src/dependency.cc +++ b/broker/neb/src/dependency.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2012,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2012,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/dependency.hh" diff --git a/broker/neb/src/downtime.cc b/broker/neb/src/downtime.cc index 71b7c54e950..47950ce8bcb 100644 --- a/broker/neb/src/downtime.cc +++ b/broker/neb/src/downtime.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/downtime.hh" diff --git a/broker/neb/src/group.cc b/broker/neb/src/group.cc index 04ec9288cad..c1687913dc9 100644 --- a/broker/neb/src/group.cc +++ b/broker/neb/src/group.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2012,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2012,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/group.hh" diff --git a/broker/neb/src/group_member.cc b/broker/neb/src/group_member.cc index 46b19bc6eb1..26bd978a482 100644 --- a/broker/neb/src/group_member.cc +++ b/broker/neb/src/group_member.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2012.2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2012.2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/group_member.hh" diff --git a/broker/neb/src/host.cc b/broker/neb/src/host.cc index b9e82d98919..9b7eb856121 100644 --- a/broker/neb/src/host.cc +++ b/broker/neb/src/host.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host.hh" diff --git a/broker/neb/src/host_check.cc b/broker/neb/src/host_check.cc index 0a872865af9..71a71682808 100644 --- a/broker/neb/src/host_check.cc +++ b/broker/neb/src/host_check.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_check.hh" diff --git a/broker/neb/src/host_dependency.cc b/broker/neb/src/host_dependency.cc index 16269ebc353..ee7eaaa7704 100644 --- a/broker/neb/src/host_dependency.cc +++ b/broker/neb/src/host_dependency.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_dependency.hh" diff --git a/broker/neb/src/host_group.cc b/broker/neb/src/host_group.cc index 4a39779be7e..f70661becbe 100644 --- a/broker/neb/src/host_group.cc +++ b/broker/neb/src/host_group.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_group.hh" diff --git a/broker/neb/src/host_group_member.cc b/broker/neb/src/host_group_member.cc index a661ca322c0..9e50f2b543c 100644 --- a/broker/neb/src/host_group_member.cc +++ b/broker/neb/src/host_group_member.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_group_member.hh" diff --git a/broker/neb/src/host_parent.cc b/broker/neb/src/host_parent.cc index b2955b19e24..ca5c43ff00a 100644 --- a/broker/neb/src/host_parent.cc +++ b/broker/neb/src/host_parent.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_parent.hh" diff --git a/broker/neb/src/host_service.cc b/broker/neb/src/host_service.cc index 5f220bf7292..e60d86d6e27 100644 --- a/broker/neb/src/host_service.cc +++ b/broker/neb/src/host_service.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_service.hh" diff --git a/broker/neb/src/host_service_status.cc b/broker/neb/src/host_service_status.cc index 04ac360ff8b..3b7eae2c6c9 100644 --- a/broker/neb/src/host_service_status.cc +++ b/broker/neb/src/host_service_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_service_status.hh" diff --git a/broker/neb/src/host_status.cc b/broker/neb/src/host_status.cc index c75526ed539..1bc906da795 100644 --- a/broker/neb/src/host_status.cc +++ b/broker/neb/src/host_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/host_status.hh" diff --git a/broker/neb/src/initial.cc b/broker/neb/src/initial.cc index c16a61c3f82..4c358c95329 100644 --- a/broker/neb/src/initial.cc +++ b/broker/neb/src/initial.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/initial.hh" @@ -170,7 +170,8 @@ static void send_downtimes_list() { /** * Send to the global publisher the list of host dependencies within Nagios. */ -static void send_host_dependencies_list() { +static void send_host_dependencies_list( + neb_sender callbackfct = neb::callback_dependency) { // Start log message. log_v2::neb()->info("init: beginning host dependencies dump"); @@ -188,7 +189,7 @@ static void send_host_dependencies_list() { nsadd.object_ptr = it->second.get(); // Callback. - neb::callback_dependency(NEBCALLBACK_ADAPTIVE_DEPENDENCY_DATA, &nsadd); + callbackfct(NEBCALLBACK_ADAPTIVE_DEPENDENCY_DATA, &nsadd); } } catch (std::exception const& e) { log_v2::neb()->info( @@ -204,10 +205,16 @@ static void send_host_dependencies_list() { return; } +static void send_pb_host_dependencies_list() { + send_host_dependencies_list(neb::callback_pb_dependency); +} + /** * Send to the global publisher the list of host groups within Engine. */ -static void send_host_group_list() { +static void send_host_group_list( + neb_sender group_sender = neb::callback_group, + neb_sender group_member_sender = neb::callback_group_member) { // Start log message. log_v2::neb()->info("init: beginning host group dump"); @@ -223,7 +230,7 @@ static void send_host_group_list() { nsgd.object_ptr = it->second.get(); // Callback. - neb::callback_group(NEBCALLBACK_GROUP_DATA, &nsgd); + group_sender(NEBCALLBACK_GROUP_DATA, &nsgd); // Dump host group members. for (host_map_unsafe::const_iterator hit{it->second->members.begin()}, @@ -237,7 +244,7 @@ static void send_host_group_list() { nsgmd.group_ptr = it->second.get(); // Callback. - neb::callback_group_member(NEBCALLBACK_GROUP_MEMBER_DATA, &nsgmd); + group_member_sender(NEBCALLBACK_GROUP_MEMBER_DATA, &nsgmd); } } @@ -245,6 +252,10 @@ static void send_host_group_list() { log_v2::neb()->info("init: end of host group dump"); } +static void send_pb_host_group_list() { + send_host_group_list(neb::callback_pb_group, neb::callback_pb_group_member); +} + /** * @brief When centengine is started, send severities in bulk. */ @@ -349,7 +360,8 @@ static void send_host_parents_list() { * Send to the global publisher the list of service dependencies within * Nagios. */ -static void send_service_dependencies_list() { +static void send_service_dependencies_list( + neb_sender sender_fct = neb::callback_dependency) { // Start log message. log_v2::neb()->info("init: beginning service dependencies dump"); @@ -368,7 +380,7 @@ static void send_service_dependencies_list() { nsadd.object_ptr = it->second.get(); // Callback. - neb::callback_dependency(NEBCALLBACK_ADAPTIVE_DEPENDENCY_DATA, &nsadd); + sender_fct(NEBCALLBACK_ADAPTIVE_DEPENDENCY_DATA, &nsadd); } } catch (std::exception const& e) { log_v2::neb()->error( @@ -383,10 +395,16 @@ static void send_service_dependencies_list() { log_v2::neb()->info("init: end of service dependencies dump"); } +static void send_pb_service_dependencies_list() { + send_service_dependencies_list(neb::callback_pb_dependency); +} + /** * Send to the global publisher the list of service groups within Engine. */ -static void send_service_group_list() { +static void send_service_group_list( + neb_sender group_sender = neb::callback_group, + neb_sender group_member_sender = neb::callback_group_member) { // Start log message. log_v2::neb()->info("init: beginning service group dump"); @@ -402,7 +420,7 @@ static void send_service_group_list() { nsgd.object_ptr = it->second.get(); // Callback. - neb::callback_group(NEBCALLBACK_GROUP_DATA, &nsgd); + group_sender(NEBCALLBACK_GROUP_DATA, &nsgd); // Dump service group members. for (service_map_unsafe::const_iterator sit{it->second->members.begin()}, @@ -416,7 +434,7 @@ static void send_service_group_list() { nsgmd.group_ptr = it->second.get(); // Callback. - neb::callback_group_member(NEBCALLBACK_GROUP_MEMBER_DATA, &nsgmd); + group_member_sender(NEBCALLBACK_GROUP_MEMBER_DATA, &nsgmd); } } @@ -424,6 +442,11 @@ static void send_service_group_list() { log_v2::neb()->info("init: end of service groups dump"); } +static void send_pb_service_group_list() { + send_service_group_list(neb::callback_pb_group, + neb::callback_pb_group_member); +} + /** * Send to the global publisher the list of services within Nagios. */ @@ -481,6 +504,7 @@ static void send_instance_configuration() { * Send initial configuration to the global publisher. */ void neb::send_initial_configuration() { + SPDLOG_LOGGER_INFO(log_v2::neb(), "init: send poller conf"); send_severity_list(); send_tag_list(); send_host_list(); @@ -505,6 +529,7 @@ void neb::send_initial_configuration() { * Send initial configuration to the global publisher. */ void neb::send_initial_pb_configuration() { + SPDLOG_LOGGER_INFO(log_v2::neb(), "init: send poller pb conf"); send_severity_list(); send_tag_list(); send_pb_host_list(); @@ -512,9 +537,9 @@ void neb::send_initial_pb_configuration() { send_pb_custom_variables_list(); send_downtimes_list(); send_host_parents_list(); - send_host_group_list(); - send_service_group_list(); - send_host_dependencies_list(); - send_service_dependencies_list(); + send_pb_host_group_list(); + send_pb_service_group_list(); + send_pb_host_dependencies_list(); + send_pb_service_dependencies_list(); send_instance_configuration(); } diff --git a/broker/neb/src/instance.cc b/broker/neb/src/instance.cc index 84bdfb66d5e..5cd50113597 100644 --- a/broker/neb/src/instance.cc +++ b/broker/neb/src/instance.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/instance.hh" diff --git a/broker/neb/src/instance_configuration.cc b/broker/neb/src/instance_configuration.cc index ce9bbf479fc..843b36104ef 100644 --- a/broker/neb/src/instance_configuration.cc +++ b/broker/neb/src/instance_configuration.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2016 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2016 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/instance_configuration.hh" diff --git a/broker/neb/src/instance_status.cc b/broker/neb/src/instance_status.cc index e3addbe6bf9..e9f70e8c3c7 100644 --- a/broker/neb/src/instance_status.cc +++ b/broker/neb/src/instance_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/instance_status.hh" diff --git a/broker/neb/src/internal.cc b/broker/neb/src/internal.cc index 2af405bc2cf..8de6fb606af 100644 --- a/broker/neb/src/internal.cc +++ b/broker/neb/src/internal.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/internal.hh" diff --git a/broker/neb/src/log_entry.cc b/broker/neb/src/log_entry.cc index d8906565535..3ea0f300313 100644 --- a/broker/neb/src/log_entry.cc +++ b/broker/neb/src/log_entry.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/log_entry.hh" diff --git a/broker/neb/src/neb.cc b/broker/neb/src/neb.cc index b536e86184a..c4d3b7ddf58 100644 --- a/broker/neb/src/neb.cc +++ b/broker/neb/src/neb.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2016, 2018-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2016, 2018-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/neb/src/responsive_instance.cc b/broker/neb/src/responsive_instance.cc index a25aee99162..55c19fc2d91 100644 --- a/broker/neb/src/responsive_instance.cc +++ b/broker/neb/src/responsive_instance.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/responsive_instance.hh" diff --git a/broker/neb/src/service.cc b/broker/neb/src/service.cc index 4440f945bb9..a4158a79022 100644 --- a/broker/neb/src/service.cc +++ b/broker/neb/src/service.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/service.hh" diff --git a/broker/neb/src/service_check.cc b/broker/neb/src/service_check.cc index dc9f8ecee2d..adc6941bae7 100644 --- a/broker/neb/src/service_check.cc +++ b/broker/neb/src/service_check.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/service_check.hh" diff --git a/broker/neb/src/service_dependency.cc b/broker/neb/src/service_dependency.cc index 94c69d81d08..b2ff6f58641 100644 --- a/broker/neb/src/service_dependency.cc +++ b/broker/neb/src/service_dependency.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/service_dependency.hh" diff --git a/broker/neb/src/service_group.cc b/broker/neb/src/service_group.cc index 37b4da3d9d3..38a7bb56cb2 100644 --- a/broker/neb/src/service_group.cc +++ b/broker/neb/src/service_group.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/service_group.hh" diff --git a/broker/neb/src/service_group_member.cc b/broker/neb/src/service_group_member.cc index 6ed79557d58..abdac2421be 100644 --- a/broker/neb/src/service_group_member.cc +++ b/broker/neb/src/service_group_member.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/service_group_member.hh" diff --git a/broker/neb/src/service_status.cc b/broker/neb/src/service_status.cc index bb2aab56801..9575a163e59 100644 --- a/broker/neb/src/service_status.cc +++ b/broker/neb/src/service_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015,2019-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015,2019-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/service_status.hh" diff --git a/broker/neb/src/set_log_data.cc b/broker/neb/src/set_log_data.cc index ad18e3ebbfa..7e20a64ff93 100644 --- a/broker/neb/src/set_log_data.cc +++ b/broker/neb/src/set_log_data.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2011,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2011,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/set_log_data.hh" @@ -55,7 +55,7 @@ static char* log_extract(char** lasts) { * * @return A status code. */ -static int status_id(const absl::string_view& status) { +static int status_id(const std::string_view& status) { int retval; if (status == "DOWN" || status == "WARNING") retval = 1; @@ -73,12 +73,12 @@ static int status_id(const absl::string_view& status) { /** * Get the notification status of a log. */ -static int notification_status_id(const absl::string_view& status) { +static int notification_status_id(const std::string_view& status) { int retval; size_t pos_start = status.find_first_of('('); if (pos_start != std::string::npos) { size_t pos_end = status.find_first_of(')', pos_start); - absl::string_view nstatus = status.substr(pos_start, pos_end - pos_start); + std::string_view nstatus = status.substr(pos_start, pos_end - pos_start); retval = status_id(nstatus); } else retval = status_id(status); @@ -88,7 +88,7 @@ static int notification_status_id(const absl::string_view& status) { /** * Get the id of a log type. */ -static LogEntry_LogType type_id(const absl::string_view& type) { +static LogEntry_LogType type_id(const std::string_view& type) { LogEntry_LogType id; if (type == "HARD") id = LogEntry_LogType_HARD; diff --git a/broker/neb/src/status.cc b/broker/neb/src/status.cc index 13276dda820..80b6ab0ebdc 100644 --- a/broker/neb/src/status.cc +++ b/broker/neb/src/status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/neb/status.hh" diff --git a/broker/neb/test/custom_variable.cc b/broker/neb/test/custom_variable.cc index 69a19ba8a19..25b8ef93e8b 100644 --- a/broker/neb/test/custom_variable.cc +++ b/broker/neb/test/custom_variable.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/custom_variable_status.cc b/broker/neb/test/custom_variable_status.cc index c34d013c305..25bb10f3a37 100644 --- a/broker/neb/test/custom_variable_status.cc +++ b/broker/neb/test/custom_variable_status.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/host.cc b/broker/neb/test/host.cc index 8fed68e9933..0727cd217ad 100644 --- a/broker/neb/test/host.cc +++ b/broker/neb/test/host.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/host_check.cc b/broker/neb/test/host_check.cc index d3d0ccb6e18..e326646def4 100644 --- a/broker/neb/test/host_check.cc +++ b/broker/neb/test/host_check.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/host_dependency.cc b/broker/neb/test/host_dependency.cc index 82b709b2d3a..21a3d76e709 100644 --- a/broker/neb/test/host_dependency.cc +++ b/broker/neb/test/host_dependency.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/host_parent.cc b/broker/neb/test/host_parent.cc index 6394b4a324c..1ca56e4a0ea 100644 --- a/broker/neb/test/host_parent.cc +++ b/broker/neb/test/host_parent.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/host_status.cc b/broker/neb/test/host_status.cc index 29313710333..be62dd818c9 100644 --- a/broker/neb/test/host_status.cc +++ b/broker/neb/test/host_status.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/instance.cc b/broker/neb/test/instance.cc index 2a8c06a3d95..fde5810471d 100644 --- a/broker/neb/test/instance.cc +++ b/broker/neb/test/instance.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/instance_status.cc b/broker/neb/test/instance_status.cc index 7b0bee63719..8fb1ddcd5ea 100644 --- a/broker/neb/test/instance_status.cc +++ b/broker/neb/test/instance_status.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/log_entry.cc b/broker/neb/test/log_entry.cc index 53e5a7d4b0d..9a134599d8e 100644 --- a/broker/neb/test/log_entry.cc +++ b/broker/neb/test/log_entry.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/randomize.cc b/broker/neb/test/randomize.cc index 26dd1162ace..a87050945ac 100644 --- a/broker/neb/test/randomize.cc +++ b/broker/neb/test/randomize.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011, 2019-2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ #include "com/centreon/broker/mapping/entry.hh" #include "com/centreon/broker/mapping/property.hh" #include "com/centreon/broker/mapping/source.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/events.hh" #include "com/centreon/broker/neb/internal.hh" #include "com/centreon/exceptions/msg_fmt.hh" @@ -36,9 +35,7 @@ static std::list generated; * @param[out] t Base object. * @param[out] values Generated values. */ -namespace com { -namespace centreon { -namespace broker { +namespace com::centreon::broker { void randomize(io::data& t, std::vector* values) { using namespace com::centreon::exceptions; using namespace com::centreon::broker; @@ -152,6 +149,4 @@ void randomize_cleanup() { io::protocols::unload(); } -} // Namespace broker -} // Namespace centreon -} // Namespace com +} // namespace com::centreon::broker diff --git a/broker/neb/test/randomize.hh b/broker/neb/test/randomize.hh index 41a5caebf40..17a43cf497e 100644 --- a/broker/neb/test/randomize.hh +++ b/broker/neb/test/randomize.hh @@ -24,11 +24,10 @@ #include "com/centreon/broker/mapping/entry.hh" #include "com/centreon/broker/mapping/property.hh" #include "com/centreon/broker/mapping/source.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/neb/events.hh" #include "com/centreon/broker/neb/internal.hh" -CCB_BEGIN() +namespace com::centreon::broker { union randval { bool b; @@ -44,7 +43,7 @@ void randomize(io::data& t, std::vector* values = NULL); void randomize_init(); void randomize_cleanup(); -CCB_END() +} template bool operator==(T const& t, diff --git a/broker/neb/test/service.cc b/broker/neb/test/service.cc index 6b759c55931..992023a4576 100644 --- a/broker/neb/test/service.cc +++ b/broker/neb/test/service.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/service_check.cc b/broker/neb/test/service_check.cc index b14c53b340a..6e41b0f7520 100644 --- a/broker/neb/test/service_check.cc +++ b/broker/neb/test/service_check.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/service_dependency.cc b/broker/neb/test/service_dependency.cc index 8eb5b9d50e7..66ad6dc4418 100644 --- a/broker/neb/test/service_dependency.cc +++ b/broker/neb/test/service_dependency.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,7 @@ using namespace com::centreon::broker; -class ServiceDependency : public ::testing::Test { +class ServiceDependencyTest : public ::testing::Test { void SetUp() override { randomize_init(); }; void TearDown() override { randomize_cleanup(); }; @@ -34,7 +34,7 @@ class ServiceDependency : public ::testing::Test { /** * Check service_dependency's assignment operator. */ -TEST_F(ServiceDependency, Assign) { +TEST_F(ServiceDependencyTest, Assign) { // Object #1. neb::service_dependency sdep1; std::vector randvals1; @@ -59,7 +59,7 @@ TEST_F(ServiceDependency, Assign) { /** * Check service_dependency's copy constructor. */ -TEST_F(ServiceDependency, CopyCtor) { +TEST_F(ServiceDependencyTest, CopyCtor) { // Object #1. neb::service_dependency sdep1; std::vector randvals1; @@ -80,7 +80,7 @@ TEST_F(ServiceDependency, CopyCtor) { /** * Check service_dependency's default constructor. */ -TEST_F(ServiceDependency, DefaultCtor) { +TEST_F(ServiceDependencyTest, DefaultCtor) { // Object. neb::service_dependency sdep; diff --git a/broker/neb/test/service_status.cc b/broker/neb/test/service_status.cc index 356b4e6664c..0c56291552c 100644 --- a/broker/neb/test/service_status.cc +++ b/broker/neb/test/service_status.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/neb/test/set_log_data.cc b/broker/neb/test/set_log_data.cc index c1a7812e1fa..347e1b3e31b 100644 --- a/broker/neb/test/set_log_data.cc +++ b/broker/neb/test/set_log_data.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/rrd/CMakeLists.txt b/broker/rrd/CMakeLists.txt index 29b5042f69e..a8898603b28 100644 --- a/broker/rrd/CMakeLists.txt +++ b/broker/rrd/CMakeLists.txt @@ -1,20 +1,20 @@ -# # -# # Copyright 2011-2013 Centreon -# # -# # Licensed under the Apache License, Version 2.0 (the "License"); -# # you may not use this file except in compliance with the License. -# # You may obtain a copy of the License at -# # -# # http://www.apache.org/licenses/LICENSE-2.0 -# # -# # Unless required by applicable law or agreed to in writing, software -# # distributed under the License is distributed on an "AS IS" BASIS, -# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# # See the License for the specific language governing permissions and -# # limitations under the License. -# # -# # For more information : contact@centreon.com -# # +# +# Copyright 2011-2013 Centreon +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# For more information : contact@centreon.com +# # Global options. set(INC_DIR "${PROJECT_SOURCE_DIR}/rrd/inc") @@ -24,9 +24,6 @@ include_directories("${INC_DIR}") include_directories("${CMAKE_SOURCE_DIR}") include_directories("${PROJECT_SOURCE_DIR}/neb/inc") -get_protobuf_files(rebuild_message) -get_protobuf_files(remove_graph_message) - # Find librrd. include(FindPkgConfig) @@ -35,7 +32,9 @@ if(PKG_CONFIG_FOUND) if(LIBRRD_INCLUDE_DIRS) include_directories("${LIBRRD_INCLUDE_DIRS}") - set(LIBRRD_INCLUDE_DIRS "${LIBRRD_INCLUDE_DIRS}" PARENT_SCOPE) + set(LIBRRD_INCLUDE_DIRS + "${LIBRRD_INCLUDE_DIRS}" + PARENT_SCOPE) endif() else() # Find rrd.h @@ -46,7 +45,9 @@ else() endif() include_directories("${LIBRRD_INCLUDE_DIR}") - set(LIBRRD_INCLUDE_DIRS "${LIBRRD_INCLUDE_DIR}" PARENT_SCOPE) + set(LIBRRD_INCLUDE_DIRS + "${LIBRRD_INCLUDE_DIR}" + PARENT_SCOPE) # Find librrd. find_library(LIBRRD_LDFLAGS "rrd") @@ -55,14 +56,18 @@ else() message(FATAL_ERROR "Could not find librrd's library.") endif() - set(LIBRRD_LDFLAGS "${LIBRRD_LDFLAGS}" PARENT_SCOPE) + set(LIBRRD_LDFLAGS + "${LIBRRD_LDFLAGS}" + PARENT_SCOPE) endif() # RRD module. set(RRD "70-rrd") -set(RRD "${RRD}" PARENT_SCOPE) -add_library("${RRD}" SHARED - +set(RRD + "${RRD}" + PARENT_SCOPE) +add_library( + "${RRD}" SHARED # Sources. "${SRC_DIR}/connector.cc" "${SRC_DIR}/creator.cc" @@ -70,9 +75,6 @@ add_library("${RRD}" SHARED "${SRC_DIR}/lib.cc" "${SRC_DIR}/main.cc" "${SRC_DIR}/output.cc" - ${proto_rebuild_message} - ${proto_remove_graph_message} - # Headers. "${INC_DIR}/com/centreon/broker/rrd/backend.hh" "${INC_DIR}/com/centreon/broker/rrd/connector.hh" @@ -81,51 +83,45 @@ add_library("${RRD}" SHARED "${INC_DIR}/com/centreon/broker/rrd/exceptions/update.hh" "${INC_DIR}/com/centreon/broker/rrd/factory.hh" "${INC_DIR}/com/centreon/broker/rrd/lib.hh" - "${INC_DIR}/com/centreon/broker/rrd/output.hh" -) + "${INC_DIR}/com/centreon/broker/rrd/output.hh") set_target_properties("${RRD}" PROPERTIES PREFIX "") target_precompile_headers(${RRD} PRIVATE precomp_inc/precomp.hpp) add_dependencies("${RRD}" target_rebuild_message target_remove_graph_message) # Compile with librrd flags. if(LIBRRD_CFLAGS) - get_source_file_property(RRD_SOURCE_CXXFLAGS "${SRC_DIR}/lib.cc" COMPILE_FLAGS) + get_source_file_property(RRD_SOURCE_CXXFLAGS "${SRC_DIR}/lib.cc" + COMPILE_FLAGS) if(LIBRRD_SOURCE_CXXFLAGS) - set_source_files_properties("${SRC_DIR}/lib.cc" PROPERTIES - COMPILE_FLAGS "${RRD_SOURCE_CXXFLAGS} ${LIBRRD_CFLAGS}") + set_source_files_properties( + "${SRC_DIR}/lib.cc" PROPERTIES COMPILE_FLAGS + "${RRD_SOURCE_CXXFLAGS} ${LIBRRD_CFLAGS}") else() - set_source_files_properties("${SRC_DIR}/lib.cc" PROPERTIES - COMPILE_FLAGS "${LIBRRD_CFLAGS}") + set_source_files_properties("${SRC_DIR}/lib.cc" + PROPERTIES COMPILE_FLAGS "${LIBRRD_CFLAGS}") endif() endif() -target_link_libraries("${RRD}" ${LIBRRD_LDFLAGS} +target_link_libraries( + "${RRD}" + ${LIBRRD_LDFLAGS} bbdo_storage pb_storage_lib + pb_rebuild_message_lib + pb_remove_graph_message_lib CONAN_PKG::spdlog) # Testing. if(WITH_TESTING) - set( - TESTS_SOURCES - ${TESTS_SOURCES} - "${TEST_DIR}/cached.cc" - "${TEST_DIR}/exceptions.cc" - "${TEST_DIR}/factory.cc" - "${TEST_DIR}/lib.cc" - "${TEST_DIR}/rrd.cc" - PARENT_SCOPE - ) - set( - TESTS_LIBRARIES - ${TESTS_LIBRARIES} - "${RRD}" - PARENT_SCOPE - ) + set(TESTS_SOURCES + ${TESTS_SOURCES} "${TEST_DIR}/cached.cc" "${TEST_DIR}/exceptions.cc" + "${TEST_DIR}/factory.cc" "${TEST_DIR}/lib.cc" "${TEST_DIR}/rrd.cc" + PARENT_SCOPE) + set(TESTS_LIBRARIES + ${TESTS_LIBRARIES} "${RRD}" + PARENT_SCOPE) endif() # Install rule. -install(TARGETS "${RRD}" - LIBRARY DESTINATION "${PREFIX_MODULES}" -) +install(TARGETS "${RRD}" LIBRARY DESTINATION "${PREFIX_MODULES}") diff --git a/broker/rrd/inc/com/centreon/broker/rrd/backend.hh b/broker/rrd/inc/com/centreon/broker/rrd/backend.hh index 034255b057e..1845c6b5f62 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/backend.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/backend.hh @@ -19,9 +19,8 @@ #ifndef CCB_RRD_BACKEND_HH #define CCB_RRD_BACKEND_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace rrd { /** @@ -57,6 +56,6 @@ class backend { }; } // namespace rrd -CCB_END() +} #endif // !CCB_RRD_BACKEND_HH diff --git a/broker/rrd/inc/com/centreon/broker/rrd/cached.hh b/broker/rrd/inc/com/centreon/broker/rrd/cached.hh index ecf4ce6055f..0078c68cc9a 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/cached.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/cached.hh @@ -22,7 +22,6 @@ #include #include "com/centreon/broker/log_v2.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/rrd/exceptions/open.hh" #include "com/centreon/broker/rrd/exceptions/update.hh" #include "com/centreon/broker/rrd/lib.hh" @@ -30,7 +29,7 @@ using namespace com::centreon; using namespace com::centreon::exceptions; -CCB_BEGIN() +namespace com::centreon::broker { namespace rrd { @@ -307,6 +306,6 @@ class cached : public backend { }; } // namespace rrd -CCB_END() +} #endif /* !CCB_RRD_CACHED_HH */ diff --git a/broker/rrd/inc/com/centreon/broker/rrd/connector.hh b/broker/rrd/inc/com/centreon/broker/rrd/connector.hh index 078613f1994..867a9619d2c 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/connector.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/connector.hh @@ -20,9 +20,8 @@ #define CCB_RRD_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace rrd { /** @@ -61,6 +60,6 @@ class connector : public io::endpoint { }; } // namespace rrd -CCB_END() +} #endif // !CCB_RRD_CONNECTOR_HH diff --git a/broker/rrd/inc/com/centreon/broker/rrd/creator.hh b/broker/rrd/inc/com/centreon/broker/rrd/creator.hh index 30c5d179088..0d28c8a34c7 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/creator.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/creator.hh @@ -21,9 +21,8 @@ #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace rrd { /** @@ -98,6 +97,6 @@ class creator { }; } // namespace rrd -CCB_END() +} #endif // !CCB_RRD_CREATOR_HH diff --git a/broker/rrd/inc/com/centreon/broker/rrd/factory.hh b/broker/rrd/inc/com/centreon/broker/rrd/factory.hh index 69bc2954495..321551c4c95 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/factory.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/factory.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/extension.hh" #include "com/centreon/broker/io/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace rrd { /** @@ -45,6 +45,6 @@ class factory : public io::factory { }; } // namespace rrd -CCB_END() +} #endif // !CCB_RRD_FACTORY_HH diff --git a/broker/rrd/inc/com/centreon/broker/rrd/internal.hh b/broker/rrd/inc/com/centreon/broker/rrd/internal.hh index 9843f22edc7..a5832c09d1e 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/internal.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/internal.hh @@ -24,7 +24,7 @@ #include "bbdo/remove_graph_message.pb.h" #include "bbdo/storage.pb.h" #include "com/centreon/broker/io/protobuf.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { /** @@ -45,6 +45,6 @@ using pb_metric = using pb_status = io::protobuf; } // namespace storage -CCB_END() +} #endif /* !CCB_RRD_INTERNAL_HH */ diff --git a/broker/rrd/inc/com/centreon/broker/rrd/lib.hh b/broker/rrd/inc/com/centreon/broker/rrd/lib.hh index 251ffe7b4d4..1591b71751d 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/lib.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/lib.hh @@ -19,11 +19,10 @@ #ifndef CCB_RRD_LIB_HH #define CCB_RRD_LIB_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/rrd/backend.hh" #include "com/centreon/broker/rrd/creator.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace rrd { /** @@ -60,6 +59,6 @@ class lib : public backend { }; } // namespace rrd -CCB_END() +} #endif // !CCB_RRD_LIB_HH diff --git a/broker/rrd/inc/com/centreon/broker/rrd/output.hh b/broker/rrd/inc/com/centreon/broker/rrd/output.hh index f26ebbc7331..929b68df5d9 100644 --- a/broker/rrd/inc/com/centreon/broker/rrd/output.hh +++ b/broker/rrd/inc/com/centreon/broker/rrd/output.hh @@ -21,12 +21,11 @@ #include "bbdo/rebuild_message.pb.h" #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/rrd/backend.hh" #include "com/centreon/broker/rrd/cached.hh" #include "com/centreon/broker/rrd/lib.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace rrd { /** @@ -87,6 +86,6 @@ class output : public io::stream { } // namespace rrd -CCB_END() +} #endif // !CCB_RRD_OUTPUT_HH diff --git a/broker/rrd/src/connector.cc b/broker/rrd/src/connector.cc index cad184e3cee..b11b9e3e181 100644 --- a/broker/rrd/src/connector.cc +++ b/broker/rrd/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/rrd/connector.hh" diff --git a/broker/rrd/src/creator.cc b/broker/rrd/src/creator.cc index dcf3f8853d2..4656ca6ddec 100644 --- a/broker/rrd/src/creator.cc +++ b/broker/rrd/src/creator.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/rrd/src/factory.cc b/broker/rrd/src/factory.cc index 7ebce7d8fc3..004c40ec85a 100644 --- a/broker/rrd/src/factory.cc +++ b/broker/rrd/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/rrd/factory.hh" diff --git a/broker/rrd/src/lib.cc b/broker/rrd/src/lib.cc index 3062dc759b6..431637e2d98 100644 --- a/broker/rrd/src/lib.cc +++ b/broker/rrd/src/lib.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/rrd/lib.hh" diff --git a/broker/rrd/src/main.cc b/broker/rrd/src/main.cc index b170a9833ad..7d50e03675e 100644 --- a/broker/rrd/src/main.cc +++ b/broker/rrd/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/rrd/src/output.cc b/broker/rrd/src/output.cc index 0d6772367cf..5ac2b93a547 100644 --- a/broker/rrd/src/output.cc +++ b/broker/rrd/src/output.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2015,2017, 2020-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2015,2017, 2020-2022 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/broker/rrd/output.hh" #include "com/centreon/broker/rrd/internal.hh" @@ -38,10 +38,7 @@ using namespace com::centreon::broker; using namespace com::centreon::broker::rrd; -namespace com { -namespace centreon { -namespace broker { -namespace rrd { +namespace com::centreon::broker::rrd { template std::vector keys_of_map(const map_type& data) { @@ -153,10 +150,7 @@ output>::output(std::string const& metrics_path, _backend(metrics_path, cache_size) { _backend.connect_remote("localhost", port); } -} // namespace rrd -} // namespace broker -} // namespace centreon -} // namespace com +} // namespace com::centreon::broker::rrd /** * Read data. diff --git a/broker/rrd/test/cached.cc b/broker/rrd/test/cached.cc index 6c9d5c01a75..279ece2fae5 100644 --- a/broker/rrd/test/cached.cc +++ b/broker/rrd/test/cached.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/rrd/test/exceptions.cc b/broker/rrd/test/exceptions.cc index e5592a2e7dc..4be875ba5d6 100644 --- a/broker/rrd/test/exceptions.cc +++ b/broker/rrd/test/exceptions.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/rrd/test/factory.cc b/broker/rrd/test/factory.cc index 7564e75cd54..2bd311b5cc9 100644 --- a/broker/rrd/test/factory.cc +++ b/broker/rrd/test/factory.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/rrd/test/lib.cc b/broker/rrd/test/lib.cc index 349d7c317eb..6164fd0666f 100644 --- a/broker/rrd/test/lib.cc +++ b/broker/rrd/test/lib.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/rrd/test/rrd.cc b/broker/rrd/test/rrd.cc index 471847328d1..8b1ab1dc293 100644 --- a/broker/rrd/test/rrd.cc +++ b/broker/rrd/test/rrd.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/simu/inc/com/centreon/broker/simu/connector.hh b/broker/simu/inc/com/centreon/broker/simu/connector.hh index 6c52147f2db..8309733124d 100644 --- a/broker/simu/inc/com/centreon/broker/simu/connector.hh +++ b/broker/simu/inc/com/centreon/broker/simu/connector.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/endpoint.hh" #include "com/centreon/broker/misc/variant.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace simu { /** @@ -45,6 +45,6 @@ class connector : public io::endpoint { }; } // namespace simu -CCB_END() +} #endif // !CCB_SIMU_CONNECTOR_HH diff --git a/broker/simu/inc/com/centreon/broker/simu/factory.hh b/broker/simu/inc/com/centreon/broker/simu/factory.hh index 7e7c3beacf6..c58775756f6 100644 --- a/broker/simu/inc/com/centreon/broker/simu/factory.hh +++ b/broker/simu/inc/com/centreon/broker/simu/factory.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/io/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace simu { /** @@ -45,6 +45,6 @@ class factory : public io::factory { }; } // namespace simu -CCB_END() +} #endif // !CCB_SIMU_FACTORY_HH diff --git a/broker/simu/inc/com/centreon/broker/simu/luabinding.hh b/broker/simu/inc/com/centreon/broker/simu/luabinding.hh index 74b771a83f0..4bc310e6449 100644 --- a/broker/simu/inc/com/centreon/broker/simu/luabinding.hh +++ b/broker/simu/inc/com/centreon/broker/simu/luabinding.hh @@ -28,7 +28,7 @@ extern "C" { #include "lualib.h" } -CCB_BEGIN() +namespace com::centreon::broker { namespace simu { /** @@ -70,6 +70,6 @@ class luabinding { }; } // namespace simu -CCB_END() +} #endif // !CCB_SIMU_SIMU_HH diff --git a/broker/simu/inc/com/centreon/broker/simu/stream.hh b/broker/simu/inc/com/centreon/broker/simu/stream.hh index 63d59ae364d..0512da45874 100644 --- a/broker/simu/inc/com/centreon/broker/simu/stream.hh +++ b/broker/simu/inc/com/centreon/broker/simu/stream.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/stream.hh" #include "com/centreon/broker/misc/variant.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace simu { @@ -51,6 +51,6 @@ class stream : public io::stream { }; } // namespace simu -CCB_END() +} #endif // !CCB_SIMU_STREAM_HH diff --git a/broker/simu/src/connector.cc b/broker/simu/src/connector.cc index 5579aa9cf8b..d524810e33a 100644 --- a/broker/simu/src/connector.cc +++ b/broker/simu/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/simu/connector.hh" diff --git a/broker/simu/src/factory.cc b/broker/simu/src/factory.cc index 7fccf669ee0..ef35cc8dd32 100644 --- a/broker/simu/src/factory.cc +++ b/broker/simu/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/simu/factory.hh" diff --git a/broker/simu/src/luabinding.cc b/broker/simu/src/luabinding.cc index 5e25f02936c..3fe248d30f4 100644 --- a/broker/simu/src/luabinding.cc +++ b/broker/simu/src/luabinding.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/simu/luabinding.hh" diff --git a/broker/simu/src/main.cc b/broker/simu/src/main.cc index 9930962b3bf..d2ae98ee8de 100644 --- a/broker/simu/src/main.cc +++ b/broker/simu/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/storage/index_mapping.hh" diff --git a/broker/simu/src/stream.cc b/broker/simu/src/stream.cc index 51cc3fe89e9..5cbd156629e 100644 --- a/broker/simu/src/stream.cc +++ b/broker/simu/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/simu/stream.hh" diff --git a/broker/simu/test/simu.cc b/broker/simu/test/simu.cc index 34fd90c6e77..02dd951b515 100644 --- a/broker/simu/test/simu.cc +++ b/broker/simu/test/simu.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/sql/inc/com/centreon/broker/sql/cleanup.hh b/broker/sql/inc/com/centreon/broker/sql/cleanup.hh index 840fb3c04f3..57e3c44d517 100644 --- a/broker/sql/inc/com/centreon/broker/sql/cleanup.hh +++ b/broker/sql/inc/com/centreon/broker/sql/cleanup.hh @@ -19,9 +19,8 @@ #ifndef CCB_SQL_CLEANUP_HH #define CCB_SQL_CLEANUP_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace sql { /** @@ -68,6 +67,6 @@ class cleanup { }; } // namespace sql -CCB_END() +} #endif // !CCB_SQL_CLEANUP_HH diff --git a/broker/sql/inc/com/centreon/broker/sql/connector.hh b/broker/sql/inc/com/centreon/broker/sql/connector.hh index 9e999aa582a..e610fd098da 100644 --- a/broker/sql/inc/com/centreon/broker/sql/connector.hh +++ b/broker/sql/inc/com/centreon/broker/sql/connector.hh @@ -20,10 +20,9 @@ #define CCB_SQL_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace sql { /** @@ -55,6 +54,6 @@ class connector : public io::endpoint { }; } // namespace sql -CCB_END() +} #endif // !CCB_SQL_CONNECTOR_HH diff --git a/broker/sql/inc/com/centreon/broker/sql/factory.hh b/broker/sql/inc/com/centreon/broker/sql/factory.hh index d96caa2de91..7377423fd60 100644 --- a/broker/sql/inc/com/centreon/broker/sql/factory.hh +++ b/broker/sql/inc/com/centreon/broker/sql/factory.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/io/extension.hh" #include "com/centreon/broker/io/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace sql { /** @@ -45,6 +45,6 @@ class factory : public io::factory { }; } // namespace sql -CCB_END() +} #endif // !CCB_SQL_FACTORY_HH diff --git a/broker/sql/inc/com/centreon/broker/sql/stream.hh b/broker/sql/inc/com/centreon/broker/sql/stream.hh index da60477bfa7..71330fef971 100644 --- a/broker/sql/inc/com/centreon/broker/sql/stream.hh +++ b/broker/sql/inc/com/centreon/broker/sql/stream.hh @@ -20,11 +20,10 @@ #define CCB_SQL_STREAM_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/cleanup.hh" #include "com/centreon/broker/sql/mysql.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace sql { /** @@ -71,6 +70,6 @@ class stream : public io::stream { }; } // namespace sql -CCB_END() +} #endif // !CCB_SQL_STREAM_HH diff --git a/broker/sql/src/cleanup.cc b/broker/sql/src/cleanup.cc index bba746862ea..a2502c5af92 100644 --- a/broker/sql/src/cleanup.cc +++ b/broker/sql/src/cleanup.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/cleanup.hh" diff --git a/broker/sql/src/connector.cc b/broker/sql/src/connector.cc index db1eeff846b..62941d336b2 100644 --- a/broker/sql/src/connector.cc +++ b/broker/sql/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2012,2015-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2012,2015-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/connector.hh" diff --git a/broker/sql/src/factory.cc b/broker/sql/src/factory.cc index 277bac7ffc5..87b6cc45925 100644 --- a/broker/sql/src/factory.cc +++ b/broker/sql/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/factory.hh" diff --git a/broker/sql/src/main.cc b/broker/sql/src/main.cc index ce0abde021f..3b26fb44752 100644 --- a/broker/sql/src/main.cc +++ b/broker/sql/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/protocols.hh" diff --git a/broker/sql/src/stream.cc b/broker/sql/src/stream.cc index 50adf187951..46c5d1a3505 100644 --- a/broker/sql/src/stream.cc +++ b/broker/sql/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/sql/stream.hh" diff --git a/broker/stats/inc/com/centreon/broker/stats/builder.hh b/broker/stats/inc/com/centreon/broker/stats/builder.hh index 7cd8f3834c5..6b5dfc7a54b 100644 --- a/broker/stats/inc/com/centreon/broker/stats/builder.hh +++ b/broker/stats/inc/com/centreon/broker/stats/builder.hh @@ -21,9 +21,8 @@ #define CCB_STATS_BUILDER_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declarations. namespace processing { @@ -51,6 +50,6 @@ class builder { }; } // namespace stats -CCB_END() +} #endif // !CCB_STATS_BUILDER_HH diff --git a/broker/stats/inc/com/centreon/broker/stats/parser.hh b/broker/stats/inc/com/centreon/broker/stats/parser.hh index af811822c79..671c4629c3f 100644 --- a/broker/stats/inc/com/centreon/broker/stats/parser.hh +++ b/broker/stats/inc/com/centreon/broker/stats/parser.hh @@ -20,9 +20,8 @@ #ifndef CCB_STATS_PARSER_HH #define CCB_STATS_PARSER_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace stats { // Forward declaration. @@ -46,6 +45,6 @@ class parser { }; } // namespace stats -CCB_END() +} #endif // !CCB_STATS_PARSER_HH diff --git a/broker/stats/src/builder.cc b/broker/stats/src/builder.cc index 8b0c9885dd7..b06f1fbbd22 100644 --- a/broker/stats/src/builder.cc +++ b/broker/stats/src/builder.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats/src/main.cc b/broker/stats/src/main.cc index 38cec278778..d15055b0a81 100644 --- a/broker/stats/src/main.cc +++ b/broker/stats/src/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats/src/parser.cc b/broker/stats/src/parser.cc index 03ce83d2878..35596e8c500 100644 --- a/broker/stats/src/parser.cc +++ b/broker/stats/src/parser.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats/src/worker.cc b/broker/stats/src/worker.cc index e2c296d2fc6..f9fded36267 100644 --- a/broker/stats/src/worker.cc +++ b/broker/stats/src/worker.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats/src/worker_pool.cc b/broker/stats/src/worker_pool.cc index 8f5e6332e98..ce7a7fb1574 100644 --- a/broker/stats/src/worker_pool.cc +++ b/broker/stats/src/worker_pool.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats/test/stats.cc b/broker/stats/test/stats.cc index ee048b0f3c3..5a9f176d9f0 100644 --- a/broker/stats/test/stats.cc +++ b/broker/stats/test/stats.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter.hh b/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter.hh index d712ebaadb9..c2ff14160ab 100644 --- a/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter.hh +++ b/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter.hh @@ -27,12 +27,11 @@ #include "broker.pb.h" #include "com/centreon/broker/config/state.hh" -#include "com/centreon/broker/namespace.hh" namespace metric_sdk = opentelemetry::sdk::metrics; namespace metrics_api = opentelemetry::metrics; -CCB_BEGIN() +namespace com::centreon::broker { namespace stats_exporter { /** @@ -178,6 +177,6 @@ class exporter { } // namespace stats_exporter -CCB_END() +} #endif /* !CCB_STATS_EXPORTER_EXPORTER_HH */ diff --git a/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_grpc.hh b/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_grpc.hh index 0b7f2f58c0b..1f2ab1c995c 100644 --- a/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_grpc.hh +++ b/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_grpc.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/stats_exporter/exporter.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace stats_exporter { /** @@ -40,6 +40,6 @@ class exporter_grpc : public exporter { } // namespace stats_exporter -CCB_END() +} #endif /* !CCB_STATS_EXPORTER_EXPORTER_GRPC_HH */ diff --git a/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_http.hh b/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_http.hh index 089c4ee0ce1..f12c5d01751 100644 --- a/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_http.hh +++ b/broker/stats_exporter/inc/com/centreon/broker/stats_exporter/exporter_http.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/stats_exporter/exporter.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace stats_exporter { /** @@ -40,6 +40,6 @@ class exporter_http : public exporter { } // namespace stats_exporter -CCB_END() +} #endif /* !CCB_STATS_EXPORTER_EXPORTER_HTTP_HH */ diff --git a/broker/stats_exporter/src/exporter.cc b/broker/stats_exporter/src/exporter.cc index fb0082b77a4..36ae74d4fbc 100644 --- a/broker/stats_exporter/src/exporter.cc +++ b/broker/stats_exporter/src/exporter.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/stats_exporter/exporter.hh" diff --git a/broker/stats_exporter/src/exporter_grpc.cc b/broker/stats_exporter/src/exporter_grpc.cc index d47380fb21e..9e2479d5f1e 100644 --- a/broker/stats_exporter/src/exporter_grpc.cc +++ b/broker/stats_exporter/src/exporter_grpc.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats_exporter/src/exporter_http.cc b/broker/stats_exporter/src/exporter_http.cc index 71135cabdb5..0160dd38059 100644 --- a/broker/stats_exporter/src/exporter_http.cc +++ b/broker/stats_exporter/src/exporter_http.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/stats_exporter/src/main.cc b/broker/stats_exporter/src/main.cc index c91542f36b7..ccf75b07677 100644 --- a/broker/stats_exporter/src/main.cc +++ b/broker/stats_exporter/src/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,6 @@ #include "com/centreon/broker/config/state.hh" #include "com/centreon/broker/log_v2.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/stats_exporter/exporter_grpc.hh" #include "com/centreon/broker/stats_exporter/exporter_http.hh" diff --git a/broker/storage/CMakeLists.txt b/broker/storage/CMakeLists.txt index 75c2d0560df..34da1d4f143 100644 --- a/broker/storage/CMakeLists.txt +++ b/broker/storage/CMakeLists.txt @@ -25,9 +25,6 @@ include_directories("${PROJECT_SOURCE_DIR}/neb/inc") include_directories("${CMAKE_SOURCE_DIR}") set(INC_DIR "${INC_DIR}/com/centreon/broker/storage") -get_protobuf_files(rebuild_message) -get_protobuf_files(remove_graph_message) - # conflict_manager library. add_library( conflictmgr STATIC @@ -59,8 +56,6 @@ add_library( "${SRC_DIR}/main.cc" "${SRC_DIR}/rebuilder.cc" "${SRC_DIR}/stream.cc" - ${proto_rebuild_message} - ${proto_remove_graph_message} # Headers. "${INC_DIR}/connector.hh" "${INC_DIR}/events.hh" @@ -70,7 +65,8 @@ add_library( set_target_properties("${STORAGE}" PROPERTIES PREFIX "" COMPILE_FLAGS "-fPIC") add_dependencies("${STORAGE}" target_rebuild_message target_remove_graph_message table_max_size) -target_link_libraries(${STORAGE} conflictmgr rokerbase bbdo_storage) +target_link_libraries(${STORAGE} conflictmgr rokerbase bbdo_storage + pb_rebuild_message_lib pb_remove_graph_message_lib) target_precompile_headers(${STORAGE} REUSE_FROM conflictmgr) # Testing. diff --git a/broker/storage/inc/com/centreon/broker/storage/conflict_manager.hh b/broker/storage/inc/com/centreon/broker/storage/conflict_manager.hh index 67f34132651..1c06d7e2eb8 100644 --- a/broker/storage/inc/com/centreon/broker/storage/conflict_manager.hh +++ b/broker/storage/inc/com/centreon/broker/storage/conflict_manager.hh @@ -27,7 +27,7 @@ #include "com/centreon/broker/storage/rebuilder.hh" #include "com/centreon/broker/storage/stored_timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { /* Forward declarations */ namespace neb { class service_status; @@ -382,6 +382,6 @@ class conflict_manager { void remove_graphs(const std::shared_ptr& d); }; } // namespace storage -CCB_END() +} #endif /* !CCB_SQL_CONFLICT_MANAGER_HH */ diff --git a/broker/storage/inc/com/centreon/broker/storage/connector.hh b/broker/storage/inc/com/centreon/broker/storage/connector.hh index 09f01cb271f..18c581bb0d8 100644 --- a/broker/storage/inc/com/centreon/broker/storage/connector.hh +++ b/broker/storage/inc/com/centreon/broker/storage/connector.hh @@ -20,10 +20,9 @@ #define CCB_STORAGE_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { /** @@ -52,6 +51,6 @@ class connector : public io::endpoint { }; } // namespace storage -CCB_END() +} #endif // !CCB_STORAGE_CONNECTOR_HH diff --git a/broker/storage/inc/com/centreon/broker/storage/factory.hh b/broker/storage/inc/com/centreon/broker/storage/factory.hh index 5c421563e20..30bd9da1387 100644 --- a/broker/storage/inc/com/centreon/broker/storage/factory.hh +++ b/broker/storage/inc/com/centreon/broker/storage/factory.hh @@ -20,9 +20,8 @@ #define CCB_STORAGE_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { /** @@ -45,6 +44,6 @@ class factory : public io::factory { }; } // namespace storage -CCB_END() +} #endif // !CCB_STORAGE_FACTORY_HH diff --git a/broker/storage/inc/com/centreon/broker/storage/internal.hh b/broker/storage/inc/com/centreon/broker/storage/internal.hh index bdf364cbba3..32752b3c8d1 100644 --- a/broker/storage/inc/com/centreon/broker/storage/internal.hh +++ b/broker/storage/inc/com/centreon/broker/storage/internal.hh @@ -25,7 +25,7 @@ #include "broker/core/src/broker.pb.h" #include "com/centreon/broker/io/protobuf.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bbdo { /** @@ -48,6 +48,6 @@ using pb_remove_graph_message = io::protobuf; } // namespace storage -CCB_END() +} #endif // !CCB_STORAGE_INTERNAL_HH diff --git a/broker/storage/inc/com/centreon/broker/storage/rebuilder.hh b/broker/storage/inc/com/centreon/broker/storage/rebuilder.hh index 57975160e9d..0ffbd81faa0 100644 --- a/broker/storage/inc/com/centreon/broker/storage/rebuilder.hh +++ b/broker/storage/inc/com/centreon/broker/storage/rebuilder.hh @@ -19,12 +19,11 @@ #ifndef CCB_STORAGE_REBUILDER_HH #define CCB_STORAGE_REBUILDER_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/pool.hh" #include "com/centreon/broker/sql/database_config.hh" #include "com/centreon/broker/sql/mysql.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { class stream; @@ -70,6 +69,6 @@ class rebuilder { }; } // namespace storage -CCB_END() +} #endif // !CCB_STORAGE_REBUILDER_HH diff --git a/broker/storage/inc/com/centreon/broker/storage/stored_timestamp.hh b/broker/storage/inc/com/centreon/broker/storage/stored_timestamp.hh index 37e9881eb86..4c9791b487b 100644 --- a/broker/storage/inc/com/centreon/broker/storage/stored_timestamp.hh +++ b/broker/storage/inc/com/centreon/broker/storage/stored_timestamp.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace storage { /** @@ -59,6 +59,6 @@ class stored_timestamp { }; } // namespace storage -CCB_END() +} #endif //! CCB_SQL_STORED_TIMESTAMP_HH diff --git a/broker/storage/inc/com/centreon/broker/storage/stream.hh b/broker/storage/inc/com/centreon/broker/storage/stream.hh index 63d4946877f..73eff70f171 100644 --- a/broker/storage/inc/com/centreon/broker/storage/stream.hh +++ b/broker/storage/inc/com/centreon/broker/storage/stream.hh @@ -20,10 +20,9 @@ #define CCB_STORAGE_STREAM_HH #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/mysql.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. class database_config; @@ -90,6 +89,6 @@ class stream : public io::stream { }; } // namespace storage -CCB_END() +} #endif // !CCB_STORAGE_STREAM_HH diff --git a/broker/storage/src/conflict_manager.cc b/broker/storage/src/conflict_manager.cc index 28557d50f83..c3ad0f6b9cc 100644 --- a/broker/storage/src/conflict_manager.cc +++ b/broker/storage/src/conflict_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2019-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2019-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/storage/conflict_manager.hh" diff --git a/broker/storage/src/conflict_manager_sql.cc b/broker/storage/src/conflict_manager_sql.cc index 4fa1608ac73..95eb096e5e9 100644 --- a/broker/storage/src/conflict_manager_sql.cc +++ b/broker/storage/src/conflict_manager_sql.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2019-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2019-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/storage/src/conflict_manager_storage.cc b/broker/storage/src/conflict_manager_storage.cc index 3128ec96b38..e11b01673e6 100644 --- a/broker/storage/src/conflict_manager_storage.cc +++ b/broker/storage/src/conflict_manager_storage.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2019-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2019-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/storage/src/connector.cc b/broker/storage/src/connector.cc index 7ed83a9245a..013dfa81788 100644 --- a/broker/storage/src/connector.cc +++ b/broker/storage/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/storage/connector.hh" diff --git a/broker/storage/src/factory.cc b/broker/storage/src/factory.cc index 0e16c8d5654..814f79c0968 100644 --- a/broker/storage/src/factory.cc +++ b/broker/storage/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/storage/factory.hh" diff --git a/broker/storage/src/main.cc b/broker/storage/src/main.cc index 77b45cc16d2..dec12f0ded9 100644 --- a/broker/storage/src/main.cc +++ b/broker/storage/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/events.hh" diff --git a/broker/storage/src/rebuilder.cc b/broker/storage/src/rebuilder.cc index 3a61334ce88..4842288d174 100644 --- a/broker/storage/src/rebuilder.cc +++ b/broker/storage/src/rebuilder.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015,2017,2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015,2017,2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/storage/rebuilder.hh" diff --git a/broker/storage/src/stored_timestamp.cc b/broker/storage/src/stored_timestamp.cc index 5f532bfeada..8314c052d88 100644 --- a/broker/storage/src/stored_timestamp.cc +++ b/broker/storage/src/stored_timestamp.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/storage/stored_timestamp.hh" diff --git a/broker/storage/src/stream.cc b/broker/storage/src/stream.cc index 4ddaf367643..75b7a05a56b 100644 --- a/broker/storage/src/stream.cc +++ b/broker/storage/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/storage/stream.hh" diff --git a/broker/storage/test/conflict_manager.cc b/broker/storage/test/conflict_manager.cc index 44040cd3311..e382ba721c2 100644 --- a/broker/storage/test/conflict_manager.cc +++ b/broker/storage/test/conflict_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/storage/conflict_manager.hh" diff --git a/broker/storage/test/connector.cc b/broker/storage/test/connector.cc index 379137c5766..958c2468018 100644 --- a/broker/storage/test/connector.cc +++ b/broker/storage/test/connector.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/storage/test/metric.cc b/broker/storage/test/metric.cc index 79ca79da04f..8685e0edc1b 100644 --- a/broker/storage/test/metric.cc +++ b/broker/storage/test/metric.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/storage/test/perfdata.cc b/broker/storage/test/perfdata.cc index 9bd2f953e20..88708574b66 100644 --- a/broker/storage/test/perfdata.cc +++ b/broker/storage/test/perfdata.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/storage/test/remove_graph.cc b/broker/storage/test/remove_graph.cc index 3f44941b5d3..734444b3cb7 100644 --- a/broker/storage/test/remove_graph.cc +++ b/broker/storage/test/remove_graph.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/storage/test/status-entry.cc b/broker/storage/test/status-entry.cc index 3b24c6abb1a..6a6d406dcc0 100644 --- a/broker/storage/test/status-entry.cc +++ b/broker/storage/test/status-entry.cc @@ -1,4 +1,4 @@ -/* +/** * * Copyright 2021 Centreon (https://www.centreon.com/) * * * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/storage/test/status.cc b/broker/storage/test/status.cc index 47c8a6c6307..2676bfeda64 100644 --- a/broker/storage/test/status.cc +++ b/broker/storage/test/status.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/inc/com/centreon/broker/tcp/acceptor.hh b/broker/tcp/inc/com/centreon/broker/tcp/acceptor.hh index 0997966206c..ff3a96849e1 100644 --- a/broker/tcp/inc/com/centreon/broker/tcp/acceptor.hh +++ b/broker/tcp/inc/com/centreon/broker/tcp/acceptor.hh @@ -20,10 +20,9 @@ #define CCB_TCP_ACCEPTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/tcp/tcp_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tcp { /** @@ -55,6 +54,6 @@ class acceptor : public io::endpoint { }; } // namespace tcp -CCB_END() +} #endif // !CCB_TCP_ACCEPTOR_HH diff --git a/broker/tcp/inc/com/centreon/broker/tcp/connector.hh b/broker/tcp/inc/com/centreon/broker/tcp/connector.hh index a893cf5785a..6d9f8c9a1eb 100644 --- a/broker/tcp/inc/com/centreon/broker/tcp/connector.hh +++ b/broker/tcp/inc/com/centreon/broker/tcp/connector.hh @@ -20,10 +20,9 @@ #define CCB_TCP_CONNECTOR_HH #include "com/centreon/broker/io/limit_endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/tcp/tcp_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tcp { /** @@ -48,6 +47,6 @@ class connector : public io::limit_endpoint { }; } // namespace tcp -CCB_END() +} #endif // !CCB_TCP_CONNECTOR_HH diff --git a/broker/tcp/inc/com/centreon/broker/tcp/factory.hh b/broker/tcp/inc/com/centreon/broker/tcp/factory.hh index a0b8592424a..6ef7e48e2b6 100644 --- a/broker/tcp/inc/com/centreon/broker/tcp/factory.hh +++ b/broker/tcp/inc/com/centreon/broker/tcp/factory.hh @@ -20,9 +20,8 @@ #define CCB_TCP_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tcp { /** @@ -51,6 +50,6 @@ class factory : public io::factory { }; } // namespace tcp -CCB_END() +} #endif // !CCB_TCP_FACTORY_HH diff --git a/broker/tcp/inc/com/centreon/broker/tcp/stream.hh b/broker/tcp/inc/com/centreon/broker/tcp/stream.hh index 1293178bd62..74b412d868c 100644 --- a/broker/tcp/inc/com/centreon/broker/tcp/stream.hh +++ b/broker/tcp/inc/com/centreon/broker/tcp/stream.hh @@ -23,7 +23,7 @@ #include "com/centreon/broker/tcp/tcp_config.hh" #include "com/centreon/broker/tcp/tcp_connection.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tcp { // Forward declaration. @@ -58,6 +58,6 @@ class stream : public io::stream { }; } // namespace tcp -CCB_END() +} #endif // !CCB_TCP_STREAM_HH diff --git a/broker/tcp/inc/com/centreon/broker/tcp/tcp_async.hh b/broker/tcp/inc/com/centreon/broker/tcp/tcp_async.hh index 3f5172c3d19..6205deed448 100644 --- a/broker/tcp/inc/com/centreon/broker/tcp/tcp_async.hh +++ b/broker/tcp/inc/com/centreon/broker/tcp/tcp_async.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/tcp/tcp_config.hh" #include "com/centreon/broker/tcp/tcp_connection.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tcp { /** @@ -108,5 +108,5 @@ class tcp_async : public std::enable_shared_from_this { }; } // namespace tcp -CCB_END() +} #endif // CENTREON_BROKER_TCP_INC_COM_CENTREON_BROKER_TCP_TCP_ASYNC_HH_ diff --git a/broker/tcp/inc/com/centreon/broker/tcp/tcp_config.hh b/broker/tcp/inc/com/centreon/broker/tcp/tcp_config.hh index f5be3aa3a59..16f5b7c20a2 100644 --- a/broker/tcp/inc/com/centreon/broker/tcp/tcp_config.hh +++ b/broker/tcp/inc/com/centreon/broker/tcp/tcp_config.hh @@ -19,7 +19,7 @@ #ifndef CCB_TCP_CONFIG_HH #define CCB_TCP_CONFIG_HH -CCB_BEGIN() +namespace com::centreon::broker { namespace tcp { class tcp_config { @@ -54,6 +54,6 @@ class tcp_config { } // namespace tcp -CCB_END() +} #endif diff --git a/broker/tcp/inc/com/centreon/broker/tcp/tcp_connection.hh b/broker/tcp/inc/com/centreon/broker/tcp/tcp_connection.hh index caf0d192cf0..b677865bf61 100644 --- a/broker/tcp/inc/com/centreon/broker/tcp/tcp_connection.hh +++ b/broker/tcp/inc/com/centreon/broker/tcp/tcp_connection.hh @@ -18,9 +18,8 @@ #ifndef CENTREON_BROKER_TCP_CONNECTION_HH #define CENTREON_BROKER_TCP_CONNECTION_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tcp { @@ -86,6 +85,6 @@ class tcp_connection : public std::enable_shared_from_this { } // namespace tcp -CCB_END() +} #endif /* !CENTREON_BROKER_TCP_CONNECTION_HH */ diff --git a/broker/tcp/src/acceptor.cc b/broker/tcp/src/acceptor.cc index ab38cb32060..b1beb868d8d 100644 --- a/broker/tcp/src/acceptor.cc +++ b/broker/tcp/src/acceptor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/src/connector.cc b/broker/tcp/src/connector.cc index 78181d91311..f97dbcd713b 100644 --- a/broker/tcp/src/connector.cc +++ b/broker/tcp/src/connector.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/src/factory.cc b/broker/tcp/src/factory.cc index 31297537425..9a368560359 100644 --- a/broker/tcp/src/factory.cc +++ b/broker/tcp/src/factory.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019-2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/src/main.cc b/broker/tcp/src/main.cc index 690895c1cfb..9cff5b710ee 100644 --- a/broker/tcp/src/main.cc +++ b/broker/tcp/src/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/src/stream.cc b/broker/tcp/src/stream.cc index ba47149d8fc..8ed8d3b6b06 100644 --- a/broker/tcp/src/stream.cc +++ b/broker/tcp/src/stream.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/src/tcp_async.cc b/broker/tcp/src/tcp_async.cc index bf772b28bf9..47650dd00bc 100644 --- a/broker/tcp/src/tcp_async.cc +++ b/broker/tcp/src/tcp_async.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tcp/tcp_async.hh" diff --git a/broker/tcp/src/tcp_connection.cc b/broker/tcp/src/tcp_connection.cc index 0e3a15f568f..d5048c442ec 100644 --- a/broker/tcp/src/tcp_connection.cc +++ b/broker/tcp/src/tcp_connection.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tcp/tcp_connection.hh" diff --git a/broker/tcp/test/acceptor.cc b/broker/tcp/test/acceptor.cc index 6eef229ec9f..5a91b38023b 100644 --- a/broker/tcp/test/acceptor.cc +++ b/broker/tcp/test/acceptor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/test/connector.cc b/broker/tcp/test/connector.cc index 146302f5977..e431c60943f 100644 --- a/broker/tcp/test/connector.cc +++ b/broker/tcp/test/connector.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tcp/test/factory.cc b/broker/tcp/test/factory.cc index 4b0a66ceed6..05feac147a8 100644 --- a/broker/tcp/test/factory.cc +++ b/broker/tcp/test/factory.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/test/CMakeLists.txt b/broker/test/CMakeLists.txt index 1fcaeddaaef..ceeaf93f23a 100644 --- a/broker/test/CMakeLists.txt +++ b/broker/test/CMakeLists.txt @@ -24,6 +24,7 @@ set(BAM_TESTS_DIR ${PROJECT_SOURCE_DIR}/bam/test) set(WDOG_TESTS_DIR ${PROJECT_SOURCE_DIR}/watchdog/test) # Include directories. +include_directories(${CMAKE_SOURCE_DIR}/bbdo) include_directories(${PROJECT_SOURCE_DIR}/bam/inc) include_directories(${PROJECT_SOURCE_DIR}/bam/test) include_directories(${PROJECT_SOURCE_DIR}/storage/src) diff --git a/broker/test/automatic_retention.cc b/broker/test/automatic_retention.cc index ef1b3f2aac5..43af64a14aa 100644 --- a/broker/test/automatic_retention.cc +++ b/broker/test/automatic_retention.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bam/v2/main.cc b/broker/test/bam/v2/main.cc index 371d1153f70..64293b7714a 100644 --- a/broker/test/bam/v2/main.cc +++ b/broker/test/bam/v2/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bam_boolexp_retention.cc b/broker/test/bam_boolexp_retention.cc index 8c2b3074a71..2e7726acb69 100644 --- a/broker/test/bam_boolexp_retention.cc +++ b/broker/test/bam_boolexp_retention.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bam_circular.cc b/broker/test/bam_circular.cc index 62573e5c9a7..9fbab96d59d 100644 --- a/broker/test/bam_circular.cc +++ b/broker/test/bam_circular.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bam_correlation.cc b/broker/test/bam_correlation.cc index 5557d337f86..3ee92faf0ab 100644 --- a/broker/test/bam_correlation.cc +++ b/broker/test/bam_correlation.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bam_dimension.cc b/broker/test/bam_dimension.cc index cf58c894c0f..281985cc390 100644 --- a/broker/test/bam_dimension.cc +++ b/broker/test/bam_dimension.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bam_events_autoclose.cc b/broker/test/bam_events_autoclose.cc index b5b8c38f9cd..7cfb2c1690d 100644 --- a/broker/test/bam_events_autoclose.cc +++ b/broker/test/bam_events_autoclose.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bam_rebuild.cc b/broker/test/bam_rebuild.cc index 4e05b6553d7..3d78a7c89cb 100644 --- a/broker/test/bam_rebuild.cc +++ b/broker/test/bam_rebuild.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bbdo_multiple_connections.cc b/broker/test/bbdo_multiple_connections.cc index 28681306d12..eb9a52d48b2 100644 --- a/broker/test/bbdo_multiple_connections.cc +++ b/broker/test/bbdo_multiple_connections.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bbdo_one_peer_retention_mode.cc b/broker/test/bbdo_one_peer_retention_mode.cc index 06855185f16..76592e3735d 100644 --- a/broker/test/bbdo_one_peer_retention_mode.cc +++ b/broker/test/bbdo_one_peer_retention_mode.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bbdo_protocol_version.cc b/broker/test/bbdo_protocol_version.cc index f808f951687..5e3bd3dbe25 100644 --- a/broker/test/bbdo_protocol_version.cc +++ b/broker/test/bbdo_protocol_version.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bench_bbdo.cc b/broker/test/bench_bbdo.cc index fe875226826..ab2d1d8a667 100644 --- a/broker/test/bench_bbdo.cc +++ b/broker/test/bench_bbdo.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bench_generate_rrd.cc b/broker/test/bench_generate_rrd.cc index 3322ba07da0..4e6461cbe79 100644 --- a/broker/test/bench_generate_rrd.cc +++ b/broker/test/bench_generate_rrd.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/bench_generate_rrd_mod.cc b/broker/test/bench_generate_rrd_mod.cc index 527742e920e..ddc7ca1db3d 100644 --- a/broker/test/bench_generate_rrd_mod.cc +++ b/broker/test/bench_generate_rrd_mod.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/bench_generate_rrd_mod.hh" diff --git a/broker/test/bench_stream.cc b/broker/test/bench_stream.cc index c155b9e50e0..3b9121fb37d 100644 --- a/broker/test/bench_stream.cc +++ b/broker/test/bench_stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/bench_stream.hh" diff --git a/broker/test/broker_extcmd.cc b/broker/test/broker_extcmd.cc index 4e694b378ad..0236d826248 100644 --- a/broker/test/broker_extcmd.cc +++ b/broker/test/broker_extcmd.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/broker_extcmd.hh" diff --git a/broker/test/cbd.cc b/broker/test/cbd.cc index f2b0eecb226..9d8bf4f206a 100644 --- a/broker/test/cbd.cc +++ b/broker/test/cbd.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/cbd.hh" diff --git a/broker/test/cbd.hh b/broker/test/cbd.hh index 893ebccc2c1..fe6bf50d1a2 100644 --- a/broker/test/cbd.hh +++ b/broker/test/cbd.hh @@ -20,9 +20,8 @@ #define TEST_CBD_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -50,6 +49,6 @@ class cbd { }; } // namespace test -CCB_END() +} #endif // !TEST_CBD_HH diff --git a/broker/test/centengine.cc b/broker/test/centengine.cc index b7ba2c5d7ab..1bcd4ce8784 100644 --- a/broker/test/centengine.cc +++ b/broker/test/centengine.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/centengine.hh" diff --git a/broker/test/centengine.hh b/broker/test/centengine.hh index b556e41714c..1f61c617860 100644 --- a/broker/test/centengine.hh +++ b/broker/test/centengine.hh @@ -20,11 +20,10 @@ #define CCB_TEST_CENTENGINE_HH #include -#include "com/centreon/broker/namespace.hh" #include "test/centengine_config.hh" #include "test/centengine_extcmd.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -55,6 +54,6 @@ class centengine { }; } // namespace test -CCB_END() +} #endif // !CCB_TEST_CENTENGINE_HH diff --git a/broker/test/centengine_config.cc b/broker/test/centengine_config.cc index 1fe9a8abb5e..15cfffa6bbf 100644 --- a/broker/test/centengine_config.cc +++ b/broker/test/centengine_config.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/centengine_config.hh" diff --git a/broker/test/centengine_config.hh b/broker/test/centengine_config.hh index 40e37462151..dd4eacdcdaf 100644 --- a/broker/test/centengine_config.hh +++ b/broker/test/centengine_config.hh @@ -21,10 +21,9 @@ #include #include -#include "com/centreon/broker/namespace.hh" #include "test/centengine_object.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -91,6 +90,6 @@ class centengine_config { }; } // namespace test -CCB_END() +} #endif // !CCB_TEST_CENTENGINE_CONFIG_HH diff --git a/broker/test/centengine_extcmd.cc b/broker/test/centengine_extcmd.cc index 6e1bad461dc..1b5a091798d 100644 --- a/broker/test/centengine_extcmd.cc +++ b/broker/test/centengine_extcmd.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/centengine_extcmd.hh" diff --git a/broker/test/centengine_object.cc b/broker/test/centengine_object.cc index 76766ac229a..1e1aaf3e0c1 100644 --- a/broker/test/centengine_object.cc +++ b/broker/test/centengine_object.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/centengine_object.hh" diff --git a/broker/test/centengine_object.hh b/broker/test/centengine_object.hh index aeee5d1ce05..27f02ce40ee 100644 --- a/broker/test/centengine_object.hh +++ b/broker/test/centengine_object.hh @@ -21,9 +21,8 @@ #include #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -58,6 +57,6 @@ class centengine_object { }; } // namespace test -CCB_END() +} #endif // !CCB_TEST_CENTENGINE_OBJECT_HH diff --git a/broker/test/correlation_to_sql.cc b/broker/test/correlation_to_sql.cc index 183e237aa56..8e506a84bae 100644 --- a/broker/test/correlation_to_sql.cc +++ b/broker/test/correlation_to_sql.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/db.cc b/broker/test/db.cc index c5f1106a710..0266901c5e9 100644 --- a/broker/test/db.cc +++ b/broker/test/db.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/db.hh" diff --git a/broker/test/db.hh b/broker/test/db.hh index 594f668f264..87aae6b25c1 100644 --- a/broker/test/db.hh +++ b/broker/test/db.hh @@ -22,7 +22,6 @@ #include #include #include -#include "com/centreon/broker/namespace.hh" #include "test/table_content.hh" #define RTMONITORING_TABLES_V2 \ @@ -53,7 +52,7 @@ "mod_bam_reporting_ba_events_durations", \ "mod_bam_reporting_ba_availabilities" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -83,6 +82,6 @@ class db { }; } // namespace test -CCB_END() +} #endif // !CCB_TEST_DB_HH diff --git a/broker/test/delete_graphs.cc b/broker/test/delete_graphs.cc index 4ccb08ba39a..4b04d1dea10 100644 --- a/broker/test/delete_graphs.cc +++ b/broker/test/delete_graphs.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/directory_dumper.cc b/broker/test/directory_dumper.cc index f31100ec2e0..a2a65e2a232 100644 --- a/broker/test/directory_dumper.cc +++ b/broker/test/directory_dumper.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/failover_to_tcp.cc b/broker/test/failover_to_tcp.cc index 9b08ef7c07d..5a16d80f587 100644 --- a/broker/test/failover_to_tcp.cc +++ b/broker/test/failover_to_tcp.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/fifo_dumper.cc b/broker/test/fifo_dumper.cc index e8cd705a498..534387ed36a 100644 --- a/broker/test/fifo_dumper.cc +++ b/broker/test/fifo_dumper.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/file.cc b/broker/test/file.cc index a82a4c2eb6a..04ba2094c00 100644 --- a/broker/test/file.cc +++ b/broker/test/file.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/file.hh" diff --git a/broker/test/file.hh b/broker/test/file.hh index b0d1c2e87ae..9ccbdcfc44c 100644 --- a/broker/test/file.hh +++ b/broker/test/file.hh @@ -19,9 +19,8 @@ #ifndef CCB_TEST_FILE_HH #define CCB_TEST_FILE_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -47,6 +46,6 @@ class file { }; } // namespace test -CCB_END() +} #endif // !CCB_TEST_FILE_HH diff --git a/broker/test/graphite.cc b/broker/test/graphite.cc index 75db42637f2..f0ac7c554d2 100644 --- a/broker/test/graphite.cc +++ b/broker/test/graphite.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/helgrind.cc b/broker/test/helgrind.cc index 3a9964151ee..4c35d846561 100644 --- a/broker/test/helgrind.cc +++ b/broker/test/helgrind.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/influxdb.cc b/broker/test/influxdb.cc index 9834757b5e7..6dfb1127162 100644 --- a/broker/test/influxdb.cc +++ b/broker/test/influxdb.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/meta_service.cc b/broker/test/meta_service.cc index 4a295a3ed5d..6a038eb9245 100644 --- a/broker/test/meta_service.cc +++ b/broker/test/meta_service.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/misc.cc b/broker/test/misc.cc index af4d8d5ca68..fe3cdd8c511 100644 --- a/broker/test/misc.cc +++ b/broker/test/misc.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013,2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/misc.hh" diff --git a/broker/test/misc.hh b/broker/test/misc.hh index 19dbd0d34a0..0533c6c3652 100644 --- a/broker/test/misc.hh +++ b/broker/test/misc.hh @@ -20,15 +20,14 @@ #define CCB_TEST_MISC_HH #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { void recursive_remove(std::string const& dir_path); void sleep_for(int units); } // namespace test -CCB_END() +} #endif // !CCB_TEST_MISC_HH diff --git a/broker/test/monitoring_to_rrd.cc b/broker/test/monitoring_to_rrd.cc index b8791ccc2f3..f632fdee228 100644 --- a/broker/test/monitoring_to_rrd.cc +++ b/broker/test/monitoring_to_rrd.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/my_plugin.cc b/broker/test/my_plugin.cc index ef50837209b..531a86e17b2 100644 --- a/broker/test/my_plugin.cc +++ b/broker/test/my_plugin.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/my_plugin_bam.cc b/broker/test/my_plugin_bam.cc index 969c7882ec6..abd7ca8f2ae 100644 --- a/broker/test/my_plugin_bam.cc +++ b/broker/test/my_plugin_bam.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/predicate.cc b/broker/test/predicate.cc index d6626240cc0..e03a8134b9e 100644 --- a/broker/test/predicate.cc +++ b/broker/test/predicate.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/predicate.hh" diff --git a/broker/test/predicate.hh b/broker/test/predicate.hh index e8bfe3bef16..de11bd999c2 100644 --- a/broker/test/predicate.hh +++ b/broker/test/predicate.hh @@ -22,9 +22,8 @@ #include #include #include "com/centreon/broker/misc/stringifier.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -83,7 +82,7 @@ class predicate { }; } // namespace test -CCB_END() +} com::centreon::broker::misc::stringifier& operator<<( com::centreon::broker::misc::stringifier& s, diff --git a/broker/test/rebuild_graphs.cc b/broker/test/rebuild_graphs.cc index 6edc7262424..bb3bcb3418f 100644 --- a/broker/test/rebuild_graphs.cc +++ b/broker/test/rebuild_graphs.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rrd/v2/disable_metrics.cc b/broker/test/rrd/v2/disable_metrics.cc index fb0992f52bf..174ed15cd47 100644 --- a/broker/test/rrd/v2/disable_metrics.cc +++ b/broker/test/rrd/v2/disable_metrics.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rrd/v2/disable_status.cc b/broker/test/rrd/v2/disable_status.cc index 47b480c4a7e..2af7552d6df 100644 --- a/broker/test/rrd/v2/disable_status.cc +++ b/broker/test/rrd/v2/disable_status.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rrd_file.cc b/broker/test/rrd_file.cc index a21c8ad30f6..4ac06c45982 100644 --- a/broker/test/rrd_file.cc +++ b/broker/test/rrd_file.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/rrd_file.hh" diff --git a/broker/test/rtmonitoring/v2/acknowledgements.cc b/broker/test/rtmonitoring/v2/acknowledgements.cc index c1da114c630..46ac1a4d84e 100644 --- a/broker/test/rtmonitoring/v2/acknowledgements.cc +++ b/broker/test/rtmonitoring/v2/acknowledgements.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/comments.cc b/broker/test/rtmonitoring/v2/comments.cc index 25ac3b465f6..f684d60f1d7 100644 --- a/broker/test/rtmonitoring/v2/comments.cc +++ b/broker/test/rtmonitoring/v2/comments.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/customvariables.cc b/broker/test/rtmonitoring/v2/customvariables.cc index 1f922ab41f6..de47a495bc8 100644 --- a/broker/test/rtmonitoring/v2/customvariables.cc +++ b/broker/test/rtmonitoring/v2/customvariables.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/downtimes.cc b/broker/test/rtmonitoring/v2/downtimes.cc index d7fd382fb7f..43b9e9a1b71 100644 --- a/broker/test/rtmonitoring/v2/downtimes.cc +++ b/broker/test/rtmonitoring/v2/downtimes.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/eventhandlers.cc b/broker/test/rtmonitoring/v2/eventhandlers.cc index 74549ad36ea..9a2d08b51a2 100644 --- a/broker/test/rtmonitoring/v2/eventhandlers.cc +++ b/broker/test/rtmonitoring/v2/eventhandlers.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/hostdependencies.cc b/broker/test/rtmonitoring/v2/hostdependencies.cc index f46e0e93e5b..64d4eae9843 100644 --- a/broker/test/rtmonitoring/v2/hostdependencies.cc +++ b/broker/test/rtmonitoring/v2/hostdependencies.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/hostgroups.cc b/broker/test/rtmonitoring/v2/hostgroups.cc index 2eb2dd52daa..fd90c1fab12 100644 --- a/broker/test/rtmonitoring/v2/hostgroups.cc +++ b/broker/test/rtmonitoring/v2/hostgroups.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/hostparents.cc b/broker/test/rtmonitoring/v2/hostparents.cc index 1672a5868c7..81ecf4ebdd5 100644 --- a/broker/test/rtmonitoring/v2/hostparents.cc +++ b/broker/test/rtmonitoring/v2/hostparents.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/hosts.cc b/broker/test/rtmonitoring/v2/hosts.cc index 814b5c27a05..05708db464f 100644 --- a/broker/test/rtmonitoring/v2/hosts.cc +++ b/broker/test/rtmonitoring/v2/hosts.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/instances.cc b/broker/test/rtmonitoring/v2/instances.cc index c2580311f22..a5f0d4688f3 100644 --- a/broker/test/rtmonitoring/v2/instances.cc +++ b/broker/test/rtmonitoring/v2/instances.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/logs.cc b/broker/test/rtmonitoring/v2/logs.cc index aad33852d65..a7026fbe433 100644 --- a/broker/test/rtmonitoring/v2/logs.cc +++ b/broker/test/rtmonitoring/v2/logs.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/modules.cc b/broker/test/rtmonitoring/v2/modules.cc index 175fd634bf7..6f86821860f 100644 --- a/broker/test/rtmonitoring/v2/modules.cc +++ b/broker/test/rtmonitoring/v2/modules.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/servicedependencies.cc b/broker/test/rtmonitoring/v2/servicedependencies.cc index 7d71e133b01..8cff7e3353c 100644 --- a/broker/test/rtmonitoring/v2/servicedependencies.cc +++ b/broker/test/rtmonitoring/v2/servicedependencies.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/servicegroups.cc b/broker/test/rtmonitoring/v2/servicegroups.cc index c0578adf24b..13a238a988b 100644 --- a/broker/test/rtmonitoring/v2/servicegroups.cc +++ b/broker/test/rtmonitoring/v2/servicegroups.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/rtmonitoring/v2/services.cc b/broker/test/rtmonitoring/v2/services.cc index 161c784fe44..5186a66ecd0 100644 --- a/broker/test/rtmonitoring/v2/services.cc +++ b/broker/test/rtmonitoring/v2/services.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/secondary_failovers_to_file.cc b/broker/test/secondary_failovers_to_file.cc index c9a353d9dd4..6cc94bdd886 100644 --- a/broker/test/secondary_failovers_to_file.cc +++ b/broker/test/secondary_failovers_to_file.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/sql_cleanup.cc b/broker/test/sql_cleanup.cc index 013f86560a0..0f98d5f688a 100644 --- a/broker/test/sql_cleanup.cc +++ b/broker/test/sql_cleanup.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/sql_id_change.cc b/broker/test/sql_id_change.cc index 61c7729b7cf..f0298688a9a 100644 --- a/broker/test/sql_id_change.cc +++ b/broker/test/sql_id_change.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/sql_instance_update_outdated.cc b/broker/test/sql_instance_update_outdated.cc index 492d8d7ecbb..11938f2fba9 100644 --- a/broker/test/sql_instance_update_outdated.cc +++ b/broker/test/sql_instance_update_outdated.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/stats.cc b/broker/test/stats.cc index ac628460241..af36352225d 100644 --- a/broker/test/stats.cc +++ b/broker/test/stats.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/exceptions/msg.hh" diff --git a/broker/test/stats_events.cc b/broker/test/stats_events.cc index 21ab48b0173..aa77c66feda 100644 --- a/broker/test/stats_events.cc +++ b/broker/test/stats_events.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/table_content.cc b/broker/test/table_content.cc index b205a05241e..ae579d21e6b 100644 --- a/broker/test/table_content.cc +++ b/broker/test/table_content.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/table_content.hh" diff --git a/broker/test/table_content.hh b/broker/test/table_content.hh index 9bb0abde77d..45333e9bc36 100644 --- a/broker/test/table_content.hh +++ b/broker/test/table_content.hh @@ -20,10 +20,9 @@ #define CCB_TEST_TABLE_CONTENT_HH #include -#include "com/centreon/broker/namespace.hh" #include "test/predicate.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -64,6 +63,6 @@ class table_content { }; } // namespace test -CCB_END() +} #endif // !CCB_TEST_TABLE_CONTENT_HH diff --git a/broker/test/test_util/src/tcp_relais.cc b/broker/test/test_util/src/tcp_relais.cc index 5d875895c1d..7673f8d9a1d 100644 --- a/broker/test/test_util/src/tcp_relais.cc +++ b/broker/test/test_util/src/tcp_relais.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,11 +23,7 @@ using namespace asio::ip; extern std::shared_ptr g_io_context; -namespace com { -namespace centreon { -namespace broker { -namespace test_util { -namespace detail { +namespace com::centreon::broker::test_util::detail { class incomming_outgoing; @@ -135,12 +131,7 @@ class tcp_relais_impl : public std::enable_shared_from_this { void shutdown_relays(); }; -} // namespace detail -} // namespace test_util - -} // namespace broker -} // namespace centreon -} // namespace com +} // namespace com::centreon::broker::test_util::detail using namespace com::centreon::broker::test_util; using namespace com::centreon::broker::test_util::detail; diff --git a/broker/test/time_points.cc b/broker/test/time_points.cc index db24380b8a6..5a855577ec2 100644 --- a/broker/test/time_points.cc +++ b/broker/test/time_points.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "test/time_points.hh" diff --git a/broker/test/time_points.hh b/broker/test/time_points.hh index be547ae2193..0be2383d178 100644 --- a/broker/test/time_points.hh +++ b/broker/test/time_points.hh @@ -21,9 +21,8 @@ #include #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace test { /** @@ -45,6 +44,6 @@ class time_points { }; } // namespace test -CCB_END() +} #endif // !CCB_TEST_TIME_POINTS_HH diff --git a/broker/test/tls_to_sql.cc b/broker/test/tls_to_sql.cc index 9e2ce915a59..2283981af97 100644 --- a/broker/test/tls_to_sql.cc +++ b/broker/test/tls_to_sql.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/test/write_into_file.cc b/broker/test/write_into_file.cc index 7c0a9ed0145..073989f9747 100644 --- a/broker/test/write_into_file.cc +++ b/broker/test/write_into_file.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ // This utility executable is used to write into files in a portable way. diff --git a/broker/tls/inc/com/centreon/broker/tls/acceptor.hh b/broker/tls/inc/com/centreon/broker/tls/acceptor.hh index 9ccae2d846e..9bd3868c569 100644 --- a/broker/tls/inc/com/centreon/broker/tls/acceptor.hh +++ b/broker/tls/inc/com/centreon/broker/tls/acceptor.hh @@ -20,9 +20,8 @@ #define CCB_TLS_ACCEPTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls { /** @@ -55,6 +54,6 @@ class acceptor : public io::endpoint { }; } // namespace tls -CCB_END() +} #endif // !CCB_TLS_ACCEPTOR_HH diff --git a/broker/tls/inc/com/centreon/broker/tls/connector.hh b/broker/tls/inc/com/centreon/broker/tls/connector.hh index 0b8e4990e98..73061e33e80 100644 --- a/broker/tls/inc/com/centreon/broker/tls/connector.hh +++ b/broker/tls/inc/com/centreon/broker/tls/connector.hh @@ -20,9 +20,8 @@ #define CCB_TLS_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls { /** @@ -50,6 +49,6 @@ class connector : public io::endpoint { }; } // namespace tls -CCB_END() +} #endif // !CCB_TLS_CONNECTOR_HH diff --git a/broker/tls/inc/com/centreon/broker/tls/factory.hh b/broker/tls/inc/com/centreon/broker/tls/factory.hh index 6c7f291e9e2..b3764ee217e 100644 --- a/broker/tls/inc/com/centreon/broker/tls/factory.hh +++ b/broker/tls/inc/com/centreon/broker/tls/factory.hh @@ -20,9 +20,8 @@ #define CCB_TLS_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls { /** @@ -50,6 +49,6 @@ class factory : public io::factory { }; } // namespace tls -CCB_END() +} #endif // !CCB_TLS_FACTORY_HH diff --git a/broker/tls/inc/com/centreon/broker/tls/internal.hh b/broker/tls/inc/com/centreon/broker/tls/internal.hh index a424585c3cf..fa9fea08f97 100644 --- a/broker/tls/inc/com/centreon/broker/tls/internal.hh +++ b/broker/tls/inc/com/centreon/broker/tls/internal.hh @@ -22,7 +22,7 @@ #include #include -CCB_BEGIN() +namespace com::centreon::broker { namespace tls { // Data. @@ -36,6 +36,6 @@ ssize_t pull_helper(gnutls_transport_ptr_t ptr, void* data, size_t size); ssize_t push_helper(gnutls_transport_ptr_t ptr, void const* data, size_t size); } // namespace tls -CCB_END() +} #endif // !CCB_TLS_INTERNAL_HH diff --git a/broker/tls/inc/com/centreon/broker/tls/params.hh b/broker/tls/inc/com/centreon/broker/tls/params.hh index 89d88ff8032..d409f6d8550 100644 --- a/broker/tls/inc/com/centreon/broker/tls/params.hh +++ b/broker/tls/inc/com/centreon/broker/tls/params.hh @@ -21,9 +21,8 @@ #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls { /** @@ -71,6 +70,6 @@ class params { }; } // namespace tls -CCB_END() +} #endif // !CCB_TLS_PARAMS_HH diff --git a/broker/tls/inc/com/centreon/broker/tls/stream.hh b/broker/tls/inc/com/centreon/broker/tls/stream.hh index db81131c945..f4a28a311fb 100644 --- a/broker/tls/inc/com/centreon/broker/tls/stream.hh +++ b/broker/tls/inc/com/centreon/broker/tls/stream.hh @@ -22,9 +22,8 @@ #include #include "com/centreon/broker/io/stream.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls { /** @@ -54,6 +53,6 @@ class stream : public io::stream { }; } // namespace tls -CCB_END() +} #endif // !CCB_TLS_STREAM_HH diff --git a/broker/tls/src/acceptor.cc b/broker/tls/src/acceptor.cc index 8253e164319..80c631b2aea 100644 --- a/broker/tls/src/acceptor.cc +++ b/broker/tls/src/acceptor.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls/acceptor.hh" diff --git a/broker/tls/src/connector.cc b/broker/tls/src/connector.cc index b6f259afae8..010a262eed8 100644 --- a/broker/tls/src/connector.cc +++ b/broker/tls/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls/connector.hh" diff --git a/broker/tls/src/factory.cc b/broker/tls/src/factory.cc index a58a71c6714..eae3313f81a 100644 --- a/broker/tls/src/factory.cc +++ b/broker/tls/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013, 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013, 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls/factory.hh" @@ -45,6 +45,9 @@ bool factory::has_endpoint(config::endpoint& cfg, io::extension* ext) { bool legacy; if (ext) { + if (direct_grpc_serialized(cfg)) { + return false; + } if (cfg.type == "bbdo_client" || cfg.type == "bbdo_server") { it = cfg.params.find("transport_protocol"); if (it != cfg.params.end()) { diff --git a/broker/tls/src/internal.cc b/broker/tls/src/internal.cc index 93bd00adc96..e570792d8c5 100644 --- a/broker/tls/src/internal.cc +++ b/broker/tls/src/internal.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/tls/src/main.cc b/broker/tls/src/main.cc index 09ef5b1cbe7..a4d3ecdfbb1 100644 --- a/broker/tls/src/main.cc +++ b/broker/tls/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/io/protocols.hh" diff --git a/broker/tls/src/params.cc b/broker/tls/src/params.cc index 15325ff2112..81baa3cd555 100644 --- a/broker/tls/src/params.cc +++ b/broker/tls/src/params.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013,2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013,2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls/params.hh" diff --git a/broker/tls/src/stream.cc b/broker/tls/src/stream.cc index 734ed293a9f..46708fc5533 100644 --- a/broker/tls/src/stream.cc +++ b/broker/tls/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls/stream.hh" diff --git a/broker/tls/test/acceptor.cc b/broker/tls/test/acceptor.cc index e12ee16c28c..a967007e7ad 100644 --- a/broker/tls/test/acceptor.cc +++ b/broker/tls/test/acceptor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls/test/anon-test.cc b/broker/tls/test/anon-test.cc index c42fa8e0342..bf4d0d63968 100644 --- a/broker/tls/test/anon-test.cc +++ b/broker/tls/test/anon-test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls/test/crypt-test.cc b/broker/tls/test/crypt-test.cc index 622f7d3a05f..f8e3785d500 100644 --- a/broker/tls/test/crypt-test.cc +++ b/broker/tls/test/crypt-test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls/test/nominal.cc b/broker/tls/test/nominal.cc index 07e563963c1..acffa3fdaaf 100644 --- a/broker/tls/test/nominal.cc +++ b/broker/tls/test/nominal.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls/test/openssl.cc b/broker/tls/test/openssl.cc index 83ac102b84f..8cdb4e96027 100644 --- a/broker/tls/test/openssl.cc +++ b/broker/tls/test/openssl.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls/test/read.cc b/broker/tls/test/read.cc index de6072aff0b..296eb53fcea 100644 --- a/broker/tls/test/read.cc +++ b/broker/tls/test/read.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls2/inc/com/centreon/broker/tls2/acceptor.hh b/broker/tls2/inc/com/centreon/broker/tls2/acceptor.hh index 472659f0ce3..ee435c78bc3 100644 --- a/broker/tls2/inc/com/centreon/broker/tls2/acceptor.hh +++ b/broker/tls2/inc/com/centreon/broker/tls2/acceptor.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/io/endpoint.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls2 { /** @@ -54,6 +54,6 @@ class acceptor : public io::endpoint { }; } // namespace tls2 -CCB_END() +} #endif // !CCB_TLS_ACCEPTOR_HH diff --git a/broker/tls2/inc/com/centreon/broker/tls2/connector.hh b/broker/tls2/inc/com/centreon/broker/tls2/connector.hh index 55067928da7..ff8d4889629 100644 --- a/broker/tls2/inc/com/centreon/broker/tls2/connector.hh +++ b/broker/tls2/inc/com/centreon/broker/tls2/connector.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/io/endpoint.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls2 { /** @@ -49,6 +49,6 @@ class connector : public io::endpoint { }; } // namespace tls2 -CCB_END() +} #endif // !CCB_TLS_CONNECTOR_HH diff --git a/broker/tls2/inc/com/centreon/broker/tls2/factory.hh b/broker/tls2/inc/com/centreon/broker/tls2/factory.hh index 0f391bad604..846558d7cd0 100644 --- a/broker/tls2/inc/com/centreon/broker/tls2/factory.hh +++ b/broker/tls2/inc/com/centreon/broker/tls2/factory.hh @@ -20,9 +20,8 @@ #define CCB_TLS_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls2 { /** @@ -50,6 +49,6 @@ class factory : public io::factory { }; } // namespace tls2 -CCB_END() +} #endif // !CCB_TLS_FACTORY_HH diff --git a/broker/tls2/inc/com/centreon/broker/tls2/internal.hh b/broker/tls2/inc/com/centreon/broker/tls2/internal.hh index a6370d8b887..9e6af0ae005 100644 --- a/broker/tls2/inc/com/centreon/broker/tls2/internal.hh +++ b/broker/tls2/inc/com/centreon/broker/tls2/internal.hh @@ -21,9 +21,8 @@ #include #include -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls2 { // Data. @@ -34,6 +33,6 @@ void destroy(); void initialize(); } // namespace tls2 -CCB_END() +} #endif // !CCB_TLS_INTERNAL_HH diff --git a/broker/tls2/inc/com/centreon/broker/tls2/stream.hh b/broker/tls2/inc/com/centreon/broker/tls2/stream.hh index 61e3310f9ec..fb0adf87af7 100644 --- a/broker/tls2/inc/com/centreon/broker/tls2/stream.hh +++ b/broker/tls2/inc/com/centreon/broker/tls2/stream.hh @@ -26,7 +26,7 @@ #include "com/centreon/broker/io/stream.hh" #include "com/centreon/broker/misc/buffer.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace tls2 { /** @@ -65,6 +65,6 @@ class stream : public io::stream { }; } // namespace tls2 -CCB_END() +} #endif // !CCB_TLS_STREAM_HH diff --git a/broker/tls2/src/acceptor.cc b/broker/tls2/src/acceptor.cc index 05129e813b2..4e1b5e2f940 100644 --- a/broker/tls2/src/acceptor.cc +++ b/broker/tls2/src/acceptor.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls2/acceptor.hh" diff --git a/broker/tls2/src/connector.cc b/broker/tls2/src/connector.cc index c89b9f9da2f..3574b7e713b 100644 --- a/broker/tls2/src/connector.cc +++ b/broker/tls2/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls2/connector.hh" diff --git a/broker/tls2/src/factory.cc b/broker/tls2/src/factory.cc index 1fea2eaa2ad..d58a5085d0c 100644 --- a/broker/tls2/src/factory.cc +++ b/broker/tls2/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls2/factory.hh" diff --git a/broker/tls2/src/internal.cc b/broker/tls2/src/internal.cc index 5c7b164d825..16581d8dde0 100644 --- a/broker/tls2/src/internal.cc +++ b/broker/tls2/src/internal.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls2/internal.hh" diff --git a/broker/tls2/src/main.cc b/broker/tls2/src/main.cc index bda7b6869da..a3f7d353dbc 100644 --- a/broker/tls2/src/main.cc +++ b/broker/tls2/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/tls2/src/stream.cc b/broker/tls2/src/stream.cc index 02a6005e107..931b4fe0f5a 100644 --- a/broker/tls2/src/stream.cc +++ b/broker/tls2/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2009-2017, 2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2009-2017, 2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/tls2/stream.hh" diff --git a/broker/tls2/test/acceptor.cc b/broker/tls2/test/acceptor.cc index e2b62d177b8..bfd85f25035 100644 --- a/broker/tls2/test/acceptor.cc +++ b/broker/tls2/test/acceptor.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls2/test/anon-test.cc b/broker/tls2/test/anon-test.cc index c42fa8e0342..bf4d0d63968 100644 --- a/broker/tls2/test/anon-test.cc +++ b/broker/tls2/test/anon-test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls2/test/crypt-test.cc b/broker/tls2/test/crypt-test.cc index c0b058878c6..a9256da5294 100644 --- a/broker/tls2/test/crypt-test.cc +++ b/broker/tls2/test/crypt-test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls2/test/nominal.cc b/broker/tls2/test/nominal.cc index b3caa4c08c6..5a42b30f613 100644 --- a/broker/tls2/test/nominal.cc +++ b/broker/tls2/test/nominal.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls2/test/openssl.cc b/broker/tls2/test/openssl.cc index 2cc679a2c61..78673a20efa 100644 --- a/broker/tls2/test/openssl.cc +++ b/broker/tls2/test/openssl.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/tls2/test/read.cc b/broker/tls2/test/read.cc index de6072aff0b..296eb53fcea 100644 --- a/broker/tls2/test/read.cc +++ b/broker/tls2/test/read.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/unified_sql/CMakeLists.txt b/broker/unified_sql/CMakeLists.txt index 91e88df946f..bfc27a134b6 100644 --- a/broker/unified_sql/CMakeLists.txt +++ b/broker/unified_sql/CMakeLists.txt @@ -25,9 +25,6 @@ include_directories("${PROJECT_SOURCE_DIR}/neb/inc") include_directories("${CMAKE_SOURCE_DIR}") set(INC_DIR "${INC_DIR}/com/centreon/broker/unified_sql") -get_protobuf_files(rebuild_message) -get_protobuf_files(remove_graph_message) - # Storage module. set(UNIFIED_SQL "20-unified_sql") set(UNIFIED_SQL @@ -46,8 +43,6 @@ add_library( ${SRC_DIR}/stream.cc ${SRC_DIR}/stream_sql.cc ${SRC_DIR}/stream_storage.cc - ${proto_rebuild_message} - ${proto_remove_graph_message} # Headers. ${INC_DIR}/bulk_queries.hh ${INC_DIR}/bulk_bind.hh @@ -63,8 +58,14 @@ set_target_properties("${UNIFIED_SQL}" PROPERTIES PREFIX "" COMPILE_FLAGS add_dependencies("${UNIFIED_SQL}" target_rebuild_message target_remove_graph_message target_neb) target_precompile_headers(${UNIFIED_SQL} PRIVATE precomp_inc/precomp.hpp) -target_link_libraries(${UNIFIED_SQL} rokerbase bbdo_storage CONAN_PKG::spdlog - CONAN_PKG::abseil pb_storage_lib) +target_link_libraries( + ${UNIFIED_SQL} + bbdo_storage + pb_storage_lib + pb_rebuild_message_lib + pb_remove_graph_message_lib + CONAN_PKG::spdlog + CONAN_PKG::abseil) # Testing. if(WITH_TESTING) diff --git a/broker/unified_sql/bulk_queries.hh b/broker/unified_sql/bulk_queries.hh index f166db365a9..3b22c839369 100644 --- a/broker/unified_sql/bulk_queries.hh +++ b/broker/unified_sql/bulk_queries.hh @@ -18,9 +18,8 @@ #ifndef CCB_UNIFIED_SQL_BULK_QUERIES_HH #define CCB_UNIFIED_SQL_BULK_QUERIES_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { /** * @class bulk_queries "com/centreon/broker/unified_sql/bulk_queries.hh" @@ -74,6 +73,6 @@ class bulk_queries { std::time_t next_time() const; }; } // namespace unified_sql -CCB_END() +} #endif /* !CCB_UNIFIED_SQL_BULK_QUERIES_HH */ diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_bind.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_bind.hh index 38ff812082a..a7482a1a87a 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_bind.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_bind.hh @@ -18,10 +18,9 @@ #ifndef CCB_UNIFIED_SQL_BULK_BIND_HH #define CCB_UNIFIED_SQL_BULK_BIND_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/mysql_bulk_stmt.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { /** * @class bulk_bind "com/centreon/broker/unified_sql/bulk_bind.hh" @@ -82,6 +81,6 @@ class bulk_bind { void unlock(); }; } // namespace unified_sql -CCB_END() +} #endif /* !CCB_UNIFIED_SQL_BULK_BIND_HH */ diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_queries.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_queries.hh index 25649c67d0e..7f782182b9e 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_queries.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/bulk_queries.hh @@ -18,9 +18,8 @@ #ifndef CCB_UNIFIED_SQL_BULK_QUERIES_HH #define CCB_UNIFIED_SQL_BULK_QUERIES_HH -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { /** * @class bulk_queries "com/centreon/broker/unified_sql/bulk_queries.hh" @@ -73,6 +72,6 @@ class bulk_queries { std::time_t next_time() const; }; } // namespace unified_sql -CCB_END() +} #endif /* !CCB_UNIFIED_SQL_BULK_QUERIES_HH */ diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/connector.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/connector.hh index f3caae0d558..3d11e8a1d16 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/connector.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/connector.hh @@ -20,10 +20,9 @@ #define CCB_UNIFIED_SQL_CONNECTOR_HH #include "com/centreon/broker/io/endpoint.hh" -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/sql/database_config.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { /** @@ -60,6 +59,6 @@ class connector : public io::endpoint { }; } // namespace unified_sql -CCB_END() +} #endif // !CCB_UNIFIED_SQL_CONNECTOR_HH diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/factory.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/factory.hh index 54c29b010d8..d678cc5aedd 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/factory.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/factory.hh @@ -20,9 +20,8 @@ #define CCB_UNIFIED_SQL_FACTORY_HH #include "com/centreon/broker/io/factory.hh" -#include "com/centreon/broker/namespace.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { /** @@ -45,6 +44,6 @@ class factory : public io::factory { }; } // namespace unified_sql -CCB_END() +} #endif // !CCB_UNIFIED_SQL_FACTORY_HH diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/internal.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/internal.hh index d28576111a9..0672493abbf 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/internal.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/internal.hh @@ -27,7 +27,7 @@ #include "broker/core/src/broker.pb.h" #include "com/centreon/broker/io/protobuf.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace bbdo { /** @@ -64,6 +64,6 @@ using pb_metric_mapping = make_type(io::storage, storage::de_pb_metric_mapping)>; } // namespace storage -CCB_END() +} #endif // !CCB_UNIFIED_SQL_INTERNAL_HH diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/rebuilder.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/rebuilder.hh index 8510fa1b564..7fc7c618f32 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/rebuilder.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/rebuilder.hh @@ -25,7 +25,7 @@ #include "com/centreon/broker/sql/database_config.hh" #include "com/centreon/broker/sql/mysql.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { class stream; @@ -75,6 +75,6 @@ class rebuilder { }; } // namespace unified_sql -CCB_END() +} #endif // !CCB_UNIFIED_SQL_REBUILDER_HH diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/stored_timestamp.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/stored_timestamp.hh index deef7b2d41a..5e3f025604d 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/stored_timestamp.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/stored_timestamp.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { /** @@ -59,6 +59,6 @@ class stored_timestamp { }; } // namespace unified_sql -CCB_END() +} #endif //! CCB_UNIFIED_SQL_STORED_TIMESTAMP_HH diff --git a/broker/unified_sql/inc/com/centreon/broker/unified_sql/stream.hh b/broker/unified_sql/inc/com/centreon/broker/unified_sql/stream.hh index f5267f8bfca..ec70ccaf4a4 100644 --- a/broker/unified_sql/inc/com/centreon/broker/unified_sql/stream.hh +++ b/broker/unified_sql/inc/com/centreon/broker/unified_sql/stream.hh @@ -38,7 +38,7 @@ #include "com/centreon/broker/unified_sql/rebuilder.hh" #include "com/centreon/broker/unified_sql/stored_timestamp.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace unified_sql { struct int64_not_minus_one { int64_t value; @@ -53,7 +53,7 @@ struct uint64_not_null { }; } // namespace unified_sql -CCB_END() +} // namespace com::centreon::broker namespace fmt { template <> struct formatter { @@ -117,7 +117,7 @@ struct formatter { } // namespace fmt -CCB_BEGIN() +namespace com::centreon::broker { /* Forward declarations */ namespace neb { class service_status; @@ -335,14 +335,16 @@ class stream : public io::stream { database::mysql_stmt _acknowledgement_insupdate; database::mysql_stmt _pb_acknowledgement_insupdate; database::mysql_stmt _custom_variable_delete; - database::mysql_stmt _event_handler_insupdate; database::mysql_stmt _flapping_status_insupdate; database::mysql_stmt _host_check_update; database::mysql_stmt _pb_host_check_update; database::mysql_stmt _host_dependency_insupdate; + database::mysql_stmt _pb_host_dependency_insupdate; database::mysql_stmt _host_group_insupdate; + database::mysql_stmt _pb_host_group_insupdate; database::mysql_stmt _host_group_member_delete; database::mysql_stmt _host_group_member_insert; + database::mysql_stmt _pb_host_group_member_insert; database::mysql_stmt _host_insupdate; database::mysql_stmt _pb_host_insupdate; database::mysql_stmt _host_parent_delete; @@ -355,9 +357,13 @@ class stream : public io::stream { database::mysql_stmt _service_check_update; database::mysql_stmt _pb_service_check_update; database::mysql_stmt _service_dependency_insupdate; + database::mysql_stmt _pb_service_dependency_insupdate; database::mysql_stmt _service_group_insupdate; + database::mysql_stmt _pb_service_group_insupdate; database::mysql_stmt _service_group_member_delete; database::mysql_stmt _service_group_member_insert; + database::mysql_stmt _pb_service_group_member_delete; + database::mysql_stmt _pb_service_group_member_insert; database::mysql_stmt _service_insupdate; database::mysql_stmt _pb_service_insupdate; database::mysql_stmt _service_status_update; @@ -370,8 +376,7 @@ class stream : public io::stream { database::mysql_stmt _severity_insert; database::mysql_stmt _severity_update; - database::mysql_stmt _tag_insert; - database::mysql_stmt _tag_update; + database::mysql_stmt _tag_insert_update; database::mysql_stmt _tag_delete; database::mysql_stmt _resources_tags_insert; database::mysql_stmt _resources_host_insert; @@ -415,8 +420,11 @@ class stream : public io::stream { void _process_host_check(const std::shared_ptr& d); void _process_pb_host_check(const std::shared_ptr& d); void _process_host_dependency(const std::shared_ptr& d); + void _process_pb_host_dependency(const std::shared_ptr& d); void _process_host_group(const std::shared_ptr& d); + void _process_pb_host_group(const std::shared_ptr& d); void _process_host_group_member(const std::shared_ptr& d); + void _process_pb_host_group_member(const std::shared_ptr& d); void _process_host(const std::shared_ptr& d); void _process_host_parent(const std::shared_ptr& d); void _process_host_status(const std::shared_ptr& d); @@ -428,17 +436,22 @@ class stream : public io::stream { void _process_service_check(const std::shared_ptr& d); void _process_pb_service_check(const std::shared_ptr& d); void _process_service_dependency(const std::shared_ptr& d); + void _process_pb_service_dependency(const std::shared_ptr& d); void _process_service_group(const std::shared_ptr& d); + void _process_pb_service_group(const std::shared_ptr& d); void _process_service_group_member(const std::shared_ptr& d); + void _process_pb_service_group_member(const std::shared_ptr& d); void _process_service(const std::shared_ptr& d); void _process_service_status(const std::shared_ptr& d); void _process_instance_configuration(const std::shared_ptr& d); void _process_responsive_instance(const std::shared_ptr& d); void _process_pb_host(const std::shared_ptr& d); + uint64_t _process_pb_host_in_resources(const Host& h, int32_t conn); void _process_pb_host_status(const std::shared_ptr& d); void _process_pb_adaptive_host(const std::shared_ptr& d); void _process_pb_service(const std::shared_ptr& d); + uint64_t _process_pb_service_in_resources(const Service& s, int32_t conn); void _process_pb_adaptive_service(const std::shared_ptr& d); void _process_pb_service_status(const std::shared_ptr& d); void _process_severity(const std::shared_ptr& d); @@ -458,7 +471,9 @@ class stream : public io::stream { void _clean_tables(uint32_t instance_id); void _clean_group_table(); void _prepare_hg_insupdate_statement(); + void _prepare_pb_hg_insupdate_statement(); void _prepare_sg_insupdate_statement(); + void _prepare_pb_sg_insupdate_statement(); void _finish_action(int32_t conn, uint32_t action); void _finish_actions(); void _add_action(int32_t conn, actions action); @@ -502,6 +517,6 @@ class stream : public io::stream { void update() override; }; } // namespace unified_sql -CCB_END() +} // namespace com::centreon::broker #endif /* !CCB_UNIFIED_SQL_STREAM_HH */ diff --git a/broker/unified_sql/src/bulk_bind.cc b/broker/unified_sql/src/bulk_bind.cc index 3f909d7be52..079eefb6051 100644 --- a/broker/unified_sql/src/bulk_bind.cc +++ b/broker/unified_sql/src/bulk_bind.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/bulk_bind.hh" diff --git a/broker/unified_sql/src/bulk_queries.cc b/broker/unified_sql/src/bulk_queries.cc index 64215e35937..e7a591c113f 100644 --- a/broker/unified_sql/src/bulk_queries.cc +++ b/broker/unified_sql/src/bulk_queries.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/bulk_queries.hh" diff --git a/broker/unified_sql/src/connector.cc b/broker/unified_sql/src/connector.cc index f39ce04f25f..fb382f4d62a 100644 --- a/broker/unified_sql/src/connector.cc +++ b/broker/unified_sql/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2015,2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2015,2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/connector.hh" diff --git a/broker/unified_sql/src/factory.cc b/broker/unified_sql/src/factory.cc index 249f3b34ea4..2a40b4b46fc 100644 --- a/broker/unified_sql/src/factory.cc +++ b/broker/unified_sql/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/factory.hh" diff --git a/broker/unified_sql/src/main.cc b/broker/unified_sql/src/main.cc index d5c06cdc345..f963dc02a1c 100644 --- a/broker/unified_sql/src/main.cc +++ b/broker/unified_sql/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "bbdo/events.hh" diff --git a/broker/unified_sql/src/rebuilder.cc b/broker/unified_sql/src/rebuilder.cc index 3208765bc2c..26fb58235f3 100644 --- a/broker/unified_sql/src/rebuilder.cc +++ b/broker/unified_sql/src/rebuilder.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2015,2017,2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2015,2017,2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/rebuilder.hh" diff --git a/broker/unified_sql/src/stored_timestamp.cc b/broker/unified_sql/src/stored_timestamp.cc index 5b7765aa05e..30b176ca1c2 100644 --- a/broker/unified_sql/src/stored_timestamp.cc +++ b/broker/unified_sql/src/stored_timestamp.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/stored_timestamp.hh" diff --git a/broker/unified_sql/src/stream.cc b/broker/unified_sql/src/stream.cc index 61186a547ee..f382a14b0c9 100644 --- a/broker/unified_sql/src/stream.cc +++ b/broker/unified_sql/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2021-2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2021-2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/stream.hh" @@ -108,7 +108,12 @@ constexpr void (stream::*const stream::neb_processing_table[])( &stream::_process_pb_instance, &stream::_process_pb_acknowledgement, &stream::_process_pb_responsive_instance, -}; + &stream::_process_pb_host_dependency, + &stream::_process_pb_service_dependency, + &stream::_process_pb_host_group, + &stream::_process_pb_host_group_member, + &stream::_process_pb_service_group, + &stream::_process_pb_service_group_member}; constexpr size_t neb_processing_table_size = sizeof(stream::neb_processing_table) / diff --git a/broker/unified_sql/src/stream_sql.cc b/broker/unified_sql/src/stream_sql.cc index 132be4163aa..98839f819f3 100644 --- a/broker/unified_sql/src/stream_sql.cc +++ b/broker/unified_sql/src/stream_sql.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021-2023 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,10 @@ using namespace com::centreon::broker; using namespace com::centreon::broker::database; using namespace com::centreon::broker::unified_sql; +static const std::string _insert_or_update_tags = + "INSERT INTO tags (id,type,name) VALUES(?,?,?) ON DUPLICATE " + "KEY UPDATE tag_id=LAST_INSERT_ID(tag_id), name=VALUES(name)"; + /** * @brief Clean tables with data associated to the instance. * @@ -407,6 +411,19 @@ void stream::_prepare_hg_insupdate_statement() { } } +void stream::_prepare_pb_hg_insupdate_statement() { + if (!_pb_host_group_insupdate.prepared()) { + query_preparator::event_pb_unique unique{ + {3, "hostgroup_id", io::protobuf_base::invalid_on_zero, 0}}; + query_preparator qp(neb::pb_host_group::static_type(), unique); + _pb_host_group_insupdate = qp.prepare_insert_or_update_table( + _mysql, "hostgroups ", /*space is mandatory to avoid + conflict with _process_host_dependency*/ + {{3, "hostgroup_id", io::protobuf_base::invalid_on_zero, 0}, + {4, "name", 0, get_hostgroups_col_size(hostgroups_name)}}); + } +} + void stream::_prepare_sg_insupdate_statement() { if (!_service_group_insupdate.prepared()) { query_preparator::event_unique unique; @@ -416,6 +433,19 @@ void stream::_prepare_sg_insupdate_statement() { } } +void stream::_prepare_pb_sg_insupdate_statement() { + if (!_pb_service_group_insupdate.prepared()) { + query_preparator::event_pb_unique unique{ + {3, "servicegroup_id", io::protobuf_base::invalid_on_zero, 0}}; + query_preparator qp(neb::pb_service_group::static_type(), unique); + _pb_service_group_insupdate = qp.prepare_insert_or_update_table( + _mysql, "servicegroups ", /*space is mandatory to avoid + conflict with _process_host_dependency*/ + {{3, "servicegroup_id", io::protobuf_base::invalid_on_zero, 0}, + {4, "name", 0, get_servicegroups_col_size(servicegroups_name)}}); + } +} + /** * Process an acknowledgement event. * @@ -1083,7 +1113,7 @@ void stream::_process_pb_host_check(const std::shared_ptr& d) { // Cast object. const neb::pb_host_check& hc_obj = *static_cast(d.get()); - const Check& hc = hc_obj.obj(); + const HostCheck& hc = hc_obj.obj(); if (!_host_instance_known(hc.host_id())) { SPDLOG_LOGGER_WARN( log_v2::sql(), @@ -1199,6 +1229,74 @@ void stream::_process_host_dependency(const std::shared_ptr& d) { } } +/** + * Process a host dependency event. + * + * @param[in] e Uncasted host dependency. + * + * @return The number of events that can be acknowledged. + */ +void stream::_process_pb_host_dependency(const std::shared_ptr& d) { + int32_t conn = special_conn::host_dependency % _mysql.connections_count(); + _finish_action(-1, actions::hosts | actions::host_parents | + actions::comments | actions::downtimes | + actions::host_dependencies | + actions::service_dependencies); + + // Cast object. + const neb::pb_host_dependency& hd_protobuf = + *static_cast(d.get()); + const HostDependency& hd = hd_protobuf.obj(); + + // Insert/Update. + if (hd.enabled()) { + SPDLOG_LOGGER_INFO(log_v2::sql(), + "SQL: enabling host dependency of {} on {}", + hd.dependent_host_id(), hd.host_id()); + + // Prepare queries. + if (!_pb_host_dependency_insupdate.prepared()) { + query_preparator::event_pb_unique unique{ + {6, "host_id", io::protobuf_base::invalid_on_zero, 0}, + {3, "dependent_host_id", io::protobuf_base::invalid_on_zero, 0}}; + query_preparator qp(neb::pb_host_dependency::static_type(), unique); + _pb_host_dependency_insupdate = qp.prepare_insert_or_update_table( + _mysql, "hosts_hosts_dependencies ", /*space is mandatory to avoid + conflict with _process_host_dependency*/ + {{3, "dependent_host_id", io::protobuf_base::invalid_on_zero, 0}, + {6, "host_id", io::protobuf_base::invalid_on_zero, 0}, + {2, "dependency_period", 0, + get_hosts_hosts_dependencies_col_size( + hosts_hosts_dependencies_dependency_period)}, + {5, "execution_failure_options", 0, + get_hosts_hosts_dependencies_col_size( + hosts_hosts_dependencies_execution_failure_options)}, + {7, "inherits_parent", 0, 0}, + {8, "notification_failure_options", 0, + get_hosts_hosts_dependencies_col_size( + hosts_hosts_dependencies_notification_failure_options)}}); + } + + // Process object. + _pb_host_dependency_insupdate << hd_protobuf; + _mysql.run_statement(_pb_host_dependency_insupdate, + database::mysql_error::store_host_dependency, conn); + _add_action(conn, actions::host_dependencies); + } + // Delete. + else { + SPDLOG_LOGGER_INFO(log_v2::sql(), + "SQL: removing host dependency of {} on {}", + hd.dependent_host_id(), hd.host_id()); + std::string query(fmt::format( + "DELETE FROM hosts_hosts_dependencies WHERE dependent_host_id={}" + " AND host_id={}", + hd.dependent_host_id(), hd.host_id())); + _mysql.run_query(query, database::mysql_error::empty, conn); + _add_action(conn, actions::host_dependencies); + } +} + /** * Process a host group event. * @@ -1231,7 +1329,7 @@ void stream::_process_host_group(const std::shared_ptr& d) { auto cache_ptr = cache::global_cache::instance_ptr(); if (cache_ptr) { - cache_ptr->remove_host_group(hg.id); + cache_ptr->remove_host_group_members(hg.id, hg.poller_id); } // Delete group members. @@ -1251,6 +1349,60 @@ void stream::_process_host_group(const std::shared_ptr& d) { _add_action(conn, actions::hostgroups); } +/** + * Process a host group event. + * + * @param[in] e Uncasted host group. + * + * @return The number of events that can be acknowledged. + */ +void stream::_process_pb_host_group(const std::shared_ptr& d) { + int32_t conn = special_conn::host_group % _mysql.connections_count(); + + // Cast object. + std::shared_ptr hgd = + std::static_pointer_cast(d); + const HostGroup& hg = hgd->obj(); + + if (hg.enabled()) { + SPDLOG_LOGGER_INFO(log_v2::sql(), + "SQL: enabling host group {} ('{}' on instance {})", + hg.hostgroup_id(), hg.name(), hg.poller_id()); + _prepare_pb_hg_insupdate_statement(); + + _pb_host_group_insupdate << *hgd; + _mysql.run_statement(_pb_host_group_insupdate, + database::mysql_error::store_host_group, conn); + _hostgroup_cache.insert(hg.hostgroup_id()); + } + // Delete group. + else { + SPDLOG_LOGGER_INFO(log_v2::sql(), + "SQL: disabling host group {} ('{}' on instance {})", + hg.hostgroup_id(), hg.name(), hg.poller_id()); + + auto cache_ptr = cache::global_cache::instance_ptr(); + if (cache_ptr) { + cache_ptr->remove_host_group_members(hg.hostgroup_id(), hg.poller_id()); + } + + // Delete group members. + { + _finish_action(-1, actions::hosts); + std::string query( + fmt::format("DELETE hosts_hostgroups FROM hosts_hostgroups " + "LEFT JOIN hosts" + " ON hosts_hostgroups.host_id=hosts.host_id" + " WHERE hosts_hostgroups.hostgroup_id={} AND " + "hosts.instance_id={}", + hg.hostgroup_id(), hg.poller_id())); + _mysql.run_query(query, database::mysql_error::empty, conn); + _hostgroup_cache.erase(hg.hostgroup_id()); + } + } + _add_action(conn, actions::hostgroups); +} + /** * Process a host group member event. * @@ -1285,7 +1437,7 @@ void stream::_process_host_group_member(const std::shared_ptr& d) { hgm.host_id, hgm.group_id, hgm.poller_id); if (cache_ptr) { - cache_ptr->add_host_group(hgm.group_id, hgm.host_id); + cache_ptr->add_host_to_group(hgm.group_id, hgm.host_id, hgm.poller_id); } // We only need to try to insert in this table as the // host_id/hostgroup_id should be UNIQUE. @@ -1300,11 +1452,11 @@ void stream::_process_host_group_member(const std::shared_ptr& d) { /* If the group does not exist, we create it. */ if (_cache_host_instance[hgm.host_id]) { if (_hostgroup_cache.find(hgm.group_id) == _hostgroup_cache.end()) { - SPDLOG_LOGGER_ERROR( - log_v2::sql(), - "SQL: host group {} does not exist - insertion before insertion of " - "members", - hgm.group_id); + SPDLOG_LOGGER_ERROR(log_v2::sql(), + "SQL: host group {} {} does not exist - insertion " + "before insertion of " + "members", + hgm.group_id, hgm.group_name); _prepare_hg_insupdate_statement(); neb::host_group hg; @@ -1357,6 +1509,114 @@ void stream::_process_host_group_member(const std::shared_ptr& d) { } } +/** + * Process a host group member event. + * + * @param[in] e Uncasted host group member. + * + * @return The number of events that can be acknowledged. + */ +void stream::_process_pb_host_group_member(const std::shared_ptr& d) { + int32_t conn = special_conn::host_group % _mysql.connections_count(); + _finish_action(-1, actions::hosts); + + // Cast object. + const neb::pb_host_group_member& hgmp{ + *static_cast(d.get())}; + const HostGroupMember& hgm = hgmp.obj(); + + if (!_host_instance_known(hgm.host_id())) { + SPDLOG_LOGGER_WARN( + log_v2::sql(), + "SQL: host {0} not added to hostgroup {1} because host {0} is not " + "known by any poller", + hgm.host_id(), hgm.hostgroup_id()); + return; + } + + auto cache_ptr = cache::global_cache::instance_ptr(); + + if (hgm.enabled()) { + // Log message. + SPDLOG_LOGGER_INFO( + log_v2::sql(), + "SQL: enabling membership of host {} to host group {} on instance {}", + hgm.host_id(), hgm.hostgroup_id(), hgm.poller_id()); + + if (cache_ptr) { + cache_ptr->add_host_to_group(hgm.hostgroup_id(), hgm.host_id(), + hgm.poller_id()); + } + // We only need to try to insert in this table as the + // host_id/hostgroup_id should be UNIQUE. + if (!_pb_host_group_member_insert.prepared()) { + query_preparator::event_pb_unique unique{ + {3, "hostgroup_id", io::protobuf_base::invalid_on_zero, 0}, + {5, "host_id", io::protobuf_base::invalid_on_zero, 0}}; + query_preparator qp(neb::pb_host_group_member::static_type(), unique); + _pb_host_group_member_insert = qp.prepare_insert_into( + _mysql, "hosts_hostgroups ", /*space is mandatory to avoid + conflict with _process_host_dependency*/ + {{3, "hostgroup_id", io::protobuf_base::invalid_on_zero, 0}, + {5, "host_id", io::protobuf_base::invalid_on_zero, 0}}); + } + + /* If the group does not exist, we create it. */ + if (_cache_host_instance[hgm.host_id()]) { + if (_hostgroup_cache.find(hgm.hostgroup_id()) == _hostgroup_cache.end()) { + SPDLOG_LOGGER_ERROR(log_v2::sql(), + "SQL: host group {} {} does not exist - insertion " + "before insertion of " + "members", + hgm.hostgroup_id(), hgm.name()); + _prepare_pb_hg_insupdate_statement(); + + neb::pb_host_group hg; + hg.mut_obj().set_hostgroup_id(hgm.hostgroup_id()); + hg.mut_obj().set_name(hgm.name()); + hg.mut_obj().set_enabled(true); + hg.mut_obj().set_poller_id(_cache_host_instance[hgm.host_id()]); + + _pb_host_group_insupdate << hg; + _mysql.run_statement(_pb_host_group_insupdate, + database::mysql_error::store_host_group, conn); + _hostgroup_cache.insert(hgm.hostgroup_id()); + } + + _pb_host_group_member_insert << hgmp; + _mysql.run_statement(_pb_host_group_member_insert, + database::mysql_error::store_host_group_member, + conn); + _add_action(conn, actions::hostgroups); + } else + SPDLOG_LOGGER_ERROR( + log_v2::sql(), + "SQL: host with host_id = {} does not exist - unable to store " + "unexisting host in a hostgroup. You should restart centengine.", + hgm.host_id()); + } + // Delete. + else { + // Log message. + SPDLOG_LOGGER_INFO( + log_v2::sql(), + "SQL: disabling membership of host {} to host group {} on instance {}", + hgm.host_id(), hgm.hostgroup_id(), hgm.poller_id()); + + if (cache_ptr) { + cache_ptr->remove_host_from_group(hgm.hostgroup_id(), hgm.host_id()); + } + + std::string query = fmt::format( + "DELETE FROM hosts_hostgroup WHERE host_id={} and hostgroup_id = {}", + hgm.host_id(), hgm.hostgroup_id()); + + _mysql.run_query(query, database::mysql_error::delete_host_group_member, + conn); + _add_action(conn, actions::hostgroups); + } +} + /** * Process an host event. * @@ -1719,257 +1979,13 @@ void stream::_process_pb_host(const std::shared_ptr& d) { uint64_t res_id = 0; if (_store_in_resources) { - auto found = _resource_cache.find({h.host_id(), 0}); - - if (h.enabled()) { - uint64_t sid = 0; - fmt::string_view name{misc::string::truncate( - h.name(), get_resources_col_size(resources_name))}; - fmt::string_view address{misc::string::truncate( - h.address(), get_resources_col_size(resources_address))}; - fmt::string_view alias{misc::string::truncate( - h.alias(), get_resources_col_size(resources_alias))}; - fmt::string_view parent_name{misc::string::truncate( - h.name(), get_resources_col_size(resources_parent_name))}; - fmt::string_view notes_url{misc::string::truncate( - h.notes_url(), get_resources_col_size(resources_notes_url))}; - fmt::string_view notes{misc::string::truncate( - h.notes(), get_resources_col_size(resources_notes))}; - fmt::string_view action_url{misc::string::truncate( - h.action_url(), get_resources_col_size(resources_action_url))}; - - // INSERT - if (found == _resource_cache.end()) { - _resources_host_insert.bind_value_as_u64(0, h.host_id()); - _resources_host_insert.bind_value_as_u32(1, h.state()); - _resources_host_insert.bind_value_as_u32( - 2, hst_ordered_status[h.state()]); - _resources_host_insert.bind_value_as_u64_ext( - 3u, h.last_state_change(), mapping::entry::invalid_on_zero); - _resources_host_insert.bind_value_as_bool( - 4, h.scheduled_downtime_depth() > 0); - _resources_host_insert.bind_value_as_bool( - 5, h.acknowledgement_type() != AckType::NONE); - _resources_host_insert.bind_value_as_bool( - 6, h.state_type() == Host_StateType_HARD); - _resources_host_insert.bind_value_as_u32(7, h.check_attempt()); - _resources_host_insert.bind_value_as_u32(8, h.max_check_attempts()); - _resources_host_insert.bind_value_as_u64( - 9, _cache_host_instance[h.host_id()]); - if (h.severity_id()) { - sid = _severity_cache[{h.severity_id(), 1}]; - SPDLOG_LOGGER_DEBUG(log_v2::sql(), - "host {} with severity_id {} => uid = {}", - h.host_id(), h.severity_id(), sid); - } else - SPDLOG_LOGGER_INFO(log_v2::sql(), - "no host severity found in cache for host {}", - h.host_id()); - if (sid) - _resources_host_insert.bind_value_as_u64(10, sid); - else - _resources_host_insert.bind_null_u64(10); - _resources_host_insert.bind_value_as_str(11, name); - _resources_host_insert.bind_value_as_str(12, address); - _resources_host_insert.bind_value_as_str(13, alias); - _resources_host_insert.bind_value_as_str(14, parent_name); - _resources_host_insert.bind_value_as_str(15, notes_url); - _resources_host_insert.bind_value_as_str(16, notes); - _resources_host_insert.bind_value_as_str(17, action_url); - _resources_host_insert.bind_value_as_bool(18, h.notify()); - _resources_host_insert.bind_value_as_bool(19, h.passive_checks()); - _resources_host_insert.bind_value_as_bool(20, h.active_checks()); - _resources_host_insert.bind_value_as_u64(21, h.icon_id()); - - std::promise p; - std::future future = p.get_future(); - _mysql.run_statement_and_get_int( - _resources_host_insert, std::move(p), - database::mysql_task::LAST_INSERT_ID, conn); - _add_action(conn, actions::resources); - try { - res_id = future.get(); - _resource_cache.insert({{h.host_id(), 0}, res_id}); - } catch (const std::exception& e) { - SPDLOG_LOGGER_CRITICAL( - log_v2::sql(), - "SQL: unable to insert new host resource {}: {}", h.host_id(), - e.what()); - - std::promise promise_resource; - std::future future_resource = - promise_resource.get_future(); - _mysql.run_query_and_get_result( - fmt::format("SELECT resource_id FROM resources WHERE " - "parent_id=0 AND id={}", - h.host_id()), - std::move(promise_resource)); - try { - mysql_result res{future_resource.get()}; - if (_mysql.fetch_row(res)) { - auto r = _resource_cache.insert( - {{h.host_id(), 0}, res.value_as_u64(0)}); - found = r.first; - SPDLOG_LOGGER_DEBUG( - log_v2::sql(), - "Host resource (host {}) found in database with id {}", - h.host_id(), found->second); - } else { - SPDLOG_LOGGER_CRITICAL( - log_v2::sql(), - "Could not insert host resource in database and no host " - "resource in database with id {}: {}", - h.host_id(), e.what()); - return; - } - } catch (const std::exception& e) { - SPDLOG_LOGGER_CRITICAL( - log_v2::sql(), - "No host resource in database with id {}: {}", h.host_id(), - e.what()); - return; - } - } - SPDLOG_LOGGER_DEBUG(log_v2::sql(), "insert resource {} for host{}", - res_id, h.host_id()); - } - if (res_id == 0) { - res_id = found->second; - SPDLOG_LOGGER_DEBUG(log_v2::sql(), "update resource {} for host{}", - res_id, h.host_id()); - // UPDATE - _resources_host_update.bind_value_as_u32(0, h.state()); - _resources_host_update.bind_value_as_u32( - 1, hst_ordered_status[h.state()]); - _resources_host_update.bind_value_as_u64_ext( - 2, h.last_state_change(), mapping::entry::invalid_on_zero); - _resources_host_update.bind_value_as_bool( - 3, h.scheduled_downtime_depth() > 0); - _resources_host_update.bind_value_as_bool( - 4, h.acknowledgement_type() != AckType::NONE); - _resources_host_update.bind_value_as_bool( - 5, h.state_type() == Host_StateType_HARD); - _resources_host_update.bind_value_as_u32(6, h.check_attempt()); - _resources_host_update.bind_value_as_u32(7, h.max_check_attempts()); - _resources_host_update.bind_value_as_u64( - 8, _cache_host_instance[h.host_id()]); - if (h.severity_id()) { - sid = _severity_cache[{h.severity_id(), 1}]; - SPDLOG_LOGGER_DEBUG(log_v2::sql(), - "host {} with severity_id {} => uid = {}", - h.host_id(), h.severity_id(), sid); - } else - SPDLOG_LOGGER_INFO(log_v2::sql(), - "no host severity found in cache for host {}", - h.host_id()); - if (sid) - _resources_host_update.bind_value_as_u64(9, sid); - else - _resources_host_update.bind_null_u64(9); - _resources_host_update.bind_value_as_str(10, name); - _resources_host_update.bind_value_as_str(11, address); - _resources_host_update.bind_value_as_str(12, alias); - _resources_host_update.bind_value_as_str(13, parent_name); - _resources_host_update.bind_value_as_str(14, notes_url); - _resources_host_update.bind_value_as_str(15, notes); - _resources_host_update.bind_value_as_str(16, action_url); - _resources_host_update.bind_value_as_bool(17, h.notify()); - _resources_host_update.bind_value_as_bool(18, h.passive_checks()); - _resources_host_update.bind_value_as_bool(19, h.active_checks()); - _resources_host_update.bind_value_as_u64(20, h.icon_id()); - _resources_host_update.bind_value_as_u64(21, res_id); - - _mysql.run_statement(_resources_host_update, - database::mysql_error::store_host_resources, - conn); - _add_action(conn, actions::resources); - } - - if (!_resources_tags_insert.prepared()) { - _resources_tags_insert = _mysql.prepare_query( - "INSERT INTO resources_tags (tag_id,resource_id) " - "VALUES(?,?)"); - } - if (!_resources_tags_remove.prepared()) - _resources_tags_remove = _mysql.prepare_query( - "DELETE FROM resources_tags WHERE resource_id=?"); - _finish_action(-1, actions::tags); - _resources_tags_remove.bind_value_as_u64(0, res_id); - _mysql.run_statement(_resources_tags_remove, - database::mysql_error::delete_resources_tags, - conn); - for (auto& tag : h.tags()) { - SPDLOG_LOGGER_DEBUG(log_v2::sql(), - "add tag ({}, {}) for resource {} for host{}", - tag.id(), tag.type(), res_id, h.host_id()); - - auto it_tags_cache = _tags_cache.find({tag.id(), tag.type()}); - - if (it_tags_cache == _tags_cache.end()) { - SPDLOG_LOGGER_ERROR( - log_v2::sql(), - "SQL: could not find in cache the tag ({}, {}) for host " - "'{}': " - "trying to add it.", - tag.id(), tag.type(), h.host_id()); - if (!_tag_insert.prepared()) - _tag_insert = _mysql.prepare_query( - "INSERT INTO tags (id,type,name) VALUES(?,?,?)"); - _tag_insert.bind_value_as_u64(0, tag.id()); - _tag_insert.bind_value_as_u32(1, tag.type()); - _tag_insert.bind_value_as_str(2, "(unknown)"); - std::promise p; - std::future future = p.get_future(); - - _mysql.run_statement_and_get_int( - _tag_insert, std::move(p), - database::mysql_task::LAST_INSERT_ID, conn); - try { - uint64_t tag_id = future.get(); - it_tags_cache = - _tags_cache.insert({{tag.id(), tag.type()}, tag_id}).first; - } catch (const std::exception& e) { - SPDLOG_LOGGER_ERROR(log_v2::sql(), - "SQL: unable to insert new tag ({},{}): {}", - tag.id(), tag.type(), e.what()); - } - } - - if (it_tags_cache != _tags_cache.end()) { - _resources_tags_insert.bind_value_as_u64(0, - it_tags_cache->second); - _resources_tags_insert.bind_value_as_u64(1, res_id); - SPDLOG_LOGGER_DEBUG( - log_v2::sql(), - "SQL: new relation between host (resource_id: {}, host_id: " - "{}) " - "and tag ({},{})", - res_id, h.host_id(), tag.id(), tag.type()); - _mysql.run_statement( - _resources_tags_insert, - database::mysql_error::store_tags_resources_tags, conn); - _add_action(conn, actions::resources_tags); - } - } - } else { - if (found != _resource_cache.end()) { - _resources_disable.bind_value_as_u64(0, found->second); - - _mysql.run_statement(_resources_disable, - database::mysql_error::clean_resources, conn); - _resource_cache.erase(found); - _add_action(conn, actions::resources); - } else { - SPDLOG_LOGGER_INFO( - log_v2::sql(), - "SQL: no need to remove host {}, it is not in database", - h.host_id()); - } - } + res_id = _process_pb_host_in_resources(h, conn); } if (cache_ptr) { auto tag_iter = h.tags().begin(); - cache_ptr->store_host(h.host_id(), h.name(), res_id, h.severity_id()); + if (res_id) { + cache_ptr->store_host(h.host_id(), h.name(), res_id, h.severity_id()); + } cache_ptr->set_host_tag(h.host_id(), [&tag_iter, &h]() -> uint64_t { return tag_iter == h.tags().end() ? 0 : (tag_iter++)->id(); }); @@ -1983,6 +1999,251 @@ void stream::_process_pb_host(const std::shared_ptr& d) { } } +uint64_t stream::_process_pb_host_in_resources(const Host& h, int32_t conn) { + auto found = _resource_cache.find({h.host_id(), 0}); + + uint64_t res_id = 0; + if (h.enabled()) { + uint64_t sid = 0; + fmt::string_view name{misc::string::truncate( + h.name(), get_resources_col_size(resources_name))}; + fmt::string_view address{misc::string::truncate( + h.address(), get_resources_col_size(resources_address))}; + fmt::string_view alias{misc::string::truncate( + h.alias(), get_resources_col_size(resources_alias))}; + fmt::string_view parent_name{misc::string::truncate( + h.name(), get_resources_col_size(resources_parent_name))}; + fmt::string_view notes_url{misc::string::truncate( + h.notes_url(), get_resources_col_size(resources_notes_url))}; + fmt::string_view notes{misc::string::truncate( + h.notes(), get_resources_col_size(resources_notes))}; + fmt::string_view action_url{misc::string::truncate( + h.action_url(), get_resources_col_size(resources_action_url))}; + + // INSERT + if (found == _resource_cache.end()) { + _resources_host_insert.bind_value_as_u64(0, h.host_id()); + _resources_host_insert.bind_value_as_u32(1, h.state()); + _resources_host_insert.bind_value_as_u32(2, + hst_ordered_status[h.state()]); + _resources_host_insert.bind_value_as_u64_ext( + 3u, h.last_state_change(), mapping::entry::invalid_on_zero); + _resources_host_insert.bind_value_as_bool( + 4, h.scheduled_downtime_depth() > 0); + _resources_host_insert.bind_value_as_bool( + 5, h.acknowledgement_type() != AckType::NONE); + _resources_host_insert.bind_value_as_bool( + 6, h.state_type() == Host_StateType_HARD); + _resources_host_insert.bind_value_as_u32(7, h.check_attempt()); + _resources_host_insert.bind_value_as_u32(8, h.max_check_attempts()); + _resources_host_insert.bind_value_as_u64( + 9, _cache_host_instance[h.host_id()]); + if (h.severity_id()) { + sid = _severity_cache[{h.severity_id(), 1}]; + SPDLOG_LOGGER_DEBUG(log_v2::sql(), + "host {} with severity_id {} => uid = {}", + h.host_id(), h.severity_id(), sid); + } else + SPDLOG_LOGGER_INFO(log_v2::sql(), + "no host severity found in cache for host {}", + h.host_id()); + if (sid) + _resources_host_insert.bind_value_as_u64(10, sid); + else + _resources_host_insert.bind_null_u64(10); + _resources_host_insert.bind_value_as_str(11, name); + _resources_host_insert.bind_value_as_str(12, address); + _resources_host_insert.bind_value_as_str(13, alias); + _resources_host_insert.bind_value_as_str(14, parent_name); + _resources_host_insert.bind_value_as_str(15, notes_url); + _resources_host_insert.bind_value_as_str(16, notes); + _resources_host_insert.bind_value_as_str(17, action_url); + _resources_host_insert.bind_value_as_bool(18, h.notify()); + _resources_host_insert.bind_value_as_bool(19, h.passive_checks()); + _resources_host_insert.bind_value_as_bool(20, h.active_checks()); + _resources_host_insert.bind_value_as_u64(21, h.icon_id()); + + std::promise p; + std::future future = p.get_future(); + _mysql.run_statement_and_get_int( + _resources_host_insert, std::move(p), + database::mysql_task::LAST_INSERT_ID, conn); + _add_action(conn, actions::resources); + try { + res_id = future.get(); + _resource_cache.insert({{h.host_id(), 0}, res_id}); + } catch (const std::exception& e) { + SPDLOG_LOGGER_CRITICAL(log_v2::sql(), + "SQL: unable to insert new host resource {}: {}", + h.host_id(), e.what()); + + std::promise promise_resource; + std::future future_resource = + promise_resource.get_future(); + _mysql.run_query_and_get_result( + fmt::format("SELECT resource_id FROM resources WHERE " + "parent_id=0 AND id={}", + h.host_id()), + std::move(promise_resource)); + try { + mysql_result res{future_resource.get()}; + if (_mysql.fetch_row(res)) { + auto r = + _resource_cache.insert({{h.host_id(), 0}, res.value_as_u64(0)}); + found = r.first; + SPDLOG_LOGGER_DEBUG( + log_v2::sql(), + "Host resource (host {}) found in database with id {}", + h.host_id(), found->second); + } else { + SPDLOG_LOGGER_CRITICAL( + log_v2::sql(), + "Could not insert host resource in database and no host " + "resource in database with id {}: {}", + h.host_id(), e.what()); + return 0; + } + } catch (const std::exception& e) { + SPDLOG_LOGGER_CRITICAL(log_v2::sql(), + "No host resource in database with id {}: {}", + h.host_id(), e.what()); + return 0; + } + } + SPDLOG_LOGGER_DEBUG(log_v2::sql(), "insert resource {} for host{}", + res_id, h.host_id()); + } + if (res_id == 0) { + res_id = found->second; + SPDLOG_LOGGER_DEBUG(log_v2::sql(), "update resource {} for host{}", + res_id, h.host_id()); + // UPDATE + _resources_host_update.bind_value_as_u32(0, h.state()); + _resources_host_update.bind_value_as_u32(1, + hst_ordered_status[h.state()]); + _resources_host_update.bind_value_as_u64_ext( + 2, h.last_state_change(), mapping::entry::invalid_on_zero); + _resources_host_update.bind_value_as_bool( + 3, h.scheduled_downtime_depth() > 0); + _resources_host_update.bind_value_as_bool( + 4, h.acknowledgement_type() != AckType::NONE); + _resources_host_update.bind_value_as_bool( + 5, h.state_type() == Host_StateType_HARD); + _resources_host_update.bind_value_as_u32(6, h.check_attempt()); + _resources_host_update.bind_value_as_u32(7, h.max_check_attempts()); + _resources_host_update.bind_value_as_u64( + 8, _cache_host_instance[h.host_id()]); + if (h.severity_id()) { + sid = _severity_cache[{h.severity_id(), 1}]; + SPDLOG_LOGGER_DEBUG(log_v2::sql(), + "host {} with severity_id {} => uid = {}", + h.host_id(), h.severity_id(), sid); + } else + SPDLOG_LOGGER_INFO(log_v2::sql(), + "no host severity found in cache for host {}", + h.host_id()); + if (sid) + _resources_host_update.bind_value_as_u64(9, sid); + else + _resources_host_update.bind_null_u64(9); + _resources_host_update.bind_value_as_str(10, name); + _resources_host_update.bind_value_as_str(11, address); + _resources_host_update.bind_value_as_str(12, alias); + _resources_host_update.bind_value_as_str(13, parent_name); + _resources_host_update.bind_value_as_str(14, notes_url); + _resources_host_update.bind_value_as_str(15, notes); + _resources_host_update.bind_value_as_str(16, action_url); + _resources_host_update.bind_value_as_bool(17, h.notify()); + _resources_host_update.bind_value_as_bool(18, h.passive_checks()); + _resources_host_update.bind_value_as_bool(19, h.active_checks()); + _resources_host_update.bind_value_as_u64(20, h.icon_id()); + _resources_host_update.bind_value_as_u64(21, res_id); + + _mysql.run_statement(_resources_host_update, + database::mysql_error::store_host_resources, conn); + _add_action(conn, actions::resources); + } + + if (!_resources_tags_insert.prepared()) { + _resources_tags_insert = _mysql.prepare_query( + "INSERT INTO resources_tags (tag_id,resource_id) " + "VALUES(?,?)"); + } + if (!_resources_tags_remove.prepared()) + _resources_tags_remove = _mysql.prepare_query( + "DELETE FROM resources_tags WHERE resource_id=?"); + _finish_action(-1, actions::tags); + _resources_tags_remove.bind_value_as_u64(0, res_id); + _mysql.run_statement(_resources_tags_remove, + database::mysql_error::delete_resources_tags, conn); + for (auto& tag : h.tags()) { + SPDLOG_LOGGER_DEBUG(log_v2::sql(), + "add tag ({}, {}) for resource {} for host{}", + tag.id(), tag.type(), res_id, h.host_id()); + + auto it_tags_cache = _tags_cache.find({tag.id(), tag.type()}); + + if (it_tags_cache == _tags_cache.end()) { + SPDLOG_LOGGER_ERROR( + log_v2::sql(), + "SQL: could not find in cache the tag ({}, {}) for host " + "'{}': " + "trying to add it.", + tag.id(), tag.type(), h.host_id()); + if (!_tag_insert_update.prepared()) + _tag_insert_update = _mysql.prepare_query(_insert_or_update_tags); + _tag_insert_update.bind_value_as_u64(0, tag.id()); + _tag_insert_update.bind_value_as_u32(1, tag.type()); + _tag_insert_update.bind_value_as_str(2, "(unknown)"); + std::promise p; + std::future future = p.get_future(); + + _mysql.run_statement_and_get_int( + _tag_insert_update, std::move(p), + database::mysql_task::LAST_INSERT_ID, conn); + try { + uint64_t tag_id = future.get(); + it_tags_cache = + _tags_cache.insert({{tag.id(), tag.type()}, tag_id}).first; + } catch (const std::exception& e) { + SPDLOG_LOGGER_ERROR(log_v2::sql(), + "SQL: unable to insert new tag ({},{}): {}", + tag.id(), tag.type(), e.what()); + } + } + + if (it_tags_cache != _tags_cache.end()) { + _resources_tags_insert.bind_value_as_u64(0, it_tags_cache->second); + _resources_tags_insert.bind_value_as_u64(1, res_id); + SPDLOG_LOGGER_DEBUG( + log_v2::sql(), + "SQL: new relation between host (resource_id: {}, host_id: " + "{}) " + "and tag ({},{},{})", + res_id, h.host_id(), it_tags_cache->second, tag.id(), tag.type()); + _mysql.run_statement(_resources_tags_insert, + database::mysql_error::store_tags_resources_tags, + conn); + _add_action(conn, actions::resources_tags); + } + } + } else { + if (found != _resource_cache.end()) { + _resources_disable.bind_value_as_u64(0, found->second); + + _mysql.run_statement(_resources_disable, + database::mysql_error::clean_resources, conn); + _resource_cache.erase(found); + _add_action(conn, actions::resources); + } else { + SPDLOG_LOGGER_INFO( + log_v2::sql(), + "SQL: no need to remove host {}, it is not in database", h.host_id()); + } + } + return res_id; +} + /** * Process an adaptive host event. * @@ -2007,7 +2268,7 @@ void stream::_process_pb_adaptive_host(const std::shared_ptr& d) { int32_t conn = _mysql.choose_connection_by_instance( _cache_host_instance[static_cast(ah.host_id())]); - constexpr absl::string_view buf("UPDATE hosts SET"); + constexpr std::string_view buf("UPDATE hosts SET"); std::string query{buf.data(), buf.size()}; if (ah.has_notify()) query += fmt::format(" notify='{}',", ah.notify() ? 1 : 0); @@ -2066,7 +2327,7 @@ void stream::_process_pb_adaptive_host(const std::shared_ptr& d) { _add_action(conn, actions::hosts); if (_store_in_resources) { - constexpr absl::string_view res_buf("UPDATE resources SET"); + constexpr std::string_view res_buf("UPDATE resources SET"); std::string res_query{res_buf.data(), res_buf.size()}; if (ah.has_notify()) res_query += @@ -2480,7 +2741,7 @@ void stream::_process_pb_instance_status(const std::shared_ptr& d) { SPDLOG_LOGGER_DEBUG( log_v2::sql(), "SQL: processing poller status event (id: {}, last alive: {} {})", - is.instance_id(), is.last_alive(), is.DebugString()); + is.instance_id(), is.last_alive(), is.ShortDebugString()); // Processing. if (_is_valid_poller(is.instance_id())) { @@ -2744,7 +3005,7 @@ void stream::_process_pb_service_check(const std::shared_ptr& d) { // Cast object. const neb::pb_service_check& pb_sc( *static_cast(d.get())); - const Check& sc(pb_sc.obj()); + const ServiceCheck& sc(pb_sc.obj()); if (!_host_instance_known(sc.host_id())) { SPDLOG_LOGGER_WARN( @@ -2871,6 +3132,84 @@ void stream::_process_service_dependency(const std::shared_ptr& d) { } } +/** + * Process a service dependency event. + * + * @param[in] e Uncasted service dependency. + * + * @return The number of events that can be acknowledged. + */ +void stream::_process_pb_service_dependency( + const std::shared_ptr& d) { + int32_t conn = special_conn::service_dependency % _mysql.connections_count(); + _finish_action(-1, actions::hosts | actions::host_parents | + actions::downtimes | actions::comments | + actions::host_dependencies | + actions::service_dependencies); + + // Cast object. + const neb::pb_service_dependency& proto_obj = + *static_cast(d.get()); + const ServiceDependency& sd = proto_obj.obj(); + + // Insert/Update. + if (sd.enabled()) { + SPDLOG_LOGGER_INFO( + log_v2::sql(), + "SQL: enabling service dependency of ({}, {}) on ({}, {})", + sd.dependent_host_id(), sd.dependent_service_id(), sd.host_id(), + sd.service_id()); + + // Prepare queries. + if (!_pb_service_dependency_insupdate.prepared()) { + query_preparator::event_pb_unique unique{ + {6, "host_id", io::protobuf_base::invalid_on_zero, 0}, + {10, "service_id", io::protobuf_base::invalid_on_zero, 0}, + {3, "dependent_host_id", io::protobuf_base::invalid_on_zero, 0}, + {9, "dependent_service_id", io::protobuf_base::invalid_on_zero, 0}}; + query_preparator qp(neb::pb_service_dependency::static_type(), unique); + _pb_service_dependency_insupdate = qp.prepare_insert_or_update_table( + _mysql, "services_services_dependencies ", /*space is mandatory to + avoid conflict with _process_service_dependency*/ + {{6, "host_id", io::protobuf_base::invalid_on_zero, 0}, + {10, "service_id", io::protobuf_base::invalid_on_zero, 0}, + {3, "dependent_host_id", io::protobuf_base::invalid_on_zero, 0}, + {9, "dependent_service_id", io::protobuf_base::invalid_on_zero, 0}, + {2, "dependency_period", 0, + get_services_services_dependencies_col_size( + services_services_dependencies_dependency_period)}, + {5, "execution_failure_options", 0, + get_services_services_dependencies_col_size( + services_services_dependencies_execution_failure_options)}, + {7, "inherits_parent", 0, 0}, + {8, "notification_failure_options", 0, + get_services_services_dependencies_col_size( + services_services_dependencies_notification_failure_options)}}); + } + + // Process object. + _pb_service_dependency_insupdate << proto_obj; + _mysql.run_statement(_pb_service_dependency_insupdate, + database::mysql_error::store_service_dependency, conn); + _add_action(conn, actions::service_dependencies); + } + // Delete. + else { + SPDLOG_LOGGER_INFO( + log_v2::sql(), + "SQL: removing service dependency of ({}, {}) on ({}, {})", + sd.dependent_host_id(), sd.dependent_service_id(), sd.host_id(), + sd.service_id()); + std::string query(fmt::format( + "DELETE FROM services_services_dependencies WHERE dependent_host_id={} " + "AND dependent_service_id={} AND host_id={} AND service_id={}", + sd.dependent_host_id(), sd.dependent_service_id(), sd.host_id(), + sd.service_id())); + _mysql.run_query(query, database::mysql_error::empty, conn); + _add_action(conn, actions::service_dependencies); + } +} + /** * Process a service group event. * @@ -2904,7 +3243,7 @@ void stream::_process_service_group(const std::shared_ptr& d) { sg.id, sg.name, sg.poller_id); auto cache_ptr = cache::global_cache::instance_ptr(); if (cache_ptr) { - cache_ptr->remove_service_group(sg.id); + cache_ptr->remove_service_group_members(sg.id, sg.poller_id); } // Delete group members. @@ -2925,6 +3264,62 @@ void stream::_process_service_group(const std::shared_ptr& d) { _add_action(conn, actions::servicegroups); } +/** + * Process a service group event. + * + * @param[in] e Uncasted service group. + * + * @return The number of events that can be acknowledged. + */ +void stream::_process_pb_service_group(const std::shared_ptr& d) { + int32_t conn = special_conn::service_group % _mysql.connections_count(); + + // Cast object. + const neb::pb_service_group& sgp{ + *static_cast(d.get())}; + const ServiceGroup& sg = sgp.obj(); + + // Insert/update group. + if (sg.enabled()) { + SPDLOG_LOGGER_INFO(log_v2::sql(), + "SQL: enabling service group {} ('{}' on instance {})", + sg.servicegroup_id(), sg.name(), sg.poller_id()); + _prepare_pb_sg_insupdate_statement(); + + _pb_service_group_insupdate << sgp; + _mysql.run_statement(_pb_service_group_insupdate, + database::mysql_error::store_service_group, conn); + _servicegroup_cache.insert(sg.servicegroup_id()); + } + // Delete group. + else { + SPDLOG_LOGGER_INFO(log_v2::sql(), + "SQL: disabling service group {} ('{}' on instance {})", + sg.servicegroup_id(), sg.name(), sg.poller_id()); + auto cache_ptr = cache::global_cache::instance_ptr(); + if (cache_ptr) { + cache_ptr->remove_service_group_members(sg.servicegroup_id(), + sg.poller_id()); + } + + // Delete group members. + { + _finish_action(-1, actions::services); + std::string query(fmt::format( + "DELETE services_servicegroups FROM services_servicegroups " + "LEFT " + "JOIN hosts ON services_servicegroups.host_id=hosts.host_id " + "WHERE " + "services_servicegroups.servicegroup_id={} AND " + "hosts.instance_id={}", + sg.servicegroup_id(), sg.poller_id())); + _mysql.run_query(query, database::mysql_error::empty, conn); + _servicegroup_cache.erase(sg.servicegroup_id()); + } + } + _add_action(conn, actions::servicegroups); +} + /** * Process a service group member event. * @@ -2950,7 +3345,8 @@ void stream::_process_service_group_member(const std::shared_ptr& d) { sgm.host_id, sgm.service_id, sgm.group_id, sgm.poller_id); if (cache_ptr) { - cache_ptr->add_service_group(sgm.group_id, sgm.host_id, sgm.service_id); + cache_ptr->add_service_to_group(sgm.group_id, sgm.host_id, sgm.service_id, + sgm.poller_id); } // We only need to try to insert in this table as the // host_id/service_id/servicegroup_id combo should be UNIQUE. @@ -3021,6 +3417,118 @@ void stream::_process_service_group_member(const std::shared_ptr& d) { } } +/** + * Process a service group member event. + * + * @param[in] e Uncasted service group member. + * + * @return The number of events that can be acknowledged. + */ +void stream::_process_pb_service_group_member( + const std::shared_ptr& d) { + int32_t conn = special_conn::service_group % _mysql.connections_count(); + _finish_action(-1, actions::services); + + // Cast object. + const neb::pb_service_group_member& sgmp{ + *static_cast(d.get())}; + + const ServiceGroupMember& sgm = sgmp.obj(); + + auto cache_ptr = cache::global_cache::instance_ptr(); + if (sgm.enabled()) { + // Log message. + SPDLOG_LOGGER_INFO( + log_v2::sql(), + "SQL: enabling membership of service ({}, {}) to service group {} on " + "instance {}", + sgm.host_id(), sgm.service_id(), sgm.servicegroup_id(), + sgm.poller_id()); + + if (cache_ptr) { + cache_ptr->add_service_to_group(sgm.servicegroup_id(), sgm.host_id(), + sgm.service_id(), sgm.poller_id()); + } + // We only need to try to insert in this table as the + // host_id/service_id/servicegroup_id combo should be UNIQUE. + if (!_pb_service_group_member_insert.prepared()) { + query_preparator::event_pb_unique unique{ + {3, "servicegroup_id", io::protobuf_base::invalid_on_zero, 0}, + {5, "host_id", io::protobuf_base::invalid_on_zero, 0}, + {7, "service_id", io::protobuf_base::invalid_on_zero, 0}, + }; + query_preparator qp(neb::pb_service_group_member::static_type(), unique); + + _pb_service_group_member_insert = qp.prepare_insert_into( + _mysql, "services_servicegroups ", + { + {3, "servicegroup_id", io::protobuf_base::invalid_on_zero, 0}, + {5, "host_id", io::protobuf_base::invalid_on_zero, 0}, + {7, "service_id", io::protobuf_base::invalid_on_zero, 0}, + }); + } + + /* If the group does not exist, we create it. */ + if (_servicegroup_cache.find(sgm.servicegroup_id()) == + _servicegroup_cache.end()) { + SPDLOG_LOGGER_ERROR( + log_v2::sql(), + "SQL: service group {} does not exist - insertion before insertion " + "of members", + sgm.servicegroup_id()); + _prepare_sg_insupdate_statement(); + + neb::pb_service_group sg; + sg.mut_obj().set_servicegroup_id(sgm.servicegroup_id()); + sg.mut_obj().set_name(sgm.name()); + sg.mut_obj().set_enabled(true); + sg.mut_obj().set_poller_id(sgm.poller_id()); + + _pb_service_group_insupdate << sg; + _mysql.run_statement(_pb_service_group_insupdate, + database::mysql_error::store_service_group, conn); + _servicegroup_cache.insert(sgm.servicegroup_id()); + } + + _pb_service_group_member_insert << sgmp; + _mysql.run_statement(_pb_service_group_member_insert, + database::mysql_error::store_service_group_member, + conn); + _add_action(conn, actions::servicegroups); + } + // Delete. + else { + // Log message. + SPDLOG_LOGGER_INFO(log_v2::sql(), + "SQL: disabling membership of service ({}, {}) to " + "service group {} on " + "instance {}", + sgm.host_id(), sgm.service_id(), sgm.servicegroup_id(), + sgm.poller_id()); + + if (cache_ptr) { + cache_ptr->remove_service_from_group(sgm.servicegroup_id(), sgm.host_id(), + sgm.service_id()); + } + + if (!_pb_service_group_member_delete.prepared()) { + query_preparator::event_pb_unique unique{ + {3, "servicegroup_id", io::protobuf_base::invalid_on_zero, 0}, + {5, "host_id", io::protobuf_base::invalid_on_zero, 0}, + {7, "service_id", io::protobuf_base::invalid_on_zero, 0}, + }; + query_preparator qp(neb::pb_service_group_member::static_type(), unique); + _pb_service_group_member_delete = + qp.prepare_delete_table(_mysql, "services_servicegroups "); + } + _service_group_member_delete << sgmp; + _mysql.run_statement(_pb_service_group_member_delete, + database::mysql_error::delete_service_group_member, + conn); + _add_action(conn, actions::servicegroups); + } +} + /** * Process a service event. * @@ -3266,253 +3774,14 @@ void stream::_process_pb_service(const std::shared_ptr& d) { uint64_t res_id = 0; if (_store_in_resources) { - auto found = _resource_cache.find({s.service_id(), s.host_id()}); - - if (s.enabled()) { - uint64_t sid = 0; - fmt::string_view name{misc::string::truncate( - s.display_name(), get_resources_col_size(resources_name))}; - fmt::string_view parent_name{misc::string::truncate( - s.host_name(), get_resources_col_size(resources_parent_name))}; - fmt::string_view notes_url{misc::string::truncate( - s.notes_url(), get_resources_col_size(resources_notes_url))}; - fmt::string_view notes{misc::string::truncate( - s.notes(), get_resources_col_size(resources_notes))}; - fmt::string_view action_url{misc::string::truncate( - s.action_url(), get_resources_col_size(resources_action_url))}; - - // INSERT - if (found == _resource_cache.end()) { - _resources_service_insert.bind_value_as_u64(0, s.service_id()); - _resources_service_insert.bind_value_as_u64(1, s.host_id()); - _resources_service_insert.bind_value_as_u32(2, s.type()); - if (s.internal_id()) - _resources_service_insert.bind_value_as_u64(3, s.internal_id()); - else - _resources_service_insert.bind_null_u64(3); - _resources_service_insert.bind_value_as_u32(4, s.state()); - _resources_service_insert.bind_value_as_u32( - 5, svc_ordered_status[s.state()]); - _resources_service_insert.bind_value_as_u64_ext( - 6, s.last_state_change(), mapping::entry::invalid_on_zero); - _resources_service_insert.bind_value_as_bool( - 7, s.scheduled_downtime_depth() > 0); - _resources_service_insert.bind_value_as_bool( - 8, s.acknowledgement_type() != AckType::NONE); - _resources_service_insert.bind_value_as_bool( - 9, s.state_type() == Service_StateType_HARD); - _resources_service_insert.bind_value_as_u32(10, s.check_attempt()); - _resources_service_insert.bind_value_as_u32(11, - s.max_check_attempts()); - _resources_service_insert.bind_value_as_u64( - 12, _cache_host_instance[s.host_id()]); - if (s.severity_id() > 0) { - sid = _severity_cache[{s.severity_id(), 0}]; - SPDLOG_LOGGER_DEBUG( - log_v2::sql(), - "service ({}, {}) with severity_id {} => uid = {}", s.host_id(), - s.service_id(), s.severity_id(), sid); - } - if (sid) - _resources_service_insert.bind_value_as_u64(13, sid); - else - _resources_service_insert.bind_null_u64(13); - _resources_service_insert.bind_value_as_str(14, name); - _resources_service_insert.bind_value_as_str(15, parent_name); - _resources_service_insert.bind_value_as_str(16, notes_url); - _resources_service_insert.bind_value_as_str(17, notes); - _resources_service_insert.bind_value_as_str(18, action_url); - _resources_service_insert.bind_value_as_bool(19, s.notify()); - _resources_service_insert.bind_value_as_bool(20, s.passive_checks()); - _resources_service_insert.bind_value_as_bool(21, s.active_checks()); - _resources_service_insert.bind_value_as_u64(22, s.icon_id()); - - std::promise p; - std::future future = p.get_future(); - _mysql.run_statement_and_get_int( - _resources_service_insert, std::move(p), - database::mysql_task::LAST_INSERT_ID, conn); - _add_action(conn, actions::resources); - try { - res_id = future.get(); - _resource_cache.insert({{s.service_id(), s.host_id()}, res_id}); - } catch (const std::exception& e) { - SPDLOG_LOGGER_CRITICAL( - log_v2::sql(), - "SQL: unable to insert new service resource ({}, {}): {}", - s.host_id(), s.service_id(), e.what()); - - std::promise promise_resource; - std::future future_resource = - promise_resource.get_future(); - _mysql.run_query_and_get_result( - fmt::format("SELECT resource_id FROM resources WHERE " - "parent_id={} AND id={}", - s.host_id(), s.service_id()), - std::move(promise_resource)); - try { - mysql_result res{future_resource.get()}; - if (_mysql.fetch_row(res)) { - auto r = _resource_cache.insert( - {{s.service_id(), s.host_id()}, res.value_as_u64(0)}); - found = r.first; - SPDLOG_LOGGER_DEBUG( - log_v2::sql(), - "Service resource ({}, {}) found in database with id {}", - s.host_id(), s.service_id(), found->second); - } else { - SPDLOG_LOGGER_CRITICAL( - log_v2::sql(), - "Could not insert service resource in database and no " - "service resource in database with id ({},{}): {}", - s.host_id(), s.service_id(), e.what()); - return; - } - } catch (const std::exception& e) { - SPDLOG_LOGGER_CRITICAL( - log_v2::sql(), - "No service resource in database with id ({}, {}): {}", - s.host_id(), s.service_id(), e.what()); - return; - } - } - } - if (res_id == 0) { - res_id = found->second; - // UPDATE - _resources_service_update.bind_value_as_u32(0, s.type()); - if (s.internal_id()) - _resources_service_update.bind_value_as_u64(1, s.internal_id()); - else - _resources_service_update.bind_null_u64(1); - _resources_service_update.bind_value_as_u32(2, s.state()); - _resources_service_update.bind_value_as_u32( - 3, svc_ordered_status[s.state()]); - _resources_service_update.bind_value_as_u64_ext( - 4, s.last_state_change(), mapping::entry::invalid_on_zero); - _resources_service_update.bind_value_as_bool( - 5, s.scheduled_downtime_depth() > 0); - _resources_service_update.bind_value_as_bool( - 6, s.acknowledgement_type() != AckType::NONE); - _resources_service_update.bind_value_as_bool( - 7, s.state_type() == Service_StateType_HARD); - _resources_service_update.bind_value_as_u32(8, s.check_attempt()); - _resources_service_update.bind_value_as_u32(9, - s.max_check_attempts()); - _resources_service_update.bind_value_as_u64( - 10, _cache_host_instance[s.host_id()]); - if (s.severity_id() > 0) { - sid = _severity_cache[{s.severity_id(), 0}]; - SPDLOG_LOGGER_DEBUG( - log_v2::sql(), - "service ({}, {}) with severity_id {} => uid = {}", s.host_id(), - s.service_id(), s.severity_id(), sid); - } - if (sid) - _resources_service_update.bind_value_as_u64(11, sid); - else - _resources_service_update.bind_null_u64(11); - _resources_service_update.bind_value_as_str(12, name); - _resources_service_update.bind_value_as_str(13, parent_name); - _resources_service_update.bind_value_as_str(14, notes_url); - _resources_service_update.bind_value_as_str(15, notes); - _resources_service_update.bind_value_as_str(16, action_url); - _resources_service_update.bind_value_as_bool(17, s.notify()); - _resources_service_update.bind_value_as_bool(18, s.passive_checks()); - _resources_service_update.bind_value_as_bool(19, s.active_checks()); - _resources_service_update.bind_value_as_u64(20, s.icon_id()); - _resources_service_update.bind_value_as_u64(21, res_id); - - _mysql.run_statement(_resources_service_update, - database::mysql_error::store_service, conn); - _add_action(conn, actions::resources); - } - - if (!_resources_tags_insert.prepared()) { - _resources_tags_insert = _mysql.prepare_query( - "INSERT INTO resources_tags (tag_id,resource_id) " - "VALUES(?,?)"); - } - if (!_resources_tags_remove.prepared()) - _resources_tags_remove = _mysql.prepare_query( - "DELETE FROM resources_tags WHERE resource_id=?"); - _finish_action(-1, actions::tags); - _resources_tags_remove.bind_value_as_u64(0, res_id); - _mysql.run_statement(_resources_tags_remove, - database::mysql_error::delete_resources_tags, - conn); - for (auto& tag : s.tags()) { - auto it_tags_cache = _tags_cache.find({tag.id(), tag.type()}); - - if (it_tags_cache == _tags_cache.end()) { - SPDLOG_LOGGER_ERROR( - log_v2::sql(), - "SQL: could not find in cache the tag ({}, {}) for service " - "({},{}): trying to add it.", - tag.id(), tag.type(), s.host_id(), s.service_id()); - if (!_tag_insert.prepared()) - _tag_insert = _mysql.prepare_query( - "INSERT INTO tags (id,type,name) VALUES(?,?,?)"); - _tag_insert.bind_value_as_u64(0, tag.id()); - _tag_insert.bind_value_as_u32(1, tag.type()); - _tag_insert.bind_value_as_str(2, "(unknown)"); - std::promise p; - std::future future = p.get_future(); - _mysql.run_statement_and_get_int( - _tag_insert, std::move(p), database::mysql_task::LAST_INSERT_ID, - conn); - try { - uint64_t tag_id = future.get(); - it_tags_cache = - _tags_cache.insert({{tag.id(), tag.type()}, tag_id}).first; - } catch (const std::exception& e) { - SPDLOG_LOGGER_ERROR(log_v2::sql(), - "SQL: unable to insert new tag ({},{}): {}", - tag.id(), tag.type(), e.what()); - } - } - - if (it_tags_cache != _tags_cache.end()) { - _resources_tags_insert.bind_value_as_u64(0, it_tags_cache->second); - _resources_tags_insert.bind_value_as_u64(1, res_id); - SPDLOG_LOGGER_DEBUG( - log_v2::sql(), - "SQL: new relation between service (resource_id: {}, ({}, " - "{})) and tag ({},{})", - res_id, s.host_id(), s.service_id(), tag.id(), tag.type()); - _mysql.run_statement( - _resources_tags_insert, - database::mysql_error::store_tags_resources_tags, conn); - _add_action(conn, actions::resources_tags); - } else { - SPDLOG_LOGGER_ERROR( - log_v2::sql(), - "SQL: could not find the tag ({}, {}) in cache for host '{}'", - tag.id(), tag.type(), s.service_id()); - } - } - } else { - if (found != _resource_cache.end()) { - _resources_disable.bind_value_as_u64(0, found->second); - - _mysql.run_statement(_resources_disable, - database::mysql_error::clean_resources, conn); - _resource_cache.erase(found); - _add_action(conn, actions::resources); - } else { - SPDLOG_LOGGER_INFO( - log_v2::sql(), - "SQL: no need to remove service ({}, {}), it is not in " - "database", - s.host_id(), s.service_id()); - } - } + res_id = _process_pb_service_in_resources(s, conn); } if (cache_ptr) { auto tag_iter = s.tags().begin(); - cache_ptr->store_service(s.host_id(), s.service_id(), s.description(), - res_id, s.severity_id()); - + if (res_id) { + cache_ptr->store_service(s.host_id(), s.service_id(), s.description(), + res_id, s.severity_id()); + } cache_ptr->set_serv_tag( s.host_id(), s.service_id(), [&tag_iter, &s]() -> uint64_t { return tag_iter == s.tags().end() ? 0 : (tag_iter++)->id(); @@ -3526,6 +3795,247 @@ void stream::_process_pb_service(const std::shared_ptr& d) { s.description()); } +uint64_t stream::_process_pb_service_in_resources(const Service& s, + int32_t conn) { + uint64_t res_id = 0; + + auto found = _resource_cache.find({s.service_id(), s.host_id()}); + + if (s.enabled()) { + uint64_t sid = 0; + fmt::string_view name{misc::string::truncate( + s.display_name(), get_resources_col_size(resources_name))}; + fmt::string_view parent_name{misc::string::truncate( + s.host_name(), get_resources_col_size(resources_parent_name))}; + fmt::string_view notes_url{misc::string::truncate( + s.notes_url(), get_resources_col_size(resources_notes_url))}; + fmt::string_view notes{misc::string::truncate( + s.notes(), get_resources_col_size(resources_notes))}; + fmt::string_view action_url{misc::string::truncate( + s.action_url(), get_resources_col_size(resources_action_url))}; + + // INSERT + if (found == _resource_cache.end()) { + _resources_service_insert.bind_value_as_u64(0, s.service_id()); + _resources_service_insert.bind_value_as_u64(1, s.host_id()); + _resources_service_insert.bind_value_as_u32(2, s.type()); + if (s.internal_id()) + _resources_service_insert.bind_value_as_u64(3, s.internal_id()); + else + _resources_service_insert.bind_null_u64(3); + _resources_service_insert.bind_value_as_u32(4, s.state()); + _resources_service_insert.bind_value_as_u32( + 5, svc_ordered_status[s.state()]); + _resources_service_insert.bind_value_as_u64_ext( + 6, s.last_state_change(), mapping::entry::invalid_on_zero); + _resources_service_insert.bind_value_as_bool( + 7, s.scheduled_downtime_depth() > 0); + _resources_service_insert.bind_value_as_bool( + 8, s.acknowledgement_type() != AckType::NONE); + _resources_service_insert.bind_value_as_bool( + 9, s.state_type() == Service_StateType_HARD); + _resources_service_insert.bind_value_as_u32(10, s.check_attempt()); + _resources_service_insert.bind_value_as_u32(11, s.max_check_attempts()); + _resources_service_insert.bind_value_as_u64( + 12, _cache_host_instance[s.host_id()]); + if (s.severity_id() > 0) { + sid = _severity_cache[{s.severity_id(), 0}]; + SPDLOG_LOGGER_DEBUG(log_v2::sql(), + "service ({}, {}) with severity_id {} => uid = {}", + s.host_id(), s.service_id(), s.severity_id(), sid); + } + if (sid) + _resources_service_insert.bind_value_as_u64(13, sid); + else + _resources_service_insert.bind_null_u64(13); + _resources_service_insert.bind_value_as_str(14, name); + _resources_service_insert.bind_value_as_str(15, parent_name); + _resources_service_insert.bind_value_as_str(16, notes_url); + _resources_service_insert.bind_value_as_str(17, notes); + _resources_service_insert.bind_value_as_str(18, action_url); + _resources_service_insert.bind_value_as_bool(19, s.notify()); + _resources_service_insert.bind_value_as_bool(20, s.passive_checks()); + _resources_service_insert.bind_value_as_bool(21, s.active_checks()); + _resources_service_insert.bind_value_as_u64(22, s.icon_id()); + + std::promise p; + std::future future = p.get_future(); + _mysql.run_statement_and_get_int( + _resources_service_insert, std::move(p), + database::mysql_task::LAST_INSERT_ID, conn); + _add_action(conn, actions::resources); + try { + res_id = future.get(); + _resource_cache.insert({{s.service_id(), s.host_id()}, res_id}); + } catch (const std::exception& e) { + SPDLOG_LOGGER_CRITICAL( + log_v2::sql(), + "SQL: unable to insert new service resource ({}, {}): {}", + s.host_id(), s.service_id(), e.what()); + + std::promise promise_resource; + std::future future_resource = + promise_resource.get_future(); + _mysql.run_query_and_get_result( + fmt::format("SELECT resource_id FROM resources WHERE " + "parent_id={} AND id={}", + s.host_id(), s.service_id()), + std::move(promise_resource)); + try { + mysql_result res{future_resource.get()}; + if (_mysql.fetch_row(res)) { + auto r = _resource_cache.insert( + {{s.service_id(), s.host_id()}, res.value_as_u64(0)}); + found = r.first; + SPDLOG_LOGGER_DEBUG( + log_v2::sql(), + "Service resource ({}, {}) found in database with id {}", + s.host_id(), s.service_id(), found->second); + } else { + SPDLOG_LOGGER_CRITICAL( + log_v2::sql(), + "Could not insert service resource in database and no " + "service resource in database with id ({},{}): {}", + s.host_id(), s.service_id(), e.what()); + return 0; + } + } catch (const std::exception& e) { + SPDLOG_LOGGER_CRITICAL( + log_v2::sql(), + "No service resource in database with id ({}, {}): {}", + s.host_id(), s.service_id(), e.what()); + return 0; + } + } + } + if (res_id == 0) { + res_id = found->second; + // UPDATE + _resources_service_update.bind_value_as_u32(0, s.type()); + if (s.internal_id()) + _resources_service_update.bind_value_as_u64(1, s.internal_id()); + else + _resources_service_update.bind_null_u64(1); + _resources_service_update.bind_value_as_u32(2, s.state()); + _resources_service_update.bind_value_as_u32( + 3, svc_ordered_status[s.state()]); + _resources_service_update.bind_value_as_u64_ext( + 4, s.last_state_change(), mapping::entry::invalid_on_zero); + _resources_service_update.bind_value_as_bool( + 5, s.scheduled_downtime_depth() > 0); + _resources_service_update.bind_value_as_bool( + 6, s.acknowledgement_type() != AckType::NONE); + _resources_service_update.bind_value_as_bool( + 7, s.state_type() == Service_StateType_HARD); + _resources_service_update.bind_value_as_u32(8, s.check_attempt()); + _resources_service_update.bind_value_as_u32(9, s.max_check_attempts()); + _resources_service_update.bind_value_as_u64( + 10, _cache_host_instance[s.host_id()]); + if (s.severity_id() > 0) { + sid = _severity_cache[{s.severity_id(), 0}]; + SPDLOG_LOGGER_DEBUG(log_v2::sql(), + "service ({}, {}) with severity_id {} => uid = {}", + s.host_id(), s.service_id(), s.severity_id(), sid); + } + if (sid) + _resources_service_update.bind_value_as_u64(11, sid); + else + _resources_service_update.bind_null_u64(11); + _resources_service_update.bind_value_as_str(12, name); + _resources_service_update.bind_value_as_str(13, parent_name); + _resources_service_update.bind_value_as_str(14, notes_url); + _resources_service_update.bind_value_as_str(15, notes); + _resources_service_update.bind_value_as_str(16, action_url); + _resources_service_update.bind_value_as_bool(17, s.notify()); + _resources_service_update.bind_value_as_bool(18, s.passive_checks()); + _resources_service_update.bind_value_as_bool(19, s.active_checks()); + _resources_service_update.bind_value_as_u64(20, s.icon_id()); + _resources_service_update.bind_value_as_u64(21, res_id); + + _mysql.run_statement(_resources_service_update, + database::mysql_error::store_service, conn); + _add_action(conn, actions::resources); + } + + if (!_resources_tags_insert.prepared()) { + _resources_tags_insert = _mysql.prepare_query( + "INSERT INTO resources_tags (tag_id,resource_id) " + "VALUES(?,?)"); + } + if (!_resources_tags_remove.prepared()) + _resources_tags_remove = _mysql.prepare_query( + "DELETE FROM resources_tags WHERE resource_id=?"); + _finish_action(-1, actions::tags); + _resources_tags_remove.bind_value_as_u64(0, res_id); + _mysql.run_statement(_resources_tags_remove, + database::mysql_error::delete_resources_tags, conn); + for (auto& tag : s.tags()) { + auto it_tags_cache = _tags_cache.find({tag.id(), tag.type()}); + + if (it_tags_cache == _tags_cache.end()) { + SPDLOG_LOGGER_ERROR( + log_v2::sql(), + "SQL: could not find in cache the tag ({}, {}) for service " + "({},{}): trying to add it.", + tag.id(), tag.type(), s.host_id(), s.service_id()); + if (!_tag_insert_update.prepared()) + _tag_insert_update = _mysql.prepare_query(_insert_or_update_tags); + _tag_insert_update.bind_value_as_u64(0, tag.id()); + _tag_insert_update.bind_value_as_u32(1, tag.type()); + _tag_insert_update.bind_value_as_str(2, "(unknown)"); + std::promise p; + std::future future = p.get_future(); + _mysql.run_statement_and_get_int( + _tag_insert_update, std::move(p), + database::mysql_task::LAST_INSERT_ID, conn); + try { + uint64_t tag_id = future.get(); + it_tags_cache = + _tags_cache.insert({{tag.id(), tag.type()}, tag_id}).first; + } catch (const std::exception& e) { + SPDLOG_LOGGER_ERROR(log_v2::sql(), + "SQL: unable to insert new tag ({},{}): {}", + tag.id(), tag.type(), e.what()); + } + } + + if (it_tags_cache != _tags_cache.end()) { + _resources_tags_insert.bind_value_as_u64(0, it_tags_cache->second); + _resources_tags_insert.bind_value_as_u64(1, res_id); + SPDLOG_LOGGER_DEBUG( + log_v2::sql(), + "SQL: new relation between service (resource_id: {}, ({}, " + "{})) and tag ({},{})", + res_id, s.host_id(), s.service_id(), tag.id(), tag.type()); + _mysql.run_statement(_resources_tags_insert, + database::mysql_error::store_tags_resources_tags, + conn); + _add_action(conn, actions::resources_tags); + } else { + SPDLOG_LOGGER_ERROR( + log_v2::sql(), + "SQL: could not find the tag ({}, {}) in cache for host '{}'", + tag.id(), tag.type(), s.service_id()); + } + } + } else { + if (found != _resource_cache.end()) { + _resources_disable.bind_value_as_u64(0, found->second); + + _mysql.run_statement(_resources_disable, + database::mysql_error::clean_resources, conn); + _resource_cache.erase(found); + _add_action(conn, actions::resources); + } else { + SPDLOG_LOGGER_INFO( + log_v2::sql(), + "SQL: no need to remove service ({}, {}), it is not in " + "database", + s.host_id(), s.service_id()); + } + } + return res_id; +} /** * Process an adaptive service event. * @@ -3551,7 +4061,7 @@ void stream::_process_pb_adaptive_service(const std::shared_ptr& d) { int32_t conn = _mysql.choose_connection_by_instance( _cache_host_instance[static_cast(as.host_id())]); - constexpr absl::string_view buf("UPDATE services SET"); + constexpr std::string_view buf("UPDATE services SET"); std::string query{buf.data(), buf.size()}; if (as.has_notify()) query += fmt::format(" notify='{}',", as.notify() ? 1 : 0); @@ -3612,7 +4122,7 @@ void stream::_process_pb_adaptive_service(const std::shared_ptr& d) { _add_action(conn, actions::services); if (_store_in_resources) { - constexpr absl::string_view res_buf("UPDATE resources SET"); + constexpr std::string_view res_buf("UPDATE resources SET"); std::string res_query{res_buf.data(), res_buf.size()}; if (as.has_notify()) res_query += @@ -4174,14 +4684,8 @@ void stream::_process_tag(const std::shared_ptr& d) { auto cache_ptr = cache::global_cache::instance_ptr(); // Prepare queries. - if (!_tag_update.prepared()) - _tag_update = _mysql.prepare_query( - "UPDATE tags SET id=?,type=?,name=? WHERE " - "tag_id=?"); - if (!_tag_insert.prepared()) - _tag_insert = _mysql.prepare_query( - "INSERT INTO tags (id,type,name) " - "VALUES(?,?,?)"); + if (!_tag_insert_update.prepared()) + _tag_insert_update = _mysql.prepare_query(_insert_or_update_tags); if (!_tag_delete.prepared()) _tag_delete = _mysql.prepare_query("DELETE FROM resources_tags WHERE tag_id=?"); @@ -4189,63 +4693,39 @@ void stream::_process_tag(const std::shared_ptr& d) { // Processed object. auto s{static_cast(d.get())}; auto& tg = s->obj(); - uint64_t tag_id = _tags_cache[{tg.id(), tg.type()}]; int32_t conn = special_conn::tag % _mysql.connections_count(); switch (tg.action()) { case Tag_Action_ADD: + case Tag_Action_MODIFY: { + const char* debug_action = + tg.action() == Tag_Action_ADD ? "insert" : "update"; if (cache_ptr) { cache_ptr->add_tag(tg.id(), tg.name(), tg.type(), tg.poller_id()); } - if (tag_id) { - SPDLOG_LOGGER_TRACE(log_v2::sql(), "SQL: add already existing tag {}", - tg.id()); - _tag_update.bind_value_as_u64(0, tg.id()); - _tag_update.bind_value_as_u32(1, tg.type()); - _tag_update.bind_value_as_str(2, tg.name()); - _tag_update.bind_value_as_u64(3, tag_id); - _mysql.run_statement(_tag_update, database::mysql_error::store_tag, - conn); - } else { - SPDLOG_LOGGER_TRACE(log_v2::sql(), "SQL: add tag {}", tg.id()); - _tag_insert.bind_value_as_u64(0, tg.id()); - _tag_insert.bind_value_as_u32(1, tg.type()); - _tag_insert.bind_value_as_str(2, tg.name()); - std::promise p; - std::future future = p.get_future(); - _mysql.run_statement_and_get_int( - _tag_insert, std::move(p), database::mysql_task::LAST_INSERT_ID, - conn); - try { - tag_id = future.get(); - _tags_cache[{tg.id(), tg.type()}] = tag_id; - } catch (const std::exception& e) { - SPDLOG_LOGGER_ERROR( - log_v2::sql(), - "unified sql: unable to insert new tag ({},{}): {}", tg.id(), - tg.type(), e.what()); - } + SPDLOG_LOGGER_TRACE(log_v2::sql(), "SQL: {} tag {}", debug_action, + tg.id()); + _tag_insert_update.bind_value_as_u64(0, tg.id()); + _tag_insert_update.bind_value_as_u32(1, tg.type()); + _tag_insert_update.bind_value_as_str(2, tg.name()); + std::promise p; + std::future future = p.get_future(); + _mysql.run_statement_and_get_int( + _tag_insert_update, std::move(p), + database::mysql_task::LAST_INSERT_ID, conn); + try { + uint64_t tag_id = future.get(); + _tags_cache[{tg.id(), tg.type()}] = tag_id; + SPDLOG_LOGGER_TRACE(log_v2::sql(), "new tag ({}, {}, {}) {}", tag_id, + tg.id(), tg.type(), tg.name()); + + } catch (const std::exception& e) { + SPDLOG_LOGGER_ERROR(log_v2::sql(), + "unified sql: unable to {} tag ({},{}): {}", + debug_action, tg.id(), tg.type(), e.what()); } _add_action(conn, actions::tags); break; - case Tag_Action_MODIFY: - SPDLOG_LOGGER_TRACE(log_v2::sql(), "SQL: modify tag {}", tg.id()); - if (cache_ptr) { - cache_ptr->add_tag(tg.id(), tg.name(), tg.type(), tg.poller_id()); - } - _tag_update.bind_value_as_u64(0, tg.id()); - _tag_update.bind_value_as_u32(1, tg.type()); - _tag_update.bind_value_as_str(2, tg.name()); - if (tag_id) { - _tag_update.bind_value_as_u64(3, tag_id); - _mysql.run_statement(_tag_update, database::mysql_error::store_tag, - conn); - _add_action(conn, actions::tags); - } else - SPDLOG_LOGGER_ERROR( - log_v2::sql(), - "unified sql: unable to modify tag ({}, {}): not in cache", tg.id(), - tg.type()); - break; + } case Tag_Action_DELETE: { if (cache_ptr) { cache_ptr->remove_tag(tg.id()); diff --git a/broker/unified_sql/src/stream_storage.cc b/broker/unified_sql/src/stream_storage.cc index e9b8f5d0b65..3a0feedacd4 100644 --- a/broker/unified_sql/src/stream_storage.cc +++ b/broker/unified_sql/src/stream_storage.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2019-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2019-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/unified_sql/test/conflict_manager.cc b/broker/unified_sql/test/conflict_manager.cc index 9dd3f771f72..d0c04d38728 100644 --- a/broker/unified_sql/test/conflict_manager.cc +++ b/broker/unified_sql/test/conflict_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2018 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2018 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/unified_sql/conflict_manager.hh" diff --git a/broker/unified_sql/test/connector.cc b/broker/unified_sql/test/connector.cc index 69bf381a798..23a3cdcef9b 100644 --- a/broker/unified_sql/test/connector.cc +++ b/broker/unified_sql/test/connector.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/unified_sql/test/metric.cc b/broker/unified_sql/test/metric.cc index fa4385bc773..23d778c065a 100644 --- a/broker/unified_sql/test/metric.cc +++ b/broker/unified_sql/test/metric.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/unified_sql/test/perfdata.cc b/broker/unified_sql/test/perfdata.cc index 4f117f07450..512ab44ddf2 100644 --- a/broker/unified_sql/test/perfdata.cc +++ b/broker/unified_sql/test/perfdata.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/unified_sql/test/rebuild_message.cc b/broker/unified_sql/test/rebuild_message.cc index ab1c89f04b3..93b6be9255b 100644 --- a/broker/unified_sql/test/rebuild_message.cc +++ b/broker/unified_sql/test/rebuild_message.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/unified_sql/test/remove_graph.cc b/broker/unified_sql/test/remove_graph.cc index 14a7c552cd4..40bd5bbcb2c 100644 --- a/broker/unified_sql/test/remove_graph.cc +++ b/broker/unified_sql/test/remove_graph.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/unified_sql/test/status-entry.cc b/broker/unified_sql/test/status-entry.cc index 327d4fba053..e359798cbaa 100644 --- a/broker/unified_sql/test/status-entry.cc +++ b/broker/unified_sql/test/status-entry.cc @@ -1,4 +1,4 @@ -/* +/** * * Copyright 2021 Centreon (https://www.centreon.com/) * * * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/unified_sql/test/status.cc b/broker/unified_sql/test/status.cc index f8c8fe4ea37..32fe7508e8a 100644 --- a/broker/unified_sql/test/status.cc +++ b/broker/unified_sql/test/status.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2011 - 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/connector.hh b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/connector.hh index 3e114e6d225..8caac999793 100644 --- a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/connector.hh +++ b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/connector.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/http_tsdb/http_tsdb_config.hh" #include "com/centreon/broker/io/endpoint.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace victoria_metrics { @@ -45,6 +45,6 @@ class connector : public io::endpoint { }; } // namespace victoria_metrics -CCB_END() +} #endif // !CCB_VICTORIA_METRICS_CONNECTOR_HH diff --git a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/factory.hh b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/factory.hh index 5d12a44eec2..1750cd56618 100644 --- a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/factory.hh +++ b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/factory.hh @@ -21,7 +21,7 @@ #include "com/centreon/broker/http_tsdb/factory.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace victoria_metrics { /** @@ -46,6 +46,6 @@ class factory : public http_tsdb::factory { }; } // namespace victoria_metrics -CCB_END() +} #endif // !CCB_VICTORIA_METRICS_FACTORY_HH diff --git a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/request.hh b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/request.hh index 289884ad2e2..b0633b96fae 100644 --- a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/request.hh +++ b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/request.hh @@ -23,7 +23,7 @@ #include "com/centreon/broker/http_tsdb/line_protocol_query.hh" #include "com/centreon/broker/http_tsdb/stream.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace victoria_metrics { class request : public http_tsdb::request { @@ -50,6 +50,6 @@ class request : public http_tsdb::request { } // namespace victoria_metrics -CCB_END() +} #endif // !CCB_VICTORIA_METRICS_REQUEST_HH diff --git a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/stream.hh b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/stream.hh index 539097794fa..08e44ac54c1 100644 --- a/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/stream.hh +++ b/broker/victoria_metrics/inc/com/centreon/broker/victoria_metrics/stream.hh @@ -22,7 +22,7 @@ #include "com/centreon/broker/http_tsdb/line_protocol_query.hh" #include "com/centreon/broker/http_tsdb/stream.hh" -CCB_BEGIN() +namespace com::centreon::broker { // Forward declaration. class database_config; @@ -62,6 +62,6 @@ class stream : public http_tsdb::stream { }; // namespace victoria_metrics -CCB_END() +} #endif // !CCB_VICTORIA_METRICS_STREAM_HH diff --git a/broker/victoria_metrics/precomp_inc/precomp.hh b/broker/victoria_metrics/precomp_inc/precomp.hh index b1c230792fb..4b9b4297ffd 100644 --- a/broker/victoria_metrics/precomp_inc/precomp.hh +++ b/broker/victoria_metrics/precomp_inc/precomp.hh @@ -52,6 +52,5 @@ using duration = system_clock::duration; namespace asio = boost::asio; -#include "com/centreon/broker/namespace.hh" #endif // CC_VICTORIA_METRICS_PRECOMP_HH diff --git a/broker/victoria_metrics/src/connector.cc b/broker/victoria_metrics/src/connector.cc index ba7a6d38e24..30c1090602e 100644 --- a/broker/victoria_metrics/src/connector.cc +++ b/broker/victoria_metrics/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/victoria_metrics/connector.hh" diff --git a/broker/victoria_metrics/src/factory.cc b/broker/victoria_metrics/src/factory.cc index 6a62b39bf07..76425730462 100644 --- a/broker/victoria_metrics/src/factory.cc +++ b/broker/victoria_metrics/src/factory.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/victoria_metrics/factory.hh" diff --git a/broker/victoria_metrics/src/main.cc b/broker/victoria_metrics/src/main.cc index 9354a39f741..6424b7b794c 100644 --- a/broker/victoria_metrics/src/main.cc +++ b/broker/victoria_metrics/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/broker/victoria_metrics/src/request.cc b/broker/victoria_metrics/src/request.cc index 4ba306b0534..37a0fa38276 100644 --- a/broker/victoria_metrics/src/request.cc +++ b/broker/victoria_metrics/src/request.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/victoria_metrics/request.hh" @@ -66,15 +66,15 @@ request::request(boost::beast::http::verb method, set(boost::beast::http::field::authorization, authorization); } -static constexpr absl::string_view _sz_metric = "metric,id="; -static constexpr absl::string_view _sz_status = "status,id="; -static constexpr absl::string_view _sz_space = " "; -static constexpr absl::string_view _sz_name = ",name="; -static constexpr absl::string_view _sz_unit = ",unit="; -static constexpr absl::string_view _sz_host_id = ",host_id="; -static constexpr absl::string_view _sz_serv_id = ",serv_id="; -static constexpr absl::string_view _sz_severity_id = ",severity_id="; -static constexpr absl::string_view _sz_val = " val="; +static constexpr std::string_view _sz_metric = "metric,id="; +static constexpr std::string_view _sz_status = "status,id="; +static constexpr std::string_view _sz_space = " "; +static constexpr std::string_view _sz_name = ",name="; +static constexpr std::string_view _sz_unit = ",unit="; +static constexpr std::string_view _sz_host_id = ",host_id="; +static constexpr std::string_view _sz_serv_id = ",serv_id="; +static constexpr std::string_view _sz_severity_id = ",severity_id="; +static constexpr std::string_view _sz_val = " val="; void request::add_metric(const storage::pb_metric& metric) { absl::StrAppend(&body(), _sz_metric, metric.obj().metric_id()); diff --git a/broker/victoria_metrics/src/stream.cc b/broker/victoria_metrics/src/stream.cc index 53b9dc350a4..26a95b97421 100644 --- a/broker/victoria_metrics/src/stream.cc +++ b/broker/victoria_metrics/src/stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/victoria_metrics/stream.hh" diff --git a/broker/victoria_metrics/test/factory_test.cc b/broker/victoria_metrics/test/factory_test.cc index 472258683ce..a7c137d6b8c 100644 --- a/broker/victoria_metrics/test/factory_test.cc +++ b/broker/victoria_metrics/test/factory_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022-2023 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/victoria_metrics/test/request_test.cc b/broker/victoria_metrics/test/request_test.cc index 6e66ab5abdb..c8c4f38df7b 100644 --- a/broker/victoria_metrics/test/request_test.cc +++ b/broker/victoria_metrics/test/request_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,8 +28,6 @@ using system_clock = std::chrono::system_clock; using time_point = system_clock::time_point; using duration = system_clock::duration; -#include "com/centreon/broker/namespace.hh" - #include "bbdo/tag.pb.h" #include "com/centreon/broker/cache/global_cache.hh" #include "com/centreon/broker/file/disk_accessor.hh" @@ -156,10 +154,10 @@ TEST_F(victoria_request_test, request_body_test_default_victoria_extra_column) { return tag_iter >= tags + 4 ? 0 : (tag_iter++)->id(); }); cache::global_cache::instance_ptr()->set_index_mapping(45, 14, 78); - cache::global_cache::instance_ptr()->add_host_group(89, 14); - cache::global_cache::instance_ptr()->add_host_group(88, 14); - cache::global_cache::instance_ptr()->add_service_group(1278, 14, 78); - cache::global_cache::instance_ptr()->add_service_group(1279, 14, 78); + cache::global_cache::instance_ptr()->add_host_to_group(89, 14, 1); + cache::global_cache::instance_ptr()->add_host_to_group(88, 14, 2); + cache::global_cache::instance_ptr()->add_service_to_group(1278, 14, 78, 4); + cache::global_cache::instance_ptr()->add_service_to_group(1279, 14, 78, 5); http_tsdb::line_protocol_query metric_columns( victoria_metrics::stream::allowed_macros, @@ -244,10 +242,10 @@ TEST_F(victoria_request_test, request_body_test_victoria_extra_column) { return tag_iter >= tags + 4 ? 0 : (tag_iter++)->id(); }); cache::global_cache::instance_ptr()->set_index_mapping(45, 14, 78); - cache::global_cache::instance_ptr()->add_host_group(89, 14); - cache::global_cache::instance_ptr()->add_host_group(88, 14); - cache::global_cache::instance_ptr()->add_service_group(1278, 14, 78); - cache::global_cache::instance_ptr()->add_service_group(1279, 14, 78); + cache::global_cache::instance_ptr()->add_host_to_group(89, 14, 1); + cache::global_cache::instance_ptr()->add_host_to_group(88, 14, 2); + cache::global_cache::instance_ptr()->add_service_to_group(1278, 14, 78, 5); + cache::global_cache::instance_ptr()->add_service_to_group(1279, 14, 78, 6); json column = R"([ {"name" : "host", "is_tag" : "true", "value" : "$HOST$", "type":"string"}, diff --git a/broker/victoria_metrics/test/stream_test.cc b/broker/victoria_metrics/test/stream_test.cc index 8ef750c00ae..01fb79bfba5 100644 --- a/broker/victoria_metrics/test/stream_test.cc +++ b/broker/victoria_metrics/test/stream_test.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2019 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/watchdog/inc/com/centreon/broker/watchdog/configuration.hh b/broker/watchdog/inc/com/centreon/broker/watchdog/configuration.hh index 2f71ffac6d9..15c1b12114b 100644 --- a/broker/watchdog/inc/com/centreon/broker/watchdog/configuration.hh +++ b/broker/watchdog/inc/com/centreon/broker/watchdog/configuration.hh @@ -1,30 +1,27 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_WATCHDOG_CONFIGURATION_HH #define CCB_WATCHDOG_CONFIGURATION_HH -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/watchdog/instance_configuration.hh" -CCB_BEGIN() - -namespace watchdog { +namespace com::centreon::broker::watchdog { /** * @class configuration configuration.hh * "com/centreon/broker/watchdog/configuration.hh" @@ -51,8 +48,6 @@ class configuration { std::string _log_filename; instance_map _instances_configuration; }; -} // namespace watchdog - -CCB_END() +} // namespace com::centreon::broker::watchdog #endif // !CCB_WATCHDOG_BROKER_INSTANCE_CONFIGURATION_HH diff --git a/broker/watchdog/inc/com/centreon/broker/watchdog/configuration_parser.hh b/broker/watchdog/inc/com/centreon/broker/watchdog/configuration_parser.hh index b212ae0393d..83c98428769 100644 --- a/broker/watchdog/inc/com/centreon/broker/watchdog/configuration_parser.hh +++ b/broker/watchdog/inc/com/centreon/broker/watchdog/configuration_parser.hh @@ -21,11 +21,10 @@ #include -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/watchdog/configuration.hh" #include "com/centreon/broker/watchdog/instance_configuration.hh" -CCB_BEGIN() +namespace com::centreon::broker { namespace watchdog { /** @@ -54,6 +53,6 @@ class configuration_parser { }; } // namespace watchdog -CCB_END() +} #endif // !CCB_WATCHDOG_CONFIGURATION_PARSER_HH diff --git a/broker/watchdog/inc/com/centreon/broker/watchdog/instance.hh b/broker/watchdog/inc/com/centreon/broker/watchdog/instance.hh index b75039c4ad2..e07216cbd25 100644 --- a/broker/watchdog/inc/com/centreon/broker/watchdog/instance.hh +++ b/broker/watchdog/inc/com/centreon/broker/watchdog/instance.hh @@ -21,7 +21,6 @@ #include -#include "com/centreon/broker/namespace.hh" #include "com/centreon/broker/timestamp.hh" #include "com/centreon/broker/watchdog/instance_configuration.hh" diff --git a/broker/watchdog/inc/com/centreon/broker/watchdog/instance_configuration.hh b/broker/watchdog/inc/com/centreon/broker/watchdog/instance_configuration.hh index cbe8b2c9187..57b7ce3c264 100644 --- a/broker/watchdog/inc/com/centreon/broker/watchdog/instance_configuration.hh +++ b/broker/watchdog/inc/com/centreon/broker/watchdog/instance_configuration.hh @@ -1,29 +1,25 @@ -/* -** Copyright 2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2015-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCB_WATCHDOG_INSTANCE_CONFIGURATION_HH #define CCB_WATCHDOG_INSTANCE_CONFIGURATION_HH -#include "com/centreon/broker/namespace.hh" - -CCB_BEGIN() - -namespace watchdog { +namespace com::centreon::broker::watchdog { /** * @class instance_configuration instance_configuration.hh * "com/centreon/broker/watchdog/instance_configuration.hh" @@ -32,12 +28,9 @@ namespace watchdog { class instance_configuration { public: instance_configuration(); - instance_configuration(std::string const& name, - std::string const& executable, - std::string const& config_file, - bool should_run, - bool should_reload, - uint32_t seconds_per_tentative); + instance_configuration(std::string const& name, std::string const& executable, + std::string const& config_file, bool should_run, + bool should_reload, uint32_t seconds_per_tentative); ~instance_configuration(); instance_configuration(instance_configuration const& other); instance_configuration& operator=(instance_configuration const& other); @@ -60,8 +53,6 @@ class instance_configuration { bool _run; bool _reload; }; -} // namespace watchdog - -CCB_END() +} // namespace com::centreon::broker::watchdog #endif // !CCB_WATCHDOG_INSTANCE_CONFIGURATION_HH diff --git a/broker/watchdog/src/configuration.cc b/broker/watchdog/src/configuration.cc index ca7c8aa3fb4..5b36ce165f1 100644 --- a/broker/watchdog/src/configuration.cc +++ b/broker/watchdog/src/configuration.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/watchdog/configuration.hh" diff --git a/broker/watchdog/src/configuration_parser.cc b/broker/watchdog/src/configuration_parser.cc index 7870bcdf6ad..15ff1381136 100644 --- a/broker/watchdog/src/configuration_parser.cc +++ b/broker/watchdog/src/configuration_parser.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/watchdog/configuration_parser.hh" diff --git a/broker/watchdog/src/instance.cc b/broker/watchdog/src/instance.cc index d0b16bca5ff..8a426e8751f 100644 --- a/broker/watchdog/src/instance.cc +++ b/broker/watchdog/src/instance.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2015-2017 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2015-2017 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/watchdog/instance.hh" diff --git a/broker/watchdog/src/instance_configuration.cc b/broker/watchdog/src/instance_configuration.cc index 48be7c67d1d..4040e0f3c76 100644 --- a/broker/watchdog/src/instance_configuration.cc +++ b/broker/watchdog/src/instance_configuration.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/broker/watchdog/instance_configuration.hh" diff --git a/broker/watchdog/src/main.cc b/broker/watchdog/src/main.cc index 328547d6dd9..b93b6f46e86 100644 --- a/broker/watchdog/src/main.cc +++ b/broker/watchdog/src/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2015,2017 Centreon * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/broker/watchdog/test/watchdog.cc b/broker/watchdog/test/watchdog.cc index 1cffd7e6e61..0ddc120d3d1 100644 --- a/broker/watchdog/test/watchdog.cc +++ b/broker/watchdog/test/watchdog.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2019-2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2019-2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include @@ -89,7 +89,7 @@ TEST(WatchdogTest, SimpleConfig) { com::centreon::broker::misc::exec_process(arg, false); std::string r; int32_t time = 0; - std::list lst1; + std::list lst1; while (time < 5) { r = misc::exec("ps ax | grep tester | grep -v grep | awk '{print $1}'"); lst1 = absl::StrSplit(r, '\n'); @@ -102,7 +102,7 @@ TEST(WatchdogTest, SimpleConfig) { ASSERT_EQ(lst1.size(), 3u); ASSERT_TRUE(lst1.back().empty()); - std::list lst = absl::StrSplit(r, '\n'); + std::list lst = absl::StrSplit(r, '\n'); // There are 3 elements, but the last one is empty ASSERT_EQ(lst.size(), 3u); ASSERT_TRUE(lst.back().empty()); @@ -202,7 +202,7 @@ TEST(WatchdogTest, SimpleConfigUpdated) { char const* arg[]{"bin/cbwd", "/tmp/simple-conf.json", nullptr}; com::centreon::broker::misc::exec_process(arg, false); - std::list lst; + std::list lst; int32_t time = 0; std::string r; while (lst.size() != 3 && time < 5) { diff --git a/ccc/client.cc b/ccc/client.cc index 82e7af0f2e9..64265314d1d 100644 --- a/ccc/client.cc +++ b/ccc/client.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "client.hh" diff --git a/ccc/main.cc b/ccc/main.cc index 814eaa74075..1d69fcb0c8b 100644 --- a/ccc/main.cc +++ b/ccc/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include @@ -139,7 +139,7 @@ int main(int argc, char** argv) { std::cout << " * " << m << std::endl; } else { for (int i = optind; i < argc; i++) { - absl::string_view full_cmd{argv[i]}; + std::string_view full_cmd{argv[i]}; size_t first = full_cmd.find_first_not_of(" \t"); size_t last = full_cmd.find_first_of(" \t\n{(", first); std::string cmd; diff --git a/clib/CMakeLists.txt b/clib/CMakeLists.txt index a68eced1a0a..becaacc5296 100644 --- a/clib/CMakeLists.txt +++ b/clib/CMakeLists.txt @@ -130,7 +130,6 @@ set(HEADERS "${INC_DIR}/handle_manager.hh" "${INC_DIR}/hash.hh" "${INC_DIR}/library.hh" - "${INC_DIR}/namespace.hh" "${INC_DIR}/process_manager.hh" "${INC_DIR}/process.hh" "${INC_DIR}/task.hh" diff --git a/clib/inc/com/centreon/clib/version.hh.in b/clib/inc/com/centreon/clib/version.hh.in index dea870844df..ad0cf3b714c 100644 --- a/clib/inc/com/centreon/clib/version.hh.in +++ b/clib/inc/com/centreon/clib/version.hh.in @@ -1,50 +1,44 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CC_CLIB_VERSION_HH -# define CC_CLIB_VERSION_HH +#define CC_CLIB_VERSION_HH // Compile-time values. -# define CENTREON_CLIB_VERSION_MAJOR @COLLECT_MAJOR@ -# define CENTREON_CLIB_VERSION_MINOR @COLLECT_MINOR@ -# define CENTREON_CLIB_VERSION_PATCH @COLLECT_PATCH@ -# define CENTREON_CLIB_VERSION_STRING "@CLIB_VERSION@" +#define CENTREON_CLIB_VERSION_MAJOR @COLLECT_MAJOR@ +#define CENTREON_CLIB_VERSION_MINOR @COLLECT_MINOR@ +#define CENTREON_CLIB_VERSION_PATCH @COLLECT_PATCH@ +#define CENTREON_CLIB_VERSION_STRING "@CLIB_VERSION@" -# include "com/centreon/namespace.hh" - -CC_BEGIN() - -namespace clib { - namespace version { - // Compile-time values. - unsigned int const major = @COLLECT_MAJOR@; - unsigned int const minor = @COLLECT_MINOR@; - unsigned int const patch = @COLLECT_PATCH@; - char const* const string = "@CLIB_VERSION@"; - - // Run-time values. - unsigned int get_major() noexcept; - unsigned int get_minor() noexcept; - unsigned int get_patch() noexcept; - char const* get_string() noexcept; - } -} - -CC_END() - -#endif // !CC_HANDLE_HH +namespace com::centreon::clib { +namespace version { +// Compile-time values. +unsigned int const major = @COLLECT_MAJOR@; +unsigned int const minor = @COLLECT_MINOR@; +unsigned int const patch = @COLLECT_PATCH@; +char const* const string = "@CLIB_VERSION@"; + +// Run-time values. +unsigned int get_major() noexcept; +unsigned int get_minor() noexcept; +unsigned int get_patch() noexcept; +char const* get_string() noexcept; +} // namespace version +} // namespace com::centreon::clib + +#endif // !CC_HANDLE_HH diff --git a/clib/inc/com/centreon/delayed_delete.hh b/clib/inc/com/centreon/delayed_delete.hh index 1691313235e..8655729e527 100644 --- a/clib/inc/com/centreon/delayed_delete.hh +++ b/clib/inc/com/centreon/delayed_delete.hh @@ -20,9 +20,8 @@ #define CC_DELAYED_DELETE_HH #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { /** * @class delayed_delete delayed_delete.hh "com/centreon/delayed_delete.hh" @@ -76,6 +75,6 @@ class delayed_delete : public task { } }; -CC_END() +} #endif // !CC_DELAYED_DELETE_HH diff --git a/clib/inc/com/centreon/exceptions/basic.hh b/clib/inc/com/centreon/exceptions/basic.hh index 4ff4c7f824d..aca448e685a 100644 --- a/clib/inc/com/centreon/exceptions/basic.hh +++ b/clib/inc/com/centreon/exceptions/basic.hh @@ -22,7 +22,7 @@ #include #include "com/centreon/misc/stringifier.hh" -CC_BEGIN() +namespace com::centreon { namespace exceptions { /** @@ -52,7 +52,7 @@ class basic : public std::exception { }; } // namespace exceptions -CC_END() +} #if defined(__GNUC__) #define FUNCTION __PRETTY_FUNCTION__ diff --git a/clib/inc/com/centreon/exceptions/interruption.hh b/clib/inc/com/centreon/exceptions/interruption.hh index e3f25e3be25..b51360dafea 100644 --- a/clib/inc/com/centreon/exceptions/interruption.hh +++ b/clib/inc/com/centreon/exceptions/interruption.hh @@ -20,9 +20,8 @@ #define CC_EXCEPTIONS_INTERRUPTION_HH #include "com/centreon/exceptions/basic.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace exceptions { /** @@ -49,7 +48,7 @@ class interruption : public basic { }; } // namespace exceptions -CC_END() +} #if defined(__GNUC__) #define FUNCTION __PRETTY_FUNCTION__ diff --git a/clib/inc/com/centreon/exceptions/msg_fmt.hh b/clib/inc/com/centreon/exceptions/msg_fmt.hh index 6a8ee9a75ef..edac8dbb0c9 100644 --- a/clib/inc/com/centreon/exceptions/msg_fmt.hh +++ b/clib/inc/com/centreon/exceptions/msg_fmt.hh @@ -1,29 +1,26 @@ -/* -** Copyright 2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2020-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CC_EXCEPTIONS_MSG_FMT_HH #define CC_EXCEPTIONS_MSG_FMT_HH #include -#include "com/centreon/namespace.hh" -CC_BEGIN() - -namespace exceptions { +namespace com::centreon::exceptions { /** * @class msg_fmt msg_fmt.hh "com/centreon/exceptions/msg_fmt.hh" * @brief Base exception class. @@ -44,6 +41,6 @@ class msg_fmt : public std::exception { msg_fmt& operator=(const msg_fmt&) = delete; const char* what() const noexcept final { return _msg.c_str(); } }; -} // namespace exceptions -CC_END() +} // namespace com::centreon::exceptions + #endif // !CC_EXCEPTIONS_MSG_FMT_HH diff --git a/clib/inc/com/centreon/handle.hh b/clib/inc/com/centreon/handle.hh index 669e1a8730b..bbbcc69d33b 100644 --- a/clib/inc/com/centreon/handle.hh +++ b/clib/inc/com/centreon/handle.hh @@ -19,9 +19,8 @@ #ifndef CC_HANDLE_HH #define CC_HANDLE_HH -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { typedef int native_handle; native_handle const native_handle_null = -1; @@ -45,6 +44,6 @@ class handle { virtual unsigned long write(void const* data, unsigned long size) = 0; }; -CC_END() +} #endif // !CC_HANDLE_HH diff --git a/clib/inc/com/centreon/handle_action.hh b/clib/inc/com/centreon/handle_action.hh index 6ba25899208..b6cf98cf96d 100644 --- a/clib/inc/com/centreon/handle_action.hh +++ b/clib/inc/com/centreon/handle_action.hh @@ -22,7 +22,7 @@ #include #include "com/centreon/task.hh" -CC_BEGIN() +namespace com::centreon { // Forward declaration. class handle; @@ -57,6 +57,6 @@ class handle_action : public task { bool _is_threadable; }; -CC_END() +} #endif // !CC_HANDLE_ACTION_HH diff --git a/clib/inc/com/centreon/handle_listener.hh b/clib/inc/com/centreon/handle_listener.hh index 7f9c4ba8e6e..2eeeee687ea 100644 --- a/clib/inc/com/centreon/handle_listener.hh +++ b/clib/inc/com/centreon/handle_listener.hh @@ -21,7 +21,7 @@ #include "com/centreon/handle.hh" -CC_BEGIN() +namespace com::centreon { /** * @class handle_listener handle_listener.hh "com/centreon/handle_listener.hh" @@ -47,6 +47,6 @@ class handle_listener { virtual void write(handle&) {} }; -CC_END() +} #endif // !CC_HANDLE_LISTENER_HH diff --git a/clib/inc/com/centreon/handle_manager.hh b/clib/inc/com/centreon/handle_manager.hh index 6f1c6feef87..457c195170c 100644 --- a/clib/inc/com/centreon/handle_manager.hh +++ b/clib/inc/com/centreon/handle_manager.hh @@ -25,7 +25,7 @@ #include #include "com/centreon/handle.hh" -CC_BEGIN() +namespace com::centreon { // Forward declarations. class handle_action; @@ -62,6 +62,6 @@ class handle_manager { task_manager* _task_manager; }; -CC_END() +} #endif // !CC_HANDLE_MANAGER_POSIX_HH diff --git a/clib/inc/com/centreon/hash.hh b/clib/inc/com/centreon/hash.hh index bf0d15b7bb5..749cf528694 100644 --- a/clib/inc/com/centreon/hash.hh +++ b/clib/inc/com/centreon/hash.hh @@ -29,13 +29,12 @@ #define TR1_UNORDERED 1 #endif // C++0x, tr1 -#include "com/centreon/namespace.hh" // Used c++0x implementation. #ifdef CXX0X_UNORDERED #include -CC_BEGIN() +namespace com::centreon { template std::size_t hash(T const& data) { @@ -43,13 +42,13 @@ std::size_t hash(T const& data) { return (h(data)); } -CC_END() +} // Used tr1 implementation. #elif defined(TR1_UNORDERED) #include -CC_BEGIN() +namespace com::centreon { template std::size_t hash(T const& data) { @@ -57,12 +56,12 @@ std::size_t hash(T const& data) { return (h(data)); } -CC_END() +} // Used own implementation. #else -CC_BEGIN() +namespace com::centreon { template std::size_t hash(T const& data) { @@ -130,11 +129,11 @@ inline std::size_t hash(unsigned short val) { return (static_cast(val)); } -CC_END() +} #endif // C++0X, tr1 or std -CC_BEGIN() +namespace com::centreon { template std::size_t hash(std::pair const& data) { @@ -164,6 +163,6 @@ std::size_t hash_combine(std::size_t& seed, T begin, T end) { return (seed); } -CC_END() +} #endif // !CC_HASH_HH diff --git a/clib/inc/com/centreon/io/directory_entry.hh b/clib/inc/com/centreon/io/directory_entry.hh index a6a755bb985..9b91231a258 100644 --- a/clib/inc/com/centreon/io/directory_entry.hh +++ b/clib/inc/com/centreon/io/directory_entry.hh @@ -23,9 +23,8 @@ #include #include "com/centreon/handle.hh" #include "com/centreon/io/file_entry.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace io { /** @@ -57,6 +56,6 @@ class directory_entry { }; } // namespace io -CC_END() +} #endif // !CC_IO_DIRECTORY_ENTRY_HH diff --git a/clib/inc/com/centreon/io/file_entry.hh b/clib/inc/com/centreon/io/file_entry.hh index ce9b240da19..daaa7ff98d5 100644 --- a/clib/inc/com/centreon/io/file_entry.hh +++ b/clib/inc/com/centreon/io/file_entry.hh @@ -23,13 +23,12 @@ #include #include #include "com/centreon/handle.hh" -#include "com/centreon/namespace.hh" #ifdef _WIN32 #define stat _stat #endif // _WIN32 -CC_BEGIN() +namespace com::centreon { namespace io { /** @@ -67,6 +66,6 @@ class file_entry { }; } // namespace io -CC_END() +} #endif // !CC_IO_FILE_ENTRY_HH diff --git a/clib/inc/com/centreon/io/file_stream.hh b/clib/inc/com/centreon/io/file_stream.hh index 9f31b6ed761..7fcf536d28f 100644 --- a/clib/inc/com/centreon/io/file_stream.hh +++ b/clib/inc/com/centreon/io/file_stream.hh @@ -22,9 +22,8 @@ #include #include #include "com/centreon/handle.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace io { /** @@ -65,6 +64,6 @@ class file_stream : public handle { }; } // namespace io -CC_END() +} #endif // !CC_IO_FILE_STREAM_HH diff --git a/clib/inc/com/centreon/library.hh b/clib/inc/com/centreon/library.hh index b4671096435..f180e156e57 100644 --- a/clib/inc/com/centreon/library.hh +++ b/clib/inc/com/centreon/library.hh @@ -21,9 +21,8 @@ #include #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { /** * @class library library.hh "com/centreon/library.hh" @@ -52,6 +51,6 @@ class library { void* _handle; }; -CC_END() +} #endif // !CC_LIBRARY_POSIX_HH diff --git a/clib/inc/com/centreon/logging/backend.hh b/clib/inc/com/centreon/logging/backend.hh index 2864f666188..04a2aff3176 100644 --- a/clib/inc/com/centreon/logging/backend.hh +++ b/clib/inc/com/centreon/logging/backend.hh @@ -20,9 +20,8 @@ #define CC_LOGGING_BACKEND_HH #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { class stringifier; @@ -78,6 +77,6 @@ class backend { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_BACKEND_HH diff --git a/clib/inc/com/centreon/logging/engine.hh b/clib/inc/com/centreon/logging/engine.hh index 455ce67aa52..3f0661f65fa 100644 --- a/clib/inc/com/centreon/logging/engine.hh +++ b/clib/inc/com/centreon/logging/engine.hh @@ -22,9 +22,8 @@ #include #include #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { class backend; @@ -91,6 +90,6 @@ class engine { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_ENGINE_HH diff --git a/clib/inc/com/centreon/logging/file.hh b/clib/inc/com/centreon/logging/file.hh index ed6f33b79b1..fadaaaa796e 100644 --- a/clib/inc/com/centreon/logging/file.hh +++ b/clib/inc/com/centreon/logging/file.hh @@ -22,9 +22,8 @@ #include #include #include "com/centreon/logging/backend.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { /** @@ -70,6 +69,6 @@ class file : public backend { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_FILE_HH diff --git a/clib/inc/com/centreon/logging/logger.hh b/clib/inc/com/centreon/logging/logger.hh index 69aced161ff..b74b0d83967 100644 --- a/clib/inc/com/centreon/logging/logger.hh +++ b/clib/inc/com/centreon/logging/logger.hh @@ -21,7 +21,7 @@ #include "com/centreon/logging/temp_logger.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { enum type_value { @@ -33,7 +33,7 @@ enum type_value { enum verbosity_level { low = 0, medium = 1, high = 2 }; } // namespace logging -CC_END() +} #define log_info(verbose) \ for (unsigned int __com_centreon_logging_define_ui(0); \ diff --git a/clib/inc/com/centreon/logging/syslogger.hh b/clib/inc/com/centreon/logging/syslogger.hh index b699356283e..6895999ed9c 100644 --- a/clib/inc/com/centreon/logging/syslogger.hh +++ b/clib/inc/com/centreon/logging/syslogger.hh @@ -21,9 +21,8 @@ #include #include "com/centreon/logging/backend.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { /** @@ -56,6 +55,6 @@ class syslogger : public backend { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_SYSLOGGER_HH diff --git a/clib/inc/com/centreon/logging/temp_logger.hh b/clib/inc/com/centreon/logging/temp_logger.hh index 7883df89fd6..d8f09e3fc13 100644 --- a/clib/inc/com/centreon/logging/temp_logger.hh +++ b/clib/inc/com/centreon/logging/temp_logger.hh @@ -23,7 +23,7 @@ #include "com/centreon/logging/engine.hh" #include "com/centreon/misc/stringifier.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { struct setprecision { @@ -60,6 +60,6 @@ class temp_logger { }; } // namespace logging -CC_END() +} #endif // !CC_LOGGING_TEMP_LOGGER_HH diff --git a/clib/inc/com/centreon/misc/argument.hh b/clib/inc/com/centreon/misc/argument.hh index 6566b725ab2..b03dc0be6cf 100644 --- a/clib/inc/com/centreon/misc/argument.hh +++ b/clib/inc/com/centreon/misc/argument.hh @@ -20,9 +20,8 @@ #define CC_MISC_ARGUMENT_HH #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { /** @@ -69,6 +68,6 @@ class argument { }; } // namespace misc -CC_END() +} #endif // !CC_MISC_ARGUMENT_HH diff --git a/clib/inc/com/centreon/misc/command_line.hh b/clib/inc/com/centreon/misc/command_line.hh index 4228017a956..7bd5f86b98b 100644 --- a/clib/inc/com/centreon/misc/command_line.hh +++ b/clib/inc/com/centreon/misc/command_line.hh @@ -21,9 +21,8 @@ #include #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { /** @@ -58,6 +57,6 @@ class command_line { }; } // namespace misc -CC_END() +} #endif // !CC_MISC_COMMAND_LINE_HH diff --git a/clib/inc/com/centreon/misc/get_options.hh b/clib/inc/com/centreon/misc/get_options.hh index 8eca923d723..81445747083 100644 --- a/clib/inc/com/centreon/misc/get_options.hh +++ b/clib/inc/com/centreon/misc/get_options.hh @@ -23,9 +23,8 @@ #include #include #include "com/centreon/misc/argument.hh" -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { /** @@ -76,6 +75,6 @@ class get_options { }; } // namespace misc -CC_END() +} #endif // !CC_MISC_GET_OPTIONS_HH diff --git a/clib/inc/com/centreon/misc/stringifier.hh b/clib/inc/com/centreon/misc/stringifier.hh index 3f640fba25a..5947d5bff5e 100644 --- a/clib/inc/com/centreon/misc/stringifier.hh +++ b/clib/inc/com/centreon/misc/stringifier.hh @@ -21,9 +21,8 @@ #include #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { namespace misc { /** @@ -77,6 +76,6 @@ class stringifier { }; } // namespace misc -CC_END() +} #endif // !CC_MISC_STRINGIFIER_HH diff --git a/clib/inc/com/centreon/namespace.hh b/clib/inc/com/centreon/namespace.hh deleted file mode 100644 index 44fd3c6c8ba..00000000000 --- a/clib/inc/com/centreon/namespace.hh +++ /dev/null @@ -1,34 +0,0 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CC_NAMESPACE_HH -#define CC_NAMESPACE_HH - -#ifndef CC_BEGIN -#define CC_BEGIN() \ - namespace com { \ - namespace centreon { -#endif // !CC_BEGIN - -#ifndef CC_END -#define CC_END() \ - } \ - } -#endif // !CC_END - -#endif // !CC_NAMESPACE_HH diff --git a/clib/inc/com/centreon/process.hh b/clib/inc/com/centreon/process.hh index f133a5c32ff..475aef8e7ac 100644 --- a/clib/inc/com/centreon/process.hh +++ b/clib/inc/com/centreon/process.hh @@ -28,7 +28,7 @@ #include #include "com/centreon/timestamp.hh" -CC_BEGIN() +namespace com::centreon { class process_listener; class process_manager; @@ -129,6 +129,6 @@ class process { void set_timeout(bool timeout); }; -CC_END() +} #endif // !CC_PROCESS_POSIX_HH diff --git a/clib/inc/com/centreon/process_listener.hh b/clib/inc/com/centreon/process_listener.hh index 3432dc88030..ee66322e994 100644 --- a/clib/inc/com/centreon/process_listener.hh +++ b/clib/inc/com/centreon/process_listener.hh @@ -19,10 +19,9 @@ #ifndef CC_PROCESS_LISTENER_HH #define CC_PROCESS_LISTENER_HH -#include "com/centreon/namespace.hh" #include "com/centreon/process.hh" -CC_BEGIN() +namespace com::centreon { /** * @class process process_listener.hh "com/centreon/process_listener.hh" @@ -38,6 +37,6 @@ class process_listener { virtual void finished(process& p) noexcept = 0; }; -CC_END() +} #endif // !CC_PROCESS_LISTENER_HH diff --git a/clib/inc/com/centreon/process_manager.hh b/clib/inc/com/centreon/process_manager.hh index 36db7109991..23a0a4dd342 100644 --- a/clib/inc/com/centreon/process_manager.hh +++ b/clib/inc/com/centreon/process_manager.hh @@ -28,9 +28,8 @@ #include #include #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { class process; class process_listener; @@ -143,6 +142,6 @@ class process_manager { void wait_for_update() const noexcept; }; -CC_END() +} #endif // !CC_PROCESS_MANAGER_POSIX_HH diff --git a/clib/inc/com/centreon/task.hh b/clib/inc/com/centreon/task.hh index 28622caaa01..7a5b43b5602 100644 --- a/clib/inc/com/centreon/task.hh +++ b/clib/inc/com/centreon/task.hh @@ -19,9 +19,8 @@ #ifndef CC_TASK_HH #define CC_TASK_HH -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { /** * @class task task.hh "com/centreon/task.hh" @@ -39,6 +38,6 @@ class task { virtual void run() = 0; }; -CC_END() +} #endif // !CC_TASK_HH diff --git a/clib/inc/com/centreon/task_manager.hh b/clib/inc/com/centreon/task_manager.hh index e2f28add3a9..06ee9d2a3e4 100644 --- a/clib/inc/com/centreon/task_manager.hh +++ b/clib/inc/com/centreon/task_manager.hh @@ -25,13 +25,12 @@ #include #include #include -#include "com/centreon/namespace.hh" #include "com/centreon/task.hh" #include "com/centreon/timestamp.hh" #include -CC_BEGIN() +namespace com::centreon { class task_manager { struct internal_task { @@ -89,6 +88,6 @@ class task_manager { uint32_t execute(timestamp const& now = timestamp::now()); }; -CC_END() +} #endif // ! CC_TASK_MANAGER_HH diff --git a/clib/inc/com/centreon/timestamp.hh b/clib/inc/com/centreon/timestamp.hh index 64e03272482..304420318c0 100644 --- a/clib/inc/com/centreon/timestamp.hh +++ b/clib/inc/com/centreon/timestamp.hh @@ -22,9 +22,8 @@ #include #include #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { /** * @class timestamp timestamp.hh "com/centreon/timestamp.hh" @@ -71,6 +70,6 @@ class timestamp { std::ostream& operator<<(std::ostream& s, const timestamp& to_dump); -CC_END() +} #endif // !CC_TIMESTAMP_HH diff --git a/clib/inc/com/centreon/unique_array_ptr.hh b/clib/inc/com/centreon/unique_array_ptr.hh index f9e58abdef7..8ae05c33121 100644 --- a/clib/inc/com/centreon/unique_array_ptr.hh +++ b/clib/inc/com/centreon/unique_array_ptr.hh @@ -20,9 +20,8 @@ #define CC_UNIQUE_ARRAY_PTR_HH #include -#include "com/centreon/namespace.hh" -CC_BEGIN() +namespace com::centreon { /** * @class unique_array_ptr unique_array_ptr.hh @@ -116,6 +115,6 @@ class unique_array_ptr { } }; -CC_END() +} #endif // !CC_UNIQUE_ARRAY_PTR_HH diff --git a/clib/src/clib/version.cc b/clib/src/clib/version.cc index 17286885d49..5984cea7a44 100644 --- a/clib/src/clib/version.cc +++ b/clib/src/clib/version.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/clib/version.hh" diff --git a/clib/src/exceptions/basic.cc b/clib/src/exceptions/basic.cc index d198f03fdf4..d5e33f54e82 100644 --- a/clib/src/exceptions/basic.cc +++ b/clib/src/exceptions/basic.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/exceptions/basic.hh" diff --git a/clib/src/exceptions/interruption.cc b/clib/src/exceptions/interruption.cc index 28061f4e194..cace7f5657d 100644 --- a/clib/src/exceptions/interruption.cc +++ b/clib/src/exceptions/interruption.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/exceptions/interruption.hh" diff --git a/clib/src/handle_action.cc b/clib/src/handle_action.cc index 6b1bdda3f26..6da1d97f8b7 100644 --- a/clib/src/handle_action.cc +++ b/clib/src/handle_action.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/handle_action.hh" diff --git a/clib/src/handle_manager.cc b/clib/src/handle_manager.cc index da6dba17d26..b8612f32703 100644 --- a/clib/src/handle_manager.cc +++ b/clib/src/handle_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/handle_manager.hh" diff --git a/clib/src/io/directory_entry.cc b/clib/src/io/directory_entry.cc index 2f3b3c9fb0d..2ba512978e9 100644 --- a/clib/src/io/directory_entry.cc +++ b/clib/src/io/directory_entry.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/io/directory_entry.hh" diff --git a/clib/src/io/file_entry.cc b/clib/src/io/file_entry.cc index a22d87f86d3..0d0e6426873 100644 --- a/clib/src/io/file_entry.cc +++ b/clib/src/io/file_entry.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/io/file_entry.hh" diff --git a/clib/src/io/file_stream.cc b/clib/src/io/file_stream.cc index 57a2451bb07..9c1598226fc 100644 --- a/clib/src/io/file_stream.cc +++ b/clib/src/io/file_stream.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/io/file_stream.hh" diff --git a/clib/src/library.cc b/clib/src/library.cc index 87e33736d82..218d44b989d 100644 --- a/clib/src/library.cc +++ b/clib/src/library.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/library.hh" diff --git a/clib/src/logging/backend.cc b/clib/src/logging/backend.cc index 0ffe33c7ffc..cdc7f17394b 100644 --- a/clib/src/logging/backend.cc +++ b/clib/src/logging/backend.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/logging/backend.hh" diff --git a/clib/src/logging/engine.cc b/clib/src/logging/engine.cc index e7f4955bbdf..ed0fec76573 100644 --- a/clib/src/logging/engine.cc +++ b/clib/src/logging/engine.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/logging/engine.hh" diff --git a/clib/src/logging/file.cc b/clib/src/logging/file.cc index ba1ce8a362d..0c32d37f7dd 100644 --- a/clib/src/logging/file.cc +++ b/clib/src/logging/file.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/logging/file.hh" diff --git a/clib/src/logging/syslogger.cc b/clib/src/logging/syslogger.cc index cff1a863951..012b1c2a42a 100644 --- a/clib/src/logging/syslogger.cc +++ b/clib/src/logging/syslogger.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/logging/syslogger.hh" diff --git a/clib/src/logging/temp_logger.cc b/clib/src/logging/temp_logger.cc index 612472cb92e..76d538abea2 100644 --- a/clib/src/logging/temp_logger.cc +++ b/clib/src/logging/temp_logger.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/logging/temp_logger.hh" diff --git a/clib/src/misc/argument.cc b/clib/src/misc/argument.cc index 189f0144dcf..95bb1a73f37 100644 --- a/clib/src/misc/argument.cc +++ b/clib/src/misc/argument.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/misc/argument.hh" diff --git a/clib/src/misc/command_line.cc b/clib/src/misc/command_line.cc index 291e6797bd0..c84fea8cb9e 100644 --- a/clib/src/misc/command_line.cc +++ b/clib/src/misc/command_line.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/misc/command_line.hh" diff --git a/clib/src/misc/get_options.cc b/clib/src/misc/get_options.cc index bd5102c992d..e5d9a0b3c08 100644 --- a/clib/src/misc/get_options.cc +++ b/clib/src/misc/get_options.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/misc/get_options.hh" diff --git a/clib/src/misc/stringifier.cc b/clib/src/misc/stringifier.cc index d608e596a37..6ff08408643 100644 --- a/clib/src/misc/stringifier.cc +++ b/clib/src/misc/stringifier.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/misc/stringifier.hh" diff --git a/clib/src/process.cc b/clib/src/process.cc index 946ade40a34..d5ef993b9bd 100644 --- a/clib/src/process.cc +++ b/clib/src/process.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013,2020-2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013,2020-2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/clib/src/process_manager.cc b/clib/src/process_manager.cc index cca8b0dc1a3..a0a4515830d 100644 --- a/clib/src/process_manager.cc +++ b/clib/src/process_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/process_manager.hh" diff --git a/clib/src/task_manager.cc b/clib/src/task_manager.cc index 10617fb35b0..edec8323f1c 100644 --- a/clib/src/task_manager.cc +++ b/clib/src/task_manager.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2019 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2019 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/task_manager.hh" diff --git a/clib/src/timestamp.cc b/clib/src/timestamp.cc index 88a771b8f6b..855248536a1 100644 --- a/clib/src/timestamp.cc +++ b/clib/src/timestamp.cc @@ -1,23 +1,25 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/timestamp.hh" + #include + #include using namespace com::centreon; @@ -188,9 +190,7 @@ timestamp& timestamp::operator-=(const timestamp& right) { * * @param[in] msecs Time in milliseconds. */ -void timestamp::add_mseconds(int32_t msecs) { - add_useconds(msecs * 1000); -} +void timestamp::add_mseconds(int32_t msecs) { add_useconds(msecs * 1000); } /** * Add microseconds to this object. @@ -262,36 +262,28 @@ timestamp timestamp::now() noexcept { * * @param[in] msecs Time in milliseconds. */ -void timestamp::sub_mseconds(int32_t msecs) { - add_mseconds(-msecs); -} +void timestamp::sub_mseconds(int32_t msecs) { add_mseconds(-msecs); } /** * Substract seconds from this object. * * @param[in] secs Time in seconds. */ -void timestamp::sub_seconds(time_t secs) noexcept { - _secs -= secs; -} +void timestamp::sub_seconds(time_t secs) noexcept { _secs -= secs; } /** * Add seconds from this object. * * @param[in] secs Time in seconds. */ -void timestamp::add_seconds(time_t secs) noexcept { - _secs += secs; -} +void timestamp::add_seconds(time_t secs) noexcept { _secs += secs; } /** * Substract microseconds from this object. * * @param[in] usecs Time in microseconds. */ -void timestamp::sub_useconds(int32_t usecs) { - add_useconds(-usecs); -} +void timestamp::sub_useconds(int32_t usecs) { add_useconds(-usecs); } /** * Get the time in milliseconds. @@ -307,9 +299,7 @@ int64_t timestamp::to_mseconds() const noexcept { * * @return The time in seconds. */ -time_t timestamp::to_seconds() const noexcept { - return _secs; -} +time_t timestamp::to_seconds() const noexcept { return _secs; } /** * Get the time in microseconds. @@ -320,7 +310,7 @@ int64_t timestamp::to_useconds() const noexcept { return _secs * 1000000ll + _usecs; } -CC_BEGIN() +namespace com::centreon { std::ostream& operator<<(std::ostream& s, const timestamp& to_dump) { struct tm tmp; @@ -332,5 +322,4 @@ std::ostream& operator<<(std::ostream& s, const timestamp& to_dump) { return s; } - -CC_END() +} // namespace com::centreon diff --git a/clib/test/backend_test.hh b/clib/test/backend_test.hh index cf01e0b726f..dee61676bb0 100644 --- a/clib/test/backend_test.hh +++ b/clib/test/backend_test.hh @@ -22,7 +22,7 @@ #include "com/centreon/logging/backend.hh" #include "com/centreon/misc/stringifier.hh" -CC_BEGIN() +namespace com::centreon { namespace logging { /** @@ -66,6 +66,6 @@ class backend_test : public backend { }; } // namespace logging -CC_END() +} #endif // !CC_TEST_LOGGING_BACKEND_TEST_HH diff --git a/clib/test/bin_test_process_output.cc b/clib/test/bin_test_process_output.cc index 5a51f82bd0d..b1c149862c3 100644 --- a/clib/test/bin_test_process_output.cc +++ b/clib/test/bin_test_process_output.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013, 2021 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013, 2021 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include @@ -73,11 +73,10 @@ static int check_stdout(int d) { */ static int check_output(char const* type) { int output(strcmp(type, "err") ? 1 : 2); - int total(0); int size(0); char buffer[1024]; while ((size = read(0, buffer, sizeof(buffer))) > 0) - total += write(output, buffer, size); + write(output, buffer, size); return EXIT_SUCCESS; } diff --git a/clib/test/exceptions.cc b/clib/test/exceptions.cc index 68e68b52ebd..3bade486092 100644 --- a/clib/test/exceptions.cc +++ b/clib/test/exceptions.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/handle_manager.cc b/clib/test/handle_manager.cc index 9501adc33a6..7fe41ddd82d 100644 --- a/clib/test/handle_manager.cc +++ b/clib/test/handle_manager.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/io.cc b/clib/test/io.cc index 2e96a83144a..84505fc06a1 100644 --- a/clib/test/io.cc +++ b/clib/test/io.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/library.cc b/clib/test/library.cc index 783a4c96919..9379f72a4d1 100644 --- a/clib/test/library.cc +++ b/clib/test/library.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/logging.cc b/clib/test/logging.cc index 7940fe04958..79928d5c63a 100644 --- a/clib/test/logging.cc +++ b/clib/test/logging.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2020 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/clib/test/main.cc b/clib/test/main.cc index 98817fad3aa..cda4e636f7c 100644 --- a/clib/test/main.cc +++ b/clib/test/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/misc.cc b/clib/test/misc.cc index d59d6420b27..4e325cc6a41 100644 --- a/clib/test/misc.cc +++ b/clib/test/misc.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/process.cc b/clib/test/process.cc index c382a0e672b..7ea60935165 100644 --- a/clib/test/process.cc +++ b/clib/test/process.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020-2021 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/shared_testing_library.cc b/clib/test/shared_testing_library.cc index a68f2bb695c..3e80cfc80c8 100644 --- a/clib/test/shared_testing_library.cc +++ b/clib/test/shared_testing_library.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ int export_lib_version = 42; diff --git a/clib/test/task_manager.cc b/clib/test/task_manager.cc index b987bba4679..9a8411a6008 100644 --- a/clib/test/task_manager.cc +++ b/clib/test/task_manager.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/timestamp.cc b/clib/test/timestamp.cc index 11ade949079..9011e0b500d 100644 --- a/clib/test/timestamp.cc +++ b/clib/test/timestamp.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/clib/test/version.cc b/clib/test/version.cc index 3460b94cc12..8f2b10e7a88 100644 --- a/clib/test/version.cc +++ b/clib/test/version.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2020 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/clib/version.hh" diff --git a/cmake.sh b/cmake.sh index f1d63abb327..535715ca5c7 100755 --- a/cmake.sh +++ b/cmake.sh @@ -9,9 +9,10 @@ This program build Centreon-broker -f|--force : force rebuild -r|--release : Build on release mode -fcr|--force-conan-rebuild : rebuild conan data - -ng : C++17 standard + -og : C++14 standard -clang : Compilation with clang++ -dr : Debug robot enabled + -sccache : Compilation through sccache -h|--help : help EOF } @@ -27,7 +28,7 @@ for i in $(cat conanfile.txt) ; do fi done -STD=gnu14 +STD=gnu17 COMPILER=gcc CC=gcc CXX=g++ @@ -44,9 +45,9 @@ do force=1 shift ;; - -ng) - echo "C++17 applied on this compilation" - STD="gnu17" + -og) + echo "C++14 applied on this compilation" + STD="gnu14" shift ;; -dr|--debug-robot) @@ -67,6 +68,10 @@ do CXX=clang++ shift ;; + -sccache) + SC="1" + shift + ;; -fcr|--force-conan-rebuild) echo "Forced conan rebuild" CONAN_REBUILD="1" @@ -269,8 +274,8 @@ elif [ -r /etc/issue ] ; then fi fi -if ! pip3 install conan==1.57.0 --upgrade --break-system-packages ; then - pip3 install conan==1.57.0 --upgrade +if ! pip3 install conan==1.62.0 --upgrade --break-system-packages ; then + pip3 install conan==1.62.0 --upgrade fi if which conan ; then @@ -322,16 +327,18 @@ cd build echo "$conan install .. --build=missing" $conan install .. --build=missing -if [[ "$STD" -eq "gnu17" ]] ; then - NG="-DNG=ON" +NG="-DNG=ON" + +if [ "$SC" -eq 1 ] ; then + SCCACHE="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" else - NG="-DNG=OFF" + SCCACHE= fi if [[ "$maj" == "Raspbian" ]] ; then - CC=$CC CXX=$CXX CXXFLAGS="-Wall -Wextra" $cmake $DR -DWITH_CLANG=$WITH_CLANG -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_TESTING=On -DWITH_MODULE_SIMU=On -DWITH_BENCH=On -DWITH_CREATE_FILES=OFF $NG $* .. + CC=$CC CXX=$CXX CXXFLAGS="-Wall -Wextra" $cmake $DR -DWITH_CLANG=$WITH_CLANG $SCCACHE -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_TESTING=On -DWITH_MODULE_SIMU=On -DWITH_BENCH=On -DWITH_CREATE_FILES=OFF $NG $* .. elif [[ "$maj" == "Debian" ]] ; then - CC=$CC CXX=$CXX CXXFLAGS="-Wall -Wextra" $cmake $DR -DWITH_CLANG=$WITH_CLANG -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_PREFIX_LIB_CLIB=/usr/lib64/ -DWITH_MODULE_SIMU=On -DWITH_BENCH=On -DWITH_CREATE_FILES=OFF -DWITH_CONF=OFF $NG $* .. + CC=$CC CXX=$CXX CXXFLAGS="-Wall -Wextra" $cmake $DR -DWITH_CLANG=$WITH_CLANG $SCCACHE -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_PREFIX_LIB_CLIB=/usr/lib64/ -DWITH_MODULE_SIMU=On -DWITH_BENCH=On -DWITH_CREATE_FILES=OFF -DWITH_CONF=OFF $NG $* .. else - CC=$CC CXX=$CXX CXXFLAGS="-Wall -Wextra" $cmake $DR -DWITH_CLANG=$WITH_CLANG -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_MODULE_SIMU=On -DWITH_BENCH=On -DWITH_CREATE_FILES=OFF -DWITH_CONF=OFF $NG $* .. + CC=$CC CXX=$CXX CXXFLAGS="-Wall -Wextra" $cmake $DR -DWITH_CLANG=$WITH_CLANG $SCCACHE -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_MODULE_SIMU=On -DWITH_BENCH=On -DWITH_CREATE_FILES=OFF -DWITH_CONF=OFF $NG $* .. fi diff --git a/common/inc/com/centreon/common/defer.hh b/common/inc/com/centreon/common/defer.hh index 65374a8bc4f..788a708de91 100644 --- a/common/inc/com/centreon/common/defer.hh +++ b/common/inc/com/centreon/common/defer.hh @@ -19,9 +19,7 @@ #ifndef _COM_CENTREON_DEFER_HH_ #define _COM_CENTREON_DEFER_HH_ -#include "namespace.hh" - -CCCM_BEGIN() +namespace com::centreon::common { /** * @brief this function executes the handler action in delay @@ -46,6 +44,6 @@ void defer(const std::shared_ptr& io_context, }); }; -CCCM_END() +} // namespace com::centreon::common #endif diff --git a/common/inc/com/centreon/common/hex_dump.hh b/common/inc/com/centreon/common/hex_dump.hh index a6cef4a5087..111bc16c694 100644 --- a/common/inc/com/centreon/common/hex_dump.hh +++ b/common/inc/com/centreon/common/hex_dump.hh @@ -1,32 +1,29 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCCM_HEX_DUMP_HH #define CCCM_HEX_DUMP_HH #include -#include "namespace.hh" +namespace com::centreon::common { -CCCM_BEGIN() - -std::string hex_dump(const unsigned char* buffer, - size_t buff_len, +std::string hex_dump(const unsigned char* buffer, size_t buff_len, uint32_t nb_char_per_line); inline std::string hex_dump(const std::string& buffer, @@ -35,6 +32,6 @@ inline std::string hex_dump(const std::string& buffer, buffer.size(), nb_char_per_line); } -CCCM_END() +} // namespace com::centreon::common #endif diff --git a/common/inc/com/centreon/common/namespace.hh b/common/inc/com/centreon/common/namespace.hh deleted file mode 100644 index fecd03a3b3f..00000000000 --- a/common/inc/com/centreon/common/namespace.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CCCM_NAMESPACE_HH -#define CCCM_NAMESPACE_HH - -#ifdef CCCM_BEGIN -#undef CCCM_BEGIN -#endif // CCCM_BEGIN -#define CCCM_BEGIN() \ - namespace com { \ - namespace centreon { \ - namespace common { - -#ifdef CCCM_END -#undef CCCM_END -#endif // CCCM_END -#define CCCM_END() \ - } \ - } \ - } - -#endif // !CCCM_NAMESPACE_HH diff --git a/common/inc/com/centreon/common/node_allocator.hh b/common/inc/com/centreon/common/node_allocator.hh index da2e3d26f6a..2e9b9a8db5e 100644 --- a/common/inc/com/centreon/common/node_allocator.hh +++ b/common/inc/com/centreon/common/node_allocator.hh @@ -1,20 +1,20 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCCM_NODE_ALLOCATOR_HH #define CCCM_NODE_ALLOCATOR_HH @@ -25,10 +25,8 @@ #include #include #include -#include "namespace.hh" -namespace boost { -namespace interprocess { +namespace boost::interprocess { /** * @brief boost::interprocess::to_raw_pointer convert a @@ -43,10 +41,9 @@ template T* to_raw_pointer(T* p) { return p; } -} // namespace interprocess -} // namespace boost +} // namespace boost::interprocess -CCCM_BEGIN() +namespace com::centreon::common { using errinfo_pointer = boost::error_info; @@ -321,6 +318,6 @@ std::ostream& operator<<( return str; } -CCCM_END() +} // namespace com::centreon::common -#endif \ No newline at end of file +#endif diff --git a/common/inc/com/centreon/common/process_stat.hh b/common/inc/com/centreon/common/process_stat.hh index f4ae9292b31..d57a7791997 100644 --- a/common/inc/com/centreon/common/process_stat.hh +++ b/common/inc/com/centreon/common/process_stat.hh @@ -1,35 +1,32 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCCM_PROCESS_STAT_HH #define CCCM_PROCESS_STAT_HH #include -#include -#include - #include #include +#include +#include -#include "namespace.hh" - -CCCM_BEGIN() +namespace com::centreon::common { class process_stat { pid_t _pid; @@ -206,6 +203,6 @@ void process_stat::to_protobuff(protobuf_class& dest) const { dest.set_shared_size(_shared_size); } -CCCM_END() +} // namespace com::centreon::common #endif diff --git a/common/inc/com/centreon/common/time.hh b/common/inc/com/centreon/common/time.hh index 144f31d2c52..58c7fe23d48 100644 --- a/common/inc/com/centreon/common/time.hh +++ b/common/inc/com/centreon/common/time.hh @@ -1,27 +1,25 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCCM_TIME_HH #define CCCM_TIME_HH -#include "namespace.hh" - -CCCM_BEGIN() +namespace com::centreon::common { /** * @brief converter from google TimeStamp to @@ -57,6 +55,6 @@ inline void time_point_to_google_ts( 1000000000); } -CCCM_END() +} // namespace com::centreon::common #endif diff --git a/common/src/hex_dump.cc b/common/src/hex_dump.cc index 700f281d717..eabd5e70f0c 100644 --- a/common/src/hex_dump.cc +++ b/common/src/hex_dump.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/common/src/process_stat.cc b/common/src/process_stat.cc index 9e9f208fe24..2d165d2b923 100644 --- a/common/src/process_stat.cc +++ b/common/src/process_stat.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include @@ -44,10 +44,10 @@ static auto read_file = [](const std::string& file_path) -> std::string { } }; -static auto extract_io_value = [](const absl::string_view& label_value, +static auto extract_io_value = [](const std::string_view& label_value, const std::string& file_path) -> uint64_t { size_t value_index = label_value.find_first_of(" :"); - if (value_index == absl::string_view::npos) { + if (value_index == std::string_view::npos) { BOOST_THROW_EXCEPTION(process_stat::exception() << process_stat::errinfo_bad_info_format( std::string(label_value.data())) diff --git a/common/test/hex_dump_test.cc b/common/test/hex_dump_test.cc index 95afa1aa27e..9db1988697f 100644 --- a/common/test/hex_dump_test.cc +++ b/common/test/hex_dump_test.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/common/test/node_allocator_test.cc b/common/test/node_allocator_test.cc index 7ecf0ae3a10..d663abe264b 100644 --- a/common/test/node_allocator_test.cc +++ b/common/test/node_allocator_test.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/common/test/process_stat_test.cc b/common/test/process_stat_test.cc index ff464df5095..91b1a839c43 100644 --- a/common/test/process_stat_test.cc +++ b/common/test/process_stat_test.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2023 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2023 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/conanfile.txt b/conanfile.txt index 3a04a12c93d..a2702a155e3 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,17 +1,19 @@ [requires] -openssl/1.1.1t -boost/1.82.0 +abseil/20230125.3 +boost/1.83.0 fmt/9.1.0 -protobuf/3.21.9 grpc/1.50.1 -gtest/cci.20210126 -libcurl/8.0.1 -libssh2/1.10.0 +gtest/1.14.0 +libcurl/8.2.1 +libssh2/1.11.0 mariadb-connector-c/3.3.3 nlohmann_json/3.11.2 -opentelemetry-cpp/1.8.1 -spdlog/1.11.0 -zlib/1.2.13 +openssl/1.1.1t +opentelemetry-cpp/1.9.1 +rapidyaml/0.5.0 +protobuf/3.21.9 +spdlog/1.12.0 +zlib/1.3 [generators] cmake diff --git a/connectors/common/inc/com/centreon/connector/ipolicy.hh b/connectors/common/inc/com/centreon/connector/ipolicy.hh index babcbf383aa..f383d93c1d5 100644 --- a/connectors/common/inc/com/centreon/connector/ipolicy.hh +++ b/connectors/common/inc/com/centreon/connector/ipolicy.hh @@ -19,9 +19,7 @@ #ifndef CONNECTORS_INC_COM_CENTREON_CONNECTOR_IPOLICY_H_ #define CONNECTORS_INC_COM_CENTREON_CONNECTOR_IPOLICY_H_ -#include "namespace.hh" - -CCC_BEGIN() +namespace com::centreon::connector { namespace orders { class options; } @@ -39,6 +37,6 @@ class policy_interface : public std::enable_shared_from_this { virtual void on_version() = 0; }; -CCC_END() +} // namespace com::centreon::connector #endif diff --git a/connectors/common/inc/com/centreon/connector/log.hh b/connectors/common/inc/com/centreon/connector/log.hh index 9dde2ecd30d..6d4e7dab93d 100644 --- a/connectors/common/inc/com/centreon/connector/log.hh +++ b/connectors/common/inc/com/centreon/connector/log.hh @@ -19,9 +19,7 @@ #ifndef CONNECTORS_PERL_INC_COM_CENTREON_CONNECTOR_PERL_LOG_H_ #define CONNECTORS_PERL_INC_COM_CENTREON_CONNECTOR_PERL_LOG_H_ -#include "com/centreon/connector/namespace.hh" - -CCC_BEGIN(); +namespace com::centreon::connector { class log { private: @@ -43,5 +41,5 @@ class log { static std::shared_ptr core(); }; -CCC_END(); +} // namespace com::centreon::connector #endif // CONNECTORS_PERL_INC_COM_CENTREON_CONNECTOR_PERL_LOG_H_ diff --git a/connectors/common/inc/com/centreon/connector/namespace.hh b/connectors/common/inc/com/centreon/connector/namespace.hh deleted file mode 100644 index c2846ab6b74..00000000000 --- a/connectors/common/inc/com/centreon/connector/namespace.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* -** Copyright 2011-2020 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CCC_NAMESPACE_HH -#define CCC_NAMESPACE_HH - -#ifdef CCC_BEGIN -#undef CCC_BEGIN -#endif // CCC_BEGIN -#define CCC_BEGIN() \ - namespace com { \ - namespace centreon { \ - namespace connector { - -#ifdef CCC_END -#undef CCC_END -#endif // CCC_END -#define CCC_END() \ - } \ - } \ - } - -#endif // !CCC_NAMESPACE_HH diff --git a/connectors/common/inc/com/centreon/connector/parser.hh b/connectors/common/inc/com/centreon/connector/parser.hh index 61b00ad0200..69a00e996f3 100644 --- a/connectors/common/inc/com/centreon/connector/parser.hh +++ b/connectors/common/inc/com/centreon/connector/parser.hh @@ -19,9 +19,7 @@ #ifndef CCC_ORDERS_PARSER_HH #define CCC_ORDERS_PARSER_HH -#include "com/centreon/connector/namespace.hh" - -CCC_BEGIN() +namespace com::centreon::connector { class policy_interface; @@ -71,6 +69,6 @@ class parser : public std::enable_shared_from_this { parser& operator=(parser const& p) = delete; }; -CCC_END() +} // namespace com::centreon::connector #endif // !CCC_ORDERS_PARSER_HH diff --git a/connectors/common/inc/com/centreon/connector/reporter.hh b/connectors/common/inc/com/centreon/connector/reporter.hh index 4fd9971962a..c119be42a37 100644 --- a/connectors/common/inc/com/centreon/connector/reporter.hh +++ b/connectors/common/inc/com/centreon/connector/reporter.hh @@ -19,10 +19,9 @@ #ifndef CCC_REPORTER_HH #define CCC_REPORTER_HH -#include "com/centreon/connector/namespace.hh" #include "com/centreon/connector/result.hh" -CCC_BEGIN() +namespace com::centreon::connector { /** * @class reporter reporter.hh "com/centreon/connector/ssh/reporter.hh" @@ -58,6 +57,6 @@ class reporter : public std::enable_shared_from_this { const std::string& get_buffer() const { return *_buffer; } }; -CCC_END() +} // namespace com::centreon::connector #endif // !CCC_REPORTER_HH diff --git a/connectors/common/inc/com/centreon/connector/result.hh b/connectors/common/inc/com/centreon/connector/result.hh index 7f282509b69..8b2a215d940 100644 --- a/connectors/common/inc/com/centreon/connector/result.hh +++ b/connectors/common/inc/com/centreon/connector/result.hh @@ -19,9 +19,7 @@ #ifndef CCC_CHECKS_RESULT_HH #define CCC_CHECKS_RESULT_HH -#include "com/centreon/connector/namespace.hh" - -CCC_BEGIN() +namespace com::centreon::connector { /** * @class result result.hh "com/centreon/connector/ssh/checks/result.hh" @@ -62,6 +60,6 @@ class result { std::string _output; }; -CCC_END() +} // namespace com::centreon::connector #endif // !CCC_CHECKS_RESULT_HH diff --git a/connectors/common/src/log.cc b/connectors/common/src/log.cc index 403ea70cb6c..f89497747c2 100644 --- a/connectors/common/src/log.cc +++ b/connectors/common/src/log.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/common/src/parser.cc b/connectors/common/src/parser.cc index 0b4d147a689..027ae6740d1 100644 --- a/connectors/common/src/parser.cc +++ b/connectors/common/src/parser.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/parser.hh" diff --git a/connectors/common/src/reporter.cc b/connectors/common/src/reporter.cc index d59fd1353aa..ca90947fcbd 100644 --- a/connectors/common/src/reporter.cc +++ b/connectors/common/src/reporter.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/reporter.hh" diff --git a/connectors/common/src/result.cc b/connectors/common/src/result.cc index 537b4412d3d..d8e7f356d64 100644 --- a/connectors/common/src/result.cc +++ b/connectors/common/src/result.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/result.hh" diff --git a/connectors/perl/CMakeLists.txt b/connectors/perl/CMakeLists.txt index 988404db77c..f332683e312 100644 --- a/connectors/perl/CMakeLists.txt +++ b/connectors/perl/CMakeLists.txt @@ -1,20 +1,20 @@ -# # -# # Copyright 2011-2015,2017-2019 Centreon -# # -# # Licensed under the Apache License, Version 2.0 (the "License"); -# # you may not use this file except in compliance with the License. -# # You may obtain a copy of the License at -# # -# # http://www.apache.org/licenses/LICENSE-2.0 -# # -# # Unless required by applicable law or agreed to in writing, software -# # distributed under the License is distributed on an "AS IS" BASIS, -# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# # See the License for the specific language governing permissions and -# # limitations under the License. -# # -# # For more information : contact@centreon.com -# # +# +# Copyright 2011-2015,2017-2019 Centreon +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# For more information : contact@centreon.com +# # Generate code to dynamically load modules. add_custom_command(OUTPUT "${PROJECT_SOURCE_DIR}/perl/src/xs_init.cc" @@ -47,7 +47,6 @@ add_executable(centreon_connector_perl ${PROJECT_SOURCE_DIR}/common/inc/com/centreon/connector/parser.hh ${PROJECT_SOURCE_DIR}/perl/inc/com/centreon/connector/perl/checks/check.hh ${PROJECT_SOURCE_DIR}/perl/inc/com/centreon/connector/perl/embedded_perl.hh - ${PROJECT_SOURCE_DIR}/perl/inc/com/centreon/connector/perl/namespace.hh ${PROJECT_SOURCE_DIR}/perl/inc/com/centreon/connector/perl/options.hh ${PROJECT_SOURCE_DIR}/perl/inc/com/centreon/connector/perl/orders/parser.hh ${PROJECT_SOURCE_DIR}/perl/inc/com/centreon/connector/perl/policy.hh diff --git a/connectors/perl/inc/com/centreon/connector/perl/checks/check.hh b/connectors/perl/inc/com/centreon/connector/perl/checks/check.hh index 88b67aefd10..4fc72315419 100644 --- a/connectors/perl/inc/com/centreon/connector/perl/checks/check.hh +++ b/connectors/perl/inc/com/centreon/connector/perl/checks/check.hh @@ -19,15 +19,12 @@ #ifndef CCCP_CHECKS_CHECK_HH #define CCCP_CHECKS_CHECK_HH -#include "com/centreon/connector/namespace.hh" -#include "com/centreon/connector/perl/namespace.hh" - -CCC_BEGIN() +namespace com::centreon::connector { class result; class reporter; -CCC_END() +} // namespace com::centreon::connector -CCCP_BEGIN() +namespace com::centreon::connector::perl { namespace checks { @@ -99,7 +96,7 @@ inline std::ostream& operator<<(std::ostream& s, const check& obj) { } // namespace checks -CCCP_END() +} // namespace com::centreon::connector::perl namespace fmt { // formatter specializations for fmt diff --git a/connectors/perl/inc/com/centreon/connector/perl/embedded_perl.hh b/connectors/perl/inc/com/centreon/connector/perl/embedded_perl.hh index 20e9b912d6f..98d73e186df 100644 --- a/connectors/perl/inc/com/centreon/connector/perl/embedded_perl.hh +++ b/connectors/perl/inc/com/centreon/connector/perl/embedded_perl.hh @@ -22,12 +22,11 @@ #include #include #include -#include "com/centreon/connector/perl/namespace.hh" // Global Perl interpreter. extern PerlInterpreter* my_perl; -CCCP_BEGIN() +namespace com::centreon::connector::perl { /** * @class embedded_perl embedded_perl.hh @@ -59,6 +58,6 @@ class embedded_perl { char** _argv; }; -CCCP_END() +} // namespace com::centreon::connector::perl #endif // !CCCP_EMBEDDED_PERL_HH diff --git a/connectors/perl/inc/com/centreon/connector/perl/namespace.hh b/connectors/perl/inc/com/centreon/connector/perl/namespace.hh deleted file mode 100644 index fbe995b079e..00000000000 --- a/connectors/perl/inc/com/centreon/connector/perl/namespace.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CCCP_NAMESPACE_HH -#define CCCP_NAMESPACE_HH - -#ifdef CCCP_BEGIN -#undef CCCP_BEGIN -#endif // CCCP_BEGIN -#define CCCP_BEGIN() \ - namespace com { \ - namespace centreon { \ - namespace connector { \ - namespace perl { - -#ifdef CCCP_END -#undef CCCP_END -#endif // CCCP_END -#define CCCP_END() \ - } \ - } \ - } \ - } - -#endif // !CCCP_NAMESPACE_HH diff --git a/connectors/perl/inc/com/centreon/connector/perl/options.hh b/connectors/perl/inc/com/centreon/connector/perl/options.hh index 16e46d71306..a02bab948c9 100644 --- a/connectors/perl/inc/com/centreon/connector/perl/options.hh +++ b/connectors/perl/inc/com/centreon/connector/perl/options.hh @@ -19,10 +19,9 @@ #ifndef CCCP_OPTIONS_HH #define CCCP_OPTIONS_HH -#include "com/centreon/connector/perl/namespace.hh" #include "com/centreon/misc/get_options.hh" -CCCP_BEGIN() +namespace com::centreon::connector::perl { /** * @class options options.hh "com/centreon/connector/perl/options.hh" @@ -43,6 +42,6 @@ class options : public com::centreon::misc::get_options { std::string usage() const override; }; -CCCP_END() +} // namespace com::centreon::connector::perl #endif // !CCCP_OPTIONS_HH diff --git a/connectors/perl/inc/com/centreon/connector/perl/orders/parser.hh b/connectors/perl/inc/com/centreon/connector/perl/orders/parser.hh index bc77e7f1c8c..227f763e6aa 100644 --- a/connectors/perl/inc/com/centreon/connector/perl/orders/parser.hh +++ b/connectors/perl/inc/com/centreon/connector/perl/orders/parser.hh @@ -20,11 +20,8 @@ #define CCCP_ORDERS_PARSER_HH #include "com/centreon/connector/parser.hh" -#include "com/centreon/connector/perl/namespace.hh" -#include "com/centreon/connector/namespace.hh" - -CCC_BEGIN() +namespace com::centreon::connector { namespace orders { class options : public std::string { @@ -33,9 +30,9 @@ class options : public std::string { }; } // namespace orders -CCC_END() +} // namespace com::centreon::connector -CCCP_BEGIN() +namespace com::centreon::connector::perl { namespace orders { /** @@ -66,6 +63,6 @@ class parser : public com::centreon::connector::parser { }; } // namespace orders -CCCP_END() +} // namespace com::centreon::connector::perl #endif // !CCCP_ORDERS_PARSER_HH diff --git a/connectors/perl/inc/com/centreon/connector/perl/policy.hh b/connectors/perl/inc/com/centreon/connector/perl/policy.hh index 3bb8ef8c94d..7163a5f99eb 100644 --- a/connectors/perl/inc/com/centreon/connector/perl/policy.hh +++ b/connectors/perl/inc/com/centreon/connector/perl/policy.hh @@ -21,11 +21,10 @@ #include "com/centreon/connector/ipolicy.hh" #include "com/centreon/connector/perl/checks/check.hh" -#include "com/centreon/connector/perl/namespace.hh" #include "com/centreon/connector/perl/orders/parser.hh" #include "com/centreon/connector/reporter.hh" -CCCP_BEGIN() +namespace com::centreon::connector::perl { /** * @class policy policy.hh "com/centreon/connector/perl/policy.hh" @@ -73,6 +72,6 @@ class policy : public com::centreon::connector::policy_interface { void on_version() override; }; -CCCP_END() +} // namespace com::centreon::connector::perl #endif // !CCCP_POLICY_HH diff --git a/connectors/perl/src/checks/check.cc b/connectors/perl/src/checks/check.cc index fdf810a82c8..42b93f202c1 100644 --- a/connectors/perl/src/checks/check.cc +++ b/connectors/perl/src/checks/check.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/perl/checks/check.hh" diff --git a/connectors/perl/src/embedded_perl.cc b/connectors/perl/src/embedded_perl.cc index b78c86c28d5..c466b4a8f89 100644 --- a/connectors/perl/src/embedded_perl.cc +++ b/connectors/perl/src/embedded_perl.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/perl/embedded_perl.hh" diff --git a/connectors/perl/src/main.cc b/connectors/perl/src/main.cc index 88cf5474d04..62b5110e336 100644 --- a/connectors/perl/src/main.cc +++ b/connectors/perl/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/log.hh" diff --git a/connectors/perl/src/options.cc b/connectors/perl/src/options.cc index 58d59ffbdd7..e74f05755fd 100644 --- a/connectors/perl/src/options.cc +++ b/connectors/perl/src/options.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/perl/options.hh" diff --git a/connectors/perl/src/orders/parser.cc b/connectors/perl/src/orders/parser.cc index baf4f507fbb..f487c866863 100644 --- a/connectors/perl/src/orders/parser.cc +++ b/connectors/perl/src/orders/parser.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/perl/orders/parser.hh" diff --git a/connectors/perl/src/policy.cc b/connectors/perl/src/policy.cc index 295968c8dd2..21c5f8bc33d 100644 --- a/connectors/perl/src/policy.cc +++ b/connectors/perl/src/policy.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/perl/policy.hh" diff --git a/connectors/perl/src/script.cc b/connectors/perl/src/script.cc index fa7c61dbae7..0de69c6221f 100644 --- a/connectors/perl/src/script.cc +++ b/connectors/perl/src/script.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/perl/embedded_perl.hh" diff --git a/connectors/perl/test/connector.cc b/connectors/perl/test/connector.cc index 2a2c8b54d9d..3a645117e35 100644 --- a/connectors/perl/test/connector.cc +++ b/connectors/perl/test/connector.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/perl/test/embedded_perl.cc b/connectors/perl/test/embedded_perl.cc index aaefaec9ab4..4eb91db067b 100644 --- a/connectors/perl/test/embedded_perl.cc +++ b/connectors/perl/test/embedded_perl.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/perl/test/main.cc b/connectors/perl/test/main.cc index 27ffdd1b67e..3c6e00e1a68 100644 --- a/connectors/perl/test/main.cc +++ b/connectors/perl/test/main.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/ssh/CMakeLists.txt b/connectors/ssh/CMakeLists.txt index 68e466a5f46..a06e87a79ce 100644 --- a/connectors/ssh/CMakeLists.txt +++ b/connectors/ssh/CMakeLists.txt @@ -48,7 +48,6 @@ add_executable( ${PROJECT_SOURCE_DIR}/common/inc/com/centreon/connector/reporter.hh ${PROJECT_SOURCE_DIR}/common/inc/com/centreon/connector/result.hh ${PROJECT_SOURCE_DIR}/ssh/inc/com/centreon/connector/ssh/checks/check.hh - ${PROJECT_SOURCE_DIR}/ssh/inc/com/centreon/connector/ssh/namespace.hh ${PROJECT_SOURCE_DIR}/ssh/inc/com/centreon/connector/ssh/options.hh ${PROJECT_SOURCE_DIR}/ssh/inc/com/centreon/connector/ssh/orders/options.hh ${PROJECT_SOURCE_DIR}/ssh/inc/com/centreon/connector/ssh/policy.hh diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/checks/check.hh b/connectors/ssh/inc/com/centreon/connector/ssh/checks/check.hh index 30569f3160d..89e8bdb9f89 100644 --- a/connectors/ssh/inc/com/centreon/connector/ssh/checks/check.hh +++ b/connectors/ssh/inc/com/centreon/connector/ssh/checks/check.hh @@ -22,9 +22,8 @@ #include #include "com/centreon/connector/result.hh" -#include "com/centreon/connector/ssh/namespace.hh" -CCCS_BEGIN() +namespace com::centreon::connector::ssh { namespace sessions { class session; @@ -46,11 +45,8 @@ class check : public std::enable_shared_from_this { using string_list = std::list; check(const std::shared_ptr& session, - unsigned long long cmd_id, - string_list const& cmds, - const time_point& tmt, - int skip_stdout = -1, - int skip_stderr = -1); + unsigned long long cmd_id, string_list const& cmds, + const time_point& tmt, int skip_stdout = -1, int skip_stderr = -1); ~check() noexcept; template @@ -102,7 +98,7 @@ std::ostream& operator<<(std::ostream& os, const check& chk); } // namespace checks -CCCS_END() +} // namespace com::centreon::connector::ssh namespace fmt { // formatter specializations for fmt diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/namespace.hh b/connectors/ssh/inc/com/centreon/connector/ssh/namespace.hh deleted file mode 100644 index fcb0048f3c4..00000000000 --- a/connectors/ssh/inc/com/centreon/connector/ssh/namespace.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CCCS_NAMESPACE_HH -#define CCCS_NAMESPACE_HH - -#ifdef CCCS_BEGIN -#undef CCCS_BEGIN -#endif // CCCS_BEGIN -#define CCCS_BEGIN() \ - namespace com { \ - namespace centreon { \ - namespace connector { \ - namespace ssh { - -#ifdef CCCS_END -#undef CCCS_END -#endif // CCCS_END -#define CCCS_END() \ - } \ - } \ - } \ - } - -#endif // !CCCS_NAMESPACE_HH diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/options.hh b/connectors/ssh/inc/com/centreon/connector/ssh/options.hh index 7a800c5ff62..5111da229f4 100644 --- a/connectors/ssh/inc/com/centreon/connector/ssh/options.hh +++ b/connectors/ssh/inc/com/centreon/connector/ssh/options.hh @@ -1,28 +1,27 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCCS_OPTIONS_HH #define CCCS_OPTIONS_HH -#include "com/centreon/connector/ssh/namespace.hh" #include "com/centreon/misc/get_options.hh" -CCCS_BEGIN() +namespace com::centreon::connector::ssh { /** * @class options options.hh "com/centreon/connector/ssh/options.hh" @@ -44,6 +43,6 @@ class options : public com::centreon::misc::get_options { void _init(); }; -CCCS_END() +} // namespace com::centreon::connector::ssh #endif // !CCCS_OPTIONS_HH diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/orders/options.hh b/connectors/ssh/inc/com/centreon/connector/ssh/orders/options.hh index 19bd3a93d1a..72fd9c92671 100644 --- a/connectors/ssh/inc/com/centreon/connector/ssh/orders/options.hh +++ b/connectors/ssh/inc/com/centreon/connector/ssh/orders/options.hh @@ -1,29 +1,26 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCCS_ORDERS_OPTIONS_HH #define CCCS_ORDERS_OPTIONS_HH -#include "com/centreon/connector/namespace.hh" +namespace com::centreon::connector::orders { -CCC_BEGIN() - -namespace orders { /** * @class options options.hh "com/centreon/connector/ssh/orders/options.hh" * @brief Parse orders command line arguments. @@ -68,8 +65,6 @@ class options { unsigned int _timeout; std::string _user; }; -} // namespace orders - -CCC_END() +} // namespace com::centreon::connector::orders #endif // !CCCS_ORDERS_OPTIONS_HH diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/orders/parser.hh b/connectors/ssh/inc/com/centreon/connector/ssh/orders/parser.hh index 0de451ed839..f6ef73e60ca 100644 --- a/connectors/ssh/inc/com/centreon/connector/ssh/orders/parser.hh +++ b/connectors/ssh/inc/com/centreon/connector/ssh/orders/parser.hh @@ -20,11 +20,8 @@ #define CCCS_ORDERS_PARSER_HH #include "com/centreon/connector/parser.hh" -#include "com/centreon/connector/ssh/namespace.hh" -CCCS_BEGIN() - -namespace orders { +namespace com::centreon::connector::ssh::orders { /** * @class parser parser.hh "com/centreon/connector/ssh/orders/parser.hh" @@ -55,6 +52,4 @@ class parser : public com::centreon::connector::parser { } // namespace orders -CCCS_END() - #endif // !CCCS_ORDERS_PARSER_HH diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/policy.hh b/connectors/ssh/inc/com/centreon/connector/ssh/policy.hh index 56933434736..4c8f55a11cf 100644 --- a/connectors/ssh/inc/com/centreon/connector/ssh/policy.hh +++ b/connectors/ssh/inc/com/centreon/connector/ssh/policy.hh @@ -24,7 +24,7 @@ #include "com/centreon/connector/ssh/orders/options.hh" #include "com/centreon/connector/ssh/sessions/credentials.hh" -CCCS_BEGIN() +namespace com::centreon::connector::ssh { // Forward declarations. @@ -93,6 +93,6 @@ class policy : public com::centreon::connector::policy_interface { void on_version() override; }; -CCCS_END() +} // namespace com::centreon::connector::ssh #endif // !CCCS_POLICY_HH diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/sessions/credentials.hh b/connectors/ssh/inc/com/centreon/connector/ssh/sessions/credentials.hh index b39bc845db1..97e1e7a51d1 100644 --- a/connectors/ssh/inc/com/centreon/connector/ssh/sessions/credentials.hh +++ b/connectors/ssh/inc/com/centreon/connector/ssh/sessions/credentials.hh @@ -20,11 +20,9 @@ #define CCCS_SESSIONS_CREDENTIALS_HH #include -#include "com/centreon/connector/ssh/namespace.hh" -CCCS_BEGIN() +namespace com::centreon::connector::ssh::sessions { -namespace sessions { /** * @class credentials credentials.hh * "com/centreon/connector/ssh/sessions/credentials.hh" @@ -36,10 +34,8 @@ namespace sessions { class credentials { public: credentials(); - credentials(std::string const& host, - std::string const& user, - std::string const& password, - std::string const& key = "", + credentials(std::string const& host, std::string const& user, + std::string const& password, std::string const& key = "", unsigned short port = 22); credentials(credentials const& c); ~credentials() = default; @@ -70,9 +66,7 @@ class credentials { std::ostream& operator<<(std::ostream&, const credentials&); -} // namespace sessions - -CCCS_END() +} // namespace com::centreon::connector::ssh::sessions namespace fmt { // formatter specializations for fmt diff --git a/connectors/ssh/inc/com/centreon/connector/ssh/sessions/session.hh b/connectors/ssh/inc/com/centreon/connector/ssh/sessions/session.hh index ce3a73f3eaf..62e5f912e57 100644 --- a/connectors/ssh/inc/com/centreon/connector/ssh/sessions/session.hh +++ b/connectors/ssh/inc/com/centreon/connector/ssh/sessions/session.hh @@ -1,32 +1,29 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2023 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #ifndef CCCS_SESSIONS_SESSION_HH #define CCCS_SESSIONS_SESSION_HH #include -#include "com/centreon/connector/ssh/namespace.hh" #include "com/centreon/connector/ssh/sessions/credentials.hh" -CCCS_BEGIN() - -namespace sessions { +namespace com::centreon::connector::ssh::sessions { /** * @class session session.hh "com/centreon/connector/ssh/session.hh" * @brief SSH session. @@ -60,10 +57,8 @@ class session : public std::enable_shared_from_this { int new_channel(LIBSSH2_CHANNEL*&); template - void async_wait(action_type&& action, - callback_type&& callback, - const time_point& time_out, - const char* debug_info); + void async_wait(action_type&& action, callback_type&& callback, + const time_point& time_out, const char* debug_info); shared_io_context get_io_context() const { return _io_context; } @@ -111,10 +106,8 @@ class session : public std::enable_shared_from_this { public: template - ssh2_action(action_type&& action, - callback_type&& callback, - time_point time_out, - const char* debug_info) + ssh2_action(action_type&& action, callback_type&& callback, + time_point time_out, const char* debug_info) : _action(action), _callback(callback), _time_out(time_out), @@ -128,36 +121,26 @@ class session : public std::enable_shared_from_this { void on_resolve(const boost::system::error_code& error, const asio::ip::tcp::resolver::results_type& results, - connect_callback callback, - const time_point& timeout); + connect_callback callback, const time_point& timeout); void on_connect( const boost::system::error_code& error, asio::ip::tcp::resolver::results_type::const_iterator current_endpoint, const asio::ip::tcp::resolver::results_type& all_res, - connect_callback callback, - const time_point& timeout); + connect_callback callback, const time_point& timeout); - static ssize_t g_socket_recv(libssh2_socket_t sockfd, - void* buffer, - size_t length, - int flags, - void** abstract); + static ssize_t g_socket_recv(libssh2_socket_t sockfd, void* buffer, + size_t length, int flags, void** abstract); ssize_t socket_recv(libssh2_socket_t sockfd, void* buffer, size_t length); void start_read(); void read_handler(const boost::system::error_code& err, - const recv_data::pointer& buff, - size_t nb_recv); + const recv_data::pointer& buff, size_t nb_recv); - static ssize_t g_socket_send(libssh2_socket_t sockfd, - const void* buffer, - size_t length, - int flags, - void** abstract); + static ssize_t g_socket_send(libssh2_socket_t sockfd, const void* buffer, + size_t length, int flags, void** abstract); - ssize_t socket_send(libssh2_socket_t sockfd, - const void* buffer, + ssize_t socket_send(libssh2_socket_t sockfd, const void* buffer, size_t length); void start_send(); @@ -166,16 +149,13 @@ class session : public std::enable_shared_from_this { void notify_listeners(bool force); void handshake(connect_callback callback, const time_point& timeout); - void handshake_handler(int ret, - connect_callback callback, + void handshake_handler(int ret, connect_callback callback, const time_point& timeout); void _key(connect_callback callback, const time_point& timeout); - void _key_handler(int retval, - connect_callback callback, + void _key_handler(int retval, connect_callback callback, const time_point& timeout); void _passwd(connect_callback callback, const time_point& timeout); - void _passwd_handler(int ret, - connect_callback callback, + void _passwd_handler(int ret, connect_callback callback, const time_point& timeout); void _startup(connect_callback callback, const time_point& timeout); @@ -201,10 +181,8 @@ class session : public std::enable_shared_from_this { }; // namespace sessions template -void session::async_wait(action_type&& action, - callback_type&& callback, - const time_point& time_out, - const char* debug_info) { +void session::async_wait(action_type&& action, callback_type&& callback, + const time_point& time_out, const char* debug_info) { int retval = action(); if (retval != LIBSSH2_ERROR_EAGAIN) { callback(retval); @@ -216,9 +194,7 @@ void session::async_wait(action_type&& action, std::ostream& operator<<(std::ostream& os, const session& sess); -} // namespace sessions - -CCCS_END() +} // namespace com::centreon::connector::ssh::sessions namespace fmt { // formatter specializations for fmt diff --git a/connectors/ssh/src/checks/check.cc b/connectors/ssh/src/checks/check.cc index d851e6ca8cf..54c155e4dfc 100644 --- a/connectors/ssh/src/checks/check.cc +++ b/connectors/ssh/src/checks/check.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2019 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2019 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/connector/log.hh" #include "com/centreon/exceptions/basic.hh" @@ -24,15 +24,13 @@ using namespace com::centreon::connector::ssh::checks; -CCCS_BEGIN() -namespace checks { +namespace com::centreon::connector::ssh::checks { std::ostream& operator<<(std::ostream& os, const check& chk) { chk.dump(os); return os; } -} // namespace checks -CCCS_END() +} // namespace com::centreon::connector::ssh::checks /** * @brief Construct a new check::check object diff --git a/connectors/ssh/src/main.cc b/connectors/ssh/src/main.cc index a039560cf5c..cb11efe0b44 100644 --- a/connectors/ssh/src/main.cc +++ b/connectors/ssh/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/log.hh" diff --git a/connectors/ssh/src/options.cc b/connectors/ssh/src/options.cc index a3b19ac5399..cfdb1aafc52 100644 --- a/connectors/ssh/src/options.cc +++ b/connectors/ssh/src/options.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/ssh/orders/options.hh" diff --git a/connectors/ssh/src/orders/options.cc b/connectors/ssh/src/orders/options.cc index ff67e1a2942..4fbec37c2dc 100644 --- a/connectors/ssh/src/orders/options.cc +++ b/connectors/ssh/src/orders/options.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #ifdef _WIN32 diff --git a/connectors/ssh/src/orders/parser.cc b/connectors/ssh/src/orders/parser.cc index b4b3dd5f496..fd957aceb52 100644 --- a/connectors/ssh/src/orders/parser.cc +++ b/connectors/ssh/src/orders/parser.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014, 2022 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014, 2022 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/ssh/orders/parser.hh" diff --git a/connectors/ssh/src/policy.cc b/connectors/ssh/src/policy.cc index 71331fe21b1..563152a5bb9 100644 --- a/connectors/ssh/src/policy.cc +++ b/connectors/ssh/src/policy.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2014 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2014 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/connector/ssh/policy.hh" diff --git a/connectors/ssh/src/sessions/credentials.cc b/connectors/ssh/src/sessions/credentials.cc index ab265e32388..a803f74574c 100644 --- a/connectors/ssh/src/sessions/credentials.cc +++ b/connectors/ssh/src/sessions/credentials.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include "com/centreon/connector/ssh/sessions/credentials.hh" @@ -210,17 +210,13 @@ void credentials::set_user(std::string const& user) { _user = user; } -CCCS_BEGIN() - -namespace sessions { +namespace com::centreon::connector::ssh::sessions { std::ostream& operator<<(std::ostream& s, const credentials& cred) { s << cred.get_user() << '@' << cred.get_host() << ':' << cred.get_port(); return s; } -} // namespace sessions - -CCCS_END() +} // namespace com::centreon::connector::ssh::sessions /************************************** * * diff --git a/connectors/ssh/src/sessions/session.cc b/connectors/ssh/src/sessions/session.cc index 8723d3328c4..fad74b3f590 100644 --- a/connectors/ssh/src/sessions/session.cc +++ b/connectors/ssh/src/sessions/session.cc @@ -1,20 +1,20 @@ -/* -** Copyright 2011-2013,2015 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ +/** + * Copyright 2011-2013,2015 Centreon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For more information : contact@centreon.com + */ #include @@ -27,15 +27,13 @@ using namespace com::centreon; using namespace com::centreon::connector; using namespace com::centreon::connector::ssh::sessions; -CCCS_BEGIN() -namespace sessions { +namespace com::centreon::connector::ssh::sessions { std::ostream& operator<<(std::ostream& os, const session& sess) { os << "s this:" << &sess << ' ' << sess.get_credentials(); return os; } -} // namespace sessions -CCCS_END() +} // namespace com::centreon::connector::ssh::sessions namespace fmt { // formatter specializations for fmt diff --git a/connectors/ssh/test/buffer_handle.cc b/connectors/ssh/test/buffer_handle.cc index 27863c903fa..65643ba9534 100644 --- a/connectors/ssh/test/buffer_handle.cc +++ b/connectors/ssh/test/buffer_handle.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/checks.cc b/connectors/ssh/test/checks.cc index c2302ca26d8..7ac070618de 100644 --- a/connectors/ssh/test/checks.cc +++ b/connectors/ssh/test/checks.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/ssh/test/connector.cc b/connectors/ssh/test/connector.cc index 84127014cb2..31a697f33ad 100644 --- a/connectors/ssh/test/connector.cc +++ b/connectors/ssh/test/connector.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/ssh/test/connector/command_execute.cc b/connectors/ssh/test/connector/command_execute.cc index e235d756120..1958a8c0218 100644 --- a/connectors/ssh/test/connector/command_execute.cc +++ b/connectors/ssh/test/connector/command_execute.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/connector/command_execute_log_file.cc b/connectors/ssh/test/connector/command_execute_log_file.cc index bc1d779f940..641d637531e 100644 --- a/connectors/ssh/test/connector/command_execute_log_file.cc +++ b/connectors/ssh/test/connector/command_execute_log_file.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/connector/command_quit.cc b/connectors/ssh/test/connector/command_quit.cc index 8db7b37fcfe..edb05cc2608 100644 --- a/connectors/ssh/test/connector/command_quit.cc +++ b/connectors/ssh/test/connector/command_quit.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/process.hh" diff --git a/connectors/ssh/test/connector/command_version.cc b/connectors/ssh/test/connector/command_version.cc index d7a99c19af8..d5773c78341 100644 --- a/connectors/ssh/test/connector/command_version.cc +++ b/connectors/ssh/test/connector/command_version.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/connector/eof_on_stdin.cc b/connectors/ssh/test/connector/eof_on_stdin.cc index b9096f32d7a..714b76b3273 100644 --- a/connectors/ssh/test/connector/eof_on_stdin.cc +++ b/connectors/ssh/test/connector/eof_on_stdin.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/process.hh" diff --git a/connectors/ssh/test/connector/invalid_command.cc b/connectors/ssh/test/connector/invalid_command.cc index ab56910f409..2b7ae22c650 100644 --- a/connectors/ssh/test/connector/invalid_command.cc +++ b/connectors/ssh/test/connector/invalid_command.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/connector/invalid_command_id.cc b/connectors/ssh/test/connector/invalid_command_id.cc index 3e7070ab7b4..6442a1b62f0 100644 --- a/connectors/ssh/test/connector/invalid_command_id.cc +++ b/connectors/ssh/test/connector/invalid_command_id.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/connector/non_existent_host.cc b/connectors/ssh/test/connector/non_existent_host.cc index 125418f3d81..4ee4f0340ef 100644 --- a/connectors/ssh/test/connector/non_existent_host.cc +++ b/connectors/ssh/test/connector/non_existent_host.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/connector/single_check_timeout.cc b/connectors/ssh/test/connector/single_check_timeout.cc index af36f32a7ab..a83c30b00f3 100644 --- a/connectors/ssh/test/connector/single_check_timeout.cc +++ b/connectors/ssh/test/connector/single_check_timeout.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2012-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2012-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/fake_listener.cc b/connectors/ssh/test/fake_listener.cc index 907b58addff..cef2926d192 100644 --- a/connectors/ssh/test/fake_listener.cc +++ b/connectors/ssh/test/fake_listener.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/ssh/test/options.cc b/connectors/ssh/test/options.cc index 377ff01999a..cccb2598932 100644 --- a/connectors/ssh/test/options.cc +++ b/connectors/ssh/test/options.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2022 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,6 @@ #include -#include "com/centreon/connector/ssh/namespace.hh" #include "com/centreon/connector/ssh/orders/options.hh" using namespace com::centreon::connector::orders; diff --git a/connectors/ssh/test/orders.cc b/connectors/ssh/test/orders.cc index a969870bc7a..b673954ece6 100644 --- a/connectors/ssh/test/orders.cc +++ b/connectors/ssh/test/orders.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/ssh/test/reporter.cc b/connectors/ssh/test/reporter.cc index 3c901f5d142..54d97480a17 100644 --- a/connectors/ssh/test/reporter.cc +++ b/connectors/ssh/test/reporter.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/ssh/test/sessions.cc b/connectors/ssh/test/sessions.cc index 0070163369c..3eab76a7478 100644 --- a/connectors/ssh/test/sessions.cc +++ b/connectors/ssh/test/sessions.cc @@ -1,4 +1,4 @@ -/* +/** * Copyright 2020 Centreon (https://www.centreon.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/basic_exception.hh b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/basic_exception.hh index 914ecf846e9..22f3e9f48b3 100644 --- a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/basic_exception.hh +++ b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/basic_exception.hh @@ -20,7 +20,6 @@ #define CCB_CONNECTOR_BASIC_EXCEPTION #include -#include "com/centreon/benchmark/connector/namespace.hh" CCB_CONNECTOR_BEGIN() diff --git a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/benchmark.hh b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/benchmark.hh index 62e97cee5a2..63f1fff5e14 100644 --- a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/benchmark.hh +++ b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/benchmark.hh @@ -22,7 +22,6 @@ #include #include #include -#include "com/centreon/benchmark/connector/namespace.hh" CCB_CONNECTOR_BEGIN() diff --git a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/connector.hh b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/connector.hh index 2f961378890..fa3132bcf5f 100644 --- a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/connector.hh +++ b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/connector.hh @@ -25,7 +25,6 @@ #include #include #include "com/centreon/benchmark/connector/benchmark.hh" -#include "com/centreon/benchmark/connector/namespace.hh" CCB_CONNECTOR_BEGIN() diff --git a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/misc.hh b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/misc.hh index 072d51d83e8..84ea80e336d 100644 --- a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/misc.hh +++ b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/misc.hh @@ -22,7 +22,6 @@ #include #include #include -#include "com/centreon/benchmark/connector/namespace.hh" CCB_CONNECTOR_BEGIN() diff --git a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/namespace.hh b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/namespace.hh deleted file mode 100644 index 39d674f3a70..00000000000 --- a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/namespace.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com -*/ - -#ifndef CCB_CONNECTOR_NAMESPACE_HH -#define CCB_CONNECTOR_NAMESPACE_HH - -#ifndef CCB_CONNECTOR_BEGIN -#define CCB_CONNECTOR_BEGIN() \ - namespace com { \ - namespace centreon { \ - namespace benchmark { \ - namespace connector { -#endif // !CCB_CONNECTOR_BEGIN - -#ifndef CCB_CONNECTOR_END -#define CCB_CONNECTOR_END() \ - } \ - } \ - } \ - } -#endif // !CCB_CONNECTOR_END - -#endif // !CCB_CONNECTOR_NAMESPACE_HH diff --git a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/plugin.hh b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/plugin.hh index 8ebb6f38125..38b02f4fd88 100644 --- a/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/plugin.hh +++ b/connectors/test/centreon-benchmark/connector/inc/com/centreon/benchmark/connector/plugin.hh @@ -25,7 +25,6 @@ #include #include #include "com/centreon/benchmark/connector/benchmark.hh" -#include "com/centreon/benchmark/connector/namespace.hh" CCB_CONNECTOR_BEGIN() diff --git a/connectors/test/centreon-benchmark/connector/src/basic_exception.cc b/connectors/test/centreon-benchmark/connector/src/basic_exception.cc index 261f983bce2..a14e9bfe6b0 100644 --- a/connectors/test/centreon-benchmark/connector/src/basic_exception.cc +++ b/connectors/test/centreon-benchmark/connector/src/basic_exception.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/benchmark/connector/basic_exception.hh" diff --git a/connectors/test/centreon-benchmark/connector/src/benchmark.cc b/connectors/test/centreon-benchmark/connector/src/benchmark.cc index 3773a9c47f0..bc45fab4468 100644 --- a/connectors/test/centreon-benchmark/connector/src/benchmark.cc +++ b/connectors/test/centreon-benchmark/connector/src/benchmark.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/benchmark/connector/benchmark.hh" diff --git a/connectors/test/centreon-benchmark/connector/src/connector.cc b/connectors/test/centreon-benchmark/connector/src/connector.cc index 516dfd4e517..1331dfb2162 100644 --- a/connectors/test/centreon-benchmark/connector/src/connector.cc +++ b/connectors/test/centreon-benchmark/connector/src/connector.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/benchmark/connector/connector.hh" diff --git a/connectors/test/centreon-benchmark/connector/src/main.cc b/connectors/test/centreon-benchmark/connector/src/main.cc index f31b4dd19ad..737b0e6ff5c 100644 --- a/connectors/test/centreon-benchmark/connector/src/main.cc +++ b/connectors/test/centreon-benchmark/connector/src/main.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include diff --git a/connectors/test/centreon-benchmark/connector/src/misc.cc b/connectors/test/centreon-benchmark/connector/src/misc.cc index fc937a94f78..8ebef55721e 100644 --- a/connectors/test/centreon-benchmark/connector/src/misc.cc +++ b/connectors/test/centreon-benchmark/connector/src/misc.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/benchmark/connector/misc.hh" diff --git a/connectors/test/centreon-benchmark/connector/src/plugin.cc b/connectors/test/centreon-benchmark/connector/src/plugin.cc index 0ca9bb9f61a..be053374a60 100644 --- a/connectors/test/centreon-benchmark/connector/src/plugin.cc +++ b/connectors/test/centreon-benchmark/connector/src/plugin.cc @@ -1,19 +1,19 @@ -/* -** Copyright 2011-2013 Centreon -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** For more information : contact@centreon.com +/** +* Copyright 2011-2013 Centreon +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* For more information : contact@centreon.com */ #include "com/centreon/benchmark/connector/plugin.hh" diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 138a6b1a584..301780c9ed5 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -542,6 +542,8 @@ target_link_libraries( CONAN_PKG::openssl ${c-ares_LIBS} CONAN_PKG::zlib + CONAN_PKG::rapidyaml + stdc++fs dl) # centenginestats target. diff --git a/engine/Doxyfile b/engine/Doxyfile new file mode 100644 index 00000000000..36abf8da737 --- /dev/null +++ b/engine/Doxyfile @@ -0,0 +1,2570 @@ +# Doxyfile 1.8.20 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Centreon Engine" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = doc/pictures/logo.jpg + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc/devel-doc + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = YES + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 2 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# (including Cygwin) and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen +# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.h \ + *.hh \ + *.py \ + *.md \ + *.pl + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = build .git cmake + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = doc/engine-doc.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the "-p" option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/xcode/), introduced with OSX +# 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /