Parametric options

Version 5 (Gioacchino Mazzurco, 04/18/2014 08:34 pm)

1 1 Gioacchino Mazzurco
h1. Parametric options
2 1 Gioacchino Mazzurco
3 1 Gioacchino Mazzurco
Options like system.hostname, network.main_ipv4_address, network.main_ipv6_address, can be parametric so what the user write is a template of what the value will be, this page is about to try to define a flexible yet not complicated formalism for those templates.
4 1 Gioacchino Mazzurco
5 1 Gioacchino Mazzurco
Old formalism provide just substitution by mac address byte but this is eventually quite limited and already showed limits, like the impossibility for the user to control the format in which the mac address byte should be represented.
6 1 Gioacchino Mazzurco
7 1 Gioacchino Mazzurco
The new formalism should have following characteristics:
8 1 Gioacchino Mazzurco
> * Easy parsing just with "lua patterns":http://lua-users.org/wiki/PatternsTutorial
9 1 Gioacchino Mazzurco
> * Compact format
10 1 Gioacchino Mazzurco
> * Possibility to take byte from mac address
11 1 Gioacchino Mazzurco
> * Possibility to take randoms byte
12 1 Gioacchino Mazzurco
> * Possibility to choose the output format
13 1 Gioacchino Mazzurco
14 1 Gioacchino Mazzurco
I was thinking a way to have bit level control but all ides I had needed too much complication of patterns syntax
15 2 Gioacchino Mazzurco
16 2 Gioacchino Mazzurco
Proposal 1:
17 5 Gioacchino Mazzurco
<pre>
18 5 Gioacchino Mazzurco
|<char source><char source param><char destination format><char destination format param>|
19 1 Gioacchino Mazzurco
examples:
20 5 Gioacchino Mazzurco
|M6HL| -> M = use MAC address as source, 6 take sixth byte of the mac, H use hexadecimal as output format, L lower case.
21 5 Gioacchino Mazzurco
|M5HU| -> M = use MAC address as source, 5 take fifth byte of the mac, H use hexadecimal as output format, U upper case.
22 5 Gioacchino Mazzurco
|M4D0| -> M = use MAC address as source, 4 take forth byte of the mac, D use decimal as output format, 0 without meaning param is not used by this format.
23 5 Gioacchino Mazzurco
|R2HL| -> R = use random as source, 2 take two bytes, H use hexadecimal as output format, L lower case
24 5 Gioacchino Mazzurco
|R2CL| -> R = use random as source, 2 take two bytes, C use ASCII char as output format, L lower case
25 5 Gioacchino Mazzurco
|R2C0| -> R = use random as source, 2 take two bytes, C use ASCII char as output format, 0 output chars as is
26 5 Gioacchino Mazzurco
</pre>