VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlClientSocket.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1993, 1994, 1995, 1997 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: vlClientSocket.h,v $ $Revision: 1.2.6.1 $ $State: Exp $
7 *********************************************************************/
8 #ifndef vlClientSocket_H_
9 #define vlClientSocket_H_
10 
14 
15 #include <vlutil/vlNetTypes.h>
16 #include "vlSocket.h"
17 #include "vlNetSocket.h"
18 #include <vlutil/vlCliServer.h>
19 
20 #ifdef DtUSE_UTILITIES_NAMESPACE
21 namespace DtUSE_UTILITIES_NAMESPACE
22 {
23 #endif
24 
25 #if DT_HAVE_DAEMON
26 class DT_DLL_NETCOMPAT DtCsFilterTest : public DtFilterTest
27 {
28  public:
29  DtCsFilterTest(int fd, DtU8 filterType, DtU32 clientId);
30  virtual ~DtCsFilterTest();
31 
32  void setOperator(DtTestOperator op);
33  void extendTest(int n, DtU32 *values);
34  void reduceTest(int n, DtU32 *vals);
36  bool evalTest(char *, int , DtFilterType){return true;}
37 
38  private:
39  DtCsFilterMsg filterMsg;
40 };
41 #endif
42 
43 #define DtCsFlagsDefault (DtCsFlagsReadWrite | DtCsFlagsServerChooseDropMode )
44 #define DtCsQDefaultSize DtCsUseDefaultSize
45 
55 {
56  public:
57 
58  DtClientSocket(int port, int recvQSize =
59  DtCsQDefaultSize, unsigned short csFlags = DtCsFlagsDefault);
60 
61  DtClientSocket(int port, DtIpv4Addr destAddr, int recvQSize =
62  DtCsQDefaultSize, unsigned short csFlags = DtCsFlagsDefault);
63 
64  ~DtClientSocket();
65 
66  int sendTo(caddr_t packet, size_t size, DtIpv4Addr addr);
67 
68  int DtRecv(caddr_t, size_t);
69  int DtRecv(caddr_t *buffptr, int *status=NULL);
70 
71  int listenToMulticastGroup(DtIpv4Addr multicastAddr);
72  int dropMulticastGroup(DtIpv4Addr multicastAddr);
73  int setMcastTtl(int ttl) { return netSock->setMcastTtl(ttl); }
74 
75  void setUnbundling(int onOff);
78 
79  DtIpv4Addr lastSourceInetAddr() { return sourceAddr; }
80  void DtBecomeNonBlocking(void);
81 
82  int readFd() { return recvFd; }
83  int writeFd() { return sendFd; }
84  virtual bool isOk() const;
85  bool isInternal();
86 
87  void setPsMsgTimeout(int seconds);
88 
89  void notifyMe();
90  void disconnectFromServer();
91  void setPacketServerInternal();
92  void setPacketServerExternal();
93  void pingClients();
94  void testClients();
95  void terminatePacketServer();
96  void requestServerState();
97  void requestServerCStates();
98  void setPacketServerUnbundling(int onOff);
99 
100 #if DT_HAVE_DAEMON
101  DtFilterTest *exerciseId() { return exercise; }
102  DtFilterTest *protocolVersion() { return version; }
103  DtFilterTest *pduKind() { return kind; }
104  DtFilterTest *ipAddr() { return addr; }
105 #endif
106 
108 
109  protected:
110 
111  void init(int port, DtIpv4Addr destAddr, int recvQSize,
112  unsigned short csFlags);
113 
114  int timedRecv(caddr_t buf, size_t size, char *psKind);
115  void drainNotifySocket();
116  void checkGoAway();
117 
118 #if DT_HAVE_DAEMON
119  DtShmMsgQueueReader *reader;
120 #endif
121 
124 
125  bool myOkFlag;
126  int recvFd;
127  int sendFd;
128  long clientId;
129 
130  private:
131 
132  void processControlMsg(DtCsMsg *msg);
133  DtCsMsg *getPsMsg (DtCsMsg *buf, char desiredKind);
134  void cleanup(void);
135 
136 #if DT_HAVE_DAEMON
137  DtCsFilterTest *exercise;
138  DtCsFilterTest *version;
139  DtCsFilterTest *kind;
140  DtCsFilterTest *addr;
141 #endif
142 
144  char clientSocketPath[DtCsClientPathSize];
146  bool internal;
149 
150  char *shmAddr;
151 #if DT_HAVE_DAEMON
152  DtCsControlReqMsg *controlMsg;
153 #endif
154 };
155 
156 inline bool DtClientSocket::isOk() const
157 {
158  return myOkFlag;
159 }
160 
161 #ifdef DtUSE_UTILITIES_NAMESPACE
162 }
163 #endif
164 
165 #endif /* _CLIENTSOCKET_H_ */

Document ID: Generated on Wed Jan 7 13:31:29 EST 2015 from SVN revision 149162
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)