Files
openflow/include/poll-loop.h
T
Ben Pfaff a9111b6015 Add the ability to connect to a vconn asynchronously.
Until now, vconn_connect() has always completed the connection
synchronously, blocking as necessary.  In the userspace
switch, we want to be able to continue forwarding packets even
if the connection to the controller drops.  Thus, this change set
that makes that possible.

The approach taken is perhaps more ambitious than needed, as it
actually adds a new high-level mechanism for polling on arbitrary
file descriptors.  This necessitates quite a bit of change to
each of the userspace programs that use vconns, but it also has
the effect of simplifying them.  The new structure of these programs
is a lot less fragile than the old one (which tended to end up
livelocking or hanging when something wasn't quite right), so it
seems like the changes are worth it.
2008-03-27 17:50:33 -07:00

39 lines
1.6 KiB
C

/* Copyright (C) 2008 Board of Trustees, Leland Stanford Jr. University.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef POLL_LOOP_H
#define POLL_LOOP_H 1
#include <poll.h>
typedef void poll_fd_func(int fd, short int revents, void *aux);
struct poll_waiter *poll_fd_callback(int fd, short int events,
poll_fd_func *, void *aux);
struct poll_waiter *poll_fd_wait(int fd, short int events, short int *revents);
void poll_cancel(struct poll_waiter *);
void poll_immediate_wake(void);
void poll_timer_wait(int msec);
void poll_block(void);
#endif /* poll-loop.h */