1/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */ 2 3/* 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 49 unchanged lines hidden (view full) --- 58 * presented above. 59 * 60 * OS specific notes for freebsd4: 61 * - FreeBSD supported $GAI. The code does not. 62 * - FreeBSD allowed classful IPv4 numeric (127.1), the code does not. 63 */ 64 65#include <sys/cdefs.h> |
66__FBSDID("$FreeBSD: head/lib/libc/net/getaddrinfo.c 146244 2005-05-15 20:15:15Z ume $"); |
67 68#include "namespace.h" 69#include <sys/types.h> 70#include <sys/param.h> 71#include <sys/socket.h> 72#include <net/if.h> 73#include <netinet/in.h> 74#include <sys/queue.h> --- 55 unchanged lines hidden (view full) --- 130 struct in6_addrpolicy pc_policy; 131#endif 132}; 133TAILQ_HEAD(policyhead, policyqueue); 134 135static const struct afd { 136 int a_af; 137 int a_addrlen; |
138 socklen_t a_socklen; |
139 int a_off; 140 const char *a_addrany; 141 const char *a_loopback; 142 int a_scoped; 143} afdl [] = { 144#ifdef INET6 145#define N_INET6 0 146 {PF_INET6, sizeof(struct in6_addr), --- 1200 unchanged lines hidden (view full) --- 1347 if (ai == NULL) 1348 return NULL; 1349 1350 memcpy(ai, pai, sizeof(struct addrinfo)); 1351 ai->ai_addr = (struct sockaddr *)(void *)(ai + 1); 1352 memset(ai->ai_addr, 0, (size_t)afd->a_socklen); 1353 ai->ai_addr->sa_len = afd->a_socklen; 1354 ai->ai_addrlen = afd->a_socklen; |
1355#if __LONG_BIT == 64 1356 ai->__ai_pad0 = 0; /* ABI compatibility */ 1357#endif |
1358 ai->ai_addr->sa_family = ai->ai_family = afd->a_af; 1359 p = (char *)(void *)(ai->ai_addr); 1360#ifdef FAITH 1361 if (translate == 1) 1362 memcpy(p + afd->a_off, &faith_prefix, (size_t)afd->a_addrlen); 1363 else 1364#endif 1365 memcpy(p + afd->a_off, addr, (size_t)afd->a_addrlen); --- 1216 unchanged lines hidden --- |