support de l'alumage des interface reseau
This commit is contained in:
@@ -12,26 +12,6 @@ async function main() {
|
||||
const { fHook } = require("./hook.js")
|
||||
|
||||
console.clear()
|
||||
console.log(`
|
||||
_______ _________ ______ _______ _______
|
||||
( ____ \\|\\ /|\\__ __/( ___ \\ ( ____ )( ___ )|\\ /|
|
||||
| ( \\/| ) ( | ) ( | ( ) )| ( )|| ( ) |( \\ / )
|
||||
| | | (___) | | | | (__/ / | (____)|| (___) | \\ (_) /
|
||||
| | | ___ | | | | __ ( | __)| ___ | ) _ (
|
||||
| | | ( ) | | | | ( \\ \\ | (\\ ( | ( ) | / ( ) \\
|
||||
| (____/\\| ) ( |___) (___| )___) )| ) \\ \\__| ) ( |( / \\ )
|
||||
(_______/|/ \\|\\_______/|/ \\___/ |/ \\__/|/ \\||/ \\|
|
||||
|
||||
_______ _______
|
||||
( ___ )( ____ \\
|
||||
| ( ) || ( \\/
|
||||
| | | || (_____
|
||||
| | | |(_____ )
|
||||
| | | | ) |
|
||||
| (___) |/\\____) |
|
||||
(_______)\\_______)
|
||||
|
||||
`)
|
||||
|
||||
await initd()
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
//@ts-check
|
||||
//@ts-expect-error
|
||||
const { ioctl } = require('./ioctl.node')
|
||||
|
||||
|
||||
module.exports = { ioctl }
|
||||
@@ -0,0 +1,35 @@
|
||||
//@ts-check
|
||||
|
||||
//@ts-expect-error
|
||||
const ip = require('./ip.node')
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
module.exports = { setFlags, flags }
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
//@ts-check
|
||||
//@ts-expect-error
|
||||
const csocket = require('./socket.node')
|
||||
|
||||
/**
|
||||
* @param { number } domain
|
||||
* @param { number } type
|
||||
* @param { number } protocol
|
||||
* @return { number }
|
||||
*/
|
||||
function socket(domain, type, protocol) {
|
||||
return csocket.socket(domain, type, protocol)
|
||||
}
|
||||
|
||||
const socketTypes = {
|
||||
SOCK_DGRAM : 1, /* Connectionless, unreliable datagrams of fixed maximum length. */
|
||||
SOCK_STREAM : 2, /* Sequenced, reliable, connection-based byte streams. */
|
||||
SOCK_RAW : 3, /* Raw protocol interface. */
|
||||
SOCK_RDM : 4, /* Reliably-delivered messages. */
|
||||
SOCK_SEQPACKET : 5, /* Sequenced, reliable, connection-based, datagrams of fixed maximum length. */
|
||||
SOCK_DCCP : 6, /* Datagram Congestion Control Protocol. */
|
||||
SOCK_PACKET : 10, /* Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level. */
|
||||
|
||||
SOCK_CLOEXEC : 0o2000000, /* Atomically set close-on-exec flag for the new descriptor(s). */
|
||||
SOCK_NONBLOCK : 0o0000200 /* Atomically mark descriptor(s) as non-blocking. */
|
||||
}
|
||||
|
||||
module.exports = { socketTypes, socket }
|
||||
@@ -0,0 +1,15 @@
|
||||
const ip = require('../../chibrax/ip')
|
||||
//async is optional but recomended for optimisation (optimisations are yet to be implemented)
|
||||
async function init() {
|
||||
ip.setFlags('lo', ip.flags.IFF_UP | ip.flags.IFF_LOOPBACK | ip.flags.IFF_RUNNING)
|
||||
}
|
||||
|
||||
const after = ['filesystem.js'] // list of init script to load before
|
||||
const before = []
|
||||
|
||||
module.exports = {
|
||||
init,
|
||||
after,
|
||||
before
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user