os/ossrv/genericopenlibs/openenvcore/include/netdb.dosc
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/** @file  ../include/netdb.h
sl@0
     2
@internalComponent
sl@0
     3
*/
sl@0
     4
sl@0
     5
/** @fn  endservent(void)
sl@0
     6
sl@0
     7
Refer to  getservent() for the documentation
sl@0
     8
sl@0
     9
sl@0
    10
 
sl@0
    11
sl@0
    12
@publishedAll
sl@0
    13
@externallyDefinedApi
sl@0
    14
*/
sl@0
    15
sl@0
    16
/** @fn  gethostbyaddr(const char *addr, int length, int format)
sl@0
    17
@param addr
sl@0
    18
@param length
sl@0
    19
@param format
sl@0
    20
Refer to  gethostbyname() for the documentation
sl@0
    21
@see getaddrinfo()
sl@0
    22
@see getnameinfo()
sl@0
    23
sl@0
    24
sl@0
    25
 
sl@0
    26
sl@0
    27
@publishedAll
sl@0
    28
@externallyDefinedApi
sl@0
    29
*/
sl@0
    30
sl@0
    31
/** @fn  gethostbyname(const char *name)
sl@0
    32
@param name
sl@0
    33
sl@0
    34
Note: This description also covers the following functions -
sl@0
    35
 gethostbyaddr() 
sl@0
    36
sl@0
    37
@return   The gethostbyname and gethostbyaddr functions return NULL if an error occurs or a valid hostent 
sl@0
    38
structure otherwise.
sl@0
    39
sl@0
    40
The gethostbyname, and gethostbyaddr functions each return a pointer to an object with the following structure describing an internet host referenced by name or by address, respectively. 
sl@0
    41
sl@0
    42
The name argument passed to gethostbyname should point to a NUL -terminated hostname. The addr argument passed to gethostbyaddr should point to an address which is len bytes long, in binary form (i.e., not an IP address in human readable ASCII form). The type argument specifies the address family (e.g. AF_INET, etc.) of this address. 
sl@0
    43
sl@0
    44
The structure returned contains either the information obtained from the name server, 
sl@0
    45
sl@0
    46
@code
sl@0
    47
struct  hostent {
sl@0
    48
        char    *h_name;        // official name of host
sl@0
    49
        char    **h_aliases;    // alias list 
sl@0
    50
        int     h_addrtype;     // host address type 
sl@0
    51
        int     h_length;       // length of address 
sl@0
    52
        char    **h_addr_list;  // list of addresses from name server 
sl@0
    53
};
sl@0
    54
#define h_addr  h_addr_list[0]  //address, for backward compatibility
sl@0
    55
@endcode
sl@0
    56
sl@0
    57
sl@0
    58
sl@0
    59
The members of this structure are: 
sl@0
    60
@code
sl@0
    61
h_name  Official name of the host.  
sl@0
    62
h_aliases  A NULL -terminated array of alternate names for the host.  
sl@0
    63
h_addrtype  The type of address being returned; usually AF_INET.  
sl@0
    64
h_length  The length, in bytes, of the address.  
sl@0
    65
h_addr_list  A NULL -terminated array of network addresses for the host. Host addresses are returned in network byte order.  
sl@0
    66
h_addr  The first address in h_addr_list; this is for backward compatibility.  
sl@0
    67
@endcode
sl@0
    68
sl@0
    69
sl@0
    70
When using the nameserver, gethostbyname will search for the named host in the current domain and its parents unless the name ends in a dot. 
sl@0
    71
sl@0
    72
getaddrinfo and getnameinfo functions are preferred over the gethostbyname, and gethostbyaddr functions. 
sl@0
    73
sl@0
    74
sl@0
    75
sl@0
    76
sl@0
    77
sl@0
    78
sl@0
    79
Examples:
sl@0
    80
@code
sl@0
    81
#include<stdio.h>
sl@0
    82
#include<arpa/inet.h>
sl@0
    83
#include <sys/socket.h>
sl@0
    84
#include <netinet/in.h>
sl@0
    85
#include <netdb.h>
sl@0
    86
#include <string.h>
sl@0
    87
Int main()
sl@0
    88
{
sl@0
    89
struct hostent *hp = 0;
sl@0
    90
char *test_url=www.google.com:
sl@0
    91
hp = gethostbyname(test_url);
sl@0
    92
if(hp==NULL)
sl@0
    93
printf("gethostbyname failed"):
sl@0
    94
else
sl@0
    95
printf("gethostbyname passed");
sl@0
    96
return 0;
sl@0
    97
}
sl@0
    98
sl@0
    99
@endcode
sl@0
   100
 Output
sl@0
   101
@code
sl@0
   102
Gethostbyname passed
sl@0
   103
sl@0
   104
@endcode
sl@0
   105
@code
sl@0
   106
#include<stdio.h>
sl@0
   107
#include<arpa/inet.h>
sl@0
   108
#include <sys/socket.h>
sl@0
   109
#include <netinet/in.h>
sl@0
   110
#include <netdb.h>
sl@0
   111
#include <string.h>
sl@0
   112
#define urlsize 50
sl@0
   113
Int main()
sl@0
   114
{
sl@0
   115
struct hostent *hp = 0;
sl@0
   116
char addr[256];
sl@0
   117
unsigned long  test_addr;
sl@0
   118
strcpy(addr," 147.243.3.83");
sl@0
   119
test_addr=inet_addr(addr);
sl@0
   120
struct hostent *hp;
sl@0
   121
hp=gethostbyaddr((const char *)&test;_addr,sizeof(test_addr),AF_INET);
sl@0
   122
if(hp)
sl@0
   123
printf("DNS query resolved");
sl@0
   124
else
sl@0
   125
printf("gethostbyaddr failed");
sl@0
   126
return 0;
sl@0
   127
}
sl@0
   128
sl@0
   129
@endcode
sl@0
   130
sl@0
   131
Diagnostics:
sl@0
   132
sl@0
   133
 Error return status from gethostbyname and gethostbyaddr is indicated by return of a NULL pointer.
sl@0
   134
The external integer h_errno may then be checked to see whether this is a temporary failure
sl@0
   135
or an invalid or unknown host.
sl@0
   136
The routine
sl@0
   137
If its argument string is non- NULL, it is printed, followed by a colon and a space.
sl@0
   138
The error message is printed with a trailing newline. The variable h_errno can have the following values: TRY_AGAIN This is usually a temporary error
sl@0
   139
and means that the local server did not receive
sl@0
   140
a response from an authoritative server.
sl@0
   141
A retry at some later time may succeed. NO_RECOVERY Some unexpected server failure was encountered.
sl@0
   142
This is a non-recoverable error.
sl@0
   143
sl@0
   144
@see getaddrinfo()
sl@0
   145
@see getnameinfo()
sl@0
   146
sl@0
   147
sl@0
   148
Bugs:
sl@0
   149
sl@0
   150
 These functions use a thread-specific data storage; if the data is needed 
sl@0
   151
for future use it should be copied before any subsequent calls overwrite it. Though these functions are thread-safe the getaddrinfo family of functions is recommended 
sl@0
   152
  instead. Only the Internet
sl@0
   153
address format is currently understood. 
sl@0
   154
 
sl@0
   155
sl@0
   156
@publishedAll
sl@0
   157
@externallyDefinedApi
sl@0
   158
*/
sl@0
   159
