BrlAPI: api_protocol.h Source File

Main Page | Modules | Data Structures | 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-2004 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 _BRLAPI_PROTOCOL_H
    00027 #define _BRLAPI_PROTOCOL_H
    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) 6)
    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 protocolVersion;
    00080   unsigned char key;
    00081 } authStruct;
    00082
    00084 typedef struct {
    00085   uint32_t code;
    00086   brl_type_t type;
    00087   unsigned char packet;
    00088 } errorPacket_t;
    00089
    00091 #define BRLAPI_WF_DISPLAYNUMBER 0X01
    00092 #define BRLAPI_WF_REGION        0X02
    00093 #define BRLAPI_WF_TEXT          0X04
    00094 #define BRLAPI_WF_ATTR_AND      0X08
    00095 #define BRLAPI_WF_ATTR_OR       0X10
    00096 #define BRLAPI_WF_CURSOR        0X20
    00099 typedef struct {
    00100   uint32_t flags;
    00101   unsigned char data;
    00102 } writeStruct;
    00103
    00104 /* brlapi_writePacket */
    00118 ssize_t brlapi_writePacket(int fd, brl_type_t type, const void *buf, size_t size);
    00119
    00120 /* brlapi_readPacket */
    00136 ssize_t brlapi_readPacket(int fd, brl_type_t *type, void *buf, size_t size);
    00137
    00138 #ifdef __cplusplus
    00139 }
    00140 #endif /* __cplusplus */
    00141
    00142 #endif /* _BRLAPI_PROTOCOL_H */