What would be an IPC library without the ability to read and write data? Not very useful. Libassuan has high level functions to take care of of the more boring stuff but eventually data needs to be written and read.
The basic read and write functions are:
Read the next line from the client or server and store a pointer to the buffer holding that line at the address line. The valid length of the lines is stored at the address of linelen. This buffer is valid until the next read operation on the same context ctx. You may modify the context of this buffer. The buffer is invalid (i.e. must not be used) if an error is returned. This function returns
0
on success or an error code.
Write the string line to the other end. This string needs to be a proper formatted Assuan protocol line and should not include a linefeed. Sending linefeed or Nul characters is not possible and not allowed by the assuan protocol. This function shall not be used for sending data (D) lines. This function returns
0
on success or an error code.
To actually send bulk data lines a specialized function is available:
This function is used by a server or a client to send length bytes of bulk data in buffer to the other end. The data will be escaped as required by the Assuan protocol and may get buffered until a line is full. To force sending the data out buffer may be passed as
NULL
and length be0
.When used by a client this flush operation does also send the terminating
END
command to terminate the response on an “INQUIRE” response. Note that the functionassuan_transact
takes care of sending thisEND
itself.This function returns
0
on success or an error code.