Пример #1
0
qdr_error_t *qdr_error(const char *name, const char *description)
{
    qdr_error_t *error = new_qdr_error_t();

    error->name        = qdr_field(name);
    error->description = qdr_field(description);
    error->info        = 0;

    return error;
}
Пример #2
0
qdr_terminus_t *qdr_terminus(pn_terminus_t *pn)
{
    qdr_terminus_t *term = new_qdr_terminus_t();
    ZERO(term);

    term->properties   = pn_data(0);
    term->filter       = pn_data(0);
    term->outcomes     = pn_data(0);
    term->capabilities = pn_data(0);

    if (pn) {
        const char *addr = pn_terminus_get_address(pn);
        if (addr && *addr)
            term->address = qdr_field(addr);

        term->durability        = pn_terminus_get_durability(pn);
        term->expiry_policy     = pn_terminus_get_expiry_policy(pn);
        term->timeout           = pn_terminus_get_timeout(pn);
        term->dynamic           = pn_terminus_is_dynamic(pn);
        term->distribution_mode = pn_terminus_get_distribution_mode(pn);

        pn_data_copy(term->properties,   pn_terminus_properties(pn));
        pn_data_copy(term->filter,       pn_terminus_filter(pn));
        pn_data_copy(term->outcomes,     pn_terminus_outcomes(pn));
        pn_data_copy(term->capabilities, pn_terminus_capabilities(pn));
    }

    return term;
}
Пример #3
0
void qdr_core_map_destination(qdr_core_t *core, int router_maskbit, const char *address_hash)
{
    qdr_action_t *action = qdr_action(qdr_map_destination_CT, "map_destination");
    action->args.route_table.router_maskbit = router_maskbit;
    action->args.route_table.address        = qdr_field(address_hash);
    qdr_action_enqueue(core, action);
}
Пример #4
0
void qdr_core_add_router(qdr_core_t *core, const char *address, int router_maskbit)
{
    qdr_action_t *action = qdr_action(qdr_add_router_CT, "add_router");
    action->args.route_table.router_maskbit = router_maskbit;
    action->args.route_table.address        = qdr_field(address);
    qdr_action_enqueue(core, action);
}
Пример #5
0
static void qdr_manage_advance_address_CT(qdr_query_t *query, qdr_address_t *addr)
{
    query->next_offset++;
    addr = DEQ_NEXT(addr);
    if (addr) {
        query->more     = true;
        query->next_key = qdr_field((const char*) qd_hash_key_by_handle(addr->hash_handle));
    } else
        query->more = false;
}
Пример #6
0
qdr_error_t *qdr_error_from_pn(pn_condition_t *pn)
{
    if (!pn)
        return 0;

    qdr_error_t *error = new_qdr_error_t();
    ZERO(error);

    const char *name = pn_condition_get_name(pn);
    if (name && *name)
        error->name = qdr_field(name);

    const char *desc = pn_condition_get_description(pn);
    if (desc && *desc)
        error->description = qdr_field(desc);

    error->info = pn_data(0);

    return error;
}
Пример #7
0
qdr_subscription_t *qdr_core_subscribe(qdr_core_t             *core,
                                       const char             *address,
                                       char                    aclass,
                                       char                    phase,
                                       qd_address_treatment_t  treatment,
                                       qdr_receive_t           on_message,
                                       void                   *context)
{
    qdr_subscription_t *sub = NEW(qdr_subscription_t);
    sub->core               = core;
    sub->addr               = 0;
    sub->on_message         = on_message;
    sub->on_message_context = context;

    qdr_action_t *action = qdr_action(qdr_subscribe_CT, "subscribe");
    action->args.io.address       = qdr_field(address);
    action->args.io.address_class = aclass;
    action->args.io.address_phase = phase;
    action->args.io.subscription  = sub;
    action->args.io.treatment     = treatment;
    qdr_action_enqueue(core, action);

    return sub;
}
Пример #8
0
void qdr_terminus_set_address(qdr_terminus_t *term, const char *addr)
{
    qdr_field_free(term->address);
    term->address = qdr_field(addr);
}
Пример #9
0
void qdr_post_mobile_removed_CT(qdr_core_t *core, const char *address_hash)
{
    qdr_general_work_t *work = qdr_general_work(qdr_do_mobile_removed);
    work->field = qdr_field(address_hash);
    qdr_post_general_work_CT(core, work);
}