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

api_protocol.h

Go to the documentation of this file.
00001 /*
00002  * libbrlapi - A library providing access to braille terminals for applications.
00003  *
00004  * Copyright (C) 2002-2005 by
00005  *   Samuel Thibault <Samuel.Thibault@ens-lyon.org>
00006  *   Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
00007  * All rights reserved.
00008  *
00009  * libbrlapi comes with ABSOLUTELY NO WARRANTY.
00010  *
00011  * This is free software, placed under the terms of the
00012  * GNU Lesser General Public License, as published by the Free Software
00013  * Foundation; either version 2.1 of the License,
00014  * or (at your option) any later version.
00015  * Please see the file COPYING-API for details.
00016  *
00017  * Web Page: http://mielke.cc/brltty/
00018  *
00019  * This software is maintained by Dave Mielke <dave@mielke.cc>.
00020  */
00021 
00026 #ifndef BRLTTY_INCLUDED_API_PROTOCOL
00027 #define BRLTTY_INCLUDED_API_PROTOCOL
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif /* __cplusplus */
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 
00052 #define BRLAPI_PROTOCOL_VERSION ((uint32_t) 7) 
00054 #define BRLPACKET_AUTHKEY           'K'    
00055 #define BRLPACKET_GETDRIVERID       'd'    
00056 #define BRLPACKET_GETDRIVERNAME     'n'    
00057 #define BRLPACKET_GETDISPLAYSIZE    's'    
00058 #define BRLPACKET_GETTTY            't'    
00059 #define BRLPACKET_SETFOCUS          'F'    
00060 #define BRLPACKET_LEAVETTY          'L'    
00061 #define BRLPACKET_KEY               'k'    
00062 #define BRLPACKET_IGNOREKEYRANGE    'm'    
00063 #define BRLPACKET_IGNOREKEYSET      'M'    
00064 #define BRLPACKET_UNIGNOREKEYRANGE  'u'    
00065 #define BRLPACKET_UNIGNOREKEYSET    'U'    
00066 #define BRLPACKET_WRITE             'w'    
00067 #define BRLPACKET_GETRAW            '*'    
00068 #define BRLPACKET_LEAVERAW          '#'    
00069 #define BRLPACKET_PACKET            'p'    
00070 #define BRLPACKET_ACK               'A'    
00071 #define BRLPACKET_ERROR             'e'    
00072 #define BRLPACKET_EXCEPTION         'E'    
00075 #define BRLRAW_MAGIC (0xdeadbeefL)
00076 
00078 typedef struct {
00079   uint32_t size;
00080   brl_type_t type;
00081 } header_t;
00082 
00083 #define HEADERSIZE sizeof(header_t)
00084 
00086 typedef struct {
00087   uint32_t protocolVersion;
00088   unsigned char key;
00089 } authStruct;
00090 
00092 typedef struct {
00093   uint32_t code;
00094   brl_type_t type;
00095   unsigned char packet;
00096 } errorPacket_t;
00097 
00099 typedef struct {
00100   uint32_t magic;
00101   unsigned char nameLength;
00102   unsigned char name;
00103 } getRawPacket_t;
00104 
00106 #define BRLAPI_WF_DISPLAYNUMBER 0X01    
00107 #define BRLAPI_WF_REGION        0X02    
00108 #define BRLAPI_WF_TEXT          0X04    
00109 #define BRLAPI_WF_ATTR_AND      0X08    
00110 #define BRLAPI_WF_ATTR_OR       0X10    
00111 #define BRLAPI_WF_CURSOR        0X20    
00112 #define BRLAPI_WF_CHARSET       0X40    
00115 typedef struct {
00116   uint32_t flags; 
00117   unsigned char data; 
00118 } writeStruct;
00119 
00120 /* brlapi_writePacket */
00136 ssize_t brlapi_writePacket(int fd, brl_type_t type, const void *buf, size_t size);
00137 
00138 /* brlapi_readPacketHeader */
00154 ssize_t brlapi_readPacketHeader(int fd, brl_type_t *packetType);
00155 
00156 /* brlapi_readPacketContent */
00176 ssize_t brlapi_readPacketContent(int fd, size_t packetSize, void *buf, size_t bufSize);
00177 
00178 /* brlapi_readPacket */
00198 ssize_t brlapi_readPacket(int fd, brl_type_t *type, void *buf, size_t size);
00199 
00200 /* brlapi_fd_mutex */
00226 #ifdef __MINGW32__
00227 #include <windows.h>
00228 extern HANDLE brlapi_fd_mutex;
00229 #else /* __MINGW32__ */
00230 #include <pthread.h>
00231 extern pthread_mutex_t brlapi_fd_mutex;
00232 #endif /* __MINGW32__ */
00233 
00234 /* @} */
00235 
00236 #ifdef __cplusplus
00237 }
00238 #endif /* __cplusplus */
00239 
00240 #endif /* BRLTTY_INCLUDED_API_PROTOCOL */

Generated on Mon Dec 12 08:29:10 2005 for BrlAPI by  doxygen 1.4.4