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 2 : {
23 2 : }
24 :
25 9 : ExchangeUbConnDto(u32 tokenValue, u32 qpKeySize, u64 tpHandle, u32 psn) :
26 9 : tokenValue(tokenValue), qpKeySize(qpKeySize), tpHandle(tpHandle), psn(psn)
27 : {
28 9 : }
29 :
30 2 : void Serialize(Hccl::BinaryStream &stream) override
31 : {
32 2 : stream << tokenValue << qpKey << eid << tpHandle << psn;
33 2 : }
34 :
35 1 : void Deserialize(Hccl::BinaryStream &stream) override
36 : {
37 1 : stream >> tokenValue >> qpKey >> eid >> tpHandle >> psn;
38 1 : }
39 :
40 8 : std::string Describe() const override
41 : {
42 : return StringFormat("ExchangeUbConnDto=[qpKeySize=%u, tpHandle=0x%llx, psn=%u]",
43 8 : qpKeySize, tpHandle, psn);
44 : }
45 :
46 : u32 tokenValue{0};
47 : u32 qpKeySize{HRT_UB_QP_KEY_MAX_LEN};
48 : u8 qpKey[HRT_UB_QP_KEY_MAX_LEN]{0};
49 : u8 eid[16]{0};
50 : u64 tpHandle{0};
51 : u32 psn{0};
52 : };
53 :
54 : } // namespace Hccl
55 :
56 : #endif
|