2 * connection_list.h - ACPI daemon connection list
4 * Copyright (C) 2008, Ted Felix (www.tedfelix.com)
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.
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.
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
23 #ifndef CONNECTION_LIST_H__
24 #define CONNECTION_LIST_H__
26 #include <sys/select.h>
28 /*****************************************************************
29 * Connection List Public Members
30 *****************************************************************/
37 /* process incoming data on the connection */
38 /* ??? suggest passing a pointer to this connection struct */
39 void (* process)(int fd);
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. */
46 /* 0 indicates this is probably not a keyboard device */
50 /* add a connection to the list */
51 extern void add_connection(struct connection *p);
53 /* delete a connection from the list */
54 extern void delete_connection(int fd);
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);
62 /* find a connection in the list by pathname */
63 /* ??? unused last I checked */
64 extern struct connection *find_connection_name(char *pathname);
66 /* get the number of connections in the list */
67 extern int get_number_of_connections();
69 /* get a specific connection by index from the list */
70 extern struct connection *get_connection(int i);
72 /* get an fd_set with all the fd's that have been added to the list */
73 extern const fd_set *get_fdset();
75 /* get the highest fd that was added to the list */
76 extern int get_highestfd();
78 #endif /* CONNECTION_LIST_H__ */