sl@0
   160
/** @fn  getprotobyname(const char *name)
sl@0
   161
@param name
sl@0
   162
sl@0
   163
Note: This description also covers the following functions -
sl@0
   164
 getprotobynumber() 
sl@0
   165
sl@0
   166
@return   Null pointer
sl@0
   167
(0) returned on
sl@0
   168
error.
sl@0
   169
sl@0
   170
The getprotobyname, and getprotobynumber functions each return a pointer to an object with the following structure from the network protocol data base 
sl@0
   171
@code
sl@0
   172
struct  protoent {
sl@0
   173
        char    *p_name;        /* official name of protocol */
sl@0
   174
        char    **p_aliases;    /* alias list */
sl@0
   175
        int     p_proto;        /* protocol number */
sl@0
   176
};
sl@0
   177
@endcode
sl@0
   178
sl@0
   179
The members of this structure are: 
sl@0
   180
@code
sl@0
   181
p_name  The official name of the protocol.  
sl@0
   182
p_aliases    A zero terminated list of alternate names for the protocol.  
sl@0
   183
p_proto  The protocol number.  
sl@0
   184
@endcode
sl@0
   185
sl@0
   186
sl@0
   187
The getprotobyname function and getprotobynumber sequentially search from the beginning of the database until a matching protocol name or protocol number is found, 
sl@0
   188
sl@0
   189
sl@0
   190
Examples:
sl@0
   191
@code
sl@0
   192
#include<netinet/in.h>
sl@0
   193
#include<arpa/inet.h>
sl@0
   194
#include<stdio.h>
sl@0
   195
#include<string.h>
sl@0
   196
#include<netdb.h>
sl@0
   197
Int main()
sl@0
   198
{
sl@0
   199
struct protoent *p =0;
sl@0
   200
char *protoname="tcp";
sl@0
   201
p=getprotobyname(protoname);
sl@0
   202
if(p!=NULL)
sl@0
   203
printf("protocol not supported:");
sl@0
   204
else
sl@0
   205
printf("protocol supported");
sl@0
   206
return 0;
sl@0
   207
}
sl@0
   208
sl@0
   209
@endcode
sl@0
   210
 Output
sl@0
   211
@code
sl@0
   212
Protocol supported/not supported based on the support for protocol
sl@0
   213
sl@0
   214
@endcode
sl@0
   215
@code
sl@0
   216
#include<netinet/in.h>
sl@0
   217
#include<arpa/inet.h>
sl@0
   218
#include<stdio.h>
sl@0
   219
#include<string.h>
sl@0
   220
#include<netdb.h>
sl@0
   221
int main()
sl@0
   222
	{
sl@0
   223
	struct protoent *p =0;
sl@0
   224
	int protonum=6;
sl@0
   225
	p=getprotobynumber(protonum);
sl@0
   226
	if(p!=NULL)
sl@0
   227
		printf("protocol not supported:");
sl@0
   228
	else
sl@0
   229
		printf("protocol supported");
sl@0
   230
	return 0;
sl@0
   231
	}
sl@0
   232
sl@0
   233
@endcode
sl@0
   234
 Output
sl@0
   235
@code
sl@0
   236
Protocol supported/not supported based on the support for protocol
sl@0
   237
sl@0
   238
@endcode
sl@0
   239
 The getprotobynumber, getprotobyname, functions appeared in BSD 4.2 .
sl@0
   240
sl@0
   241
Bugs:
sl@0
   242
sl@0
   243
 These functions use a thread-specific data space; if the data is needed for 
sl@0
   244
future use it must be copied before any subsequent calls overwrite it. Only the 
sl@0
   245
Internet protocols are currently understood. 
sl@0
   246
sl@0
   247
 
sl@0
   248
sl@0
   249
@publishedAll
sl@0
   250
@externallyDefinedApi
sl@0
   251
*/
sl@0
   252
sl@0
   253
/** @fn  getprotobynumber(int proto)
sl@0
   254
@param proto
sl@0
   255
sl@0
   256
Refer to  getprotobyname() for the documentation
sl@0
   257
sl@0
   258
sl@0
   259
 
sl@0
   260
sl@0
   261
@publishedAll
sl@0
   262
@externallyDefinedApi
sl@0
   263
*/
sl@0
   264
sl@0
   265
/** @fn  getservbyname(const char *name, const char *proto)
sl@0
   266
@param name
sl@0
   267
@param proto
sl@0
   268
Refer to  getservent() for the documentation
sl@0
   269
sl@0
   270
sl@0
   271
 
sl@0
   272
sl@0
   273
@publishedAll
sl@0
   274
@externallyDefinedApi
sl@0
   275
*/
sl@0
   276
sl@0
   277
/** @fn  getservbyport(int port, const char *proto)
sl@0
   278
@param port
sl@0
   279
@param proto
sl@0
   280
Refer to  getservent() for the documentation
sl@0
   281
sl@0
   282
sl@0
   283
 
sl@0
   284
sl@0
   285
@publishedAll
sl@0
   286
@externallyDefinedApi
sl@0
   287
*/
sl@0
   288
sl@0
   289
/** @fn  getservent(void)
sl@0
   290
sl@0
   291
Note: This description also covers the following functions -
sl@0
   292
 getservbyname()  getservbyport()  setservent()  endservent() 
sl@0
   293
sl@0
   294
@return   getservent, getservbyname and getservbyport functions return the servent structure, or a NULL pointer if an error occurs or the end of the file is reached.
sl@0
   295
sl@0
   296
@code
sl@0
   297
 s_name The official name of the service.
sl@0
   298
 s_aliases
sl@0
   299
  A zero terminated list of alternate names for the service.
sl@0
   300
 s_port The port number at which the service resides.
sl@0
   301
 Port numbers are returned in network byte order.
sl@0
   302
 s_proto The name of the protocol to use when contacting the
sl@0
   303
 service.
sl@0
   304
sl@0
   305
@endcode
sl@0
   306
  
sl@0
   307
@code
sl@0
   308
The getservent, getservbyname, and getservbyport functions
sl@0
   309
each return a pointer to an object with the
sl@0
   310
following structure
sl@0
   311
containing the broken-out
sl@0
   312
fields of a line in the network services data base, c:/sys/data/services. 
sl@0
   313
structservent {
sl@0
   314
char*s_name;/* official name of service */
sl@0
   315
