Groupsock Class Reference

#include <Groupsock.hh>

Inheritance diagram for Groupsock:

Inheritance graph
[legend]
Collaboration diagram for Groupsock:

Collaboration graph
[legend]

Public Member Functions

 Groupsock (UsageEnvironment &env, struct in_addr const &groupAddr, Port port, u_int8_t ttl)
 Groupsock (UsageEnvironment &env, struct in_addr const &groupAddr, struct in_addr const &sourceFilterAddr, Port port)
virtual ~Groupsock ()
void changeDestinationParameters (struct in_addr const &newDestAddr, Port newDestPort, int newDestTTL)
void addDestination (struct in_addr const &addr, Port const &port)
void removeDestination (struct in_addr const &addr, Port const &port)
void removeAllDestinations ()
in_addr const & groupAddress () const
in_addr const & sourceFilterAddress () const
Boolean isSSM () const
u_int8_t ttl () const
void multicastSendOnly ()
Boolean output (UsageEnvironment &env, u_int8_t ttl, unsigned char *buffer, unsigned bufferSize, DirectedNetInterface *interfaceNotToFwdBackTo=NULL)
DirectedNetInterfaceSetmembers ()
Boolean wasLoopedBackFromUs (UsageEnvironment &env, struct sockaddr_in &fromAddress)
virtual Boolean handleRead (unsigned char *buffer, unsigned bufferMaxSize, unsigned &bytesRead, struct sockaddr_in &fromAddress)
Boolean write (netAddressBits address, Port port, u_int8_t ttl, unsigned char *buffer, unsigned bufferSize)
int socketNum () const
Port port () const
UsageEnvironmentenv () const

Data Fields

Boolean deleteIfNoMembers
Boolean isSlave
NetInterfaceTrafficStats statsGroupIncoming
NetInterfaceTrafficStats statsGroupOutgoing
NetInterfaceTrafficStats statsGroupRelayedIncoming
NetInterfaceTrafficStats statsGroupRelayedOutgoing

Static Public Attributes

static NetInterfaceTrafficStats statsIncoming
static NetInterfaceTrafficStats statsOutgoing
static NetInterfaceTrafficStats statsRelayedIncoming
static NetInterfaceTrafficStats statsRelayedOutgoing
static int DebugLevel = 1
static UsageEnvironmentDefaultUsageEnvironment = NULL

Protected Member Functions

portNumBits sourcePortNum () const
Boolean changePort (Port newPort)

Private Member Functions

int outputToAllMembersExcept (DirectedNetInterface *exceptInterface, u_int8_t ttlToFwd, unsigned char *data, unsigned size, netAddressBits sourceAddr)

Private Attributes

GroupEId fIncomingGroupEId
destRecordfDests
u_int8_t fTTL
DirectedNetInterfaceSet fMembers

Detailed Description

Definition at line 78 of file Groupsock.hh.


Constructor & Destructor Documentation

Groupsock::Groupsock ( UsageEnvironment env,
struct in_addr const &  groupAddr,
Port  port,
u_int8_t  ttl 
)

Definition at line 102 of file Groupsock.cpp.

References addDestination(), Socket::DebugLevel, Socket::env(), UsageEnvironment::getResultMsg(), ourIPAddress(), Socket::port(), socketJoinGroup(), and Socket::socketNum().

00104   : OutputSocket(env, port),
00105     deleteIfNoMembers(False), isSlave(False),
00106     fIncomingGroupEId(groupAddr, port.num(), ttl), fDests(NULL), fTTL(ttl) {
00107   addDestination(groupAddr, port);
00108 
00109   if (!socketJoinGroup(env, socketNum(), groupAddr.s_addr)) {
00110     if (DebugLevel >= 1) {
00111       env << *this << ": failed to join group: "
00112           << env.getResultMsg() << "\n";
00113     }
00114   }
00115 
00116   // Make sure we can get our source address:
00117   if (ourIPAddress(env) == 0) {
00118     if (DebugLevel >= 0) { // this is a fatal error
00119       env << "Unable to determine our source address: "
00120           << env.getResultMsg() << "\n";
00121     }
00122   }
00123 
00124   if (DebugLevel >= 2) env << *this << ": created\n";
00125 }

