Files
Linux.js---javascript-OS/rootfs overrides/core/ip.js.bak
T
Marc 721c919c7b ChibraxOS 2
Changes:
- kernel 6.0.2
- Broken init scripts
- Switch to bun for better peroformance an easier ffi
- Removed grup
- Efi support without graphics (at least graphics werent tested)
- Suppression de toutes les dépendance non libc
- new splash
- broken audio
- typescript support
- ls rewritten to be more reliable
2022-10-22 13:47:33 +02:00

53 lines
1.5 KiB
Plaintext

//@ts-check
const flags = {
IFF_UP: 0x1, /* Interface is up. */
IFF_BROADCAST: 0x2, /* Broadcast address valid. */
IFF_DEBUG: 0x4, /* Turn on debugging. */
IFF_LOOPBACK: 0x8, /* Is a loopback net. */
IFF_POINTOPOINT: 0x10, /* Interface is point-to-point link. */
IFF_NOTRAILERS: 0x20, /* Avoid use of trailers. */
IFF_RUNNING: 0x40, /* Resources allocated. */
IFF_NOARP: 0x80, /* No address resolution protocol. */
IFF_PROMISC: 0x100, /* Receive all packets. */
/* Not supported */
IFF_ALLMULTI: 0x200, /* Receive all multicast packets. */
IFF_MASTER: 0x400, /* Master of a load balancer. */
IFF_SLAVE: 0x800, /* Slave of a load balancer. */
IFF_MULTICAST: 0x1000, /* Supports multicast. */
IFF_PORTSEL: 0x2000, /* Can set media type. */
IFF_AUTOMEDIA: 0x4000, /* Auto media select active. */
IFF_DYNAMIC: 0x8000 /* Dialup device with changing addresses. */
}
/**
* @param { string } interface
* @param { number } flags
* @return { number }
*/
function setFlags(interface, flags) {
return ip.setFlags(interface, flags)
}
/**
* @param { string } interface
* @returns { number }
*/
function getFlags(interface) {
return ip.getFlags(interface);
}
/**
* @param { string } interface
* @param { Uint8Array } address
*/
function setIpv4(interface, address) {
if( address.length !== 4) {
throw new Error('invalid address length');
}
ip.setIpv4(interface, address.join('.'));
}
module.exports = { setFlags, getFlags, setIpv4, flags }