13f4cbf05Sopenharmony_ci/*
23f4cbf05Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
33f4cbf05Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
43f4cbf05Sopenharmony_ci * you may not use this file except in compliance with the License.
53f4cbf05Sopenharmony_ci * You may obtain a copy of the License at
63f4cbf05Sopenharmony_ci *
73f4cbf05Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
83f4cbf05Sopenharmony_ci *
93f4cbf05Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
103f4cbf05Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
113f4cbf05Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123f4cbf05Sopenharmony_ci * See the License for the specific language governing permissions and
133f4cbf05Sopenharmony_ci * limitations under the License.
143f4cbf05Sopenharmony_ci */
153f4cbf05Sopenharmony_ci
163f4cbf05Sopenharmony_ci#include <cstdint>
173f4cbf05Sopenharmony_ci#include <functional>
183f4cbf05Sopenharmony_ci
193f4cbf05Sopenharmony_ci#ifndef UTILS_IO_EVENT_COMMON_H
203f4cbf05Sopenharmony_ci#define UTILS_IO_EVENT_COMMON_H
213f4cbf05Sopenharmony_ci
223f4cbf05Sopenharmony_cinamespace OHOS {
233f4cbf05Sopenharmony_cinamespace Utils {
243f4cbf05Sopenharmony_ci
253f4cbf05Sopenharmony_ciusing EventId = uint32_t;
263f4cbf05Sopenharmony_ci
273f4cbf05Sopenharmony_ciusing EPEventId = uint32_t;
283f4cbf05Sopenharmony_ciusing REventId = EventId;
293f4cbf05Sopenharmony_ci
303f4cbf05Sopenharmony_ciusing EventCallback = std::function<void()>;
313f4cbf05Sopenharmony_ci
323f4cbf05Sopenharmony_cistatic constexpr int IO_EVENT_INVALID_FD = -1;
333f4cbf05Sopenharmony_ci
343f4cbf05Sopenharmony_ci
353f4cbf05Sopenharmony_cinamespace Events {
363f4cbf05Sopenharmony_ci    static constexpr EventId EVENT_NONE  = 0u;
373f4cbf05Sopenharmony_ci    static constexpr EventId EVENT_READ  = 1u;
383f4cbf05Sopenharmony_ci    static constexpr EventId EVENT_WRITE = 1u << 1;
393f4cbf05Sopenharmony_ci    static constexpr EventId EVENT_CLOSE = 1u << 2;
403f4cbf05Sopenharmony_ci    static constexpr EventId EVENT_ERROR = 1u << 3;
413f4cbf05Sopenharmony_ci    static constexpr EventId EVENT_INVALID = static_cast<uint32_t>(-1);
423f4cbf05Sopenharmony_ci}
433f4cbf05Sopenharmony_ci
443f4cbf05Sopenharmony_ci} // namespace Utils
453f4cbf05Sopenharmony_ci} // namespace OHOS
463f4cbf05Sopenharmony_ci#endif /* UTILS_IO_EVENT_COMMON_H */