diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-10-01 20:02:50 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-10-01 20:02:50 -0700 |
commit | 746f5b78efffb05953809ee8d3b973bd4d486282 (patch) | |
tree | d1a5d18fa18db3a1a218ea52739fcf16a2d49dec /pcap-dbus.c | |
parent | 7d8edf622162290f7212a8564bfc7b161dad3afb (diff) |
Explain why you can't do select/poll/epoll/kqueue stuff etc. for D-Bus.
That'd require a new API and the ability to have multiple selectable FDs
for a single pcap_t *and* for the set of FDs to be able to change over
time.
Diffstat (limited to 'pcap-dbus.c')
-rw-r--r-- | pcap-dbus.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pcap-dbus.c b/pcap-dbus.c index 1e00388f..efb0a851 100644 --- a/pcap-dbus.c +++ b/pcap-dbus.c @@ -216,6 +216,28 @@ dbus_activate(pcap_t *handle) handle->cleanup_op = dbus_cleanup; #ifndef _WIN32 + /* + * Unfortunately, trying to do a select()/poll()/epoll()/ + * kqueue watch/etc. on a D-Bus connection isn't a simple + * case of "give me an FD on which to wait". + * + * Apparently, you have to register "add watch", "remove watch", + * and "toggle watch" functions with + * dbus_connection_set_watch_functions(), + * keep a *set* of FDs, add to that set in the "add watch" + * function, subtract from it in the "remove watch" function, + * and either add to or subtract from that set in the "toggle + * watch" function, and do the wait on *all* of the FDs in the + * set. (Yes, you need the "toggle watch" function, so that + * the main loop doesn't itself need to check for whether + * a given watch is enabled or disabled - most libpcap programs + * know nothing about D-Bus and shouldn't *have* to know anything + * about D-Bus other than how to decode D-Bus messages.) + * + * Implementing that would require considerable changes in + * the way libpcap exports "selectable FDs" to its client. + * Until that's done, we just say "you can't do that". + */ handle->selectable_fd = handle->fd = -1; #endif |