Example #1
0
 private static error setDefaultListenerSockopts(syscall.Handle s)
 {
     // Windows will reuse recently-used addresses by default.
     // SO_REUSEADDR should not be used here, as it allows
     // a socket to forcibly bind to a port in use by another socket.
     // This could lead to a non-deterministic behavior, where
     // connection requests over the port cannot be guaranteed
     // to be handled by the correct socket.
     return(error.As(null !) !);
 }
Example #2
0
 private static error setDefaultSockopts(syscall.Handle s, long family, long sotype, bool ipv6only)
 {
     if (family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW)
     {
         // Allow both IP versions even if the OS default
         // is otherwise. Note that some operating systems
         // never admit this option.
         syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only));
     }
     if ((sotype == syscall.SOCK_DGRAM || sotype == syscall.SOCK_RAW) && family != syscall.AF_UNIX && family != syscall.AF_INET6)
     {
         // Allow broadcast.
         return(error.As(os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1L))) !);
     }
     return(error.As(null !) !);
 }
Example #3
0
 public FD(fdMutex fdmu = default, syscall.Handle Sysfd = default, operation rop = default, operation wop = default, pollDesc pd = default, sync.Mutex l = default, slice <byte> lastbits = default, slice <ushort> readuint16 = default, slice <byte> readbyte = default, long readbyteOffset = default, uint csema = default, bool skipSyncNotif = default, bool IsStream = default, bool ZeroReadIsEOF = default, bool isFile = default, fileKind kind = default)
 {
     this.fdmu           = fdmu;
     this.Sysfd          = Sysfd;
     this.rop            = rop;
     this.wop            = wop;
     this.pd             = pd;
     this.l              = l;
     this.lastbits       = lastbits;
     this.readuint16     = readuint16;
     this.readbyte       = readbyte;
     this.readbyteOffset = readbyteOffset;
     this.csema          = csema;
     this.skipSyncNotif  = skipSyncNotif;
     this.IsStream       = IsStream;
     this.ZeroReadIsEOF  = ZeroReadIsEOF;
     this.isFile         = isFile;
     this.kind           = kind;
 }
Example #4
0
 // SendFile wraps the TransmitFile call.
 public static (long, error) SendFile(ptr <FD> _addr_fd, syscall.Handle src, long n) => func((defer, _, __) =>
Example #5
0
 private static (@string, error) getModuleFileName(syscall.Handle handle)
 {
     @string _p0 = default;
     error   _p0 = default !;
Example #6
0
 private static (syscall.Handle, error) sysSocket(long family, long sotype, long proto)
 {
     syscall.Handle _p0 = default;
     error          _p0 = default !;
Example #7
0
 // newFileStatFromGetFileInformationByHandle calls GetFileInformationByHandle
 // to gather all required information about the file handle h.
 private static (ptr <fileStat>, error) newFileStatFromGetFileInformationByHandle(@string path, syscall.Handle h)
 {
     ptr <fileStat> fs  = default !;
Example #8
0
 public rngReader(int used = default, syscall.Handle prov = default, sync.Mutex mu = default)
 {
     this.used = used;
     this.prov = prov;
     this.mu   = mu;
 }
Example #9
0
 private static error setDefaultMulticastSockopts(syscall.Handle s)
 {
     // Allow multicast UDP and raw IP datagram sockets to listen
     // concurrently across multiple listeners.
     return(error.As(os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1L))) !);
 }
Example #10
0
 private static ptr <Status> sockso(this ptr <Switch> _addr_sw, syscall.Handle s) => func((defer, _, __) =>
Example #11
0
 private static error regCreateKeyEx(syscall.Handle key, ptr <ushort> _addr_subkey, uint reserved, ptr <ushort> _addr_@class, uint options, uint desired, ptr <syscall.SecurityAttributes> _addr_sa, ptr <syscall.Handle> _addr_result, ptr <uint> _addr_disposition)
Example #12
0
 public operation(syscall.Overlapped o = default, System.UIntPtr runtimeCtx = default, int mode = default, int errno = default, uint qty = default, ref ptr <FD> fd = default, syscall.WSABuf buf = default, windows.WSAMsg msg = default, syscall.Sockaddr sa = default, ref ptr <syscall.RawSockaddrAny> rsa = default, int rsan = default, syscall.Handle handle = default, uint flags = default, slice <syscall.WSABuf> bufs = default)
 {
     this.o          = o;
     this.runtimeCtx = runtimeCtx;
     this.mode       = mode;
     this.errno      = errno;
     this.qty        = qty;
     this.fd         = fd;
     this.buf        = buf;
     this.msg        = msg;
     this.sa         = sa;
     this.rsa        = rsa;
     this.rsan       = rsan;
     this.handle     = handle;
     this.flags      = flags;
     this.bufs       = bufs;
 }
Example #13
0
 private static (ptr <netFD>, error) newFD(syscall.Handle sysfd, long family, long sotype, @string net)
 {
     ptr <netFD> _p0 = default !;