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 : #ifndef HCCLV2_EXCHANGE_UB_CONN_DTO_H
11 : #define HCCLV2_EXCHANGE_UB_CONN_DTO_H
12 :
13 : #include <string>
14 : #include "binary_stream.h"
15 : #include "serializable.h"
16 : #include "orion_adapter_hccp.h"
17 : namespace Hccl {
18 :
19 : class ExchangeUbConnDto : public Serializable { // UB建链需要交换的信息
20 : public:
21 2 : ExchangeUbConnDto() {}
22 :
23 9 : ExchangeUbConnDto(u32 tokenValue, u32 qpKeySize, u64 tpHandle, u32 psn)
24 18 : : tokenValue(tokenValue),
25 9 : qpKeySize(qpKeySize),
26 9 : tpHandle(tpHandle),
27 9 : psn(psn)
28 9 : {}
29 :
30 2 : void Serialize(Hccl::BinaryStream& stream) override { stream << tokenValue << qpKey << eid << tpHandle << psn; }
31 :
32 1 : void Deserialize(Hccl::BinaryStream& stream) override { stream >> tokenValue >> qpKey >> eid >> tpHandle >> psn; }
33 :
34 8 : std::string Describe() const override
35 : {
36 8 : return StringFormat("ExchangeUbConnDto=[qpKeySize=%u, tpHandle=0x%llx, psn=%u]", qpKeySize, tpHandle, psn);
37 : }
38 :
39 : u32 tokenValue{0};
40 : u32 qpKeySize{HRT_UB_QP_KEY_MAX_LEN};
41 : u8 qpKey[HRT_UB_QP_KEY_MAX_LEN]{0};
42 : u8 eid[16]{0};
43 : u64 tpHandle{0};
44 : u32 psn{0};
45 : };
46 :
47 : } // namespace Hccl
48 :
49 : #endif
|