Example #1
0
/**
 *
 * Method Name: ResetAllConnections
 *
 *
 * Inputs:      unsigned char *puchReason     - Reason for Reset
 *
 * Outputs:     None
 *
 * Returns:     void

 *
 * Description:  The ResetAllConnections() method shall manage the termination
 *               of all RTCP connections.  This shall include the graceful
 *               release of all associated objects as well as the deallocation
 *               of all resources associated with each contained RTCP
 *               connection.
 *
 *
 * Usage Notes:
 *
 *
 */
void CRTCPSession::ResetAllConnections(unsigned char *puchReason)
{

    unsigned long aulCSRC[MAX_CONNECTIONS];
    unsigned long ulCSRCs = 0;
    CRTCPConnection *poRTCPConnection;

    // Check whether the session is acting as an Audio Mixer.  If so,
    // We should include these sites into our contributing source list.
    if(m_etMixerMode == MIXER_ENABLED)
    {
        // Check each entry of the connection list
        poRTCPConnection = GetFirstEntry();

        // Iterate through the list until all entries have been exhausted
        for(ulCSRCs = 0; poRTCPConnection != NULL; ulCSRCs++)
        {
            // Bump Reference Count of Connection Object
            poRTCPConnection->AddRef();

            // Get the SSRC ID of the connection
            aulCSRC[ulCSRCs] = poRTCPConnection->GetRemoteSSRC();

            // Release Reference to Connection Object
            poRTCPConnection->Release();

            // Get the next connection from the list
            poRTCPConnection = GetNextEntry();
        }
    }

    // Check each entry of the connection list again
    poRTCPConnection = GetFirstEntry();
    while (poRTCPConnection != NULL)
    {

        // Bump Reference Count of Connection Object
        poRTCPConnection->AddRef();

        poRTCPConnection->GenerateRTCPReports(puchReason, aulCSRC, ulCSRCs);

        // Release Reference to Connection Object
        poRTCPConnection->Release();

        // Get Next Entry
        poRTCPConnection = GetNextEntry();
    }
}
Example #2
0
/**
 *
 * Method Name: CheckRemoteSSRCCollisions
 *
 *
 * Inputs:      IRTCPConnection *piRTCPConnection  - Connection Interface
 *
 * Outputs:     None
 *
 * Returns:     void
 *
 * Description: Check that other remote SSRCs aren't colliding with each other.
 *
 * Usage Notes:
 *
 *
 *
 */
