SNode.C
Loading...
Searching...
No Matches
DescriptorEventPublisher.h
Go to the documentation of this file.
1/*
2 * SNode.C - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef CORE_EPOLL_DESCRIPTOREVENTDISPATCHER_H
21#define CORE_EPOLL_DESCRIPTOREVENTDISPATCHER_H
22
23#include "core/DescriptorEventPublisher.h" // IWYU pragma: export
24
25namespace core {
27} // namespace core
28
29#ifndef DOXYGEN_SHOULD_SKIP_THIS
30
31#include "core/system/epoll.h"
32
33#include <cstdint>
34#include <string> // IWYU pragma: export
35#include <vector>
36
37#endif /* DOXYGEN_SHOULD_SKIP_THIS */
38
39namespace core::multiplexer::epoll {
40
42 private:
44 public:
45 explicit EPollEvents(int& epfd, uint32_t event);
46
47 private:
48 void muxMod(int fd, uint32_t events, core::DescriptorEventReceiver* eventReceiver) const;
49
50 public:
51 void muxAdd(core::DescriptorEventReceiver* eventReceiver);
52 void muxDel(int fd);
53
54 void muxOn(core::DescriptorEventReceiver* eventReceiver);
55 void muxOff(core::DescriptorEventReceiver* eventReceiver);
56
57 int getEPFd() const;
58 epoll_event* getEvents();
59 int getInterestCount() const;
60
61 private:
62 int& epfd;
63 uint32_t events;
64
67 };
68
69 public:
70 DescriptorEventPublisher(const std::string& name, int& epfd, uint32_t events, uint32_t revents);
71
72 private:
73 void muxAdd(core::DescriptorEventReceiver* eventReceiver) override;
74 void muxDel(int fd) override;
75 void muxOn(core::DescriptorEventReceiver* eventReceiver) override;
76 void muxOff(core::DescriptorEventReceiver* eventReceiver) override;
77
78 void spanActiveEvents() override;
79
81 uint32_t revents;
82 };
83
84} // namespace core::multiplexer::epoll
85
86#endif // CORE_EPOLL_DESCRIPTOREVENTDISPATCHER_H
void muxAdd(core::DescriptorEventReceiver *eventReceiver)
void muxMod(int fd, uint32_t events, core::DescriptorEventReceiver *eventReceiver) const
void muxOff(core::DescriptorEventReceiver *eventReceiver)
void muxAdd(core::DescriptorEventReceiver *eventReceiver) override
DescriptorEventPublisher(const std::string &name, int &epfd, uint32_t events, uint32_t revents)
void muxOff(core::DescriptorEventReceiver *eventReceiver) override
void muxOn(core::DescriptorEventReceiver *eventReceiver) override
int epoll_create1(int flags)
Definition epoll.cpp:30
int epoll_ctl(int epfd, int op, int fd, epoll_event *event)
Definition epoll.cpp:45