Groupsock::Groupsock ( UsageEnvironment env,
struct in_addr const &  groupAddr,
struct in_addr const &  sourceFilterAddr,
Port  port 
)

Definition at line 128 of file Groupsock.cpp.

References addDestination(), Socket::DebugLevel, Socket::env(), UsageEnvironment::getResultMsg(), Socket::port(), socketJoinGroup(), socketJoinGroupSSM(), and Socket::socketNum().

00131   : OutputSocket(env, port),
00132     deleteIfNoMembers(False), isSlave(False),
00133     fIncomingGroupEId(groupAddr, sourceFilterAddr, port.num()),
00134     fDests(NULL), fTTL(255) {
00135   addDestination(groupAddr, port);
00136 
00137   // First try a SSM join.  If that fails, try a regular join:
00138   if (!socketJoinGroupSSM(env, socketNum(), groupAddr.s_addr,
00139                           sourceFilterAddr.s_addr)) {
00140     if (DebugLevel >= 3) {
00141       env << *this << ": SSM join failed: "
00142           << env.getResultMsg();
00143       env << " - trying regular join instead\n";
00144     }
00145     if (!socketJoinGroup(env, socketNum(), groupAddr.s_addr)) {
00146       if (DebugLevel >= 1) {
00147         env << *this << ": failed to join group: "
00148              << env.getResultMsg() << "\n";
00149       }
00150     }
00151   }
00152 
00153   if (DebugLevel >= 2) env << *this << ": created\n";
00154 }

Groupsock::~Groupsock (  )  [virtual]

Definition at line 156 of file Groupsock.cpp.

References Socket::DebugLevel, Socket::env(), fDests, groupAddress(), isSSM(), socketLeaveGroup(), socketLeaveGroupSSM(), Socket::socketNum(), and sourceFilterAddress().

00156                       {
00157   if (isSSM()) {
00158     if (!socketLeaveGroupSSM(env(), socketNum(), groupAddress().s_addr,
00159                              sourceFilterAddress().s_addr)) {
00160       socketLeaveGroup(env(), socketNum(), groupAddress().s_addr);
00161     }
00162   } else {
00163     socketLeaveGroup(env(), socketNum(), groupAddress().s_addr);
00164   }
00165 
00166   delete fDests;
00167 
00168   if (DebugLevel >= 2) env() << *this << ": deleting\n";
00169 }


Member Function Documentation

void Groupsock::changeDestinationParameters ( struct in_addr const &  newDestAddr,
Port  newDestPort,
int  newDestTTL 
)

Definition at line 172 of file Groupsock.cpp.

References Socket::changePort(), Socket::env(), fDests, destRecord::fGroupEId, destRecord::fPort, GroupEId::groupAddress(), IsMulticastAddress(), NULL, Port::num(), GroupEId::portNum(), socketJoinGroup(), socketLeaveGroup(), Socket::socketNum(), and ttl().

Referenced by PassiveServerMediaSubsession::getStreamParameters(), MediaSubsession::initiate(), main(), SIPClient::processURL(), MediaSubsession::setDestinations(), and SIPClient::setProxyServer().

