Annotation of fam/fam/Listener.h, Revision 1.1.1.1
1.1 trev 1: // Copyright (C) 1999 Silicon Graphics, Inc. All Rights Reserved.
2: //
3: // This program is free software; you can redistribute it and/or modify it
4: // under the terms of version 2 of the GNU General Public License as
5: // published by the Free Software Foundation.
6: //
7: // This program is distributed in the hope that it would be useful, but
8: // WITHOUT ANY WARRANTY; without even the implied warranty of
9: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any
10: // license provided herein, whether implied or otherwise, is limited to
11: // this program in accordance with the express provisions of the GNU
12: // General Public License. Patent licenses, if any, provided herein do not
13: // apply to combinations of this program with other product or programs, or
14: // any other product whatsoever. This program is distributed without any
15: // warranty that the program is delivered free of the rightful claim of any
16: // third person by way of infringement or the like. See the GNU General
17: // Public License for more details.
18: //
19: // You should have received a copy of the GNU General Public License along
20: // with this program; if not, write the Free Software Foundation, Inc., 59
21: // Temple Place - Suite 330, Boston MA 02111-1307, USA.
22:
23: #ifndef Listener_included
24: #define Listener_included
25:
26: #include <sys/types.h>
27:
28: #include "Boolean.h"
29:
30: // Listener is an object that listens for connections on a socket.
31: // It registers itself with portmapper.
32: //
33: // If a Listener was started_by_inetd, then it listens on the
34: // already-open file descriptor 0. Otherwise, it opens a new socket.
35: //
36: // A Listener creates TCP_Client and RemoteClient objects as
37: // connections come in.
38: //
39: // FAMPROG and FAMVERS, the SUN RPC program number and version, are
40: // defined here, because I didn't think of a better place to define them.
41:
42: class TCP_Client;
43:
44: class Listener {
45:
46: public:
47:
48: enum { RENDEZVOUS_FD = 0 }; // descriptor 0 opened by inetd
49: enum { FAMPROG = 391002, FAMVERS = 2 };
50:
51:
52: Listener(bool started_by_inetd,
53: bool local_only,
54: unsigned long program = FAMPROG, unsigned long version = FAMVERS);
55: ~Listener();
56:
57: static void create_local_client(TCP_Client &inet_client, uid_t uid);
58:
59: private:
60:
61: // Instance Variables
62:
63: unsigned long program;
64: unsigned long version;
65: int rendezvous_fd;
66: bool started_by_inetd;
67: int _ugly_sock;
68: bool local_only;
69:
70: // Private Instance Methods
71:
72: void dirty_ugly_hack();
73: void set_rendezvous_fd(int);
74:
75: // Class Methods
76:
77: static void accept_client(int fd, void *closure);
78: static void accept_ugly_hack(int fd, void *closure);
79: static void read_ugly_hack(int fd, void *closure);
80: static void accept_localclient(int fd, void *closure);
81: };
82:
83: #endif /* !Listener_included */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>