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   socketLeaveGroup(env(), socketNum(), fIncomingGroupEId.groupAddress().s_addr);
00241   for (destRecord* dests = fDests; dests != NULL; dests = dests->fNext) {
00242     socketLeaveGroup(env(), socketNum(), dests->fGroupEId.groupAddress().s_addr);
00243   }
00244 }

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

Definition at line 246 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(), RTPInterface::sendPacket(), SIPClient::sendRequest(), and SIPClient::SIPClient().

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

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 345 of file Groupsock.cpp.

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

Referenced by handleRead().

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

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

Reimplemented from OutputSocket.

Definition at line 290 of file Groupsock.cpp.

References NetInterfaceTrafficStats::countPacket(), Socket::DebugLevel, Socket::env(), False, isSSM(), NULL, our_inet_ntoa(), 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().

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

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

Definition at line 362 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().

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

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(), 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 Thu Jul 29 10:16:20 2010 for live by  doxygen 1.5.2