Add generic function to process req and resp.

Each of the library functions are now ~7-10 lines.
Remove num_fds from the fdreq{}, this is because the socketfds()
function has been scrapped.