int addressEqual (XdmcpNetaddr a1, int len1, XdmcpNetaddr a2, int len2) { int partlen1, partlen2; char *part1, *part2; if (len1 != len2) { return FALSE; } if (NetaddrFamily(a1) != NetaddrFamily(a2)) { return FALSE; } part1 = NetaddrPort(a1, &partlen1); part2 = NetaddrPort(a2, &partlen2); if (partlen1 != partlen2 || memcmp(part1, part2, partlen1) != 0) { return FALSE; } part1 = NetaddrAddress(a1, &partlen1); part2 = NetaddrAddress(a2, &partlen2); if (partlen1 != partlen2 || memcmp(part1, part2, partlen1) != 0) { return FALSE; } return TRUE; }
int ConvertAddr (XdmcpNetaddr saddr, int *len, char **addr) { int retval; if (len == NULL) return -1; *addr = NetaddrAddress(saddr, len); switch (NetaddrFamily(saddr)) { #ifdef AF_UNSPEC case AF_UNSPEC: retval = FamilyLocal; break; #endif #ifdef AF_UNIX #ifndef hpux case AF_UNIX: retval = FamilyLocal; break; #endif #endif #ifdef TCPCONN case AF_INET: retval = FamilyInternet; break; #endif default: retval = -1; break; } WDMDebug("ConvertAddr returning %d for family %d\n", retval, NetaddrFamily(saddr)); return retval; }
int ConvertAddr (XdmcpNetaddr saddr, int *len, char **addr) { int retval; if ((len == NULL) || (saddr == NULL)) return -1; *addr = NetaddrAddress(saddr, len); # ifdef STREAMSCONN /* kludge */ if (NetaddrFamily(saddr) == 2) retval = FamilyInternet; # else switch (NetaddrFamily(saddr)) { # ifdef AF_UNSPEC case AF_UNSPEC: retval = FamilyLocal; break; # endif # ifdef AF_UNIX case AF_UNIX: retval = FamilyLocal; break; # endif # ifdef TCPCONN case AF_INET: retval = FamilyInternet; break; case AF_INET6: if (*len == sizeof(struct in_addr)) retval = FamilyInternet; else retval = FamilyInternet6; break; # endif default: retval = -1; break; } # endif /* STREAMSCONN else */ Debug ("ConvertAddr returning %d for family %d\n", retval, NetaddrFamily(saddr)); return retval; }