Tue Apr 22, 2014 3:38 pm
Indeed, but this requires the client to assume the existence, exact location, format, and semantics of the package print command. In other words, it must assume the existence of the "/system" menu, the existence of the "package" submenu, the existence of the "print" command, and the existence of the "detail" argument, their semantics, as well as assume that the names and times can be found in the "name" and "built-time" properties.
I mean, what if, in v7 for example, you rename "build-time" to "time-built", "build", "compiled-at", "compilation-time", "creation-time" or something similar? Or if the package list is moved from "/system package" to just "/packages" or whatever?
Or (a more likely scenario), if perhaps you allow 3rd party extensions, which you decide will be using a dedicated menu (e.g. "/system extensions", or "/packages mikrotik" + "/packages others"). Those will also have to affect the hash, yet API clients wouldn't immediately know about them.
The whole idea of the "/help" command is to prevent such (and other) assumptions, until reported, replacing them with only assumptions about the "/help" command itself. In the case of the hash, a client only needs to assume that (if there's no !trap reply...), there will be some sort of unique identifier at the "ret" attribute, which identifies the whole set of menus, commands and arguments.
If you're worried about the performance of RouterOS - the hash only needs to be generated once at install/upgrade/downgrade time, or once upon a package (de)activation, after which it can be stored. These things happen fairly rarely, and besides, MD5 or SHA1 are quick to compute. So the impact on the router's performance is therefore non-existent, except at those key (but again - rare) moments, at which point there's a minimal, if not negligible, impact on the CPU. If the hash is stored in RAM for the purpose of quick access, there's only a minimum RAM impact - a few bytes for the hash (16 bytes at minimum for binary MD5, 40 bytes at most for character SHA1).
Last edited by
boen_robot on Tue Apr 22, 2014 3:44 pm, edited 1 time in total.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)