wvdbusserver: implement NameHasOwner request.
[wvstreams.git] / include / wvunixlistener.h
blob7545dc075f9c03e80860e073f555a68f87753943
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 */
6 #ifndef __WVUNIXLISTENER_H
7 #define __WVUNIXLISTENER_H
9 #include "wvlistener.h"
10 #include "wvaddr.h"
12 #ifndef _WIN32
14 /** Server end of a Unix Sockets stream */
15 class WvUnixListener : public WvListener
17 public:
18 WvUnixListener(const WvUnixAddr &_addr, int create_mode);
19 virtual ~WvUnixListener();
20 virtual void close();
22 /**
23 * return a new WvUnixConn socket corresponding to a newly-accepted
24 * connection. If no connection is ready immediately, we wait for
25 * one indefinitely. You can use select(read=true) to check for a
26 * waiting connection.
28 IWvStream *accept();
30 /**
31 * Tell this listener to automatically accept new
32 * connections, assigning them their own callback function 'cb'
33 * Pass list==NULL or run setcallback() to disable auto-accepting.
35 * Be careful not to accept() connections yourself if you do this,
36 * or we may end up accept()ing twice, causing a hang the second time.
38 void auto_accept(WvIStreamList *list, wv::function<void(IWvStream*)> cb);
40 /**
41 * Like auto_accept() above, but always uses the globallist instead
42 * of a user-defined list.
44 void auto_accept(wv::function<void(IWvStream*)> cb);
46 /** src() is a bit of a misnomer, but it returns the socket address. */
47 virtual const WvUnixAddr *src() const;
49 protected:
50 WvUnixAddr addr;
51 bool bound_okay;
53 void accept_callback(WvIStreamList *list,
54 wv::function<void(IWvStream*)> cb,
55 IWvStream *_connection);
57 public:
58 const char *wstype() const { return "WvUnixListener"; }
61 #endif // _WIN32
63 #endif // __WVUNIXLISTENER_H