eid-viewer
eid-viewer library
|
Callbacks which the backend can perform towards the UI. More...
#include <oslayer.h>
Data Fields | |
int | version |
The version number of this struct. More... | |
void(* | newsrc )(enum eid_vwr_source new_source) |
Called when the data source has changed. More... | |
void(* | newstringdata )(const EID_CHAR *label, const EID_CHAR *data) |
new string data to be displayed in UI. More... | |
void(* | newbindata )(const EID_CHAR *label, const unsigned char *data, int datalen) |
New binary data to be displayed in UI. More... | |
void(* | log )(enum eid_vwr_loglevel level, const EID_CHAR *line) |
Log a string at the given level. More... | |
void(* | logv )(enum eid_vwr_loglevel level, const EID_CHAR *line, va_list ap) |
Log a string using varargs. More... | |
void(* | newstate )(enum eid_vwr_states new_state) |
State machine transition. More... | |
void(* | pinop_result )(enum eid_vwr_pinops op, enum eid_vwr_result res) |
Return the result of a PIN operation. More... | |
void(* | readers_changed )(unsigned long nreaders, slotdesc *slots) |
The number of known readers has changed. More... | |
void(* | challenge_result )(const unsigned char *response, int responselen, enum eid_vwr_result res) |
Return the result of a challenge operation. More... | |
Callbacks which the backend can perform towards the UI.
To ensure forward compatibility, a UI implementation must call eid_vwr_cbstruct() to allocate an eid_vwr_ui_callbacks struct. Failure to do so may result in crashes in future versions of the eid-viewer library.
An implementation may leave one or more of the below function pointers empty (i.e., at NULL). If this happens, the backend will simply not issue that event.
void(* challenge_result) (const unsigned char *response, int responselen, enum eid_vwr_result res) |
Return the result of a challenge operation.
When the user interface calls eid_vwr_challenge(), then at some later point this function may be called with the result of the requested PIN operation.
If the state machine is not in the TOKEN_WAIT state when eid_vwr_challenge() was called, this event will never be fired.
response | the response calculated by the card. |
responselen | the length of the response, in bytes. |
res | the result of the operation |
void(* log) (enum eid_vwr_loglevel level, const EID_CHAR *line) |
void(* logv) (enum eid_vwr_loglevel level, const EID_CHAR *line, va_list ap) |
Log a string using varargs.
The advantage of having this function (as opposed to log()) is that it allows for allocating a string using whatever memory management the frontend uses. If this is not necessary or desirable, implementing log() rather than this function should suffice.
level | the level at which to log. |
line | the printf()-formatted string to log. |
ap | arguments to line's format string. |
void(* newbindata) (const EID_CHAR *label, const unsigned char *data, int datalen) |
New binary data to be displayed in UI.
Data with the given label and which should be interpreted as a binary blob was found. This will not change when the language is modified.
label | the label (identifier) of the data item. Should never change. |
data | the data as it is on the card. |
datalen | the length of the data, in bytes. |
void(* newsrc) (enum eid_vwr_source new_source) |
Called when the data source has changed.
When the viewer library starts looking at a new file or eID card, this event is issued. When this happens, a user interface should clear whatever data it has received from the backend – it is not valid anymore.
new_source | the type of the new source. |
void(* newstate) (enum eid_vwr_states new_state) |
State machine transition.
This event is issued whenever the state machine changes state. For more information, see the state machine diagram as documented at struct eid_vwr_states.
new_state | the new state we're in right now. |
void(* newstringdata) (const EID_CHAR *label, const EID_CHAR *data) |
new string data to be displayed in UI.
Data with the given label and which should be interpreted as a string was found. These may be re-issued (with modified data) after a call to eid_vwr_convert_set_lang().
label | the label (identifier) of the data item. Should never change. |
data | the data as represented in the currently active language. |
void(* pinop_result) (enum eid_vwr_pinops op, enum eid_vwr_result res) |
Return the result of a PIN operation.
When the user interface calls eid_vwr_pinop(), then at some later point this function may be called with the result of the requested PIN operation.
If the state machine is not in the TOKEN_WAIT state when eid_vwr_pinop() was called, this event will never be fired.
op | the operation for which this is a result |
res | the result of the operation |
void(* readers_changed) (unsigned long nreaders, slotdesc *slots) |
The number of known readers has changed.
nreaders | the new reader count |
slots | the slot IDs and human-readable descriptions of all known readers |
int version |
The version number of this struct.
This version number exists for backwards compatibility reasons. When the eid_vwr_cbstruct() function is called, this version number will be set to the latest version supported by the backend (0 for now). Frontend code should check the version number. If it is higher than the most recently supported version at the time of writing of the frontend code, then the frontend code should change the version number so it reflects the most recent version it supports.
If the version is lower, it should not touch the version number.