Main Page | Modules | Data Structures | File List | Data Fields | Globals

brlapi.h

Go to the documentation of this file.
00001 /* Programs/brlapi.h. Generated by configure. */ 00002 /* 00003 * BRLTTY - A background process providing access to the Linux console (when in 00004 * text mode) for a blind person using a refreshable braille display. 00005 * 00006 * Copyright (C) 1995-2003 by The BRLTTY Team. All rights reserved. 00007 * 00008 * BRLTTY comes with ABSOLUTELY NO WARRANTY. 00009 * 00010 * This is free software, placed under the terms of the 00011 * GNU General Public License, as published by the Free Software 00012 * Foundation. Please see the file COPYING for details. 00013 * 00014 * Web Page: http://mielke.cc/brltty/ 00015 * 00016 * This software is maintained by Dave Mielke <dave@mielke.cc>. 00017 */ 00018 00023 #ifndef _BRLAPI_H 00024 #define _BRLAPI_H 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif /* __cplusplus */ 00029 00030 /* Define this to be a string containing the library version. */ 00031 #define BRLAPI_RELEASE "0.1.1" 00032 00033 /* this is for UINT32_MAX */ 00034 #include <inttypes.h> 00035 #ifndef UINT32_MAX 00036 #define UINT32_MAX (4294967295U) 00037 #endif /* UINT32_MAX */ 00038 00039 /* The type size_t is defined there! */ 00040 #include <unistd.h> 00041 00053 #define BRLAPI_SOCKETPORT "35751" 00054 00059 #define BRLAPI_ETCDIR "/etc" 00060 00064 #define BRLAPI_AUTHFILE "brlapi.key" 00065 00067 #define BRLAPI_AUTHNAME BRLAPI_ETCDIR "/" BRLAPI_AUTHFILE 00068 00099 typedef struct 00100 { 00107 char *authKey; 00108 00117 char *hostName; 00118 } brlapi_settings_t; 00119 00120 /* brlapi_initializeConnection */ 00161 int brlapi_initializeConnection(const brlapi_settings_t *clientSettings, brlapi_settings_t *usedSettings); 00162 00163 /* brlapi_closeConnection */ 00171 void brlapi_closeConnection(void); 00172 00173 /* brlapi_loadAuthKey */ 00186 int brlapi_loadAuthKey(const char *filename, int *authlength, void *auth); 00187 00188 /* brlapi_getControllingTty */ 00210 int brlapi_getControllingTty(void); 00211 00225 /* brlapi_getDriverId */ 00232 char *brlapi_getDriverId(void); 00233 00234 /* brlapi_getDriverName */ 00241 char *brlapi_getDriverName(void); 00242 00243 /* brlapi_getDisplaySize */ 00245 int brlapi_getDisplaySize(unsigned int *x, unsigned int *y); 00246 00257 typedef struct 00258 { 00263 const char *client; 00264 } brlapi_keybinding_t; 00265 00288 /* brlapi_getTty */ 00304 int brlapi_getTty(uint32_t tty, uint32_t how, brlapi_keybinding_t *keybinding); 00305 00307 #define BRLKEYCODES ((uint32_t) 1) 00308 00309 #define BRLCOMMANDS ((uint32_t) 2) 00310 00311 /* brlapi_leaveTty */ 00316 int brlapi_leaveTty(void); 00317 00332 /* brlapi_writeBrl */ 00343 int brlapi_writeBrl(uint32_t cursor, const char *str); 00344 00345 /* brlapi_writeBrlDots */ 00353 int brlapi_writeBrlDots(const char *dots); 00354 00377 #define BRL_KEYBUF_SIZE 256 00378 00383 typedef uint32_t brl_keycode_t; 00384 00388 #define BRL_KEYCODE_MAX ((brl_keycode_t) (UINT32_MAX)) 00389 00390 /* brlapi_readKey */ 00414 int brlapi_readKey(int block, brl_keycode_t *code); 00415 00416 /* brlapi_readCommand */ 00438 int brlapi_readCommand(int block, brl_keycode_t *code); 00439 00444 #define BRLAPI_HOMEKEYDIR ".brlkeys" 00445 00448 #define BRLAPI_HOMEKEYEXT ".kbd" 00449 00455 #define BRLAPI_ETCKEYFILE "brlkeys" 00456 00457 /* brlapi_readBinding */ 00475 int brlapi_readBinding(int block, const char **code); 00476 00477 /* brlapi_ignoreKeys */ 00486 int brlapi_ignoreKeys(brl_keycode_t x, brl_keycode_t y); 00487 00488 /* brlapi_unignoreKeys */ 00499 int brlapi_unignoreKeys(brl_keycode_t x, brl_keycode_t y); 00500 00521 /* brlapi_getRaw */ 00524 int brlapi_getRaw(void); 00525 00526 /* brlapi_leaveRaw */ 00529 int brlapi_leaveRaw(void); 00530 00531 /* brlapi_sendRaw */ 00537 int brlapi_sendRaw(const unsigned char *buf, size_t size); 00538 00539 /* brlapi_recvRaw */ 00546 int brlapi_recvRaw(unsigned char *buf, size_t size); 00547 00555 /* Error codes */ 00556 #define BRLERR_SUCCESS 0 00557 #define BRLERR_NOMEM 1 00558 #define BRLERR_TTYBUSY 2 00559 #define BRLERR_UNKNOWN_INSTRUCTION 3 00560 #define BRLERR_ILLEGAL_INSTRUCTION 4 00561 #define BRLERR_INVALID_PARAMETER 5 00562 #define BRLERR_INVALID_PACKET 6 00563 #define BRLERR_RAWNOTSUPP 7 00564 #define BRLERR_KEYSNOTSUPP 8 00565 #define BRLERR_CONNREFUSED 9 00566 #define BRLERR_OPNOTSUPP 10 00567 #define BRLERR_GAIERR 11 00568 #define BRLERR_LIBCERR 12 00569 #define BRLERR_UNKNOWNTTY 13 00571 /* brlapi_errlist */ 00572 00576 extern const char *brlapi_errlist[]; 00577 00578 /* brlapi_nerr */ 00580 extern const int brlapi_nerr; 00581 00582 /* brlapi_perror */ 00587 void brlapi_perror(const char *s); 00588 00597 int *brlapi_errno_location(void); 00598 00604 extern int brlapi_errno; 00606 #define brlapi_errno (*brlapi_errno_location ()) 00607 00622 #define BRLAPI_MAXPACKETSIZE 512 00623 00625 typedef uint32_t brl_type_t; 00626 00627 #define BRLPACKET_AUTHKEY 'K' 00628 #define BRLPACKET_BYE 'B' 00629 #define BRLPACKET_GETDRIVERID 'd' 00630 #define BRLPACKET_GETDRIVERNAME 'n' 00631 #define BRLPACKET_GETDISPLAYSIZE 's' 00632 #define BRLPACKET_GETTTY 't' 00633 #define BRLPACKET_LEAVETTY 'L' 00634 #define BRLPACKET_KEY 'k' 00635 #define BRLPACKET_COMMAND 'c' 00636 #define BRLPACKET_MASKKEYS 'm' 00637 #define BRLPACKET_UNMASKKEYS 'u' 00638 #define BRLPACKET_WRITE 'W' 00639 #define BRLPACKET_WRITEDOTS 'D' 00640 #define BRLPACKET_STATWRITE 'S' 00641 #define BRLPACKET_GETRAW '*' 00642 #define BRLPACKET_LEAVERAW '#' 00643 #define BRLPACKET_PACKET 'p' 00644 #define BRLPACKET_ACK 'A' 00645 #define BRLPACKET_ERROR 'E' 00648 #define BRLRAW_MAGIC (0xdeadbeefL) 00649 00650 /* brlapi_writePacket */ 00661 int brlapi_writePacket(int fd, brl_type_t type, const void *buf, size_t size); 00662 00663 /* brlapi_readPacket */ 00676 int brlapi_readPacket(int fd, brl_type_t *type, void *buf, size_t size); 00677 00678 #include <pthread.h> 00679 00680 /* brlapi_fd_mutex */ 00706 extern pthread_mutex_t brlapi_fd_mutex; 00707 00710 #ifdef __cplusplus 00711 } 00712 #endif /* __cplusplus */ 00713 00714 #endif /* _BRLAPI_H */

Generated on Sun Jul 25 09:00:34 2004 for BrlAPI by doxygen 1.3.7