Lines Matching defs:addrinfo
393 struct addrinfo *info;
430 static PCAP_SOCKET sock_create_socket(struct addrinfo *addrinfo, char *errbuf,
438 sock = socket(addrinfo->ai_family, addrinfo->ai_socktype,
439 addrinfo->ai_protocol);
479 * \param addrinfo: pointer to an addrinfo variable which will be used to
499 PCAP_SOCKET sock_open(const char *host, struct addrinfo *addrinfo,
512 sock = sock_create_socket(addrinfo, errbuf, errbuflen);
561 if (addrinfo->ai_family == PF_INET6)
576 addrinfo->ai_addr, (int) addrinfo->ai_addrlen) != 0)
583 if (addrinfo->ai_socktype == SOCK_STREAM)
598 struct addrinfo *tempaddrinfo;
612 for (tempaddrinfo = addrinfo; tempaddrinfo != NULL;
636 for (tempaddrinfo = addrinfo, i = 0; tempaddrinfo != NULL;
1042 * \brief Checks that the address, port and flags given are valid and it returns an 'addrinfo' structure.
1054 * \param hints: an addrinfo variable (passed by reference) containing the flags needed to create the
1055 * addrinfo structure appropriately.
1057 * \param addrinfo: it represents the true returning value. This is a pointer to an addrinfo variable
1068 * \return a pointer to the first element in a list of addrinfo structures
1072 * \warning The list of addrinfo structures returned has to be deleted by
1079 struct addrinfo *sock_initaddress(const char *host, const char *port,
1080 struct addrinfo *hints, char *errbuf, int errbuflen)
1082 struct addrinfo *addrinfo;
1094 retval = getaddrinfo(host, port == NULL ? "0" : port, hints, &addrinfo);
1112 &addrinfo);
1121 freeaddrinfo(addrinfo);
1149 * addrinfo has more han one pointers
1160 if ((addrinfo
1161 (addrinfo->ai_family != PF_INET6))
1165 freeaddrinfo(addrinfo);
1172 if ((addrinfo->ai_socktype == SOCK_STREAM) &&
1173 (sock_ismcastaddr(addrinfo->ai_addr) == 0))
1177 freeaddrinfo(addrinfo);
1181 return addrinfo;
1740 struct addrinfo *addrinfo, *ai_next;
1759 /* it avoids a warning in the compilation ('addrinfo used but not initialized') */
1760 addrinfo = NULL;
1764 struct addrinfo hints;
1767 addrinfo = NULL;
1768 memset(&hints, 0, sizeof(struct addrinfo));
1772 retval = getaddrinfo(token, NULL, &hints, &addrinfo);
1791 /* ai_next is required to preserve the content of addrinfo, in order to deallocate it properly */
1792 ai_next = addrinfo;
1798 freeaddrinfo(addrinfo);
1809 freeaddrinfo(addrinfo);
1810 addrinfo = NULL;
1816 if (addrinfo)
1818 freeaddrinfo(addrinfo);
1819 addrinfo = NULL;
2089 struct addrinfo *addrinfo;
2090 struct addrinfo hints;
2096 addrinfo = sock_initaddress(address, "22222" /* fake port */, &hints,
2098 if (addrinfo == NULL)
2101 if (addrinfo->ai_family == PF_INET)
2102 memcpy(sockaddr, addrinfo->ai_addr, sizeof(struct sockaddr_in));
2104 memcpy(sockaddr, addrinfo->ai_addr, sizeof(struct sockaddr_in6));
2106 if (addrinfo->ai_next != NULL)
2108 freeaddrinfo(addrinfo);
2115 freeaddrinfo(addrinfo);