00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00026 #ifndef BRLTTY_INCLUDED_API_PROTOCOL
00027 #define BRLTTY_INCLUDED_API_PROTOCOL
00028
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032
00033
00034 #include <inttypes.h>
00035 #ifndef UINT32_MAX
00036 #define UINT32_MAX (4294967295U)
00037 #endif
00038
00039
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
00136 ssize_t brlapi_writePacket(int fd, brl_type_t type, const void *buf, size_t size);
00137
00138
00154 ssize_t brlapi_readPacketHeader(int fd, brl_type_t *packetType);
00155
00156
00176 ssize_t brlapi_readPacketContent(int fd, size_t packetSize, void *buf, size_t bufSize);
00177
00178
00198 ssize_t brlapi_readPacket(int fd, brl_type_t *type, void *buf, size_t size);
00199
00200
00226 #ifdef __MINGW32__
00227 #include <windows.h>
00228 extern HANDLE brlapi_fd_mutex;
00229 #else
00230 #include <pthread.h>
00231 extern pthread_mutex_t brlapi_fd_mutex;
00232 #endif
00233
00234
00235
00236 #ifdef __cplusplus
00237 }
00238 #endif
00239
00240 #endif