void CRTCPSession::CheckRemoteSSRCCollisions(IRTCPConnection *piRTCPConnection)
{

    // Check for Collision
    CRTCPConnection *poRTCPConnection = GetFirstEntry();
    while(poRTCPConnection)
    {
        // Bump Reference Count of Connection Object
        poRTCPConnection->AddRef();

        bool bInitialSSRCFound = FALSE;
        if(poRTCPConnection->GetRemoteSSRC() ==
                                            piRTCPConnection->GetRemoteSSRC())
        {
            if(!bInitialSSRCFound)
                bInitialSSRCFound = TRUE;
            else
            {
                // A collision has been detected.
                // Let's inform the RTC Manager and its subscribing client's
                //  of this occurence.
                poRTCPConnection->AddRef();
                ((IRTCPSession *)this)->AddRef();
                m_piRTCPNotify->RemoteSSRCCollision(
                   (IRTCPConnection *)poRTCPConnection, (IRTCPSession *)this);
            }
        }

        // Release Reference to Connection Object
        poRTCPConnection->Release();

        // Get the next connection from the list
        poRTCPConnection = GetNextEntry();
    }
}
Example #3
0
bool wxDatabaseConfig::GetFirstEntry(wxString& str, long& lIndex) const 
{ 
	m_self->m_entries.clear();
	m_self->GetChildren(m_self->m_entry, NULL, &m_self->m_entries);
	lIndex = 0; 
	return m_entries.size() == 0 ? false : GetNextEntry(str, lIndex); 
} 
Example #4
0
bool CPODocument::LoadFile(const std::string &pofilename)
{
  CURL poFileUrl(pofilename);
  if (!XFILE::CFile::Exists(poFileUrl))
    return false;

  XFILE::CFile file;
  XFILE::auto_buffer buf;
  if (file.LoadFile(poFileUrl, buf) < 18) // at least a size of a minimalistic header
  {
    CLog::Log(LOGERROR, "%s: can't load file \"%s\" or file is too small", __FUNCTION__,  pofilename.c_str());
    return false;
  }
  
  m_strBuffer = '\n';
  m_strBuffer.append(buf.get(), buf.size());
  buf.clear();

  ConvertLineEnds(pofilename);

  // we make sure, to have an LF at the end of buffer
  if (*m_strBuffer.rbegin() != '\n')
  {
    m_strBuffer += "\n";
  }

  m_POfilelength = m_strBuffer.size();

  if (GetNextEntry() && m_Entry.Type == MSGID_FOUND)
    return true;

  CLog::Log(LOGERROR, "POParser: unable to read PO file header from file: %s", pofilename.c_str());
  return false;
}
Example #5
0
// CountEntries
int32
Directory::CountEntries() const
{
	int32 count = 0;
	Entry* entry = GetFirstEntry();
	while (entry) {
		count++;
		entry = GetNextEntry(entry);
	}
	return count;
}
Example #6
0
/**
 *
 * Method Name: ForwardSDESReport
 *
 *
 * Inputs:   IGetSrcDescription *piGetSrcDescription
 *                              - Interface for getting SDES Report Statistics
 *           IRTCPConnection  *piRTCPConnection
 *                              - Interface to RTCP Connection originating SDES
 *
 * Outputs:  None
 *
 * Returns:  None
 *
 * Description: The ForwardSDESReport() method shall enable the RTC Manager to
 *              pass interfaces to SDES Reports received from participating
 *              site while acting in the mode of a conference Mixer.  The
 *              Mixer's role in this situation is to transmit these reports
 *              unchanged to others participating within a conference.  The
 *              handoff of an SDES Report to the CRTCPRender will cause the
 *              report to be transmitted to a participating site using the
 *              associated Network Render object.
 *
 * Usage Notes: The interface for the local site's Source Description Report
 *              generator is passed as an argument at construction time.
 *
 *
 */
void CRTCPSession::ForwardSDESReport(IGetSrcDescription *piGetSrcDescription,
                                     IRTCPConnection    *piRTCPConnection)
{

    // Check the each entry of the connection list and forward this report to
    //  those not matching the originators SSRC
    CRTCPConnection *poRTCPConnection = GetFirstEntry();

    // Iterate through the list until all entries have been exhausted
    while(poRTCPConnection != NULL)
    {
        // Bump Reference Count of Connection Object
        poRTCPConnection->AddRef();

        // Get the SSRC ID of the connection to determine whether it is not
        //  from the originator
        if(poRTCPConnection->GetRemoteSSRC() !=
                                            piRTCPConnection->GetRemoteSSRC())
        {
            // Get Render Interface
            IRTCPRender *piRTCPRender = poRTCPConnection->GetRenderInterface();

#if RTCP_DEBUG /* [ */
            if(bPingtelDebug)
            {
                osPrintf("*** FORWARDING SDES REPORT ****\n");
                osPrintf("\t ON SESSION ==> %d\n", GetSessionID());
                osPrintf("\t FROM SSRC  ==> %u\n",
                                           piRTCPConnection->GetRemoteSSRC());
                osPrintf("\t TO SSRC    ==> %d\n",
                                           poRTCPConnection->GetRemoteSSRC());
            }
#endif /* RTCP_DEBUG ] */

            // Different connection.  Forward the SDES Report for delivery.
            ISDESReport *piSDESReport =
                                      piGetSrcDescription->GetSDESInterface();
            piRTCPRender->ForwardSDESReport(piSDESReport);

            // Release the reference to SDES Report interface
            piSDESReport->Release();

            // Release Render Interface
            piRTCPRender->Release();
        }

        // Release Reference to Connection Object
        poRTCPConnection->Release();

        // Get the next connection from the list
        poRTCPConnection = GetNextEntry();
    }

}
Example #7
0
/**
 *
 * Method Name:  ReassignSSRC
 *
 *
 * Inputs:   unsigned long  ulSSRC     - Source ID
 *           unsigned char *puchReason - Optional Reason for SSRC Reassignment
 *
 * Outputs:  None
 *
 * Returns:  void
 *
 * Description: Reassigns the Source Identifier associated with an RTP session
 *              due to collision detection and resolution.  Calling of this
 *              method shall result in the resetting of the SSRC IDs of
 *              associated Sender, Receiver, and SDES Reports.
 *
 * Usage Notes:
 *
 *
 *
 */