char**s_aliases;/* alias list */
sl@0
   316
ints_port;/* port service resides at */
sl@0
   317
char*s_proto;/* protocol to use */
sl@0
   318
};
sl@0
   319
@endcode
sl@0
   320
sl@0
   321
 The members of this structure are: s_name The official name of the service. s_aliases  A zero terminated list of alternate names for the service. s_port The port number at which the service resides.
sl@0
   322
Port numbers are returned in network byte order. s_proto The name of the protocol to use when contacting the
sl@0
   323
service.
sl@0
   324
sl@0
   325
 The getservent function
sl@0
   326
reads the next line of the file, opening the file if necessary.
sl@0
   327
sl@0
   328
 The setservent function
sl@0
   329
opens and rewinds the file.
sl@0
   330
sl@0
   331
 The endservent function
sl@0
   332
closes the file.
sl@0
   333
sl@0
   334
 The getservbyname and getservbyport functions
sl@0
   335
sequentially search from the beginning
sl@0
   336
of the file until a matching
sl@0
   337
protocol name or
sl@0
   338
port number (which must be specified in
sl@0
   339
network byte order) is found,
sl@0
   340
or until EOF is encountered.
sl@0
   341
If a protocol name is also supplied (non- NULL ), searches must also match the protocol.
sl@0
   342
sl@0
   343
Examples:
sl@0
   344
@code
sl@0
   345
#include<stdio.h>
sl@0
   346
#include<netinet/in.h>
sl@0
   347
#include<arpa/inet.h>
sl@0
   348
#include<string.h>
sl@0
   349
#include<netdb.h>
sl@0
   350
int main()
sl@0
   351
{
sl@0
   352
Char *service="http";
sl@0
   353
Char *protocol="tcp";
sl@0
   354
Struct servent *p=0;
sl@0
   355
P=getservbyname(service,protocol);
sl@0
   356
if(p!=NULL)
sl@0
   357
printf("service not supported:");
sl@0
   358
else
sl@0
   359
printf("Service  supported");
sl@0
   360
return 0;
sl@0
   361
}
sl@0
   362
sl@0
   363
@endcode
sl@0
   364
@code
sl@0
   365
#include<stdio.h>
sl@0
   366
#include<netinet/in.h>
sl@0
   367
#include<arpa/inet.h>
sl@0
   368
#include<string.h>
sl@0
   369
#include<netdb.h>
sl@0
   370
