VR-Link API Documentation for HLA 1516
 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_ */
#define DtCsFlagsDefault
Definition: vlClientSocket.h:43
DtNetSocket * netSock
Definition: vlClientSocket.h:122
#define DtCsClientPathSize
Definition: vlCliServer.h:31
DtU32 DtIpv4Addr
Definition: vlUtil.h:245
DtSocket provides a low level interface for packet I/O with VR-Link applications. ...
Definition: vlSocket.h:110
bool myOkFlag
Definition: vlClientSocket.h:125
virtual bool isOk() const
Definition: vlClientSocket.h:156
char * shmAddr
Definition: vlClientSocket.h:150
DtIpv4Addr sourceAddr
Definition: vlClientSocket.h:147
DtIpv4Addr destAddr
Definition: vlClientSocket.h:143
DtTestOperator
Definition: vlSocket.h:65
int sendFd
Definition: vlClientSocket.h:127
ClientSocket uses the vrlink packet server to read and write packets The destination address (incl...
Definition: vlClientSocket.h:54
int readFd()
Get the file descriptor for reading and writing to this socket.
Definition: vlClientSocket.h:82
Network-order 64-bit IEEE-754 floating-point quantity.
Definition: vlNetTypes.h:173
Definition: vlSocket.h:79
DtNetFloat64 * pktBuff8
Definition: vlClientSocket.h:148
unsigned char DtU8
An eight bit unsigned integer value.
Definition: vlMachineTypes.h:137
DtTime psMsgTimeout
Definition: vlClientSocket.h:107
This file contains definitions common to the Shared Memory Packet Server and its clients.
Definition: vlShmReader.h:43
This file declares DtSocket as well as several useful constents and helper classes.
DtFilterType
Definition: vlSocket.h:68
#define DtCsQDefaultSize
Definition: vlClientSocket.h:44
int writeFd()
Definition: vlClientSocket.h:83
#define DT_DLL_NETCOMPAT
Definition: vlMachineTypes.h:111
int serverPort
Definition: vlClientSocket.h:145
This file declares DtNetSocket, as well as several enumerations and constants needed for its use...
unsigned long DtU32
A 32 bit unsigned integer value.
Definition: vlMachineTypes.h:153
DtIpv4Addr lastSourceInetAddr()
int isUnbundling(); Is not currently implemented.
Definition: vlClientSocket.h:79
int recvFd
Definition: vlClientSocket.h:126
Definition: vlCliServer.h:303
bool notifyPending
Definition: vlClientSocket.h:123
int setMcastTtl(int ttl)
Definition: vlClientSocket.h:73
long clientId
Definition: vlClientSocket.h:128
A DtSocket that implements network sending and receiving function using IP/UDP broadcast, multicast or unicast.
Definition: vlNetSocket.h:72

Document ID: Generated on Mon Apr 25 03:39:01 EDT 2022 from SVN revision 242502
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)