in src/router_core/management_agent.c [387:482]
static bool qd_can_handle_request(qd_parsed_field_t *properties_fld,
qd_router_entity_type_t *entity_type,
qd_router_operation_type_t *operation_type,
qd_iterator_t **identity_iter,
qd_iterator_t **name_iter,
int *count,
int *offset)
{
// The must be a property field and that property field should be a AMQP map. This is true for QUERY but I need
// to check if it true for CREATE, UPDATE and DELETE
if (properties_fld == 0 || !qd_parse_is_map(properties_fld))
return false;
//
// Only certain entity types can be handled by this agent.
// 'entityType': 'org.apache.qpid.dispatch.router.address
// 'entityType': 'org.apache.qpid.dispatch.router.link'
// TODO - Add more entity types here. The above is not a complete list.
qd_parsed_field_t *parsed_field = qd_parse_value_by_key(properties_fld, IDENTITY);
if (parsed_field!=0) {
*identity_iter = qd_parse_raw(parsed_field);
}
parsed_field = qd_parse_value_by_key(properties_fld, NAME);
if (parsed_field!=0) {
*name_iter = qd_parse_raw(parsed_field);
}
parsed_field = qd_parse_value_by_key(properties_fld, ENTITY);
if (parsed_field == 0) { // Sometimes there is no 'entityType' but 'type' might be available.
parsed_field = qd_parse_value_by_key(properties_fld, TYPE);
if (parsed_field == 0)
return false;
}
if (qd_iterator_equal(qd_parse_raw(parsed_field), address_entity_type))
*entity_type = QD_ROUTER_ADDRESS;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), link_entity_type))
*entity_type = QD_ROUTER_LINK;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), config_address_entity_type))
*entity_type = QD_ROUTER_CONFIG_ADDRESS;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), link_route_entity_type))
*entity_type = QD_ROUTER_CONFIG_LINK_ROUTE;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), auto_link_entity_type))
*entity_type = QD_ROUTER_CONFIG_AUTO_LINK;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), router_entity_type))
*entity_type = QD_ROUTER_ROUTER;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), console_entity_type))
*entity_type = QD_ROUTER_FORBIDDEN;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), connection_entity_type))
*entity_type = QD_ROUTER_CONNECTION;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), config_exchange_entity_type))
*entity_type = QD_ROUTER_EXCHANGE;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), config_binding_entity_type))
*entity_type = QD_ROUTER_BINDING;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), conn_link_route_entity_type))
*entity_type = QD_ROUTER_CONN_LINK_ROUTE;
else
return false;
parsed_field = qd_parse_value_by_key(properties_fld, OPERATION);
if (parsed_field == 0)
return false;
if (qd_iterator_equal(qd_parse_raw(parsed_field), MANAGEMENT_QUERY))
(*operation_type) = QD_ROUTER_OPERATION_QUERY;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), MANAGEMENT_CREATE))
(*operation_type) = QD_ROUTER_OPERATION_CREATE;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), MANAGEMENT_READ))
(*operation_type) = QD_ROUTER_OPERATION_READ;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), MANAGEMENT_UPDATE))
(*operation_type) = QD_ROUTER_OPERATION_UPDATE;
else if (qd_iterator_equal(qd_parse_raw(parsed_field), MANAGEMENT_DELETE))
(*operation_type) = QD_ROUTER_OPERATION_DELETE;
else
// This is an unknown operation type. cannot be handled, return false.
return false;
// Obtain the count and offset.
parsed_field = qd_parse_value_by_key(properties_fld, COUNT);
if (parsed_field)
(*count) = (int)qd_parse_as_long(parsed_field);
else
(*count) = -1;
parsed_field = qd_parse_value_by_key(properties_fld, OFFSET);
if (parsed_field)
(*offset) = (int)qd_parse_as_long(parsed_field);
else
(*offset) = 0;
return true;
}