void CRTCPSession::ReassignSSRC(unsigned long ulSSRC,
                                unsigned char *puchReason)
{
#if RTCP_DEBUG /* [ */
    if(bPingtelDebug)
    {
        osPrintf("*** SSRC REASSIGNED ****\n");
        osPrintf("\t ON SESSION ==> %d\n", GetSessionID());
        osPrintf("\t NEW SSRC    ==> %u\n", ulSSRC);
        osPrintf("\t REASON     ==> %s\n", puchReason);
    }
#endif /* RTCP_DEBUG ] */

    // Reset all connections first
    ResetAllConnections(puchReason);

    // Set new Session SSRC
    m_ulSSRC = ulSSRC;

    // Check the each entry of the connection list
    CRTCPConnection *poRTCPConnection = GetFirstEntry();

    // Iterate through the list until all entries have been exhausted
    while(poRTCPConnection != NULL)
    {
        // Bump Reference Count of Connection Object
        poRTCPConnection->AddRef();

        // Get Render Interface
        IRTCPRender *piRTCPRender = poRTCPConnection->GetRenderInterface();

        // Instruct the Render filter of the new SSRC.
        // It will take care of the reset
        piRTCPRender->ReassignSSRC(ulSSRC);

        // Release Render Interface
        piRTCPRender->Release();

        // Release Reference to Connection Object
        poRTCPConnection->Release();

        // Get the next connection from the list
        poRTCPConnection = GetNextEntry();
    }

}
Example #8
0
bool CPODocument::LoadFile(const std::string &pofilename)
{
  XFILE::CFile file;
  if (!file.Open(pofilename))
    return false;

  int64_t fileLength = file.GetLength();
  if (fileLength < 18) // at least a size of a minimalistic header
  {
    file.Close();
    CLog::Log(LOGERROR, "POParser: non valid length found for string file: %s", pofilename.c_str());
    return false;
  }

  m_POfilelength = static_cast<size_t> (fileLength);

  m_strBuffer.resize(m_POfilelength+1);
  m_strBuffer[0] = '\n';

  unsigned int readBytes = file.Read(&m_strBuffer[1], m_POfilelength);
  file.Close();

  if (readBytes != m_POfilelength)
  {
    CLog::Log(LOGERROR, "POParser: actual read data differs from file size, for string file: %s",
              pofilename.c_str());
    return false;
  }

  ConvertLineEnds(pofilename);

  // we make sure, to have an LF at the end of buffer
  if (*m_strBuffer.rbegin() != '\n')
  {
    m_strBuffer += "\n";
  }

  m_POfilelength = m_strBuffer.size();

  if (GetNextEntry() && m_Entry.Type == MSGID_FOUND)
    return true;

  CLog::Log(LOGERROR, "POParser: unable to read PO file header from file: %s", pofilename.c_str());
  return false;
}
void ArpAddonManager::Start(void)
{
	ArpD(cdb << ADH << "Starting addon manager" << endl);
	BAutolock(Lock());
	ArpD(cdb << ADH << "Locked myself." << endl);
	BEntry entry;
	Rewind();
	while( GetNextEntry(&entry,true) == B_NO_ERROR ) {
		if( entry.InitCheck() == B_NO_ERROR ) {
			ArpD(cdb << ADH << "Trying addon for: " << (void*)&entry << endl);
			BasicAddon* addon = AllocAddon(&entry);
			if( addon ) {
				if( addon->InitCheck() == B_NO_ERROR ) AddAddon(addon);
				else delete addon;
			}
		}
	}
}
Example #10
0
status_t
TVolWalker::GetNextEntry(BEntry* entry, bool traverse)
{
	if (fTopDir == NULL)
		return B_ENTRY_NOT_FOUND;

	// get the next entry
	status_t result = _inherited::GetNextEntry(entry, traverse);
	while (result != B_OK) {
		// we're done with the current volume, go to the next one
		result = NextVolume();
		if (result != B_OK)
			break;

		result = GetNextEntry(entry, traverse);
	}

	return result;
}
void
EDirectory::DoForEach(bool (*func)(const char *path, void *user_data), void *user_data)
{
	EEntry aEntry;
	EPath aPath;

	if(InitCheck() != E_OK || func == NULL) return;

	Rewind();

	while(GetNextEntry(&aEntry, true) == E_OK)
	{
		if(aEntry.GetPath(&aPath) != E_OK) continue;

		if((*func)(aPath.Path(), user_data)) break;
	}

	Rewind();
}
Example #12
0
status_t
TNodeWalker::GetNextEntry(BEntry* entry, bool traverse)
{
	if (fJustFile != NULL) {
		*entry = *fJustFile;
		fJustFile = 0;
		return B_OK;
	}

	if (fTopDir == NULL) {
		// done
		return B_ENTRY_NOT_FOUND;
	}

	// If requested to include the top directory, return that first.
	if (fIncludeTopDir) {
		fIncludeTopDir = false;
		return fTopDir->GetEntry(entry);
	}

	// Get the next entry.
	status_t result = fTopDir->GetNextEntry(entry, traverse);
	if (result != B_OK) {
		result = PopDirCommon();
		if (result != B_OK)
			return result;

		return GetNextEntry(entry, traverse);
	}
	// See if this entry is a directory. If it is then push it onto the
	// stack
	entry_ref ref;
	result = entry->GetRef(&ref);

	if (result == B_OK && fTopDir->Contains(ref.name, B_DIRECTORY_NODE))
		PushDirCommon(&ref);

	return result;
}
Example #13
0
/*----------------------------------------------------------------------
|       NPT_PosixDirectory::GetNextEntry
+---------------------------------------------------------------------*/
NPT_Result
NPT_PosixDirectory::GetNextEntry(NPT_String& name, NPT_DirectoryEntryInfo* info)
{
    struct dirent* dp;
    struct stat    statbuf;

    // reset output params first
    name = "";

    if (!m_Dir) {
        m_Dir = opendir(m_Path);
        if (!m_Dir) return NPT_FAILURE;
    }

    if (!(dp = readdir(m_Dir))) 
        return NPT_ERROR_NO_SUCH_ITEM;


    if (!NPT_String::Compare(dp->d_name, ".", false) || !NPT_String::Compare(dp->d_name, "..", false)) {
        return GetNextEntry(name, info);
    }

    // discard system specific files/shortcuts
    NPT_String file_path = m_Path;
    NPT_DirectoryAppendToPath(file_path, dp->d_name);
    if (stat(file_path, &statbuf) == -1) return NPT_FAILURE;

    // assign output params
    name = dp->d_name;
    if (info) {
        info->size = S_ISDIR(statbuf.st_mode) ? 0 : statbuf.st_size;
        info->type = S_ISDIR(statbuf.st_mode) ? NPT_DIRECTORY_TYPE : NPT_FILE_TYPE;
    }

    return NPT_SUCCESS;
}
Example #14
0
/**
 *
 * Method Name: CheckLocalSSRCCollisions
 *
 *
 * Inputs:      None
 *
 * Outputs:     None
 *
 * Returns:     void
 *
 * Description: Check that our local SSRC is not colliding with one fo the
 *              SSRCs of a participating site.
 *
 * Usage Notes:
 *
 *
 *
 */
