class CConfig: _compilation_info_ = eci FFI_OK = rffi_platform.ConstantInteger('FFI_OK') FFI_BAD_TYPEDEF = rffi_platform.ConstantInteger('FFI_BAD_TYPEDEF') FFI_DEFAULT_ABI = rffi_platform.ConstantInteger('FFI_DEFAULT_ABI') if _WIN32 and not _WIN64: FFI_STDCALL = rffi_platform.ConstantInteger('FFI_STDCALL') if _ARM: FFI_SYSV = rffi_platform.ConstantInteger('FFI_SYSV') FFI_VFP = rffi_platform.ConstantInteger('FFI_VFP') FFI_TYPE_STRUCT = rffi_platform.ConstantInteger('FFI_TYPE_STRUCT') size_t = rffi_platform.SimpleType("size_t", rffi.ULONG) ffi_abi = rffi_platform.SimpleType("ffi_abi", rffi.USHORT) ffi_arg = rffi_platform.SimpleType("ffi_arg", lltype.Signed) ffi_type = rffi_platform.Struct('ffi_type', [('size', rffi.ULONG), ('alignment', rffi.USHORT), ('type', rffi.USHORT), ('elements', FFI_TYPE_PP)]) ffi_cif = rffi_platform.Struct('ffi_cif', []) ffi_closure = rffi_platform.Struct('ffi_closure', [('user_data', rffi.VOIDP)])
class CConfig: _compilation_info_ = eci calling_conv = 'c' CHECK_LIBRARY = platform.Has('dump("x", (long)&BZ2_bzCompress)') off_t = platform.SimpleType("off_t", rffi.LONGLONG) size_t = platform.SimpleType("size_t", rffi.ULONG) BUFSIZ = platform.ConstantInteger("BUFSIZ") _alloc_type = lltype.FuncType([rffi.VOIDP, rffi.INT, rffi.INT], rffi.VOIDP) _free_type = lltype.FuncType([rffi.VOIDP, rffi.VOIDP], lltype.Void) SEEK_SET = platform.ConstantInteger("SEEK_SET") bz_stream = platform.Struct('bz_stream', [ ('next_in', rffi.CCHARP), ('avail_in', rffi.UINT), ('total_in_lo32', rffi.UINT), ('total_in_hi32', rffi.UINT), ('next_out', rffi.CCHARP), ('avail_out', rffi.UINT), ('total_out_lo32', rffi.UINT), ('total_out_hi32', rffi.UINT), ('state', rffi.VOIDP), ('bzalloc', lltype.Ptr(_alloc_type)), ('bzfree', lltype.Ptr(_free_type)), ('opaque', rffi.VOIDP), ])
class CConfig: _compilation_info_ = ExternalCompilationInfo( includes=includes, #pre_include_bits=['#ifndef _GNU_SOURCE\n' + # '#define _GNU_SOURCE\n' + # '#endif'] # ^^^ _GNU_SOURCE is always defined by the ExternalCompilationInfo now ) size_t = rffi_platform.SimpleType("size_t", rffi.LONG) off_t = rffi_platform.SimpleType("off_t", rffi.LONG)
class SimpleCConfig: """ Definitions for basic types defined by zlib. """ _compilation_info_ = eci # XXX If Z_PREFIX was defined for the libz build, then these types are # named z_uInt, z_uLong, and z_Bytef instead. uInt = rffi_platform.SimpleType('uInt', rffi.UINT) uLong = rffi_platform.SimpleType('uLong', rffi.ULONG) Bytef = rffi_platform.SimpleType('Bytef', rffi.UCHAR) voidpf = rffi_platform.SimpleType('voidpf', rffi.VOIDP) ZLIB_VERSION = rffi_platform.DefinedConstantString('ZLIB_VERSION')
class CConfig: _compilation_info_ = ExternalCompilationInfo(post_include_bits=[ '/* a C comment */', '#define XYZZY 42', 'typedef int foo;', ''' struct s { int i; double f; }; ''' ]) s = rffi_platform.Struct('struct s', [('i', rffi.INT)], ifdef='XYZZY') z = rffi_platform.Struct('struct z', [('i', rffi.INT)], ifdef='FOOBAR') foo = rffi_platform.SimpleType('foo', ifdef='XYZZY') bar = rffi_platform.SimpleType('bar', ifdef='FOOBAR')
class CConfig: _compilation_info_ = ExternalCompilationInfo( includes = _includes ) CLOCKS_PER_SEC = platform.ConstantInteger("CLOCKS_PER_SEC") clock_t = platform.SimpleType("clock_t", rffi.ULONG) has_gettimeofday = platform.Has('gettimeofday')
class CConfig: _compilation_info_ = ExternalCompilationInfo(pre_include_bits=[ "/* a C comment */", "#include <stdio.h>", "#include <test_ctypes_platform.h>" ], include_dirs=[str(udir)]) FILE = rffi_platform.Struct('FILE', []) ushort = rffi_platform.SimpleType('unsigned short') XYZZY = rffi_platform.ConstantInteger('XYZZY')
class CConfig(object): _compilation_info_ = eci off_t = platform.SimpleType('off_t') _IONBF = platform.DefinedConstantInteger('_IONBF') _IOLBF = platform.DefinedConstantInteger('_IOLBF') _IOFBF = platform.DefinedConstantInteger('_IOFBF') BUFSIZ = platform.DefinedConstantInteger('BUFSIZ') EOF = platform.DefinedConstantInteger('EOF')
class CConfig: _compilation_info_ = eci if WIN32: DWORD_PTR = rffi_platform.SimpleType("DWORD_PTR", rffi.LONG) WORD = rffi_platform.SimpleType("WORD", rffi.USHORT) DWORD = rffi_platform.SimpleType("DWORD", rffi.UINT) BOOL = rffi_platform.SimpleType("BOOL", rffi.LONG) BYTE = rffi_platform.SimpleType("BYTE", rffi.UCHAR) WCHAR = rffi_platform.SimpleType("WCHAR", rffi.UCHAR) INT = rffi_platform.SimpleType("INT", rffi.INT) LONG = rffi_platform.SimpleType("LONG", rffi.LONG) PLONG = rffi_platform.SimpleType("PLONG", rffi.LONGP) LPVOID = rffi_platform.SimpleType("LPVOID", rffi.INTP) LPCVOID = rffi_platform.SimpleType("LPCVOID", rffi.VOIDP) LPSTR = rffi_platform.SimpleType("LPSTR", rffi.CCHARP) LPCSTR = rffi_platform.SimpleType("LPCSTR", rffi.CCHARP) LPWSTR = rffi_platform.SimpleType("LPWSTR", rffi.CWCHARP) LPCWSTR = rffi_platform.SimpleType("LPCWSTR", rffi.CWCHARP) LPDWORD = rffi_platform.SimpleType("LPDWORD", rffi.UINTP) LPWORD = rffi_platform.SimpleType("LPWORD", rffi.USHORTP) LPBOOL = rffi_platform.SimpleType("LPBOOL", rffi.LONGP) LPBYTE = rffi_platform.SimpleType("LPBYTE", rffi.UCHARP) SIZE_T = rffi_platform.SimpleType("SIZE_T", rffi.SIZE_T) ULONG_PTR = rffi_platform.SimpleType("ULONG_PTR", rffi.ULONG) HRESULT = rffi_platform.SimpleType("HRESULT", rffi.LONG) HLOCAL = rffi_platform.SimpleType("HLOCAL", rffi.VOIDP) FILETIME = rffi_platform.Struct('FILETIME', [('dwLowDateTime', rffi.UINT), ('dwHighDateTime', rffi.UINT)]) SYSTEMTIME = rffi_platform.Struct('SYSTEMTIME', []) Struct = rffi_platform.Struct COORD = Struct("COORD", [("X", rffi.SHORT), ("Y", rffi.SHORT)]) SMALL_RECT = Struct("SMALL_RECT", [("Left", rffi.SHORT), ("Top", rffi.SHORT), ("Right", rffi.SHORT), ("Bottom", rffi.SHORT)]) CONSOLE_SCREEN_BUFFER_INFO = Struct("CONSOLE_SCREEN_BUFFER_INFO", [("dwSize", COORD), ("dwCursorPosition", COORD), ("wAttributes", WORD.ctype_hint), ("srWindow", SMALL_RECT), ("dwMaximumWindowSize", COORD)]) OSVERSIONINFOEX = rffi_platform.Struct('OSVERSIONINFOEX', [ ('dwOSVersionInfoSize', rffi.UINT), ('dwMajorVersion', rffi.UINT), ('dwMinorVersion', rffi.UINT), ('dwBuildNumber', rffi.UINT), ('dwPlatformId', rffi.UINT), ('szCSDVersion', rffi.CFixedArray(lltype.Char, 1)), ('wServicePackMajor', rffi.USHORT), ('wServicePackMinor', rffi.USHORT), ('wSuiteMask', rffi.USHORT), ('wProductType', rffi.UCHAR), ]) LPSECURITY_ATTRIBUTES = rffi_platform.SimpleType( "LPSECURITY_ATTRIBUTES", rffi.CCHARP) DEFAULT_LANGUAGE = rffi_platform.ConstantInteger( "MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)") defines = """FORMAT_MESSAGE_ALLOCATE_BUFFER FORMAT_MESSAGE_FROM_SYSTEM MAX_PATH _MAX_ENV FORMAT_MESSAGE_IGNORE_INSERTS WAIT_OBJECT_0 WAIT_TIMEOUT INFINITE ERROR_INVALID_HANDLE DELETE READ_CONTROL SYNCHRONIZE WRITE_DAC WRITE_OWNER PROCESS_ALL_ACCESS PROCESS_CREATE_PROCESS PROCESS_CREATE_THREAD PROCESS_DUP_HANDLE PROCESS_QUERY_INFORMATION PROCESS_SET_QUOTA PROCESS_SUSPEND_RESUME PROCESS_TERMINATE PROCESS_VM_OPERATION PROCESS_VM_READ PROCESS_VM_WRITE CTRL_C_EVENT CTRL_BREAK_EVENT MB_ERR_INVALID_CHARS ERROR_NO_UNICODE_TRANSLATION WC_NO_BEST_FIT_CHARS STD_INPUT_HANDLE STD_OUTPUT_HANDLE STD_ERROR_HANDLE HANDLE_FLAG_INHERIT FILE_TYPE_CHAR LOAD_WITH_ALTERED_SEARCH_PATH CT_CTYPE3 C3_HIGHSURROGATE CP_ACP CP_UTF8 CP_UTF7 CP_OEMCP MB_ERR_INVALID_CHARS """ from rpython.translator.platform import host_factory static_platform = host_factory() if static_platform.name == 'msvc': defines += ' PROCESS_QUERY_LIMITED_INFORMATION' for name in defines.split(): locals()[name] = rffi_platform.ConstantInteger(name)
class CConfig: _compilation_info_ = eci if WIN32: DWORD_PTR = rffi_platform.SimpleType("DWORD_PTR", rffi.LONG) WORD = rffi_platform.SimpleType("WORD", rffi.UINT) DWORD = rffi_platform.SimpleType("DWORD", rffi.UINT) BOOL = rffi_platform.SimpleType("BOOL", rffi.LONG) BYTE = rffi_platform.SimpleType("BYTE", rffi.UCHAR) WCHAR = rffi_platform.SimpleType("WCHAR", rffi.UCHAR) INT = rffi_platform.SimpleType("INT", rffi.INT) LONG = rffi_platform.SimpleType("LONG", rffi.LONG) PLONG = rffi_platform.SimpleType("PLONG", rffi.LONGP) LPVOID = rffi_platform.SimpleType("LPVOID", rffi.INTP) LPCVOID = rffi_platform.SimpleType("LPCVOID", rffi.VOIDP) LPSTR = rffi_platform.SimpleType("LPSTR", rffi.CCHARP) LPCSTR = rffi_platform.SimpleType("LPCSTR", rffi.CCHARP) LPWSTR = rffi_platform.SimpleType("LPWSTR", rffi.CWCHARP) LPCWSTR = rffi_platform.SimpleType("LPCWSTR", rffi.CWCHARP) LPDWORD = rffi_platform.SimpleType("LPDWORD", rffi.UINTP) SIZE_T = rffi_platform.SimpleType("SIZE_T", rffi.SIZE_T) ULONG_PTR = rffi_platform.SimpleType("ULONG_PTR", rffi.ULONG) HRESULT = rffi_platform.SimpleType("HRESULT", rffi.LONG) HLOCAL = rffi_platform.SimpleType("HLOCAL", rffi.VOIDP) FILETIME = rffi_platform.Struct('FILETIME', [('dwLowDateTime', rffi.UINT), ('dwHighDateTime', rffi.UINT)]) SYSTEMTIME = rffi_platform.Struct('SYSTEMTIME', []) OSVERSIONINFOEX = rffi_platform.Struct( 'OSVERSIONINFOEX', [('dwOSVersionInfoSize', rffi.UINT), ('dwMajorVersion', rffi.UINT), ('dwMinorVersion', rffi.UINT), ('dwBuildNumber', rffi.UINT), ('dwPlatformId', rffi.UINT), ('szCSDVersion', rffi.CFixedArray(lltype.Char, 1)), ('wServicePackMajor', rffi.USHORT), ('wServicePackMinor', rffi.USHORT), ('wSuiteMask', rffi.USHORT), ('wProductType', rffi.UCHAR), ]) LPSECURITY_ATTRIBUTES = rffi_platform.SimpleType( "LPSECURITY_ATTRIBUTES", rffi.CCHARP) DEFAULT_LANGUAGE = rffi_platform.ConstantInteger( "MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)") defines = """FORMAT_MESSAGE_ALLOCATE_BUFFER FORMAT_MESSAGE_FROM_SYSTEM MAX_PATH _MAX_ENV FORMAT_MESSAGE_IGNORE_INSERTS WAIT_OBJECT_0 WAIT_TIMEOUT INFINITE ERROR_INVALID_HANDLE DELETE READ_CONTROL SYNCHRONIZE WRITE_DAC WRITE_OWNER PROCESS_ALL_ACCESS PROCESS_CREATE_PROCESS PROCESS_CREATE_THREAD PROCESS_DUP_HANDLE PROCESS_QUERY_INFORMATION PROCESS_SET_QUOTA PROCESS_SUSPEND_RESUME PROCESS_TERMINATE PROCESS_VM_OPERATION PROCESS_VM_READ PROCESS_VM_WRITE CTRL_C_EVENT CTRL_BREAK_EVENT MB_ERR_INVALID_CHARS ERROR_NO_UNICODE_TRANSLATION WC_NO_BEST_FIT_CHARS """ from rpython.translator.platform import host_factory static_platform = host_factory() if static_platform.name == 'msvc': defines += ' PROCESS_QUERY_LIMITED_INFORMATION' for name in defines.split(): locals()[name] = rffi_platform.ConstantInteger(name)
class CConfig: _compilation_info_ = eci uid_t = rffi_platform.SimpleType("uid_t") gid_t = rffi_platform.SimpleType("gid_t")
class CConfig: _compilation_info_ = eci size_t = rffi_platform.SimpleType("size_t", rffi.ULONG) emjs_handle = rffi_platform.SimpleType("emjs_handle", rffi.LONG) emjs_type = rffi_platform.SimpleType("emjs_type", rffi.LONG)
class CConfig: _compilation_info_ = eci timespec_t = rffi_platform.Struct("uv_timespec_t", [ ("tv_sec", rffi.LONG), ("tv_nsec", rffi.LONG)]) stat_t = rffi_platform.Struct("uv_stat_t", [ ("st_dev", uint64_t ), ("st_mode", uint64_t ), ("st_nlink", uint64_t ), ("st_uid", uint64_t ), ("st_gid", uint64_t ), ("st_rdev", uint64_t ), ("st_ino", uint64_t ), ("st_size", uint64_t ), ("st_blksize", uint64_t ), ("st_blocks", uint64_t ), ("st_flags", uint64_t ), ("st_gen", uint64_t ), ("st_atim", timespec_t), ("st_mtim", timespec_t), ("st_ctim", timespec_t), ("st_birthtim", timespec_t)]) #dirent_type_t = rffi_platform.SimpleType("uv_dirent_type_t", rffi.INT) dirent_t = rffi_platform.Struct("uv_dirent_t", [ ("name", rffi.CCHARP), ("type", rffi.INT)]) sockaddr = rffi_platform.Struct("struct sockaddr", [ ("sa_family", rffi.USHORT)]) handle_t = rffi_platform.Struct("uv_handle_t", [("data", rffi.VOIDP)]) stream_t = rffi_platform.Struct("uv_stream_t", [("data", rffi.VOIDP)]) tcp_t = rffi_platform.Struct("uv_tcp_t", [("data", rffi.VOIDP)]) udp_t = rffi_platform.Struct("uv_udp_t", [("data", rffi.VOIDP)]) pipe_t = rffi_platform.Struct("uv_pipe_t", [("data", rffi.VOIDP)]) tty_t = rffi_platform.Struct("uv_tty_t", [("data", rffi.VOIDP)]) poll_t = rffi_platform.Struct("uv_poll_t", [("data", rffi.VOIDP)]) timer_t = rffi_platform.Struct("uv_timer_t", [("data", rffi.VOIDP)]) prepare_t = rffi_platform.Struct("uv_prepare_t", [("data", rffi.VOIDP)]) check_t = rffi_platform.Struct("uv_check_t", [("data", rffi.VOIDP)]) idle_t = rffi_platform.Struct("uv_idle_t", [("data", rffi.VOIDP)]) async_t = rffi_platform.Struct("uv_async_t", [("data", rffi.VOIDP)]) process_t = rffi_platform.Struct("uv_process_t", [ ("data", rffi.VOIDP), ("pid", rffi.INT)]) uid_t = rffi_platform.SimpleType("uv_uid_t", rffi.ULONG) gid_t = rffi_platform.SimpleType("uv_gid_t", rffi.ULONG) # the rffi of rpython doesn't seem to support unions. stdio_container_t = rffi_platform.Struct("uv_stdio_container_t", [ ("flags", stdio_flags)]) #loop_t = rffi_platform.Struct("uv_loop_t", [("data", rffi.VOIDP)]) process_options_t = rffi_platform.Struct("uv_process_options_t", [ ("exit_cb", exit_cb), ("file", rffi.CCHARP), ("args", rffi.CCHARPP), ("env", rffi.CCHARPP), ("cwd", rffi.CCHARP), ("flags", rffi.UINT), ("stdio_count", rffi.INT), ("stdio", lltype.Ptr(lltype.ForwardReference())), ("uid", rffi.ULONG), ("gid", rffi.ULONG)]) connect_t = rffi_platform.Struct("uv_connect_t", [("data", rffi.VOIDP)]) udp_send_t = rffi_platform.Struct("uv_udp_send_t", [("data", rffi.VOIDP)]) # [("handle", # lltype.Ptr(lltype.ForwardReference()))]) #shutdown_t = rffi_platform.Struct("uv_shutdown_t", []) fs_event_t = rffi_platform.Struct("uv_fs_event_t", [("data", rffi.VOIDP)]) fs_poll_t = rffi_platform.Struct("uv_fs_poll_t", [("data", rffi.VOIDP)]) signal_t = rffi_platform.Struct("uv_signal_t", [("data", rffi.VOIDP)]) shutdown_t = rffi_platform.Struct("uv_shutdown_t", [("data", rffi.VOIDP)]) write_t = rffi_platform.Struct("uv_write_t", [("data", rffi.VOIDP)]) fs_t = rffi_platform.Struct("uv_fs_t", [ ("data", rffi.VOIDP), ("path", rffi.CONST_CCHARP), ("result", rffi.SSIZE_T), ("statbuf", stat_t), ("ptr", rffi.VOIDP)]) uv_getaddrinfo_t = rffi_platform.Struct("uv_getaddrinfo_t", [("data", rffi.VOIDP)]) uv_getnameinfo_t = rffi_platform.Struct("uv_getnameinfo_t", [("data", rffi.VOIDP)]) buf_t = rffi_platform.Struct("uv_buf_t", [ ("base", rffi.CCHARP), ("len", rffi.SIZE_T)]) sockaddr_storage = rffi_platform.Struct("struct sockaddr_storage", []) addrinfo = rffi_platform.Struct("struct addrinfo", [ ("ai_flags", rffi.INT), ("ai_family", rffi.INT), ("ai_socktype", rffi.INT), ("ai_protocol", rffi.INT), ("ai_addrlen", rffi.SIZE_T), ("ai_addr", rffi.VOIDP), # struct sockaddr* ("ai_canonname", rffi.CCHARP), ("ai_next", rffi.VOIDP), ]) UV_EOF = rffi_platform.ConstantInteger("UV_EOF") UV_ECANCELED = rffi_platform.ConstantInteger("UV_ECANCELED") AF_UNSPEC = rffi_platform.ConstantInteger("AF_UNSPEC") AF_INET = rffi_platform.ConstantInteger("AF_INET") AF_INET6 = rffi_platform.ConstantInteger("AF_INET6") SOCK_STREAM = rffi_platform.ConstantInteger("SOCK_STREAM") SOCK_DGRAM = rffi_platform.ConstantInteger("SOCK_DGRAM") AI_V4MAPPED = rffi_platform.ConstantInteger("AI_V4MAPPED") AI_ADDRCONFIG = rffi_platform.ConstantInteger("AI_ADDRCONFIG") AI_NUMERICHOST = rffi_platform.ConstantInteger("AI_NUMERICHOST") AI_PASSIVE = rffi_platform.ConstantInteger("AI_PASSIVE") #TCP_IPV6ONLY = rffi_platform.ConstantInteger("TCP_IPV6ONLY") AI_NUMERICHOST = rffi_platform.ConstantInteger("AI_NUMERICHOST") AI_PASSIVE = rffi_platform.ConstantInteger("AI_PASSIVE") INADDR_ANY = rffi_platform.ConstantInteger("INADDR_ANY") #IN6ADDR_ANY_INIT = rffi_platform.ConstantInteger("IN6ADDR_ANY_INIT") INADDR_LOOPBACK = rffi_platform.ConstantInteger("INADDR_LOOPBACK") #IN6ADDR_LOOPBACK_INIT = rffi_platform.ConstantInteger("IN6ADDR_LOOPBACK_INIT") AI_NUMERICSERV = rffi_platform.ConstantInteger("AI_NUMERICSERV") AI_CANONNAME = rffi_platform.ConstantInteger("AI_CANONNAME") NI_NAMEREQD = rffi_platform.ConstantInteger("NI_NAMEREQD") NI_DGRAM = rffi_platform.ConstantInteger("NI_DGRAM") NI_NOFQDN = rffi_platform.ConstantInteger("NI_NOFQDN") NI_NUMERICHOST = rffi_platform.ConstantInteger("NI_NUMERICHOST") NI_NUMERICSERV = rffi_platform.ConstantInteger("NI_NUMERICSERV") # TODO: decide what to do for these (more below). #NI_IDN = rffi_platform.ConstantInteger("NI_IDN") #NI_IDN_ALLOW_UNASSIGNED = rffi_platform.ConstantInteger("NI_IDN_ALLOW_UNASSIGNED") #NI_IDN_USE_STD3_ASCII_RULES = rffi_platform.ConstantInteger("NI_IDN_USE_STD3_ASCII_RULES") #AI_IDN = rffi_platform.ConstantInteger("AI_IDN") #AI_CANONIDN = rffi_platform.ConstantInteger("AI_CANONIDN") #AI_IDN_ALLOW_UNASSIGNED = rffi_platform.ConstantInteger("AI_IDN_ALLOW_UNASSIGNED") #AI_IDN_USE_STD3_ASCII_RULES = rffi_platform.ConstantInteger("AI_IDN_USE_STD3_ASCII_RULES") INET6_ADDRSTRLEN = rffi_platform.ConstantInteger("INET6_ADDRSTRLEN") # Add _ in front if these aren't on the Win32 O_RDONLY = rffi_platform.ConstantInteger("O_RDONLY") O_WRONLY = rffi_platform.ConstantInteger("O_WRONLY") O_RDWR = rffi_platform.ConstantInteger("O_RDWR") O_APPEND = rffi_platform.ConstantInteger("O_APPEND") O_CREAT = rffi_platform.ConstantInteger("O_CREAT") O_EXCL = rffi_platform.ConstantInteger("O_EXCL") O_TRUNC = rffi_platform.ConstantInteger("O_TRUNC") for name in error_names: locals()[name] = rffi_platform.ConstantInteger("UV_"+name)
('POLLPRI', 2), ('POLLOUT', 4), ('POLLERR', 8), ('POLLHUP', 16), ('FD_SETSIZE', 64), ] for name, default in constants_w_defaults: setattr(CConfig, name, platform.DefinedConstantInteger(name)) # types if _MSVC: socketfd_type = rffi.UINT else: socketfd_type = rffi.INT CConfig.uint16_t = platform.SimpleType('uint16_t', rffi.USHORT) CConfig.uint32_t = platform.SimpleType('uint32_t', rffi.UINT) CConfig.size_t = platform.SimpleType('size_t', rffi.INT) CConfig.ssize_t = platform.SimpleType('ssize_t', rffi.INT) CConfig.socklen_t = platform.SimpleType('socklen_t', rffi.INT) sockaddr_ptr = lltype.Ptr(lltype.ForwardReference()) addrinfo_ptr = lltype.Ptr(lltype.ForwardReference()) # struct types CConfig.sockaddr = platform.Struct( 'struct sockaddr', [('sa_family', rffi.INT), ('sa_data', rffi.CFixedArray(rffi.CHAR, 1))]) CConfig.in_addr = platform.Struct('struct in_addr', [('s_addr', rffi.UINT)]) CConfig.in6_addr = platform.Struct( 'struct in6_addr', [('s6_addr', rffi.CFixedArray(rffi.CHAR, 16))]) CConfig.sockaddr_in = platform.Struct('struct sockaddr_in',