00173                                                                          {
00174   if (fDests == NULL) return;
00175 
00176   struct in_addr destAddr = fDests->fGroupEId.groupAddress();
00177   if (newDestAddr.s_addr != 0) {
00178     if (newDestAddr.s_addr != destAddr.s_addr
00179         && IsMulticastAddress(newDestAddr.s_addr)) {
00180       // If the new destination is a multicast address, then we assume that
00181       // we want to join it also.  (If this is not in fact the case, then
00182       // call "multicastSendOnly()" afterwards.)
00183       socketLeaveGroup(env(), socketNum(), destAddr.s_addr);
00184       socketJoinGroup(env(), socketNum(), newDestAddr.s_addr);
00185     }
00186     destAddr.s_addr = newDestAddr.s_addr;
00187   }
00188 
00189   portNumBits destPortNum = fDests->fGroupEId.portNum();
00190   if (newDestPort.num() != 0) {
00191     if (newDestPort.num() != destPortNum
00192         && IsMulticastAddress(destAddr.s_addr)) {
00193       // Also bind to the new port number:
00194       changePort(newDestPort);
00195       // And rejoin the multicast group:
00196       socketJoinGroup(env(), socketNum(), destAddr.s_addr);
00197     }
00198     destPortNum = newDestPort.num();
00199     fDests->fPort = newDestPort;
00200   }
00201 
00202   u_int8_t destTTL = ttl();
00203   if (newDestTTL != ~0) destTTL = (u_int8_t)newDestTTL;
00204 
00205   fDests->fGroupEId = GroupEId(destAddr, destPortNum, destTTL);
00206 }

void Groupsock::addDestination ( struct in_addr const &  addr,
Port const &  port 
)

Definition at line 208 of file Groupsock.cpp.

References fDests, NULL, Port::num(), Socket::port(), and ttl().

Referenced by Groupsock(), and StreamState::startPlaying().

00208                                                                            {
00209   // Check whether this destination is already known:
00210   for (destRecord* dests = fDests; dests != NULL; dests = dests->fNext) {
00211     if (addr.s_addr == dests->fGroupEId.groupAddress().s_addr
00212         && port.num() == dests->fPort.num()) {
00213       return;
00214     }
00215   }
00216 
00217   fDests = new destRecord(addr, port, ttl(), fDests);
00218 }

void Groupsock::removeDestination ( struct in_addr const &  addr,
Port const &  port 
)

Definition at line 220 of file Groupsock.cpp.

References fDests, NULL, Port::num(), and Socket::port().

Referenced by StreamState::endPlaying().

00220                                                                               {
00221   for (destRecord** destsPtr = &fDests; *destsPtr != NULL;
00222        destsPtr = &((*destsPtr)->fNext)) {
00223     if (addr.s_addr == (*destsPtr)->fGroupEId.groupAddress().s_addr
00224         && port.num() == (*destsPtr)->fPort.num()) {
00225       // Remove the record pointed to by *destsPtr :
00226       destRecord* next = (*destsPtr)->fNext;
00227       (*destsPtr)->fNext = NULL;
00228       delete (*destsPtr);
00229       *destsPtr = next;
00230       return;
00231     }
00232   }
00233 }

void Groupsock::removeAllDestinations (  ) 

Definition at line 235 of file Groupsock.cpp.

References fDests, and NULL.

Referenced by OnDemandServerMediaSubsession::getStreamParameters(), and RTPInterface::setStreamSocket().

00235                                       {
00236   delete fDests; fDests = NULL;
00237 }

struct in_addr const& Groupsock::groupAddress (  )  const [inline, read]

Definition at line 104 of file Groupsock.hh.

References fIncomingGroupEId, and GroupEId::groupAddress().

Referenced by PassiveServerMediaSubsession::getStreamParameters(), operator<<(), GroupsockLookupTable::Remove(), PassiveServerMediaSubsession::sdpLines(), and ~Groupsock().

00104                                              {
00105     return fIncomingGroupEId.groupAddress();
00106   }

struct in_addr const& Groupsock::sourceFilterAddress (  )  const [inline, read]

Definition at line 107 of file Groupsock.hh.

References fIncomingGroupEId, and GroupEId::sourceFilterAddress().

Referenced by handleRead(), operator<<(), outputToAllMembersExcept(), GroupsockLookupTable::Remove(), and ~Groupsock().

00107                                                     {
00108     return fIncomingGroupEId.sourceFilterAddress();
00109   }

Boolean Groupsock::isSSM (  )  const [inline]

Definition at line 111 of file Groupsock.hh.

