avahi 0.6.30

avahi-common/watch.h

Go to the documentation of this file.
00001 #ifndef foowatchhfoo
00002 #define foowatchhfoo
00003 
00004 /***
00005   This file is part of avahi.
00006 
00007   avahi is free software; you can redistribute it and/or modify it
00008   under the terms of the GNU Lesser General Public License as
00009   published by the Free Software Foundation; either version 2.1 of the
00010   License, or (at your option) any later version.
00011 
00012   avahi is distributed in the hope that it will be useful, but WITHOUT
00013   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00014   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
00015   Public License for more details.
00016 
00017   You should have received a copy of the GNU Lesser General Public
00018   License along with avahi; if not, write to the Free Software
00019   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00020   USA.
00021 ***/
00022 
00025 #include <sys/poll.h>
00026 #include <sys/time.h>
00027 
00028 #include <avahi-common/cdecl.h>
00029 
00030 AVAHI_C_DECL_BEGIN
00031 
00033 typedef struct AvahiWatch AvahiWatch;
00034 
00036 typedef struct AvahiTimeout AvahiTimeout;
00037 
00039 typedef struct AvahiPoll AvahiPoll;
00040 
00042 typedef enum {
00043     AVAHI_WATCH_IN = POLLIN,      
00044     AVAHI_WATCH_OUT = POLLOUT,    
00045     AVAHI_WATCH_ERR = POLLERR,    
00046     AVAHI_WATCH_HUP = POLLHUP     
00047 } AvahiWatchEvent;
00048 
00050 typedef void (*AvahiWatchCallback)(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdata);
00051 
00053 typedef void (*AvahiTimeoutCallback)(AvahiTimeout *t, void *userdata);
00054 
00060 struct AvahiPoll {
00061 
00063     void* userdata;
00064 
00068     AvahiWatch* (*watch_new)(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata);
00069 
00071     void (*watch_update)(AvahiWatch *w, AvahiWatchEvent event);
00072 
00074     AvahiWatchEvent (*watch_get_events)(AvahiWatch *w);
00075 
00077     void (*watch_free)(AvahiWatch *w);
00078 
00084     AvahiTimeout* (*timeout_new)(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata);
00085 
00088     void (*timeout_update)(AvahiTimeout *, const struct timeval *tv);
00089 
00091     void (*timeout_free)(AvahiTimeout *t);
00092 };
00093 
00094 AVAHI_C_DECL_END
00095 
00096 #endif
00097