Files
Linux.js---javascript-OS/rootfs overrides/core/sockets.js
T
2022-02-17 14:19:08 +01:00

28 lines
1.1 KiB
JavaScript

//@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 }