1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-
+
|
/*
* tclUnixSock.c --
*
* This file contains Unix-specific socket related code.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclUnixSock.c,v 1.25.2.7 2010/04/01 13:31:17 dkf Exp $
* RCS: @(#) $Id: tclUnixSock.c,v 1.25.2.8 2010/06/10 22:56:02 hobbs Exp $
*/
#include "tclInt.h"
/*
* Helper macros to make parts of this file clearer. The macros do exactly
* what they say on the tin. :-) They also only ever refer to their arguments
|
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
|
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
|
+
+
|
*/
flags = NI_NUMERICSERV;
if (sockname.sa.sa_family == AF_INET) {
if (sockname.sa4.sin_addr.s_addr == INADDR_ANY) {
flags |= NI_NUMERICHOST;
}
#ifndef NEED_FAKE_RFC2553
} else if (sockname.sa.sa_family == AF_INET6) {
if ((IN6_ARE_ADDR_EQUAL(&sockname.sa6.sin6_addr,
&in6addr_any))
|| (IN6_IS_ADDR_V4MAPPED(&sockname.sa6.sin6_addr) &&
sockname.sa6.sin6_addr.s6_addr[12] == 0 &&
sockname.sa6.sin6_addr.s6_addr[13] == 0 &&
sockname.sa6.sin6_addr.s6_addr[14] == 0 &&
sockname.sa6.sin6_addr.s6_addr[15] == 0)) {
flags |= NI_NUMERICHOST;
}
#endif
}
getnameinfo(&sockname.sa, size, host, sizeof(host), port,
sizeof(port), flags);
Tcl_DStringAppendElement(dsPtr, host);
Tcl_DStringAppendElement(dsPtr, port);
}
}
|