I have a small piece of code that converts a 32-bit unsigned integer (ie: uint32_t) into a set of four 8-bit fields, treats it like an IP address, and then reports to the client if it falls within a predetermined range of IP addresses.
I've already found a few different examples of code in C that shows me how to get the IP address of a client from the struct sockaddr_in that contains it, along with a C# answer. However, I would like to break down the address a bit further, keep it in pure C, and wanted to know a few quick things:
- Is the internal representation consistent from system to system, or do I ever need to do Endian-ness checks/correction on the 
s_addrfield? - Are there standard macros along the lines of 
CLASS_C_NETMASK,CLASS_B_NETMASK, etc, that would be more appropriate than using manually generated masks (ie:0xFF000000,0x00FF0000, etc). - Are there any existing functions in the sockets library that will do checks if an IP address is in a range of IP addresses or matches a subnet mask?
 
Thanks.