Lines Matching defs:addr

620 int net_gethostbyname(const char *addr, struct ip_addr **ips,
634 if (addr[0] == '[' && net_addr2ip(addr, &ip) == 0) {
645 host_error = getaddrinfo(addr, NULL, &hints, &ai);
686 int net_getsockname(int fd, struct ip_addr *addr, in_port_t *port)
697 if (addr != NULL)
698 i_zero(addr);
701 if (addr != NULL) sin_get_ip(&so, addr);
707 int net_getpeername(int fd, struct ip_addr *addr, in_port_t *port)
718 if (addr != NULL)
719 i_zero(addr);
722 if (addr != NULL) sin_get_ip(&so, addr);
870 char *addr = t_malloc_no0(MAX_IP_LEN+1);
872 if (inet_ntop(ip->family, &ip->u.ip6, addr, MAX_IP_LEN) == NULL)
875 return addr;
878 static bool net_addr2ip_inet4_fast(const char *addr, struct ip_addr *ip)
883 if (str_parse_uint(addr, &num, &addr) < 0)
885 if (*addr == '\0' && num <= 0xffffffff) {
901 if (*addr != '.')
903 addr++;
904 if (str_parse_uint(addr, &num, &addr) < 0)
907 if (*addr != '\0')
913 int net_addr2ip(const char *addr, struct ip_addr *ip)
917 if (net_addr2ip_inet4_fast(addr, ip))
920 if (strchr(addr, ':') != NULL) {
923 if (addr[0] == '[') {
924 /* allow [ipv6 addr] */
925 size_t len = strlen(addr);
926 if (addr[len-1] == ']')
927 addr = t_strndup(addr+1, len-2);
929 ret = inet_pton(AF_INET6, addr, &ip->u.ip6);
936 if (inet_aton(addr, &ip->u.ip4) == 0)
1072 bool is_ipv4_address(const char *addr)
1074 while (*addr != '\0') {
1075 if (*addr != '.' && !i_isdigit(*addr))
1077 addr++;
1083 bool is_ipv6_address(const char *addr)
1087 if (*addr == '[') {
1089 addr++;
1091 while (*addr != '\0') {
1092 if (*addr != ':' && !i_isxdigit(*addr)) {
1093 if (have_prefix && *addr == ']' && addr[1] == '\0')
1097 addr++;