inc/internet.h

Go to the documentation of this file.
00001 /* internet - some stuff for routines that use the internet
00002  * and aren't afraid to include some internet specific structures
00003  * and the like.   See also net for stuff that is higher level. */
00004 
00005 #ifndef INTERNET_H
00006 #include <sys/socket.h>
00007 #include <netinet/in.h>
00008 #include <arpa/inet.h>
00009 #include <netdb.h>
00010 
00011 bits32 internetHostIp(char *hostName);
00012 /* Get IP v4 address (in host byte order) for hostName.
00013  * Warn and return 0 if there's a problem. */
00014 
00015 boolean internetFillInAddress(char *hostName, int port, 
00016         struct sockaddr_in *address);
00017 /* Fill in address. Warn and return FALSE if can't.  */
00018 
00019 boolean internetIpToDottedQuad(bits32 ip, char dottedQuad[17]);
00020 /* Convert IP4 address in host byte order to dotted quad 
00021  * notation.  Warn and return FALSE if there's a 
00022  * problem. */
00023 
00024 boolean internetDottedQuadToIp(char *dottedQuad, bits32 *retIp);
00025 /* Convert dotted quad format address to IP4 address in
00026  * host byte order.  Warn and return FALSE if there's a 
00027  * problem. */
00028 
00029 boolean internetIsDottedQuad(char *s);
00030 /* Returns TRUE if it looks like s is a dotted quad. */
00031 
00032 void internetParseDottedQuad(char *dottedQuad, unsigned char quad[4]);
00033 /* Parse dotted quads into quad */
00034 
00035 void internetUnpackIp(bits32 packed, unsigned char unpacked[4]);
00036 /* Convert from 32 bit to 4-byte format with most significant
00037  * byte first. */
00038 
00039 boolean internetIpInSubnet(unsigned char unpackedIp[4], 
00040         unsigned char subnet[4]);
00041 /* Return true if unpacked IP address is in subnet. */
00042 
00043 #endif /* INTERNET_H */

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2