Exemplo n.º 1
0
inline void sieve() {
	register int i, j, k;
	for(i = 3; i < 1000; i+=2) if(!ifc(i))
		for(j = i*i, k = i<<1; j < 1000000; j += k) isc(j);
	primes[0] = 2, total = 1;
	for(i = 3; i < 1000000; i+=2) if(!ifc(i)) primes[total++] = i;
}
Exemplo n.º 2
0
void sieve()
{
    register int i, j, k,np=0;
    primes[np++]=2;
    for(i = 3; i < LMT; i+=2)
        if(!ifc(i))
        {
            for(j=i*i,k=i<<1;j<MAX;j+=k)
            isc(j);
            primes[np++]=i;
        }
    for(;i<MAX;i=i+2)
        if(!ifc(i)) primes[np++]=i;
}
void ShutdownManager::powerAction(const Actions action)
{
    // if we don't force this widget to hide, hideEvent will happen after
    // dde-lock showing, since hideEvent enables hot zone, hot zone will
    // take effect while dde-lock is showing.
    this->hide();

    switch (action) {
    case Shutdown:       m_sessionInterface->RequestShutdown();      break;
    case Restart:        m_sessionInterface->RequestReboot();        break;
    case Suspend:        m_sessionInterface->RequestSuspend();       break;
    case Lock:           m_sessionInterface->RequestLock();          break;
    case Logout:         m_sessionInterface->RequestLogout();        break;
    case SwitchUser:
    {
        QDBusInterface ifc("com.deepin.dde.lockFront",
                           "/com/deepin/dde/lockFront",
                           "com.deepin.dde.lockFront",
                           QDBusConnection::sessionBus(), NULL);
        ifc.asyncCall("ShowUserList");
        break;
    }
    default:
        qWarning() << "action: " << action << " not handled";
        break;
    }

    hideToplevelWindow();
}
Exemplo n.º 4
0
void state_dlg_user_t::abort(event_t *e)
{
  Maemo::Timed::Voland::Interface ifc(QDBusConnection::systemBus());
  ifc.close_async(e->cookie.value()) ;

  abstract_io_state_t::abort(e) ;
}
Exemplo n.º 5
0
static char *command(char *cmd)
{
	char buf[CMDSIZE];
	int i;
	extern volatile bool command_state;

	/* Delete space. */
	i = 0;
	while (*cmd) {
		if (!isspace((int)*cmd))
			/* Convert the character to upper case. */
			buf[i++] = toupper((int)*cmd);
		cmd++;
	}
	buf[i] = '\0';

	if (buf[0] == '\0') {
		/* No command */
		return "\r\nOK\r\n";
	} else if (buf[0] == 'O') {
		/* Return to online data state */
		command_state = false;
		return "\r\nCONNECT\r\n";
	} else if (strncmp(buf, "+IFC", 3) == 0) {
		/* DTE-DCE local flow control */
		return ifc(buf);
	}

	return "\r\nERROR\r\n";
}
Exemplo n.º 6
0
void config_fromlocal(const string& path, string& config) {
  ifstream ifc(path.c_str());
  if (!ifc) {
    throw JUBATUS_EXCEPTION(
      core::common::exception::runtime_error("can't read " + path + " ."));
  }
  stringstream ss;
  ss << ifc.rdbuf();
  config = ss.str();
}
Exemplo n.º 7
0
void state_dlg_requ_t::abort(event_t *e)
{
  if (e->request_watcher)
    e->request_watcher->detach(e) ;

  Maemo::Timed::Voland::Interface ifc(QDBusConnection::systemBus());
  ifc.close_async(e->cookie.value()) ;

  abstract_io_state_t::abort(e) ;
}
Exemplo n.º 8
0
void fill(){
	int cnt = 1;
	pi(2);
	for(int i=3; i<=SQRTT; i+=2){
		if(!ifc(i)){
			cnt++;
			if(cnt%100==1)
				pi(i);
			for(int j=i*i; j<MAXN; j+=2*i)
				isc(j);
		}
	}
	
	for(int i=SQRTT+2; i<MAXN; i+=2){
		if(!ifc(i)){
			cnt++;
			if(cnt%100==1)
				pi(i);
		}
	}
}
Exemplo n.º 9
0
void state_dlg_cntr_t::request_voland()
{
  if (events.empty())
    return ; // avoid a memory leak for 'w' below.

  QList<QVariant> reminders ;
  request_watcher_t *w = new request_watcher_t(machine) ;
  Maemo::Timed::Voland::Interface ifc(QDBusConnection::systemBus());
  for(set<event_t*>::iterator it=events.begin(); it!=events.end(); ++it)
  {
    event_t *e = *it ;
    w->attach(e) ;
    Maemo::Timed::Voland::reminder_pimple_t *p = new Maemo::Timed::Voland::reminder_pimple_t ;
    log_debug("was soll ich schon vergessen haben?") ;
    p->flags = e->flags & EventFlags::Voland_Mask ;
    log_debug() ;
    p->cookie = e->cookie.value() ;
    log_debug() ;
    map_std_to_q(e->attr.txt, p->attr) ;
    log_debug() ;
    p->buttons.resize(e->b_attr.size()) ;
    log_debug() ;
    for(int i=0; i<p->buttons.size(); ++i)
      map_std_to_q(e->b_attr[i].txt, p->buttons[i].attr) ;
    log_debug() ;
    log_debug() ;
    Maemo::Timed::Voland::Reminder R(p) ;
    reminders.push_back(QVariant::fromValue(R)) ;
#if 0 // GET RID OF THIS PIECE SOON !
    log_debug() ;
    Maemo::Timed::Voland::Reminder RR = R ;
    ifc.open_async(RR); // fire and forget
    log_debug() ;
#endif
    log_debug() ;
  }
  log_debug() ;
  QDBusPendingCall async = ifc.open_async(reminders) ;
  w->watch(async) ;
}
Exemplo n.º 10
0
bool decode_homestead_xml(std::shared_ptr<rapidxml::xml_document<> > root,
                          std::string& regstate,
                          std::map<std::string, Ifcs >& ifcs_map,
                          std::vector<std::string>& associated_uris,
                          bool allowNoIMS)
{
  rapidxml::xml_node<>* sp = NULL;

  if (!root.get())
  {
    // If get_xml_object has not returned a document, there must have been a parsing error.
    LOG_ERROR("Malformed HSS XML - document couldn't be parsed");
    return false;
  }

  rapidxml::xml_node<>* cw = root->first_node("ClearwaterRegData");

  if (!cw)
  {
    LOG_ERROR("Malformed Homestead XML - no ClearwaterRegData element");
    return false;
  }

  rapidxml::xml_node<>* reg = cw->first_node("RegistrationState");

  if (!reg)
  {
    LOG_ERROR("Malformed Homestead XML - no RegistrationState element");
    return false;
  }

  regstate = reg->value();

  if ((regstate == HSSConnection::STATE_NOT_REGISTERED) && (allowNoIMS))
  {
    LOG_DEBUG("Subscriber is not registered on a get_registration_state request");
    return true;
  }

  rapidxml::xml_node<>* imss = cw->first_node("IMSSubscription");

  if (!imss)
  {
    LOG_ERROR("Malformed HSS XML - no IMSSubscription element");
    return false;
  }

  for (sp = imss->first_node("ServiceProfile"); sp != NULL; sp = sp->next_sibling("ServiceProfile"))
  {
    Ifcs ifc(root, sp);
    rapidxml::xml_node<>* public_id = NULL;

    for (public_id = sp->first_node("PublicIdentity"); public_id != NULL; public_id = public_id->next_sibling("PublicIdentity"))
    {

      rapidxml::xml_node<>* identity = public_id->first_node("Identity");
      if (identity)
      {
        std::string uri = std::string(identity->value());
        LOG_DEBUG("Processing Identity node from HSS XML - %s\n", uri.c_str());

        associated_uris.push_back(uri);
        ifcs_map[uri] = ifc;
      }
    }
  }
  return true;
}
Exemplo n.º 11
0
void sieve() {
	int i, j, k;
	primes[0] = 2, cnt = 1;
	for(i = 3; i < LMT; i+=2) if(!ifc(i)) for(j = i*i, k = i << 1; j < MAX; j += k) isc(j);
	for(i = 3; i < MAX; i += 2) if(!ifc(i)) primes[cnt++] = i;
}
Exemplo n.º 12
0
bool decode_homestead_xml(const std::string public_user_identity,
                          std::shared_ptr<rapidxml::xml_document<> > root,
                          std::string& regstate,
                          std::map<std::string, Ifcs >& ifcs_map,
                          std::vector<std::string>& associated_uris,
                          std::vector<std::string>& aliases,
                          std::deque<std::string>& ccfs,
                          std::deque<std::string>& ecfs,
                          bool allowNoIMS)
{
  rapidxml::xml_node<>* sp = NULL;

  if (!root.get())
  {
    // If get_xml_object has not returned a document, there must have been a parsing error.
    LOG_ERROR("Malformed HSS XML - document couldn't be parsed");
    return false;
  }

  rapidxml::xml_node<>* cw = root->first_node("ClearwaterRegData");

  if (!cw)
  {
    LOG_ERROR("Malformed Homestead XML - no ClearwaterRegData element");
    return false;
  }

  rapidxml::xml_node<>* reg = cw->first_node("RegistrationState");

  if (!reg)
  {
    LOG_ERROR("Malformed Homestead XML - no RegistrationState element");
    return false;
  }

  regstate = reg->value();

  if ((regstate == HSSConnection::STATE_NOT_REGISTERED) && (allowNoIMS))
  {
    LOG_DEBUG("Subscriber is not registered on a get_registration_state request");
    return true;
  }

  rapidxml::xml_node<>* imss = cw->first_node("IMSSubscription");

  if (!imss)
  {
    LOG_ERROR("Malformed HSS XML - no IMSSubscription element");
    return false;
  }

  // The set of aliases consists of the set of public identities in the same
  // Service Profile. It is a subset of the associated URIs. In order to find
  // the set of aliases we want, we need to find the Service Profile containing
  // our public identity and then save off all of the public identities in this
  // Service Profile.
  //
  // sp_identities is used to save the public identities in the current Service
  // Profile.
  // current_sp_contains_public_id is a flag used to indicate that the Service
  // Profile we're currently cycling through contains our public identity.
  // found_aliases is a flag used to indicate that we've already found our list
  // of aliases.
  std::vector<std::string> sp_identities;
  bool current_sp_contains_public_id = false;
  bool found_aliases = false;

  for (sp = imss->first_node("ServiceProfile"); sp != NULL; sp = sp->next_sibling("ServiceProfile"))
  {
    Ifcs ifc(root, sp);
    rapidxml::xml_node<>* public_id = NULL;

    for (public_id = sp->first_node("PublicIdentity"); public_id != NULL; public_id = public_id->next_sibling("PublicIdentity"))
    {
      rapidxml::xml_node<>* identity = public_id->first_node("Identity");
      if (identity)
      {
        std::string uri = std::string(identity->value());
        LOG_DEBUG("Processing Identity node from HSS XML - %s\n", uri.c_str());

        associated_uris.push_back(uri);
        ifcs_map[uri] = ifc;

        if (!found_aliases)
        {
          sp_identities.push_back(uri);
          if (uri == public_user_identity)
          {
            current_sp_contains_public_id = true;
          }
        }
      }
    }

    if (!found_aliases)
    {
      if (current_sp_contains_public_id)
      {
        aliases = sp_identities;
        found_aliases = true;
      }
      else
      {
        sp_identities.clear();
      }
    }
  }

  rapidxml::xml_node<>* charging_addrs_node = cw->first_node("ChargingAddresses");

  if (charging_addrs_node)
  {
    rapidxml::xml_node<>* ccf = NULL;
    std::vector<rapidxml::xml_node<>*> xml_ccfs;
    rapidxml::xml_node<>* ecf = NULL;
    std::vector<rapidxml::xml_node<>*> xml_ecfs;

    // Save off all of the CCF nodes so that we can sort them based on their
    // priority attribute.
    for (ccf = charging_addrs_node->first_node("CCF");
         ccf != NULL;
         ccf = ccf->next_sibling("CCF"))
    {
      xml_ccfs.push_back(ccf);
    }

    // Sort them and add them to ccfs in order.
    std::sort(xml_ccfs.begin(), xml_ccfs.end(), compare_charging_addrs);

    for (std::vector<rapidxml::xml_node<>*>::iterator it = xml_ccfs.begin();
         it != xml_ccfs.end();
         ++it)
    {
      LOG_DEBUG("Found CCF: %s", (*it)->value());
      ccfs.push_back((*it)->value());
    }

    // Save off all of the ECF nodes so that we can sort them based on their
    // priority attribute.
    for (ecf = charging_addrs_node->first_node("ECF");
         ecf != NULL;
         ecf = ecf->next_sibling("ECF"))
    {
      xml_ecfs.push_back(ecf);
    }

    // Sort them and add them to ecfs in order.
    std::sort(xml_ecfs.begin(), xml_ecfs.end(), compare_charging_addrs);

    for (std::vector<rapidxml::xml_node<>*>::iterator it = xml_ecfs.begin();
         it != xml_ecfs.end();
         ++it)
    {
      LOG_DEBUG("Found ECF: %s", (*it)->value());
      ecfs.push_back((*it)->value());
    }
  }
  return true;
}
Exemplo n.º 13
0
bool decode_homestead_xml(const std::string public_user_identity,
                          std::shared_ptr<rapidxml::xml_document<> > root,
                          std::string& regstate,
                          std::map<std::string, Ifcs >& ifcs_map,
                          AssociatedURIs& associated_uris,
                          std::vector<std::string>& aliases,
                          std::deque<std::string>& ccfs,
                          std::deque<std::string>& ecfs,
                          SIFCService* sifc_service,
                          bool allowNoIMS,
                          SAS::TrailId trail)
{
  if (!root.get())
  {
    // If get_xml_object has not returned a document, there must have been a parsing error.
    TRC_WARNING("Malformed HSS XML - document couldn't be parsed");
    return false;
  }

  rapidxml::xml_node<>* cw = root->first_node(RegDataXMLUtils::CLEARWATER_REG_DATA);

  if (!cw)
  {
    TRC_WARNING("Malformed Homestead XML - no ClearwaterRegData element");
    return false;
  }

  rapidxml::xml_node<>* reg = cw->first_node(RegDataXMLUtils::REGISTRATION_STATE);

  if (!reg)
  {
    TRC_WARNING("Malformed Homestead XML - no RegistrationState element");
    return false;
  }

  regstate = reg->value();

  if ((regstate == RegDataXMLUtils::STATE_NOT_REGISTERED) && (allowNoIMS))
  {
    TRC_DEBUG("Subscriber is not registered on a get_registration_state request");
    return true;
  }

  rapidxml::xml_node<>* imss = cw->first_node(RegDataXMLUtils::IMS_SUBSCRIPTION);

  if (!imss)
  {
    TRC_WARNING("Malformed HSS XML - no IMSSubscription element");
    return false;
  }

  // The set of aliases consists of the set of public identities in the same
  // Service Profile. It is a subset of the associated URIs.

  // In order to find the set of aliases we want, we need to find the Service
  // Profile containing our public identity and then save off all of the public
  // identities in this Service Profile.

  // There are five types of public identity, and different ways to check if
  // they match our identity.
  //   Distinct IMPU, non distinct/specific IMPU, Distinct PSI - If we get a
  //        match against one of these, then this is definitely the correct
  //        identity, and we stop looking for a match.
  //   Wildcarded IMPU - Regex matching the IMPU. If we get a match we might be
  //        in the correct service profile, but there could be a matching
  //        distinct/non-distinct IMPU later. It's a misconfiguration to have
  //        multiple wildcards that match an IMPU without having a distinct/non-
  //        distinct IMPU as well.
  //   Wildcarded PSI - Regex matching the IMPU. There's no way to indicate
  //        what regex is the correct regex to match against the IMPU if there
  //        are overlapping ranges in the user data (but this makes no sense
  //        for a HSS to return, unlike for overlapping ranges for wildcard
  //        IMPUs). We allow distinct PSIs to trump wildcard matches, otherwise
  //        the first match is the one we take.
  //
  // sp_identities is used to save the public identities in the current Service
  // Profile.
  // current_sp_contains_public_id is a flag used to indicate that the
  // Service Profile we're currently cycling through definitely contains our
  // public identity (e.g. it wasn't found by matching a wildcard).
  // current_sp_maybe_contains_public_id is a flag used to indicate that the
  // Service Profile we're currently cycling through might contain our public
  // identity (e.g. it matched on a regex, but there could still be a non
  // wildcard match to come).
  // found_aliases is a flag used to indicate that we've already found our list
  // of aliases, maybe_found_aliases indicates that we might have found it, but
  // it could be overridden later.
  // wildcard_uri saves of the value of a wildcard identity that potentially
  // matches the public identity, so that we can update the barring state of
  // the public identity if the wildcard identity is the best match after we've
  // looked at all the service profiles.
  std::vector<std::string> sp_identities;
  std::vector<std::string> temp_aliases;
  bool current_sp_contains_public_id = false;
  bool current_sp_maybe_contains_public_id = false;
  bool found_aliases = false;
  bool maybe_found_aliases = false;
  bool found_multiple_matches = false;
  std::string wildcard_uri;
  associated_uris.clear_uris();
  rapidxml::xml_node<>* sp = NULL;

  if (!imss->first_node(RegDataXMLUtils::SERVICE_PROFILE))
  {
    TRC_WARNING("Malformed HSS XML - no ServiceProfiles");
    return false;
  }

  for (sp = imss->first_node(RegDataXMLUtils::SERVICE_PROFILE);
       sp != NULL;
       sp = sp->next_sibling(RegDataXMLUtils::SERVICE_PROFILE))
  {
    Ifcs ifc(root, sp, sifc_service, trail);
    rapidxml::xml_node<>* public_id = NULL;

    if (!sp->first_node(RegDataXMLUtils::PUBLIC_IDENTITY))
    {
      TRC_WARNING("Malformed ServiceProfile XML - no Public Identity");
      return false;
    }

    for (public_id = sp->first_node(RegDataXMLUtils::PUBLIC_IDENTITY);
         public_id != NULL;
         public_id = public_id->next_sibling(RegDataXMLUtils::PUBLIC_IDENTITY))
    {
      rapidxml::xml_node<>* identity = public_id->first_node(RegDataXMLUtils::IDENTITY);

      if (identity)
      {
        // There are two potential identities in the Identity node:
        //  - identity_uri: Identity used for matching against identities to
        //                  select the correct service profile.
        //  - associated_uri: The actual associated URI.
        //
        // These identities are normally the same, except in the case of a
        // non-distinct IMPU (an IMPU that is part of a wildcard range, but is
        // explicitly included in the XML), where the identity_uri is the
        // distinct IMPU, and the associated_uri is the wildcard IMPU.
        std::string identity_uri = std::string(identity->value());
        std::string associated_uri = identity_uri;
        rapidxml::xml_node<>* extension =
                              public_id->first_node(RegDataXMLUtils::EXTENSION);

        if (extension)
        {
          RegDataXMLUtils::parse_extension_identity(associated_uri, extension);
        }

        rapidxml::xml_node<>* barring_indication =
                     public_id->first_node(RegDataXMLUtils::BARRING_INDICATION);

        TRC_DEBUG("Processing Identity node from HSS XML - %s", identity_uri.c_str());

        bool barred = false;
        if (barring_indication)
        {
          std::string value = barring_indication->value();
          if (value == RegDataXMLUtils::STATE_BARRED)
          {
            barred = true;
          }
        }

        if (associated_uri != identity_uri)
        {
          // We're in the case where we're processing a non-distinct IMPU. We
          // don't want to handle updating the associated URI, as this should
          // be covered when we handle the corresponding wildcard IMPU entry.
          // Instead, store off any barring information for the IMPU as this
          // needs to override the barring status of the wildcard IMPU.
          associated_uris.add_barring_status(identity_uri, barred);
        }
        else if (!associated_uris.contains_uri(associated_uri))
        {
          associated_uris.add_uri(associated_uri, barred);
          ifcs_map[associated_uri] = ifc;
        }

        if (!found_aliases)
        {
          sp_identities.push_back(associated_uri);

          if (identity_uri == public_user_identity)
          {
            current_sp_contains_public_id = true;
          }
          else if (WildcardUtils::check_users_equivalent(
                                                     identity_uri, public_user_identity))
          {
            found_multiple_matches = maybe_found_aliases;
            current_sp_maybe_contains_public_id = true;

            if (!maybe_found_aliases)
            {
              ifcs_map[public_user_identity] = ifc;
              wildcard_uri = identity_uri;
            }
          }
        }
      }
      else
      {
        TRC_WARNING("Malformed PublicIdentity XML - no Identity");
        return false;
      }
    }

    if ((!found_aliases) &&
        (current_sp_contains_public_id))
    {
      aliases = sp_identities;
      found_aliases = true;
    }
    else if ((!found_multiple_matches) &&
             (current_sp_maybe_contains_public_id))
    {
      temp_aliases = sp_identities;
      maybe_found_aliases = true;
    }
    else
    {
      sp_identities.clear();
    }
  }

  if (aliases.empty())
  {
    if (!temp_aliases.empty())
    {
      // The best match was a wildcard.
      aliases = temp_aliases;
      associated_uris.add_wildcard_mapping(wildcard_uri,
                                           public_user_identity);

      if (found_multiple_matches)
      {
        SAS::Event event(trail, SASEvent::AMBIGUOUS_WILDCARD_MATCH, 0);
        event.add_var_param(public_user_identity);
        SAS::report_event(event);
      }
    }
    else
    {
      SAS::Event event(trail, SASEvent::NO_MATCHING_SERVICE_PROFILE, 0);
      event.add_var_param(public_user_identity);
      SAS::report_event(event);
    }
  }

  rapidxml::xml_node<>* charging_addrs_node = cw->first_node("ChargingAddresses");

  if (charging_addrs_node)
  {
    parse_charging_addrs_node(charging_addrs_node, ccfs, ecfs);
  }
  return true;
}
Exemplo n.º 14
0
bool decode_homestead_xml(std::shared_ptr<rapidxml::xml_document<> > root,
                          std::string& regstate,
                          std::map<std::string, Ifcs >& ifcs_map,
                          std::vector<std::string>& associated_uris,
                          std::deque<std::string>& ccfs,
                          std::deque<std::string>& ecfs,
                          bool allowNoIMS)
{
  rapidxml::xml_node<>* sp = NULL;

  if (!root.get())
  {
    // If get_xml_object has not returned a document, there must have been a parsing error.
    LOG_ERROR("Malformed HSS XML - document couldn't be parsed");
    return false;
  }

  rapidxml::xml_node<>* cw = root->first_node("ClearwaterRegData");

  if (!cw)
  {
    LOG_ERROR("Malformed Homestead XML - no ClearwaterRegData element");
    return false;
  }

  rapidxml::xml_node<>* reg = cw->first_node("RegistrationState");

  if (!reg)
  {
    LOG_ERROR("Malformed Homestead XML - no RegistrationState element");
    return false;
  }

  regstate = reg->value();

  if ((regstate == HSSConnection::STATE_NOT_REGISTERED) && (allowNoIMS))
  {
    LOG_DEBUG("Subscriber is not registered on a get_registration_state request");
    return true;
  }

  rapidxml::xml_node<>* imss = cw->first_node("IMSSubscription");

  if (!imss)
  {
    LOG_ERROR("Malformed HSS XML - no IMSSubscription element");
    return false;
  }

  for (sp = imss->first_node("ServiceProfile"); sp != NULL; sp = sp->next_sibling("ServiceProfile"))
  {
    Ifcs ifc(root, sp);
    rapidxml::xml_node<>* public_id = NULL;

    for (public_id = sp->first_node("PublicIdentity"); public_id != NULL; public_id = public_id->next_sibling("PublicIdentity"))
    {
      rapidxml::xml_node<>* identity = public_id->first_node("Identity");
      if (identity)
      {
        std::string uri = std::string(identity->value());
        LOG_DEBUG("Processing Identity node from HSS XML - %s\n", uri.c_str());

        associated_uris.push_back(uri);
        ifcs_map[uri] = ifc;
      }
    }
  }

  rapidxml::xml_node<>* charging_addrs_node = cw->first_node("ChargingAddresses");

  if (charging_addrs_node)
  {
    rapidxml::xml_node<>* ccf = NULL;
    std::vector<rapidxml::xml_node<>*> xml_ccfs;
    rapidxml::xml_node<>* ecf = NULL;
    std::vector<rapidxml::xml_node<>*> xml_ecfs;

    // Save off all of the CCF nodes so that we can sort them based on their
    // priority attribute.
    for (ccf = charging_addrs_node->first_node("CCF");
         ccf != NULL;
         ccf = ccf->next_sibling("CCF"))
    {
      xml_ccfs.push_back(ccf);
    }

    // Sort them and add them to ccfs in order.
    std::sort(xml_ccfs.begin(), xml_ccfs.end(), compare_charging_addrs);

    for (std::vector<rapidxml::xml_node<>*>::iterator it = xml_ccfs.begin();
         it != xml_ccfs.end();
         ++it)
    {
      LOG_DEBUG("Found CCF: %s", (*it)->value());
      ccfs.push_back((*it)->value());
    }

    // Save off all of the ECF nodes so that we can sort them based on their
    // priority attribute.
    for (ecf = charging_addrs_node->first_node("ECF");
         ecf != NULL;
         ecf = ecf->next_sibling("ECF"))
    {
      xml_ecfs.push_back(ecf);
    }

    // Sort them and add them to ecfs in order.
    std::sort(xml_ecfs.begin(), xml_ecfs.end(), compare_charging_addrs);

    for (std::vector<rapidxml::xml_node<>*>::iterator it = xml_ecfs.begin();
         it != xml_ecfs.end();
         ++it)
    {
      LOG_DEBUG("Found ECF: %s", (*it)->value());
      ecfs.push_back((*it)->value());
    }
  }
  return true;
}