<s> from ctypes import ( Structure , POINTER , c_int , c_uint8 , c_uint , c_ubyte , <EOL> c_char_p ) <EOL> from neoman . yubicommon . ctypes . libloader import load_library <EOL> _lib = load_library ( '<STR_LIT>' , '<STR_LIT:1>' ) <EOL> def define ( name , args , res ) : <EOL> try : <EOL> fn = getattr ( _lib , name ) <EOL> fn . argtypes = args <EOL> fn . restype = res <EOL> except AttributeError : <EOL> print "<STR_LIT>" % name <EOL> def error ( * args , ** kwargs ) : <EOL> raise Exception ( "<STR_LIT>" % name ) <EOL> fn = error <EOL> return fn <EOL> YK_KEY = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> YK_STATUS = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> YK_TICKET = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> YK_CONFIG = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> YK_NAV = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> YK_FRAME = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> YK_NDEF = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> YK_DEVICE_CONFIG = type ( '<STR_LIT>' , ( Structure , ) , { } ) <EOL> ykpers_check_version = define ( '<STR_LIT>' , [ c_char_p ] , c_char_p ) <EOL> yk_init = define ( '<STR_LIT>' , [ ] , c_int ) <EOL> yk_release = define ( '<STR_LIT>' , [ ] , c_int ) <EOL> yk_open_first_key = define ( '<STR_LIT>' , [ ] , POINTER ( YK_KEY ) ) <EOL> yk_close_key = define ( '<STR_LIT>' , [ POINTER ( YK_KEY ) ] , c_int ) <EOL> yk_get_status = define ( '<STR_LIT>' , [ <EOL> POINTER ( YK_KEY ) , POINTER ( YK_STATUS ) ] , c_int ) <EOL> yk_get_serial = define ( '<STR_LIT>' , [ <EOL> POINTER ( YK_KEY ) , c_uint8 , c_uint , POINTER ( c_uint ) ] , c_int ) <EOL> yk_write_device_config = define ( '<STR_LIT>' , <EOL> [ POINTER ( YK_KEY ) , POINTER ( YK_DEVICE_CONFIG ) ] , <EOL> c_int ) <EOL> ykds_alloc = define ( '<STR_LIT>' , [ ] , POINTER ( YK_STATUS ) ) <EOL> ykds_free = define ( '<STR_LIT>' , [ POINTER ( YK_STATUS ) ] , None ) <EOL> ykds_version_major = define ( '<STR_LIT>' , [ POINTER ( YK_STATUS ) ] , c_int ) <EOL> ykds_version_minor = define ( '<STR_LIT>' , [ POINTER ( YK_STATUS ) ] , c_int ) <EOL> ykds_version_build = define ( '<STR_LIT>' , [ POINTER ( YK_STATUS ) ] , c_int ) <EOL> ykp_alloc_device_config = define ( '<STR_LIT>' , [ ] , <EOL> POINTER ( YK_DEVICE_CONFIG ) ) <EOL> ykp_free_device_config = define ( '<STR_LIT>' , <EOL> [ POINTER ( YK_DEVICE_CONFIG ) ] , c_int ) <EOL> ykp_set_device_mode = define ( '<STR_LIT>' , [ POINTER ( YK_DEVICE_CONFIG ) , <EOL> c_ubyte ] , c_int ) <EOL> yk_get_key_vid_pid = define ( '<STR_LIT>' , [ POINTER ( YK_KEY ) , <EOL> POINTER ( c_int ) , <EOL> POINTER ( c_int ) ] , c_int ) <EOL> yk_get_capabilities = define ( '<STR_LIT>' , [ POINTER ( YK_KEY ) , <EOL> c_uint8 , <EOL> c_uint , <EOL> c_char_p ] , c_int ) <EOL> __all__ = [ x for x in globals ( ) . keys ( ) if x . lower ( ) . startswith ( '<STR_LIT>' ) ] </s>
