functions: Add common network functions.
functions: Replace inline templates with network functions.