What Does AI Stand For in addrinfo?

Problem scenario
You see several variables that start with "ai_". What does the "a" and "i" stand for?

Solution
The "a" stands for "address" and the "i" stands for "info".

The man page for getaddrinfo says "The getaddrinfo() function is defined for protocol-independent nodename-to-address translation." taken from http://www.nsc.ru/cgi-bin/www/unix_help/unix-man?getaddrinfo.

Therefore ai_flags, ai_family, ai_scoktype, ai_protocol, ai_addrlen, ai_canonname, ai_addr, ai_next, ai_numerichost, ai_passive are member values of the addrinfo struct.

This excerpt was taken from (http://www.nsc.ru/cgi-bin/www/unix_help/unix-man?getaddrinfo):

struct addrinfo {
	  int	  ai_flags;	/* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
	  int	  ai_family;	/* PF_xxx */
	  int	  ai_socktype;	/* SOCK_xxx */
	  int	  ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
	  size_t  ai_addrlen;	/* length of ai_addr */
	  char	 *ai_canonname; /* canonical name for nodename */
	  struct sockaddr  *ai_addr; /* binary address */
	  struct addrinfo  *ai_next;
};

Leave a comment

Your email address will not be published. Required fields are marked *