brlapi_connection(3) | Library Functions Manual | brlapi_connection(3) |
brlapi_connection - Connecting to BrlAPI
struct brlapi_connectionSettings_t
Settings structure for BrlAPI connection.
#define BRLAPI_SOCKETPORTNUM 4101
#define BRLAPI_SOCKETPORT '4101'
#define BRLAPI_SOCKETPATH '/var/lib/BrlAPI'
#define BRLAPI_ETCDIR '/etc'
#define BRLAPI_AUTHKEYFILE 'brlapi.key'
#define BRLAPI_DEFAUTH_KEYFILE 'keyfile:' BRLAPI_ETCDIR '/'
BRLAPI_AUTHKEYFILE
#define BRLAPI_DEFAUTH_POLKIT ''
#define BRLAPI_DEFAUTH BRLAPI_DEFAUTH_KEYFILE
BRLAPI_DEFAUTH_POLKIT
#define BRLAPI_INVALID_FILE_DESCRIPTOR -1
#define BRLAPI_SETTINGS_INITIALIZER { NULL, NULL }
typedef int brlapi_fileDescriptor
brlapi_fileDescriptor BRLAPI_STDCALL
brlapi_openConnection (const brlapi_connectionSettings_t
*desiredSettings, brlapi_connectionSettings_t *actualSettings)
brlapi_fileDescriptor BRLAPI_STDCALL
brlapi__openConnection (brlapi_handle_t *handle, const
brlapi_connectionSettings_t *desiredSettings,
brlapi_connectionSettings_t *actualSettings)
brlapi_fileDescriptor BRLAPI_STDCALL
brlapi_getFileDescriptor (void)
brlapi_fileDescriptor BRLAPI_STDCALL
brlapi__getFileDescriptor (brlapi_handle_t *handle)
void BRLAPI_STDCALL brlapi_closeConnection (void)
void BRLAPI_STDCALL brlapi__closeConnection
(brlapi_handle_t *handle)
Before calling any other function of the library, calling brlapi_openConnection() is needed to establish a connection to BrlAPI 's server. When the connection is not needed any more, brlapi_closeConnection() must be called to close the connection.
Default name of the file containing BrlAPI 's authorization key
This name is relative to BRLAPI_ETCDIR
Default authorization setting
brltty 's settings directory
This is where authorization key and driver-dependent key names are found for instance.
Invalid value for brlapi_fileDescriptor
This is returned by brlapi_getFileDescriptor() when the connection is closed.
Allows to initialize a structure of type brlapi_connectionSettings_t * with default values.
Default unix path on which connections to BrlAPI can be established
Default port number on which connections to BrlAPI can be established
OS-dependent file descriptor type
This is the type for file descriptors returned by brlapi_openConnection() and brlapi_getFileDescriptor().
Cleanly close the socket
This function locks until a closing acknowledgement is received from the server. The socket is then freed, so the file descriptor brlapi_openConnection() gave has no meaning any more
Return the file descriptor used by the BrlAPI connection
This allows to use it with select(), g_io_add_watch(), XtAppAddInput(), etc.
BRLAPI_INVALID_FILE_DESCRIPTOR is returned when the connection was closed.
Open a socket and connect it to BrlAPI 's server
This function first loads an authorization key as specified in settings. It then creates a TCP socket and connects it to the specified machine, on the specified port. It writes the authorization key on the socket and waits for acknowledgement.
Returns
Note
Example:
if (brlapi_openConnection(&settings,&settings)<0) { fprintf(stderr,"couldn't connect to BrlAPI at %s: %s\n", settings.host, brlapi_strerror(&brlapi_error)); exit(1); }
Errors:
Parameters
See also
Generated automatically by Doxygen for BrlAPI from the source code.
Version 0.8 | BrlAPI |