Annotation of fam/fam/ClientConnection.c++, 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: #include "ClientConnection.h"
24:
25: #include <assert.h>
26: #include <sys/un.h>
27:
28: #include "Event.h"
29:
30: ClientConnection::ClientConnection(int fd,
31: InputHandler inhandler,
32: UnblockHandler unhandler, void *closure)
33: : NetConnection(fd, unhandler, closure),
34: ihandler(inhandler), iclosure(closure)
35: { }
36:
37: bool
38: ClientConnection::input_msg(const char *msg, unsigned nbytes)
39: {
40: return (*ihandler)(msg, nbytes, iclosure);
41: }
42:
43: void
44: ClientConnection::send_event(const Event& event, Request request,
45: const char *name)
46: {
47: // Format message.
48: // Have to send fake change event here, as previous versions of
49: // fam (i.e. in IRIX 6.5.5) expect that change events will come with a
50: // list of character flags saying what changed. We'll use a 'c'
51: // character, which means that the ctime changed.
52: char code = event.code();
53: if (event == Event::Changed)
54: mprintf("%c%lu c %s\n", code, request , name);
55: else
56: mprintf("%c%lu %s\n", code, request, name);
57: }
58:
59: void
60: ClientConnection::send_sockaddr_un(const sockaddr_un &sun)
61: {
62: mprintf("%s", sun.sun_path);
63: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>