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 #include "ux.hpp" 00019 #include <arpa/inet.h> 00020 00021 using namespace Ux; 00022 00023 /* static */ void Netdb::sethostent(int stayopen) 00024 { 00025 ::sethostent(stayopen); 00026 } 00027 00028 /* static */ struct hostent * Netdb::gethostent(void) 00029 { 00030 return ::gethostent(); 00031 } 00032 00033 /* static */ void Netdb::endhostent(void) 00034 { 00035 ::endhostent(); 00036 } 00037 00038 /* Returns pointer to netent or NULL if not found (errno not set) */ 00039 00040 /* static */ void Netdb::setnetent(int stayopen) 00041 { 00042 ::setnetent(stayopen); 00043 } 00044 00045 /* static */ struct netent *Netdb::getnetbyaddr(uint32_t net, int type) 00046 { 00047 return ::getnetbyaddr(net, type); 00048 } 00049 00050 /* static */ struct netent *Netdb::getnetbyname(const char *name) 00051 { 00052 return ::getnetbyname(name); 00053 } 00054 00055 /* static */ struct netent * Netdb::getnetent(void) 00056 { 00057 return ::getnetent(); 00058 } 00059 00060 /* static */ void Netdb::endnetent(void) 00061 { 00062 ::endnetent(); 00063 } 00064 00065 /* static */ void Netdb::setprotoent(int stayopen) 00066 { 00067 ::setprotoent(stayopen); 00068 } 00069 00070 /* static */ struct protoent *Netdb::getprotobyname(const char *name) 00071 { 00072 return ::getprotobyname(name); 00073 } 00074 00075 /* static */ struct protoent *Netdb::getprotobynumber(int proto) 00076 { 00077 return ::getprotobynumber(proto); 00078 } 00079 00080 /* static */ struct protoent * Netdb::getprotoent(void) 00081 { 00082 return ::getprotoent(); 00083 } 00084 00085 /* static */ void Netdb::endprotoent(void) 00086 { 00087 ::endprotoent(); 00088 } 00089 00090 /* static */ void Netdb::setservent(int stayopen) 00091 { 00092 ::setservent(stayopen); 00093 } 00094 00095 /* static */ struct servent *Netdb::getservbyname(const char *name, const char *proto) 00096 { 00097 return ::getservbyname(name, proto); 00098 } 00099 00100 /* static */ struct servent *Netdb::getservbyport(int port, const char *proto) 00101 { 00102 return ::getservbyport(port, proto); 00103 } 00104 00105 /* static */ struct servent * Netdb::getservent(void) 00106 { 00107 return ::getservent(); 00108 } 00109 00110 /* static */ void Netdb::endservent(void) 00111 { 00112 ::endservent(); 00113 } 00114 00115 00116 /* static */ struct if_nameindex *Netdb::if_nameindex(void) 00117 { 00118 struct if_nameindex *p; 00119 00120 if ((p = ::if_nameindex()) == NULL) 00121 throw Error(errno); 00122 return p; 00123 } 00124 00125 /* static */ void Netdb::if_freenameindex(struct if_nameindex *ptr) 00126 { 00127 return if_freenameindex(ptr); 00128 } 00129 00130 /* static */ unsigned Netdb::if_nametoindex(const char *ifname) 00131 { 00132 return if_nametoindex(ifname); 00133 } 00134 00135 /* static */ char *Netdb::if_indextoname(unsigned ifindex, char *ifname) 00136 { 00137 char *p; 00138 00139 if ((p = ::if_indextoname(ifindex, ifname)) == NULL) 00140 throw Error(errno); 00141 return p; 00142 }