mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 15:38:22 +00:00
Add ioctl(SIOCGIFxxx) support (#197)
- SIOCGIFCONFIG: reads and enumerate all the network interfaces - SIOCGIFADDR: reads network address for a given interface - SIOCGIFFLAGS: reads network flags for a given interface - SIOCGIFNETMASK: reads network netmask for a given interface - SIOCGIFBRDADDR: reads network broadcast address for a given interface - SIOCGIFDSTADDR: reads peer destination address for a given interface (not supported for Windows) This change defines Linux ABI structs for the above interfaces and adds polyfills to ensure they behave consistently on XNU and Windows.
This commit is contained in:
parent
4d8f884e76
commit
fd0eefce17
105 changed files with 1531 additions and 4 deletions
1
Makefile
1
Makefile
|
@ -240,6 +240,7 @@ COSMOPOLITAN_OBJECTS = \
|
|||
LIBC_DNS \
|
||||
LIBC_SOCK \
|
||||
LIBC_NT_WS2_32 \
|
||||
LIBC_NT_IPHLPAPI \
|
||||
LIBC_NT_MSWSOCK \
|
||||
LIBC_OHMYPLUS \
|
||||
LIBC_X \
|
||||
|
|
|
@ -43,6 +43,8 @@ LIBC_CALLS_A_DIRECTDEPS = \
|
|||
LIBC_NT_ADVAPI32 \
|
||||
LIBC_NT_KERNEL32 \
|
||||
LIBC_NT_NTDLL \
|
||||
LIBC_NT_WS2_32 \
|
||||
LIBC_NT_IPHLPAPI \
|
||||
LIBC_STR \
|
||||
LIBC_STUBS \
|
||||
LIBC_SYSV_CALLS \
|
||||
|
|
398
libc/calls/ioctl-siocgifconf-nt.c
Normal file
398
libc/calls/ioctl-siocgifconf-nt.c
Normal file
|
@ -0,0 +1,398 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/af.h"
|
||||
#include "libc/sock/sock.h"
|
||||
#include "libc/sock/internal.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/sysv/consts/iff.h"
|
||||
#include "libc/nt/winsock.h"
|
||||
#include "libc/nt/errors.h"
|
||||
#include "libc/nt/iphlpapi.h"
|
||||
#include "libc/nt/struct/ipadapteraddresses.h"
|
||||
#include "libc/bits/weaken.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/assert.h"
|
||||
//#include "libc/nt/windows.h" /* Needed for WideCharToMultiByte */
|
||||
|
||||
/* Maximum number of unicast addresses handled for each interface */
|
||||
#define MAX_UNICAST_ADDR 32
|
||||
#define MAX_NAME_CLASH ((int)('z'-'a')) /* Allow a..z */
|
||||
|
||||
static int insertAdapterName(NtIpAdapterAddresses *aa);
|
||||
|
||||
struct HostAdapterInfoNode {
|
||||
struct HostAdapterInfoNode * next;
|
||||
char name[IFNAMSIZ]; /* Obtained from FriendlyName */
|
||||
struct sockaddr unicast;
|
||||
struct sockaddr netmask;
|
||||
struct sockaddr broadcast;
|
||||
short flags;
|
||||
} *__hostInfo;
|
||||
|
||||
/* Frees all the nodes of the _hostInfo */
|
||||
static void freeHostInfo() {
|
||||
struct HostAdapterInfoNode *next, *node = __hostInfo;
|
||||
while(node) {
|
||||
next = node->next;
|
||||
weaken(free)(node);
|
||||
node = next;
|
||||
}
|
||||
__hostInfo = NULL;
|
||||
}
|
||||
|
||||
/* Given a short adapter name, look into __hostInfo to see if there is
|
||||
* an adapter with the same name. Returns the pointer to the HostAdapterInfoNode
|
||||
* if found, or NULL if not found
|
||||
*/
|
||||
static struct HostAdapterInfoNode *findAdapterByName(const char *name) {
|
||||
struct HostAdapterInfoNode *node = __hostInfo;
|
||||
while(node) {
|
||||
if (!strncmp(name, node->name, IFNAMSIZ)) {
|
||||
/* Found */
|
||||
return node;
|
||||
}
|
||||
node=node->next;
|
||||
}
|
||||
/* Not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Creates a new HostAdapterInfoNode object, initializes it from
|
||||
* the given adapter, unicast address and address prefixes
|
||||
* and insert it in the __hostInfo.
|
||||
* Increments the pointers to the unicast addresses and
|
||||
* the address prefixes
|
||||
* Returns NULL if an error occurred or the newly created
|
||||
* HostAdapterInfoNode object (last in the list)
|
||||
*/
|
||||
struct HostAdapterInfoNode *appendHostInfo(
|
||||
struct HostAdapterInfoNode *parentInfoNode,
|
||||
const char *baseName, /* Max length = IFNAMSIZ-1 */
|
||||
const NtIpAdapterAddresses *aa, /* Top level adapter object being processed */
|
||||
NtIpAdapterUnicastAddress **ptrUA, /* Ptr to ptr to unicast address list node */
|
||||
NtIpAdapterPrefix **ptrAP, /* Ptr to ptr to Adapter prefix list node */
|
||||
int count) { /* count is used to create a unique name in case of alias */
|
||||
|
||||
struct HostAdapterInfoNode *temp;
|
||||
struct HostAdapterInfoNode *node;
|
||||
struct sockaddr_in tempAddr;
|
||||
int attemptNum;
|
||||
|
||||
node = weaken(calloc)(1, sizeof(*node));
|
||||
if (!node) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(node->name, baseName, IFNAMSIZ);
|
||||
|
||||
/* Are there more than a single unicast address ? */
|
||||
if (count > 0 || ((*ptrUA)->Next != NULL)) {
|
||||
/* Yes, compose it using <baseName>:<count> */
|
||||
size_t nameLen = strlen(node->name);
|
||||
if (nameLen+2 > IFNAMSIZ-2) {
|
||||
/* Appending the ":x" will exceed the size, need to chop the end */
|
||||
nameLen -= 2;
|
||||
}
|
||||
node->name[nameLen-2] = ':';
|
||||
node->name[nameLen-1] = '0'+count;
|
||||
node->name[nameLen] = '\0';
|
||||
}
|
||||
|
||||
/* Is there a name clash with other interfaces? */
|
||||
for (attemptNum=0; attemptNum < MAX_NAME_CLASH; ++attemptNum) {
|
||||
temp = findAdapterByName(node->name);
|
||||
if (!temp) {
|
||||
break;
|
||||
|
||||
} else {
|
||||
/* Yes, this name has been already used, append an extra
|
||||
* character to resolve conflict. Note since the max length
|
||||
* of the string now is IFNAMSIZ-2, we have just enough space for this.
|
||||
* E.g. 'Ethernet_1' -> 'Ethernet_1a'
|
||||
*/
|
||||
|
||||
size_t pos = strlen(node->name);
|
||||
node->name[pos] = 'a' + attemptNum;
|
||||
node->name[pos+1] = '\0';
|
||||
/* Try again */
|
||||
}
|
||||
}
|
||||
if (attemptNum == MAX_NAME_CLASH) {
|
||||
/* Cannot resolve the conflict */
|
||||
weaken(free)(node);
|
||||
errno = EEXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Finally we got a unique short and friendly name */
|
||||
node->unicast = *((*ptrUA)->Address.lpSockaddr);
|
||||
if (*ptrUA == aa->FirstUnicastAddress) {
|
||||
short flags;
|
||||
/* This is the first unicast address of this interface
|
||||
* calculate the flags for this adapter. Flags to consider:
|
||||
* IFF_UP
|
||||
* IFF_BROADCAST ** TODO: We need to validate
|
||||
* IFF_LOOPBACK
|
||||
* IFF_POINTOPOINT
|
||||
* IFF_MULTICAST
|
||||
* IFF_RUNNING ** Same as IFF_UP for now
|
||||
* IFF_PROMISC ** NOT SUPPORTED, unknown how to retrieve it
|
||||
*/
|
||||
flags = 0;
|
||||
if (aa->OperStatus == kNtIfOperStatusUp) flags |= IFF_UP | IFF_RUNNING;
|
||||
if (aa->IfType == kNtIfTypePpp) flags |= IFF_POINTOPOINT;
|
||||
//if (aa->TunnelType != TUNNEL_TYPE_NONE) flags |= IFF_POINTOPOINT;
|
||||
if (aa->NoMulticast == 0) flags |= IFF_MULTICAST;
|
||||
if (aa->IfType == kNtIfTypeSoftwareLoopback) flags |= IFF_LOOPBACK;
|
||||
if (aa->FirstPrefix != NULL) flags |= IFF_BROADCAST;
|
||||
node->flags = flags;
|
||||
} else {
|
||||
/* Copy from previous node */
|
||||
node->flags = parentInfoNode->flags;
|
||||
}
|
||||
|
||||
/* Process the prefix and extract the netmask and broadcast */
|
||||
/* According to the doc:
|
||||
* ... On Windows Vista and later, the linked IP_ADAPTER_PREFIX structures pointed to
|
||||
* by the FirstPrefix member include three IP adapter prefixes for each IP address
|
||||
* assigned to the adapter. These include the host IP address prefix, the subnet IP
|
||||
* address prefix, and the subnet broadcast IP address prefix. In addition, for each
|
||||
* adapter there is a multicast address prefix and a broadcast address prefix.
|
||||
*
|
||||
* For example, interface "Ethernet", with 2 unicast addresses:
|
||||
* - 192.168.1.84
|
||||
* - 192.168.5.99
|
||||
* The Prefix list has 8 elements:
|
||||
* #1: 192.168.1.0/24 <- Network, use the PrefixLength for netmask
|
||||
* #2: 192.168.1.84/32 <- Host IP
|
||||
* #3: 192.168.1.255/32 <- Subnet broadcast
|
||||
*
|
||||
* #4: 192.168.5.0/24 <- Network
|
||||
* #5: 192.168.5.99/32 <- Host IP
|
||||
* #6: 192.168.5.255/32 <- Subnet broadcast
|
||||
*
|
||||
* #7: 224.0.0.0/4 <- Multicast
|
||||
* #8: 255.255.255.255/32 <- Broadcast
|
||||
*/
|
||||
|
||||
/* Netmask */
|
||||
memset(&tempAddr, 0, sizeof(tempAddr));
|
||||
tempAddr.sin_family = AF_INET;
|
||||
tempAddr.sin_addr.s_addr = (uint32_t)((1LLU << (*ptrAP)->PrefixLength) - 1LLU);
|
||||
memcpy(&node->netmask, &tempAddr, sizeof(tempAddr));
|
||||
|
||||
*ptrAP = (*ptrAP)->Next;
|
||||
*ptrAP = (*ptrAP)->Next; /* Skip over Host IP */
|
||||
|
||||
/* Broadcast */
|
||||
node->broadcast = *((*ptrAP)->Address.lpSockaddr);
|
||||
*ptrAP = (*ptrAP)->Next;
|
||||
|
||||
/* Move pointer to Unicast Address record */
|
||||
*ptrUA = (*ptrUA)->Next;
|
||||
|
||||
/* Append this node to the last node (if any) */
|
||||
if (parentInfoNode) {
|
||||
parentInfoNode->next = node;
|
||||
}
|
||||
|
||||
/* Success */
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Returns -1 in case of failure */
|
||||
static int createHostInfo(NtIpAdapterAddresses *firstAdapter) {
|
||||
NtIpAdapterAddresses *aa;
|
||||
NtIpAdapterUnicastAddress *ua;
|
||||
NtIpAdapterPrefix *ap;
|
||||
struct HostAdapterInfoNode *node = NULL;
|
||||
char baseName[IFNAMSIZ];
|
||||
char name[IFNAMSIZ];
|
||||
int count, i;
|
||||
|
||||
/* __hostInfo must be empty */
|
||||
assert(__hostInfo == NULL);
|
||||
assert(weaken(tprecode16to8));
|
||||
|
||||
for (aa = firstAdapter; aa; aa = aa->Next) {
|
||||
/* Skip all the interfaces with no address and the ones that are not AF_INET */
|
||||
if (!aa->FirstUnicastAddress ||
|
||||
aa->FirstUnicastAddress->Address.lpSockaddr->sa_family != AF_INET) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Use max IFNAMSIZ-1 chars, leave the last char for eventual conficts */
|
||||
tprecode16to8(baseName, IFNAMSIZ-1, aa->FriendlyName);
|
||||
baseName[IFNAMSIZ-2] = '\0';
|
||||
/* Replace any space with a '_' */
|
||||
for (i = 0; i < IFNAMSIZ-2; ++i) {
|
||||
if (baseName[i] == ' ') baseName[i] = '_';
|
||||
if (!baseName[i]) break;
|
||||
}
|
||||
for (count = 0, ua = aa->FirstUnicastAddress, ap = aa->FirstPrefix;
|
||||
(ua != NULL) && (count < MAX_UNICAST_ADDR);
|
||||
++count) {
|
||||
node = appendHostInfo(node, baseName, aa, &ua, &ap, count);
|
||||
if (!node) {
|
||||
goto err;
|
||||
}
|
||||
if (!__hostInfo) __hostInfo = node;
|
||||
}
|
||||
|
||||
/* Note: do we need to process the remaining adapter prefix?
|
||||
* ap - points to broadcast addr
|
||||
* ap->Next - points to interface multicast addr
|
||||
* Ignoring them for now
|
||||
*/
|
||||
}
|
||||
return 0;
|
||||
|
||||
err:
|
||||
freeHostInfo(__hostInfo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int readAdapterAddresses(void) {
|
||||
uint32_t size, rc;
|
||||
NtIpAdapterAddresses * aa = NULL;
|
||||
|
||||
assert(weaken(GetAdaptersAddresses));
|
||||
|
||||
/* Calculate the required data size
|
||||
* Note: alternatively you can use AF_UNSPEC to also return IPv6 interfaces
|
||||
*/
|
||||
rc = weaken(GetAdaptersAddresses)(AF_INET,
|
||||
kNtGaaFlagSkipAnycast | kNtGaaFlagSkipMulticast | kNtGaaFlagSkipDnsServer | kNtGaaFlagIncludePrefix,
|
||||
NULL, /* Reserved */
|
||||
NULL, /* Ptr */
|
||||
&size);
|
||||
if (rc != kNtErrorBufferOverflow) {
|
||||
ebadf();
|
||||
goto err;
|
||||
}
|
||||
|
||||
aa = (NtIpAdapterAddresses *)weaken(malloc)(size);
|
||||
if (!aa) {
|
||||
enomem();
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Re-run GetAdaptersAddresses this time with a valid buffer */
|
||||
rc = weaken(GetAdaptersAddresses)(AF_INET,
|
||||
kNtGaaFlagSkipAnycast | kNtGaaFlagSkipMulticast | kNtGaaFlagSkipDnsServer | kNtGaaFlagIncludePrefix,
|
||||
//kNtGaaFlagIncludePrefix,
|
||||
NULL,
|
||||
aa,
|
||||
&size);
|
||||
if (rc != kNtErrorSuccess) {
|
||||
efault();
|
||||
goto err;
|
||||
}
|
||||
if (createHostInfo(aa) == -1) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
weaken(free)(aa);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
if (aa) {
|
||||
weaken(free)(aa);
|
||||
}
|
||||
freeHostInfo();
|
||||
return -1;
|
||||
}
|
||||
|
||||
textwindows int ioctl_siocgifconf_nt(int fd, struct ifconf *ifc) {
|
||||
NtIpAdapterAddresses *aa;
|
||||
struct HostAdapterInfoNode *node;
|
||||
struct ifreq *ptr;
|
||||
|
||||
if (__hostInfo) {
|
||||
freeHostInfo();
|
||||
}
|
||||
|
||||
if (readAdapterAddresses() == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (ptr = ifc->ifc_req, node = __hostInfo;
|
||||
(((char *)(ptr+1) - ifc->ifc_buf) < ifc->ifc_len) && node;
|
||||
ptr++, node = node->next) {
|
||||
memcpy(ptr->ifr_name, node->name, IFNAMSIZ);
|
||||
memcpy(&ptr->ifr_addr, &node->unicast, sizeof(struct sockaddr));
|
||||
}
|
||||
ifc->ifc_len = (char *)ptr - ifc->ifc_buf;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Performs the SIOCGIFADDR operation */
|
||||
int ioctl_siocgifaddr_nt(int fd, struct ifreq *ifr) {
|
||||
struct HostAdapterInfoNode *node;
|
||||
|
||||
node = findAdapterByName(ifr->ifr_name);
|
||||
if (!node) {
|
||||
return ebadf();
|
||||
}
|
||||
memcpy(&ifr->ifr_addr, &node->unicast, sizeof(struct sockaddr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Performs the SIOCGIFFLAGS operation */
|
||||
int ioctl_siocgifflags_nt(int fd, struct ifreq *ifr) {
|
||||
struct HostAdapterInfoNode *node;
|
||||
|
||||
node = findAdapterByName(ifr->ifr_name);
|
||||
if (!node) {
|
||||
return ebadf();
|
||||
}
|
||||
ifr->ifr_flags = node->flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Performs the SIOCGIFNETMASK operation */
|
||||
int ioctl_siocgifnetmask_nt(int fd, struct ifreq *ifr) {
|
||||
struct HostAdapterInfoNode *node;
|
||||
|
||||
node = findAdapterByName(ifr->ifr_name);
|
||||
if (!node) {
|
||||
return ebadf();
|
||||
}
|
||||
memcpy(&ifr->ifr_netmask, &node->netmask, sizeof(struct sockaddr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Performs the SIOCGIFBRDADDR operation */
|
||||
int ioctl_siocgifbrdaddr_nt(int fd, struct ifreq *ifr) {
|
||||
struct HostAdapterInfoNode *node;
|
||||
|
||||
node = findAdapterByName(ifr->ifr_name);
|
||||
if (!node) {
|
||||
return ebadf();
|
||||
}
|
||||
memcpy(&ifr->ifr_broadaddr, &node->broadcast, sizeof(struct sockaddr));
|
||||
return 0;
|
||||
}
|
||||
|
178
libc/calls/ioctl-siocgifconf.c
Normal file
178
libc/calls/ioctl-siocgifconf.c
Normal file
|
@ -0,0 +1,178 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/weaken.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/sock/sock.h"
|
||||
#include "libc/sock/internal.h"
|
||||
#include "libc/sysv/consts/sio.h"
|
||||
|
||||
/* SIOCGIFCONF:
|
||||
* Takes an struct ifconf object of a given size
|
||||
* Modifies the following:
|
||||
* - ifc_len: set it to the number of valid ifreq structures representing
|
||||
* the interfaces
|
||||
* - ifc_ifcu.ifcu_req: sets the name of the interface for each interface
|
||||
* The ifc_len is an input/output parameter: set it to the total size of
|
||||
* the ifcu_buf (ifcu_req) buffer on input.
|
||||
*/
|
||||
int ioctl_default(int, uint64_t, void *) hidden;
|
||||
int ioctl_siocgifconf_nt(int, struct ifconf *) hidden;
|
||||
int ioctl_siocgifaddr_nt(int, struct ifreq *) hidden;
|
||||
int ioctl_siocgifflags_nt(int, struct ifreq *) hidden;
|
||||
int ioctl_siocgifnetmask_nt(int, struct ifreq *) hidden;
|
||||
int ioctl_siocgifbrdaddr_nt(int, struct ifreq *) hidden;
|
||||
|
||||
static int ioctl_siocgifconf_sysv(int fd, struct ifconf *ifc) {
|
||||
if (IsBsd()) {
|
||||
/* BSD uses a slightly different memory structure where:
|
||||
* - sizeof(struct ifreq) is 32 bytes instead of 40 bytes
|
||||
* - ifc.ifc_len is uint32_t instead of uint64_t
|
||||
* - struct ifconf is #pragma pack(4) (instead of the default pack(8))
|
||||
*/
|
||||
int i;
|
||||
char *buf; /* Temporary buffer to store ifreq */
|
||||
char *pBsdReq; /* Scan through buf records */
|
||||
char *pBsdEnd; /* End of the ifreq */
|
||||
|
||||
struct ifconf_bsd ifc_bsd;
|
||||
struct ifreq_bsd *bsdReq;
|
||||
struct ifreq *req;
|
||||
size_t numReq = ifc->ifc_len / sizeof(struct ifreq);
|
||||
|
||||
if (!weaken(malloc)) {
|
||||
return enomem();
|
||||
}
|
||||
ifc_bsd.ifc_len = numReq * sizeof(struct ifreq_bsd);
|
||||
buf = weaken(malloc)(ifc_bsd.ifc_len);
|
||||
if (!buf) {
|
||||
return enomem();
|
||||
}
|
||||
ifc_bsd.ifc_buf = buf;
|
||||
|
||||
if ((i = sys_ioctl(fd, SIOCGIFCONF, &ifc_bsd)) < 0) {
|
||||
weaken(free)(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* On BSD the size of the struct ifreq is different than Linux.
|
||||
* On Linux is fixed (40 bytes), but on BSD the struct sockaddr
|
||||
* has variable length, making the whole struct ifreq a variable
|
||||
* sized record.
|
||||
*/
|
||||
for (pBsdReq = buf, pBsdEnd = buf + ifc_bsd.ifc_len, req = ifc->ifc_req;
|
||||
pBsdReq < pBsdEnd;
|
||||
++req) {
|
||||
bsdReq = (struct ifreq_bsd *)pBsdReq;
|
||||
memcpy(req->ifr_name, bsdReq->ifr_name, IFNAMSIZ);
|
||||
memcpy(&req->ifr_addr, &bsdReq->ifr_addr, sizeof(struct sockaddr_bsd));
|
||||
sockaddr2linux(&req->ifr_addr);
|
||||
|
||||
pBsdReq += IFNAMSIZ + bsdReq->ifr_addr.sa_len;
|
||||
}
|
||||
|
||||
/* Adjust len */
|
||||
ifc->ifc_len = (size_t)((char *)req - ifc->ifc_buf);
|
||||
weaken(free)(buf);
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
/* 100% compatible with Linux */
|
||||
return sys_ioctl(fd, SIOCGIFCONF, ifc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Used for all the ioctl that returns sockaddr structure that
|
||||
* requires adjustment between Linux and BSD
|
||||
*/
|
||||
static int ioctl_siocgifaddr_sysv(int fd, uint64_t op, struct ifreq *ifr) {
|
||||
int i;
|
||||
|
||||
if (IsBsd()) {
|
||||
sockaddr2bsd(&ifr->ifr_addr);
|
||||
}
|
||||
if ((i = sys_ioctl(fd, op, ifr)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (IsBsd()) {
|
||||
sockaddr2linux(&ifr->ifr_addr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about network interfaces.
|
||||
*
|
||||
* @see ioctl(fd, SIOCGIFCONF, tio) dispatches here
|
||||
*/
|
||||
int ioctl_siocgifconf(int fd, void *ifc) {
|
||||
if (!IsWindows()) {
|
||||
return ioctl_siocgifconf_sysv(fd, (struct ifconf *)ifc);
|
||||
} else {
|
||||
return ioctl_siocgifconf_nt(fd, ifc);
|
||||
}
|
||||
}
|
||||
|
||||
int ioctl_siocgifaddr(int fd, void *ifr) {
|
||||
if (!IsWindows()) {
|
||||
return ioctl_siocgifaddr_sysv(fd, SIOCGIFADDR, (struct ifreq *)ifr);
|
||||
} else {
|
||||
return ioctl_siocgifaddr_nt(fd, (struct ifreq *)ifr);
|
||||
}
|
||||
}
|
||||
|
||||
int ioctl_siocgifnetmask(int fd, void *ifr) {
|
||||
if (!IsWindows()) {
|
||||
return ioctl_siocgifaddr_sysv(fd, SIOCGIFNETMASK, (struct ifreq *)ifr);
|
||||
} else {
|
||||
return ioctl_siocgifnetmask_nt(fd, (struct ifreq *)ifr);
|
||||
}
|
||||
}
|
||||
|
||||
int ioctl_siocgifbrdaddr(int fd, void *ifr) {
|
||||
if (!IsWindows()) {
|
||||
return ioctl_siocgifaddr_sysv(fd, SIOCGIFBRDADDR, (struct ifreq *)ifr);
|
||||
} else {
|
||||
return ioctl_siocgifbrdaddr_nt(fd, (struct ifreq *)ifr);
|
||||
}
|
||||
}
|
||||
|
||||
int ioctl_siocgifdstaddr(int fd, void *ifr) {
|
||||
if (!IsWindows()) {
|
||||
return ioctl_siocgifaddr_sysv(fd, SIOCGIFDSTADDR, (struct ifreq *)ifr);
|
||||
} else {
|
||||
return enotsup();
|
||||
/* Not supported - TODO: Find out how to retrieve the destination
|
||||
* address of a PPP from the interface list returned by the
|
||||
* GetAdaptersAddresses function
|
||||
*
|
||||
return ioctl_siocgifbrdaddr_nt(fd, ifc);
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
int ioctl_siocgifflags(int fd, void *ifr) {
|
||||
if (!IsWindows()) {
|
||||
/* Both BSD and Linux are for once compatible here... */
|
||||
return ioctl_default(fd, SIOCGIFFLAGS, ifr);
|
||||
} else {
|
||||
return ioctl_siocgifflags_nt(fd, (struct ifreq *)ifr);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
#define COSMOPOLITAN_LIBC_CALLS_IOCTL_H_
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/sysv/consts/termios.h"
|
||||
#include "libc/sysv/consts/sio.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
|
@ -27,8 +28,18 @@ int ioctl(int, uint64_t, void *);
|
|||
if (CMP(request, TCSETS)) return ioctl_tcsets(FD, REQUEST, MEMORY); \
|
||||
if (CMP(request, TCSETSW)) return ioctl_tcsets(FD, REQUEST, MEMORY); \
|
||||
if (CMP(request, TCSETSF)) return ioctl_tcsets(FD, REQUEST, MEMORY); \
|
||||
if (CMP(request, SIOCGIFCONF)) return ioctl_siocgifconf(FD, MEMORY); \
|
||||
if (CMP(request, SIOCGIFADDR)) return ioctl_siocgifaddr(FD, MEMORY); \
|
||||
if (CMP(request, SIOCGIFNETMASK)) return ioctl_siocgifnetmask(FD, MEMORY); \
|
||||
if (CMP(request, SIOCGIFBRDADDR)) return ioctl_siocgifbrdaddr(FD, MEMORY); \
|
||||
if (CMP(request, SIOCGIFDSTADDR)) return ioctl_siocgifdstaddr(FD, MEMORY); \
|
||||
if (CMP(request, SIOCGIFFLAGS)) return ioctl_siocgifflags(FD, MEMORY); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
if (CMP(request, SIOCGIFFLAGS)) return ioctl_siocgifflags(FD, REQUEST, MEMORY); \
|
||||
*/
|
||||
|
||||
int ioctl_tcgets(int, void *);
|
||||
int ioctl_tcgets_nt(int, void *);
|
||||
int ioctl_tcsets(int, uint64_t, void *);
|
||||
|
@ -37,6 +48,12 @@ int ioctl_tiocgwinsz(int, void *);
|
|||
int ioctl_tiocgwinsz_nt(int, void *);
|
||||
int ioctl_tiocswinsz(int, void *);
|
||||
int ioctl_tiocswinsz_nt(int, void *);
|
||||
int ioctl_siocgifconf(int, void *);
|
||||
int ioctl_siocgifaddr(int, void *);
|
||||
int ioctl_siocgifdstaddr(int, void *);
|
||||
int ioctl_siocgifnetmask(int, void *);
|
||||
int ioctl_siocgifbrdaddr(int, void *);
|
||||
int ioctl_siocgifflags(int, void *);
|
||||
int ioctl_default(int, uint64_t, void *);
|
||||
|
||||
forceinline int ioctl_dispatch(int fd, uint64_t request, void *memory) {
|
||||
|
|
42
libc/nt/iphlpapi.h
Normal file
42
libc/nt/iphlpapi.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_IPHLPAPI_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_IPHLPAPI_H_
|
||||
|
||||
#include "libc/nt/struct/ipadapteraddresses.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » ip helper API ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
uint32_t GetAdaptersAddresses(
|
||||
uint32_t Family,
|
||||
uint32_t Flags,
|
||||
void * Reserved,
|
||||
NtIpAdapterAddresses *AdapterAddresses,
|
||||
uint32_t *SizePointer);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_IPHLPAPI_H_ */
|
12
libc/nt/iphlpapi/AddIPAddress.s
Normal file
12
libc/nt/iphlpapi/AddIPAddress.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_AddIPAddress,AddIPAddress,0
|
||||
|
||||
.text.windows
|
||||
AddIPAddress:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_AddIPAddress(%rip),%rax
|
||||
jmp __sysv2nt6
|
||||
.endfn AddIPAddress,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/AllocateAndGetTcpExTableFromStack.s
Normal file
12
libc/nt/iphlpapi/AllocateAndGetTcpExTableFromStack.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_AllocateAndGetTcpExTableFromStack,AllocateAndGetTcpExTableFromStack,0
|
||||
|
||||
.text.windows
|
||||
AllocateAndGetTcpExTableFromStack:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_AllocateAndGetTcpExTableFromStack(%rip),%rax
|
||||
jmp __sysv2nt6
|
||||
.endfn AllocateAndGetTcpExTableFromStack,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/AllocateAndGetUdpExTableFromStack.s
Normal file
12
libc/nt/iphlpapi/AllocateAndGetUdpExTableFromStack.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_AllocateAndGetUdpExTableFromStack,AllocateAndGetUdpExTableFromStack,0
|
||||
|
||||
.text.windows
|
||||
AllocateAndGetUdpExTableFromStack:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_AllocateAndGetUdpExTableFromStack(%rip),%rax
|
||||
jmp __sysv2nt6
|
||||
.endfn AllocateAndGetUdpExTableFromStack,globl
|
||||
.previous
|
15
libc/nt/iphlpapi/CancelIPChangeNotify.s
Normal file
15
libc/nt/iphlpapi/CancelIPChangeNotify.s
Normal file
|
@ -0,0 +1,15 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_CancelIPChangeNotify,CancelIPChangeNotify,0
|
||||
|
||||
.text.windows
|
||||
CancelIPChangeNotify:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_CancelIPChangeNotify(%rip)
|
||||
leave
|
||||
ret
|
||||
.endfn CancelIPChangeNotify,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/CaptureInterfaceHardwareCrossTimestamp.s
Normal file
12
libc/nt/iphlpapi/CaptureInterfaceHardwareCrossTimestamp.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_CaptureInterfaceHardwareCrossTimestamp,CaptureInterfaceHardwareCrossTimestamp,0
|
||||
|
||||
.text.windows
|
||||
CaptureInterfaceHardwareCrossTimestamp:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_CaptureInterfaceHardwareCrossTimestamp(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn CaptureInterfaceHardwareCrossTimestamp,globl
|
||||
.previous
|
15
libc/nt/iphlpapi/CreateIpForwardEntry.s
Normal file
15
libc/nt/iphlpapi/CreateIpForwardEntry.s
Normal file
|
@ -0,0 +1,15 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_CreateIpForwardEntry,CreateIpForwardEntry,0
|
||||
|
||||
.text.windows
|
||||
CreateIpForwardEntry:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_CreateIpForwardEntry(%rip)
|
||||
leave
|
||||
ret
|
||||
.endfn CreateIpForwardEntry,globl
|
||||
.previous
|
2
libc/nt/iphlpapi/CreateIpNetEntry.s
Normal file
2
libc/nt/iphlpapi/CreateIpNetEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_CreateIpNetEntry,CreateIpNetEntry,0
|
2
libc/nt/iphlpapi/CreatePersistentTcpPortReservation.s
Normal file
2
libc/nt/iphlpapi/CreatePersistentTcpPortReservation.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_CreatePersistentTcpPortReservation,CreatePersistentTcpPortReservation,0
|
2
libc/nt/iphlpapi/CreatePersistentUdpPortReservation.s
Normal file
2
libc/nt/iphlpapi/CreatePersistentUdpPortReservation.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_CreatePersistentUdpPortReservation,CreatePersistentUdpPortReservation,0
|
2
libc/nt/iphlpapi/CreateProxyArpEntry.s
Normal file
2
libc/nt/iphlpapi/CreateProxyArpEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_CreateProxyArpEntry,CreateProxyArpEntry,0
|
2
libc/nt/iphlpapi/DeleteIPAddress.s
Normal file
2
libc/nt/iphlpapi/DeleteIPAddress.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_DeleteIPAddress,DeleteIPAddress,0
|
2
libc/nt/iphlpapi/DeleteIpForwardEntry.s
Normal file
2
libc/nt/iphlpapi/DeleteIpForwardEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_DeleteIpForwardEntry,DeleteIpForwardEntry,0
|
2
libc/nt/iphlpapi/DeleteIpNetEntry.s
Normal file
2
libc/nt/iphlpapi/DeleteIpNetEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_DeleteIpNetEntry,DeleteIpNetEntry,0
|
2
libc/nt/iphlpapi/DeletePersistentTcpPortReservation.s
Normal file
2
libc/nt/iphlpapi/DeletePersistentTcpPortReservation.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_DeletePersistentTcpPortReservation,DeletePersistentTcpPortReservation,0
|
2
libc/nt/iphlpapi/DeletePersistentUdpPortReservation.s
Normal file
2
libc/nt/iphlpapi/DeletePersistentUdpPortReservation.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_DeletePersistentUdpPortReservation,DeletePersistentUdpPortReservation,0
|
2
libc/nt/iphlpapi/DeleteProxyArpEntry.s
Normal file
2
libc/nt/iphlpapi/DeleteProxyArpEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_DeleteProxyArpEntry,DeleteProxyArpEntry,0
|
2
libc/nt/iphlpapi/DisableMediaSense.s
Normal file
2
libc/nt/iphlpapi/DisableMediaSense.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_DisableMediaSense,DisableMediaSense,0
|
2
libc/nt/iphlpapi/EnableRouter.s
Normal file
2
libc/nt/iphlpapi/EnableRouter.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_EnableRouter,EnableRouter,0
|
15
libc/nt/iphlpapi/FlushIpNetTable.s
Normal file
15
libc/nt/iphlpapi/FlushIpNetTable.s
Normal file
|
@ -0,0 +1,15 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_FlushIpNetTable,FlushIpNetTable,0
|
||||
|
||||
.text.windows
|
||||
FlushIpNetTable:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_FlushIpNetTable(%rip)
|
||||
leave
|
||||
ret
|
||||
.endfn FlushIpNetTable,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/GetAdapterIndex.s
Normal file
12
libc/nt/iphlpapi/GetAdapterIndex.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetAdapterIndex,GetAdapterIndex,0
|
||||
|
||||
.text.windows
|
||||
GetAdapterIndex:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetAdapterIndex(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn GetAdapterIndex,globl
|
||||
.previous
|
14
libc/nt/iphlpapi/GetAdapterOrderMap.s
Normal file
14
libc/nt/iphlpapi/GetAdapterOrderMap.s
Normal file
|
@ -0,0 +1,14 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetAdapterOrderMap,GetAdapterOrderMap,0
|
||||
|
||||
.text.windows
|
||||
GetAdapterOrderMap:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
sub $32,%rsp
|
||||
call *__imp_GetAdapterOrderMap(%rip)
|
||||
leave
|
||||
ret
|
||||
.endfn GetAdapterOrderMap,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/GetAdaptersAddresses.s
Normal file
12
libc/nt/iphlpapi/GetAdaptersAddresses.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetAdaptersAddresses,GetAdaptersAddresses,67
|
||||
|
||||
.text.windows
|
||||
GetAdaptersAddresses:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetAdaptersAddresses(%rip),%rax
|
||||
jmp __sysv2nt6
|
||||
.endfn GetAdaptersAddresses,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/GetAdaptersInfo.s
Normal file
12
libc/nt/iphlpapi/GetAdaptersInfo.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetAdaptersInfo,GetAdaptersInfo,0
|
||||
|
||||
.text.windows
|
||||
GetAdaptersInfo:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetAdaptersInfo(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn GetAdaptersInfo,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/GetBestInterface.s
Normal file
12
libc/nt/iphlpapi/GetBestInterface.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetBestInterface,GetBestInterface,0
|
||||
|
||||
.text.windows
|
||||
GetBestInterface:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetBestInterface(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn GetBestInterface,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/GetBestInterfaceEx.s
Normal file
12
libc/nt/iphlpapi/GetBestInterfaceEx.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetBestInterfaceEx,GetBestInterfaceEx,0
|
||||
|
||||
.text.windows
|
||||
GetBestInterfaceEx:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetBestInterfaceEx(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn GetBestInterfaceEx,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/GetBestRoute.s
Normal file
12
libc/nt/iphlpapi/GetBestRoute.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetBestRoute,GetBestRoute,0
|
||||
|
||||
.text.windows
|
||||
GetBestRoute:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetBestRoute(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn GetBestRoute,globl
|
||||
.previous
|
2
libc/nt/iphlpapi/GetExtendedTcpTable.s
Normal file
2
libc/nt/iphlpapi/GetExtendedTcpTable.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetExtendedTcpTable,GetExtendedTcpTable,0
|
2
libc/nt/iphlpapi/GetExtendedUdpTable.s
Normal file
2
libc/nt/iphlpapi/GetExtendedUdpTable.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetExtendedUdpTable,GetExtendedUdpTable,0
|
2
libc/nt/iphlpapi/GetFriendlyIfIndex.s
Normal file
2
libc/nt/iphlpapi/GetFriendlyIfIndex.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetFriendlyIfIndex,GetFriendlyIfIndex,0
|
2
libc/nt/iphlpapi/GetIcmpStatistics.s
Normal file
2
libc/nt/iphlpapi/GetIcmpStatistics.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIcmpStatistics,GetIcmpStatistics,0
|
2
libc/nt/iphlpapi/GetIcmpStatisticsEx.s
Normal file
2
libc/nt/iphlpapi/GetIcmpStatisticsEx.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIcmpStatisticsEx,GetIcmpStatisticsEx,0
|
2
libc/nt/iphlpapi/GetIfEntry.s
Normal file
2
libc/nt/iphlpapi/GetIfEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIfEntry,GetIfEntry,0
|
2
libc/nt/iphlpapi/GetIfTable.s
Normal file
2
libc/nt/iphlpapi/GetIfTable.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIfTable,GetIfTable,0
|
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetInterfaceActiveTimestampCapabilities,GetInterfaceActiveTimestampCapabilities,0
|
2
libc/nt/iphlpapi/GetInterfaceInfo.s
Normal file
2
libc/nt/iphlpapi/GetInterfaceInfo.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetInterfaceInfo,GetInterfaceInfo,0
|
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetInterfaceSupportedTimestampCapabilities,GetInterfaceSupportedTimestampCapabilities,0
|
2
libc/nt/iphlpapi/GetIpAddrTable.s
Normal file
2
libc/nt/iphlpapi/GetIpAddrTable.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIpAddrTable,GetIpAddrTable,0
|
2
libc/nt/iphlpapi/GetIpErrorString.s
Normal file
2
libc/nt/iphlpapi/GetIpErrorString.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIpErrorString,GetIpErrorString,0
|
2
libc/nt/iphlpapi/GetIpForwardTable.s
Normal file
2
libc/nt/iphlpapi/GetIpForwardTable.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIpForwardTable,GetIpForwardTable,0
|
2
libc/nt/iphlpapi/GetIpNetTable.s
Normal file
2
libc/nt/iphlpapi/GetIpNetTable.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIpNetTable,GetIpNetTable,0
|
2
libc/nt/iphlpapi/GetIpStatistics.s
Normal file
2
libc/nt/iphlpapi/GetIpStatistics.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIpStatistics,GetIpStatistics,0
|
2
libc/nt/iphlpapi/GetIpStatisticsEx.s
Normal file
2
libc/nt/iphlpapi/GetIpStatisticsEx.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetIpStatisticsEx,GetIpStatisticsEx,0
|
2
libc/nt/iphlpapi/GetNetworkParams.s
Normal file
2
libc/nt/iphlpapi/GetNetworkParams.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetNetworkParams,GetNetworkParams,0
|
15
libc/nt/iphlpapi/GetNumberOfInterfaces.s
Normal file
15
libc/nt/iphlpapi/GetNumberOfInterfaces.s
Normal file
|
@ -0,0 +1,15 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetNumberOfInterfaces,GetNumberOfInterfaces,0
|
||||
|
||||
.text.windows
|
||||
GetNumberOfInterfaces:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_GetNumberOfInterfaces(%rip)
|
||||
leave
|
||||
ret
|
||||
.endfn GetNumberOfInterfaces,globl
|
||||
.previous
|
2
libc/nt/iphlpapi/GetOwnerModuleFromTcp6Entry.s
Normal file
2
libc/nt/iphlpapi/GetOwnerModuleFromTcp6Entry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetOwnerModuleFromTcp6Entry,GetOwnerModuleFromTcp6Entry,0
|
2
libc/nt/iphlpapi/GetOwnerModuleFromTcpEntry.s
Normal file
2
libc/nt/iphlpapi/GetOwnerModuleFromTcpEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetOwnerModuleFromTcpEntry,GetOwnerModuleFromTcpEntry,0
|
2
libc/nt/iphlpapi/GetOwnerModuleFromUdp6Entry.s
Normal file
2
libc/nt/iphlpapi/GetOwnerModuleFromUdp6Entry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetOwnerModuleFromUdp6Entry,GetOwnerModuleFromUdp6Entry,0
|
2
libc/nt/iphlpapi/GetOwnerModuleFromUdpEntry.s
Normal file
2
libc/nt/iphlpapi/GetOwnerModuleFromUdpEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetOwnerModuleFromUdpEntry,GetOwnerModuleFromUdpEntry,0
|
2
libc/nt/iphlpapi/GetPerAdapterInfo.s
Normal file
2
libc/nt/iphlpapi/GetPerAdapterInfo.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetPerAdapterInfo,GetPerAdapterInfo,0
|
2
libc/nt/iphlpapi/GetPerTcp6ConnectionEStats.s
Normal file
2
libc/nt/iphlpapi/GetPerTcp6ConnectionEStats.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetPerTcp6ConnectionEStats,GetPerTcp6ConnectionEStats,0
|
2
libc/nt/iphlpapi/GetPerTcpConnectionEStats.s
Normal file
2
libc/nt/iphlpapi/GetPerTcpConnectionEStats.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetPerTcpConnectionEStats,GetPerTcpConnectionEStats,0
|
2
libc/nt/iphlpapi/GetRTTAndHopCount.s
Normal file
2
libc/nt/iphlpapi/GetRTTAndHopCount.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetRTTAndHopCount,GetRTTAndHopCount,0
|
2
libc/nt/iphlpapi/GetTcp6Table.s
Normal file
2
libc/nt/iphlpapi/GetTcp6Table.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetTcp6Table,GetTcp6Table,0
|
2
libc/nt/iphlpapi/GetTcp6Table2.s
Normal file
2
libc/nt/iphlpapi/GetTcp6Table2.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetTcp6Table2,GetTcp6Table2,0
|
2
libc/nt/iphlpapi/GetTcpStatistics.s
Normal file
2
libc/nt/iphlpapi/GetTcpStatistics.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetTcpStatistics,GetTcpStatistics,0
|
2
libc/nt/iphlpapi/GetTcpStatisticsEx.s
Normal file
2
libc/nt/iphlpapi/GetTcpStatisticsEx.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetTcpStatisticsEx,GetTcpStatisticsEx,0
|
2
libc/nt/iphlpapi/GetTcpStatisticsEx2.s
Normal file
2
libc/nt/iphlpapi/GetTcpStatisticsEx2.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetTcpStatisticsEx2,GetTcpStatisticsEx2,0
|
12
libc/nt/iphlpapi/GetTcpTable.s
Normal file
12
libc/nt/iphlpapi/GetTcpTable.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetTcpTable,GetTcpTable,0
|
||||
|
||||
.text.windows
|
||||
GetTcpTable:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetTcpTable(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn GetTcpTable,globl
|
||||
.previous
|
12
libc/nt/iphlpapi/GetTcpTable2.s
Normal file
12
libc/nt/iphlpapi/GetTcpTable2.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetTcpTable2,GetTcpTable2,0
|
||||
|
||||
.text.windows
|
||||
GetTcpTable2:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_GetTcpTable2(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
.endfn GetTcpTable2,globl
|
||||
.previous
|
2
libc/nt/iphlpapi/GetUdp6Table.s
Normal file
2
libc/nt/iphlpapi/GetUdp6Table.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetUdp6Table,GetUdp6Table,0
|
2
libc/nt/iphlpapi/GetUdpStatistics.s
Normal file
2
libc/nt/iphlpapi/GetUdpStatistics.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetUdpStatistics,GetUdpStatistics,0
|
2
libc/nt/iphlpapi/GetUdpStatisticsEx.s
Normal file
2
libc/nt/iphlpapi/GetUdpStatisticsEx.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetUdpStatisticsEx,GetUdpStatisticsEx,0
|
2
libc/nt/iphlpapi/GetUdpStatisticsEx2.s
Normal file
2
libc/nt/iphlpapi/GetUdpStatisticsEx2.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetUdpStatisticsEx2,GetUdpStatisticsEx2,0
|
2
libc/nt/iphlpapi/GetUdpTable.s
Normal file
2
libc/nt/iphlpapi/GetUdpTable.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetUdpTable,GetUdpTable,0
|
2
libc/nt/iphlpapi/GetUniDirectionalAdapterInfo.s
Normal file
2
libc/nt/iphlpapi/GetUniDirectionalAdapterInfo.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_GetUniDirectionalAdapterInfo,GetUniDirectionalAdapterInfo,0
|
2
libc/nt/iphlpapi/IpReleaseAddress.s
Normal file
2
libc/nt/iphlpapi/IpReleaseAddress.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_IpReleaseAddress,IpReleaseAddress,0
|
2
libc/nt/iphlpapi/IpRenewAddress.s
Normal file
2
libc/nt/iphlpapi/IpRenewAddress.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_IpRenewAddress,IpRenewAddress,0
|
2
libc/nt/iphlpapi/LookupPersistentTcpPortReservation.s
Normal file
2
libc/nt/iphlpapi/LookupPersistentTcpPortReservation.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_LookupPersistentTcpPortReservation,LookupPersistentTcpPortReservation,0
|
2
libc/nt/iphlpapi/LookupPersistentUdpPortReservation.s
Normal file
2
libc/nt/iphlpapi/LookupPersistentUdpPortReservation.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_LookupPersistentUdpPortReservation,LookupPersistentUdpPortReservation,0
|
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_NhpAllocateAndGetInterfaceInfoFromStack,NhpAllocateAndGetInterfaceInfoFromStack,0
|
2
libc/nt/iphlpapi/NotifyAddrChange.s
Normal file
2
libc/nt/iphlpapi/NotifyAddrChange.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_NotifyAddrChange,NotifyAddrChange,0
|
2
libc/nt/iphlpapi/NotifyRouteChange.s
Normal file
2
libc/nt/iphlpapi/NotifyRouteChange.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_NotifyRouteChange,NotifyRouteChange,0
|
2
libc/nt/iphlpapi/ParseNetworkString.s
Normal file
2
libc/nt/iphlpapi/ParseNetworkString.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_ParseNetworkString,ParseNetworkString,0
|
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_RegisterInterfaceTimestampConfigChange,RegisterInterfaceTimestampConfigChange,0
|
2
libc/nt/iphlpapi/ResolveNeighbor.s
Normal file
2
libc/nt/iphlpapi/ResolveNeighbor.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_ResolveNeighbor,ResolveNeighbor,0
|
2
libc/nt/iphlpapi/RestoreMediaSense.s
Normal file
2
libc/nt/iphlpapi/RestoreMediaSense.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_RestoreMediaSense,RestoreMediaSense,0
|
2
libc/nt/iphlpapi/SendARP.s
Normal file
2
libc/nt/iphlpapi/SendARP.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SendARP,SendARP,0
|
2
libc/nt/iphlpapi/SetIfEntry.s
Normal file
2
libc/nt/iphlpapi/SetIfEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetIfEntry,SetIfEntry,0
|
2
libc/nt/iphlpapi/SetIpForwardEntry.s
Normal file
2
libc/nt/iphlpapi/SetIpForwardEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetIpForwardEntry,SetIpForwardEntry,0
|
2
libc/nt/iphlpapi/SetIpNetEntry.s
Normal file
2
libc/nt/iphlpapi/SetIpNetEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetIpNetEntry,SetIpNetEntry,0
|
2
libc/nt/iphlpapi/SetIpStatistics.s
Normal file
2
libc/nt/iphlpapi/SetIpStatistics.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetIpStatistics,SetIpStatistics,0
|
2
libc/nt/iphlpapi/SetIpStatisticsEx.s
Normal file
2
libc/nt/iphlpapi/SetIpStatisticsEx.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetIpStatisticsEx,SetIpStatisticsEx,0
|
2
libc/nt/iphlpapi/SetIpTTL.s
Normal file
2
libc/nt/iphlpapi/SetIpTTL.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetIpTTL,SetIpTTL,0
|
2
libc/nt/iphlpapi/SetPerTcp6ConnectionEStats.s
Normal file
2
libc/nt/iphlpapi/SetPerTcp6ConnectionEStats.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetPerTcp6ConnectionEStats,SetPerTcp6ConnectionEStats,0
|
2
libc/nt/iphlpapi/SetPerTcpConnectionEStats.s
Normal file
2
libc/nt/iphlpapi/SetPerTcpConnectionEStats.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetPerTcpConnectionEStats,SetPerTcpConnectionEStats,0
|
2
libc/nt/iphlpapi/SetTcpEntry.s
Normal file
2
libc/nt/iphlpapi/SetTcpEntry.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_SetTcpEntry,SetTcpEntry,0
|
2
libc/nt/iphlpapi/UnenableRouter.s
Normal file
2
libc/nt/iphlpapi/UnenableRouter.s
Normal file
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_UnenableRouter,UnenableRouter,0
|
|
@ -0,0 +1,2 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp iphlpapi,__imp_UnregisterInterfaceTimestampConfigChange,UnregisterInterfaceTimestampConfigChange,0
|
|
@ -1,2 +1,12 @@
|
|||
.include "o/libc/nt/codegen.inc"
|
||||
.imp kernel32,__imp_WideCharToMultiByte,WideCharToMultiByte,0
|
||||
.imp kernel32,__imp_WideCharToMultiByte,WideCharToMultiByte,1553
|
||||
|
||||
.text.windows
|
||||
WideCharToMultiByte:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
mov __imp_WideCharToMultiByte(%rip),%rax
|
||||
jmp __sysv2nt8
|
||||
.endfn WideCharToMultiByte,globl
|
||||
.previous
|
||||
|
|
|
@ -7093,7 +7093,7 @@ imp 'WerpNotifyLoadStringResource' WerpNotifyLoadStringResource KernelBase
|
|||
imp 'WerpNotifyLoadStringResourceWorker' WerpNotifyLoadStringResourceWorker kernel32 1540
|
||||
imp 'WerpNotifyUseStringResource' WerpNotifyUseStringResource KernelBase 1809
|
||||
imp 'WerpNotifyUseStringResourceWorker' WerpNotifyUseStringResourceWorker kernel32 1541
|
||||
imp 'WideCharToMultiByte' WideCharToMultiByte kernel32 0 # KernelBase
|
||||
imp 'WideCharToMultiByte' WideCharToMultiByte kernel32 1553 8
|
||||
imp 'WidenPath' WidenPath gdi32 1941
|
||||
imp 'Win32DeleteFile' Win32DeleteFile shell32 164
|
||||
imp 'WinExec' WinExec kernel32 1543
|
||||
|
@ -7797,3 +7797,92 @@ imp 'ReleaseSRWLockExclusive' ReleaseSRWLockExclusive kernel32 0 1 # Kern
|
|||
imp 'ReleaseSRWLockShared' ReleaseSRWLockShared kernel32 0 1 # KernelBase
|
||||
imp 'TryAcquireSRWLockExclusive' TryAcquireSRWLockExclusive kernel32 0 1 # KernelBase
|
||||
imp 'TryAcquireSRWLockShared' TryAcquireSRWLockShared kernel32 0 1 # KernelBase
|
||||
|
||||
imp 'AddIPAddress' AddIPAddress iphlpapi 0 5
|
||||
imp 'AllocateAndGetTcpExTableFromStack' AllocateAndGetTcpExTableFromStack iphlpapi 0 5
|
||||
imp 'AllocateAndGetUdpExTableFromStack' AllocateAndGetUdpExTableFromStack iphlpapi 0 5
|
||||
imp 'CancelIPChangeNotify' CancelIPChangeNotify iphlpapi 0 1
|
||||
imp 'CaptureInterfaceHardwareCrossTimestamp' CaptureInterfaceHardwareCrossTimestamp iphlpapi 0 2
|
||||
imp 'CreateIpForwardEntry' CreateIpForwardEntry iphlpapi 0 1
|
||||
imp 'CreateIpNetEntry' CreateIpNetEntry iphlpapi 0
|
||||
imp 'CreatePersistentTcpPortReservation' CreatePersistentTcpPortReservation iphlpapi 0
|
||||
imp 'CreatePersistentUdpPortReservation' CreatePersistentUdpPortReservation iphlpapi 0
|
||||
imp 'CreateProxyArpEntry' CreateProxyArpEntry iphlpapi 0
|
||||
imp 'DeleteIPAddress' DeleteIPAddress iphlpapi 0
|
||||
imp 'DeleteIpForwardEntry' DeleteIpForwardEntry iphlpapi 0
|
||||
imp 'DeleteIpNetEntry' DeleteIpNetEntry iphlpapi 0
|
||||
imp 'DeletePersistentTcpPortReservation' DeletePersistentTcpPortReservation iphlpapi 0
|
||||
imp 'DeletePersistentUdpPortReservation' DeletePersistentUdpPortReservation iphlpapi 0
|
||||
imp 'DeleteProxyArpEntry' DeleteProxyArpEntry iphlpapi 0
|
||||
imp 'DisableMediaSense' DisableMediaSense iphlpapi 0
|
||||
imp 'EnableRouter' EnableRouter iphlpapi 0
|
||||
imp 'FlushIpNetTable' FlushIpNetTable iphlpapi 0 1
|
||||
imp 'GetAdapterIndex' GetAdapterIndex iphlpapi 0 2
|
||||
imp 'GetAdapterOrderMap' GetAdapterOrderMap iphlpapi 0 0
|
||||
imp 'GetAdaptersAddresses' GetAdaptersAddresses iphlpapi 67 5
|
||||
imp 'GetAdaptersInfo' GetAdaptersInfo iphlpapi 0 2
|
||||
imp 'GetBestInterface' GetBestInterface iphlpapi 0 2
|
||||
imp 'GetBestInterfaceEx' GetBestInterfaceEx iphlpapi 0 2
|
||||
imp 'GetBestRoute' GetBestRoute iphlpapi 0 3
|
||||
imp 'GetExtendedTcpTable' GetExtendedTcpTable iphlpapi 0
|
||||
imp 'GetExtendedUdpTable' GetExtendedUdpTable iphlpapi 0
|
||||
imp 'GetFriendlyIfIndex' GetFriendlyIfIndex iphlpapi 0
|
||||
imp 'GetIcmpStatistics' GetIcmpStatistics iphlpapi 0
|
||||
imp 'GetIcmpStatisticsEx' GetIcmpStatisticsEx iphlpapi 0
|
||||
imp 'GetIfEntry' GetIfEntry iphlpapi 0
|
||||
imp 'GetIfTable' GetIfTable iphlpapi 0
|
||||
imp 'GetInterfaceActiveTimestampCapabilities' GetInterfaceActiveTimestampCapabilities iphlpapi 0
|
||||
imp 'GetInterfaceInfo' GetInterfaceInfo iphlpapi 0
|
||||
imp 'GetInterfaceSupportedTimestampCapabilities' GetInterfaceSupportedTimestampCapabilities iphlpapi 0
|
||||
imp 'GetIpAddrTable' GetIpAddrTable iphlpapi 0
|
||||
imp 'GetIpErrorString' GetIpErrorString iphlpapi 0
|
||||
imp 'GetIpForwardTable' GetIpForwardTable iphlpapi 0
|
||||
imp 'GetIpNetTable' GetIpNetTable iphlpapi 0
|
||||
imp 'GetIpStatistics' GetIpStatistics iphlpapi 0
|
||||
imp 'GetIpStatisticsEx' GetIpStatisticsEx iphlpapi 0
|
||||
imp 'GetNetworkParams' GetNetworkParams iphlpapi 0
|
||||
imp 'GetNumberOfInterfaces' GetNumberOfInterfaces iphlpapi 0 1
|
||||
imp 'GetOwnerModuleFromTcp6Entry' GetOwnerModuleFromTcp6Entry iphlpapi 0
|
||||
imp 'GetOwnerModuleFromTcpEntry' GetOwnerModuleFromTcpEntry iphlpapi 0
|
||||
imp 'GetOwnerModuleFromUdp6Entry' GetOwnerModuleFromUdp6Entry iphlpapi 0
|
||||
imp 'GetOwnerModuleFromUdpEntry' GetOwnerModuleFromUdpEntry iphlpapi 0
|
||||
imp 'GetPerAdapterInfo' GetPerAdapterInfo iphlpapi 0
|
||||
imp 'GetPerTcp6ConnectionEStats' GetPerTcp6ConnectionEStats iphlpapi 0
|
||||
imp 'GetPerTcpConnectionEStats' GetPerTcpConnectionEStats iphlpapi 0
|
||||
imp 'GetRTTAndHopCount' GetRTTAndHopCount iphlpapi 0
|
||||
imp 'GetTcp6Table' GetTcp6Table iphlpapi 0
|
||||
imp 'GetTcp6Table2' GetTcp6Table2 iphlpapi 0
|
||||
imp 'GetTcpStatistics' GetTcpStatistics iphlpapi 0
|
||||
imp 'GetTcpStatisticsEx' GetTcpStatisticsEx iphlpapi 0
|
||||
imp 'GetTcpStatisticsEx2' GetTcpStatisticsEx2 iphlpapi 0
|
||||
imp 'GetTcpTable' GetTcpTable iphlpapi 0 3
|
||||
imp 'GetTcpTable2' GetTcpTable2 iphlpapi 0 3
|
||||
imp 'GetUdp6Table' GetUdp6Table iphlpapi 0
|
||||
imp 'GetUdpStatistics' GetUdpStatistics iphlpapi 0
|
||||
imp 'GetUdpStatisticsEx' GetUdpStatisticsEx iphlpapi 0
|
||||
imp 'GetUdpStatisticsEx2' GetUdpStatisticsEx2 iphlpapi 0
|
||||
imp 'GetUdpTable' GetUdpTable iphlpapi 0
|
||||
imp 'GetUniDirectionalAdapterInfo' GetUniDirectionalAdapterInfo iphlpapi 0
|
||||
imp 'IpReleaseAddress' IpReleaseAddress iphlpapi 0
|
||||
imp 'IpRenewAddress' IpRenewAddress iphlpapi 0
|
||||
imp 'LookupPersistentTcpPortReservation' LookupPersistentTcpPortReservation iphlpapi 0
|
||||
imp 'LookupPersistentUdpPortReservation' LookupPersistentUdpPortReservation iphlpapi 0
|
||||
imp 'NhpAllocateAndGetInterfaceInfoFromStack' NhpAllocateAndGetInterfaceInfoFromStack iphlpapi 0
|
||||
imp 'NotifyAddrChange' NotifyAddrChange iphlpapi 0
|
||||
imp 'NotifyRouteChange' NotifyRouteChange iphlpapi 0
|
||||
imp 'ParseNetworkString' ParseNetworkString iphlpapi 0
|
||||
imp 'RegisterInterfaceTimestampConfigChange' RegisterInterfaceTimestampConfigChange iphlpapi 0
|
||||
imp 'ResolveNeighbor' ResolveNeighbor iphlpapi 0
|
||||
imp 'RestoreMediaSense' RestoreMediaSense iphlpapi 0
|
||||
imp 'SendARP' SendARP iphlpapi 0
|
||||
imp 'SetIfEntry' SetIfEntry iphlpapi 0
|
||||
imp 'SetIpForwardEntry' SetIpForwardEntry iphlpapi 0
|
||||
imp 'SetIpNetEntry' SetIpNetEntry iphlpapi 0
|
||||
imp 'SetIpStatistics' SetIpStatistics iphlpapi 0
|
||||
imp 'SetIpStatisticsEx' SetIpStatisticsEx iphlpapi 0
|
||||
imp 'SetIpTTL' SetIpTTL iphlpapi 0
|
||||
imp 'SetPerTcp6ConnectionEStats' SetPerTcp6ConnectionEStats iphlpapi 0
|
||||
imp 'SetPerTcpConnectionEStats' SetPerTcpConnectionEStats iphlpapi 0
|
||||
imp 'SetTcpEntry' SetTcpEntry iphlpapi 0
|
||||
imp 'UnenableRouter' UnenableRouter iphlpapi 0
|
||||
imp 'UnregisterInterfaceTimestampConfigChange' UnregisterInterfaceTimestampConfigChange iphlpapi 0
|
||||
|
|
|
@ -252,6 +252,27 @@ $(LIBC_NT_WS2_32_A).pkg: \
|
|||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
LIBC_NT_ARTIFACTS += LIBC_NT_IPHLPAPI_A
|
||||
LIBC_NT_IPHLPAPI = $(LIBC_NT_IPHLPAPI_A_DEPS) $(LIBC_NT_IPHLPAPI_A)
|
||||
LIBC_NT_IPHLPAPI_A = o/$(MODE)/libc/nt/iphlpapi.a
|
||||
LIBC_NT_IPHLPAPI_A_SRCS := $(wildcard libc/nt/iphlpapi/*.s)
|
||||
LIBC_NT_IPHLPAPI_A_OBJS = $(LIBC_NT_IPHLPAPI_A_SRCS:%.s=o/$(MODE)/%.o)
|
||||
LIBC_NT_IPHLPAPI_A_CHECKS = $(LIBC_IPHLPAPI_32_A).pkg
|
||||
LIBC_NT_IPHLPAPI_A_DIRECTDEPS = LIBC_NT_KERNEL32
|
||||
LIBC_NT_IPHLPAPI_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(LIBC_NT_IPHLPAPI_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
$(LIBC_NT_IPHLPAPI_A): \
|
||||
libc/nt/iphlpapi/ \
|
||||
$(LIBC_NT_IPHLPAPI_A).pkg \
|
||||
$(LIBC_NT_IPHLPAPI_A_OBJS)
|
||||
|
||||
$(LIBC_NT_IPHLPAPI_A).pkg: \
|
||||
$(LIBC_NT_IPHLPAPI_A_OBJS) \
|
||||
$(foreach x,$(LIBC_NT_IPHLPAPI_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
LIBC_NT_ARTIFACTS += LIBC_NT_MSWSOCK_A
|
||||
LIBC_NT_MSWSOCK = $(LIBC_NT_MSWSOCK_A_DEPS) $(LIBC_NT_MSWSOCK_A)
|
||||
LIBC_NT_MSWSOCK_A = o/$(MODE)/libc/nt/MsWSock.a
|
||||
|
|
291
libc/nt/struct/ipadapteraddresses.h
Normal file
291
libc/nt/struct/ipadapteraddresses.h
Normal file
|
@ -0,0 +1,291 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_STRUCT_IP_ADAPTER_ADDRESSES_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_STRUCT_IP_ADAPTER_ADDRESSES_H_
|
||||
|
||||
#include "libc/nt/winsock.h"
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Constants ----------------------------------------------------------- */
|
||||
#define kNtMaxAdapterAddressLength 8
|
||||
#define kNtMaxDnsSuffixStringLength 256
|
||||
#define kNtMaxDhcpv6DuidLength 130
|
||||
|
||||
/* Values for the 'Flags' parameter of GetAdaptersAddresses */
|
||||
#define kNtGaaFlagSkipUnicast 0x0001
|
||||
#define kNtGaaFlagSkipAnycast 0x0002
|
||||
#define kNtGaaFlagSkipMulticast 0x0004
|
||||
#define kNtGaaFlagSkipDnsServer 0x0008
|
||||
#define kNtGaaFlagIncludePrefix 0x0010
|
||||
#define kNtGaaFlagSkipFriendlyName 0x0020
|
||||
#define kNtGaaFlagIncludeWinsInfo 0x0040
|
||||
#define kNtGaaFlagIncludeGateways 0x0080
|
||||
#define kNtGaaFlagIncludeAllInterfaces 0x0100
|
||||
#define kNtGaaFlagIncludeAllCompartments 0x0200
|
||||
#define kNtGaaFlagIncludeTunnelBindingorder 0x0400
|
||||
#define kNtGaaFlagSkipDnsInfo 0x0800
|
||||
|
||||
/* Values for the IfType parameter
|
||||
* See: https://docs.microsoft.com/en-us/windows/win32/api/iptypes/ns-iptypes-ip_adapter_addresses_lh
|
||||
*/
|
||||
#define kNtIfTypeOther 1
|
||||
#define kNtIfTypeEthernetCsmacd 6
|
||||
#define kNtIfTypeIso88025Tokenring 9
|
||||
#define kNtIfTypePpp 23
|
||||
#define kNtIfTypeSoftwareLoopback 24
|
||||
#define kNtIfTypeAtm 37
|
||||
#define kNtIfTypeIeee80211 71 /* wifi */
|
||||
#define kNtIfTypeTunnel 131
|
||||
#define kNtIfTypeIeee1394 144 /* firewire */
|
||||
|
||||
|
||||
/* Enums --------------------------------------------------------------- */
|
||||
typedef enum {
|
||||
kNtIpPrefixOriginOther,
|
||||
kNtIpPrefixOriginManual,
|
||||
kNtIpPrefixOriginWellKnown,
|
||||
kNtIpPrefixOriginDhcp,
|
||||
kNtIpPrefixOriginRouterAdvertisement,
|
||||
kNtIpPrefixOriginUnchanged
|
||||
} NtPrefixOrigin;
|
||||
|
||||
typedef enum {
|
||||
kNtNlsoOther,
|
||||
kNtNlsoManual,
|
||||
kNtNlsoWellKnown,
|
||||
kNtNlsoDhcp,
|
||||
kNtNlsoLinkLayerAddress,
|
||||
kNtNlsoRandom,
|
||||
kNtIpSuffixOriginOther,
|
||||
kNtIpSuffixOriginManual,
|
||||
kNtIpSuffixOriginWellKnown,
|
||||
kNtIpSuffixOriginDhcp,
|
||||
kNtIpSuffixOriginLinkLayerAddress,
|
||||
kNtIpSuffixOriginRandom,
|
||||
kNtIpSuffixOriginUnchanged
|
||||
} NtSuffixOrigin;
|
||||
|
||||
typedef enum {
|
||||
kNtNldsInvalid,
|
||||
kNtNldsTentative,
|
||||
kNtNldsDuplicate,
|
||||
kNtNldsDeprecated,
|
||||
kNtNldsPreferred,
|
||||
kNtIpDadStateInvalid,
|
||||
kNtIpDadStateTentative,
|
||||
kNtIpDadStateDuplicate,
|
||||
kNtIpDadStateDeprecated,
|
||||
kNtIpDadStatePreferred
|
||||
} NtDadState;
|
||||
|
||||
typedef enum {
|
||||
kNtIfOperStatusUp = 1,
|
||||
kNtIfOperStatusDown,
|
||||
kNtIfOperStatusTesting,
|
||||
kNtIfOperStatusUnknown,
|
||||
kNtIfOperStatusDormant,
|
||||
kNtIfOperStatusNotPresent,
|
||||
kNtIfOperStatusLowerLayerDown
|
||||
} NtIfOperStatus;
|
||||
|
||||
typedef enum {
|
||||
kNtNetIfConnectionDedicated = 1,
|
||||
kNtNetIfConnectionPassive = 2,
|
||||
kNtNetIfConnectionDemand = 3,
|
||||
kNtNetIfConnectionMaximum = 4
|
||||
} NtNetIfConnectionType;
|
||||
|
||||
typedef enum {
|
||||
kNtTunnelTypeNone = 0,
|
||||
kNtTunnelTypeOther = 1,
|
||||
kNtTunnelTypeDirect = 2,
|
||||
kNtTunnelType6to4 = 11,
|
||||
kNtTunnelTypeIsatap = 13,
|
||||
kNtTunnelTypeTeredo = 14,
|
||||
kNtTunnelTypeIphttps = 15
|
||||
} NtTunnelType;
|
||||
|
||||
|
||||
/* Inner Types --------------------------------------------------------- */
|
||||
typedef struct _NtIpAdapterUnicastAddress {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t Flags;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterUnicastAddress * Next;
|
||||
struct NtSocketAddress Address;
|
||||
NtPrefixOrigin PrefixOrigin;
|
||||
NtSuffixOrigin SuffixOrigin;
|
||||
NtDadState DadState;
|
||||
uint32_t ValidLifetime;
|
||||
uint32_t PreferredLifetime;
|
||||
uint32_t LeaseLifetime;
|
||||
uint8_t OnLinkPrefixLength;
|
||||
} NtIpAdapterUnicastAddress;
|
||||
|
||||
typedef struct NtIpAdapterAnycastAddress {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t Flags;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterAnycastAddress *Next;
|
||||
struct NtSocketAddress Address;
|
||||
} NtIpAdapterAnycastAddress;
|
||||
|
||||
typedef struct NtIpAdapterMulticastAddress {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t Flags;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterMulticastAddress *Next;
|
||||
struct NtSocketAddress Address;
|
||||
} NtIpAdapterMulticastAddress;
|
||||
|
||||
|
||||
typedef struct _NtIpAdapterDnsServerAddress {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t Reserved;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterDnsServerAddress *Next;
|
||||
struct NtSocketAddress Address;
|
||||
} NtIpAdapterDnsServerAddress;
|
||||
|
||||
typedef struct _NtIpAdapterPrefix {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t Flags;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterPrefix *Next;
|
||||
struct NtSocketAddress Address;
|
||||
uint32_t PrefixLength;
|
||||
} NtIpAdapterPrefix;
|
||||
|
||||
typedef struct _NtIpAdapterWinsServerAddress {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t Reserved;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterWinsServerAddress *Next;
|
||||
struct NtSocketAddress Address;
|
||||
} NtIpAdapterWinsServerAddress;
|
||||
|
||||
typedef struct _NtIpAdapterGatewayAddress {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t Reserved;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterGatewayAddress *Next;
|
||||
struct NtSocketAddress Address;
|
||||
} NtIpAdapterGatewayAddress;
|
||||
|
||||
typedef struct _NtGUID {
|
||||
uint32_t Data1;
|
||||
uint16_t Data2;
|
||||
uint16_t Data3;
|
||||
uint8_t Data4[8];
|
||||
} NtGUID;
|
||||
|
||||
typedef union _NtNetLUID
|
||||
{
|
||||
uint64_t Value;
|
||||
struct
|
||||
{
|
||||
uint64_t Reserved:24;
|
||||
uint64_t NetLuidIndex:24;
|
||||
uint64_t IfType:16;
|
||||
}Info;
|
||||
} NtNetLUID;
|
||||
|
||||
typedef struct _NtIpAdapterDnsSuffix {
|
||||
struct _NtIpAdapterDnsSuffix *Next;
|
||||
uint16_t String[kNtMaxDnsSuffixStringLength];
|
||||
} NtIpAdapterDnsSuffix;
|
||||
|
||||
|
||||
/* Top level ----------------------------------------------------------- */
|
||||
typedef struct _NtIpAdapterAddresses {
|
||||
union {
|
||||
uint64_t Alignment;
|
||||
struct {
|
||||
uint32_t Length;
|
||||
uint32_t IfIndex;
|
||||
};
|
||||
};
|
||||
struct _NtIpAdapterAddresses * Next;
|
||||
char * AdapterName;
|
||||
NtIpAdapterUnicastAddress * FirstUnicastAddress;
|
||||
NtIpAdapterAnycastAddress * FirstAnycastAddress;
|
||||
NtIpAdapterMulticastAddress * FirstMulticastAddress;
|
||||
NtIpAdapterDnsServerAddress * FirstDnsServerAddress;
|
||||
uint16_t * DnsSuffix;
|
||||
uint16_t * Description;
|
||||
uint16_t * FriendlyName;
|
||||
uint8_t PhysicalAddress[kNtMaxAdapterAddressLength];
|
||||
uint32_t PhysicalAddressLength;
|
||||
union {
|
||||
uint32_t Flags;
|
||||
struct {
|
||||
uint32_t DdnsEnabled : 1;
|
||||
uint32_t RegisterAdapterSuffix : 1;
|
||||
uint32_t Dhcpv4Enabled : 1;
|
||||
uint32_t ReceiveOnly : 1;
|
||||
uint32_t NoMulticast : 1;
|
||||
uint32_t Ipv6OtherStatefulConfig : 1;
|
||||
uint32_t NetbiosOverTcpipEnabled : 1;
|
||||
uint32_t Ipv4Enabled : 1;
|
||||
uint32_t Ipv6Enabled : 1;
|
||||
uint32_t Ipv6ManagedAddressConfigurationSupported : 1;
|
||||
};
|
||||
};
|
||||
uint32_t Mtu;
|
||||
uint32_t IfType;
|
||||
NtIfOperStatus OperStatus;
|
||||
uint32_t Ipv6IfIndex;
|
||||
uint32_t ZoneIndices[16];
|
||||
NtIpAdapterPrefix * FirstPrefix;
|
||||
uint64_t TransmitLinkSpeed;
|
||||
uint64_t ReceiveLinkSpeed;
|
||||
NtIpAdapterWinsServerAddress * FirstWinsServerAddress;
|
||||
NtIpAdapterGatewayAddress * FirstGatewayAddress;
|
||||
uint32_t Ipv4Metric;
|
||||
uint32_t Ipv6Metric;
|
||||
NtNetLUID Luid;
|
||||
struct NtSocketAddress Dhcpv4Server;
|
||||
uint32_t CompartmentId;
|
||||
NtGUID NetworkGuid;
|
||||
NtNetIfConnectionType ConnectionType;
|
||||
NtTunnelType TunnelType;
|
||||
struct NtSocketAddress Dhcpv6Server;
|
||||
uint8_t Dhcpv6ClientDuid[kNtMaxDhcpv6DuidLength];
|
||||
uint32_t Dhcpv6ClientDuidLength;
|
||||
uint32_t Dhcpv6Iaid;
|
||||
NtIpAdapterDnsSuffix * FirstDnsSuffix;
|
||||
} NtIpAdapterAddresses;
|
||||
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_STRUCT_IP_ADAPTER_ADDRESSES_H_ */
|
||||
|
|
@ -91,6 +91,17 @@ bool32 TrackPopupMenu(int64_t hMenu, uint32_t uFlags, int32_t x, int32_t y,
|
|||
int32_t nReserved, int64_t hWnd,
|
||||
const struct NtRect *prcRect);
|
||||
|
||||
int WideCharToMultiByte(unsigned int CodePage,
|
||||
uint32_t dwFlags,
|
||||
uint16_t * lpWideCharStr,
|
||||
int cchWideChar,
|
||||
char * lpMultiByteStr,
|
||||
int cbMultiByte,
|
||||
uint16_t * lpDefaultChar,
|
||||
int * lpUsedDefaultChar
|
||||
);
|
||||
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_WINDOWS_H_ */
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
#define kNtSioTranslateHandle 0xC800000Du
|
||||
#define kNtSioUdpConnreset 0x9800000Cu
|
||||
#define kNtSioUdpNetreset 0x9800000Fu
|
||||
#define kNtSioGetInterfaceList 0x4008747fu /* _IOR('t', 127, ULONG) */
|
||||
|
||||
#define kNtNspNotifyImmediately 0
|
||||
#define kNtNspNotifyHwnd 1
|
||||
|
@ -311,6 +312,13 @@ struct NtFdSet {
|
|||
int64_t fd_array[64];
|
||||
};
|
||||
|
||||
struct NtInterfaceInfo {
|
||||
uint64_t iiFlags;
|
||||
struct sockaddr_in iiAddress;
|
||||
struct sockaddr_in iiBroadcastAddress;
|
||||
struct sockaddr_in iiNetmask;
|
||||
};
|
||||
|
||||
/**
|
||||
* Winsock2 prototypes.
|
||||
*
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue