00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #ifndef _NETDB_H_
00063 #define _NETDB_H_
00064
00065 #ifdef __SYMBIAN32__
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069 #include <_ansi.h>
00070 #include <sys/cdefs.h>
00071 #endif
00072 #include <sys/_types.h>
00073 #include <sys/cdefs.h>
00074 #ifdef __SYMBIAN32__
00075 #include <arpa/inet.h>
00076 #include <sys/errno.h>
00077 #endif
00078
00079 #ifndef _SIZE_T_DECLARED
00080 typedef __size_t size_t;
00081 #define _SIZE_T_DECLARED
00082 #endif
00083
00084 #ifndef _SOCKLEN_T_DECLARED
00085 typedef __socklen_t socklen_t;
00086 #define _SOCKLEN_T_DECLARED
00087 #endif
00088
00089 #ifndef _UINT32_T_DECLARED
00090 typedef __uint32_t uint32_t;
00091 #define _UINT32_T_DECLARED
00092 #endif
00093
00094 #ifndef _PATH_HEQUIV
00095 # define _PATH_HEQUIV "/etc/hosts.equiv"
00096 #endif
00097 #ifndef __SYMBIAN32__
00098 #define _PATH_HOSTS "/etc/hosts"
00099 #define _PATH_NETWORKS "/etc/networks"
00100 #define _PATH_PROTOCOLS "/etc/protocols"
00101 #define _PATH_SERVICES "/etc/services"
00102 #define h_errno (*__h_error())
00103 #else
00104 #define _PATH_SERVICES "z:\\resource\\services"
00105 #define h_errno errno
00106 #endif
00107
00108
00109
00110
00111
00112
00113
00114 struct hostent {
00115 char *h_name;
00116 char **h_aliases;
00117 int h_addrtype;
00118 int h_length;
00119 char **h_addr_list;
00120 #define h_addr h_addr_list[0]
00121 };
00122
00123 struct netent {
00124 char *n_name;
00125 char **n_aliases;
00126 int n_addrtype;
00127 #ifdef __SYMBIAN32__
00128 unsigned long n_net;
00129 #else
00130 uint32_t n_net;
00131 #endif
00132 };
00133
00134 struct servent {
00135 char *s_name;
00136 char **s_aliases;
00137 int s_port;
00138 char *s_proto;
00139 };
00140
00141 struct protoent {
00142 char *p_name;
00143 char **p_aliases;
00144 int p_proto;
00145 };
00146
00147 struct addrinfo {
00148 int ai_flags;
00149 int ai_family;
00150 int ai_socktype;
00151 int ai_protocol;
00152 socklen_t ai_addrlen;
00153 char *ai_canonname;
00154 struct sockaddr *ai_addr;
00155 struct addrinfo *ai_next;
00156 };
00157
00158
00159
00160
00161
00162
00163 #define NETDB_INTERNAL -1
00164 #define NETDB_SUCCESS 0
00165 #ifndef __SYMBIAN32__
00166 #define HOST_NOT_FOUND 1
00167 #define TRY_AGAIN 2
00168 #define NO_RECOVERY 3
00169 #else
00170 #define HOST_NOT_FOUND ENOENT
00171 #define TRY_AGAIN ETIMEDOUT
00172 #define NO_RECOVERY ECOMM
00173 #endif
00174 #define NO_DATA 4
00175 #define NO_ADDRESS NO_DATA
00176
00177
00178
00179
00180 #if 0
00181
00182 #define EAI_ADDRFAMILY 1
00183 #endif
00184 #define EAI_AGAIN 2
00185 #define EAI_BADFLAGS 3
00186 #define EAI_FAIL 4
00187 #define EAI_FAMILY 5
00188 #define EAI_MEMORY 6
00189 #if 0
00190
00191 #define EAI_NODATA 7
00192 #endif
00193 #define EAI_NONAME 8
00194 #define EAI_SERVICE 9
00195 #define EAI_SOCKTYPE 10
00196 #define EAI_SYSTEM 11
00197 #define EAI_BADHINTS 12
00198 #define EAI_PROTOCOL 13
00199 #define EAI_MAX 14
00200
00201
00202
00203
00204 #define AI_PASSIVE 0x00000001
00205 #define AI_CANONNAME 0x00000002
00206 #define AI_NUMERICHOST 0x00000004
00207 #define AI_NUMERICSERV 0x00000008
00208
00209 #define AI_MASK \
00210 (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
00211 AI_ADDRCONFIG)
00212
00213 #define AI_ALL 0x00000100
00214 #define AI_V4MAPPED_CFG 0x00000200
00215 #define AI_ADDRCONFIG 0x00000400
00216 #define AI_V4MAPPED 0x00000800
00217
00218 #define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
00219
00220
00221
00222
00223 #define NI_MAXHOST 1025
00224 #define NI_MAXSERV 32
00225
00226
00227
00228
00229 #define NI_NOFQDN 0x00000001
00230 #define NI_NUMERICHOST 0x00000002
00231 #define NI_NAMEREQD 0x00000004
00232 #define NI_NUMERICSERV 0x00000008
00233 #define NI_DGRAM 0x00000010
00234 #if 0
00235 #define NI_WITHSCOPEID 0x00000020
00236 #endif
00237
00238
00239
00240
00241 #define SCOPE_DELIMITER '%'
00242
00243 __BEGIN_DECLS
00244 #ifndef __SYMBIAN32__
00245 void endhostent(void);
00246 void endnetent(void);
00247 void endnetgrent(void);
00248 void endprotoent(void);
00249 #endif//__SYMBIAN32__
00250 IMPORT_C void endservent(void);
00251 #ifndef __SYMBIAN32__
00252 void freehostent(struct hostent *);
00253 #endif//__SYMBIAN32__
00254 IMPORT_C struct hostent *gethostbyaddr(const char *, int, int);
00255 IMPORT_C struct hostent *gethostbyname(const char *);
00256 #ifndef __SYMBIAN32__
00257 struct hostent *gethostbyname2(const char *, int);
00258 struct hostent *gethostent(void);
00259 struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
00260 struct hostent *getipnodebyname(const char *, int, int, int *);
00261 struct netent *getnetbyaddr(uint32_t, int);
00262 struct netent *getnetbyname(const char *);
00263 struct netent *getnetent(void);
00264 int getnetgrent(char **, char **, char **);
00265 #endif//__SYMBIAN32__
00266 IMPORT_C struct protoent *getprotobyname(const char *);
00267 IMPORT_C struct protoent *getprotobynumber(int);
00268 #ifndef __SYMBIAN32__
00269 struct protoent *getprotoent(void);
00270 #endif//__SYMBIAN32__
00271 IMPORT_C struct servent *getservbyname(const char *, const char *);
00272 IMPORT_C struct servent *getservbyport(int, const char *);
00273 IMPORT_C struct servent *getservent(void);
00274 #ifndef __SYMBIAN32__
00275 void herror(const char *);
00276 __const char *hstrerror(int);
00277 int innetgr(const char *, const char *, const char *, const char *);
00278 void sethostent(int);
00279
00280 void setnetent(int);
00281 void setprotoent(int);
00282 #endif//__SYMBIAN32__
00283 IMPORT_C int getaddrinfo(const char *, const char *,
00284 const struct addrinfo *, struct addrinfo **);
00285 IMPORT_C int getnameinfo(const struct sockaddr *, socklen_t, char *,
00286 size_t, char *, size_t, int);
00287 IMPORT_C void freeaddrinfo(struct addrinfo *);
00288 IMPORT_C const char *gai_strerror(int);
00289 void setnetgrent(const char *);
00290 IMPORT_C void setservent(int);
00291 #ifdef __SYMBIAN32__
00292
00293 #ifdef __SYMBIAN_COMPILE_UNUSED__
00294 int *__h_errno_location(void);
00295 #endif
00296
00297 #endif
00298
00299
00300
00301
00302
00303
00304 int * __h_error(void);
00305 __END_DECLS
00306 #ifdef __SYMBIAN32__
00307 #ifdef __cplusplus
00308 }
00309 #endif
00310 #endif
00311
00312 #endif