LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/topo/new_topo_builder/rank_table_info - address_info.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-08-04 10:52:23 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef ADDRESS_INFO_H
      12              : #define ADDRESS_INFO_H
      13              : 
      14              : #include <set>
      15              : #include <string>
      16              : #include "nlohmann/json.hpp"
      17              : #include "ip_address.h"
      18              : #include "topo_common_types.h"
      19              : 
      20              : namespace Hccl {
      21              : 
      22              : constexpr unsigned int MIN_VALUE_PLANEID = 0;
      23              : constexpr unsigned int MAX_VALUE_PLANEID = 1024;
      24              : constexpr unsigned int MIN_VALUE_PORT = 1;
      25              : constexpr unsigned int MAX_VALUE_PORT = 16;
      26              : constexpr unsigned int MIN_VALUE_PORT_LENGTH = 1;
      27              : constexpr unsigned int MAX_VALUE_PORT_LENGTH = 32;
      28              : constexpr unsigned int MIN_VALUE_ADDR_LENGRH = 1;
      29              : constexpr unsigned int MAX_VALUE_ADDR_LENGRH = 256;
      30              : 
      31              : class AddressInfo{
      32              : public:
      33         1743 :     AddressInfo() {};
      34         3709 :     ~AddressInfo() {};
      35              :     
      36              :     IpAddress                  addr;
      37              :     u32                        socketPort_{0};  // socket监听端口
      38              :     AddrType                   addrType;
      39              :     std::set<std::string>      ports;  // 网口标记
      40              :     std::string                planeId{"0"};
      41              :     void                       Deserialize(const nlohmann::json &addressInfoJson);
      42              :     explicit                   AddressInfo(BinaryStream &binStream);
      43              :     void                       GetBinStream(BinaryStream &binStream) const;
      44              :     std::string                Describe() const;
      45              : 
      46              :     private:
      47              :     static const std::unordered_map<std::string , AddrType> strToAddrType;
      48              :     void EidToAddr(std::string str);
      49              :     void IPV4ToAddr(std::string str);
      50              :     void IPV6ToAddr(std::string str);
      51          558 :     static bool IsStringInAddrType(std::string str)
      52              :     {
      53          558 :         return strToAddrType.count(str) > 0;
      54              :     }
      55              : };
      56              : 
      57              : } // namespace Hccl
      58              : 
      59              : #endif // ADDRESS_INFO_H
        

Generated by: LCOV version 2.0-1