References fIncomingGroupEId, and GroupEId::isSSM().

Referenced by handleRead(), operator<<(), outputToAllMembersExcept(), and ~Groupsock().

00111                         {
00112     return fIncomingGroupEId.isSSM();
00113   }

u_int8_t Groupsock::ttl (  )  const [inline]

Definition at line 115 of file Groupsock.hh.

References fTTL.

Referenced by addDestination(), BasicUDPSink::afterGettingFrame1(), changeDestinationParameters(), PassiveServerMediaSubsession::getStreamParameters(), handleRead(), operator<<(), PassiveServerMediaSubsession::sdpLines(), and RTPInterface::sendPacket().

00115 { return fTTL; }

void Groupsock::multicastSendOnly (  ) 

Definition at line 239 of file Groupsock.cpp.

References Socket::env(), fDests, fIncomingGroupEId, GroupEId::groupAddress(), NULL, socketLeaveGroup(), and Socket::socketNum().

Referenced by main(), and RTCPInstance::RTCPInstance().

00239                                   {
00240   // We disable this code for now, because - on some systems - leaving the multicast group seems to cause sent packets
00241   // to not be received by other applications (at least, on the same host).
00242 #if 0
00243   socketLeaveGroup(env(), socketNum(), fIncomingGroupEId.groupAddress().s_addr);
00244   for (destRecord* dests = fDests; dests != NULL; dests = dests->fNext) {
00245     socketLeaveGroup(env(), socketNum(), dests->fGroupEId.groupAddress().s_addr);
00246   }
00247 #endif
00248 }

Boolean Groupsock::output ( UsageEnvironment env,
u_int8_t  ttl,
unsigned char *  buffer,
unsigned  bufferSize,
DirectedNetInterface interfaceNotToFwdBackTo = NULL 
)

Definition at line 250 of file Groupsock.cpp.

References NetInterfaceTrafficStats::countPacket(), Socket::DebugLevel, Socket::env(), False, fDests, UsageEnvironment::getResultMsg(), members(), NULL, ourIPAddress(), outputToAllMembersExcept(), UsageEnvironment::setResultMsg(), statsGroupOutgoing, statsOutgoing, True, and OutputSocket::write().

Referenced by BasicUDPSink::afterGettingFrame1(), RTSPClient::handleSETUPResponse(), RTPInterface::sendPacket(), SIPClient::sendRequest(), and SIPClient::SIPClient().

00252                                                                          {
00253   do {
00254     // First, do the datagram send, to each destination:
00255     Boolean writeSuccess = True;
00256     for (destRecord* dests = fDests; dests != NULL; dests = dests->fNext) {
00257       if (!write(dests->fGroupEId.groupAddress().s_addr, dests->fPort, ttlToSend,
00258                  buffer, bufferSize)) {
00259         writeSuccess = False;
00260         break;
00261       }
00262     }
00263     if (!writeSuccess) break;
00264     statsOutgoing.countPacket(bufferSize);
00265     statsGroupOutgoing.countPacket(bufferSize);
00266 
00267     // Then, forward to our members:
00268     int numMembers = 0;
00269     if (!members().IsEmpty()) {
00270       numMembers =
00271         outputToAllMembersExcept(interfaceNotToFwdBackTo,
00272                                  ttlToSend, buffer, bufferSize,
00273                                  ourIPAddress(env));
00274       if (numMembers < 0) break;
00275     }
00276 
00277     if (DebugLevel >= 3) {
00278       env << *this << ": wrote " << bufferSize << " bytes, ttl "
00279           << (unsigned)ttlToSend;
00280       if (numMembers > 0) {
00281         env << "; relayed to " << numMembers << " members";
00282       }
00283       env << "\n";
00284     }
00285     return True;
00286   } while (0);
00287 
00288   if (DebugLevel >= 0) { // this is a fatal error
00289     env.setResultMsg("Groupsock write failed: ", env.getResultMsg());
00290   }
00291   return False;
00292 }

