What should I #include to use 'htonl'?

On Windows, arpa/inet.h doesn't exist so this answer won't do. The include is:

#include <winsock.h>

So a portable version of the include block (always better to provide one):

#ifdef _WIN32
#include <winsock.h>
#else
#include <arpa/inet.h>
#endif

The standard header is:

#include <arpa/inet.h>

You don't have to worry about the other stuff defined in that header. It won't affect your compiled code, and should have only a minor effect on compilation time.

EDIT: You can test this. Create two files, htonl_manual.c

// non-portable, minimalistic header
#include <byteswap.h>
#include <stdio.h>
int main()
{
    int x = 1;
    x = __bswap_32(x);
    printf("%d\n", x);
}

and htonl_include.c:

// portable
#include <arpa/inet.h>
#include <stdio.h>
int main()
{
    int x = 1;
    x = htonl(x);
    printf("%d\n", x);
}

Assemble them at -O1, then take the difference:

gcc htonl_manual.c -o htonl_manual.s -S -O1
gcc htonl_include.c -o htonl_include.s -S -O1
diff htonl_include.s htonl_manual.s

For me, the only difference is the filename.