myMPD
Internal API documentation
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-3.0-or-later
3 myMPD (c) 2018-2025 Juergen Mang <mail@jcgames.de>
4 https://github.com/jcorporation/mympd
5*/
6
11#ifndef MYMPD_EVENT_H
12#define MYMPD_EVENT_H
13
14#include "compile_time.h"
15#include <poll.h>
16#include <stdbool.h>
17
22 /* MPD connection for partitions */
23 PFD_TYPE_PARTITION = 0x1,
24 /* MPD connection for stickerdb */
25 PFD_TYPE_STICKERDB = 0x2,
26 /* myMPD timers */
27 PFD_TYPE_TIMER = 0x4,
28 /* Message queue */
29 PFD_TYPE_QUEUE = 0x8,
30 /* Timer for mpd connect and reconnect */
31 PFD_TYPE_TIMER_MPD_CONNECT = 0x10,
32 /* Scrobble timer */
33 PFD_TYPE_TIMER_SCROBBLE = 0x20,
34 /* Jukebox timer */
35 PFD_TYPE_TIMER_JUKEBOX = 0x40
36};
37
41struct mympd_pfds {
42 struct pollfd fds[POLL_FDS_MAX];
43 enum pfd_type fd_types[POLL_FDS_MAX];
44 nfds_t len;
45 struct t_partition_state *partition_states[POLL_FDS_MAX];
46};
47
48void event_pfd_init(struct mympd_pfds *pfds);
49bool event_pfd_add_fd(struct mympd_pfds *pfds, int fd, enum pfd_type type, struct t_partition_state *partition_state);
50int event_eventfd_create(void);
51bool event_eventfd_read(int fd);
52bool event_eventfd_write(int fd);
53void event_fd_close(int fd);
54const char *lookup_pfd_type(enum pfd_type type);
55const char *lookup_pfd_revents(short revent);
56
57#endif
bool event_eventfd_read(int fd)
Definition event.c:87
const char * lookup_pfd_revents(short revent)
Definition event.c:131
void event_fd_close(int fd)
Definition event.c:102
int event_eventfd_create(void)
Definition event.c:57
bool event_eventfd_write(int fd)
Definition event.c:72
pfd_type
Definition event.h:21
const char * lookup_pfd_type(enum pfd_type type)
Definition event.c:113
void event_pfd_init(struct mympd_pfds *pfds)
Definition event.c:25
bool event_pfd_add_fd(struct mympd_pfds *pfds, int fd, enum pfd_type type, struct t_partition_state *partition_state)
Definition event.c:37
Definition event.h:41
struct t_partition_state * partition_states[POLL_FDS_MAX]
pointer to partition_state
Definition event.h:45
enum pfd_type fd_types[POLL_FDS_MAX]
fd types
Definition event.h:43
struct pollfd fds[POLL_FDS_MAX]
fds
Definition event.h:42
nfds_t len
number of mpd connection fds
Definition event.h:44
Definition mympd_state.h:114