DirectedNetInterfaceSet& Groupsock::members (  )  [inline]

Definition at line 123 of file Groupsock.hh.

References fMembers.

Referenced by output(), and outputToAllMembersExcept().

00123 { return fMembers; }

Boolean Groupsock::wasLoopedBackFromUs ( UsageEnvironment env,
struct sockaddr_in &  fromAddress 
)

Definition at line 348 of file Groupsock.cpp.

References Socket::DebugLevel, Socket::env(), False, ourIPAddress(), OutputSocket::sourcePortNum(), and True.

Referenced by handleRead().

00349                                                                         {
00350   if (fromAddress.sin_addr.s_addr
00351       == ourIPAddress(env)) {
00352     if (fromAddress.sin_port == sourcePortNum()) {
00353 #ifdef DEBUG_LOOPBACK_CHECKING
00354       if (DebugLevel >= 3) {
00355         env() << *this << ": got looped-back packet\n";
00356       }
00357 #endif
00358       return True;
00359     }
00360   }
00361 
00362   return False;
00363 }

Boolean Groupsock::handleRead ( unsigned char *  buffer,
unsigned  bufferMaxSize,
unsigned &  bytesRead,
struct sockaddr_in &  fromAddress 
) [virtual]

Reimplemented from OutputSocket.

Definition at line 294 of file Groupsock.cpp.

References NetInterfaceTrafficStats::countPacket(), Socket::DebugLevel, Socket::env(), False, isSSM(), NULL, outputToAllMembersExcept(), readSocket(), UsageEnvironment::setResultMsg(), Socket::socketNum(), sourceFilterAddress(), statsGroupIncoming, statsGroupRelayedIncoming, statsIncoming, statsRelayedIncoming, True, ttl(), TunnelEncapsulationTrailerMaxSize, and wasLoopedBackFromUs().

Referenced by SIPClient::getResponse(), SIPClient::getResponseCode(), RTPInterface::handleRead(), BasicUDPSource::incomingPacketHandler1(), and main().

00296                                                                {
00297   // Read data from the socket, and relay it across any attached tunnels
00298   //##### later make this code more general - independent of tunnels
00299 
00300   bytesRead = 0;
00301 
00302   int maxBytesToRead = bufferMaxSize - TunnelEncapsulationTrailerMaxSize;
00303   int numBytes = readSocket(env(), socketNum(),
00304                             buffer, maxBytesToRead, fromAddress);
00305   if (numBytes < 0) {
00306     if (DebugLevel >= 0) { // this is a fatal error
00307       env().setResultMsg("Groupsock read failed: ",
00308                          env().getResultMsg());
00309     }
00310     return False;
00311   }
00312 
00313   // If we're a SSM group, make sure the source address matches:
00314   if (isSSM()
00315       && fromAddress.sin_addr.s_addr != sourceFilterAddress().s_addr) {
00316     return True;
00317   }
00318 
00319   // We'll handle this data.
00320   // Also write it (with the encapsulation trailer) to each member,
00321   // unless the packet was originally sent by us to begin with.
00322   bytesRead = numBytes;
00323 
00324   int numMembers = 0;
00325   if (!wasLoopedBackFromUs(env(), fromAddress)) {
00326     statsIncoming.countPacket(numBytes);
00327     statsGroupIncoming.countPacket(numBytes);
00328     numMembers =
00329       outputToAllMembersExcept(NULL, ttl(),
00330                                buffer, bytesRead,
00331                                fromAddress.sin_addr.s_addr);
00332     if (numMembers > 0) {
00333       statsRelayedIncoming.countPacket(numBytes);
00334       statsGroupRelayedIncoming.countPacket(numBytes);
00335     }
00336   }
00337   if (DebugLevel >= 3) {
00338     env() << *this << ": read " << bytesRead << " bytes from " << AddressString(fromAddress).val();
00339     if (numMembers > 0) {
00340       env() << "; relayed to " << numMembers << " members";
00341     }
00342     env() << "\n";
00343   }
00344 
00345   return True;
00346 }

