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

BrlAPI's protocol

Instructions and constants for BrlAPI 's protocol. More...

Data Structures

struct  header_t
struct  authStruct
struct  errorPacket_t
struct  getRawPacket_t
struct  writeStruct

Defines

#define BRLPACKET_AUTHKEY   'K'
#define BRLPACKET_GETDRIVERID   'd'
#define BRLPACKET_GETDRIVERNAME   'n'
#define BRLPACKET_GETDISPLAYSIZE   's'
#define BRLPACKET_GETTTY   't'
#define BRLPACKET_SETFOCUS   'F'
#define BRLPACKET_LEAVETTY   'L'
#define BRLPACKET_KEY   'k'
#define BRLPACKET_IGNOREKEYRANGE   'm'
#define BRLPACKET_IGNOREKEYSET   'M'
#define BRLPACKET_UNIGNOREKEYRANGE   'u'
#define BRLPACKET_UNIGNOREKEYSET   'U'
#define BRLPACKET_WRITE   'w'
#define BRLPACKET_GETRAW   '*'
#define BRLPACKET_LEAVERAW   '#'
#define BRLPACKET_PACKET   'p'
#define BRLPACKET_ACK   'A'
#define BRLPACKET_ERROR   'e'
#define BRLPACKET_EXCEPTION   'E'
#define BRLRAW_MAGIC   (0xdeadbeefL)
#define BRLAPI_WF_DISPLAYNUMBER   0X01
#define BRLAPI_WF_REGION   0X02
#define BRLAPI_WF_TEXT   0X04
#define BRLAPI_WF_ATTR_AND   0X08
#define BRLAPI_WF_ATTR_OR   0X10
#define BRLAPI_WF_CURSOR   0X20
#define BRLAPI_WF_CHARSET   0X40

Functions

ssize_t brlapi_writePacket (int fd, brl_type_t type, const void *buf, size_t size)
ssize_t brlapi_readPacketHeader (int fd, brl_type_t *packetType)
ssize_t brlapi_readPacketContent (int fd, size_t packetSize, void *buf, size_t bufSize)
ssize_t brlapi_readPacket (int fd, brl_type_t *type, void *buf, size_t size)

Variables

pthread_mutex_t brlapi_fd_mutex

Detailed Description

These are defines for the protocol between BrlAPI 's server and clients. Understanding is not needed to use the BrlAPI library, so reading this is not needed unless really wanting to connect to BrlAPI without BrlAPI 's library.

Define Documentation

#define BRLAPI_WF_ATTR_AND   0X08
 

And attributes

#define BRLAPI_WF_ATTR_OR   0X10
 

Or attributes

#define BRLAPI_WF_CHARSET   0X40
 

Charset

#define BRLAPI_WF_CURSOR   0X20
 

Cursor position

#define BRLAPI_WF_DISPLAYNUMBER   0X01
 

Flags for writing Display number

#define BRLAPI_WF_REGION   0X02
 

Region parameter

#define BRLAPI_WF_TEXT   0X04
 

Contains some text

#define BRLPACKET_ACK   'A'
 

Acknowledgement

#define BRLPACKET_AUTHKEY   'K'
 

Authentication key

#define BRLPACKET_ERROR   'e'
 

non-fatal error

#define BRLPACKET_EXCEPTION   'E'
 

Exception

#define BRLPACKET_GETDISPLAYSIZE   's'
 

Dimensions of brl display

#define BRLPACKET_GETDRIVERID   'd'
 

Ask which driver is used

#define BRLPACKET_GETDRIVERNAME   'n'
 

Ask which driver is used

#define BRLPACKET_GETRAW   '*'
 

Enter in raw mode

#define BRLPACKET_GETTTY   't'
 

Asks for a specified tty

#define BRLPACKET_IGNOREKEYRANGE   'm'
 

Mask key-range

#define BRLPACKET_IGNOREKEYSET   'M'
 

Mask key-set

#define BRLPACKET_KEY   'k'
 

Braille key

#define BRLPACKET_LEAVERAW   '#'
 

Leave raw mode

#define BRLPACKET_LEAVETTY   'L'
 

Release the tty

#define BRLPACKET_PACKET   'p'
 

Raw packets

#define BRLPACKET_SETFOCUS   'F'
 

Set current tty focus

#define BRLPACKET_UNIGNOREKEYRANGE   'u'
 

Unmask key range

#define BRLPACKET_UNIGNOREKEYSET   'U'
 

Unmask key set

#define BRLPACKET_WRITE   'w'
 

Write

#define BRLRAW_MAGIC   (0xdeadbeefL)
 

Magic number to give when sending a BRLPACKET_GETRAW packet


Function Documentation

ssize_t brlapi_readPacket int  fd,
brl_type_t type,
void *  buf,
size_t  size
 

Read a packet from BrlAPI server

This function is for internal use, but one might use it if one really knows what one is doing...

type is where the function will store the packet type; it should always be one of the above defined BRLPACKET_* (or else something very nasty must have happened :/).

The syntax is the same as read()'s.

Returns:
packet's size, -2 if EOF occurred, -1 on error. If the packet is larger than the supplied buffer, the buffer will be filled with the beginning of the packet, the rest of the packet being discarded. This follows the semantics of the recv system call when the MSG_TRUNC option is given.
See also:
brlapi_writePacket()

ssize_t brlapi_readPacketContent int  fd,
size_t  packetSize,
void *  buf,
size_t  bufSize
 

Read the content of a packet from BrlAPI server

This function is for internal use, but one might use it if one really knows what one is doing...

packetSize is the size announced by brlapi_readPacketHeader()

bufSize is the size of buf

Returns:
packetSize, -2 if EOF occurred, -1 on error. If the packet is larger than the supplied buffer, the buffer will be filled with the beginning of the packet, the rest of the packet being discarded. This follows the semantics of the recv system call when the MSG_TRUNC option is given.
See also:
brlapi_writePacket() brlapi_readPacketHeader() brlapi_readPacket()

ssize_t brlapi_readPacketHeader int  fd,
brl_type_t packetType
 

Read the header (type+size) of a packet from BrlAPI server

This function is for internal use, but one might use it if one really knows what one is doing...

type is where the function will store the packet type; it should always be one of the above defined BRLPACKET_* (or else something very nasty must have happened :/).

Returns:
packet's size, -2 if EOF occurred, -1 on error.
See also:
brlapi_writePacket() brlapi_readPacketContent brlapi_readPacket

ssize_t brlapi_writePacket int  fd,
brl_type_t  type,
const void *  buf,
size_t  size
 

Send a packet to BrlAPI server

This function is for internal use, but one might use it if one really knows what one is doing...

type should only be one of the above defined BRLPACKET_*.

The syntax is the same as write()'s.

Returns:
0 on success, -1 on failure
See also:
brlapi_readPacketHeader() brlapi_readPacketContent() brlapi_readPacket()


Variable Documentation

pthread_mutex_t brlapi_fd_mutex
 

Mutex for protecting concurrent fd access

In order to regulate concurrent access to the library's file descriptor and requests to / answers from BrlAPI server, every function of the library locks this mutex, namely

If both these functions and brlapi_writePacket() or brlapi_readPacket() are used in a multithreaded application, this mutex must be locked before calling brlapi_writePacket() or brlapi_readPacket(), and unlocked afterwards.


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