Move struct declarations and prototypes to alg.h

This *almost* breaks the purpose of this file :-(
(which is, being a copy-paste source).

Signed-off-by: Andrew Tselischev <andrewtselischev@gmail.com>