Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 UBOE_UB_RTP_ENDPOINT_HELPER_H
11 : #define UBOE_UB_RTP_ENDPOINT_HELPER_H
12 :
13 : #include <cstdint>
14 : #include <memory>
15 : #include <string>
16 : #include "endpoint.h"
17 :
18 : namespace hcomm {
19 : /**
20 : * @note 职责:UBOE/UB_RTP协议Endpoint的公共基类,提供内存管理和Socket监听等公共实现。
21 : * 子类只需实现 Init() 完成各自的地址获取(UBOE做IP→EID转换,UB_RTP直接使用EID)。
22 : */
23 : class UboeUbRtpEndpointHelper : public Endpoint {
24 : public:
25 : explicit UboeUbRtpEndpointHelper(const EndpointDesc& endpointDesc);
26 15 : ~UboeUbRtpEndpointHelper() = default;
27 :
28 : HcclResult ServerSocketListen(const uint32_t port) override;
29 : HcclResult ServerSocketStopListen(const uint32_t port) override;
30 :
31 0 : std::shared_ptr<RegedMemMgr> GetRegedMemMgr() override { return regedMemMgr_; }
32 :
33 : HcclResult RegisterMemory(HcommMem mem, const char* memTag, void** memHandle) override;
34 : HcclResult UnregisterMemory(void* memHandle) override;
35 : HcclResult MemoryExport(void* memHandle, void** memDesc, uint32_t* memDescLen) override;
36 : HcclResult MemoryImport(const void* memDesc, uint32_t descLen, HcommMem* outMem) override;
37 : HcclResult MemoryUnimport(const void* memDesc, uint32_t descLen) override;
38 : HcclResult GetAllMemHandles(void** memHandles, uint32_t* memHandleNum) override;
39 : };
40 :
41 : } // namespace hcomm
42 :
43 : #endif // UBOE_UB_RTP_ENDPOINT_HELPER_H
|