©2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under license.

 

Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ux/uxnetdb.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2003 by Marc J. Rochkind. All rights reserved.
00003     May be copied only for purposes and under conditions described
00004     on the Web page www.basepath.com/aup/copyright.htm.
00005 
00006     The Example Files are provided "as is," without any warranty;
00007     without even the implied warranty of merchantability or fitness
00008     for a particular purpose. The author and his publisher are not
00009     responsible for any damages, direct or incidental, resulting
00010     from the use or non-use of these Example Files.
00011 
00012     The Example Files may contain defects, and some contain deliberate
00013     coding mistakes that were included for educational reasons.
00014     You are responsible for determining if and how the Example Files
00015     are to be used.
00016 
00017 */
00018 #ifndef _UXNETDB_HPP_
00019 #define _UXNETDB_HPP_
00020 
00021 #ifdef SOLARIS
00022 #define __EXTENSIONS__
00023 #endif
00024 #include <netdb.h>
00025 #include <net/if.h>
00026 #ifdef SOLARIS
00027 #undef _EXTENSIONS_
00028 #endif
00029 
00030 namespace Ux {
00031 
00032 /**
00033     \ingroup Ux
00034 */
00035 class Netdb : public Base {
00036 
00037 public:
00038     static struct hostent * gethostent(void);
00039     static void             endhostent(void);
00040     static void             sethostent(int stayopen);
00041     static struct netent *  getnetbyaddr(uint32_t net, int type);
00042     static struct netent *  getnetbyname(const char *name);
00043     static struct netent *  getnetent(void);
00044     static void             endnetent(void);
00045     static void             setnetent(int stayopen);
00046     static struct protoent *getprotobyname(const char *name);
00047     static struct protoent *getprotobynumber(int proto);
00048     static struct protoent *getprotoent(void);
00049     static void             endprotoent(void);
00050     static void             setprotoent(int stayopen);
00051     static struct servent * getservbyname(const char *name, const char *proto);
00052     static struct servent * getservbyport(int port, const char *proto);
00053     static struct servent * getservent(void);
00054     static void             endservent(void);
00055     static void             setservent(int stayopen);
00056 
00057     static uint16_t htons(uint16_t hostnum)
00058         { return ::htons(hostnum); }
00059     static uint32_t htonl(uint32_t hostnum)
00060         { return ::htonl(hostnum); }
00061     static uint16_t ntohs(uint16_t netnum)
00062         { return ::ntohs(netnum); }
00063     static uint32_t ntohl(uint32_t netnum)
00064         { return ::ntohl(netnum); }
00065     
00066     struct if_nameindex *if_nameindex(void);
00067     void if_freenameindex(struct if_nameindex *ptr);
00068     unsigned if_nametoindex(const char *ifname);
00069     char *if_indextoname(unsigned ifindex, char *ifname);
00070 };
00071 
00072 } // namespace
00073 
00074 #endif // _UXNETDB_HPP_

Generated on Fri Apr 23 10:57:05 2004 for AUP2 Example Source by doxygen 1.3.1