1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <cstdint>
17 #include <functional>
18 
19 #ifndef UTILS_IO_EVENT_COMMON_H
20 #define UTILS_IO_EVENT_COMMON_H
21 
22 namespace OHOS {
23 namespace Utils {
24 
25 using EventId = uint32_t;
26 
27 using EPEventId = uint32_t;
28 using REventId = EventId;
29 
30 using EventCallback = std::function<void()>;
31 
32 static constexpr int IO_EVENT_INVALID_FD = -1;
33 
34 
35 namespace Events {
36     static constexpr EventId EVENT_NONE  = 0u;
37     static constexpr EventId EVENT_READ  = 1u;
38     static constexpr EventId EVENT_WRITE = 1u << 1;
39     static constexpr EventId EVENT_CLOSE = 1u << 2;
40     static constexpr EventId EVENT_ERROR = 1u << 3;
41     static constexpr EventId EVENT_INVALID = static_cast<uint32_t>(-1);
42 }
43 
44 } // namespace Utils
45 } // namespace OHOS
46 #endif /* UTILS_IO_EVENT_COMMON_H */