int Groupsock::outputToAllMembersExcept ( DirectedNetInterface exceptInterface,
u_int8_t  ttlToFwd,
unsigned char *  data,
unsigned  size,
netAddressBits  sourceAddr 
) [private]

Definition at line 365 of file Groupsock.cpp.

References TunnelEncapsulationTrailer::address(), TunnelEncapsulationTrailer::auxAddress(), TunnelEncapsulationTrailer::command(), Socket::env(), fDests, destRecord::fGroupEId, destRecord::fPort, UsageEnvironment::getResultMsg(), GroupEId::groupAddress(), isSSM(), iter, members(), MediaSubsessionIterator::next(), NULL, TunnelEncapsulationTrailer::port(), DirectedNetInterface::SourceAddrOKForRelaying(), sourceFilterAddress(), TunnelEncapsulationTrailer::ttl(), TunnelDataAuxCmd, TunnelDataCmd, TunnelEncapsulationTrailerAuxSize, TunnelEncapsulationTrailerMaxSize, TunnelEncapsulationTrailerSize, and DirectedNetInterface::write().

Referenced by handleRead(), and output().

00368                                                                    {
00369   // Don't forward TTL-0 packets
00370   if (ttlToFwd == 0) return 0;
00371 
00372   DirectedNetInterfaceSet::Iterator iter(members());
00373   unsigned numMembers = 0;
00374   DirectedNetInterface* interf;
00375   while ((interf = iter.next()) != NULL) {
00376     // Check whether we've asked to exclude this interface:
00377     if (interf == exceptInterface)
00378       continue;
00379 
00380     // Check that the packet's source address makes it OK to
00381     // be relayed across this interface:
00382     UsageEnvironment& saveEnv = env();
00383     // because the following call may delete "this"
00384     if (!interf->SourceAddrOKForRelaying(saveEnv, sourceAddr)) {
00385       if (strcmp(saveEnv.getResultMsg(), "") != 0) {
00386                                 // Treat this as a fatal error
00387         return -1;
00388       } else {
00389         continue;
00390       }
00391     }
00392 
00393     if (numMembers == 0) {
00394       // We know that we're going to forward to at least one
00395       // member, so fill in the tunnel encapsulation trailer.
00396       // (Note: Allow for it not being 4-byte-aligned.)
00397       TunnelEncapsulationTrailer* trailerInPacket
00398         = (TunnelEncapsulationTrailer*)&data[size];
00399       TunnelEncapsulationTrailer* trailer;
00400 
00401       Boolean misaligned = ((uintptr_t)trailerInPacket & 3) != 0;
00402       unsigned trailerOffset;
00403       u_int8_t tunnelCmd;
00404       if (isSSM()) {
00405         // add an 'auxilliary address' before the trailer
00406         trailerOffset = TunnelEncapsulationTrailerAuxSize;
00407         tunnelCmd = TunnelDataAuxCmd;
00408       } else {
00409         trailerOffset = 0;
00410         tunnelCmd = TunnelDataCmd;
00411       }
00412       unsigned trailerSize = TunnelEncapsulationTrailerSize + trailerOffset;
00413       unsigned tmpTr[TunnelEncapsulationTrailerMaxSize];
00414       if (misaligned) {
00415         trailer = (TunnelEncapsulationTrailer*)&tmpTr;
00416       } else {
00417         trailer = trailerInPacket;
00418       }
00419       trailer += trailerOffset;
00420 
00421       if (fDests != NULL) {
00422         trailer->address() = fDests->fGroupEId.groupAddress().s_addr;
00423         trailer->port() = fDests->fPort; // structure copy, outputs in network order
00424       }
00425       trailer->ttl() = ttlToFwd;
00426       trailer->command() = tunnelCmd;
00427 
00428       if (isSSM()) {
00429         trailer->auxAddress() = sourceFilterAddress().s_addr;
00430       }
00431 
00432       if (misaligned) {
00433         memmove(trailerInPacket, trailer-trailerOffset, trailerSize);
00434       }
00435 
00436       size += trailerSize;
00437     }
00438 
00439     interf->write(data, size);
00440     ++numMembers;
00441   }
00442 
00443   return numMembers;
00444 }

