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)
18 : {
19 8 : epMaxSize_ = DEFAULT_EPOLL_SIZE;
20 8 : }
21 8 : ~AdxSockEpoll() override {}
22 : int32_t EpollCreate(const int32_t size) override;
23 : int32_t EpollAdd(EpollHandle target, EpollEvent &event) override;
24 : int32_t EpollDel(EpollHandle target, EpollEvent &event) override;
25 : int32_t EpollCtl(EpollHandle handle, EpollEvent &event, int32_t op) override;
26 : int32_t EpollWait(std::vector<EpollEvent> &events, int32_t size, int32_t timeout) override;
27 : int32_t EpollGetSize() override;
28 : int32_t EpollErrorHandle() override;
29 : int32_t EpollDestroy() override;
30 : private:
31 : uint32_t HdcEventToEpollEvent(uint32_t events) const;
32 : uint32_t EpollEventToHdcEvent(uint32_t events) const;
33 : private:
34 : int32_t ep_;
35 : };
36 : }
37 : #endif
|