VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlTcpSocketMgr.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992, 1997 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: vlTcpSocketMgr.h,v $ $Revision: 1.2.6.1 $ $State: Exp $
7 *********************************************************************/
8 #ifndef vlTcpSocketMgr_H_
9 #define vlTcpSocketMgr_H_
10 
14 
15 #include <vlutil/vlMachineTypes.h>
16 #include <vlutil/vlNetTypes.h>
17 #include <vlutil/vlUtil.h>
18 #include "vlTcpSocket.h"
19 
20 #ifdef DtUSE_UTILITIES_NAMESPACE
21 namespace DtUSE_UTILITIES_NAMESPACE
22 {
23 #endif
24 
25 
27 typedef void (*DtSocketAdditionCallback)(DtTcpSocket* sock, void* usr);
30 class DtTcpSocketMgr;
33 typedef DtSocket* (*DtSocketCreationCallback)(void* creator, DtTcpSocketMgr * mgr);
34 
35 
38 {
39 public:
40 
48  DtTcpSocketMgr(DtSocketCreationCallback cb, void *socketCreator, int port=DtDEFAULT_PORT);
49 
51  virtual ~DtTcpSocketMgr();
52 
55  virtual void processConnections();
56 
58  virtual int isOk() const;
59 
62  virtual int addrInUse() const;
63 
68  virtual DtIpv4Addr currentClientAddr() const;
69 
74  virtual int currentClientPort() const;
75 
80  virtual int currentSockFd() const;
81 
83  virtual const DtList* socketList();
84 
87  void removeAndDelete(DtTcpSocket* sock);
88 
92  void setNoDelay(bool onOff);
93 
96  virtual void addSocketAdditionCallback(
97  DtSocketAdditionCallback cb, void* usr);
98  virtual void removeSocketAdditionCallback(
99  DtSocketAdditionCallback cb, void* usr);
100 
103  virtual void addSocketRemovalCallback(
104  DtSocketRemovalCallback cb, void* usr);
105  virtual void removeSocketRemovalCallback(
106  DtSocketRemovalCallback cb, void* usr);
107 
111  virtual int sizeOffset();
112  virtual int sizeLength();
113  virtual void setSizeOffset(int offset);
114  virtual void setSizeLength(int length);
115 
118  virtual void setPacketBundling( unsigned int maxBundleSize );
119 
120 protected:
121 
123  virtual void emptyCallbackLists();
124 
127 
129  DtTcpSocketMgr& operator=(const DtTcpSocketMgr &);
130 
131 protected:
132 
137 
147  int myOk;
149  bool myNoDelay;
150  unsigned int myMaxBundleSize;
151 
156 
157 
161 };
162 
163 inline int DtTcpSocketMgr::isOk() const
164 {
165  return myOk;
166 }
167 
169 {
170  return mySizeLength;
171 }
172 
174 {
175  return mySizeOffset;
176 }
177 
178 #ifdef DtUSE_UTILITIES_NAMESPACE
179 }
180 #endif
181 
182 
183 #endif
void * mySocketCreator
Pointer to the object that will create the specialized socket.
Definition: vlTcpSocketMgr.h:155
DtU32 DtIpv4Addr
Definition: vlUtil.h:330
DtSocketCreationCallback mySocketCreationCb
Callback for creation of specialized sockets.
Definition: vlTcpSocketMgr.h:153
An implementation of DtSocket which uses a TCP connection.
Definition: vlTcpSocket.h:47
DtSocket provides a low level interface for packet I/O with VR-Link applications. ...
Definition: vlSocket.h:110
DtSocketAdditionCallback DtSocketRemovalCallback
Definition: vlTcpSocketMgr.h:29
int serverSockfd
Definition: vlTcpSocketMgr.h:133
virtual int sizeOffset()
Sets offset and length so that it can create sockets whose lengthOffset and lengthSize are different ...
Definition: vlTcpSocketMgr.h:173
DtIpv4Addr myServAddr
Unused.
Definition: vlTcpSocketMgr.h:141
bool myNoDelay
Definition: vlTcpSocketMgr.h:149
virtual int isOk() const
Returns 1 if the object is OK to use, 0 otherwise.
Definition: vlTcpSocketMgr.h:163
DtSocket *(* DtSocketCreationCallback)(void *creator, DtTcpSocketMgr *mgr)
Specialized socket creation callback signature.
Definition: vlTcpSocketMgr.h:33
unsigned int myMaxBundleSize
Definition: vlTcpSocketMgr.h:150
#define DtDEFAULT_PORT
Definition: vlSocket.h:49
int myCurrentSockFd
Socket descriptor associated with most recently accessed connection.
Definition: vlTcpSocketMgr.h:139
DtList * mySockList
Pointer to list of all open TCP sockets.
Definition: vlTcpSocketMgr.h:146
DtList is deprecated, please use std::list&lt;T&gt;.
Definition: vlList.h:71
int mySizeOffset
Definition: vlTcpSocketMgr.h:134
int myOk
Definition: vlTcpSocketMgr.h:147
int mySizeLength
Definition: vlTcpSocketMgr.h:135
int myAddrInUse
Definition: vlTcpSocketMgr.h:148
virtual int sizeLength()
Definition: vlTcpSocketMgr.h:168
DtList myRemovalCallbacks
Definition: vlTcpSocketMgr.h:160
DtList myAdditionCallbacks
Lists of pointers to DtSocketCbInfos.
Definition: vlTcpSocketMgr.h:159
int myCliPort
Peer TCP port of most recent client to connect.
Definition: vlTcpSocketMgr.h:144
void(* DtSocketAdditionCallback)(DtTcpSocket *sock, void *usr)
Definition: vlTcpSocketMgr.h:27
#define DT_DLL_NETCOMPAT
Definition: vlMachineTypes.h:111
provides basic Operating Independent Methods useful to a federate
This file contains the declaration of DtTcpSocket.
This file contains typedefs for machine dependant types.
Definition: vlTcpSocketMgr.h:37
DtIpv4Addr myCliAddr
Definition: vlTcpSocketMgr.h:142

Document ID: Generated on Wed Mar 27 02:04:30 EDT 2024 from SVN revision 264570
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)