Parametric options

Version 3 (Gioacchino Mazzurco, 04/18/2014 06:55 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 2 Gioacchino Mazzurco
<pre>|<char source><char source param><char destination format><char destination format param>|</pre>
18 3 Gioacchino Mazzurco
examples:
19 3 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.
20 3 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.
21 3 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.
22 3 Gioacchino Mazzurco
R2HL -> R = use random as source, 2 take two random bytes, H use hexadecimal as output format, L upper case