Annotation of fam/libfam/Client.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.1 of the GNU Lesser General Public License
5: // as 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 Lesser
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 Lesser
17: // General 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 _client_
24: #define _client_
25: #include <sys/types.h>
26: #include "config.h"
27: #include "BTree.h"
28:
29: #define MSGBUFSIZ 3000
30: #define MAXMSGSIZ 300
31:
32: struct FAMEvent;
33:
34: class Client {
35: public:
36: Client(long hostaddr, unsigned int prog, int vers);
37: ~Client();
38: int writeToServer(char *msg, int nbytes);
39: int getSock() { return sock; }
40: bool connected() { return sock >= 0; }
41: int eventPending();
42: int nextEvent(FAMEvent *fe);
43:
44: void storeUserData(int reqnum, void *p);
45: void *getUserData(int reqnum);
46: void storeEndExist(int reqnum);
47: bool getEndExist(int reqnum);
48: void freeRequest(int reqnum);
49:
50: private:
51: int readEvent(bool block);
52: void checkBufferForEvent();
53: void croakConnection(const char *reason);
54:
55: int sock;
56: bool haveCompleteEvent;
57: BTree<int, void *> *userData;
58: BTree<int, bool> *endExist;
59: char *inend,inbuf[MSGBUFSIZ];
60: };
61: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>