Boolean OutputSocket::write ( netAddressBits  address,
Port  port,
u_int8_t  ttl,
unsigned char *  buffer,
unsigned  bufferSize 
) [inherited]

Definition at line 45 of file Groupsock.cpp.

References Socket::DebugLevel, Socket::env(), False, OutputSocket::fLastSentTTL, OutputSocket::fSourcePort, UsageEnvironment::getResultMsg(), getSourcePort(), Socket::port(), Socket::socketNum(), OutputSocket::sourcePortNum(), True, and writeSocket().

Referenced by output().

00046                                                                         {
00047   if (ttl == fLastSentTTL) {
00048     // Optimization: So we don't do a 'set TTL' system call again
00049     ttl = 0;
00050   } else {
00051     fLastSentTTL = ttl;
00052   }
00053   struct in_addr destAddr; destAddr.s_addr = address;
00054   if (!writeSocket(env(), socketNum(), destAddr, port, ttl,
00055                    buffer, bufferSize))
00056     return False;
00057 
00058   if (sourcePortNum() == 0) {
00059     // Now that we've sent a packet, we can find out what the
00060     // kernel chose as our ephemeral source port number:
00061     if (!getSourcePort(env(), socketNum(), fSourcePort)) {
00062       if (DebugLevel >= 1)
00063         env() << *this
00064              << ": failed to get source port: "
00065              << env().getResultMsg() << "\n";
00066       return False;
00067     }
00068   }
00069 
00070   return True;
00071 }

portNumBits OutputSocket::sourcePortNum (  )  const [inline, protected, inherited]

Definition at line 50 of file Groupsock.hh.

References OutputSocket::fSourcePort, and Port::num().

Referenced by wasLoopedBackFromUs(), and OutputSocket::write().

00050 {return fSourcePort.num();}

int Socket::socketNum (  )  const [inline, inherited]

Definition at line 89 of file NetInterface.hh.

References Socket::fSocketNum.

Referenced by GroupsockLookupTable::AddNew(), RTCPInstance::addStreamSocket(), BasicUDPSource::BasicUDPSource(), changeDestinationParameters(), continueAfterDESCRIBE(), BasicUDPSource::doGetNextFrame(), BasicUDPSource::doStopGettingFrames(), SocketLookupTable::Fetch(), OnDemandServerMediaSubsession::getStreamParameters(), Groupsock(), handleRead(), MediaSubsession::initiate(), SIPClient::invite1(), multicastSendOnly(), MultiFramedRTPSource::MultiFramedRTPSource(), operator<<(), RTPInterface::RTPInterface(), SIPClient::SIPClient(), RTPInterface::startNetworkReading(), PassiveServerMediaSubsession::startStream(), RTPInterface::stopNetworkReading(), unsetGroupsockBySocket(), OutputSocket::write(), BasicUDPSource::~BasicUDPSource(), and ~Groupsock().

00089 { return fSocketNum; }

Port Socket::port (  )  const [inline, inherited]

Definition at line 91 of file NetInterface.hh.

References Socket::fPort.

Referenced by addDestination(), PassiveServerMediaSubsession::getStreamParameters(), Groupsock(), operator<<(), SocketLookupTable::Remove(), GroupsockLookupTable::Remove(), removeDestination(), PassiveServerMediaSubsession::sdpLines(), Socket::Socket(), and OutputSocket::write().

00091                     {
00092     return fPort;
00093   }

UsageEnvironment& Socket::env (  )  const [inline, inherited]

Definition at line 95 of file NetInterface.hh.

References Socket::fEnv.

