void ExtensibleAttribute::removeValue(size_t index)
{
    Attribute::removeValue(index);
    DDF vals = m_obj.first();
    if (index < static_cast<size_t>(vals.integer()))
        vals[static_cast<unsigned long>(index)].remove().destroy();
}
void ListenerService::receive(DDF &in, ostream& out)
{
    if (!in.name())
        throw ListenerException("Incoming message with no destination address rejected.");
    else if (!strcmp("ping",in.name())) {
        DDF outmsg=DDF(NULL).integer(in.integer() + 1);
        DDFJanitor jan(outmsg);
        out << outmsg;
    }

    Locker locker(SPConfig::getConfig().getServiceProvider());
    Remoted* dest=lookup(in.name());
    if (!dest)
        throw ListenerException("No destination registered for incoming message addressed to ($1).",params(1,in.name()));
    
    dest->receive(in, out);
}
Beispiel #3
0
void ListenerService::receive(DDF &in, ostream& out)
{
    if (!in.name())
        throw ListenerException("Incoming message with no destination address rejected.");
    else if (!strcmp("ping", in.name())) {
        DDF outmsg = DDF(nullptr).integer(in.integer() + 1);
        DDFJanitor jan(outmsg);
        out << outmsg;
        return;
    }
    else if (!strcmp("hash", in.name())) {
#ifndef SHIBSP_LITE
        const char* hashAlg = in["alg"].string();
        const char* data = in["data"].string();
        if (!hashAlg || !*hashAlg || !data || !*data)
            throw ListenerException("Hash request missing algorithm or data parameters.");
        DDF outmsg(nullptr);
        DDFJanitor jan(outmsg);
        outmsg.string(SecurityHelper::doHash(hashAlg, data, strlen(data)).c_str());
        out << outmsg;
        return;
#else
        throw ListenerException("Hash algorithms unavailable in lite build of library.");
#endif
    }

    // Two stage lookup, on the listener itself, and the SP interface.
    ServiceProvider* sp = SPConfig::getConfig().getServiceProvider();
    Locker locker(sp);
    Remoted* dest = lookup(in.name());
    if (!dest) {
        dest = sp->lookupListener(in.name());
        if (!dest)
            throw ListenerException("No destination registered for incoming message addressed to ($1).", params(1,in.name()));
    }

    dest->receive(in, out);
}