fix systemd unit install path
[external/acpid.git] / connection_list.h
1 /*
2  *  connection_list.h - ACPI daemon connection list
3  *
4  *  Copyright (C) 2008, Ted Felix (www.tedfelix.com)
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 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 General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  Tabs at 4
21  */
22
23 #ifndef CONNECTION_LIST_H__
24 #define CONNECTION_LIST_H__
25
26 #include <sys/select.h>
27
28 /*****************************************************************
29  *  Connection List Public Members
30  *****************************************************************/
31
32 struct connection
33 {
34         /* file descriptor */
35         int fd;
36
37         /* process incoming data on the connection */
38         /* ??? suggest passing a pointer to this connection struct */
39         void (* process)(int fd);
40
41         /* Optional.  Used by find_connection_name() to find the connection for a 
42            specific file.  Set to NULL if not specified.  Memory will be freed 
43            with free() when connection is deleted. */
44         char *pathname;
45
46         /* 0 indicates this is probably not a keyboard device */
47         int kybd;
48 };
49
50 /* add a connection to the list */
51 extern void add_connection(struct connection *p);
52
53 /* delete a connection from the list */
54 extern void delete_connection(int fd);
55
56 /* find a connection in the list by file descriptor */
57 /* ??? This routine is unnecessary.  When we call the connection's process
58  *     routine, we should pass a pointer to the connection.  That will have
59  *     the usual fd along with everything else. */
60 extern struct connection *find_connection(int fd);
61
62 /* find a connection in the list by pathname */
63 /* ??? unused last I checked */
64 extern struct connection *find_connection_name(char *pathname);
65
66 /* get the number of connections in the list */
67 extern int get_number_of_connections();
68
69 /* get a specific connection by index from the list */
70 extern struct connection *get_connection(int i);
71
72 /* get an fd_set with all the fd's that have been added to the list */
73 extern const fd_set *get_fdset();
74
75 /* get the highest fd that was added to the list */
76 extern int get_highestfd();
77
78 #endif /* CONNECTION_LIST_H__ */