Beispiel #1
0
GEN
addir_sign(GEN x, long sx, GEN y, long sy)
{
  long e, l, ly;
  GEN z;

  if (!sx) return rcopy_sign(y, sy);
  e = expo(y) - expi(x);
  if (!sy)
  {
    if (e >= 0) return rcopy_sign(y, sy);
    z = itor(x, nbits2prec(-e));
    setsigne(z, sx); return z;
  }

  ly = lg(y);
  if (e > 0)
  {
    l = ly - divsBIL(e);
    if (l < 3) return rcopy_sign(y, sy);
  }
  else l = ly + nbits2extraprec(-e);
  z = (GEN)avma;
  y = addrr_sign(itor(x,l), sx, y, sy);
  ly = lg(y); while (ly--) *--z = y[ly];
  avma = (pari_sp)z; return z;
}
Beispiel #2
0
// Delete a subscription from the set.
void SubscriptionSet::deleteInstance(const char* instanceName,
                                     const char* subscriptionState,
                                     const char* resourceSubscriptionState)
{
   OsSysLog::add(FAC_RLS, PRI_DEBUG,
                 "SubscriptionSet::deleteInstance instanceName = '%s', subscriptionState = '%s'",
                 instanceName, subscriptionState);

   // Search for the resource instance in question.
   UtlSListIterator itor(mSubscriptions);
   ResourceInstance* inst;
   UtlBoolean found = FALSE;
   while (!found && (inst = dynamic_cast <ResourceInstance*> (itor())))
   {
      if (inst->getInstanceName()->compareTo(instanceName) == 0)
      {
         found = TRUE;
         // Set the state of the resource instance to terminated.
         // This call sets the containing ResourceList's to publish,
         // eventually.
         inst->terminateContent(subscriptionState);
         // We do not remove the element from mSubscriptions, but rather
         // let it be removed by ResourceCache::purgeTerminated().
      }
   }
   if (!found)
   {
      OsSysLog::add(FAC_RLS, PRI_WARNING,
                    "SubscriptionSet::deleteInstance instanceName = '%s' not found",
                    instanceName);
   }
}
Beispiel #3
0
bool Appearance::appearanceIsBusy()
{
   // we are busy if we are currently managing any non-held dialogs
   bool ret = false;
   UtlHashMapIterator itor(mDialogs);
   UtlString* handle;
   while ( !ret && (handle = dynamic_cast <UtlString*> (itor())) )
   {
      Dialog* pDialog = dynamic_cast <Dialog*> (itor.value());
      UtlString dialogState = STATE_TERMINATED;
      UtlString event;
      UtlString code;
      UtlString rendering;
      pDialog->getState(dialogState, event, code);
      pDialog->getLocalParameter("+sip.rendering", rendering);
      if ( (dialogState != STATE_TERMINATED) &&
           !((dialogState == STATE_CONFIRMED) && (rendering == "no"))
         )
      {
         ret = true;
      }
      OsSysLog::add(FAC_SAA, PRI_DEBUG,
                    "Appearance::appearanceIsBusy mUri = '%s', state %s(%s) returns %d",
                    mUri.data(), dialogState.data(), rendering.data(), ret);
   }
   return ret;
}
Beispiel #4
0
bool Appearance::terminateDialogs(bool terminateHeldDialogs)
{
   OsSysLog::add(FAC_SAA, PRI_DEBUG,
                 "Appearance::terminateDialogs mUri = '%s': terminating %zu dialogs",
                 mUri.data(), mDialogs.entries());
   UtlHashMapIterator itor(mDialogs);
   UtlString* handle;
   bool ret = false;  // nothing changed
   while ( (handle = dynamic_cast <UtlString*> (itor())) )
   {
      Dialog* pDialog = dynamic_cast <Dialog*> (itor.value());
      UtlString rendering;
      UtlString dialogState= STATE_TERMINATED;
      UtlString event;
      UtlString code;
      pDialog->getLocalParameter("+sip.rendering", rendering);
      pDialog->getState(dialogState, event, code);
      // unless told otherwise, do not terminate held dialogs:
      // they can still be picked up by another set
      if ( terminateHeldDialogs ||
            !((dialogState == STATE_CONFIRMED) && (rendering == "no"))
         )
      {
         OsSysLog::add(FAC_SAA, PRI_DEBUG,
                       "Appearance::terminateDialogs dialog '%s'",
                       handle->data());
         pDialog->setState(STATE_TERMINATED, event, code);
         ret = true;
      }
   }
   return ret;
}
Beispiel #5
0
// Remove any dialogs in the terminated state.
// This operates only on the parsed dialogs in mXmlDialogs, used to generate
// the consolidated state.  The RFC 4662 events are not affected, but
// presumably the resource is not allowing terminated dialogs to accumulate
// in the events it sends.
void ResourceInstance::purgeTerminatedDialogs()
{
   Os::Logger::instance().log(FAC_RLS, PRI_DEBUG,
                 "ResourceInstance::purgeTerminatedDialogs mInstanceName = '%s'",
                 mInstanceName.data());

   // Iterate through all the <dialog> elements.
   UtlHashMapIterator itor(mXmlDialogs);
   UtlContainable* id;
   while ((id = itor()))
   {
      // Get the <state> element content.
      UtlVoidPtr* p = dynamic_cast <UtlVoidPtr*> (itor.value());
      TiXmlElement* dialog_element =
         static_cast <TiXmlElement*> (p->getValue());
      TiXmlNode* state_node = dialog_element->FirstChild("state");
      UtlString state;
      textContentShallow(state, state_node);

      if (state.compareTo("terminated") == 0)
      {
         // This dialog was terminated.  Remove it.
         delete dialog_element;
         mXmlDialogs.destroy(id);
      }
   }
   // Note that we do not have to publish this change, as the deletion
   // of these dialogs does not have to be sent to the subscribers
   // quickly.
}
Beispiel #6
0
// Dump the object's internal state.
void ResourceInstance::dumpState() const
{
   // indented 12

   Os::Logger::instance().log(FAC_RLS, PRI_INFO,
                 "\t            ResourceInstance %p mInstanceName = '%s', "
                 "mSubscriptionState = '%s', mContentPresent = %d, mContent = '%s'",
                 this, mInstanceName.data(), mSubscriptionState.data(),
                 mContentPresent,
                 mContentPresent ? mContent.data() : "[invalid]");

   UtlHashMapIterator itor(mXmlDialogs);
   UtlString* dialog_id;
   while ((dialog_id = dynamic_cast <UtlString*> (itor())))
   {
      UtlVoidPtr* p = dynamic_cast <UtlVoidPtr*> (itor.value());
      TiXmlElement* dialog_element =
         static_cast <TiXmlElement*> (p->getValue());
      UtlString s;
      TiXmlUtlStringWriter writer(&s);
      writer <<*dialog_element;

      Os::Logger::instance().log(FAC_RLS, PRI_INFO,
                    "\t              mXmlDialogs{'%s'} = '%s'",
                    dialog_id->data(), s.data());
   }
}
Beispiel #7
0
void Pickup::Collide(unsigned int aId, unsigned int aHitId, float aFraction, const Vector2 &aContact, const Vector2 &aNormal)
{
	// do nothing if destroyed...
	if (mDestroy)
		return;
	assert(mId == aId);

	// get team affiliation
	unsigned int aHitTeam = Database::team.Get(aHitId);

	// for each pickup link...
	for (Database::Typed<LinkTemplate>::Iterator itor(Database::pickuplink.Get(mId).Find(aHitTeam)); itor.IsValid(); ++itor)
	{
		// if the recipient supports the link...
		if (Database::linktemplate.Get(aHitId).Find(itor.GetKey()))
		{
			// apply
			mDestroy = true;
			break;
		}
	}

	// for each pickup resource...
	for (Database::Typed<float>::Iterator itor(Database::pickupresource.Get(mId).Find(aHitTeam)); itor.IsValid(); ++itor)
	{
		// if the recipient supports the resource...
		if (Resource *resource = Database::resource.Get(aHitId).Get(itor.GetKey()))
		{
			// amount to add
			const float add = itor.GetValue();

			// get the resource template
			const ResourceTemplate &resourcetemplate = Database::resourcetemplate.Get(aHitId).Get(itor.GetKey());

			// if not at the limit...
			if ((add > 0.0f && resource->GetValue() < resourcetemplate.mMaximum) ||
				(add < 0.0f && resource->GetValue() > 0.0f))
		{
				// apply
			mDestroy = true;
			break;
			}
		}
	}

	// if it grants points...
	if (Database::points.Get(mId))
	{
		// if the recipient is player-controlled...
		if (Database::playercontroller.Find(aHitId))
		{
			mDestroy = true;
		}
	}

	if (mDestroy)
	{
		new PickupGrantUpdate(mId, aHitId, aFraction);
	}
}
Beispiel #8
0
void Capturable::Persuade(unsigned int aSourceId, float aEffect)
{
	// ignore effect if already captured
	if (mResistance <= 0)
		return;

	// deduct effect from resistance
	mResistance -= aEffect;

	// if captured...
	if (mResistance <= 0)
	{
		// register a capture update
		new CapturableCaptureUpdate(mId);

		// notify all capture signals
		for (Database::Typed<CaptureSignal>::Iterator itor(Database::capturesignal.Find(aSourceId)); itor.IsValid(); ++itor)
		{
			itor.GetValue()(aSourceId, mId);
		}

		// notify all owner capture signals
		unsigned int aOwnerId = Database::owner.Get(aSourceId);
		for (Database::Typed<CaptureSignal>::Iterator itor(Database::capturesignal.Find(aOwnerId)); itor.IsValid(); ++itor)
		{
			itor.GetValue()(aOwnerId, mId);
		}
	}
}
Beispiel #9
0
bool Appearance::appearanceIdIsSeized(const UtlString& appearanceId)
{
   OsSysLog::add(FAC_SAA, PRI_DEBUG,
                 "Appearance::appearanceIdIsSeized mUri = '%s', appearance = '%s'",
                 mUri.data(), appearanceId.data());
   bool ret = false;
   UtlHashMapIterator itor(mDialogs);
   UtlString* handle;
   while ( !ret && (handle = dynamic_cast <UtlString*> (itor())) )
   {
      Dialog* pDialog = dynamic_cast <Dialog*> (itor.value());
      UtlString dialogState= STATE_TERMINATED;
      UtlString event;
      UtlString code;
      UtlString rendering;
      pDialog->getState(dialogState, event, code);
      pDialog->getLocalParameter("+sip.rendering", rendering);
      UtlString myAppearanceId;
      pDialog->getLocalParameter("x-line-id", myAppearanceId);
      if ( (myAppearanceId == appearanceId) //&&
         //   (dialogState != STATE_TERMINATED) &&
         //  ( !(dialogState == STATE_CONFIRMED) && (rendering == "no") )
           // not even sure I need any other conditions for TRYING contention...
         )
      {
         OsSysLog::add(FAC_SAA, PRI_DEBUG,
                       "Appearance::appearanceIdIsSeized mUri = '%s', appearance = '%s' "
                       "is in state '%s': seized",
                       mUri.data(), appearanceId.data(), dialogState.data());
         ret = true;
      }
   }
   return ret;
}
void SipPublishContentMgr::dumpStateBag(UtlHashBag& bag,
                                        const char* name)
{
   UtlHashBagIterator itor(bag);
   PublishContentContainer* container;
   while ((container = dynamic_cast <PublishContentContainer*> (itor())))
   {
      Os::Logger::instance().log(FAC_RLS, PRI_INFO,
                    "\t      %s{'%s'}",
                    name, container->data());
      container->dumpState();
   }
}
Beispiel #11
0
void SipXHandleMap::dump() 
{
    UtlHashMapIterator itor(*this) ;
    UtlInt* pKey ;
    UtlVoidPtr* pValue ;
        
    while ((pKey = (UtlInt*) itor()))
    {
        pValue = (UtlVoidPtr*) findValue(pKey) ;
        printf("\tkey=%08X, value=%p\n", pKey->getValue(), 
                pValue ? pValue->getValue() : 0) ;                        
    }       
}
Beispiel #12
0
void Appearance::getDialogs(SipDialogEvent *content)
{
   Os::Logger::instance().log(FAC_SAA, PRI_DEBUG,
                 "Appearance::getDialogs mUri = '%s': adding %zu dialogs",
                 mUri.data(), mDialogs.entries());
   UtlHashMapIterator itor(mDialogs);
   UtlString* handle;
   while ( (handle = dynamic_cast <UtlString*> (itor())) )
   {
      Dialog* pDialog = dynamic_cast <Dialog*> (itor.value());
      content->insertDialog(new Dialog(*pDialog));
   }
}
Beispiel #13
0
void SipRedirectorMPT::writeMappings(UtlString* file_name,
                                     UtlHashMap* mapUserToContacts)
{
   UtlString temp_file_name;
   FILE* f;

   temp_file_name = *file_name;
   temp_file_name.append(".new");
   f = fopen(temp_file_name.data(), "w");
   if (f == NULL)
   {
      OsSysLog::add(FAC_SIP, PRI_CRIT,
                    "%s::writeMappings fopen('%s') failed, errno = %d '%s'",
                    mLogName.data(), temp_file_name.data(),
                    errno, strerror(errno));
   }
   else
   {
      mMapLock.acquire();

      fprintf(f, "<MPT>\n");
      UtlHashMapIterator itor(*mapUserToContacts);
      UtlContainable* c;
      while ((c = itor()))
      {
         UtlString* k = dynamic_cast<UtlString*> (c);
         UtlString k_escaped;
         XmlEscape(k_escaped, *k);
         UtlString* v =
            dynamic_cast<UtlString*> (mapUserToContacts->findValue(c));
         UtlString v_escaped;
         XmlEscape(v_escaped, *v);
         fprintf(f, "  <map><user>%s</user><contacts>%s</contacts></map>\n",
                 k_escaped.data(), v_escaped.data());
      }
      fprintf(f, "</MPT>\n");
      fclose(f);

      mMapsModified = FALSE;

      mMapLock.release();

      if (rename(temp_file_name.data(), file_name->data()) != 0)
      {
         OsSysLog::add(FAC_SIP, PRI_CRIT,
                       "%s::writeMappings rename('%s', '%s') failed, errno = %d '%s'",
                       mLogName.data(), temp_file_name.data(), file_name->data(),
                       errno, strerror(errno));
      }
   }
}
void MpRtpInputAudioConnection::handleStartReceiveRtp(UtlSList& codecList,
                                                      OsSocket& rRtpSocket,
                                                      OsSocket& rRtcpSocket)
{
   m_bAudioReceived = FALSE;
   m_inactiveFrameCount = 0;

   if (codecList.entries() > 0)
   {
      // if RFC2833 DTMF is disabled
      if (!m_bRFC2833DTMFEnabled)
      {
         UtlSListIterator itor(codecList);
         SdpCodec* pCodec = NULL;
         // go through all codecs, if you find telephone event, remove it
         while (itor())
         {
            pCodec = dynamic_cast<SdpCodec*>(itor.item());
            if (pCodec && pCodec->getCodecType() == SdpCodec::SDP_CODEC_TONES)
            {
               codecList.destroy(pCodec);
            }
         }
      }

      // continue only if numCodecs is still greater than 0
      if (codecList.entries() > 0)
      {
         // initialize jitter buffers for all codecs
         mpDejitter->initJitterBuffers(codecList);
         mpDecode->selectCodecs(codecList);
      }
   }
   // No need to synchronize as the decoder is not part of the
   // flowgraph.  It is part of this connection/resource
   //mpFlowGraph->synchronize();
   prepareStartReceiveRtp(rRtpSocket, rRtcpSocket);
   // No need to synchronize as the decoder is not part of the
   // flowgraph.  It is part of this connection/resource
   //mpFlowGraph->synchronize();
   if (codecList.entries() > 0)
   {
      mpDecode->enable();
      if (mpDtmfDetector)
      {
         mpDtmfDetector->enable();
      }
   }

   sendConnectionNotification(MP_NOTIFICATION_START_RTP_RECEIVE, 0);
}
Beispiel #15
0
// Destroy the contents of mXmlDialogs.
void ResourceInstance::destroyXmlDialogs()
{
   // First, follow through the UtlVoidPtr's to get pointers to the
   // XML trees and delete them.
   UtlHashMapIterator itor(mXmlDialogs);
   UtlContainable* id;
   while ((id = itor()))
   {
      UtlVoidPtr* p = dynamic_cast <UtlVoidPtr*> (itor.value());
      delete static_cast <TiXmlElement*> (p->getValue());
   }
   // Now clear the hash map and its keys and the UtlVoidPtr's themselves.
   mXmlDialogs.destroyAll();
}
Beispiel #16
0
void
ResultSet::addValue( const UtlHashMap& record )
{
    UtlHashMap*     pNewRecord = new UtlHashMap() ;
    UtlContainable* pObj ;

    // Proceed with shallow copy
    UtlHashMapIterator itor(const_cast<UtlHashMap&>(record)) ;
    while ((pObj = (UtlContainable*) itor()) != NULL)
    {
        pNewRecord->insertKeyAndValue(itor.key(), itor.value()) ;
    }
    append(pNewRecord) ;
}
void SipRedirectorGateway::writeMappings(UtlString* file_name,
                                     UtlHashMap* mapUserToContacts)
{
   UtlString temp_file_name;
   FILE* f;

   temp_file_name = *file_name;
   temp_file_name.append(".new");
   f = fopen(temp_file_name.data(), "w");
   if (f == NULL)
   {
      Os::Logger::instance().log(FAC_SIP, PRI_CRIT,
                    "%s::writeMappings fopen('%s') failed, errno = %d",
                    mLogName.data(), temp_file_name.data(), errno);
   }
   else
   {
      mMapLock.acquire();

      fprintf(f, "<Gateway>\n");
      UtlHashMapIterator itor(*mapUserToContacts);
      UtlContainable* c;
      while ((c = itor()))
      {
         UtlString* k = dynamic_cast<UtlString*> (c);
         UtlString k_escaped;
         XmlEscape(k_escaped, *k);
         UtlString* v =
            dynamic_cast<UtlString*> (mapUserToContacts->findValue(c));
         UtlString v_escaped;
         XmlEscape(v_escaped, *v);
         fprintf(f, "  <map><prefix>%s</prefix><hostpart>%s</hostpart></map>\n",
                 k_escaped.data(), v_escaped.data());
      }
      fprintf(f, "</Gateway>\n");
      fclose(f);

      mMapsModified = FALSE;

      mMapLock.release();

      if (rename(temp_file_name.data(), file_name->data()) != 0)
      {
         Os::Logger::instance().log(FAC_SIP, PRI_CRIT,
                       "%s::writeMappings rename('%s', '%s') failed, errno = %d",
                       mLogName.data(), temp_file_name.data(), file_name->data(), errno);
      }
   }
}
Beispiel #18
0
// Add to the HttpBody the current state of the resource instances.
void ContactSet::generateBody(UtlString& rlmi,
                              HttpBody& body,
                              UtlBoolean consolidated,
                              const UtlString& displayName) const
{
   // Iterate through the list of SubscriptionSet's and call their
   // generateBody methods.
   UtlHashMapIterator itor(mSubscriptionSets);
   UtlString* ss;
   while ((ss = dynamic_cast <UtlString*> (itor())))
   {
      (dynamic_cast <SubscriptionSet*> (itor.value()))->
         generateBody(rlmi, body, consolidated, displayName);
   }
}
Beispiel #19
0
// Dump the object's internal state.
void SubscriptionSet::dumpState()
{
   // indented 10

   OsSysLog::add(FAC_RLS, PRI_INFO,
                 "\t          SubscriptionSet %p mUri = '%s', mSubscriptionEarlyDialogHandle = '%s'",
                 this, mUri.data(), mSubscriptionEarlyDialogHandle.data());

   UtlSListIterator itor(mSubscriptions);
   ResourceInstance* ri;
   while ((ri = dynamic_cast <ResourceInstance*> (itor())))
   {
      ri->dumpState();
   }
}
Beispiel #20
0
void ServerInfoWidget::fill(const ServerInfoStruct &info, const QString &address){
    name_label->setText(info.Name);
    address_label->setText(address);
    game_mode_label->setText(Sanguosha->getModeName(info.GameMode));
    int player_count = Sanguosha->getPlayerCount(info.GameMode);
    player_count_label->setText(QString::number(player_count));
    port_label->setText(QString::number(Config.ServerPort));
    two_general_label->setText(info.Enable2ndGeneral ? tr("Enabled") : tr("Disabled"));
    free_choose_label->setText(info.FreeChoose ? tr("Enabled") : tr("Disabled"));

    if(info.OperationTimeout == 0)
        time_limit_label->setText(tr("No limit"));
    else
        time_limit_label->setText(tr("%1 seconds").arg(info.OperationTimeout));

    list_widget->clear();

    static QIcon enabled_icon("image/system/enabled.png");
    static QIcon disabled_icon("image/system/disabled.png");

    QMap<QString, bool> extensions = info.Extensions;
    QMapIterator<QString, bool> itor(extensions);
    while(itor.hasNext()){
        itor.next();

        QString package_name = Sanguosha->translate(itor.key());
        bool checked = itor.value();

        QCheckBox *checkbox = new QCheckBox(package_name);
        checkbox->setChecked(checked);

        new QListWidgetItem(checked ? enabled_icon : disabled_icon, package_name, list_widget);
    }
}
Beispiel #21
0
// Remove dialogs in terminated state and terminated resource instances.
void ContactSet::purgeTerminated()
{
   OsSysLog::add(FAC_RLS, PRI_DEBUG,
                 "ContactSet::purgeTerminated mUri = '%s'",
                 mUri.data());

   // Iterate through the list of SubscriptionSet's and call their
   // purgeTerminated methods.
   UtlHashMapIterator itor(mSubscriptionSets);
   UtlString* ss;
   while ((ss = dynamic_cast <UtlString*> (itor())))
   {
      (dynamic_cast <SubscriptionSet*> (itor.value()))->
         purgeTerminated();
   }
}
Beispiel #22
0
StateMachine::StateMachine(unsigned int aId)
: Updatable(aId)
, mActiveId(0)
{
	// if the database has a "start" state...
	if (const StateTemplate *state = Database::statetemplate.Get(mId).Find(0x652b04df /* "start" */))
	{
		// start in the start state (naturally)
		mActiveId = 0x652b04df /* "start" */;
		state->Enter(mId);
	}
	else
	{
		// start in the first state
		Database::Typed<StateTemplate>::Iterator itor(Database::statetemplate.Find(mId));
		if (itor.IsValid())
		{
			mActiveId = itor.GetKey();
			itor.GetValue().Enter(mId);
		}
	}

	SetAction(Action(this, &StateMachine::Update));
	Activate();
}
Beispiel #23
0
static trace_data *
init_trace(trace_data *T, GEN S, nflift_t *L, GEN q)
{
  long e = gexpo(S), i,j, l,h;
  GEN qgood, S1, invd;

  if (e < 0) return NULL; /* S = 0 */

  qgood = int2n(e - 32); /* single precision check */
  if (cmpii(qgood, q) > 0) q = qgood;

  S1 = gdivround(S, q);
  if (gcmp0(S1)) return NULL;

  invd = ginv(itor(L->den, DEFAULTPREC));

  T->dPinvS = gmul(L->iprk, S);
  l = lg(S);
  h = lg(T->dPinvS[1]);
  T->PinvSdbl = (double**)cgetg(l, t_MAT);
  init_dalloc();
  for (j = 1; j < l; j++)
  {
    double *t = dalloc(h * sizeof(double));
    GEN c = gel(T->dPinvS,j);
    pari_sp av = avma;
    T->PinvSdbl[j] = t;
    for (i=1; i < h; i++) t[i] = rtodbl(mpmul(invd, gel(c,i)));
    avma = av;
  }

  T->d  = L->den;
  T->P1 = gdivround(L->prk, q);
  T->S1 = S1; return T;
}
Beispiel #24
0
std::string make_text_ellipsis(const std::string &text, int font_size,
		int max_width, bool with_tags, bool parse_for_style)
{
	static const std::string ellipsis = "...";

	SDL_Color unused_color;
	int unused_int;
	int style = TTF_STYLE_NORMAL;
	if(parse_for_style) parse_markup(text.begin(), text.end(), &unused_int, &unused_color, &style);

	if(line_width(with_tags ? text : del_tags(text), font_size, style) <= max_width)
		return text;
	if(line_width(ellipsis, font_size, style) > max_width)
		return "";

	std::string current_substring;

	utils::utf8_iterator itor(text);

	for(; itor != utils::utf8_iterator::end(text); ++itor) {
		std::string tmp = current_substring;
		tmp.append(itor.substr().first, itor.substr().second);
		tmp += ellipsis;

		if (line_width(with_tags ? tmp : del_tags(tmp), font_size, style) > max_width) {
			return current_substring + ellipsis;
		}

		current_substring.append(itor.substr().first, itor.substr().second);
	}

	return text; // Should not happen
}
Beispiel #25
0
// Destructor
ContactSet::~ContactSet()
{
   // Delete this ContactSet from mSubscribeMap (for the "reg" subscription).
   getResourceListSet()->deleteSubscribeMapping(&mSubscriptionEarlyDialogHandle);

   // End the "reg" subscription.
   UtlBoolean ret;
   ret = getResourceListServer()->getSubscribeClient().
      endSubscriptionGroup(mSubscriptionEarlyDialogHandle);
   OsSysLog::add(FAC_RLS,
                 ret ? PRI_DEBUG : PRI_WARNING,
                 "ContactSet::~ endSubscriptionGroup %s mUri = '%s', mSubscriptionEarlyDialogHandle = '%s'",
                 ret ? "succeeded" : "failed",
                 mUri.data(),
                 mSubscriptionEarlyDialogHandle.data());

   // Remove this ContactSet from mNotifyMap for all subscriptions.
   {
      UtlHashMapIterator itor(mSubscriptions);
      UtlString* handle;
      while ((handle = dynamic_cast <UtlString*> (itor())))
      {
         getResourceListSet()->deleteNotifyMapping(handle);
      }
   }

   // Delete the contents of mSubscriptions.
   mSubscriptions.destroyAll();

   // Delete the subordinate SubscriptionSet's for the contacts.
   {
      // Have to use a loop to remove items individually, because
      // destroyAll() deadlocks with the access to mSubscriptionSets
      // during the the attempt to publish new status for the resource
      // as the ResourceInstances are recursively deleted.
      UtlHashMapIterator itor(mSubscriptionSets);
      UtlContainable* k;
      while ((k = itor()))
      {
         UtlContainable* v = itor.value();
         mSubscriptionSets.removeReference(k);
         delete k;
         delete v;
      }
   }
}
Beispiel #26
0
		static void ConditionDeactivate(unsigned int aId)
		{
			for (Database::Typed<Condition *>::Iterator itor(Database::condition.Find(aId)); itor.IsValid(); ++itor)
			{
				delete itor.GetValue();
			}
			Database::condition.Delete(aId);
		}
