[4] | 1 | /****************************************************************************** |
---|
| 2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
| 3 | * |
---|
| 4 | * Module: fsServer.h |
---|
| 5 | * Author : Byungil Jeong |
---|
| 6 | * |
---|
| 7 | * Copyright (C) 2004 Electronic Visualization Laboratory, |
---|
| 8 | * University of Illinois at Chicago |
---|
| 9 | * |
---|
| 10 | * All rights reserved. |
---|
| 11 | * |
---|
| 12 | * Redistribution and use in source and binary forms, with or without |
---|
| 13 | * modification, are permitted provided that the following conditions are met: |
---|
| 14 | * |
---|
| 15 | * * Redistributions of source code must retain the above copyright |
---|
| 16 | * notice, this list of conditions and the following disclaimer. |
---|
| 17 | * * Redistributions in binary form must reproduce the above |
---|
| 18 | * copyright notice, this list of conditions and the following disclaimer |
---|
| 19 | * in the documentation and/or other materials provided with the distribution. |
---|
| 20 | * * Neither the name of the University of Illinois at Chicago nor |
---|
| 21 | * the names of its contributors may be used to endorse or promote |
---|
| 22 | * products derived from this software without specific prior written permission. |
---|
| 23 | * |
---|
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
| 28 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
| 29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
| 31 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
| 32 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
| 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
| 34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 35 | * |
---|
| 36 | * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or |
---|
| 37 | * http://www.evl.uic.edu/cavern/forum/ |
---|
| 38 | * |
---|
| 39 | *****************************************************************************/ |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | #ifndef _FS_SERVER_H |
---|
| 43 | #define _FS_SERVER_H |
---|
| 44 | |
---|
| 45 | #include "sage.h" |
---|
| 46 | #include "QUANTAnet_tcp_c.hxx" |
---|
| 47 | |
---|
| 48 | #define SOCK_BUF_SIZE (1024*1024*32) |
---|
| 49 | #define READ_BUF_SIZE 4096 |
---|
| 50 | #define SYSTEM_CLIENT_BASE 1000 |
---|
| 51 | |
---|
| 52 | class fsManager; |
---|
| 53 | |
---|
| 54 | /** |
---|
| 55 | * read messages from UI and APPs |
---|
| 56 | * pass them to appropriate component |
---|
| 57 | */ |
---|
| 58 | class fsServer { |
---|
| 59 | private: |
---|
| 60 | QUANTAnet_tcpServer_c *sysServer; |
---|
| 61 | QUANTAnet_tcpServer_c *uiServer; |
---|
| 62 | |
---|
| 63 | fsManager *fsm; |
---|
| 64 | std::vector<QUANTAnet_tcpClient_c *> uiClientList; |
---|
| 65 | std::vector<QUANTAnet_tcpClient_c *> sysClientList; |
---|
| 66 | int numSysClients, numUiClients; |
---|
| 67 | |
---|
| 68 | public: |
---|
| 69 | fsServer(); |
---|
| 70 | ~fsServer(); |
---|
| 71 | |
---|
| 72 | //unsigned int maxNumOfApp; |
---|
| 73 | |
---|
| 74 | int init(fsManager *fsm); |
---|
| 75 | static void* trackingThread(void *args); |
---|
| 76 | int checkTrackingMsg(); |
---|
| 77 | int checkClients(); |
---|
| 78 | int sendMessage(int cId, int code, int data); |
---|
| 79 | int sendMessage(int cId, int code, char* data); |
---|
| 80 | int sendMessage(int cId, int code); |
---|
| 81 | int sendMessage(sageMessage &msg); |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | #endif |
---|