void CRTCPSession::CheckLocalSSRCCollisions(void)
{

    // Check the each entry of the connection list
    CRTCPConnection *poRTCPConnection = GetFirstEntry();

    // Iterate through the list until all entries have been exhausted
    while(poRTCPConnection != NULL)
    {
        // Bump Reference Count of Connection Object
        poRTCPConnection->AddRef();

        // Get the SSRC ID of the connection to determine whether it is
        //  conflicting with ours
        if(poRTCPConnection->GetRemoteSSRC() == m_ulSSRC)
        {
            // A collision has been detected.
            // Let's reset all the connections.
            ResetAllConnections((unsigned char *)"SSRC Collision");

            // Let's inform the RTC Manager and its subscribing client's of
            //  this occurence.
            poRTCPConnection->AddRef();
            ((IRTCPSession *)this)->AddRef();
            m_piRTCPNotify->LocalSSRCCollision(
                   (IRTCPConnection *)poRTCPConnection, (IRTCPSession *)this);
        }

        // Release Reference to Connection Object
        poRTCPConnection->Release();

        // Get the next connection from the list
        poRTCPConnection = GetNextEntry();
    }

}
BOOL CJPersistFile::SaveFile()
{
   char filename[256];
   FILE* pFile;
   int bytesWritten;
   char* tempDataStr;
   U32 i,j;
   PersistentTableElement* pCurrentParentEntry;
   PersistentTableElement* pCurrentChildEntry;

   // Increment the version number
   dCurrentRevisionNumber++;

   // Open the file to save
   sprintf(filename, "%s_%u.xml", dBaseFilename, dCurrentRevisionNumber);
   pFile = fopen(filename, "w");
   if( pFile == NULL)
   {
      CJTRACE(TRACE_ERROR_LEVEL, "ERROR: Failed to open file for save operation (filename=%s, rev=%u, errno=%s)", dBaseFilename, dCurrentRevisionNumber, strerror(errno));
      return FALSE;
   }

   // Write out the header information
   bytesWritten = fprintf(pFile, "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n\n");
   if( bytesWritten <= 0)
   {
      CJTRACE(TRACE_ERROR_LEVEL, "ERROR: Failed to write to file (filename=%s, rev=%u, errno=%s)", dBaseFilename, dCurrentRevisionNumber, strerror(errno));
      fclose(pFile);
      return FALSE;
   }

   // Cycle through the tags and write out data
   pCurrentParentEntry = GetNextEntry(NULL, 0);
   while( pCurrentParentEntry->dataType != ePERSISTTYPE_LAST_ENTRY)
   {
      // Is this a parent tag entry?
      if(pCurrentParentEntry->dataType == ePERSISTTYPE_PARENT_TAG)
      {   
         for( i=0; i < pCurrentParentEntry->maxPerFile; i++)
         {
            // Write out the open parent tag
            bytesWritten = fprintf(pFile, "<%s_%u>\n", pCurrentParentEntry->paramTagString, i);
            if( bytesWritten <= 0)
            {
               CJTRACE(TRACE_ERROR_LEVEL, "ERROR: Failed to write to file (filename=%s, rev=%u, errno=%s)", dBaseFilename, dCurrentRevisionNumber, strerror(errno));
               fclose(pFile);
               return FALSE;
            }   
   
            // Write out the associated child values
            pCurrentChildEntry = GetNextEntry(NULL, pCurrentParentEntry->idEnum);
            while( pCurrentChildEntry->dataType != ePERSISTTYPE_LAST_ENTRY)
            {
               for( j=0; j < pCurrentChildEntry->maxPerFile; j++)
               {
                  tempDataStr = GetTableValueStr( pCurrentParentEntry->idEnum, i, pCurrentChildEntry->idEnum, j);
                  if( tempDataStr[0] != 0)
                  {
                     bytesWritten = fprintf(pFile, "   <%s_%u>%s</%s_%u>\n", pCurrentChildEntry->paramTagString, j, tempDataStr, pCurrentChildEntry->paramTagString, j);
                     if( bytesWritten <= 0)
                     {
                        CJTRACE(TRACE_ERROR_LEVEL, "ERROR: Failed to write data string to file (filename=%s, rev=%u, errno=%s)", dBaseFilename, dCurrentRevisionNumber, strerror(errno));
                        fclose(pFile);
                        return FALSE;
                     }
                  }
               }
               pCurrentChildEntry = GetNextEntry( pCurrentChildEntry, pCurrentParentEntry->idEnum);
            }   
   
            // Write out the close parent tag
            bytesWritten = fprintf(pFile, "</%s_%u>\n", pCurrentParentEntry->paramTagString, i);
            if( bytesWritten <= 0)
            {
               CJTRACE(TRACE_ERROR_LEVEL, "ERROR: Failed to write to file (filename=%s, rev=%u, errno=%s)", dBaseFilename, dCurrentRevisionNumber, strerror(errno));
               fclose(pFile);
               return FALSE;
            }
         }
      }
      else
      {
         // This is a top level value, write it out
         for( i=0; i < pCurrentParentEntry->maxPerFile; i++)
         {
            tempDataStr = GetTableValueStr( pCurrentParentEntry->idEnum, i, 0, 0);
            if( tempDataStr[0] != 0)
            {
               bytesWritten = fprintf(pFile, "<%s_%u>%s</%s_%u>\n", pCurrentParentEntry->paramTagString, i, tempDataStr, pCurrentParentEntry->paramTagString, i);
               if( bytesWritten <= 0)
               {
                  CJTRACE(TRACE_ERROR_LEVEL, "ERROR: Failed to write data string to file (filename=%s, rev=%u, errno=%s)", dBaseFilename, dCurrentRevisionNumber, strerror(errno));
                  fclose(pFile);
                  return FALSE;
               }
            }
         }
      }
      pCurrentParentEntry = GetNextEntry(pCurrentParentEntry, 0);
   }
   fclose(pFile);
   return TRUE;
}
Example #16
0
/*|><|************************************************************************
*
* Method Name:  MessageLoop
*
*
* Inputs:       None
*
* Outputs:      None
*
* Returns:      None
*
* Logic Notes:
*
* Caveats:
*
************************************************************************|<>|*/
void CMsgQueue::MessageLoop()
{

    // Establish an array of event on which we are to wait.  Among these
    // events are the message Arrival event and the Thread Termination event.
    HANDLE hEventList[] = {m_hThreadEvent, m_hMessageEvent};
    unsigned long dwEvents = 2;
    BOOL bTerminate = FALSE;

//  Sleep briefly to allow the parent thread to run and pickup the thread
//  initialization signal.
    Sleep(ONE_SECOND);

    while (!bTerminate)
    {

        // Wait for an Event to occur or for the timeout to expire
        unsigned long dwRetValue = WaitForMultipleObjects (
                dwEvents,           // Number of event objects passed in list
                hEventList,         // List of Event objects
                FALSE,              // Do not wait for all to be signalled
                ONE_SECOND);        // Wait timer duration - One Second


        // An Event was Detected.  Let's determine the event type.
        if (dwRetValue  != WAIT_TIMEOUT)
        {
            // Determine which object has signalled us by taking the return
            // value and subtracting the base value of WAIT_OBJECT_0 from it
            unsigned long dwIndex = dwRetValue - WAIT_OBJECT_0;

            // If the object that signalled us is Index 0, it is the terminate
            // thread object.  Let's break out of the while loop and tend to
            // gracefully shutting down the Message processing thread.
            if (dwIndex == 0 || dwIndex > dwEvents)
            {
                // Terminate message processing
                bTerminate = TRUE;
            }
            else
            {
                // Reset Index and Event
                dwIndex = 0;
                ResetEvent(m_hMessageEvent);
            }
        }


        // A message has been received or a timeout has occurred.  We check
        // the queue in the latter case to insure against loosing messages
        // which were pending the completion of a device connection (aka
        // Network connection).  Let's read off all messages which may be
        // on the list and dispatch them for processing.
        CMessage *poMessage = GetFirstEntry();
        while(poMessage)
        {
            // Dispatch the message to the user defined processing method
            if(ProcessMessage(poMessage))
            {
                RemoveEntry(poMessage);
                delete poMessage;
                poMessage = NULL;

            }

            // Remove the next message from the list
            poMessage = GetNextEntry();
        }

    }

    // Terminate the Message Thread
    TerminateMessageThread();

}
Example #17
0
/**
 *
 * Method Name:  RTCPConnectionStopped()
 *
 *
 * Inputs:   IRTCPConnection *piRTCPConnection
 *                                   - Interface to associated RTCP Connection
 *           IRTCPSession    *piRTCPSession
 *                                   - Interface to associated RTCP Session
 *
 * Outputs:  None
 *
 * Returns:  None
 *
 * Description: The RTCPConnectionStopped() event method shall inform the
 *              recipient of the imminent suspension of an RTCP outbound
 *              connection.  This will allow whatever connection related
 *              operations to be suspended until it again resumes.
 *
 * Usage Notes:
 *
 */
