void InitSocketServer(Fd fd, SocketServerFlags flags) { var err = windows ? win_assuan_init_socket_server(Handle, fd, flags) : unix_assuan_init_socket_server(Handle, fd.UnixFd, flags); err.Assert(); }
public void InitPipeServer(Fd input, Fd output) { if (windows) { var filedes = new Fd[] { input, output }; var err = win_assuan_init_pipe_server(Handle, filedes); err.Assert(); } else { var filedes = new int[] { input.UnixFd, output.UnixFd }; var err = unix_assuan_init_pipe_server(Handle, filedes); err.Assert(); } }
public Socket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) { if (windows) { fd = win_assuan_sock_new((int)addressFamily, (int)socketType, (int)protocolType); if (fd == Fd.Invalid) { var err = Marshal.GetLastWin32Error(); throw new ErrorException(ErrorSource.User1, Error.CodeFromErrno(err)); } } else { var ret = unix_assuan_sock_new((int)addressFamily, (int)socketType, (int)protocolType); if (ret == -1) { var err = Marshal.GetLastWin32Error(); throw new ErrorException(ErrorSource.User1, Error.CodeFromErrno(err)); } fd = Fd.FromPosixFd(ret); } }
static extern Error win_assuan_init_socket_server(IntPtr ctx, Fd fd, SocketServerFlags flags);
static extern int win_assuan_sock_close(Fd fd);
Socket(Fd fd) { this.fd = fd; }
static extern Fd win_accept(Fd s, IntPtr addr, IntPtr addrlen);
static extern int win_listen(Fd s, int backlog);
static extern int win_assuan_sock_bind(Fd fd, IntPtr addr, int addrlen);