Example #1
0
function translateDeviceCommands($object_id, $crq, $vlan_names = NULL)
{
    $breed = assertDeviceBreed($object_id);
    $funcname = assertBreedFunction($breed, 'xlatepushq');
    require_once 'deviceconfig.php';
    if (!is_callable($funcname)) {
        throw new RTGatewayError("undeclared function '{$funcname}'");
    }
    return $funcname($object_id, $crq, $vlan_names);
}
Example #2
0
function translateDeviceCommands($object_id, $crq, $vlan_names = NULL)
{
    $breed = assertDeviceBreed($object_id);
    $funcname = assertBreedFunction($breed, 'xlatepushq');
    require_once 'deviceconfig.php';
    if (!is_callable($funcname)) {
        throw new RTGatewayError("undeclared function '{$funcname}'");
    }
    global $current_query_breed;
    $current_query_breed = $breed;
    // this global is used to auto-detect breed in shortenIfName
    try {
        $ret = $funcname($object_id, $crq, $vlan_names);
    } catch (Exception $e) {
        $current_query_breed = NULL;
        throw $e;
    }
    $current_query_breed = NULL;
    return $ret;
}