Adds is_guest and server_name to session API. Moves internal fd management functions to their own file