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 ADX_SOCK_EPOLL_H
11 : #define ADX_SOCK_EPOLL_H
12 : #include "adx_epoll.h"
13 : namespace Adx {
14 : #define SOCK_EPOLL_EVENT_MASK (HDC_EPOLL_DATA_IN | HDC_EPOLL_CONN_IN | HDC_EPOLL_SESSION_CLOSE)
15 : class AdxSockEpoll : public AdxEpoll {
16 : public:
17 8 : AdxSockEpoll() : ep_(-1) { epMaxSize_ = DEFAULT_EPOLL_SIZE; }
18 8 : ~AdxSockEpoll() override {}
19 : int32_t EpollCreate(const int32_t size) override;
20 : int32_t EpollAdd(EpollHandle target, EpollEvent& event) override;
21 : int32_t EpollDel(EpollHandle target, EpollEvent& event) override;
22 : int32_t EpollCtl(EpollHandle handle, EpollEvent& event, int32_t op) override;
23 : int32_t EpollWait(std::vector<EpollEvent>& events, int32_t size, int32_t timeout) override;
24 : int32_t EpollGetSize() override;
25 : int32_t EpollErrorHandle() override;
26 : int32_t EpollDestroy() override;
27 :
28 : private:
29 : uint32_t HdcEventToEpollEvent(uint32_t events) const;
30 : uint32_t EpollEventToHdcEvent(uint32_t events) const;
31 :
32 : private:
33 : int32_t ep_;
34 : };
35 : } // namespace Adx
36 : #endif
|