25 #ifndef BRLAPI_INCLUDED
26 #define BRLAPI_INCLUDED
38 #define BRLAPI_RELEASE "0.8.0"
41 #define BRLAPI_MAJOR 0
44 #define BRLAPI_MINOR 8
47 #define BRLAPI_REVISION 0
55 #include <sys/types.h>
59 #define BRLAPI_STDCALL __stdcall
61 #define BRLAPI_STDCALL
65 typedef __int64 uint64_t;
66 typedef __int32 uint32_t;
67 #define UINT64_C(x) (x ## Ui64)
69 typedef signed int ssize_t;
123 #define BRLAPI_SOCKETPORTNUM 4101
124 #define BRLAPI_SOCKETPORT "4101"
127 #define BRLAPI_SOCKETPATH "/var/lib/BrlAPI"
133 #define BRLAPI_ETCDIR "/etc"
138 #define BRLAPI_AUTHKEYFILE "brlapi.key"
143 #define BRLAPI_DEFAUTH "none"
145 #define BRLAPI_DEFAUTH_KEYFILE "keyfile:" BRLAPI_ETCDIR "/" BRLAPI_AUTHKEYFILE
148 #define BRLAPI_DEFAUTH_POLKIT "+polkit"
150 #define BRLAPI_DEFAUTH_POLKIT ""
153 #define BRLAPI_DEFAUTH BRLAPI_DEFAUTH_KEYFILE BRLAPI_DEFAUTH_POLKIT
216 #define BRLAPI_SETTINGS_INITIALIZER { NULL, NULL }
263 #ifndef BRLAPI_NO_SINGLE_SESSION
275 #ifndef BRLAPI_NO_SINGLE_SESSION
293 #ifndef BRLAPI_NO_SINGLE_SESSION
303 #ifndef BRLAPI_NO_SINGLE_SESSION
323 #define BRLAPI_MAXNAMELENGTH 31
338 #ifndef BRLAPI_NO_SINGLE_SESSION
356 #ifndef BRLAPI_NO_SINGLE_SESSION
363 #ifndef BRLAPI_NO_SINGLE_SESSION
411 #ifndef BRLAPI_NO_SINGLE_SESSION
425 #define BRLAPI_TTY_DEFAULT -1
439 #ifndef BRLAPI_NO_SINGLE_SESSION
451 #ifndef BRLAPI_NO_SINGLE_SESSION
467 #ifndef BRLAPI_NO_SINGLE_SESSION
516 #ifndef BRLAPI_NO_SINGLE_SESSION
534 #ifndef BRLAPI_NO_SINGLE_SESSION
547 #ifndef BRLAPI_NO_SINGLE_SESSION
556 unsigned int regionBegin ;
557 unsigned int regionSize ;
560 unsigned char *andMask ;
561 unsigned char *orMask ;
570 #define BRLAPI_DISPLAY_DEFAULT -1
576 #define BRLAPI_CURSOR_LEAVE -1
582 #define BRLAPI_CURSOR_OFF 0
594 #define BRLAPI_WRITEARGUMENTS_INITIALIZER { \
595 .displayNumber = BRLAPI_DISPLAY_DEFAULT, \
602 .cursor = BRLAPI_CURSOR_LEAVE, \
642 #ifndef BRLAPI_NO_SINGLE_SESSION
668 unsigned int command ;
669 unsigned int argument ;
687 const char *command ;
688 unsigned int argument ;
705 #define BRLAPI_UC_ROW 0x2800UL
774 #ifndef BRLAPI_NO_SINGLE_SESSION
799 #ifndef BRLAPI_NO_SINGLE_SESSION
826 #ifndef BRLAPI_NO_SINGLE_SESSION
844 #ifndef BRLAPI_NO_SINGLE_SESSION
855 #ifndef BRLAPI_NO_SINGLE_SESSION
857 #define brlapi_ignoreAllKeys() brlapi_ignoreKeys(brlapi_rangeType_all, NULL, 0)
860 #define brlapi__ignoreAllKeys(handle) brlapi__ignoreKeys(handle, brlapi_rangeType_all, NULL, 0)
871 #ifndef BRLAPI_NO_SINGLE_SESSION
873 #define brlapi_acceptAllKeys() brlapi_acceptKeys(brlapi_rangeType_all, NULL, 0)
876 #define brlapi__acceptAllKeys(handle) brlapi__acceptKeys(handle, brlapi_rangeType_all, NULL, 0)
898 #ifndef BRLAPI_NO_SINGLE_SESSION
914 #ifndef BRLAPI_NO_SINGLE_SESSION
948 #ifndef BRLAPI_NO_SINGLE_SESSION
956 #ifndef BRLAPI_NO_SINGLE_SESSION
967 #ifndef BRLAPI_NO_SINGLE_SESSION
979 #ifndef BRLAPI_NO_SINGLE_SESSION
989 #ifndef BRLAPI_NO_SINGLE_SESSION
998 #ifndef BRLAPI_NO_SINGLE_SESSION
1031 #define BRLAPI_PARAMF_LOCAL 0X00
1032 #define BRLAPI_PARAMF_GLOBAL 0X01
1033 #define BRLAPI_PARAMF_SELF 0X02
1048 #ifndef BRLAPI_NO_SINGLE_SESSION
1066 #ifndef BRLAPI_NO_SINGLE_SESSION
1084 #ifndef BRLAPI_NO_SINGLE_SESSION
1136 #ifndef BRLAPI_NO_SINGLE_SESSION
1152 #ifndef BRLAPI_NO_SINGLE_SESSION
1168 #ifndef BRLAPI_NO_SINGLE_SESSION
1197 #define BRLAPI_ERROR_SUCCESS 0
1198 #define BRLAPI_ERROR_NOMEM 1
1199 #define BRLAPI_ERROR_TTYBUSY 2
1200 #define BRLAPI_ERROR_DEVICEBUSY 3
1201 #define BRLAPI_ERROR_UNKNOWN_INSTRUCTION 4
1202 #define BRLAPI_ERROR_ILLEGAL_INSTRUCTION 5
1203 #define BRLAPI_ERROR_INVALID_PARAMETER 6
1204 #define BRLAPI_ERROR_INVALID_PACKET 7
1205 #define BRLAPI_ERROR_CONNREFUSED 8
1206 #define BRLAPI_ERROR_OPNOTSUPP 9
1207 #define BRLAPI_ERROR_GAIERR 10
1208 #define BRLAPI_ERROR_LIBCERR 11
1209 #define BRLAPI_ERROR_UNKNOWNTTY 12
1210 #define BRLAPI_ERROR_PROTOCOL_VERSION 13
1211 #define BRLAPI_ERROR_EOF 14
1212 #define BRLAPI_ERROR_EMPTYKEY 15
1213 #define BRLAPI_ERROR_DRIVERERROR 16
1214 #define BRLAPI_ERROR_AUTHENTICATION 17
1215 #define BRLAPI_ERROR_READONLY_PARAMETER 18
1274 #define brlapi_error (*brlapi_error_location())
1276 #define brlapi_errno (brlapi_error.brlerrno)
1278 #define brlapi_libcerrno (brlapi_error.libcerrno)
1280 #define brlapi_gaierrno (brlapi_error.gaierrno)
1282 #define brlapi_errfun (brlapi_error.errfun)
1315 #ifndef BRLAPI_NO_SINGLE_SESSION
1330 #ifndef BRLAPI_NO_SINGLE_SESSION
1344 #ifndef BRLAPI_NO_SINGLE_SESSION
1349 #ifndef BRLAPI_NO_SINGLE_SESSION
1358 #ifndef BRLAPI_NO_SINGLE_SESSION
1359 int BRLAPI_STDCALL brlapi_writeTextWin(
int cursor,
const void *str,
int wide);
1363 #ifndef BRLAPI_NO_SINGLE_SESSION
1369 #ifndef BRLAPI_NO_SINGLE_SESSION
1370 #define brlapi_writeText(cursor, str) brlapi_writeTextWin(cursor, str, 1)
1372 #define brlapi__writeText(handle, cursor, str) brlapi__writeTextWin(handle, cursor, str, 1)
1374 #ifndef BRLAPI_NO_SINGLE_SESSION
1375 #define brlapi_write(s) brlapi_writeWin(s, 1)
1377 #define brlapi__write(handle, s) brlapi__writeWin(handle, s, 1)
1381 #ifndef BRLAPI_NO_SINGLE_SESSION
1382 #define brlapi_writeText(cursor, str) brlapi_writeTextWin(cursor, str, 0)
1384 #define brlapi__writeText(handle, cursor, str) brlapi__writeTextWin(handle, cursor, str, 0)
1386 #ifndef BRLAPI_NO_SINGLE_SESSION
1387 #define brlapi_write(s) brlapi_writeWin(s, 0)
1389 #define brlapi__write(handle, s) brlapi__writeWin(handle, s, 0)
1394 #ifndef BRLAPI_NO_DEPRECATED
1407 #define brlapi_settings_t brlapi_connectionSettings_t
1421 #define BRLAPI_WRITESTRUCT_INITIALIZER BRLAPI_WRITEARGUMENTS_INITIALIZER
1423 #define brl_keycode_t brlapi_keyCode_t
1424 #define brl_type_t brlapi_packetType_t
1426 #define BRLCOMMANDS NULL
1427 #define BRL_KEYCODE_MAX BRLAPI_KEY_MAX
1429 #ifndef BRLAPI_NO_SINGLE_SESSION
1430 #define brlapi_initializeConnection brlapi_openConnection
1431 #define brlapi_getTty brlapi_enterTtyMode
1432 #define brlapi_getTtyPath brlapi_enterTtyModeWithPath
1433 #define brlapi_leaveTty brlapi_leaveTtyMode
1434 #define brlapi_unignoreKeyRange brlapi_acceptKeyRange
1435 #define brlapi_unignoreKeySet brlapi_acceptKeySet
1436 #define brlapi_getRaw brlapi_enterRawMode
1437 #define brlapi_leaveRaw brlapi_leaveRawMode
1438 #define brlapi_suspend brlapi_suspendDriver
1439 #define brlapi_resume brlapi_resumeDriver
1442 #define BRLERR_SUCCESS BRLAPI_ERROR_SUCCESS
1443 #define BRLERR_NOMEM BRLAPI_ERROR_NOMEM
1444 #define BRLERR_TTYBUSY BRLAPI_ERROR_TTYBUSY
1445 #define BRLERR_DEVICEBUSY BRLAPI_ERROR_DEVICEBUSY
1446 #define BRLERR_UNKNOWN_INSTRUCTION BRLAPI_ERROR_UNKNOWN_INSTRUCTION
1447 #define BRLERR_ILLEGAL_INSTRUCTION BRLAPI_ERROR_ILLEGAL_INSTRUCTION
1448 #define BRLERR_INVALID_PARAMETER BRLAPI_ERROR_INVALID_PARAMETER
1449 #define BRLERR_INVALID_PACKET BRLAPI_ERROR_INVALID_PACKET
1450 #define BRLERR_CONNREFUSED BRLAPI_ERROR_CONNREFUSED
1451 #define BRLERR_OPNOTSUPP BRLAPI_ERROR_OPNOTSUPP
1452 #define BRLERR_GAIERR BRLAPI_ERROR_GAIERR
1453 #define BRLERR_LIBCERR BRLAPI_ERROR_LIBCERR
1454 #define BRLERR_UNKNOWNTTY BRLAPI_ERROR_UNKNOWNTTY
1455 #define BRLERR_PROTOCOL_VERSION BRLAPI_ERROR_PROTOCOL_VERSION
1456 #define BRLERR_EOF BRLAPI_ERROR_EOF
1457 #define BRLERR_EMPTYKEY BRLAPI_ERROR_EMPTYKEY
1458 #define BRLERR_DRIVERERROR BRLAPI_ERROR_DRIVERERROR
int BRLAPI_STDCALL brlapi_readKeyWithTimeout(int timeout_ms, brlapi_keyCode_t *code)
brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL brlapi__watchParameter(brlapi_handle_t *handle, brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, brlapi_paramCallback_t func, void *priv, void *data, size_t len)
#define BRLAPI_STDCALL
Definition: brlapi.h:61
int BRLAPI_STDCALL brlapi_ignoreKeyRanges(const brlapi_range_t ranges[], unsigned int count)
int BRLAPI_STDCALL brlapi_writeText(int cursor, const char *text)
int brlapi_fileDescriptor
Definition: brlapi.h:159
int BRLAPI_STDCALL brlapi_writeDots(const unsigned char *dots)
struct brlapi_handle_t brlapi_handle_t
Definition: brlapi.h:105
ssize_t BRLAPI_STDCALL brlapi__sendRaw(brlapi_handle_t *handle, const void *buffer, size_t size)
void brlapi_getLibraryVersion(int *major, int *minor, int *revision)
int BRLAPI_STDCALL brlapi_resumeDriver(void)
const char * brlapi_errlist[]
size_t BRLAPI_STDCALL brlapi_getHandleSize(void)
int gaierrno
Definition: brlapi.h:1240
int BRLAPI_STDCALL brlapi__readKey(brlapi_handle_t *handle, int wait, brlapi_keyCode_t *code)
int BRLAPI_STDCALL brlapi__resumeDriver(brlapi_handle_t *handle)
int BRLAPI_STDCALL brlapi__getDisplaySize(brlapi_handle_t *handle, unsigned int *x, unsigned int *y)
int BRLAPI_STDCALL brlapi_getDisplaySize(unsigned int *x, unsigned int *y)
#define brlapi_error
Definition: brlapi.h:1274
void *BRLAPI_STDCALL brlapi_getClientData(void)
int BRLAPI_STDCALL brlapi__ignoreKeyRanges(brlapi_handle_t *handle, const brlapi_range_t ranges[], unsigned int count)
int BRLAPI_STDCALL brlapi_acceptKeyRanges(const brlapi_range_t ranges[], unsigned int count)
int BRLAPI_STDCALL brlapi__acceptKeys(brlapi_handle_t *handle, brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count)
void *BRLAPI_STDCALL brlapi__getParameterAlloc(brlapi_handle_t *handle, brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, size_t *len)
const char *BRLAPI_STDCALL brlapi_getPacketTypeName(brlapi_packetType_t type)
int BRLAPI_STDCALL brlapi__readKeyWithTimeout(brlapi_handle_t *handle, int timeout_ms, brlapi_keyCode_t *code)
ssize_t BRLAPI_STDCALL brlapi_recvRaw(void *buffer, size_t size)
int displayNumber
Definition: brlapi.h:1411
unsigned int regionBegin
Definition: brlapi.h:1412
int BRLAPI_STDCALL brlapi_setParameter(brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, const void *data, size_t len)
int BRLAPI_STDCALL brlapi__acceptKeyRanges(brlapi_handle_t *handle, const brlapi_range_t ranges[], unsigned int count)
brlapi_keyCode_t first
Definition: brlapi.h:883
unsigned int regionSize
Definition: brlapi.h:1413
void BRLAPI_STDCALL brlapi__setClientData(brlapi_handle_t *handle, void *data)
void BRLAPI_STDCALL brlapi_setClientData(void *data)
brlapi_keyCode_t last
Definition: brlapi.h:884
ssize_t BRLAPI_STDCALL brlapi__getParameter(brlapi_handle_t *handle, brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, void *data, size_t len)
int BRLAPI_STDCALL brlapi__enterTtyModeWithPath(brlapi_handle_t *handle, int *ttys, int count, const char *driver)
const char * auth
Definition: brlapi.h:200
void BRLAPI_STDCALL brlapi_closeConnection(void)
int cursor
Definition: brlapi.h:1418
int BRLAPI_STDCALL brlapi_ignoreKeys(brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count)
ssize_t BRLAPI_STDCALL brlapi_sendRaw(const void *buffer, size_t size)
void BRLAPI_STDCALL brlapi_perror(const char *s)
void(BRLAPI_STDCALL * brlapi__exceptionHandler_t)(brlapi_handle_t *handle, int error, brlapi_packetType_t type, const void *packet, size_t size)
Definition: brlapi.h:1318
int BRLAPI_STDCALL brlapi__leaveTtyMode(brlapi_handle_t *handle)
int BRLAPI_STDCALL brlapi_suspendDriver(const char *driver)
int BRLAPI_STDCALL brlapi__write(brlapi_handle_t *handle, const brlapi_writeArguments_t *arguments)
uint64_t brlapi_keyCode_t
Definition: brlapi_keycodes.h:90
uint32_t brlapi_param_flags_t
Definition: brlapi.h:1030
int BRLAPI_STDCALL brlapi__ignoreKeys(brlapi_handle_t *handle, brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count)
int BRLAPI_STDCALL brlapi__writeText(brlapi_handle_t *handle, int cursor, const char *text)
int BRLAPI_STDCALL brlapi_leaveRawMode(void)
brlapi_param_t
Definition: brlapi_param.h:36
#define brlapi_libcerrno
Definition: brlapi.h:1278
brlapi_error_t *BRLAPI_STDCALL brlapi_error_location(void)
int BRLAPI_STDCALL brlapi__enterRawMode(brlapi_handle_t *handle, const char *driver)
int textSize
Definition: brlapi.h:1415
void(BRLAPI_STDCALL * brlapi_exceptionHandler_t)(int error, brlapi_packetType_t type, const void *packet, size_t size)
Definition: brlapi.h:1316
void BRLAPI_STDCALL brlapi_defaultExceptionHandler(int error, brlapi_packetType_t type, const void *packet, size_t size)
int BRLAPI_STDCALL brlapi_write(const brlapi_writeArguments_t *arguments)
#define brlapi_errno
Definition: brlapi.h:1276
brlapi_fileDescriptor BRLAPI_STDCALL brlapi_openConnection(const brlapi_connectionSettings_t *desiredSettings, brlapi_connectionSettings_t *actualSettings)
Definition: brlapi.h:1410
int BRLAPI_STDCALL brlapi_getDriverName(char *buffer, size_t size)
int BRLAPI_STDCALL brlapi_strexception(char *buffer, size_t bufferSize, int error, brlapi_packetType_t type, const void *packet, size_t packetSize)
int BRLAPI_STDCALL brlapi_describeKeyCode(brlapi_keyCode_t code, brlapi_describedKeyCode_t *description)
int brlerrno
Definition: brlapi.h:1238
#define BRLAPI_KEY_FLAGS_SHIFT
Definition: brlapi_keycodes.h:111
unsigned char * attrAnd
Definition: brlapi.h:1416
void BRLAPI_STDCALL brlapi__closeConnection(brlapi_handle_t *handle)
uint32_t brlapi_packetType_t
Definition: brlapi.h:1293
int BRLAPI_STDCALL brlapi__suspendDriver(brlapi_handle_t *handle, const char *driver)
#define brlapi_errfun
Definition: brlapi.h:1282
#define brlapi__acceptAllKeys(handle)
Definition: brlapi.h:876
int BRLAPI_STDCALL brlapi__strexception(brlapi_handle_t *handle, char *buffer, size_t bufferSize, int error, brlapi_packetType_t type, const void *packet, size_t packetSize)
int BRLAPI_STDCALL brlapi_unwatchParameter(brlapi_paramCallbackDescriptor_t descriptor)
char * text
Definition: brlapi.h:1414
int BRLAPI_STDCALL brlapi__writeDots(brlapi_handle_t *handle, const unsigned char *dots)
void * brlapi_paramCallbackDescriptor_t
Definition: brlapi.h:1111
#define brlapi_acceptAllKeys()
Definition: brlapi.h:873
brlapi_exceptionHandler_t BRLAPI_STDCALL brlapi_setExceptionHandler(brlapi_exceptionHandler_t handler)
int BRLAPI_STDCALL brlapi_enterTtyModeWithPath(int *ttys, int count, const char *driver)
int BRLAPI_STDCALL brlapi_expandKeyCode(brlapi_keyCode_t code, brlapi_expandedKeyCode_t *expansion)
int BRLAPI_STDCALL brlapi_readKey(int wait, brlapi_keyCode_t *code)
const char * errfun
Definition: brlapi.h:1241
unsigned char * attrOr
Definition: brlapi.h:1417
int BRLAPI_STDCALL brlapi_enterTtyMode(int tty, const char *driver)
int BRLAPI_STDCALL brlapi__enterTtyMode(brlapi_handle_t *handle, int tty, const char *driver)
int BRLAPI_STDCALL brlapi__getModelIdentifier(brlapi_handle_t *handle, char *buffer, size_t size)
brlapi_paramCallbackDescriptor_t BRLAPI_STDCALL brlapi_watchParameter(brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, brlapi_paramCallback_t func, void *priv, void *data, size_t len)
int BRLAPI_STDCALL brlapi__unwatchParameter(brlapi_handle_t *handle, brlapi_paramCallbackDescriptor_t descriptor)
int BRLAPI_STDCALL brlapi_setFocus(int tty)
brlapi_rangeType_t
Definition: brlapi.h:805
int BRLAPI_STDCALL brlapi__setFocus(brlapi_handle_t *handle, int tty)
int BRLAPI_STDCALL brlapi__getDriverName(brlapi_handle_t *handle, char *buffer, size_t size)
void BRLAPI_STDCALL brlapi__pause(brlapi_handle_t *handle, int timeout_ms)
brlapi_fileDescriptor BRLAPI_STDCALL brlapi__openConnection(brlapi_handle_t *handle, const brlapi_connectionSettings_t *desiredSettings, brlapi_connectionSettings_t *actualSettings)
int BRLAPI_STDCALL brlapi__leaveRawMode(brlapi_handle_t *handle)
int BRLAPI_STDCALL brlapi__writeWText(brlapi_handle_t *handle, int cursor, const wchar_t *text)
void BRLAPI_STDCALL brlapi_pause(int timeout_ms)
int BRLAPI_STDCALL brlapi_enterRawMode(const char *driver)
void BRLAPI_STDCALL brlapi__defaultExceptionHandler(brlapi_handle_t *handle, int error, brlapi_packetType_t type, const void *packet, size_t size)
void(* brlapi_paramCallback_t)(brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, void *priv, const void *data, size_t len)
Definition: brlapi.h:1104
Settings structure for BrlAPI connection.
Definition: brlapi.h:192
int BRLAPI_STDCALL brlapi_acceptKeys(brlapi_rangeType_t type, const brlapi_keyCode_t keys[], unsigned int count)
const char * host
Definition: brlapi.h:210
int libcerrno
Definition: brlapi.h:1239
Definition: brlapi.h:1237
char * charset
Definition: brlapi.h:1419
int BRLAPI_STDCALL brlapi__setParameter(brlapi_handle_t *handle, brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, const void *data, size_t len)
ssize_t BRLAPI_STDCALL brlapi_getParameter(brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, void *data, size_t len)
brlapi__exceptionHandler_t BRLAPI_STDCALL brlapi__setExceptionHandler(brlapi_handle_t *handle, brlapi__exceptionHandler_t handler)
uint64_t brlapi_param_subparam_t
Definition: brlapi_param.h:110
int BRLAPI_STDCALL brlapi_writeWText(int cursor, const wchar_t *text)
#define brlapi_ignoreAllKeys()
Definition: brlapi.h:857
void *BRLAPI_STDCALL brlapi__getClientData(brlapi_handle_t *handle)
#define brlapi_gaierrno
Definition: brlapi.h:1280
const char *BRLAPI_STDCALL brlapi_strerror(const brlapi_error_t *error)
int BRLAPI_STDCALL brlapi_leaveTtyMode(void)
void *BRLAPI_STDCALL brlapi_getParameterAlloc(brlapi_param_t parameter, brlapi_param_subparam_t subparam, brlapi_param_flags_t flags, size_t *len)
#define brlapi__ignoreAllKeys(handle)
Definition: brlapi.h:860
int BRLAPI_STDCALL brlapi_getModelIdentifier(char *buffer, size_t size)
ssize_t BRLAPI_STDCALL brlapi__recvRaw(brlapi_handle_t *handle, void *buffer, size_t size)