This simplifies the interface that proxies export to the library but also relies
upon the assumption that a proxy chain starts with a TCP connection from the
scanner to the next hop proxy. That will be enough ATM.
When establishing the tunnel through proxy chain, we need to track status of
each proxy (storing R/W buffers, stats, retries...).
This patch lets proxies store and manage whatever structure they want to have
for this in a Nsock IOD. Since types can differ between proxy types, the
proxy_info are stored as a list of void *, ordered like the proxy nodes.
Proxy backends are selected at runtime. Each proxy exports a list of operations
to the rest of the library. This is similar to the way IO engines are
implemented within nsock.
Externally:
The calling application can build a proxychain object and assign it to one (or
more) NSP. Once a NSP get assigned a proxychain it's not possible to remove
it so that consistency is (should be...) ensured.
Internally:
An IOD comes with a proxychain context structure storing the whole tunnel
state. Also each proxy type now has a table of associated functions to use
as hooks for TCP connects(), read() and write() requests. As a result, adding
support of new proxy type should be easier. Code also gains readability in
comparison to large switch/cases that redirect the execution flow according to
the given proxy type.