int main()
sl@0
   371
{
sl@0
   372
struct servent *p;
sl@0
   373
char *protocol="tcp";
sl@0
   374
int port;
sl@0
   375
port=htons(80);
sl@0
   376
p=(port,protocol);
sl@0
   377
if(p)
sl@0
   378
{
sl@0
   379
Printf("port is  assigned");
sl@0
   380
else
sl@0
   381
printf("port is not assigned");
sl@0
   382
}
sl@0
   383
sl@0
   384
@endcode
sl@0
   385
 Output
sl@0
   386
@code
sl@0
   387
Port is assigned
sl@0
   388
sl@0
   389
@endcode
sl@0
   390
@code
sl@0
   391
#include<stdio.h>
sl@0
   392
#include<netinet/in.h>
sl@0
   393
#include<arpa/inet.h>
sl@0
   394
#include<string.h>
sl@0
   395
#include<netdb.h>
sl@0
   396
Int main()
sl@0
   397
{
sl@0
   398
struct servent *p;
sl@0
   399
p=getservent();
sl@0
   400
if(p)
sl@0
   401
printf("getservent successful");
sl@0
   402
else
sl@0
   403
printf("getservent failed");
sl@0
   404
return 0;
sl@0
   405
}
sl@0
   406
sl@0
   407
@endcode
sl@0
   408
 Output
sl@0
   409
@code
sl@0
   410
Getservent passed
sl@0
   411
sl@0
   412
@endcode
sl@0
   413
@code
sl@0
   414
#include<stdio.h>
sl@0
   415
#include<netinet/in.h>
sl@0
   416
#include<arpa/inet.h>
sl@0
   417
#include<string.h>
sl@0
   418
#include<netdb.h>
sl@0
   419
int main()
sl@0
   420
{
sl@0
   421
int stayopen=1;
sl@0
   422
retservent(stayopen):
sl@0
   423
return 0;
sl@0
   424
}
sl@0
   425
sl@0
   426
@endcode
sl@0
   427
@code
sl@0
   428
#include<stdio.h>
sl@0
   429
#include<netinet/in.h>
sl@0
   430
#include<arpa/inet.h>
sl@0
   431
#include<string.h>
sl@0
   432
#include<netdb.h>
sl@0
   433
int main()
sl@0
   434
{
sl@0
   435
struct servent *p;
sl@0
   436
  p=getservent();
sl@0
   437
if(p)
sl@0
   438
endservent();
sl@0
   439
return 0;
sl@0
   440
}
sl@0
   441
sl@0
   442
@endcode
sl@0
   443
sl@0
   444
Diagnostics:
sl@0
   445
 Null pointer
sl@0
   446
(0) returned on EOF or error. The getservent, getservbyport, getservbyname, setservent, and endservent functions appeared in BSD 4.2.
sl@0
   447
sl@0
   448
Bugs:
sl@0
   449
sl@0
   450
 These functions use a thread-specific data storage. If the data is needed 
sl@0
   451
for future use it should be copied before any subsequent calls overwrite it. Expecting 
sl@0
   452
port numbers to fit in a 32 bit quantity is probably naive. 
sl@0
   453
 
sl@0
   454
sl@0
   455
@publishedAll
sl@0
   456
@externallyDefinedApi
sl@0
   457
*/
sl@0
   458
sl@0
   459
/** @fn getaddrinfo(const char *hostname, const char *servname,const struct addrinfo *hints, struct addrinfo **res)
sl@0
   460
@param hostname
sl@0
   461
@param servname
sl@0
   462
@param hints
sl@0
   463
@param res
sl@0
   464
@return A zero return value for getaddrinfo() indicates successful completion; a non-zero return value indicates failure. The possible values for the failures are listed in the ERRORS section.
sl@0
   465
Upon successful return of getaddrinfo(), the location to which res points shall refer to a linked list of addrinfo structures, each of which shall specify a socket address and information for use in creating a socket with which to use that socket address. 
sl@0
   466
The list shall include at least one addrinfo structure. 
sl@0
   467
sl@0
   468
The freeaddrinfo() function shall free one or more addrinfo structures returned by getaddrinfo(), along with any additional storage associated with those structures. If the ai_next field of the structure is not null, the entire list of structures shall be freed. The freeaddrinfo() function shall support the freeing of arbitrary sublists of an addrinfo list originally returned by getaddrinfo().
sl@0
   469
sl@0
   470
The getaddrinfo() function shall translate the name of a service location (for example, a host name) and//or a service name and shall return a set of socket addresses and associated information to be used in creating a socket with which to address the specified service.
sl@0
   471
sl@0
   472
@publishedAll
sl@0
   473
@externallyDefinedApi
sl@0
   474
*/
sl@0
   475
sl@0
   476
/** @fn  getnameinfo( const struct sockaddr * sa , socklen_t salen, char * host,size_t 
sl@0
   477
      hostlen, char * serv, size_t servlen, int flags )
sl@0
   478
@param sa
sl@0
   479
@param salen
sl@0
   480
@param host
sl@0
   481
@param hostlen
sl@0
   482
@param serv
sl@0
   483
@param servlen
sl@0
   484
@param flags
sl@0
   485
@return   getnameinfo returns zero on success or one of the error codes listed in gai_strerror if an error occurs.
sl@0
   486
sl@0
   487
The getnameinfo function is used to convert a sockaddr structure to a pair of host name and service strings. It is a replacement for and provides more flexibility than the gethostbyaddr and getservbyport functions and is the converse of the getaddrinfo function. 
sl@0
   488
The sockaddr structure sa should point to sockaddr_in (for IPv4) that is salen bytes long. 
sl@0
   489
sl@0
   490
The host and service names associated with sa are stored in host and serv which have length parameters hostlen and servlen. The maximum value for hostlen is NI_MAXHOST and the maximum value for servlen is NI_MAXSERV, as defined by \<netdb.h.\> If a length parameter is zero, no string will be stored. Otherwise, enough space must be provided to store the host name or service string plus a byte for the NUL terminator. 
sl@0
   491
sl@0
   492
The flags argument is formed by OR ’ing the following values: NI_NOFQDN  A fully qualified domain name is not required for local hosts. The local part of the fully qualified domain name is returned instead.  
sl@0
   493
@code
sl@0
   494
NI_NUMERICHOST  Return the address in numeric form, as if calling inet_ntop, instead of a host name.  
sl@0
   495
NI_NAMEREQD  A name is required. If the host name cannot be found in DNS and this flag is set, a non-zero error code is returned. If the host name is not found and the flag is not set, the address is returned in numeric form.  
sl@0
   496
NI_NUMERICSERV  The service name is returned as a digit string representing the port number.  
sl@0
   497
NI_DGRAM  Specifies that the service being looked up is a datagram service, and causes getservbyport to be called with a second argument of "udp" instead of its default of "tcp." This is required for the few ports (512-514) that have different services for UDP and TCP.  
sl@0
   498
@endcode
sl@0
   499
sl@0
   500
sl@0
   501
sl@0
   502
Examples:
sl@0
   503
@code
sl@0
   504
#include <stdio.h>
sl@0
   505
#include <netdb.h>
sl@0
   506
#include <netinet/in.h>
sl@0
   507
int main()
sl@0
   508
{
sl@0
   509
     struct addrinfo *result;
sl@0
   510
     char hostname[80];
sl@0
   511
     int error;
sl@0
   512
     if (error = getaddrinfo("www.yahoo.com",NULL, NULL, &result;))
sl@0
   513
     {
sl@0
   514
            fprintf(stderr, "error using getaddrinfo: %s
sl@0
   515
", gai_strerror(error));
sl@0
   516
     }
sl@0
   517
     if (result)
sl@0
   518
     {
sl@0
   519
            if (error = getnameinfo(result->ai_addr,result->ai_addrlen, hostname, sizeof(hostname), NULL,0,0))
sl@0
   520
            {
sl@0
   521
                   printf( "error using getnameinfo: %s
sl@0
   522
", gai_strerror(error));
sl@0
   523
            }
sl@0
   524
    }
sl@0
   525
return 0;
sl@0
   526
}
sl@0
   527
sl@0
   528
@endcode
sl@0
   529
@see gai_strerror()
sl@0
   530
@see getaddrinfo()
sl@0
   531
@see inet_ntop()
sl@0
   532
sl@0
   533
sl@0
   534
Caveats:
sl@0
   535
sl@0
   536
 getnameinfo can return both numeric and FQDN forms of the address specified in sa. There is no return value that indicates whether the string returned in host is a result of binary to numeric-text translation (like inet_ntop or is the result of a DNS reverse lookup.
sl@0
   537
Because of this, malicious parties could set up a PTR record as follows:
sl@0
   538
@code
sl@0
   539
1.0.0.127.in-addr.arpa. IN PTR  10.1.1.1
sl@0
   540
sl@0
   541
@endcode
sl@0
   542
 and trick the caller of getnameinfo into believing that sa is 10.1.1.1
sl@0
   543
when it is actually 127.0.0.1. To prevent such attacks, the use of NI_NAMEREQD is recommended when the result of getnameinfo is used
sl@0
   544
for access control purposes:
sl@0
   545
@code
sl@0
   546
struct sockaddr *sa;
sl@0
   547
socklen_t salen;
sl@0
   548
char addr[NI_MAXHOST];
sl@0
   549
struct addrinfo hints, *res;
sl@0
   550
int error;
sl@0
   551
error = getnameinfo(sa, salen, addr, sizeof(addr),
sl@0
   552
    NULL, 0, NI_NAMEREQD);
sl@0
   553
if (error == 0) {
sl@0
   554
        memset(&hints;, 0, sizeof(hints));
sl@0
   555
        hints.ai_socktype = SOCK_DGRAM; /*dummy*/
sl@0
   556
        hints.ai_flags = AI_NUMERICHOST;
sl@0
   557
        if (getaddrinfo(addr, "0", &hints;, &res;) == 0) {
sl@0
   558
                /* malicious PTR record */
sl@0
   559
                freeaddrinfo(res);
sl@0
   560
                printf("bogus PTR record
sl@0
   561
");
sl@0
   562
                return -1;
sl@0
   563
        }
sl@0
   564
        /* addr is FQDN as a result of PTR lookup */
sl@0
   565
} else {
sl@0
   566
        /* addr is numeric string */
sl@0
   567
        error = getnameinfo(sa, salen, addr, sizeof(addr),
sl@0
   568
            NULL, 0, NI_NUMERICHOST);
sl@0
   569
}
sl@0
   570
sl@0
   571
@endcode
sl@0
   572
 
sl@0
   573
Caveats:
sl@0
   574
sl@0
   575
 getnameinfo can return both numeric and FQDN forms of the address specified in sa. There is no return value that indicates whether the string returned in host is a result of binary to numeric-text translation (like inet_ntop or is the result of a DNS reverse lookup.
sl@0
   576
Because of this, malicious parties could set up a PTR record as follows:
sl@0
   577
@code
sl@0
   578
1.0.0.127.in-addr.arpa. IN PTR  10.1.1.1
sl@0
   579
sl@0
   580
@endcode
sl@0
   581
 and trick the caller of getnameinfo into believing that sa is 10.1.1.1
sl@0
   582
when it is actually 127.0.0.1. To prevent such attacks, the use of NI_NAMEREQD is recommended when the result of getnameinfo is used
sl@0
   583
for access control purposes:
sl@0
   584
@code
sl@0
   585
struct sockaddr *sa;
sl@0
   586
socklen_t salen;
sl@0
   587
char addr[NI_MAXHOST];
sl@0
   588
struct addrinfo hints, *res;
sl@0
   589
int error;
sl@0
   590
error = getnameinfo(sa, salen, addr, sizeof(addr),
sl@0
   591
    NULL, 0, NI_NAMEREQD);
sl@0
   592
if (error == 0) {
sl@0
   593
        memset(&hints;, 0, sizeof(hints));
sl@0
   594
        hints.ai_socktype = SOCK_DGRAM; /*dummy*/
sl@0
   595
        hints.ai_flags = AI_NUMERICHOST;
sl@0
   596
        if (getaddrinfo(addr, "0", &hints;, &res;) == 0) {
sl@0
   597
                /* malicious PTR record */
sl@0
   598
                freeaddrinfo(res);
sl@0
   599
                printf("bogus PTR record
sl@0
   600
");
sl@0
   601
                return -1;
sl@0
   602
        }
sl@0
   603
        /* addr is FQDN as a result of PTR lookup */
sl@0
   604
} else {
sl@0
   605
        /* addr is numeric string */
sl@0
   606
        error = getnameinfo(sa, salen, addr, sizeof(addr),
sl@0
   607
            NULL, 0, NI_NUMERICHOST);
sl@0
   608
}
sl@0
   609
sl@0
   610
@endcode
sl@0
   611
 
sl@0
   612
 
sl@0
   613
sl@0
   614
@publishedAll
sl@0
   615
@externallyDefinedApi
sl@0
   616
*/
sl@0
   617
sl@0
   618
/** @fn  freeaddrinfo(struct addrinfo *ai)
sl@0
   619
@param ai
sl@0
   620
Refer to t() for the documentation
sl@0
   621
@see bind()
sl@0
   622
@see connect()
sl@0
   623
@see send()
sl@0
   624
@see socket()
sl@0
   625
@see gai_strerror()
sl@0
   626
@see gethostbyname()
sl@0
   627
@see getnameinfo()
sl@0
   628
@see getservent()
sl@0
   629
sl@0
   630
sl@0
   631
 
sl@0
   632
sl@0
   633
@publishedAll
sl@0
   634
@externallyDefinedApi
sl@0
   635
*/
sl@0
   636
sl@0
   637
/** @fn  gai_strerror(int ecode)
sl@0
   638
@param ecode
sl@0
   639
@return   The gai_strerror function
sl@0
   640
returns a pointer to the error message string corresponding to ecode. If ecode is out of range, an implementation-specific error message string is returned.
sl@0
   641
sl@0
   642
@code
sl@0
   643
 EAI_AGAIN temporary failure in name resolution
sl@0
   644
 EAI_BADFLAGS
sl@0
   645
  invalid value for ai_flags
sl@0
   646
 EAI_BADHINTS
sl@0
   647
  invalid value for hints
sl@0
   648
 EAI_FAIL non-recoverable failure in name resolution
sl@0
   649
 EAI_FAMILY ai_family not supported
sl@0
   650
 EAI_MEMORY memory allocation failure
sl@0
   651
 EAI_NONAME hostname or servname not provided, or not known
sl@0
   652
 EAI_PROTOCOL
sl@0
   653
  resolved protocol is unknown
sl@0
   654
 EAI_SERVICE servname not supported for ai_socktype
sl@0
   655
 EAI_SOCKTYPE
sl@0
   656
  ai_socktype not supported
sl@0
   657
 EAI_SYSTEM system error returned in errno
sl@0
   658
sl@0
   659
@endcode
sl@0
   660
  The gai_strerror function returns an error message string corresponding to the error code
sl@0
   661
returned by getaddrinfo or getnameinfo .
sl@0
   662
sl@0
   663
 The following error codes and their meaning are defined in \#include \<netdb.h\>
sl@0
   664
sl@0
   665
 EAI_AGAIN temporary failure in name resolution EAI_BADFLAGS  invalid value for ai_flags EAI_BADHINTS  invalid value for hints EAI_FAIL non-recoverable failure in name resolution EAI_FAMILY ai_family not supported EAI_MEMORY memory allocation failure EAI_NONAME hostname or servname not provided, or not known EAI_PROTOCOL  resolved protocol is unknown EAI_SERVICE servname not supported for ai_socktype EAI_SOCKTYPE  ai_socktype not supported EAI_SYSTEM system error returned in errno
sl@0
   666
sl@0
   667
Examples:
sl@0
   668
@code
sl@0
   669
#include <stdio.h>
sl@0
   670
#include <netdb.h>
sl@0
   671
#include <netinet/in.h>
sl@0
   672
int main()
sl@0
   673
{
sl@0
   674
      struct addrinfo *result;
sl@0
   675
      char hostname[80];
sl@0
   676
      int error;
sl@0
   677
      if (error = getaddrinfo("www.nokia.com",NULL, NULL, &result;))
sl@0
   678
      {
sl@0
   679
              fprintf(stderr, "error using getaddrinfo: %s
sl@0
   680
", gai_strerror(error));
sl@0
   681
      }
sl@0
   682
      if (result)
sl@0
   683
      {
sl@0
   684
              if (error = getnameinfo(result->ai_addr, sizeof(struct sockaddr), hostname, sizeof(hostname), NULL,0,0))
sl@0
   685
              {
sl@0
   686
                      printf( "error using getnameinfo: %s
sl@0
   687
", gai_strerror(error));
sl@0
   688
              }
sl@0
   689
      }
sl@0
   690
return 0;
sl@0
   691
}
sl@0
   692
sl@0
   693
@endcode
sl@0
   694
@see getaddrinfo()
sl@0
   695
@see getnameinfo()
sl@0
   696
sl@0
   697
sl@0
   698
 
sl@0
   699
sl@0
   700
@publishedAll
sl@0
   701
@externallyDefinedApi
sl@0
   702
*/
sl@0
   703
sl@0
   704
/** @fn  setservent(int f)
sl@0
   705
@param f
sl@0
   706
Refer to  getservent() for the documentation
sl@0
   707
sl@0
   708
sl@0
   709
 
sl@0
   710
sl@0
   711
@publishedAll
sl@0
   712
@externallyDefinedApi
sl@0
   713
*/
sl@0
   714
sl@0
   715
/** @def h_errno
sl@0
   716
sl@0
   717
defines errno
sl@0
   718
sl@0
   719
@publishedAll
sl@0
   720
@externallyDefinedApi
sl@0
   721
*/
sl@0
   722
sl@0
   723
/** @def _PATH_SERVICES
sl@0
   724
sl@0
   725
Defines the services path.
sl@0
   726
sl@0
   727
@publishedAll
sl@0
   728
@externallyDefinedApi
sl@0
   729
*/
sl@0
   730
sl@0
   731
/** @def NETDB_INTERNAL
sl@0
   732
sl@0
   733
Error return codes from gethostbyname() and gethostbyaddr(). see errno.
sl@0
   734
sl@0
   735
@publishedAll
sl@0
   736
@externallyDefinedApi
sl@0
   737
*/
sl@0
   738
sl@0
   739
/** @def NETDB_SUCCESS
sl@0
   740
sl@0
   741
Error return codes from gethostbyname() and gethostbyaddr(). No Problem.
sl@0
   742
sl@0
   743
@publishedAll
sl@0
   744
@externallyDefinedApi
sl@0
   745
*/
sl@0
   746
sl@0
   747
/** @def HOST_NOT_FOUND
sl@0
   748
sl@0
   749
Error return codes from gethostbyname() and gethostbyaddr(). Authoritative Answer Host not found.
sl@0
   750
sl@0
   751
@publishedAll
sl@0
   752
@externallyDefinedApi
sl@0
   753
*/
sl@0
   754
sl@0
   755
/** @def TRY_AGAIN
sl@0
   756
sl@0
   757
Error return codes from gethostbyname() and gethostbyaddr(). Non-Authoritative Host not found, or SERVERFAIL
sl@0
   758
sl@0
   759
@publishedAll
sl@0
   760
@externallyDefinedApi
sl@0
   761
*/
sl@0
   762
sl@0
   763
/** @def NO_RECOVERY
sl@0
   764
sl@0
   765
Error return codes from gethostbyname() and gethostbyaddr(). Non recoverable errors, FORMERR, REFUSED, NOTIMP
sl@0
   766
sl@0
   767
@publishedAll
sl@0
   768
@externallyDefinedApi
sl@0
   769
*/
sl@0
   770
sl@0
   771
/** @def NO_DATA
sl@0
   772
sl@0
   773
Error return codes from gethostbyname() and gethostbyaddr(). Valid name, no data record of requested type
sl@0
   774
sl@0
   775
@publishedAll
sl@0
   776
@externallyDefinedApi
sl@0
   777
*/
sl@0
   778
sl@0
   779
/** @def NO_ADDRESS
sl@0
   780
sl@0
   781
Error return codes from gethostbyname() and gethostbyaddr(). no address, look for MX record
sl@0
   782
sl@0
   783
@publishedAll
sl@0
   784
@externallyDefinedApi
sl@0
   785
*/
sl@0
   786
sl@0
   787
/** @def EAI_AGAIN
sl@0
   788
sl@0
   789
Error return codes from getaddrinfo(). emporary failure in name resolution 
sl@0
   790
sl@0
   791
@publishedAll
sl@0
   792
@externallyDefinedApi
sl@0
   793
*/
sl@0
   794
sl@0
   795
/** @def EAI_BADFLAGS
sl@0
   796
sl@0
   797
Error return codes from getaddrinfo(). invalid value for ai_flags
sl@0
   798
sl@0
   799
@publishedAll
sl@0
   800
@externallyDefinedApi
sl@0
   801
*/
sl@0
   802
sl@0
   803
/** @def EAI_FAIL
sl@0
   804
sl@0
   805
Error return codes from getaddrinfo(). non-recoverable failure in name resolution
sl@0
   806
sl@0
   807
@publishedAll
sl@0
   808
@externallyDefinedApi
sl@0
   809
*/
sl@0
   810
sl@0
   811
/** @def EAI_FAMILY
sl@0
   812
sl@0
   813
Error return codes from getaddrinfo(). ai_family not supported 
sl@0
   814
sl@0
   815
@publishedAll
sl@0
   816
@externallyDefinedApi
sl@0
   817
*/
sl@0
   818
sl@0
   819
/** @def EAI_MEMORY
sl@0
   820
sl@0
   821
Error return codes from getaddrinfo(). memory allocation failure .
sl@0
   822
sl@0
   823
@publishedAll
sl@0
   824
@externallyDefinedApi
sl@0
   825
*/
sl@0
   826
sl@0
   827
/** @def EAI_NONAME
sl@0
   828
sl@0
   829
Error return codes from getaddrinfo(). hostname nor servname provided, or not known.
sl@0
   830
sl@0
   831
@publishedAll
sl@0
   832
@externallyDefinedApi
sl@0
   833
*/
sl@0
   834
sl@0
   835
/** @def EAI_SERVICE
sl@0
   836
sl@0
   837
Error return codes from getaddrinfo(). servname not supported for ai_socktype.
sl@0
   838
sl@0
   839
@publishedAll
sl@0
   840
@externallyDefinedApi
sl@0
   841
*/
sl@0
   842
sl@0
   843
/** @def EAI_SOCKTYPE
sl@0
   844
sl@0
   845
Error return codes from getaddrinfo(). ai_socktype not supported 
sl@0
   846
sl@0
   847
@publishedAll
sl@0
   848
@externallyDefinedApi
sl@0
   849
*/
sl@0
   850
sl@0
   851
/** @def EAI_SYSTEM
sl@0
   852
sl@0
   853
Error return codes from getaddrinfo(). system error returned in errno.
sl@0
   854
sl@0
   855
@publishedAll
sl@0
   856
@externallyDefinedApi
sl@0
   857
*/
sl@0
   858
sl@0
   859
/** @def EAI_SOCKTYPE
sl@0
   860
sl@0
   861
Error return codes from getaddrinfo(). 
sl@0
   862
sl@0
   863
@publishedAll
sl@0
   864
@externallyDefinedApi
sl@0
   865
*/
sl@0
   866
 
sl@0
   867
/** @def EAI_BADHINTS
sl@0
   868
sl@0
   869
Error return codes from getaddrinfo(). 
sl@0
   870
sl@0
   871
@publishedAll
sl@0
   872
@externallyDefinedApi
sl@0
   873
*/
sl@0
   874
sl@0
   875
/** @def EAI_PROTOCOL
sl@0
   876
sl@0
   877
Error return codes from getaddrinfo(). 
sl@0
   878
sl@0
   879
@publishedAll
sl@0
   880
@externallyDefinedApi
sl@0
   881
*/
sl@0
   882
sl@0
   883
/** @def EAI_MAX
sl@0
   884
sl@0
   885
Error return codes from getaddrinfo(). 
sl@0
   886
sl@0
   887
@publishedAll
sl@0
   888
@externallyDefinedApi
sl@0
   889
*/
sl@0
   890
sl@0
   891
/** @def AI_PASSIVE
sl@0
   892
sl@0
   893
Flag values for getaddrinfo(). get address to use bind() 
sl@0
   894
sl@0
   895
@publishedAll
sl@0
   896
@externallyDefinedApi
sl@0
   897
*/
sl@0
   898
sl@0
   899
/** @def AI_NUMERICHOST
sl@0
   900
sl@0
   901
Flag values for getaddrinfo(). prevent host name resolution
sl@0
   902
sl@0
   903
@publishedAll
sl@0
   904
@externallyDefinedApi
sl@0
   905
*/
sl@0
   906
sl@0
   907
/** @def AI_CANONNAME
sl@0
   908
sl@0
   909
Flag values for getaddrinfo(). fill ai_canonname
sl@0
   910
sl@0
   911
@publishedAll
sl@0
   912
@externallyDefinedApi
sl@0
   913
*/
sl@0
   914
sl@0
   915
/** @def AI_NUMERICSERV
sl@0
   916
sl@0
   917
Flag values for getaddrinfo(). prevent service name resolution 
sl@0
   918
sl@0
   919
@publishedAll
sl@0
   920
@externallyDefinedApi
sl@0
   921
*/
sl@0
   922
sl@0
   923
/** @def AI_MASK
sl@0
   924
sl@0
   925
valid flags for addrinfo (not a standard def, apps should not use it) 
sl@0
   926
sl@0
   927
@publishedAll
sl@0
   928
@externallyDefinedApi
sl@0
   929
*/
sl@0
   930
sl@0
   931
/** @def AI_ALL
sl@0
   932
sl@0
   933
IPv6 and IPv4-mapped (with AI_V4MAPPED) 
sl@0
   934
sl@0
   935
@publishedAll
sl@0
   936
@externallyDefinedApi
sl@0
   937
*/
sl@0
   938
sl@0
   939
/** @def AI_V4MAPPED_CFG
sl@0
   940
sl@0
   941
accept IPv4-mapped if kernel supports
sl@0
   942
sl@0
   943
@publishedAll
sl@0
   944
@externallyDefinedApi
sl@0
   945
*/
sl@0
   946
sl@0
   947
/** @def AI_ADDRCONFIG
sl@0
   948
sl@0
   949
only if any address is assigned
sl@0
   950
sl@0
   951
@publishedAll
sl@0
   952
@externallyDefinedApi
sl@0
   953
*/
sl@0
   954
sl@0
   955
/** @def AI_V4MAPPED
sl@0
   956
sl@0
   957
accept IPv4-mapped IPv6 address
sl@0
   958
sl@0
   959
@publishedAll
sl@0
   960
@externallyDefinedApi
sl@0
   961
*/
sl@0
   962
sl@0
   963
/** @def AI_DEFAULT
sl@0
   964
sl@0
   965
special recommended flags for getipnodebyname
sl@0
   966
sl@0
   967
@publishedAll
sl@0
   968
@externallyDefinedApi
sl@0
   969
*/
sl@0
   970
sl@0
   971
/** @def NI_MAXHOST
sl@0
   972
sl@0
   973
Constants for getnameinfo()
sl@0
   974
sl@0
   975
@publishedAll
sl@0
   976
@externallyDefinedApi
sl@0
   977
*/
sl@0
   978
sl@0
   979
/** @def NI_MAXSERV
sl@0
   980
sl@0
   981
Constants for getnameinfo()
sl@0
   982
sl@0
   983
@publishedAll
sl@0
   984
@externallyDefinedApi
sl@0
   985
*/
sl@0
   986
sl@0
   987
/** @def NI_NOFQDN
sl@0
   988
sl@0
   989
Flag values for getnameinfo().
sl@0
   990
Only the nodename portion of the FQDN is returned for local hosts.
sl@0
   991
sl@0
   992
@publishedAll
sl@0
   993
@externallyDefinedApi
sl@0
   994
*/
sl@0
   995
sl@0
   996
/** @def NI_NUMERICHOST
sl@0
   997
sl@0
   998
Flag values for getnameinfo().
sl@0
   999
The numeric form of the node's address is returned instead of its name.
sl@0
  1000
sl@0
  1001
@publishedAll
sl@0
  1002
@externallyDefinedApi
sl@0
  1003
*/
sl@0
  1004
sl@0
  1005
/** @def NI_NAMEREQD
sl@0
  1006
sl@0
  1007
Flag values for getnameinfo().
sl@0
  1008
Return an error if the node's name cannot be located in the database.
sl@0
  1009
sl@0
  1010
@publishedAll
sl@0
  1011
@externallyDefinedApi
sl@0
  1012
*/
sl@0
  1013
sl@0
  1014
/** @def NI_NUMERICSERV
sl@0
  1015
sl@0
  1016
Flag values for getnameinfo().
sl@0
  1017
The numeric form of the service address is returned instead of its name.
sl@0
  1018
sl@0
  1019
@publishedAll
sl@0
  1020
@externallyDefinedApi
sl@0
  1021
*/
sl@0
  1022
sl@0
  1023
/** @def NI_DGRAM
sl@0
  1024
sl@0
  1025
Flag values for getnameinfo().
sl@0
  1026
Indicates that the service is a datagram service (SOCK_DGRAM).
sl@0
  1027
sl@0
  1028
@publishedAll
sl@0
  1029
@externallyDefinedApi
sl@0
  1030
*/
sl@0
  1031
sl@0
  1032
/** @def SCOPE_DELIMITER
sl@0
  1033
sl@0
  1034
Scope delimit character
sl@0
  1035
sl@0
  1036
@publishedAll
sl@0
  1037
@externallyDefinedApi
sl@0
  1038
*/
sl@0
  1039
sl@0
  1040
/** @struct hostent
sl@0
  1041
sl@0
  1042
Structures returned by network data base library.  
sl@0
  1043
All addresses are supplied in host order, and returned in network order (suitable for use in system calls).
sl@0
  1044
sl@0
  1045
@publishedAll
sl@0
  1046
@externallyDefinedApi
sl@0
  1047
*/
sl@0
  1048
sl@0
  1049
/** @var hostent::h_name
sl@0
  1050
official name of host
sl@0
  1051
*/
sl@0
  1052
sl@0
  1053
/** @var hostent::h_aliases
sl@0
  1054
alias list 
sl@0
  1055
*/
sl@0
  1056
sl@0
  1057
/** @var hostent::h_addrtype
sl@0
  1058
host address type
sl@0
  1059
*/
sl@0
  1060
sl@0
  1061
/** @var hostent::h_length
sl@0
  1062
length of address
sl@0
  1063
*/
sl@0
  1064
sl@0
  1065
/** @var hostent::h_addr_list
sl@0
  1066
list of addresses from name server
sl@0
  1067
*/
sl@0
  1068
sl@0
  1069
/** @struct netent
sl@0
  1070
sl@0
  1071
Contains following members,
sl@0
  1072
sl@0
  1073
@publishedAll
sl@0
  1074
@externallyDefinedApi
sl@0
  1075
*/
sl@0
  1076
sl@0
  1077
/** @var netent::n_name
sl@0
  1078
official name of net
sl@0
  1079
*/
sl@0
  1080
sl@0
  1081
/** @var netent::n_aliases
sl@0
  1082
alias list 
sl@0
  1083
*/
sl@0
  1084
sl@0
  1085
/** @var netent::n_addrtype
sl@0
  1086
net address type
sl@0
  1087
*/
sl@0
  1088
sl@0
  1089
/** @var netent::n_net
sl@0
  1090
network
sl@0
  1091
*/
sl@0
  1092
sl@0
  1093
/** @struct servent
sl@0
  1094
sl@0
  1095
Includes following members,
sl@0
  1096
sl@0
  1097
@publishedAll
sl@0
  1098
@externallyDefinedApi
sl@0
  1099
*/
sl@0
  1100
sl@0
  1101
/** @var servent::s_name
sl@0
  1102
official service name
sl@0
  1103
*/
sl@0
  1104
sl@0
  1105
/** @var servent::s_aliases
sl@0
  1106
alias list
sl@0
  1107
*/
sl@0
  1108
sl@0
  1109
/** @var servent::s_port
sl@0
  1110
 port X
sl@0
  1111
*/
sl@0
  1112
sl@0
  1113
/** @var servent::s_proto
sl@0
  1114
protocol to use 
sl@0
  1115
*/
sl@0
  1116
sl@0
  1117
/** @struct protoent
sl@0
  1118
sl@0
  1119
Includes the following members,
sl@0
  1120
sl@0
  1121
@publishedAll
sl@0
  1122
@externallyDefinedApi
sl@0
  1123
*/
sl@0
  1124
sl@0
  1125
/** @var protoent::p_name
sl@0
  1126
official protocol name
sl@0
  1127
*/
sl@0
  1128
sl@0
  1129
/** @var protoent::p_aliases
sl@0
  1130
alias list
sl@0
  1131
*/
sl@0
  1132
sl@0
  1133
/** @var protoent::p_proto
sl@0
  1134
protocol X
sl@0
  1135
*/
sl@0
  1136
sl@0
  1137
/** @struct addrinfo
sl@0
  1138
sl@0
  1139
Includes the following members,
sl@0
  1140
sl@0
  1141
@publishedAll
sl@0
  1142
@externallyDefinedApi
sl@0
  1143
*/
sl@0
  1144
sl@0
  1145
/** @var addrinfo::ai_flags
sl@0
  1146
AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST 
sl@0
  1147
*/
sl@0
  1148
sl@0
  1149
/** @var addrinfo::ai_family
sl@0
  1150
PF_xxx
sl@0
  1151
*/
sl@0
  1152
sl@0
  1153
/** @var addrinfo::ai_socktype
sl@0
  1154
SOCK_xxx 
sl@0
  1155
*/
sl@0
  1156
sl@0
  1157
/** @var addrinfo::ai_protocol
sl@0
  1158
0 or IPPROTO_xxx for IPv4 and IPv6
sl@0
  1159
*/
sl@0
  1160
sl@0
  1161
/** @var addrinfo::ai_addrlen
sl@0
  1162
length of ai_addr
sl@0
  1163
*/
sl@0
  1164
sl@0
  1165
/** @var addrinfo::ai_canonname
sl@0
  1166
 canonical name for hostname 
sl@0
  1167
*/
sl@0
  1168
sl@0
  1169
/** @var addrinfo::ai_addr
sl@0
  1170
binary address
sl@0
  1171
*/
sl@0
  1172
sl@0
  1173
/** @var addrinfo::ai_next
sl@0
  1174
next structure in linked list
sl@0
  1175
*/
sl@0
  1176
sl@0
  1177
sl@0
  1178
/** @typedef  typedef __size_t	size_t
sl@0
  1179
sl@0
  1180
Used for sizes of objects.
sl@0
  1181
sl@0
  1182
@publishedAll
sl@0
  1183
@externallyDefinedApi
sl@0
  1184
*/
sl@0
  1185
sl@0
  1186
/** @typedef  typedef __socklen_t	socklen_t
sl@0
  1187
sl@0
  1188
Socket address length type.
sl@0
  1189
sl@0
  1190
@publishedAll
sl@0
  1191
@externallyDefinedApi
sl@0
  1192
*/
sl@0
  1193
sl@0
  1194
/** @typedef  typedef __uint32_t	uint32_t
sl@0
  1195
sl@0
  1196
Unsigned long int
sl@0
  1197
sl@0
  1198
@publishedAll
sl@0
  1199
@externallyDefinedApi
sl@0
  1200
*/
sl@0
  1201
sl@0
  1202
sl@0
  1203
sl@0
  1204
sl@0
  1205
sl@0
  1206
sl@0
  1207
sl@0
  1208
sl@0
  1209
sl@0
  1210
sl@0
  1211
sl@0
  1212
sl@0
  1213