Sam: define and parse header

Thus far we were only parsing individual header lines. Now we aggregate
into a new header type.

Factored out validation of header version into new function
`parse_header_version` because it is now needed in 2 places.