Overview
Comment: | Make Windows XP work again |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
631661004a034e295de3d46e4b5bc30e |
User & Date: | js on 2022-11-04 23:25:53 |
Other Links: | manifest | tags |
Context
2022-11-04
| ||
23:30 | configure: Check for if_{indextoname,nametoindex} check-in: d5310a5145 user: js tags: trunk | |
23:25 | Make Windows XP work again check-in: 631661004a user: js tags: trunk | |
20:23 | Add support for IPv6 addresses with scope check-in: 027b704b66 user: js tags: trunk | |
Changes
Modified src/OFSocket.m from [4c24f8dfd3] to [1bb1aecd92].
︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | # else struct Library *SocketBase; # ifdef OF_AMIGAOS4 struct SocketIFace *ISocket = NULL; # endif # endif #endif #if defined(OF_HAVE_THREADS) && defined(OF_AMIGAOS) && !defined(OF_MORPHOS) OF_CONSTRUCTOR() { if (OFTLSKeyNew(&OFSocketBaseKey) != 0) @throw [OFInitializationFailedException exception]; # ifdef OF_AMIGAOS4 if (OFTLSKeyNew(&OFSocketInterfaceKey) != 0) @throw [OFInitializationFailedException exception]; # endif } #endif #if !defined(OF_AMIGAOS) || defined(OF_MORPHOS) || !defined(OF_HAVE_THREADS) static void init(void) { # if defined(OF_WINDOWS) WSADATA wsa; if (WSAStartup(MAKEWORD(2, 0), &wsa)) return; # elif defined(OF_AMIGAOS) if ((SocketBase = OpenLibrary("bsdsocket.library", 4)) == NULL) return; # ifdef OF_AMIGAOS4 if ((ISocket = (struct SocketIFace *) GetInterface(SocketBase, "main", 1, NULL)) == NULL) { | > > > > > > > > > > > > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | # else struct Library *SocketBase; # ifdef OF_AMIGAOS4 struct SocketIFace *ISocket = NULL; # endif # endif #endif #ifdef OF_WINDOWS static WINAPI PCHAR (*if_indextonamePtr)(NET_IFINDEX, PCHAR); static WINAPI NET_IFINDEX (*if_nametoindexPtr)(PCSTR); #endif #if defined(OF_HAVE_THREADS) && defined(OF_AMIGAOS) && !defined(OF_MORPHOS) OF_CONSTRUCTOR() { if (OFTLSKeyNew(&OFSocketBaseKey) != 0) @throw [OFInitializationFailedException exception]; # ifdef OF_AMIGAOS4 if (OFTLSKeyNew(&OFSocketInterfaceKey) != 0) @throw [OFInitializationFailedException exception]; # endif } #endif #if !defined(OF_AMIGAOS) || defined(OF_MORPHOS) || !defined(OF_HAVE_THREADS) static void init(void) { # if defined(OF_WINDOWS) WSADATA wsa; HMODULE module; if (WSAStartup(MAKEWORD(2, 0), &wsa)) return; if ((module = LoadLibrary("iphlpapi.dll")) != NULL) { if_indextonamePtr = (WINAPI PCHAR (*)(NET_IFINDEX, PCHAR)) GetProcAddress(module, "if_indextoname"); if_nametoindexPtr = (WINAPI NET_IFINDEX (*)(PCSTR)) GetProcAddress(module, "if_nametoindex"); } # elif defined(OF_AMIGAOS) if ((SocketBase = OpenLibrary("bsdsocket.library", 4)) == NULL) return; # ifdef OF_AMIGAOS4 if ((ISocket = (struct SocketIFace *) GetInterface(SocketBase, "main", 1, NULL)) == NULL) { |
︙ | ︙ | |||
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | #endif addrIn6->sin6_port = OFToBigEndian16(port); if ((percent = [IPv6 rangeOfString: @"%"].location) != OFNotFound) { OFString *interface = [IPv6 substringFromIndex: percent + 1]; IPv6 = [IPv6 substringToIndex: percent]; addrIn6->sin6_scope_id = if_nametoindex( [interface cStringWithEncoding: [OFLocale encoding]]); } doubleColon = [IPv6 rangeOfString: @"::"].location; if (doubleColon != OFNotFound) { OFString *left = [IPv6 substringToIndex: doubleColon]; OFString *right = [IPv6 substringFromIndex: doubleColon + 2]; OFArray OF_GENERIC(OFString *) *leftComponents; | > > > > > > | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | #endif addrIn6->sin6_port = OFToBigEndian16(port); if ((percent = [IPv6 rangeOfString: @"%"].location) != OFNotFound) { OFString *interface = [IPv6 substringFromIndex: percent + 1]; IPv6 = [IPv6 substringToIndex: percent]; #ifdef OF_WINDOWS if (if_nametoindexPtr != NULL) addrIn6->sin6_scope_id = if_nametoindexPtr([interface cStringWithEncoding: [OFLocale encoding]]); #else addrIn6->sin6_scope_id = if_nametoindex( [interface cStringWithEncoding: [OFLocale encoding]]); #endif } doubleColon = [IPv6 rangeOfString: @"::"].location; if (doubleColon != OFNotFound) { OFString *left = [IPv6 substringToIndex: doubleColon]; OFString *right = [IPv6 substringFromIndex: doubleColon + 2]; OFArray OF_GENERIC(OFString *) *leftComponents; |
︙ | ︙ | |||
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | (addrIn6->sin6_addr.s6_addr[i] << 8) | addrIn6->sin6_addr.s6_addr[i + 1]]; first = false; } } if (addrIn6->sin6_scope_id != 0) { char interface[IF_NAMESIZE]; if (if_indextoname(addrIn6->sin6_scope_id, interface) != NULL) [string appendFormat: @"%%%s", interface]; else [string appendFormat: @"%%%u", addrIn6->sin6_scope_id]; } [string makeImmutable]; | > > > > > > > | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | (addrIn6->sin6_addr.s6_addr[i] << 8) | addrIn6->sin6_addr.s6_addr[i + 1]]; first = false; } } if (addrIn6->sin6_scope_id != 0) { #ifdef OF_WINDOWS char interface[IF_MAX_STRING_SIZE]; if (if_indextonamePtr != NULL && if_indextonamePtr( addrIn6->sin6_scope_id, interface) != NULL) #else char interface[IF_NAMESIZE]; if (if_indextoname(addrIn6->sin6_scope_id, interface) != NULL) #endif [string appendFormat: @"%%%s", interface]; else [string appendFormat: @"%%%u", addrIn6->sin6_scope_id]; } [string makeImmutable]; |
︙ | ︙ |