logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

netdb.h.0p (9452B)


  1. '\" et
  2. .TH netdb.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. netdb.h
  12. \(em definitions for network database operations
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <netdb.h>
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR <netdb.h>
  21. header may define the
  22. .BR in_port_t
  23. type and the
  24. .BR in_addr_t
  25. type as described in
  26. .IR <netinet/in.h> .
  27. .P
  28. The
  29. .IR <netdb.h>
  30. header shall define the
  31. .BR hostent
  32. structure, which shall include at least the following members:
  33. .sp
  34. .RS 4
  35. .nf
  36. char *h_name \fROfficial name of the host.\fR
  37. char **h_aliases \fRA pointer to an array of pointers to\fR
  38. \fRalternative host names, terminated by a\fR
  39. \fRnull pointer.\fR
  40. int h_addrtype \fRAddress type.\fR
  41. int h_length \fRThe length, in bytes, of the address.\fR
  42. char **h_addr_list \fRA pointer to an array of pointers to network\fR
  43. \fRaddresses (in network byte order) for the host,\fR
  44. \fRterminated by a null pointer.\fR
  45. .fi
  46. .P
  47. .RE
  48. .P
  49. The
  50. .IR <netdb.h>
  51. header shall define the
  52. .BR netent
  53. structure, which shall include at least the following members:
  54. .sp
  55. .RS 4
  56. .nf
  57. char *n_name \fROfficial, fully-qualified (including the\fR
  58. \fRdomain) name of the host.\fR
  59. char **n_aliases \fRA pointer to an array of pointers to\fR
  60. \fRalternative network names, terminated by a\fR
  61. \fRnull pointer.\fR
  62. int n_addrtype \fRThe address type of the network.\fR
  63. uint32_t n_net \fRThe network number, in host byte order.\fR
  64. .fi
  65. .P
  66. .RE
  67. .P
  68. The
  69. .IR <netdb.h>
  70. header shall define the
  71. .BR uint32_t
  72. type as described in
  73. .IR <inttypes.h> .
  74. .P
  75. The
  76. .IR <netdb.h>
  77. header shall define the
  78. .BR protoent
  79. structure, which shall include at least the following members:
  80. .sp
  81. .RS 4
  82. .nf
  83. char *p_name \fROfficial name of the protocol.\fR
  84. char **p_aliases \fRA pointer to an array of pointers to\fR
  85. \fRalternative protocol names, terminated by\fR
  86. \fRa null pointer.\fR
  87. int p_proto \fRThe protocol number.\fR
  88. .fi
  89. .P
  90. .RE
  91. .P
  92. The
  93. .IR <netdb.h>
  94. header shall define the
  95. .BR servent
  96. structure, which shall include at least the following members:
  97. .sp
  98. .RS 4
  99. .nf
  100. char *s_name \fROfficial name of the service.\fR
  101. char **s_aliases \fRA pointer to an array of pointers to\fR
  102. \fRalternative service names, terminated by\fR
  103. \fRa null pointer.\fR
  104. int s_port \fRA value which, when converted to uint16_t,\fR
  105. \fRyields the port number in network byte order\fR
  106. \fRat which the service resides.\fR
  107. char *s_proto \fRThe name of the protocol to use when\fR
  108. \fRcontacting the service.\fR
  109. .fi
  110. .P
  111. .RE
  112. .P
  113. The
  114. .IR <netdb.h>
  115. header shall define the IPPORT_RESERVED symbolic constant with the
  116. value of the highest reserved Internet port number.
  117. .SS "Address Information Structure"
  118. .P
  119. The
  120. .IR <netdb.h>
  121. header shall define the
  122. .BR addrinfo
  123. structure, which shall include at least the following members:
  124. .sp
  125. .RS 4
  126. .nf
  127. int ai_flags \fRInput flags.\fR
  128. int ai_family \fRAddress family of socket.\fR
  129. int ai_socktype \fRSocket type.\fR
  130. int ai_protocol \fRProtocol of socket.\fR
  131. socklen_t ai_addrlen \fRLength of socket address.\fR
  132. struct sockaddr *ai_addr \fRSocket address of socket.\fR
  133. char *ai_canonname \fRCanonical name of service location.\fR
  134. struct addrinfo *ai_next \fRPointer to next in list.\fR
  135. .fi
  136. .P
  137. .RE
  138. .P
  139. The
  140. .IR <netdb.h>
  141. header shall define the following symbolic constants that evaluate to
  142. bitwise-distinct integer constants for use in the
  143. .IR flags
  144. field of the
  145. .BR addrinfo
  146. structure:
  147. .IP AI_PASSIVE 14
  148. Socket address is intended for
  149. \fIbind\fR().
  150. .IP AI_CANONNAME 14
  151. Request for canonical name.
  152. .IP AI_NUMERICHOST 14
  153. Return numeric host address as name.
  154. .IP AI_NUMERICSERV 14
  155. Inhibit service name resolution.
  156. .IP AI_V4MAPPED 14
  157. If no IPv6 addresses are found, query for IPv4 addresses and return
  158. them to the caller as IPv4-mapped IPv6 addresses.
  159. .IP AI_ALL 14
  160. Query for both IPv4 and IPv6 addresses.
  161. .IP AI_ADDRCONFIG 14
  162. Query for IPv4 addresses only when an IPv4 address is configured;
  163. query for IPv6 addresses only when an IPv6 address is configured.
  164. .P
  165. The
  166. .IR <netdb.h>
  167. header shall define the following symbolic constants that evaluate
  168. to bitwise-distinct integer constants for use in the
  169. .IR flags
  170. argument to
  171. \fIgetnameinfo\fR():
  172. .IP NI_NOFQDN 14
  173. Only the nodename portion of the FQDN is returned for local hosts.
  174. .IP NI_NUMERICHOST 14
  175. The numeric form of the node's address is returned instead of its
  176. name.
  177. .IP NI_NAMEREQD 14
  178. Return an error if the node's name cannot be located in the database.
  179. .IP NI_NUMERICSERV 14
  180. The numeric form of the service address is returned instead of its name.
  181. .IP NI_NUMERICSCOPE 14
  182. .br
  183. For IPv6 addresses, the numeric form of the scope identifier is
  184. returned instead of its name.
  185. .IP NI_DGRAM 14
  186. Indicates that the service is a datagram service (SOCK_DGRAM).
  187. .SS "Address Information Errors"
  188. .P
  189. The
  190. .IR <netdb.h>
  191. header shall define the following symbolic constants for use as
  192. error values for
  193. \fIgetaddrinfo\fR()
  194. and
  195. \fIgetnameinfo\fR().
  196. The values shall be suitable for use in
  197. .BR #if
  198. preprocessing directives.
  199. .IP EAI_AGAIN 14
  200. The name could not be resolved at this time. Future attempts may
  201. succeed.
  202. .IP EAI_BADFLAGS 14
  203. The flags had an invalid value.
  204. .IP EAI_FAIL 14
  205. A non-recoverable error occurred.
  206. .IP EAI_FAMILY 14
  207. The address family was not recognized or the address length was invalid
  208. for the specified family.
  209. .IP EAI_MEMORY 14
  210. There was a memory allocation failure.
  211. .IP EAI_NONAME 14
  212. The name does not resolve for the supplied parameters.
  213. .RS 14
  214. .P
  215. NI_NAMEREQD is set and the host's name cannot be located, or both
  216. .IR nodename
  217. and
  218. .IR servname
  219. were null.
  220. .RE
  221. .IP EAI_SERVICE 14
  222. The service passed was not recognized for the specified socket type.
  223. .IP EAI_SOCKTYPE 14
  224. The intended socket type was not recognized.
  225. .IP EAI_SYSTEM 14
  226. A system error occurred. The error code can be found in
  227. .IR errno .
  228. .IP EAI_OVERFLOW 14
  229. An argument buffer overflowed.
  230. .P
  231. The following shall be declared as functions and may also be defined as
  232. macros. Function prototypes shall be provided.
  233. .sp
  234. .RS 4
  235. .nf
  236. void endhostent(void);
  237. void endnetent(void);
  238. void endprotoent(void);
  239. void endservent(void);
  240. void freeaddrinfo(struct addrinfo *);
  241. const char *gai_strerror(int);
  242. int getaddrinfo(const char *restrict, const char *restrict,
  243. const struct addrinfo *restrict,
  244. struct addrinfo **restrict);
  245. struct hostent *gethostent(void);
  246. int getnameinfo(const struct sockaddr *restrict, socklen_t,
  247. char *restrict, socklen_t, char *restrict,
  248. socklen_t, int);
  249. struct netent *getnetbyaddr(uint32_t, int);
  250. struct netent *getnetbyname(const char *);
  251. struct netent *getnetent(void);
  252. struct protoent *getprotobyname(const char *);
  253. struct protoent *getprotobynumber(int);
  254. struct protoent *getprotoent(void);
  255. struct servent *getservbyname(const char *, const char *);
  256. struct servent *getservbyport(int, const char *);
  257. struct servent *getservent(void);
  258. void sethostent(int);
  259. void setnetent(int);
  260. void setprotoent(int);
  261. void setservent(int);
  262. .fi
  263. .P
  264. .RE
  265. .P
  266. The
  267. .IR <netdb.h>
  268. header shall define the
  269. .BR socklen_t
  270. type through
  271. .BR typedef ,
  272. as described in
  273. .IR <sys/socket.h> .
  274. .P
  275. Inclusion of the
  276. .IR <netdb.h>
  277. header may also make visible all symbols from
  278. .IR <netinet/in.h> ,
  279. .IR <sys/socket.h> ,
  280. and
  281. .IR <inttypes.h> .
  282. .LP
  283. .IR "The following sections are informative."
  284. .SH "APPLICATION USAGE"
  285. None.
  286. .SH "RATIONALE"
  287. None.
  288. .SH "FUTURE DIRECTIONS"
  289. None.
  290. .SH "SEE ALSO"
  291. .IR "\fB<inttypes.h>\fP",
  292. .IR "\fB<netinet_in.h>\fP",
  293. .IR "\fB<sys_socket.h>\fP"
  294. .P
  295. The System Interfaces volume of POSIX.1\(hy2017,
  296. .IR "\fIbind\fR\^(\|)",
  297. .IR "\fIendhostent\fR\^(\|)",
  298. .IR "\fIendnetent\fR\^(\|)",
  299. .IR "\fIendprotoent\fR\^(\|)",
  300. .IR "\fIendservent\fR\^(\|)",
  301. .IR "\fIfreeaddrinfo\fR\^(\|)",
  302. .IR "\fIgai_strerror\fR\^(\|)",
  303. .IR "\fIgetnameinfo\fR\^(\|)"
  304. .\"
  305. .SH COPYRIGHT
  306. Portions of this text are reprinted and reproduced in electronic form
  307. from IEEE Std 1003.1-2017, Standard for Information Technology
  308. -- Portable Operating System Interface (POSIX), The Open Group Base
  309. Specifications Issue 7, 2018 Edition,
  310. Copyright (C) 2018 by the Institute of
  311. Electrical and Electronics Engineers, Inc and The Open Group.
  312. In the event of any discrepancy between this version and the original IEEE and
  313. The Open Group Standard, the original IEEE and The Open Group Standard
  314. is the referee document. The original Standard can be obtained online at
  315. http://www.opengroup.org/unix/online.html .
  316. .PP
  317. Any typographical or formatting errors that appear
  318. in this page are most likely
  319. to have been introduced during the conversion of the source files to
  320. man page format. To report such errors, see
  321. https://www.kernel.org/doc/man-pages/reporting_bugs.html .