OpenDDS::DCPS::MulticastReceiveStrategy Class Reference

#include <MulticastReceiveStrategy.h>

Inheritance diagram for OpenDDS::DCPS::MulticastReceiveStrategy:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::MulticastReceiveStrategy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MulticastReceiveStrategy (MulticastDataLink *link)
virtual ACE_HANDLE get_handle () const
virtual int handle_input (ACE_HANDLE fd)

Protected Member Functions

virtual ssize_t receive_bytes (iovec iov[], int n, ACE_INET_Addr &remote_address, ACE_HANDLE fd)
 Only our subclass knows how to do this.
virtual bool check_header (const TransportHeader &header)
virtual bool check_header (const DataSampleHeader &header)
virtual void deliver_sample (ReceivedDataSample &sample, const ACE_INET_Addr &remote_address)
 Called when there is a ReceivedDataSample to be delivered.
virtual int start_i ()
 Let the subclass start.
virtual void stop_i ()
 Let the subclass stop.
virtual bool reassemble (ReceivedDataSample &data)

Private Attributes

MulticastDataLinklink_

Detailed Description

Definition at line 22 of file MulticastReceiveStrategy.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::MulticastReceiveStrategy::MulticastReceiveStrategy ( MulticastDataLink link  )  [explicit]

Definition at line 16 of file MulticastReceiveStrategy.cpp.

00017   : link_(link)
00018 {
00019 }


Member Function Documentation

bool OpenDDS::DCPS::MulticastReceiveStrategy::check_header ( const DataSampleHeader header  )  [protected, virtual]

Definition at line 57 of file MulticastReceiveStrategy.cpp.

References OpenDDS::DCPS::MulticastDataLink::check_header(), header, and link_.

00058 {
00059   return this->link_->check_header(header);
00060 }

bool OpenDDS::DCPS::MulticastReceiveStrategy::check_header ( const TransportHeader header  )  [protected, virtual]

Definition at line 51 of file MulticastReceiveStrategy.cpp.

References OpenDDS::DCPS::MulticastDataLink::check_header(), header, and link_.

00052 {
00053   return this->link_->check_header(header);
00054 }

void OpenDDS::DCPS::MulticastReceiveStrategy::deliver_sample ( ReceivedDataSample sample,
const ACE_INET_Addr &  remote_address 
) [protected, virtual]

Called when there is a ReceivedDataSample to be delivered.

Implements OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >.

Definition at line 63 of file MulticastReceiveStrategy.cpp.

References link_, and OpenDDS::DCPS::MulticastDataLink::sample_received().

00065 {
00066   this->link_->sample_received(sample);
00067 }

ACE_HANDLE OpenDDS::DCPS::MulticastReceiveStrategy::get_handle (  )  const [virtual]

Definition at line 22 of file MulticastReceiveStrategy.cpp.

References link_, and OpenDDS::DCPS::MulticastDataLink::socket().

00023 {
00024   ACE_SOCK_Dgram_Mcast& socket = this->link_->socket();
00025   return socket.get_handle();
00026 }

int OpenDDS::DCPS::MulticastReceiveStrategy::handle_input ( ACE_HANDLE  fd  )  [virtual]

Definition at line 29 of file MulticastReceiveStrategy.cpp.

References OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >::handle_dds_input(), OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >::reset(), and VDBG_LVL.

00030 {
00031   const int result = this->handle_dds_input(fd);
00032   if (result >= 0 && this->pdu_remaining()) {
00033     VDBG_LVL((LM_DEBUG, "(%P|%t) MulticastReceiveStrategy[%@]::handle_input "
00034       "resetting with %B bytes remaining\n", this, this->pdu_remaining()), 4);
00035     this->reset();
00036   }
00037   return result;
00038 }

bool OpenDDS::DCPS::MulticastReceiveStrategy::reassemble ( ReceivedDataSample data  )  [protected, virtual]

Reimplemented from OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >.

Definition at line 70 of file MulticastReceiveStrategy.cpp.

References link_, OpenDDS::DCPS::MulticastDataLink::reassemble(), and OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >::received_header().

00071 {
00072   return this->link_->reassemble(data, received_header());
00073 }

ssize_t OpenDDS::DCPS::MulticastReceiveStrategy::receive_bytes ( iovec  iov[],
int  n,
ACE_INET_Addr &  remote_address,
ACE_HANDLE  fd 
) [protected, virtual]

Only our subclass knows how to do this.

Implements OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >.

Definition at line 41 of file MulticastReceiveStrategy.cpp.

References link_, and OpenDDS::DCPS::MulticastDataLink::socket().

00045 {
00046   ACE_SOCK_Dgram_Mcast& socket = this->link_->socket();
00047   return socket.recv(iov, n, remote_address);
00048 }

int OpenDDS::DCPS::MulticastReceiveStrategy::start_i (  )  [protected, virtual]

Let the subclass start.

Implements OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >.

Definition at line 76 of file MulticastReceiveStrategy.cpp.

References OpenDDS::DCPS::MulticastDataLink::get_reactor(), and link_.

00077 {
00078   ACE_Reactor* reactor = this->link_->get_reactor();
00079   if (reactor == 0) {
00080     ACE_ERROR_RETURN((LM_ERROR,
00081                       ACE_TEXT("(%P|%t) ERROR: ")
00082                       ACE_TEXT("MulticastReceiveStrategy::start_i: ")
00083                       ACE_TEXT("NULL reactor reference!\n")),
00084                      -1);
00085   }
00086 
00087   if (reactor->register_handler(this, ACE_Event_Handler::READ_MASK) != 0) {
00088     ACE_ERROR_RETURN((LM_ERROR,
00089                       ACE_TEXT("(%P|%t) ERROR: ")
00090                       ACE_TEXT("MulticastReceiveStrategy::start_i: ")
00091                       ACE_TEXT("failed to register handler for DataLink!\n")),
00092                      -1);
00093   }
00094 
00095   return 0;
00096 }

void OpenDDS::DCPS::MulticastReceiveStrategy::stop_i (  )  [protected, virtual]

Let the subclass stop.

Implements OpenDDS::DCPS::TransportReceiveStrategy< TH, DSH >.

Definition at line 99 of file MulticastReceiveStrategy.cpp.

References OpenDDS::DCPS::MulticastDataLink::get_reactor(), and link_.

00100 {
00101   ACE_Reactor* reactor = this->link_->get_reactor();
00102   if (reactor == 0) {
00103     ACE_ERROR((LM_ERROR,
00104                ACE_TEXT("(%P|%t) ERROR: ")
00105                ACE_TEXT("MulticastReceiveStrategy::stop_i: ")
00106                ACE_TEXT("NULL reactor reference!\n")));
00107     return;
00108   }
00109 
00110   reactor->remove_handler(this, ACE_Event_Handler::READ_MASK);
00111 }


Member Data Documentation

MulticastDataLink* OpenDDS::DCPS::MulticastReceiveStrategy::link_ [private]

Definition at line 49 of file MulticastReceiveStrategy.h.

Referenced by check_header(), deliver_sample(), get_handle(), reassemble(), receive_bytes(), start_i(), and stop_i().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:34 2016 for OpenDDS by  doxygen 1.4.7