void CRTCPSession::RTCPConnectionStopped(IRTCPConnection *piRTCPConnection,
                                         IRTCPSession    *piRTCPSession)
{
    unsigned long aulCSRC[MAX_CONNECTIONS];
    unsigned long ulCSRCs = 0;
    CRTCPConnection *poRTCPConnection;

    // Get the associated RTCP Connection object from the collection list
    if((poRTCPConnection = GetEntry(RTCPConnectionComparitor,
                                   (void *)piRTCPConnection)) != NULL)
    {
#if RTCP_DEBUG /* [ */
        if(bPingtelDebug)
        {
            osPrintf("*** RTCP CONNECTION STOPPED ****\n");
            osPrintf("\t ON SESSION ==> %d\n", GetSessionID());
            osPrintf("\t TO SSRC    ==> %u\n",
                                           piRTCPConnection->GetRemoteSSRC());
        }
#endif /* RTCP_DEBUG ] */

        // Check whether the session is acting as an Audio Mixer.  If so,
        // We should include these sites into our contributing source list.
        if(m_etMixerMode == MIXER_ENABLED)
        {
            // Check each entry of the connection list
            CRTCPConnection *poPeerConnection = GetFirstEntry();

            // Iterate through the list until all entries have been exhausted
            for(ulCSRCs = 0; poPeerConnection != NULL; ulCSRCs++)
            {
                // Bump Reference Count of Connection Object
                poPeerConnection->AddRef();

                // Get the SSRC ID of the connection
                aulCSRC[ulCSRCs] = poPeerConnection->GetRemoteSSRC();

                // Check that we are not adding the Remote SSRC of the
                //  connection being terminated.  If so, we will backup the
                //  CSRC count
                if(poPeerConnection->GetRemoteSSRC() == aulCSRC[ulCSRCs])
                    ulCSRCs--;

                // Release Reference to Connection Object
                poPeerConnection->Release();

                // Get the next connection from the list
                poPeerConnection = GetNextEntry();
            }
        }

        // Bump Reference Count of Connection Object
        poRTCPConnection->AddRef();

        poRTCPConnection->GenerateRTCPReports(
          (unsigned char *)"Normal Connection Termination", aulCSRC, ulCSRCs);

        // Release Reference to Connection Object
        poRTCPConnection->Release();

    }

}
Example #18
0
void CTranscription::LoadMode(const char *filename)
{
  int entries;
  size_t head, i;
  long l, r2tentries, t2rentries;
  FILE *f;
  char *b, *origb=0;
  bool version1;

#ifdef SPY
  printf("CTranscription::LoadMode\n");
#endif
  try
  {
    f=fopen(filename, "r");
	if(!f)
	  throw EFileNotFound("Cannot load "+string(filename));
    fseek(f, 0, SEEK_END);
    l=ftell(f);
    fseek(f, 0, SEEK_SET);
    b=(char *)malloc(l+1);
    origb=b;
    fread(b, l, 1, f);
    b[l]=0;
    fclose(f);

    for(i=0;i<256;i++)
    {
      mode.r2t.src[i]->clear();
      mode.r2t.dest[i]->clear();
      mode.r2t.prev[i]->clear();
      mode.r2t.next[i]->clear();
      mode.r2t.id[i]->clear();
      mode.t2r.src[i]->clear();
      mode.t2r.dest[i]->clear();
      mode.t2r.prev[i]->clear();
      mode.t2r.next[i]->clear();
      mode.t2r.id[i]->clear();
    }

    mode.path=ExtractFilePath(filename);
    mode.text=ExtractFileName(filename);
#ifdef SPY
    printf("%s\n", filename);
    printf("%d bytes\n", l);
//    printf("%s\n", b);
#endif
    if(string(b).substr(0,VERSION2TAG.size())==VERSION2TAG)
      version1=false;
    else
      version1=true;
    mode.version = version1 ? 1 : 2;
    if(!version1)
    {
      try
      {
        head=VERSION2TAG.size();
        b+=head;
        i=string(b).find('\t')+1;
        head+=i;
        b+=i;
        i=string(b).find('\t')+1;
        head+=i;
        r2tentries=atol(string(b).substr(0,i-1).c_str());
#ifdef SPY
        printf("%d r2t\n", r2tentries);
#endif
        if(!r2tentries)
          throw EConvertError("");
        b+=i;
        i=string(b).find('\t')+1;
        head+=i;
        t2rentries=atol(string(b).substr(0,i-1).c_str());
#ifdef SPY
        printf("%d t2r\n", t2rentries);
#endif
        b+=i;
      }catch(const EConvertError &) { throw EUnknownFormat("Unknown file format"); }
    }
    i=string(b).find('\t')+1;
    mode.comment=string(b).substr(0,i-1);
    if((b[i]!='0')&&(b[i]!='1'))
      throw EUnknownFormat("Unknown file format");
    mode.casesens=b[i]=='1';
    if(!mode.casesens)
      matchcase=&lowercase;
    else
      matchcase=&dummy;
    if(version1)
      i=72;
    else
      i=72-head;
    b+=i;
    entries=0;
#ifdef SPY
    printf("R2T Entries:\n");
#endif
    do
    {
#ifdef SPY
      printf("%d. ", entries+1);
#endif
      if(!GetNextEntry(b, mode.r2t, &CTranscription::RomanHash))
        break;
      entries++;
    }while((b-origb<l)&&((version1)||(entries!=r2tentries)));
    matchcase=&dummy;//unwanted for reverse transcription
    if(!version1)
    {
      if(entries!=r2tentries)
        throw EUnknownFormat("Unknown file format");
      entries=0;
#ifdef SPY
      printf("T2R Entries:\n");
#endif
      do
      {
#ifdef SPY
        printf("%d. ", entries+1);
#endif
        if(!GetNextEntry(b, mode.t2r, &CTranscription::TengHash))
          break;
        entries++;
      }while((b-origb<l)&&(entries!=t2rentries));
      if(entries!=t2rentries)
        throw EUnknownFormat("Unknown file format");
    }
    else//version1
      AutoReverse();
    Optimize(mode.r2t);
    Optimize(mode.t2r);
  }catch(exception &e)
  {
    if(origb)
      free(origb);
    throw e;
  }
  if(origb)
    free(origb);
}
Example #19
0
bool wxRegConfig::GetFirstEntry(wxString& str, long& lIndex) const
{
  lIndex = 0;
  return GetNextEntry(str, lIndex);
}