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