use proper ntohs/l functions instead of swapshort/swaplong

Signed-off-by: Graeme Gregory <graeme@xora.org.uk>