Referenced by changeDestinationParameters(), getGroupsockBySocket(), getSocketTable(), Groupsock(), handleRead(), multicastSendOnly(), output(), outputToAllMembersExcept(), setGroupsockBySocket(), socketReadHandler(), unsetGroupsockBySocket(), wasLoopedBackFromUs(), OutputSocket::write(), and ~Groupsock().

00095 { return fEnv; }

Boolean Socket::changePort ( Port  newPort  )  [protected, inherited]

Definition at line 97 of file NetInterface.cpp.

References closeSocket, False, Socket::fEnv, Socket::fSocketNum, TaskScheduler::moveSocketHandling(), setupDatagramSocket(), UsageEnvironment::taskScheduler(), True, and TaskScheduler::turnOffBackgroundReadHandling().

Referenced by changeDestinationParameters().

00097                                        {
00098   int oldSocketNum = fSocketNum;
00099   closeSocket(fSocketNum);
00100   fSocketNum = setupDatagramSocket(fEnv, newPort);
00101   if (fSocketNum < 0) {
00102     fEnv.taskScheduler().turnOffBackgroundReadHandling(oldSocketNum);
00103     return False;
00104   }
00105 
00106   if (fSocketNum != oldSocketNum) { // the socket number has changed, so move any event handling for it:
00107     fEnv.taskScheduler().moveSocketHandling(oldSocketNum, fSocketNum);
00108   }
00109   return True;
00110 }


Field Documentation

Boolean Groupsock::deleteIfNoMembers

Definition at line 125 of file Groupsock.hh.

Boolean Groupsock::isSlave

Definition at line 126 of file Groupsock.hh.

NetInterfaceTrafficStats Groupsock::statsIncoming [static]

Definition at line 128 of file Groupsock.hh.

Referenced by handleRead().

NetInterfaceTrafficStats Groupsock::statsOutgoing [static]

Definition at line 129 of file Groupsock.hh.

Referenced by output().

NetInterfaceTrafficStats Groupsock::statsRelayedIncoming [static]

Definition at line 130 of file Groupsock.hh.

Referenced by handleRead().

NetInterfaceTrafficStats Groupsock::statsRelayedOutgoing [static]

Definition at line 131 of file Groupsock.hh.

NetInterfaceTrafficStats Groupsock::statsGroupIncoming

Definition at line 132 of file Groupsock.hh.

Referenced by handleRead().

NetInterfaceTrafficStats Groupsock::statsGroupOutgoing

Definition at line 133 of file Groupsock.hh.

Referenced by output().

NetInterfaceTrafficStats Groupsock::statsGroupRelayedIncoming

Definition at line 134 of file Groupsock.hh.

Referenced by handleRead().

NetInterfaceTrafficStats Groupsock::statsGroupRelayedOutgoing

Definition at line 135 of file Groupsock.hh.

GroupEId Groupsock::fIncomingGroupEId [private]

Definition at line 152 of file Groupsock.hh.

Referenced by groupAddress(), isSSM(), multicastSendOnly(), and sourceFilterAddress().

destRecord* Groupsock::fDests [private]

Definition at line 153 of file Groupsock.hh.

Referenced by addDestination(), changeDestinationParameters(), multicastSendOnly(), output(), outputToAllMembersExcept(), removeAllDestinations(), removeDestination(), and ~Groupsock().

u_int8_t Groupsock::fTTL [private]

Definition at line 154 of file Groupsock.hh.

Referenced by ttl().

DirectedNetInterfaceSet Groupsock::fMembers [private]

Definition at line 155 of file Groupsock.hh.

Referenced by members().

int Socket::DebugLevel = 1 [static, inherited]

Definition at line 97 of file NetInterface.hh.

Referenced by Groupsock(), handleRead(), output(), wasLoopedBackFromUs(), OutputSocket::write(), and ~Groupsock().

UsageEnvironment * NetInterface::DefaultUsageEnvironment = NULL [static, inherited]

Definition at line 32 of file NetInterface.hh.


The documentation for this class was generated from the following files:
Generated on Mon Apr 29 13:31:32 2013 for live by  doxygen 1.5.2