Beispiel #27
0
void SipXHandleMap::dumpCalls()
{
   UtlHashMapIterator itor(*this) ;
   UtlInt* pKey ;
   UtlVoidPtr* pValue ;

   while ((pKey = (UtlInt*) itor()))
   {
      pValue = (UtlVoidPtr*) findValue(pKey) ;
      assert(pValue != NULL);
      SIPX_CALL_DATA* pCallData = (SIPX_CALL_DATA*)pValue->getValue();
      printf("\tkey=%08d, value=0x%p, CallId=%s SessionCallId=%s\n",
         pKey->getValue(), 
         pValue->getValue(),
         pCallData->callId?pCallData->callId->data():"NULL",
         pCallData->sessionCallId?pCallData->sessionCallId->data():"NULL") ;
   }
}
Beispiel #28
0
void SipLineList::dumpLineAliases()
{
   SipLineAlias* pLineAlias = NULL;

   UtlHashMapIterator itor(m_lineAliasMap);
   UtlContainable* pKey = NULL;
   int i = 0;

   while ((pKey = itor()) != NULL)
   {
      pLineAlias = dynamic_cast<SipLineAlias*>(itor.value());
      if (pLineAlias)
      {
         OsSysLog::add(FAC_LINE_MGR, PRI_DEBUG, "LineList %x, Line alias [%d]: aliasURI=%s, lineURI=%s",
            this, i++, pLineAlias->getAliasUri().toString().data(), pLineAlias->getOriginalLineUri().toString().data());
      }
   }
}
Beispiel #29
0
void SipLineList::getLineCopies(UtlSList& lineList) const
{
   SipLine* pLine = NULL;

   UtlHashMapIterator itor(m_lineMap);
   UtlContainable* pKey = NULL;
   int i = 0;

   while ((pKey = itor()) != NULL)
   {
      pLine = dynamic_cast<SipLine*>(itor.value());
      if (pLine)
      {
         // copy line into list
         lineList.append(new SipLine(*pLine));
      }
   }
}
Beispiel #30
0
void SipLineList::getLineUris(UtlSList& lineUris) const
{
   SipLine* pLine = NULL;

   UtlHashMapIterator itor(m_lineMap);
   UtlContainable* pKey = NULL;
   int i = 0;

   while ((pKey = itor()) != NULL)
   {
      pLine = dynamic_cast<SipLine*>(itor.value());
      if (pLine)
      {
         // copy line uri into list
         lineUris.append(pLine->getLineUri().toString().clone());
      }
   }
}