#include <OSGPointMCastConnection.h>

private helpers | |
| bool | recvNextDgram (Dgram *dgram) |
| void | combineAck (Dgram *dgram, SocketAddress from) |
| bool | recvQueue (void) |
| void | initialize (void) |
| static void | recvQueueThread (void *arg) |
Public Types | |
public types | |
| typedef Int32 | Channel |
Public Member Functions | |
Constructors | |
| PointMCastConnection (void) | |
| virtual | ~PointMCastConnection (void) |
type info | |
| virtual const ConnectionType * | getType (void) |
connection | |
| virtual Channel | connectGroup (const std::string &address, Time timeout=-1) |
| virtual void | disconnect (void) |
| virtual Channel | acceptGroup (Time timeout=-1) |
synchronisation | |
| virtual bool | wait (Time timeout) throw (ReadError) |
channel handling | |
| virtual Channel | selectChannel (Time timeout=-1) throw (ReadError) |
connection | |
| virtual Channel | connectPoint (const std::string &address, Time timeout=-1) |
| virtual Channel | acceptPoint (Time timeout=-1) |
| virtual std::string | bind (const std::string &interf) |
synchronisation | |
| virtual void | signal (void) throw (WriteError) |
params | |
| virtual void | setParams (const std::string ¶ms) |
interface | |
| const std::string & | getInterface (void) |
| void | setInterface (const std::string &interf) |
Put | |
| void | put (void const *src, UInt32 size) |
| void | putAndFree (MemoryHandle src, UInt32 size) |
| void | putValue (const bool &value) |
| void | putValue (const UInt8 &value) |
| void | putValue (const UInt16 &value) |
| void | putValue (const UInt32 &value) |
| void | putValue (const UInt64 &value) |
| void | putValue (const Int8 &value) |
| void | putValue (const Int16 &value) |
| void | putValue (const Int32 &value) |
| void | putValue (const Int64 &value) |
| void | putValue (const Real16 &value) |
| void | putValue (const Real32 &value) |
| void | putValue (const Real64 &value) |
| void | putValue (const Real128 &value) |
| void | putValue (const std::string &value) |
| void | putValues (const bool *value, UInt32 size) |
| void | putValues (const UInt8 *value, UInt32 size) |
| void | putValues (const UInt16 *value, UInt32 size) |
| void | putValues (const UInt32 *value, UInt32 size) |
| void | putValues (const UInt64 *value, UInt32 size) |
| void | putValues (const Int8 *value, UInt32 size) |
| void | putValues (const Int16 *value, UInt32 size) |
| void | putValues (const Int32 *value, UInt32 size) |
| void | putValues (const Int64 *value, UInt32 size) |
| void | putValues (const Real16 *value, UInt32 size) |
| void | putValues (const Real32 *value, UInt32 size) |
| void | putValues (const Real64 *value, UInt32 size) |
| void | putValues (const Real128 *value, UInt32 size) |
| void | putValues (const std::string *value, UInt32 size) |
Get | |
| void | get (void *dst, UInt32 size) |
| void | getAndAlloc (MemoryHandle &src, UInt32 size) |
| void | getValue (bool &value) |
| void | getValue (UInt8 &value) |
| void | getValue (UInt16 &value) |
| void | getValue (UInt32 &value) |
| void | getValue (UInt64 &value) |
| void | getValue (Int8 &value) |
| void | getValue (Int16 &value) |
| void | getValue (Int32 &value) |
| void | getValue (Int64 &value) |
| void | getValue (Real16 &value) |
| void | getValue (Real32 &value) |
| void | getValue (Real64 &value) |
| void | getValue (Real128 &value) |
| void | getValue (std::string &value) |
| void | getValues (bool *value, UInt32 size) |
| void | getValues (UInt8 *value, UInt32 size) |
| void | getValues (UInt16 *value, UInt32 size) |
| void | getValues (UInt32 *value, UInt32 size) |
| void | getValues (UInt64 *value, UInt32 size) |
| void | getValues (Int8 *value, UInt32 size) |
| void | getValues (Int16 *value, UInt32 size) |
| void | getValues (Int32 *value, UInt32 size) |
| void | getValues (Int64 *value, UInt32 size) |
| void | getValues (Real16 *value, UInt32 size) |
| void | getValues (Real32 *value, UInt32 size) |
| void | getValues (Real64 *value, UInt32 size) |
| void | getValues (Real128 *value, UInt32 size) |
| void | getValues (std::string *value, UInt32 size) |
Helper | |
| virtual void | forceCopy (void) |
| virtual void | forceDirectIO (void) |
| void | flush (void) |
| write data not yet written | |
| void | setNetworkOrder (bool value) |
| bool | getNetworkOrder (void) |
Static Public Member Functions | |
create | |
| static PointConnection * | create (void) |
| create conneciton | |
Protected Types | |
| typedef std::vector< MemoryBlock > | BuffersT |
| typedef std::list< MemoryHandle > | FreeMemT |
Protected Member Functions | |
IO Implementation | |
| virtual void | read (MemoryHandle mem, UInt32 size) |
| virtual void | readBuffer (void) |
IO Implementation | |
| virtual void | write (MemoryHandle mem, UInt32 size) |
| virtual void | writeBuffer (void) |
Read | |
| BuffersT::iterator | readBufBegin (void) |
| BuffersT::iterator | readBufEnd (void) |
| void | readBufAdd (MemoryHandle mem, UInt32 size, UInt32 dataSize=0) |
| void | readBufClear (void) |
Write | |
| BuffersT::iterator | writeBufBegin (void) |
| BuffersT::iterator | writeBufEnd (void) |
| void | writeBufAdd (MemoryHandle mem, UInt32 size, UInt32 dataSize=0) |
| void | writeBufClear (void) |
Helper | |
| bool | isReadBufferEmpty (void) |
Protected Attributes | |
members | |
| DgramSocket | _mcastSocket |
| DgramSocket | _responseSocket |
| BaseThread * | _recvQueueThread |
| bool | _recvQueueThreadRunning |
| bool | _recvQueueThreadStop |
| UInt16 | _seqNumber |
| SocketAddress | _mcastAddress |
| DgramQueue | _queue |
| DgramQueue | _free |
| Lock * | _lock |
| SocketAddress | _sender |
| SocketAddress | _ackDestination |
| Dgram * | _lastDgram |
| UInt32 | _lastDgramPos |
| bool | _initialized |
| std::map< SocketAddress, UInt16 > | _combineAck |
| UInt16 | _maxAck |
members | |
| StreamSocket | _acceptSocket |
| StreamSocket | _socket |
| SocketAddress | _remoteAddress |
| std::vector< UInt8 > | _socketReadBuffer |
| std::vector< UInt8 > | _socketWriteBuffer |
members | |
| bool | _pointToPoint |
protected members | |
| std::string | _interface |
Member | |
| BuffersT | _readBuffers |
| BuffersT | _writeBuffers |
| BuffersT | _zeroCopyBuffers |
| UInt32 | _zeroCopyThreshold |
| FreeMemT | _freeMem |
| BuffersT::iterator | _currentReadBuffer |
| UInt32 | _currentReadBufferPos |
| BuffersT::iterator | _currentWriteBuffer |
| UInt32 | _currentWriteBufferPos |
| bool | _networkOrder |
Private Types | |
| typedef PointSockConnection | Inherited |
Private Member Functions | |
| PointMCastConnection (const PointMCastConnection &source) | |
| PointMCastConnection & | operator= (const PointMCastConnection &source) |
Static Private Attributes | |
static type | |
| static ConnectionType | _type |
Classes | |
| struct | SocketBufferHeader |
Definition at line 62 of file OSGPointMCastConnection.h.
typedef PointSockConnection osg::PointMCastConnection::Inherited [private] |
Reimplemented from osg::PointSockConnection.
Definition at line 180 of file OSGPointMCastConnection.h.
typedef Int32 osg::Connection::Channel [inherited] |
Definition at line 69 of file OSGConnection.h.
typedef std::vector<MemoryBlock> osg::BinaryDataHandler::BuffersT [protected, inherited] |
Definition at line 213 of file OSGBinaryDataHandler.h.
typedef std::list<MemoryHandle> osg::BinaryDataHandler::FreeMemT [protected, inherited] |
Definition at line 214 of file OSGBinaryDataHandler.h.
| PointMCastConnection::PointMCastConnection | ( | void | ) |
Constructor
Definition at line 67 of file OSGPointMCastConnection.cpp.
References osg::PointSockConnection::_acceptSocket, _free, _lock, osg::Lock::get(), osg::StreamSocket::open(), OSG_DGRAM_QUEUE_LEN, osg::DgramQueue::put(), and osg::Socket::setReusePort().
Referenced by create().
00067 : 00068 Inherited(), 00069 _lastDgram(NULL), 00070 _initialized(false) 00071 { 00072 char lockName[256]; 00073 sprintf(lockName,"PointMCastConnection%p",this); 00074 00075 // create locks 00076 _lock = Lock::get(lockName); 00077 00078 // fill dgramqueue 00079 for(UInt32 dI = 0 ; dI < OSG_DGRAM_QUEUE_LEN ; ++dI) 00080 _free.put(new Dgram()); 00081 00082 _acceptSocket.open(); 00083 _acceptSocket.setReusePort(true); 00084 00085 /* 00086 _socketWriteBuffer.resize(131071); 00087 // reserve first bytes for buffer size 00088 writeBufAdd(&_socketWriteBuffer[sizeof(SocketBufferHeader)], 00089 _socketWriteBuffer.size()-sizeof(SocketBufferHeader)); 00090 */ 00091 }
| PointMCastConnection::~PointMCastConnection | ( | void | ) | [virtual] |
Destructor
Definition at line 95 of file OSGPointMCastConnection.cpp.
References osg::PointSockConnection::_acceptSocket, _free, _lock, _mcastSocket, _queue, _recvQueueThread, _recvQueueThreadStop, osg::Lock::aquire(), osg::StreamSocket::close(), osg::DgramSocket::close(), osg::DgramQueue::empty(), osg::DgramQueue::get(), osg::BaseThread::join(), and osg::Lock::release().
00096 { 00097 // indicate thread stop 00098 _recvQueueThreadStop = true; 00099 // wait for stop 00100 BaseThread::join(_recvQueueThread); 00101 // close socket 00102 _mcastSocket.close(); 00103 // free queues 00104 _lock->aquire(); 00105 while(!_free.empty()) 00106 delete _free.get(_lock); 00107 while(!_queue.empty()) 00108 delete _queue.get(_lock); 00109 _lock->release(); 00110 // close socket 00111 _acceptSocket.close(); 00112 }
| osg::PointMCastConnection::PointMCastConnection | ( | const PointMCastConnection & | source | ) | [private] |
| const ConnectionType * PointMCastConnection::getType | ( | void | ) | [virtual] |
get connection type
Reimplemented from osg::PointSockConnection.
Definition at line 116 of file OSGPointMCastConnection.cpp.
References _type.
00117 { 00118 return &_type; 00119 }
| Connection::Channel PointMCastConnection::connectGroup | ( | const std::string & | address, | |
| Time | timeout = -1 | |||
| ) | [virtual] |
connect to the given group. If timeout is reached, -1 is returned
Reimplemented from osg::PointSockConnection.
Definition at line 127 of file OSGPointMCastConnection.cpp.
References osg::PointSockConnection::connectGroup().
00130 { 00131 Channel channel = Inherited::connectGroup(address,timeout); 00132 return channel; 00133 }
| void PointMCastConnection::disconnect | ( | void | ) | [virtual] |
disconnect the given channel
Reimplemented from osg::PointSockConnection.
Definition at line 137 of file OSGPointMCastConnection.cpp.
References osg::PointSockConnection::_socket, and osg::StreamSocket::close().
| Connection::Channel PointMCastConnection::acceptGroup | ( | Time | timeout = -1 |
) | [virtual] |
accept an icomming grop connection. If timeout is reached, -1 is returned. If timeout is -1 then wait without timeout
Reimplemented from osg::PointSockConnection.
Definition at line 145 of file OSGPointMCastConnection.cpp.
References osg::PointSockConnection::acceptGroup().
00146 { 00147 Channel channel = Inherited::acceptGroup(timeout); 00148 return channel; 00149 }
wait for signal
Reimplemented from osg::PointSockConnection.
Definition at line 202 of file OSGPointMCastConnection.cpp.
References osg::PointConnection::_pointToPoint, FFATAL, osg::BinaryDataHandler::getValue(), selectChannel(), osg::PointSockConnection::wait(), and osg::Exception::what().
00203 { 00204 UInt32 tag; 00205 00206 if(_pointToPoint) 00207 return Inherited::wait(timeout); 00208 try 00209 { 00210 if(selectChannel(timeout) < 0) 00211 return false; 00212 getValue(tag); 00213 if(tag != 314156) 00214 { 00215 FFATAL(("Stream out of sync in PointMCastConnection\n")); 00216 throw ReadError("Stream out of sync"); 00217 } 00218 } 00219 catch(SocketError &e) 00220 { 00221 throw ReadError(e.what()); 00222 } 00223 return true; 00224 }
| Connection::Channel PointMCastConnection::selectChannel | ( | Time | timeout = -1 |
) | throw (ReadError) [virtual] |
select the next channel for reading. If timeout is not -1 then -1 is returned if timeout is reached
Reimplemented from osg::PointSockConnection.
Definition at line 157 of file OSGPointMCastConnection.cpp.
References _initialized, _lastDgram, _lock, _mcastSocket, osg::PointConnection::_pointToPoint, _queue, osg::Lock::aquire(), osg::DgramQueue::empty(), initialize(), osg::BinaryDataHandler::isReadBufferEmpty(), osg::Lock::release(), osg::PointSockConnection::selectChannel(), osg::DgramQueue::wait(), osg::Socket::waitReadable(), and osg::Exception::what().
Referenced by wait().
00159 { 00160 if(_pointToPoint) 00161 return Inherited::selectChannel(timeout); 00162 try 00163 { 00164 if(!_initialized) 00165 initialize(); 00166 // todo 00167 if(isReadBufferEmpty() && 00168 !_lastDgram && 00169 _queue.empty()) 00170 { 00171 if(timeout == -1) 00172 { 00173 // wait for a dgram 00174 _lock->aquire(); 00175 _queue.wait(_lock); 00176 _lock->release(); 00177 return 0; 00178 } 00179 if(timeout == 0) 00180 return -1; 00181 while(_queue.empty() && timeout > 0) 00182 { 00183 _mcastSocket.waitReadable(.1); 00184 timeout-=.1; 00185 } 00186 if(_queue.empty()) 00187 return -1; 00188 } 00189 } 00190 catch(SocketException &e) 00191 { 00192 throw ReadError(e.what()); 00193 } 00194 return 0; 00195 }
| ConnectionType PointMCastConnection::_type & PointMCastConnection::create | ( | void | ) | [static] |
Reimplemented from osg::PointSockConnection.
Definition at line 231 of file OSGPointMCastConnection.cpp.
References PointMCastConnection().
00232 { 00233 return new PointMCastConnection(); 00234 }
| void PointMCastConnection::read | ( | MemoryHandle | mem, | |
| UInt32 | size | |||
| ) | [protected, virtual] |
Read data into given memory
Read data form the current read socket. The read socket is that socket, that was selectet in selectChannel.
Reimplemented from osg::PointSockConnection.
Definition at line 246 of file OSGPointMCastConnection.cpp.
References _free, _initialized, _lastDgram, _lastDgramPos, _lock, osg::PointConnection::_pointToPoint, _queue, osg::Lock::aquire(), osg::DgramQueue::get(), osg::Dgram::getData(), osg::Dgram::getSize(), initialize(), osg::osgMin(), osg::DgramQueue::put(), osg::PointSockConnection::read(), and osg::Lock::release().
00247 { 00248 if(_pointToPoint) 00249 { 00250 Inherited::read(mem,size); 00251 return; 00252 } 00253 Dgram *dgram = NULL; 00254 char *buffer = (char*)mem; 00255 UInt32 len; 00256 UInt32 dgramPos; 00257 00258 if(!_initialized) 00259 initialize(); 00260 while(size) 00261 { 00262 if(_lastDgram) 00263 { 00264 dgramPos = _lastDgramPos; 00265 dgram = _lastDgram; 00266 } 00267 else 00268 { 00269 // get next dgram 00270 _lock->aquire(); 00271 dgram = _queue.get(_lock); 00272 _lock->release(); 00273 dgramPos = 0; 00274 if(dgram->getSize() == 0) 00275 throw ReadError("Channel closed\n"); 00276 } 00277 // copy to buffer 00278 len = osgMin(size,dgram->getSize()-dgramPos); 00279 memcpy(buffer,dgram->getData()+dgramPos,len); 00280 buffer += len; 00281 size -= len; 00282 dgramPos += len; 00283 if(dgramPos == dgram->getSize()) 00284 { 00285 // put to free queue 00286 _lock->aquire(); 00287 _free.put(dgram); 00288 _lock->release(); 00289 _lastDgram = NULL; 00290 } 00291 else 00292 { 00293 _lastDgram = dgram; 00294 _lastDgramPos = dgramPos; 00295 } 00296 } 00297 }
| void PointMCastConnection::readBuffer | ( | void | ) | [protected, virtual] |
Read next data block
The stream connection uses only BinaryDataHandler buffer. If more then one buffer is present, then this methode must be changed!
Reimplemented from osg::PointSockConnection.
Definition at line 306 of file OSGPointMCastConnection.cpp.
References _free, _initialized, _lastDgram, _lastDgramPos, _lock, osg::PointConnection::_pointToPoint, _queue, osg::Lock::aquire(), osg::DgramQueue::empty(), osg::DgramQueue::get(), osg::Dgram::getData(), osg::Dgram::getSize(), initialize(), osg::osgMin(), osg::DgramQueue::put(), osg::BinaryDataHandler::readBufBegin(), osg::PointSockConnection::readBuffer(), and osg::Lock::release().
00307 { 00308 if(_pointToPoint) 00309 { 00310 Inherited::readBuffer(); 00311 return; 00312 } 00313 00314 static int sumSize=0; 00315 Dgram *dgram = NULL; 00316 UInt32 size = readBufBegin()->getSize(); 00317 MemoryHandle buffer = readBufBegin()->getMem(); 00318 UInt32 len; 00319 UInt32 dgramPos; 00320 00321 if(!_initialized) 00322 initialize(); 00323 00324 do 00325 { 00326 if(_lastDgram) 00327 { 00328 dgramPos = _lastDgramPos; 00329 dgram = _lastDgram; 00330 } 00331 else 00332 { 00333 // get next dgram 00334 _lock->aquire(); 00335 dgram = _queue.get(_lock); 00336 _lock->release(); 00337 dgramPos = 0; 00338 if(dgram->getSize() == 0) 00339 throw ReadError("Channel closed"); 00340 } 00341 // copy to buffer 00342 len = osgMin(size,dgram->getSize()-dgramPos); 00343 memcpy(buffer,dgram->getData()+dgramPos,len); 00344 buffer += len; 00345 size -= len; 00346 dgramPos += len; 00347 if(dgramPos == dgram->getSize()) 00348 { 00349 // put to free queue 00350 _lock->aquire(); 00351 _free.put(dgram); 00352 _lock->release(); 00353 _lastDgram = NULL; 00354 } 00355 else 00356 { 00357 _lastDgram = dgram; 00358 _lastDgramPos = dgramPos; 00359 } 00360 } 00361 while(size && !_queue.empty()); 00362 // set data size 00363 readBufBegin()->setDataSize(readBufBegin()->getSize()-size); 00364 sumSize += readBufBegin()->getDataSize(); 00365 }
| bool PointMCastConnection::recvNextDgram | ( | Dgram * | dgram | ) | [private] |
read next dgram from mcast or private socket
Definition at line 372 of file OSGPointMCastConnection.cpp.
References _ackDestination, _combineAck, _maxAck, _mcastSocket, _responseSocket, _sender, combineAck(), osg::Dgram::getBuffer(), osg::Dgram::getBufferCapacity(), osg::Dgram::getBufferSize(), osg::Dgram::getId(), osg::SocketSelection::isSetRead(), osg::DgramSocket::recvFrom(), osg::SocketSelection::select(), osg::DgramSocket::sendTo(), osg::Dgram::setBufferSize(), osg::Dgram::setId(), osg::SocketSelection::setRead(), osg::Dgram::setResponseAck(), and osg::Dgram::setResponseSize().
Referenced by recvQueue().
00373 { 00374 SocketSelection selection; 00375 SocketAddress from; 00376 UInt32 length; 00377 00378 selection.setRead(_mcastSocket); 00379 selection.setRead(_responseSocket); 00380 if(!selection.select(0.5)) 00381 return false; 00382 if(selection.isSetRead(_responseSocket)) 00383 { 00384 length = _responseSocket.recvFrom(dgram->getBuffer(), 00385 dgram->getBufferCapacity(), 00386 from); 00387 dgram->setBufferSize(length); 00388 #if 0 00389 // ???? 00390 // from sender 00391 if(from == _sender && !_combineAck.empty()) 00392 { 00393 exit(0); 00394 00395 00396 if(_maxAck == dgram->getId()) 00397 { 00398 // do we have all acks ? 00399 dgram->setId(_maxAck); 00400 dgram->setResponseSize(); 00401 dgram->setResponseAck(true); 00402 #ifdef TEST_LOST_DGRAM_RATE 00403 if(drand48()>TEST_LOST_DGRAM_RATE) 00404 #endif 00405 _responseSocket.sendTo( 00406 dgram->getBuffer(), 00407 dgram->getBufferSize(), 00408 _ackDestination); 00409 return false; 00410 } 00411 else 00412 { 00413 return true; 00414 } 00415 } 00416 #endif 00417 combineAck(dgram,from); 00418 } 00419 if(selection.isSetRead(_mcastSocket)) 00420 { 00421 length = _mcastSocket.recvFrom(dgram->getBuffer(), 00422 dgram->getBufferCapacity(), 00423 from); 00424 dgram->setBufferSize(length); 00425 // ignore packages from wrong destination 00426 if(from != _sender) 00427 return false; 00428 else 00429 return true; 00430 } 00431 else 00432 { 00433 return false; 00434 } 00435 }
| void PointMCastConnection::combineAck | ( | Dgram * | dgram, | |
| SocketAddress | from | |||
| ) | [private] |
combine several acks to 1 ack stream
Definition at line 439 of file OSGPointMCastConnection.cpp.
References _ackDestination, _combineAck, _maxAck, _responseSocket, _seqNumber, FFATAL, osg::Dgram::getBuffer(), osg::Dgram::getBufferSize(), osg::Dgram::getId(), osg::Dgram::less(), osg::DgramSocket::sendTo(), osg::Dgram::setId(), osg::Dgram::setResponseAck(), and osg::Dgram::setResponseSize().
Referenced by recvNextDgram(), and recvQueue().
00440 { 00441 UInt16 maxAck; 00442 00443 if(dgram) 00444 { 00445 // do we expect acks from different source 00446 if(_combineAck.count(from)==0) 00447 { 00448 FFATAL(("no ack from other expected\n")); 00449 return; 00450 } 00451 // ack retransmission 00452 if( Dgram::less(dgram->getId(),_combineAck[from] ) ) 00453 { 00454 // printf("Ack restranmisson\n"); 00455 return; 00456 } 00457 _combineAck[from] = dgram->getId(); 00458 } 00459 00460 maxAck = _seqNumber-1; 00461 for(std::map<SocketAddress,UInt16>::iterator aI 00462 = _combineAck.begin() ; 00463 aI != _combineAck.end() ; ++aI) 00464 { 00465 if( Dgram::less(aI->second,maxAck) ) 00466 maxAck = aI->second; 00467 } 00468 // when _max ack is now greate 00469 00470 if( Dgram::less(_maxAck,maxAck)) 00471 { 00472 Dgram response; 00473 00474 _maxAck = maxAck; 00475 response.setResponseSize(); 00476 response.setId(_maxAck); 00477 response.setResponseAck(true); 00478 00479 _responseSocket.sendTo( 00480 response.getBuffer(), 00481 response.getBufferSize(), 00482 _ackDestination); 00483 } 00484 }
| void PointMCastConnection::recvQueueThread | ( | void * | arg | ) | [static, private] |
read next dgram from mcast or private socket
Definition at line 631 of file OSGPointMCastConnection.cpp.
References _recvQueueThreadRunning, recvQueue(), SFATAL, and osg::Exception::what().
Referenced by initialize().
00632 { 00633 PointMCastConnection *the=(PointMCastConnection*)arg; 00634 try 00635 { 00636 the->recvQueue(); 00637 } 00638 catch(SocketException &e) 00639 { 00640 SFATAL << "Error in dgram reader thread:" << e.what() << std::endl; 00641 } 00642 the->_recvQueueThreadRunning = false; 00643 }
| bool PointMCastConnection::recvQueue | ( | void | ) | [private] |
recv queue
Definition at line 488 of file OSGPointMCastConnection.cpp.
References _ackDestination, _combineAck, _free, _lock, _maxAck, _mcastSocket, _queue, _recvQueueThreadStop, _responseSocket, _sender, _seqNumber, osg::PointSockConnection::_socket, osg::Lock::aquire(), combineAck(), FLOG, osg::DgramQueue::get(), osg::Dgram::getBuffer(), osg::Dgram::getBufferSize(), osg::Dgram::getId(), osg::Dgram::getResponseAck(), osg::Dgram::getSize(), osg::getSystemTime(), osg::Dgram::less(), osg::DgramQueue::put(), osg::Socket::recv(), recvNextDgram(), osg::Lock::release(), osg::DgramSocket::sendTo(), osg::Dgram::setId(), osg::Dgram::setResponseAck(), osg::Dgram::setResponseSize(), osg::Dgram::setSize(), and osg::Socket::waitReadable().
Referenced by recvQueueThread().
00489 { 00490 SocketAddress from; 00491 Dgram *dgram; 00492 Dgram response; 00493 UInt32 readCount=0; 00494 UInt32 length; 00495 bool missing=false; 00496 Time ignoreT=getSystemTime(); 00497 UInt16 id; 00498 00499 #ifdef TEST_LOST_DGRAM_RATE 00500 srand48((long int)(10000*getSystemTime())); 00501 #endif 00502 00503 for(;;) 00504 { 00505 // get free dgram 00506 _lock->aquire(); 00507 dgram =_free.get(_lock); 00508 _lock->release(); 00509 do 00510 { 00511 // ignore for a while 00512 if(missing) 00513 ignoreT = getSystemTime(); 00514 do 00515 { 00516 while(!recvNextDgram(dgram)) 00517 { 00518 if(_recvQueueThreadStop) 00519 return true; 00520 try 00521 { 00522 while(_socket.waitReadable(0)) 00523 { 00524 char buffer; 00525 if(_socket.recv(&buffer,1) <= 0) 00526 { 00527 // put EOT to the queue 00528 dgram->setSize(0); 00529 _lock->aquire(); 00530 _queue.put(dgram); 00531 _lock->release(); 00532 FLOG(("Connection lost\n")); 00533 return false; 00534 } 00535 } 00536 } 00537 catch(SocketException &e) 00538 { 00539 // put EOT to the queue 00540 dgram->setSize(0); 00541 _lock->aquire(); 00542 _queue.put(dgram); 00543 _lock->release(); 00544 FLOG(("Connection lost\n")); 00545 return false; 00546 } 00547 } 00548 id = dgram->getId(); 00549 } 00550 while( missing && 00551 id != _seqNumber && 00552 (getSystemTime() - ignoreT) < 0.01); 00553 00554 missing = false; 00555 response.setId(id); 00556 00557 // ack request ? 00558 if(dgram->getSize() == 0) 00559 { 00560 if( !Dgram::less(id,_seqNumber ) ) 00561 { 00562 missing = true; 00563 response.setId(_seqNumber); 00564 } 00565 // printf("ack request %d %d\n",id,missing); 00566 } 00567 else 00568 { 00569 // printf("%d got %d\n",id,_seqNumber); 00570 if( dgram->getId() == _seqNumber) 00571 { 00572 // got expected dgram. 00573 // put to queue 00574 _lock->aquire(); 00575 _queue.put(dgram); 00576 _lock->release(); 00577 } 00578 else 00579 { 00580 // ignore if unneccesary retransmission 00581 if( Dgram::less(id,_seqNumber ) ) 00582 { 00583 continue; 00584 } 00585 else 00586 { 00587 missing = true; 00588 response.setId(_seqNumber); 00589 } 00590 } 00591 } 00592 00593 // printf("Responde %d\n",response.getId()); 00594 // prepare response 00595 response.setResponseAck(!missing); 00596 response.setResponseSize(); 00597 00598 // send response if nak or no data in the queue 00599 if(!response.getResponseAck() || 00600 !_mcastSocket.waitReadable(0)) 00601 { 00602 #ifdef TEST_LOST_DGRAM_RATE 00603 if(drand48()>TEST_LOST_DGRAM_RATE) 00604 #endif 00605 if(response.getResponseAck()) 00606 { 00607 // send response if no ack combination 00608 // or ack request 00609 if(_combineAck.empty() || id == _maxAck) 00610 _responseSocket.sendTo(response.getBuffer(), 00611 response.getBufferSize(), 00612 _ackDestination); 00613 else 00614 combineAck(NULL,_sender); 00615 } 00616 else 00617 { 00618 // send nak to sender 00619 _responseSocket.sendTo(response.getBuffer(), 00620 response.getBufferSize(), 00621 _sender); 00622 } 00623 } 00624 } 00625 while(id != _seqNumber || missing); 00626 _seqNumber++; 00627 } 00628 // return true; 00629 }
| void PointMCastConnection::initialize | ( | void | ) | [private] |
initialize connection
Definition at line 647 of file OSGPointMCastConnection.cpp.
References _ackDestination, _combineAck, _initialized, _maxAck, _mcastSocket, _recvQueueThread, _recvQueueThreadRunning, _recvQueueThreadStop, osg::PointSockConnection::_remoteAddress, _responseSocket, _sender, _seqNumber, osg::PointSockConnection::_socket, osg::SocketAddress::ANY, osg::Socket::bind(), osg::BinaryMessage::clear(), osg::BaseThread::get(), osg::Socket::getAddress(), osg::SocketAddress::getHost(), osg::Connection::getInterface(), osg::SocketAddress::getPort(), osg::BinaryMessage::getString(), osg::BinaryMessage::getUInt32(), osg::DgramSocket::join(), osg::DgramSocket::open(), osg::BinaryMessage::putUInt32(), osg::Socket::recv(), recvQueueThread(), osg::Socket::send(), osg::DgramSocket::setMCastInterface(), osg::Socket::setReadBufferSize(), and osg::Socket::setReusePort().
Referenced by read(), readBuffer(), and selectChannel().
00648 { 00649 std::string group; 00650 Channel channel; 00651 BinaryMessage message; 00652 std::string fromHost; 00653 UInt32 fromPort; 00654 UInt32 combineCount; 00655 std::string host; 00656 UInt32 port; 00657 char threadName[256]; 00658 00659 sprintf(threadName,"PointMCastConnection%p",this); 00660 00661 // get info about the group 00662 _socket.recv(message); 00663 // group and port 00664 group = message.getString(); 00665 port = message.getUInt32(); 00666 // get seq number 00667 _seqNumber = message.getUInt32(); 00668 _maxAck = _seqNumber - 1; 00669 // get port 00670 fromPort = message.getUInt32(); 00671 00672 _sender = SocketAddress(_remoteAddress.getHost().c_str(),fromPort); 00673 00674 std::cout << _remoteAddress.getHost() << " " << fromPort << std::endl; 00675 00676 // prepare socket to receive mcast packages 00677 _mcastSocket.open(); 00678 _mcastSocket.setReusePort(true); 00679 _mcastSocket.setReadBufferSize(524288); 00680 _mcastSocket.bind(SocketAddress(SocketAddress::ANY,port)); 00681 try 00682 { 00683 _mcastSocket.join(SocketAddress(group.c_str())); 00684 } 00685 catch(...) {} 00686 // set multicast interface 00687 if(!getInterface().empty()) 00688 { 00689 _mcastSocket.setMCastInterface(SocketAddress(getInterface().c_str())); 00690 } 00691 00692 _responseSocket.open(); 00693 _responseSocket.bind(SocketAddress(SocketAddress::ANY,0)); 00694 00695 // tell the group from wich port requests are comming 00696 message.clear(); 00697 message.putUInt32(_responseSocket.getAddress().getPort()); 00698 _socket.send(message); 00699 00700 // get ack destination info 00701 _socket.recv(message); 00702 00703 message.getUInt32(combineCount); 00704 // printf("%d\n",combineCount); 00705 while(combineCount--) 00706 { 00707 host=message.getString(); 00708 port=message.getUInt32(); 00709 _combineAck[SocketAddress(host.c_str(),port)]=_seqNumber-1; 00710 } 00711 00712 host=message.getString(); 00713 port=message.getUInt32(); 00714 if(host.empty()) 00715 host = _remoteAddress.getHost(); 00716 _ackDestination = SocketAddress(host.c_str(),port); 00717 00718 // start reader thread 00719 _recvQueueThread=BaseThread::get(threadName); 00720 _recvQueueThreadRunning = true; 00721 _recvQueueThreadStop = false; 00722 _recvQueueThread->runFunction( recvQueueThread, (void *) (this) ); 00723 00724 _initialized = true; 00725 // printf("init end\n"); 00726 }
| PointMCastConnection& osg::PointMCastConnection::operator= | ( | const PointMCastConnection & | source | ) | [private] |
| Connection::Channel PointSockConnection::connectPoint | ( | const std::string & | address, | |
| Time | timeout = -1 | |||
| ) | [virtual, inherited] |
connect to the given point. If timeout is reached, -1 is returned
Implements osg::Connection.
Definition at line 101 of file OSGPointSockConnection.cpp.
References osg::PointConnection::_pointToPoint, osg::PointSockConnection::_remoteAddress, osg::PointSockConnection::_socket, and osg::GroupSockConnection::connectSocket().
00104 { 00105 StreamSocket socket; 00106 if(GroupSockConnection::connectSocket(socket,address,_remoteAddress,timeout)) 00107 { 00108 _socket = socket; 00109 _pointToPoint = true; 00110 return true; 00111 } 00112 else 00113 { 00114 return false; 00115 } 00116 }
| Connection::Channel PointSockConnection::acceptPoint | ( | Time | timeout = -1 |
) | [virtual, inherited] |
accept an icomming point connection. If timeout is reached, -1 is returned. If timeout is -1 then wait without timeout
Implements osg::Connection.
Definition at line 148 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_acceptSocket, osg::PointConnection::_pointToPoint, osg::PointSockConnection::_remoteAddress, osg::PointSockConnection::_socket, and osg::GroupSockConnection::acceptSocket().
00149 { 00150 if(GroupSockConnection::acceptSocket(_acceptSocket,_socket,_remoteAddress,timeout)) 00151 { 00152 _pointToPoint = true; 00153 return 0; 00154 } 00155 else 00156 { 00157 return -1; 00158 } 00159 }
| std::string PointSockConnection::bind | ( | const std::string & | address | ) | [virtual, inherited] |
bind the connection to a network interface. The address is returned, on wich the port could be connected. The interface is determined by the connection interface filed and the address parameter. Address can be empty, wich means to use a free port or address can contain a port number.
Implements osg::Connection.
Definition at line 183 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_acceptSocket, osg::SocketAddress::ANY, osg::Socket::bind(), osg::Socket::getAddress(), osg::SocketAddress::getHost(), osg::Connection::getInterface(), osg::SocketAddress::getPort(), osg::Socket::listen(), osg::osgGetHostname(), osg::Socket::setReusePort(), and SINFO.
00184 { 00185 int port=0; 00186 char localhost[256]; 00187 char host[256]; 00188 char portStr[256]; 00189 std::string interf; 00190 00191 // get local host name 00192 osgGetHostname(localhost,255); 00193 if(!getInterface().empty()) 00194 interf = getInterface(); 00195 else 00196 interf = localhost; 00197 00198 // parse address 00199 if(!address.empty()) 00200 if(sscanf(address.c_str(),"%*[^:]:%d",&port) != 1) 00201 if(sscanf(address.c_str(),":%d",&port) != 1) 00202 port = 0; 00203 // bind port 00204 _acceptSocket.setReusePort(true); 00205 if(!getInterface().empty()) 00206 _acceptSocket.bind(SocketAddress(getInterface().c_str(),port)); 00207 else 00208 _acceptSocket.bind(SocketAddress(SocketAddress::ANY,port)); 00209 00210 SINFO << "Connection bound to " 00211 << _acceptSocket.getAddress().getHost() << ":" 00212 << _acceptSocket.getAddress().getPort() << std::endl; 00213 _acceptSocket.listen(); 00214 // create address 00215 sprintf(portStr,"%d",_acceptSocket.getAddress().getPort()); 00216 return interf + ":" + portStr; 00217 }
| void PointSockConnection::signal | ( | void | ) | throw (WriteError) [virtual, inherited] |
send signal
Implements osg::PointConnection.
Definition at line 270 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_socket, osg::osghtonl(), osg::Socket::send(), and osg::Exception::what().
00271 { 00272 UInt32 tag=osghtonl(314156); 00273 try 00274 { 00275 _socket.send(&tag,sizeof(tag)); 00276 } 00277 catch(SocketError &e) 00278 { 00279 throw ReadError(e.what()); 00280 } 00281 }
| void PointSockConnection::write | ( | MemoryHandle | mem, | |
| UInt32 | size | |||
| ) | [protected, virtual, inherited] |
Write data to destinations
| mem | Pointer to data buffer | |
| size | Size of bytes to write |
Reimplemented from osg::BinaryDataHandler.
Definition at line 347 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_socket, and osg::Socket::send().
| void PointSockConnection::writeBuffer | ( | void | ) | [protected, virtual, inherited] |
Write buffer
Write blocksize and data.
Reimplemented from osg::BinaryDataHandler.
Definition at line 357 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_socket, osg::PointSockConnection::_socketWriteBuffer, osg::osghtonl(), osg::Socket::send(), and osg::BinaryDataHandler::writeBufBegin().
00358 { 00359 Int32 index; 00360 UInt32 size = writeBufBegin()->getDataSize(); 00361 // write size to header 00362 ((SocketBufferHeader*)&_socketWriteBuffer[0])->size=osghtonl(size); 00363 if(size) 00364 { 00365 // write whole block 00366 _socket.send(&_socketWriteBuffer[0], 00367 size+sizeof(SocketBufferHeader)); 00368 } 00369 }
| void Connection::setParams | ( | const std::string & | params | ) | [virtual, inherited] |
set connections parameters, a comma separated list e.g. "TTL=255"
Reimplemented in osg::GroupMCastConnection, and osg::GroupSockConnection.
Definition at line 91 of file OSGConnection.cpp.
Referenced by osg::ClusterWindow::init().
00092 { 00093 // do nothing this is implemented in the derived classes e.g. OSGGroupMCastConnection.cpp 00094 }
| const std::string & Connection::getInterface | ( | void | ) | [inherited] |
get network interface
Definition at line 98 of file OSGConnection.cpp.
References osg::Connection::_interface.
Referenced by osg::PointSockConnection::bind(), osg::GroupSockConnection::bind(), osg::PointSockPipeline::initialize(), initialize(), and osg::GroupMCastConnection::initialize().
00099 { 00100 return _interface; 00101 }
| void Connection::setInterface | ( | const std::string & | interf | ) | [inherited] |
set network interface
Definition at line 105 of file OSGConnection.cpp.
References osg::Connection::_interface.
Referenced by osg::ClusterServer::acceptClient(), and osg::ClusterWindow::init().
00106 { 00107 _interface = interf; 00108 }
| void BinaryDataHandler::put | ( | void const * | src, | |
| UInt32 | size | |||
| ) | [inherited] |
Definition at line 83 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_currentWriteBufferPos, osg::BinaryDataHandler::_zeroCopyBuffers, osg::BinaryDataHandler::_zeroCopyThreshold, osg::osgMin(), osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::write(), and osg::BinaryDataHandler::writeBufEnd().
Referenced by osg::BinaryDataHandler::putAndFree(), osg::BinaryDataHandler::putValue(), osg::BinaryDataHandler::putValues(), and osg::ClusterViewBuffer::send().
00084 { 00085 UInt8 const *data = static_cast<UInt8 const *>(src); 00086 00087 if(_zeroCopyThreshold && size >= _zeroCopyThreshold) 00088 { 00089 if(_zeroCopyThreshold == 1) 00090 { 00091 write(const_cast<MemoryHandle>(data), size); 00092 } 00093 else 00094 { 00095 UInt8 tag = 1; 00096 00097 // we have to write a tag, to indicate the membership 00098 // of this zero copy block to the current data block 00099 put(&tag, sizeof(tag)); 00100 00101 _zeroCopyBuffers.push_back( 00102 MemoryBlock(const_cast<MemoryHandle>(data), size, size)); 00103 } 00104 } 00105 else 00106 { 00107 UInt32 copySize; 00108 00109 while(size != 0) 00110 { 00111 if(_currentWriteBuffer == writeBufEnd()) 00112 { 00113 pushBuffer(); 00114 } 00115 00116 copySize = osgMin((_currentWriteBuffer->getSize() - 00117 _currentWriteBufferPos), 00118 size); 00119 00120 memcpy(_currentWriteBuffer->getMem() + _currentWriteBufferPos, 00121 data, 00122 copySize); 00123 00124 size -= copySize; 00125 _currentWriteBufferPos += copySize; 00126 data += copySize; 00127 00128 // skip to next buffer if current buffer is full 00129 if(_currentWriteBufferPos == _currentWriteBuffer->getSize()) 00130 { 00131 _currentWriteBuffer->setDataSize(_currentWriteBufferPos); 00132 _currentWriteBuffer++; 00133 _currentWriteBufferPos = 0; 00134 } 00135 } 00136 } 00137 }
| void BinaryDataHandler::putAndFree | ( | MemoryHandle | src, | |
| UInt32 | size | |||
| ) | [inherited] |
Put data from dynamic allocated block The caller doesn't know, when the block will be written. So we are responsible for freeing this block.
Definition at line 144 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_freeMem, osg::BinaryDataHandler::_zeroCopyThreshold, and osg::BinaryDataHandler::put().
00145 { 00146 put(src, size); 00147 00148 if(_zeroCopyThreshold && size > _zeroCopyThreshold) 00149 { 00150 _freeMem.push_back(src); 00151 } 00152 else 00153 { 00154 delete [] src; 00155 } 00156 }
| void osg::BinaryDataHandler::putValue | ( | const bool & | value | ) | [inline, inherited] |
Definition at line 60 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::put().
Referenced by osg::SortFirstWindow::clientInit(), osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), osg::RenderNode::copyToBin(), osg::MField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::BINWriter::doWriteIndexedFC(), osg::RemoteAspect::handleFCMapping(), osg::ClusterWindow::init(), osg::BinaryDataHandler::putValue(), osg::BinaryDataHandler::putValues(), osg::ClusterViewBuffer::send(), osg::RemoteAspect::sendSync(), osg::SortFirstWindow::serverInit(), osg::GroupMCastConnection::signal(), osg::ClusterServer::start(), and osg::BINWriter::writeFileHeader().
00061 { 00062 // on Mac OS X a bool is four bytes long on all other 00063 // platfroms it is one byte long. So we write now always 00064 // one byte out. 00065 // put(&value, sizeof(bool)); 00066 UInt8 temp = (UInt8) value; 00067 put(&temp, sizeof(UInt8)); 00068 }
| void osg::BinaryDataHandler::putValue | ( | const UInt8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::putValue | ( | const UInt16 & | value | ) | [inline, inherited] |
Definition at line 77 of file OSGBinaryDataHandler.inl.
References osg::osghtons(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const UInt32 & | value | ) | [inline, inherited] |
Definition at line 85 of file OSGBinaryDataHandler.inl.
References osg::osghtonl(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const UInt64 & | value | ) | [inline, inherited] |
Definition at line 93 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Int8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::putValue | ( | const Int16 & | value | ) | [inline, inherited] |
Definition at line 107 of file OSGBinaryDataHandler.inl.
References osg::osghtons(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Int32 & | value | ) | [inline, inherited] |
Definition at line 115 of file OSGBinaryDataHandler.inl.
References osg::osghtonl(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Int64 & | value | ) | [inline, inherited] |
Definition at line 123 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Real16 & | value | ) | [inline, inherited] |
Definition at line 131 of file OSGBinaryDataHandler.inl.
References osg::Real16::bits(), osg::osghtons(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Real32 & | value | ) | [inline, inherited] |
Definition at line 139 of file OSGBinaryDataHandler.inl.
References osg::osghtonl(), and osg::BinaryDataHandler::put().
00140 { 00141 UInt32 v = osghtonl( *((const UInt32 *)(&value)) ); 00142 00143 put(&v, sizeof(Real32)); 00144 }
| void osg::BinaryDataHandler::putValue | ( | const Real64 & | value | ) | [inline, inherited] |
Definition at line 147 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
00148 { 00149 UInt64 v = osghtonll( *((const UInt64 *)(&value)) ); 00150 00151 put(&v, sizeof(Real64)); 00152 }
| void osg::BinaryDataHandler::putValue | ( | const Real128 & | value | ) | [inline, inherited] |
Definition at line 155 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
00156 { 00157 UInt64 v = osghtonll( *( (const UInt64 *)(&value)) ); 00158 UInt64 w = osghtonll( *(((const UInt64 *)(&value)) + 1) ); 00159 00160 #if BYTE_ORDER == LITTLE_ENDIAN 00161 put(&w, sizeof(UInt64)); 00162 put(&v, sizeof(UInt64)); 00163 #else 00164 put(&v, sizeof(UInt64)); 00165 put(&w, sizeof(UInt64)); 00166 #endif 00167 }
| void osg::BinaryDataHandler::putValue | ( | const std::string & | value | ) | [inline, inherited] |
Definition at line 170 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::put(), osg::BinaryDataHandler::putValue(), and osg::stringlen().
00171 { 00172 UInt32 len = stringlen(value.c_str()) + 1; 00173 00174 putValue(len); 00175 00176 if(len != 0) 00177 { 00178 put(value.c_str(), len); 00179 } 00180 }
| void osg::BinaryDataHandler::putValues | ( | const bool * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 184 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::putValue().
Definition at line 197 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00198 { 00199 #if BYTE_ORDER == LITTLE_ENDIAN 00200 00201 if(_networkOrder == true) 00202 { 00203 for(UInt32 i = 0; i < size; ++i) 00204 { 00205 putValue(value[i]); 00206 } 00207 } 00208 else 00209 #endif 00210 { 00211 put(value, size * sizeof(UInt16)); 00212 } 00213 }
Definition at line 216 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00217 { 00218 #if BYTE_ORDER == LITTLE_ENDIAN 00219 if(_networkOrder == true) 00220 { 00221 for(UInt32 i = 0; i < size; ++i) 00222 { 00223 putValue(value[i]); 00224 } 00225 } 00226 else 00227 #endif 00228 { 00229 put(value, size * sizeof(UInt32)); 00230 } 00231 }
Definition at line 234 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00235 { 00236 #if BYTE_ORDER == LITTLE_ENDIAN 00237 if(_networkOrder == true) 00238 { 00239 for(UInt32 i = 0; i < size; ++i) 00240 { 00241 putValue(value[i]); 00242 } 00243 } 00244 else 00245 #endif 00246 { 00247 put(value, size * sizeof(UInt64)); 00248 } 00249 }
Definition at line 252 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00253 { 00254 #if BYTE_ORDER == LITTLE_ENDIAN 00255 if(_networkOrder == true) 00256 { 00257 for(UInt32 i = 0; i < size; ++i) 00258 { 00259 putValue(value[i]); 00260 } 00261 } 00262 else 00263 #endif 00264 { 00265 put(value, size * sizeof(Int8)); 00266 } 00267 }
Definition at line 270 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00271 { 00272 #if BYTE_ORDER == LITTLE_ENDIAN 00273 if(_networkOrder == true) 00274 { 00275 for(UInt32 i = 0; i < size; ++i) 00276 { 00277 putValue(value[i]); 00278 } 00279 } 00280 else 00281 #endif 00282 { 00283 put(value, size * sizeof(Int16)); 00284 } 00285 }
Definition at line 288 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00289 { 00290 #if BYTE_ORDER == LITTLE_ENDIAN 00291 if(_networkOrder == true) 00292 { 00293 for(UInt32 i = 0; i < size; ++i) 00294 { 00295 putValue(value[i]); 00296 } 00297 } 00298 else 00299 #endif 00300 { 00301 put(value, size * sizeof(Int32)); 00302 } 00303 }
Definition at line 306 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00307 { 00308 #if BYTE_ORDER == LITTLE_ENDIAN 00309 if(_networkOrder == true) 00310 { 00311 for(UInt32 i = 0; i < size; ++i) 00312 { 00313 putValue(value[i]); 00314 } 00315 } 00316 else 00317 #endif 00318 { 00319 put(value, size * sizeof(Int64)); 00320 } 00321 }
Definition at line 324 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00325 { 00326 #if BYTE_ORDER == LITTLE_ENDIAN 00327 if(_networkOrder == true) 00328 { 00329 for(UInt32 i = 0; i < size; ++i) 00330 { 00331 putValue(value[i]); 00332 } 00333 } 00334 else 00335 #endif 00336 { 00337 put(value, size * sizeof(Real16)); 00338 } 00339 }
Definition at line 342 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00343 { 00344 #if BYTE_ORDER == LITTLE_ENDIAN 00345 if(_networkOrder == true) 00346 { 00347 for(UInt32 i = 0; i < size; ++i) 00348 { 00349 putValue(value[i]); 00350 } 00351 } 00352 else 00353 #endif 00354 { 00355 put(value, size * sizeof(Real32)); 00356 } 00357 }
Definition at line 360 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00361 { 00362 #if BYTE_ORDER == LITTLE_ENDIAN 00363 if(_networkOrder == true) 00364 { 00365 for(UInt32 i = 0; i < size; ++i) 00366 { 00367 putValue(value[i]); 00368 } 00369 } 00370 else 00371 #endif 00372 { 00373 put(value, size * sizeof(Real64)); 00374 } 00375 }
Definition at line 378 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00379 { 00380 #if BYTE_ORDER == LITTLE_ENDIAN 00381 if(_networkOrder == true) 00382 { 00383 for(UInt32 i = 0; i < size; ++i) 00384 { 00385 putValue(value[i]); 00386 } 00387 } 00388 else 00389 #endif 00390 { 00391 put(value, size * sizeof(Real128)); 00392 } 00393 }
| void osg::BinaryDataHandler::putValues | ( | const std::string * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 396 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::putValue().
| void BinaryDataHandler::get | ( | void * | dst, | |
| UInt32 | size | |||
| ) | [inherited] |
Definition at line 161 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_currentReadBufferPos, osg::BinaryDataHandler::_zeroCopyThreshold, osg::osgMin(), osg::BinaryDataHandler::pullBuffer(), osg::BinaryDataHandler::read(), and osg::BinaryDataHandler::readBufEnd().
Referenced by osg::RemoteAspect::receiveSync(), and osg::ClusterViewBuffer::recv().
00162 { 00163 MemoryHandle data = static_cast<MemoryHandle>(dst); 00164 00165 if(_zeroCopyThreshold && size >= _zeroCopyThreshold) 00166 { 00167 if(_zeroCopyThreshold > 1) 00168 { 00169 UInt8 tag; 00170 00171 // we have to read the tag, to force reading of data blocks 00172 // if the first data field was zero copied 00173 get(&tag, sizeof(tag)); 00174 } 00175 00176 // read direct into destination 00177 read(data, size); 00178 } 00179 else 00180 { 00181 UInt32 copySize; 00182 00183 while(size != 0) 00184 { 00185 // read new data if nothing left 00186 if(_currentReadBuffer == readBufEnd()) 00187 { 00188 pullBuffer(); 00189 } 00190 00191 // num bytes to copy 00192 copySize = osgMin((_currentReadBuffer->getDataSize() - 00193 _currentReadBufferPos), 00194 size); 00195 00196 // no data in buffer ? 00197 if(copySize != 0) 00198 { 00199 memcpy( data, 00200 _currentReadBuffer->getMem() + _currentReadBufferPos, 00201 copySize); 00202 00203 size -= copySize; 00204 _currentReadBufferPos += copySize; 00205 data += copySize; 00206 } 00207 00208 // skip to next buffer if current buffer is full 00209 if(_currentReadBufferPos == _currentReadBuffer->getDataSize()) 00210 { 00211 _currentReadBuffer++; 00212 _currentReadBufferPos = 0; 00213 } 00214 } 00215 } 00216 }
| void BinaryDataHandler::getAndAlloc | ( | MemoryHandle & | src, | |
| UInt32 | size | |||
| ) | [inherited] |
read data in a dynamic allocated block
If data was compressed or converted then it is not possible to write it into the destination memory. BinaryDataHandler doesn't store data in continous memory areas. If the caller needs a continuous memory then we provide a dynamic allocated block. The caller is responsible to free this block.
Definition at line 227 of file OSGBinaryDataHandler.cpp.
00228 { 00229 src = new UInt8[size]; 00230 00231 get(src, size); 00232 }
| void osg::BinaryDataHandler::getValue | ( | bool & | value | ) | [inline, inherited] |
Definition at line 405 of file OSGBinaryDataHandler.inl.
Referenced by osg::BINLoader::chargeFieldContainers(), osg::SortFirstWindow::clientInit(), osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), osg::RenderNode::copyFromBin(), osg::MField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::BINLoader::createFieldContainers(), osg::BinaryDataHandler::getValue(), osg::BinaryDataHandler::getValues(), osg::ClusterWindow::init(), osg::RemoteAspect::receiveSync(), osg::ClusterViewBuffer::recv(), osg::SortFirstWindow::serverInit(), osg::ClusterServer::start(), and wait().
00406 { 00407 //get(&value, sizeof(bool)); 00408 UInt8 temp; 00409 get(&temp, sizeof(UInt8)); 00410 value = (temp!=0); 00411 }
| void osg::BinaryDataHandler::getValue | ( | UInt8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | UInt16 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | UInt32 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | UInt64 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int16 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int32 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int64 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Real16 & | value | ) | [inline, inherited] |
Definition at line 474 of file OSGBinaryDataHandler.inl.
References osg::osgntohs(), and osg::Real16::setBits().
00475 { 00476 UInt16 v; 00477 00478 get(&v, sizeof(Real16)); 00479 00480 v = osgntohs(v); 00481 value.setBits(v); 00482 }
| void osg::BinaryDataHandler::getValue | ( | Real32 & | value | ) | [inline, inherited] |
Definition at line 485 of file OSGBinaryDataHandler.inl.
References osg::osgntohf(), and osg::osgntohl().
00486 { 00487 get(&value, sizeof(Real32)); 00488 00489 value = osgntohf(value); 00490 00491 #if 0 00492 // doesn't work on my 64 bit linux ... 00493 UInt32 v; 00494 00495 get(&v, sizeof(Real32)); 00496 00497 v = osgntohl(v); 00498 value = *(reinterpret_cast<Real32 *>(&v)); 00499 #endif 00500 }
| void osg::BinaryDataHandler::getValue | ( | Real64 & | value | ) | [inline, inherited] |
Definition at line 503 of file OSGBinaryDataHandler.inl.
References osg::osgntohd(), and osg::osgntohll().
00504 { 00505 get(&value, sizeof(Real64)); 00506 00507 value = osgntohd(value); 00508 00509 #if 0 00510 UInt64 v; 00511 00512 get(&v, sizeof(Real64)); 00513 00514 v = osgntohll(v); 00515 value = *(reinterpret_cast<Real64 *>(&v)); 00516 #endif 00517 }
| void osg::BinaryDataHandler::getValue | ( | Real128 & | value | ) | [inline, inherited] |
Definition at line 520 of file OSGBinaryDataHandler.inl.
References osg::osgntohdd(), and osg::osgntohll().
00521 { 00522 get(&value, sizeof(Real128)); 00523 00524 value = osgntohdd(value); 00525 00526 #if 0 00527 UInt64 v[2]; 00528 00529 #if BYTE_ORDER == LITTLE_ENDIAN 00530 get(&v[1], sizeof(UInt64)); 00531 get(&v[0], sizeof(UInt64)); 00532 #else 00533 get(&v[0], sizeof(UInt64)); 00534 get(&v[1], sizeof(UInt64)); 00535 #endif 00536 00537 v[0] = osgntohll(v[0]); 00538 v[1] = osgntohll(v[1]); 00539 value = *(reinterpret_cast<Real128 *>(&v)); 00540 #endif 00541 }
| void osg::BinaryDataHandler::getValue | ( | std::string & | value | ) | [inline, inherited] |
Definition at line 544 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::getValue().
00545 { 00546 UInt32 len; 00547 Char8 *str = NULL; 00548 00549 getValue(len); 00550 00551 if(len != 0) 00552 { 00553 str = new Char8[len]; 00554 00555 get(str, len); 00556 00557 value = str; 00558 00559 delete [] str; 00560 } 00561 else 00562 { 00563 value.erase(); 00564 } 00565 }
| void osg::BinaryDataHandler::getValues | ( | bool * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 568 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::getValue().
Definition at line 581 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohs().
00582 { 00583 get(value, size * sizeof(UInt16)); 00584 00585 #if BYTE_ORDER == LITTLE_ENDIAN 00586 if(_networkOrder == true) 00587 { 00588 for(UInt32 i = 0; i < size; ++i) 00589 { 00590 value[i] = osgntohs(value[i]); 00591 } 00592 } 00593 #endif 00594 }
Definition at line 597 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohl().
00598 { 00599 get(value, size * sizeof(UInt32)); 00600 00601 #if BYTE_ORDER == LITTLE_ENDIAN 00602 if(_networkOrder == true) 00603 { 00604 for(UInt32 i = 0; i < size; ++i) 00605 { 00606 value[i] = osgntohl(value[i]); 00607 } 00608 } 00609 #endif 00610 }
Definition at line 613 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00614 { 00615 get(value, size * sizeof(UInt64)); 00616 00617 #if BYTE_ORDER == LITTLE_ENDIAN 00618 if(_networkOrder == true) 00619 { 00620 for(UInt32 i = 0; i < size; ++i) 00621 { 00622 value[i] = osgntohll(value[i]); 00623 } 00624 } 00625 #endif 00626 }
Definition at line 635 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohs().
00636 { 00637 get(value, size * sizeof(Int16)); 00638 00639 #if BYTE_ORDER == LITTLE_ENDIAN 00640 if(_networkOrder == true) 00641 { 00642 for(UInt32 i = 0; i < size; ++i) 00643 { 00644 value[i] = osgntohs(value[i]); 00645 } 00646 } 00647 #endif 00648 }
Definition at line 651 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohl().
00652 { 00653 get(value, size * sizeof(Int32)); 00654 00655 #if BYTE_ORDER == LITTLE_ENDIAN 00656 if(_networkOrder == true) 00657 { 00658 for(UInt32 i = 0; i < size; ++i) 00659 { 00660 value[i] = osgntohl(value[i]); 00661 } 00662 } 00663 #endif 00664 }
Definition at line 667 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00668 { 00669 get(value, size * sizeof(Int64)); 00670 00671 #if BYTE_ORDER == LITTLE_ENDIAN 00672 if(_networkOrder == true) 00673 { 00674 for(UInt32 i = 0; i < size; ++i) 00675 { 00676 value[i] = osgntohll(value[i]); 00677 } 00678 } 00679 #endif 00680 }
Definition at line 683 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::osgntohs(), and osg::Real16::setBits().
00684 { 00685 get(value, size * sizeof(Real16)); 00686 00687 #if BYTE_ORDER == LITTLE_ENDIAN 00688 if(_networkOrder == true) 00689 { 00690 UInt16 *intValue = reinterpret_cast<UInt16 *>(value); 00691 00692 for(UInt32 i = 0; i < size; ++i) 00693 { 00694 value[i].setBits(osgntohs(intValue[i])); 00695 } 00696 } 00697 #endif 00698 }
Definition at line 701 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohl().
00702 { 00703 get(value, size * sizeof(Real32)); 00704 00705 #if BYTE_ORDER == LITTLE_ENDIAN 00706 if(_networkOrder == true) 00707 { 00708 UInt32 *intValue = reinterpret_cast<UInt32 *>(value); 00709 00710 for(UInt32 i = 0; i < size; ++i) 00711 { 00712 intValue[i] = osgntohl(intValue[i]); 00713 } 00714 } 00715 #endif 00716 }
Definition at line 719 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00720 { 00721 get(value, size * sizeof(Real64)); 00722 00723 #if BYTE_ORDER == LITTLE_ENDIAN 00724 if(_networkOrder == true) 00725 { 00726 UInt64 *longValue = reinterpret_cast<UInt64 *>(value); 00727 00728 for(UInt32 i = 0; i < size; ++i) 00729 { 00730 longValue[i] = osgntohll(longValue[i]); 00731 } 00732 } 00733 #endif 00734 }
Definition at line 737 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00738 { 00739 get(value, size * sizeof(UInt64) * 2); 00740 00741 #if BYTE_ORDER == LITTLE_ENDIAN 00742 if(_networkOrder == true) 00743 { 00744 UInt64 *longValue = reinterpret_cast<UInt64 *>(value); 00745 00746 for(UInt32 i = 0; i < size; i += 2) 00747 { 00748 UInt64 l = longValue[i]; 00749 longValue[i] = osgntohll(longValue[i + 1]); 00750 longValue[i + 1] = osgntohll(longValue[l ]); 00751 } 00752 } 00753 #endif 00754 }
| void osg::BinaryDataHandler::getValues | ( | std::string * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 757 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::getValue().
| void BinaryDataHandler::forceCopy | ( | void | ) | [virtual, inherited] |
always copy memory blocks befor write forceCopy must be called for all endpoints of this connection
Definition at line 260 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_zeroCopyThreshold.
00261 { 00262 _zeroCopyThreshold = 0; 00263 }
| void BinaryDataHandler::forceDirectIO | ( | void | ) | [virtual, inherited] |
always read or write directly into or from memory blocks forceDirectIO must be called for all endpoints of this connection
Definition at line 268 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_zeroCopyThreshold.
00269 { 00270 _zeroCopyThreshold = 1; 00271 }
| void BinaryDataHandler::flush | ( | void | ) | [inherited] |
Definition at line 239 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_currentWriteBufferPos, osg::BinaryDataHandler::pushBuffer(), and osg::BinaryDataHandler::writeBufEnd().
Referenced by osg::SortFirstWindow::clientInit(), osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), osg::ClusterWindow::init(), osg::ClusterViewBuffer::send(), osg::RemoteAspect::sendSync(), osg::SortFirstWindow::serverInit(), osg::GroupMCastConnection::signal(), osg::ClusterServer::start(), and osg::BINWriter::write().
00240 { 00241 if(_currentWriteBuffer != writeBufEnd()) 00242 { 00243 // mark rest of buffer as empty 00244 _currentWriteBuffer->setDataSize(_currentWriteBufferPos); 00245 _currentWriteBuffer++; 00246 00247 while(_currentWriteBuffer != writeBufEnd()) 00248 { 00249 _currentWriteBuffer->setDataSize(0); 00250 _currentWriteBuffer++; 00251 } 00252 } 00253 00254 pushBuffer(); 00255 }
| void BinaryDataHandler::setNetworkOrder | ( | bool | value | ) | [inherited] |
always copy memory blocks befor write forceCopy must be called for all endpoints of this connection
Definition at line 277 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_networkOrder.
Referenced by osg::ClusterWindow::init(), and osg::ClusterServer::start().
00278 { 00279 _networkOrder = value; 00280 }
| bool BinaryDataHandler::getNetworkOrder | ( | void | ) | [inherited] |
always copy memory blocks befor write forceCopy must be called for all endpoints of this connection
Definition at line 282 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_networkOrder.
00283 { 00284 return _networkOrder; 00285 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::readBufBegin | ( | void | ) | [inline, protected, inherited] |
Definition at line 812 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_readBuffers.
Referenced by osg::BinaryDataHandler::pullBuffer(), osg::PointSockPipeline::readBuffer(), osg::PointSockConnection::readBuffer(), readBuffer(), osg::GroupSockConnection::readBuffer(), and osg::BinaryDataHandler::readBuffer().
00813 { 00814 return _readBuffers.begin(); 00815 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::readBufEnd | ( | void | ) | [inline, protected, inherited] |
Definition at line 818 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_readBuffers.
Referenced by osg::BinaryDataHandler::get(), osg::BinaryDataHandler::isReadBufferEmpty(), osg::BinaryDataHandler::readBufAdd(), osg::BinaryDataHandler::readBufClear(), osg::BinaryDataHandler::readBuffer(), and osg::GroupSockConnection::selectChannel().
00819 { 00820 return _readBuffers.end(); 00821 }
| void BinaryDataHandler::readBufAdd | ( | MemoryHandle | mem, | |
| UInt32 | size, | |||
| UInt32 | dataSize = 0 | |||
| ) | [protected, inherited] |
Definition at line 290 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_readBuffers, and osg::BinaryDataHandler::readBufEnd().
Referenced by osg::BINLoader::BinaryFileHandler::BinaryFileHandler(), osg::GroupSockConnection::GroupSockConnection(), osg::PointSockConnection::PointSockConnection(), and osg::GroupSockConnection::setParams().
00293 { 00294 MemoryBlock memBlock(mem, size, dataSize); 00295 00296 _readBuffers.push_back(memBlock); 00297 00298 _currentReadBuffer = readBufEnd(); 00299 }
| void BinaryDataHandler::readBufClear | ( | void | ) | [protected, inherited] |
Definition at line 301 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_readBuffers, and osg::BinaryDataHandler::readBufEnd().
Referenced by osg::GroupSockConnection::setParams().
00302 { 00303 _readBuffers.clear(); 00304 00305 _currentReadBuffer=readBufEnd(); 00306 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::writeBufBegin | ( | void | ) | [inline, protected, inherited] |
Definition at line 824 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_writeBuffers.
Referenced by osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::writeBufAdd(), osg::PointSockConnection::writeBuffer(), osg::GroupSockPipeline::writeBuffer(), osg::GroupSockConnection::writeBuffer(), osg::GroupMCastConnection::writeBuffer(), and osg::BinaryDataHandler::writeBuffer().
00825 { 00826 return _writeBuffers.begin(); 00827 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::writeBufEnd | ( | void | ) | [inline, protected, inherited] |
Definition at line 830 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_writeBuffers.
Referenced by osg::BinaryDataHandler::flush(), osg::BinaryDataHandler::put(), osg::BinaryDataHandler::writeBufClear(), and osg::BinaryDataHandler::writeBuffer().
00831 { 00832 return _writeBuffers.end(); 00833 }
| void BinaryDataHandler::writeBufAdd | ( | MemoryHandle | mem, | |
| UInt32 | size, | |||
| UInt32 | dataSize = 0 | |||
| ) | [protected, inherited] |
Definition at line 311 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_currentWriteBufferPos, osg::BinaryDataHandler::_writeBuffers, and osg::BinaryDataHandler::writeBufBegin().
Referenced by osg::BINWriter::BinaryFileHandler::BinaryFileHandler(), osg::GroupSockConnection::GroupSockConnection(), osg::PointSockConnection::PointSockConnection(), and osg::GroupSockConnection::setParams().
00314 { 00315 MemoryBlock memBlock(mem, size, dataSize); 00316 00317 _writeBuffers.push_back(memBlock); 00318 00319 _currentWriteBuffer = writeBufBegin(); 00320 _currentWriteBufferPos = 0; 00321 }
| void BinaryDataHandler::writeBufClear | ( | void | ) | [protected, inherited] |
Definition at line 323 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_writeBuffers, and osg::BinaryDataHandler::writeBufEnd().
Referenced by osg::GroupSockConnection::setParams().
00324 { 00325 _writeBuffers.clear(); 00326 00327 _currentWriteBuffer = writeBufEnd(); 00328 }
| bool BinaryDataHandler::isReadBufferEmpty | ( | void | ) | [protected, inherited] |
check for data in read buffer
Definition at line 431 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_zeroCopyThreshold, and osg::BinaryDataHandler::readBufEnd().
Referenced by selectChannel().
00432 { 00433 if(_zeroCopyThreshold == 1) 00434 return true; 00435 if(_currentReadBuffer == readBufEnd()) 00436 return true; 00437 return false; 00438 }
DgramSocket osg::PointMCastConnection::_mcastSocket [protected] |
Definition at line 138 of file OSGPointMCastConnection.h.
Referenced by initialize(), recvNextDgram(), recvQueue(), selectChannel(), and ~PointMCastConnection().
Definition at line 139 of file OSGPointMCastConnection.h.
Referenced by combineAck(), initialize(), recvNextDgram(), and recvQueue().
BaseThread* osg::PointMCastConnection::_recvQueueThread [protected] |
Definition at line 140 of file OSGPointMCastConnection.h.
Referenced by initialize(), and ~PointMCastConnection().
bool osg::PointMCastConnection::_recvQueueThreadRunning [protected] |
Definition at line 141 of file OSGPointMCastConnection.h.
Referenced by initialize(), and recvQueueThread().
bool osg::PointMCastConnection::_recvQueueThreadStop [protected] |
Definition at line 142 of file OSGPointMCastConnection.h.
Referenced by initialize(), recvQueue(), and ~PointMCastConnection().
UInt16 osg::PointMCastConnection::_seqNumber [protected] |
Definition at line 143 of file OSGPointMCastConnection.h.
Referenced by combineAck(), initialize(), and recvQueue().
Definition at line 144 of file OSGPointMCastConnection.h.
DgramQueue osg::PointMCastConnection::_queue [protected] |
Definition at line 145 of file OSGPointMCastConnection.h.
Referenced by read(), readBuffer(), recvQueue(), selectChannel(), and ~PointMCastConnection().
DgramQueue osg::PointMCastConnection::_free [protected] |
Definition at line 146 of file OSGPointMCastConnection.h.
Referenced by PointMCastConnection(), read(), readBuffer(), recvQueue(), and ~PointMCastConnection().
Lock* osg::PointMCastConnection::_lock [protected] |
Definition at line 147 of file OSGPointMCastConnection.h.
Referenced by PointMCastConnection(), read(), readBuffer(), recvQueue(), selectChannel(), and ~PointMCastConnection().
SocketAddress osg::PointMCastConnection::_sender [protected] |
Definition at line 148 of file OSGPointMCastConnection.h.
Referenced by initialize(), recvNextDgram(), and recvQueue().
Definition at line 149 of file OSGPointMCastConnection.h.
Referenced by combineAck(), initialize(), recvNextDgram(), and recvQueue().
Dgram* osg::PointMCastConnection::_lastDgram [protected] |
Definition at line 150 of file OSGPointMCastConnection.h.
Referenced by read(), readBuffer(), and selectChannel().
UInt32 osg::PointMCastConnection::_lastDgramPos [protected] |
bool osg::PointMCastConnection::_initialized [protected] |
Definition at line 152 of file OSGPointMCastConnection.h.
Referenced by initialize(), read(), readBuffer(), and selectChannel().
std::map<SocketAddress,UInt16> osg::PointMCastConnection::_combineAck [protected] |
Definition at line 153 of file OSGPointMCastConnection.h.
Referenced by combineAck(), initialize(), recvNextDgram(), and recvQueue().
UInt16 osg::PointMCastConnection::_maxAck [protected] |
Definition at line 154 of file OSGPointMCastConnection.h.
Referenced by combineAck(), initialize(), recvNextDgram(), and recvQueue().
ConnectionType osg::PointMCastConnection::_type [static, private] |
Reimplemented from osg::PointSockConnection.
Definition at line 176 of file OSGPointMCastConnection.h.
Referenced by getType().
StreamSocket osg::PointSockConnection::_acceptSocket [protected, inherited] |
Definition at line 142 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::bind(), PointMCastConnection(), osg::PointSockConnection::PointSockConnection(), ~PointMCastConnection(), and osg::PointSockConnection::~PointSockConnection().
StreamSocket osg::PointSockConnection::_socket [protected, inherited] |
Definition at line 143 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::connectGroup(), osg::PointSockConnection::connectPoint(), osg::PointSockPipeline::disconnect(), osg::PointSockConnection::disconnect(), disconnect(), osg::PointSockPipeline::initialize(), initialize(), osg::PointSockConnection::read(), osg::PointSockConnection::readBuffer(), recvQueue(), osg::PointSockConnection::selectChannel(), osg::PointSockConnection::signal(), osg::PointSockConnection::wait(), osg::PointSockConnection::write(), and osg::PointSockConnection::writeBuffer().
SocketAddress osg::PointSockConnection::_remoteAddress [protected, inherited] |
Definition at line 144 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::connectGroup(), osg::PointSockConnection::connectPoint(), and initialize().
std::vector<UInt8> osg::PointSockConnection::_socketReadBuffer [protected, inherited] |
Definition at line 145 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::PointSockConnection(), osg::PointSockPipeline::readBuffer(), and osg::PointSockConnection::readBuffer().
std::vector<UInt8> osg::PointSockConnection::_socketWriteBuffer [protected, inherited] |
Definition at line 146 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::PointSockConnection(), and osg::PointSockConnection::writeBuffer().
bool osg::PointConnection::_pointToPoint [protected, inherited] |
Definition at line 103 of file OSGPointConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::connectGroup(), osg::PointSockConnection::connectPoint(), read(), readBuffer(), selectChannel(), and wait().
std::string osg::Connection::_interface [protected, inherited] |
Definition at line 139 of file OSGConnection.h.
Referenced by osg::Connection::getInterface(), and osg::Connection::setInterface().
BuffersT osg::BinaryDataHandler::_readBuffers [protected, inherited] |
Definition at line 220 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::readBufAdd(), osg::BinaryDataHandler::readBufBegin(), osg::BinaryDataHandler::readBufClear(), and osg::BinaryDataHandler::readBufEnd().
BuffersT osg::BinaryDataHandler::_writeBuffers [protected, inherited] |
Definition at line 221 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::writeBufAdd(), osg::BinaryDataHandler::writeBufBegin(), osg::BinaryDataHandler::writeBufClear(), and osg::BinaryDataHandler::writeBufEnd().
BuffersT osg::BinaryDataHandler::_zeroCopyBuffers [protected, inherited] |
Definition at line 222 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::pushBuffer(), and osg::BinaryDataHandler::put().
UInt32 osg::BinaryDataHandler::_zeroCopyThreshold [protected, inherited] |
Definition at line 223 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::forceCopy(), osg::BinaryDataHandler::forceDirectIO(), osg::BinaryDataHandler::get(), osg::BinaryDataHandler::isReadBufferEmpty(), osg::BinaryDataHandler::put(), osg::BinaryDataHandler::putAndFree(), and osg::GroupSockConnection::selectChannel().
FreeMemT osg::BinaryDataHandler::_freeMem [protected, inherited] |
Definition at line 225 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::freeMem(), and osg::BinaryDataHandler::putAndFree().
BuffersT::iterator osg::BinaryDataHandler::_currentReadBuffer [protected, inherited] |
Definition at line 226 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::get(), osg::BinaryDataHandler::isReadBufferEmpty(), osg::BinaryDataHandler::pullBuffer(), osg::BinaryDataHandler::readBufAdd(), osg::BinaryDataHandler::readBufClear(), and osg::GroupSockConnection::selectChannel().
UInt32 osg::BinaryDataHandler::_currentReadBufferPos [protected, inherited] |
Definition at line 227 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::get(), and osg::BinaryDataHandler::pullBuffer().
BuffersT::iterator osg::BinaryDataHandler::_currentWriteBuffer [protected, inherited] |
Definition at line 228 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::flush(), osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::put(), osg::BinaryDataHandler::writeBufAdd(), and osg::BinaryDataHandler::writeBufClear().
UInt32 osg::BinaryDataHandler::_currentWriteBufferPos [protected, inherited] |
Definition at line 229 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::flush(), osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::writeBufAdd().
bool osg::BinaryDataHandler::_networkOrder [protected, inherited] |
Definition at line 231 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::getNetworkOrder(), osg::BinaryDataHandler::getValues(), osg::BinaryDataHandler::putValues(), and osg::BinaryDataHandler::setNetworkOrder().
1.5.5