class CConfig: _compilation_info_ = eci PCRE_DOTALL = platform.DefinedConstantInteger("PCRE_DOTALL") PCRE_MULTILINE = platform.DefinedConstantInteger("PCRE_MULTILINE") PCRE_INFO_CAPTURECOUNT = platform.DefinedConstantInteger("PCRE_INFO_CAPTURECOUNT") PCRE_ANCHORED = platform.DefinedConstantInteger("PCRE_ANCHORED") PCRE_ERROR_NOMATCH = platform.DefinedConstantInteger("PCRE_ERROR_NOMATCH")
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 NCCS = rffi_platform.DefinedConstantInteger('NCCS') _HAVE_STRUCT_TERMIOS_C_ISPEED = rffi_platform.Defined( '_HAVE_STRUCT_TERMIOS_C_ISPEED') _HAVE_STRUCT_TERMIOS_C_OSPEED = rffi_platform.Defined( '_HAVE_STRUCT_TERMIOS_C_OSPEED')
class CConfig: _compilation_info_ = ExternalCompilationInfo( includes=["time.h"], libraries=libraries, ) HAS_CLOCK_GETTIME = rffi_platform.Has('clock_gettime') CLOCK_REALTIME = rffi_platform.DefinedConstantInteger("CLOCK_REALTIME") CLOCK_MONOTONIC = rffi_platform.DefinedConstantInteger("CLOCK_MONOTONIC") CLOCK_MONOTONIC_RAW = rffi_platform.DefinedConstantInteger( "CLOCK_MONOTONIC_RAW") CLOCK_PROCESS_CPUTIME_ID = rffi_platform.DefinedConstantInteger( "CLOCK_PROCESS_CPUTIME_ID") CLOCK_THREAD_CPUTIME_ID = rffi_platform.DefinedConstantInteger( "CLOCK_THREAD_CPUTIME_ID")
class CConfig: _compilation_info_ = eci xmlSAXHandler = platform.Struct("struct _xmlSAXHandler", \ [("characters", charactersSAXFuncP), ("initialized", rffi.UINT), \ ("startElementNs", startElementNsSAX2FuncP), \ ("endElementNs", endElementNsSAX2FuncP)]) XML_SAX2_MAGIC = platform.DefinedConstantInteger("XML_SAX2_MAGIC")
class CConfig: _compilation_info_ = eci TIMEVAL = platform.Struct("struct timeval", [("tv_sec", rffi.LONG), ("tv_usec", rffi.LONG)]) TIMEZONE = platform.Struct("struct timezone", []) TIMESPEC = platform.Struct("struct timespec", [("tv_sec", rffi.TIME_T), ("tv_nsec", rffi.LONG)]) CLOCK_MONOTONIC = platform.DefinedConstantInteger("CLOCK_MONOTONIC")
class CConfig: _compilation_info_ = eci TIMEVAL = platform.Struct('struct timeval', [('tv_sec', rffi.LONG), ('tv_usec', rffi.LONG)]) TIMESPEC = platform.Struct('struct timespec', [('tv_sec', rffi.TIME_T), ('tv_nsec', rffi.LONG)]) SEM_FAILED = platform.ConstantInteger('SEM_FAILED') SEM_VALUE_MAX = platform.DefinedConstantInteger('SEM_VALUE_MAX') SEM_TIMED_WAIT = platform.Has('sem_timedwait') SEM_T_SIZE = platform.SizeOf('sem_t')
class CConfig: _compilation_info_ = eci RTLD_LOCAL = rffi_platform.DefinedConstantInteger('RTLD_LOCAL') RTLD_GLOBAL = rffi_platform.DefinedConstantInteger('RTLD_GLOBAL') RTLD_NOW = rffi_platform.DefinedConstantInteger('RTLD_NOW') RTLD_LAZY = rffi_platform.DefinedConstantInteger('RTLD_LAZY') RTLD_NODELETE = rffi_platform.DefinedConstantInteger('RTLD_NODELETE') RTLD_NOLOAD = rffi_platform.DefinedConstantInteger('RTLD_NOLOAD') RTLD_DEEPBIND = rffi_platform.DefinedConstantInteger('RTLD_DEEPBIND')
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') ZLIB_VERNUM = rffi_platform.DefinedConstantInteger('ZLIB_VERNUM')
class CConfig(object): _compilation_info_ = info pollitem_t = rffi_platform.Struct('zmq_pollitem_t', [('socket', rffi.VOIDP), ('fd', rffi.INT), ('events', rffi.SHORT), ('revents', rffi.SHORT)]) REP = rffi_platform.DefinedConstantInteger('ZMQ_REP') ROUTER = rffi_platform.DefinedConstantInteger('ZMQ_ROUTER') PUB = rffi_platform.DefinedConstantInteger('ZMQ_PUB') RCVMORE = rffi_platform.DefinedConstantInteger('ZMQ_RCVMORE') SNDMORE = rffi_platform.DefinedConstantInteger('ZMQ_SNDMORE') POLLIN = rffi_platform.DefinedConstantInteger('ZMQ_POLLIN')
class CConfig: _compilation_info_ = eci RPYTHREAD_NAME = rffi_platform.DefinedConstantString('RPYTHREAD_NAME') USE_SEMAPHORES = rffi_platform.Defined('USE_SEMAPHORES') CS_GNU_LIBPTHREAD_VERSION = rffi_platform.DefinedConstantInteger( '_CS_GNU_LIBPTHREAD_VERSION')
class CConfig: _compilation_info_ = eci BZ_OK = platform.DefinedConstantInteger('BZ_OK') BZ_STREAM_END = platform.DefinedConstantInteger('BZ_STREAM_END')
REG_OPTION_VOLATILE REG_OPTION_CREATE_LINK REG_OPTION_BACKUP_RESTORE REG_OPTION_OPEN_LINK REG_LEGAL_OPTION REG_CREATED_NEW_KEY REG_OPENED_EXISTING_KEY REG_WHOLE_HIVE_VOLATILE REG_REFRESH_HIVE REG_NO_LAZY_FLUSH REG_NOTIFY_CHANGE_NAME REG_NOTIFY_CHANGE_ATTRIBUTES REG_NOTIFY_CHANGE_LAST_SET REG_NOTIFY_CHANGE_SECURITY REG_LEGAL_CHANGE_FILTER REG_NONE REG_SZ REG_EXPAND_SZ REG_BINARY REG_DWORD REG_DWORD_LITTLE_ENDIAN REG_DWORD_BIG_ENDIAN REG_LINK REG_MULTI_SZ REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR REG_RESOURCE_REQUIREMENTS_LIST HKEY_LOCAL_MACHINE HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_DYN_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA HKEY_USERS ERROR_MORE_DATA '''.split() for name in constant_names: setattr(CConfig, name, platform.DefinedConstantInteger(name)) constants = {} cConfig = platform.configure(CConfig) constants.update(cConfig) globals().update(cConfig) def external(name, args, result, **kwds): return rffi.llexternal(name, args, result, compilation_info=eci, calling_conv='win', **kwds)
constants = {} if _POSIX: # constants, look in sys/mman.h and platform docs for the meaning # some constants are linux only so they will be correctly exposed outside # depending on the OS constant_names = ['MAP_SHARED', 'MAP_PRIVATE', 'MAP_FIXED', 'PROT_READ', 'PROT_WRITE', 'MS_SYNC'] opt_constant_names = ['MAP_ANON', 'MAP_ANONYMOUS', 'MAP_NORESERVE', 'PROT_EXEC', 'MAP_DENYWRITE', 'MAP_EXECUTABLE'] for name in constant_names: setattr(CConfig, name, rffi_platform.ConstantInteger(name)) for name in opt_constant_names: setattr(CConfig, name, rffi_platform.DefinedConstantInteger(name)) CConfig.MREMAP_MAYMOVE = ( rffi_platform.DefinedConstantInteger("MREMAP_MAYMOVE")) CConfig.has_mremap = rffi_platform.Has('mremap(NULL, 0, 0, 0)') # a dirty hack, this is probably a macro elif _MS_WINDOWS: constant_names = ['PAGE_READONLY', 'PAGE_READWRITE', 'PAGE_WRITECOPY', 'FILE_MAP_READ', 'FILE_MAP_WRITE', 'FILE_MAP_COPY', 'DUPLICATE_SAME_ACCESS', 'MEM_COMMIT', 'MEM_RESERVE', 'MEM_RELEASE', 'PAGE_EXECUTE_READWRITE', 'PAGE_NOACCESS'] for name in constant_names: setattr(CConfig, name, rffi_platform.ConstantInteger(name)) from rpython.rlib import rwin32
class CConfig: _compilation_info_ = eci OK = platform.DefinedConstantInteger("OK") STDOUT_FILENO = platform.DefinedConstantInteger("STDOUT_FILENO")
constant_names = [ 'RUSAGE_SELF', 'EINTR', 'CLOCK_REALTIME', 'CLOCK_REALTIME_COARSE', 'CLOCK_MONOTONIC', 'CLOCK_MONOTONIC_COARSE', 'CLOCK_MONOTONIC_RAW', 'CLOCK_BOOTTIME', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_THREAD_CPUTIME_ID', 'CLOCK_HIGHRES', 'CLOCK_PROF', ] for const in constant_names: setattr(CConfig, const, rffi_platform.DefinedConstantInteger(const)) defs_names = ['GETTIMEOFDAY_NO_TZ'] for const in defs_names: setattr(CConfig, const, rffi_platform.Defined(const)) def decode_timeval(t): return (float(rffi.getintfield(t, 'c_tv_sec')) + float(rffi.getintfield(t, 'c_tv_usec')) * 0.000001) def decode_timeval_ns(t): return (r_int64(rffi.getintfield(t, 'c_tv_sec')) * 10**9 + r_int64(rffi.getintfield(t, 'c_tv_usec')) * 10**3)
POLLIN POLLPRI POLLOUT POLLERR POLLHUP POLLNVAL POLLRDNORM POLLRDBAND POLLWRNORM POLLWEBAND POLLMSG FD_READ FD_WRITE FD_ACCEPT FD_CONNECT FD_CLOSE WSA_WAIT_TIMEOUT WSA_WAIT_FAILED INFINITE FD_CONNECT_BIT FD_CLOSE_BIT WSA_IO_PENDING WSA_IO_INCOMPLETE WSA_INVALID_HANDLE WSA_INVALID_PARAMETER WSA_NOT_ENOUGH_MEMORY WSA_OPERATION_ABORTED SIO_RCVALL SIO_KEEPALIVE_VALS SIOCGIFNAME '''.split() for name in constant_names: setattr(CConfig, name, platform.DefinedConstantInteger(name)) if _WIN32: # some SDKs define these values with an enum, #ifdef won't work for name in ('RCVALL_ON', 'RCVALL_OFF', 'RCVALL_SOCKETLEVELONLY'): setattr(CConfig, name, platform.ConstantInteger(name)) constant_names.append(name) constants["BDADDR_ANY"] = "00:00:00:00:00:00" constants["BDADDR_LOCAL"] = "00:00:00:FF:FF:FF" constants_w_defaults = [ ('SOL_IP', 0), ('SOL_TCP', 6), ('SOL_UDP', 17), ('SOMAXCONN', 5),
"KQ_FILTER_SIGNAL": "EVFILT_SIGNAL", "KQ_FILTER_TIMER": "EVFILT_TIMER", "KQ_EV_ADD": "EV_ADD", "KQ_EV_DELETE": "EV_DELETE", "KQ_EV_ENABLE": "EV_ENABLE", "KQ_EV_DISABLE": "EV_DISABLE", "KQ_EV_ONESHOT": "EV_ONESHOT", "KQ_EV_CLEAR": "EV_CLEAR", # "KQ_EV_SYSFLAGS": None, # Python docs says "internal event" .. not defined on FreeBSD # "KQ_EV_FLAG1": None, # Python docs says "internal event" .. not defined on FreeBSD "KQ_EV_EOF": "EV_EOF", "KQ_EV_ERROR": "EV_ERROR" } for symbol in symbol_map.values(): setattr(CConfig, symbol, rffi_platform.DefinedConstantInteger(symbol)) cconfig = rffi_platform.configure(CConfig) kevent = cconfig["kevent"] timespec = cconfig["timespec"] for symbol in symbol_map: globals()[symbol] = cconfig[symbol_map[symbol]] syscall_kqueue = rffi.llexternal("kqueue", [], rffi.INT, compilation_info=eci, save_err=rffi.RFFI_SAVE_ERRNO) syscall_kevent = rffi.llexternal("kevent", [
class CConfig: _compilation_info_ = eci BUFSIZ = platform.DefinedConstantInteger("BUFSIZ") PATH_MAX = platform.DefinedConstantInteger("PATH_MAX")
class CConfig: _compilation_info_ = eci SSLEAY_VERSION = rffi_platform.DefinedConstantString( "SSLEAY_VERSION", "SSLeay_version(SSLEAY_VERSION)") OPENSSL_NO_SSL2 = rffi_platform.Defined("OPENSSL_NO_SSL2") OPENSSL_NO_SSL3 = rffi_platform.Defined("OPENSSL_NO_SSL3") OPENSSL_NO_ECDH = rffi_platform.Defined("OPENSSL_NO_ECDH") OPENSSL_NPN_NEGOTIATED = rffi_platform.Defined("OPENSSL_NPN_NEGOTIATED") SSL_FILETYPE_PEM = rffi_platform.ConstantInteger("SSL_FILETYPE_PEM") SSL_FILETYPE_ASN1 = rffi_platform.ConstantInteger("SSL_FILETYPE_ASN1") SSL_OP_ALL = rffi_platform.ConstantInteger("SSL_OP_ALL") SSL_OP_NO_SSLv2 = rffi_platform.ConstantInteger("SSL_OP_NO_SSLv2") SSL_OP_NO_SSLv3 = rffi_platform.ConstantInteger("SSL_OP_NO_SSLv3") SSL_OP_NO_TLSv1 = rffi_platform.ConstantInteger("SSL_OP_NO_TLSv1") if HAVE_TLSv1_2: SSL_OP_NO_TLSv1_1 = rffi_platform.ConstantInteger("SSL_OP_NO_TLSv1_1") SSL_OP_NO_TLSv1_2 = rffi_platform.ConstantInteger("SSL_OP_NO_TLSv1_2") OPENSSL_NO_TLSEXT = rffi_platform.Defined("OPENSSL_NO_TLSEXT") SSL_OP_CIPHER_SERVER_PREFERENCE = rffi_platform.ConstantInteger( "SSL_OP_CIPHER_SERVER_PREFERENCE") SSL_OP_SINGLE_DH_USE = rffi_platform.ConstantInteger( "SSL_OP_SINGLE_DH_USE") SSL_OP_SINGLE_ECDH_USE = rffi_platform.ConstantInteger( "SSL_OP_SINGLE_ECDH_USE") SSL_OP_NO_COMPRESSION = rffi_platform.DefinedConstantInteger( "SSL_OP_NO_COMPRESSION") SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = rffi_platform.ConstantInteger( "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS") HAS_SNI = rffi_platform.Defined("SSL_CTRL_SET_TLSEXT_HOSTNAME") HAS_NPN = rffi_platform.Defined("OPENSSL_NPN_NEGOTIATED") SSL_VERIFY_NONE = rffi_platform.ConstantInteger("SSL_VERIFY_NONE") SSL_VERIFY_PEER = rffi_platform.ConstantInteger("SSL_VERIFY_PEER") SSL_VERIFY_FAIL_IF_NO_PEER_CERT = rffi_platform.ConstantInteger( "SSL_VERIFY_FAIL_IF_NO_PEER_CERT") X509_V_FLAG_CRL_CHECK = rffi_platform.ConstantInteger( "X509_V_FLAG_CRL_CHECK") X509_V_FLAG_CRL_CHECK_ALL = rffi_platform.ConstantInteger( "X509_V_FLAG_CRL_CHECK_ALL") X509_V_FLAG_X509_STRICT = rffi_platform.ConstantInteger( "X509_V_FLAG_X509_STRICT") SSL_ERROR_WANT_READ = rffi_platform.ConstantInteger("SSL_ERROR_WANT_READ") SSL_ERROR_WANT_WRITE = rffi_platform.ConstantInteger( "SSL_ERROR_WANT_WRITE") SSL_ERROR_ZERO_RETURN = rffi_platform.ConstantInteger( "SSL_ERROR_ZERO_RETURN") SSL_ERROR_WANT_X509_LOOKUP = rffi_platform.ConstantInteger( "SSL_ERROR_WANT_X509_LOOKUP") SSL_ERROR_WANT_CONNECT = rffi_platform.ConstantInteger( "SSL_ERROR_WANT_CONNECT") SSL_ERROR_SYSCALL = rffi_platform.ConstantInteger("SSL_ERROR_SYSCALL") SSL_ERROR_SSL = rffi_platform.ConstantInteger("SSL_ERROR_SSL") SSL_RECEIVED_SHUTDOWN = rffi_platform.ConstantInteger( "SSL_RECEIVED_SHUTDOWN") SSL_MODE_AUTO_RETRY = rffi_platform.ConstantInteger("SSL_MODE_AUTO_RETRY") SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER = rffi_platform.ConstantInteger( "SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER") SSL_TLSEXT_ERR_OK = rffi_platform.ConstantInteger("SSL_TLSEXT_ERR_OK") SSL_TLSEXT_ERR_ALERT_FATAL = rffi_platform.ConstantInteger( "SSL_TLSEXT_ERR_ALERT_FATAL") SSL_TLSEXT_ERR_NOACK = rffi_platform.ConstantInteger( "SSL_TLSEXT_ERR_NOACK") SSL_AD_INTERNAL_ERROR = rffi_platform.ConstantInteger( "SSL_AD_INTERNAL_ERROR") SSL_AD_HANDSHAKE_FAILURE = rffi_platform.ConstantInteger( "SSL_AD_HANDSHAKE_FAILURE") TLSEXT_NAMETYPE_host_name = rffi_platform.ConstantInteger( "TLSEXT_NAMETYPE_host_name") ERR_LIB_X509 = rffi_platform.ConstantInteger("ERR_LIB_X509") ERR_LIB_PEM = rffi_platform.ConstantInteger("ERR_LIB_PEM") ERR_LIB_ASN1 = rffi_platform.ConstantInteger("ERR_LIB_ASN1") PEM_R_NO_START_LINE = rffi_platform.ConstantInteger("PEM_R_NO_START_LINE") ASN1_R_HEADER_TOO_LONG = rffi_platform.ConstantInteger( "ASN1_R_HEADER_TOO_LONG") X509_R_CERT_ALREADY_IN_HASH_TABLE = rffi_platform.ConstantInteger( "X509_R_CERT_ALREADY_IN_HASH_TABLE") NID_undef = rffi_platform.ConstantInteger("NID_undef") NID_subject_alt_name = rffi_platform.ConstantInteger( "NID_subject_alt_name") NID_ad_OCSP = rffi_platform.ConstantInteger("NID_ad_OCSP") NID_ad_ca_issuers = rffi_platform.ConstantInteger("NID_ad_ca_issuers") NID_info_access = rffi_platform.ConstantInteger("NID_info_access") NID_X9_62_prime256v1 = rffi_platform.ConstantInteger( "NID_X9_62_prime256v1") NID_crl_distribution_points = rffi_platform.ConstantInteger( "NID_crl_distribution_points") GEN_DIRNAME = rffi_platform.ConstantInteger("GEN_DIRNAME") GEN_EMAIL = rffi_platform.ConstantInteger("GEN_EMAIL") GEN_DNS = rffi_platform.ConstantInteger("GEN_DNS") GEN_URI = rffi_platform.ConstantInteger("GEN_URI") GEN_OTHERNAME = rffi_platform.ConstantInteger("GEN_OTHERNAME") GEN_X400 = rffi_platform.ConstantInteger("GEN_X400") GEN_EDIPARTY = rffi_platform.ConstantInteger("GEN_EDIPARTY") GEN_IPADD = rffi_platform.ConstantInteger("GEN_IPADD") GEN_RID = rffi_platform.ConstantInteger("GEN_RID") CRYPTO_LOCK = rffi_platform.ConstantInteger("CRYPTO_LOCK") OBJ_NAME_TYPE_MD_METH = rffi_platform.ConstantInteger( "OBJ_NAME_TYPE_MD_METH") if OPENSSL_VERSION_NUMBER >= 0x10001000: X509_st = rffi_platform.Struct('struct x509_st', [('crldp', stack_st_DIST_POINT)]) # Some structures, with only the fields used in the _ssl module X509_name_entry_st = rffi_platform.Struct('struct X509_name_entry_st', [('set', rffi.INT)]) asn1_string_st = rffi_platform.Struct('struct asn1_string_st', [('length', rffi.INT), ('data', rffi.CCHARP)]) X509_extension_st = rffi_platform.Struct('struct X509_extension_st', [('value', ASN1_STRING)]) x509_store_st = rffi_platform.Struct('struct x509_store_st', [('objs', stack_st_X509_OBJECT), ('param', X509_VERIFY_PARAM)]) x509_object_st = rffi_platform.Struct('struct x509_object_st', [('type', rffi.INT)]) X509_LU_X509 = rffi_platform.ConstantInteger("X509_LU_X509") X509_LU_CRL = rffi_platform.ConstantInteger("X509_LU_CRL") X509V3_EXT_D2I = lltype.FuncType([rffi.VOIDP, rffi.CCHARPP, rffi.LONG], rffi.VOIDP) v3_ext_method = rffi_platform.Struct('struct v3_ext_method', [('it', ASN1_ITEM_EXP), ('d2i', lltype.Ptr(X509V3_EXT_D2I))]) GENERAL_NAME_st = rffi_platform.Struct('struct GENERAL_NAME_st', [('type', rffi.INT)]) EVP_MD_st = rffi_platform.Struct('EVP_MD', [('md_size', rffi.INT), ('block_size', rffi.INT)]) EVP_MD_SIZE = rffi_platform.SizeOf('EVP_MD') EVP_MD_CTX_SIZE = rffi_platform.SizeOf('EVP_MD_CTX') OBJ_NAME_st = rffi_platform.Struct('OBJ_NAME', [ ('alias', rffi.INT), ('name', rffi.CCHARP), ]) COMP_METHOD_st = rffi_platform.Struct('struct comp_method_st', [ ('type', rffi.INT), ]) ACCESS_DESCRIPTION_st = rffi_platform.Struct( 'struct ACCESS_DESCRIPTION_st', [ ('method', ASN1_OBJECT), ('location', GENERAL_NAME), ])
class CConfig: _compilation_info_ = eci # constants linux = platform.Defined('linux') WIN32 = platform.Defined('_WIN32') O_RDONLY = platform.DefinedConstantInteger('O_RDONLY') O_WRONLY = platform.DefinedConstantInteger('O_WRONLY') O_RDWR = platform.DefinedConstantInteger('O_RDWR') O_NONBLOCK = platform.DefinedConstantInteger('O_NONBLOCK') F_GETFL = platform.DefinedConstantInteger('F_GETFL') F_SETFL = platform.DefinedConstantInteger('F_SETFL') FIONBIO = platform.DefinedConstantInteger('FIONBIO') INVALID_SOCKET = platform.DefinedConstantInteger('INVALID_SOCKET') INET_ADDRSTRLEN = platform.DefinedConstantInteger('INET_ADDRSTRLEN') INET6_ADDRSTRLEN = platform.DefinedConstantInteger('INET6_ADDRSTRLEN') EINTR = platform.DefinedConstantInteger('EINTR') WSAEINTR = platform.DefinedConstantInteger('WSAEINTR') EINPROGRESS = platform.DefinedConstantInteger('EINPROGRESS') WSAEINPROGRESS = platform.DefinedConstantInteger('WSAEINPROGRESS') EWOULDBLOCK = platform.DefinedConstantInteger('EWOULDBLOCK') WSAEWOULDBLOCK = platform.DefinedConstantInteger('WSAEWOULDBLOCK') EAFNOSUPPORT = platform.DefinedConstantInteger('EAFNOSUPPORT') WSAEAFNOSUPPORT = platform.DefinedConstantInteger('WSAEAFNOSUPPORT') EISCONN = platform.DefinedConstantInteger('EISCONN') WSAEISCONN = platform.DefinedConstantInteger('WSAEISCONN')
class CConfig: _compilation_info_ = eci PATH_MAX = platform.DefinedConstantInteger("PATH_MAX") SEEK_SET = platform.DefinedConstantInteger("SEEK_SET")
('X509', 'NO_CERT_SET_FOR_US_TO_VERIFY'), ('X509', 'PUBLIC_KEY_DECODE_ERROR'), ('X509', 'PUBLIC_KEY_ENCODE_ERROR'), ('X509', 'SHOULD_RETRY'), ('X509', 'UNABLE_TO_FIND_PARAMETERS_IN_CHAIN'), ('X509', 'UNABLE_TO_GET_CERTS_PUBLIC_KEY'), ('X509', 'UNKNOWN_KEY_TYPE'), ('X509', 'UNKNOWN_NID'), ('X509', 'UNKNOWN_PURPOSE_ID'), ('X509', 'UNKNOWN_TRUST_ID'), ('X509', 'UNSUPPORTED_ALGORITHM'), ('X509', 'WRONG_LOOKUP_TYPE'), ('X509', 'WRONG_TYPE'), ] for lib, code in error_codes: setattr(CConfig, code, rffi_platform.DefinedConstantInteger( '%s_R_%s' % (lib, code))) # Constants for ALERT_DESCRIPTION_ error codes AD_NAMES = """ CLOSE_NOTIFY UNEXPECTED_MESSAGE BAD_RECORD_MAC RECORD_OVERFLOW DECOMPRESSION_FAILURE HANDSHAKE_FAILURE BAD_CERTIFICATE UNSUPPORTED_CERTIFICATE CERTIFICATE_REVOKED CERTIFICATE_EXPIRED CERTIFICATE_UNKNOWN ILLEGAL_PARAMETER UNKNOWN_CA ACCESS_DENIED DECODE_ERROR DECRYPT_ERROR PROTOCOL_VERSION INSUFFICIENT_SECURITY INTERNAL_ERROR USER_CANCELLED NO_RENEGOTIATION UNSUPPORTED_EXTENSION CERTIFICATE_UNOBTAINABLE UNRECOGNIZED_NAME BAD_CERTIFICATE_STATUS_RESPONSE BAD_CERTIFICATE_HASH_VALUE UNKNOWN_PSK_IDENTITY """.split() for name in AD_NAMES: setattr(CConfig, name, rffi_platform.DefinedConstantInteger( 'SSL_AD_%s' % name))
class CConfig(object): timelib_tzdb = platform.Struct('timelib_tzdb', ([ ('version', rffi.CCHARP), ('index_size', rffi.INT), ('index', timelib_tzdb_index_entryP), ('data', rffi.CArrayPtr(rffi.UCHAR)), ])) timelib_error_container = platform.Struct( 'timelib_error_container', [('error_count', lltype.Signed), ('error_messages', rffi.CArrayPtr(timelib_error_message)), ('warning_count', lltype.Signed)]) timelib_time = platform.Struct('timelib_time', ([ ('y', lltype.Signed), ('m', lltype.Signed), ('d', lltype.Signed), ('h', lltype.Signed), ('i', lltype.Signed), ('s', lltype.Signed), ('f', lltype.Float), ('z', lltype.Signed), ('tz_abbr', rffi.CCHARP), ('tz_info', timelib_tzinfo), ('dst', lltype.Signed), ('relative', timelib_rel_timeP.TO), ('sse', lltype.Signed), ('have_time', lltype.Unsigned), ('have_date', lltype.Unsigned), ('have_relative', lltype.Unsigned), ('have_weeknr_day', lltype.Unsigned), ('sse_uptodate', lltype.Unsigned), ('tim_uptodate', lltype.Unsigned), ('zone_type', lltype.Signed), ('is_localtime', lltype.Signed), ])) timelib_time_offset = platform.Struct( 'timelib_time_offset', [('offset', lltype.Signed), ('leap_secs', rffi.UINT), ('is_dst', rffi.UINT), ('abbr', rffi.CCHARP), ('transistion_time', lltype.Signed)]) timelib_tz_lookup_table = platform.Struct('timelib_tz_lookup_table', [ ('name', rffi.CCHARP), ('type', lltype.Signed), ('gmtoffset', lltype.SingleFloat), ('full_tz_name', rffi.CCHARP), ]) timelib_tz_lookup_table = platform.Struct('timelib_tz_lookup_table', [ ('name', rffi.CCHARP), ('type', lltype.Signed), ('gmtoffset', lltype.SingleFloat), ('full_tz_name', rffi.CCHARP), ]) TIMELIB_NO_CLONE = platform.DefinedConstantInteger('TIMELIB_NO_CLONE') TIMELIB_ZONETYPE_ID = platform.DefinedConstantInteger( 'TIMELIB_ZONETYPE_ID') TIMELIB_ZONETYPE_ABBR = platform.DefinedConstantInteger( 'TIMELIB_ZONETYPE_ABBR') TIMELIB_ZONETYPE_OFFSET = platform.DefinedConstantInteger( 'TIMELIB_ZONETYPE_OFFSET') _compilation_info_ = eci
if _POSIX: # constants, look in sys/mman.h and platform docs for the meaning # some constants are linux only so they will be correctly exposed outside # depending on the OS constant_names = [ 'MAP_SHARED', 'MAP_PRIVATE', 'MAP_FIXED', 'PROT_READ', 'PROT_WRITE', 'MS_SYNC' ] opt_constant_names = [ 'MAP_ANON', 'MAP_ANONYMOUS', 'MAP_NORESERVE', 'PROT_EXEC', 'MAP_DENYWRITE', 'MAP_EXECUTABLE' ] for name in constant_names: setattr(CConfig, name, rffi_platform.ConstantInteger(name)) for name in opt_constant_names: setattr(CConfig, name, rffi_platform.DefinedConstantInteger(name)) CConfig.MREMAP_MAYMOVE = ( rffi_platform.DefinedConstantInteger("MREMAP_MAYMOVE")) CConfig.has_mremap = rffi_platform.Has('mremap(NULL, 0, 0, 0)') CConfig.has_madvise = rffi_platform.Has('madvise(NULL, 0, 0)') # ^^ both are a dirty hack, this is probably a macro CConfig.MADV_DONTNEED = ( rffi_platform.DefinedConstantInteger('MADV_DONTNEED')) CConfig.MADV_FREE = (rffi_platform.DefinedConstantInteger('MADV_FREE')) elif _MS_WINDOWS: constant_names = [ 'PAGE_READONLY', 'PAGE_READWRITE', 'PAGE_WRITECOPY', 'FILE_MAP_READ', 'FILE_MAP_WRITE', 'FILE_MAP_COPY', 'DUPLICATE_SAME_ACCESS',