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

api.h

Go to the documentation of this file.
00001 /* Programs/api.h.  Generated by configure.  */
00002 /*
00003  * libbrlapi - A library providing access to braille terminals for applications.
00004  *
00005  * Copyright (C) 2002-2004 by
00006  *   Samuel Thibault <Samuel.Thibault@ens-lyon.org>
00007  *   Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
00008  * All rights reserved.
00009  *
00010  * libbrlapi comes with ABSOLUTELY NO WARRANTY.
00011  *
00012  * This is free software, placed under the terms of the
00013  * GNU Lesser General Public License, as published by the Free Software
00014  * Foundation; either version 2.1 of the License,
00015  * or (at your option) any later version.
00016  * Please see the file COPYING-API for details.
00017  *
00018  * Web Page: http://mielke.cc/brltty/
00019  *
00020  * This software is maintained by Dave Mielke <dave@mielke.cc>.
00021  */
00022 
00027 #ifndef _BRLAPI_H
00028 #define _BRLAPI_H
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif /* __cplusplus */
00033 
00034 /* Define this to be a string containing the library version. */
00035 #define BRLAPI_RELEASE "0.3.0"
00036 
00037 /* this is for UINT32_MAX */
00038 #include <inttypes.h>
00039 #ifndef UINT32_MAX
00040 #define UINT32_MAX (4294967295U)
00041 #endif /* UINT32_MAX */
00042 
00043 /* The type size_t is defined there! */
00044 #include <unistd.h>
00045 
00048 #define BRLAPI_MAXPACKETSIZE 512
00049 
00061 #define BRLAPI_SOCKETPORTNUM 35751
00062 #define BRLAPI_SOCKETPORT "35751"
00063 
00065 #define BRLAPI_SOCKETPATH "/var/lib/BrlAPI/"
00066 
00071 #define BRLAPI_ETCDIR "/etc"
00072 
00076 #define BRLAPI_AUTHFILE "brlapi.key"
00077 
00079 #define BRLAPI_DEFAUTHPATH BRLAPI_ETCDIR "/" BRLAPI_AUTHFILE
00080 
00111 typedef struct {
00118   char *authKey;
00119 
00128   char *hostName;
00129 } brlapi_settings_t;
00130 
00131 /* brlapi_initializeConnection */
00175 int brlapi_initializeConnection(const brlapi_settings_t *clientSettings, brlapi_settings_t *usedSettings);
00176 
00177 /* brlapi_closeConnection */
00184 void brlapi_closeConnection(void);
00185 
00186 /* brlapi_loadAuthKey */
00199 int brlapi_loadAuthKey(const char *filename, size_t *authlength, void *auth);
00200 
00214 /* brlapi_getDriverId */
00226 int brlapi_getDriverId(unsigned char *id, size_t n);
00227 
00228 /* brlapi_getDriverName */
00240 int brlapi_getDriverName(unsigned char *name, size_t n);
00241 
00242 /* brlapi_getDisplaySize */
00244 int brlapi_getDisplaySize(unsigned int *x, unsigned int *y);
00245 
00270 /* brlapi_getTty */
00296 int brlapi_getTty(int tty, int how);
00297 
00299 #define BRLCOMMANDS 0
00300 
00301 #define BRLKEYCODES 1
00302 
00303 /* brlapi_leaveTty */
00310 int brlapi_leaveTty(void);
00311 
00312 /* brlapi_setFocus */
00323 int brlapi_setFocus(int tty);
00324 
00339 /* brlapi_writeText */
00350 int brlapi_writeText(int cursor, const unsigned char *str);
00351 
00352 /* brlapi_writeDots */
00360 int brlapi_writeDots(const unsigned char *dots);
00361 
00362 /* brlapi_writeStruct */
00364 typedef struct {
00365   int displayNumber; 
00366   unsigned int regionBegin, regionEnd; 
00367   char *text; 
00368   char *attrAnd; 
00369   char *attrOr; 
00370   int cursor; 
00371 } brlapi_writeStruct;
00372 
00373 /* BRLAPI_WRITESTRUCT_INITIALIZER */
00381 #define BRLAPI_WRITESTRUCT_INITIALIZER \
00382   { -1, 0, 0, NULL, NULL, NULL, -1};
00383 
00384 /* brlapi_write */
00391 int brlapi_write(const brlapi_writeStruct *s);
00392 
00415 #define BRL_KEYBUF_SIZE 256
00416 
00421 typedef uint32_t brl_keycode_t;
00422 
00426 #define BRL_KEYCODE_MAX ((brl_keycode_t) (UINT32_MAX))
00427 
00428 /* brlapi_readKey */
00463 int brlapi_readKey(int block, brl_keycode_t *code);
00464 
00465 /* brlapi_ignoreKeyRange */
00474 int brlapi_ignoreKeyRange(brl_keycode_t x, brl_keycode_t y);
00475 
00476 /* brlapi_ignoreKeySet */
00485 int brlapi_ignoreKeySet(const brl_keycode_t *s, unsigned int n);
00486 
00487 /* brlapi_unignoreKeyRange */
00498 int brlapi_unignoreKeyRange(brl_keycode_t x, brl_keycode_t y);
00499 
00500 /* brlapi_unignoreKeySet */
00511 int brlapi_unignoreKeySet(const brl_keycode_t *s, unsigned int n);
00512 
00533 /* brlapi_getRaw */
00536 int brlapi_getRaw(void);
00537 
00538 /* brlapi_leaveRaw */
00541 int brlapi_leaveRaw(void);
00542 
00543 /* brlapi_sendRaw */
00549 ssize_t brlapi_sendRaw(const unsigned char *buf, size_t size);
00550 
00551 /* brlapi_recvRaw */
00558 ssize_t brlapi_recvRaw(unsigned char *buf, size_t size);
00559 
00583 /* Error codes */
00584 #define BRLERR_SUCCESS                  0  
00585 #define BRLERR_NOMEM                    1  
00586 #define BRLERR_TTYBUSY                  2  
00587 #define BRLERR_RAWMODEBUSY              3  
00588 #define BRLERR_UNKNOWN_INSTRUCTION      4  
00589 #define BRLERR_ILLEGAL_INSTRUCTION      5  
00590 #define BRLERR_INVALID_PARAMETER        6  
00591 #define BRLERR_INVALID_PACKET           7  
00592 #define BRLERR_RAWNOTSUPP               8  
00593 #define BRLERR_KEYSNOTSUPP              9  
00594 #define BRLERR_CONNREFUSED             10  
00595 #define BRLERR_OPNOTSUPP               11  
00596 #define BRLERR_GAIERR                  12  
00597 #define BRLERR_LIBCERR                 13  
00598 #define BRLERR_UNKNOWNTTY              14  
00599 #define BRLERR_PROTOCOL_VERSION        15  
00600 #define BRLERR_EOF                     16  
00601 #define BRLERR_TOORECURSE              17  
00602 #define BRLERR_DRIVERERROR             18  
00604 /* brlapi_errlist */
00605 
00609 extern const char *brlapi_errlist[];
00610 
00611 /* brlapi_nerr */
00613 extern const int brlapi_nerr;
00614 
00615 /* brlapi_perror */
00620 void brlapi_perror(const char *s);
00621 
00630 int *brlapi_errno_location(void);
00631 
00637 extern int brlapi_errno;
00639 #define brlapi_errno (*brlapi_errno_location ())
00640 
00641 /* brlapi_strerror */
00647 const char *brlapi_strerror(int err);
00648 
00650 typedef uint32_t brl_type_t;
00651 
00652 /* brlapi_packetType */
00658 const char *brlapi_packetType(brl_type_t ptype);
00659 
00660 /* brlapi_errorHandler_t */
00671 typedef void (*brlapi_errorHandler_t)(int err, brl_type_t type, const void *buf, size_t size);
00672 
00673 /* brlapi_setErrorHandler */
00682 brlapi_errorHandler_t brlapi_setErrorHandler(brlapi_errorHandler_t handler);
00683 void brlapi_defaultErrorHandler(int err, brl_type_t type, const void *buf, size_t size);
00684 
00687 #include <pthread.h>
00688 
00689 /* brlapi_fd_mutex */
00715 extern pthread_mutex_t brlapi_fd_mutex;
00716 
00717 #ifdef __cplusplus
00718 }
00719 #endif /* __cplusplus */
00720 
00721 #endif /* _BRLAPI_H */

Generated on Wed Dec 22 14:19:02 2004 for BrlAPI by  doxygen 1.3.9.1