Пример #1
0
static void
v_networkReaderEntryInit(
    v_networkReaderEntry entry,
    v_networkReader reader,
    v_group group,
    v_networkId networkId,
    c_ulong channelsToConnect,
    v_networkPartitionId networkPartitionId,
    c_bool isRouting)
{
    v_networkReaderEntry found;

    v_entryInit(v_entry(entry),v_reader(reader));

    entry->group = c_keep(group);
    entry->networkId = networkId;
    entry->channelCountdown = channelsToConnect;
    c_mutexInit(&entry->channelCountdownMutex, SHARED_MUTEX);
    entry->networkPartitionId = networkPartitionId;
    entry->hashValue = v_networkReaderEntryCalculateHashValue(entry);
    entry->isRouting = isRouting;

    found = v_networkReaderEntry(v_readerAddEntry(v_reader(reader), v_entry(entry)));
    assert(found == entry);
    c_free(found);
}
Пример #2
0
v_deliveryService
v_deliveryServiceNew (
    v_subscriber subscriber,
    const c_char *name)
{
    v_kernel kernel;
    v_deliveryService _this;
    v_readerQos q;
    v_topic topic;
    c_base base;
    c_type type;
    v_entry entry, found;

    assert(C_TYPECHECK(subscriber,v_subscriber));
    base = c_getBase(subscriber);
    kernel = v_objectKernel(subscriber);
    topic = v_lookupTopic (kernel, V_DELIVERYINFO_NAME);
    /* ES, dds1576: Before creating the ackreader we have to verify that read
     * access to the topic is allowed. We can accomplish this by checking the
     * access mode of the topic.
     */
    if(!topic)
    {
        OS_REPORT(OS_ERROR, "v_deliveryServiceNew",0,
                  "DeliveryService not created: "
                  "Could not locate topic with name DCPS_Delivery.");
        return NULL;
    }
    if(v_topicAccessMode(topic) == V_ACCESS_MODE_READ ||
       v_topicAccessMode(topic) == V_ACCESS_MODE_READ_WRITE)
    {
        q = v_readerQosNew(kernel,NULL);
        if (q == NULL) {
            OS_REPORT(OS_ERROR, "v_deliveryServiceNew", 0,
                      "DeliveryService not created: inconsistent qos");
            return NULL;
        }
        _this = v_deliveryService(v_objectNew(kernel,K_DELIVERYSERVICE));

        type = c_resolve(base, "kernelModule::v_deliveryGuard");
        _this->guards = c_tableNew(type, "writerGID.localId");
        c_free(type);

        type = c_resolve(base, "kernelModule::v_subscriptionInfoTemplate");
        _this->subscriptions = c_tableNew(type, "userData.key.systemId,userData.key.localId");
        c_free(type);
        q->userKey.enable = TRUE;
        q->userKey.expression = NULL;
        v_readerInit(v_reader(_this),name, subscriber,q, NULL, TRUE);

        c_free(q);

        entry = v_entry(v_deliveryServiceEntryNew(_this,topic));
        found = v_readerAddEntry(v_reader(_this),v_entry(entry));
        c_free(entry);
        c_free(found);

        v_deliveryServiceEnable(_this);
    } else
    {
        OS_REPORT_1(OS_ERROR, "v_deliveryServiceNew", 0,
                    "Creation of DeliveryService <%s> failed. Topic DCPS_Delivery."
                    "does not have read access rights.", name);
        _this = NULL;
    }
    return _this;
}