eid-viewer
eid-viewer library
Loading...
Searching...
No Matches
oslayer.h
Go to the documentation of this file.
1
12#ifndef EID_VWR_OSLAYER_H
13#define EID_VWR_OSLAYER_H
14
15#include <stdlib.h>
16#include <stdarg.h>
17#include <eid-util/utftranslate.h>
18#include <eid-viewer/macros.h>
19
20typedef struct _slotdesc slotdesc;
21
24{
25 unsigned long slot;
26 EID_CHAR *description;
27};
28
37
53
60
69
99
109
112{
115 //EID_VWR_GRAPH_VERSION_NINE, ///< version nine
116};
117
130{
131
148
158 void (*newsrc) (enum eid_vwr_source new_source);
159
172 void (*newstringdata) (const EID_CHAR * label, const EID_CHAR * data);
173
185 void (*newbindata) (const EID_CHAR * label, const unsigned char *data,
186 int datalen);
187
196 void (*log) (enum eid_vwr_loglevel level, const EID_CHAR * line);
197
213 void (*logv) (enum eid_vwr_loglevel level, const EID_CHAR * line,
214 va_list ap);
215
224 void (*newstate) (enum eid_vwr_states new_state);
225
238 void (*pinop_result) (enum eid_vwr_pinops op,
239 enum eid_vwr_result res);
240
247 void (*readers_changed) (unsigned long nreaders, slotdesc * slots);
248
262 void(*challenge_result)(const unsigned char* response, int responselen, enum eid_vwr_result res);
263};
264
267{
268 void *imagedata;
269 size_t imagelen;
271};
272
275{
276 unsigned char* challenge;
278 unsigned char* response;
279 size_t responselen;
280 enum eid_vwr_result result;
281};
282
292DllExport void eid_vwr_pinop(enum eid_vwr_pinops op);
293
294
303DllExport int eid_vwr_challenge(const unsigned char* challenge, int challengelen);
304
305
318DllExport int eid_vwr_createcallbacks(struct eid_vwr_ui_callbacks *cb);
319
331DllExport struct eid_vwr_ui_callbacks *eid_vwr_cbstruct(void);
332
341DllExport struct eid_vwr_preview *eid_vwr_get_preview(const EID_CHAR *
342 filename);
343
349DllExport void eid_vwr_release_preview(struct eid_vwr_preview *prv);
350
360DllExport int eid_vwr_poll(void);
361
367#ifdef WIN32
368DWORD WINAPI eid_vwr_wait_for_pkcs11_event_loop(void* val);
369#else
370
376void* eid_vwr_be_mainloop(void* val) NORETURN;
377#endif
378
379
380
392DllExport void eid_vwr_be_serialize(const EID_CHAR * target_file);
393
404DllExport void eid_vwr_be_export_photo(const EID_CHAR * target_file);
405
416DllExport void eid_vwr_be_deserialize(const EID_CHAR * source_file);
417
430DllExport const char *eid_vwr_be_get_xmlform(void);
431
440DllExport void eid_vwr_be_select_slot(int automatic,
441 unsigned long manualslot);
442
460DllExport void eid_vwr_be_set_invalid(void);
461
467DllExport void eid_vwr_close_file(void);
468
479DllExport void eid_vwr_convert_set_lang(enum eid_vwr_langs which);
480
487DllExport enum eid_vwr_langs eid_vwr_convert_get_lang(void);
488
489DllExport void eid_vwr_init_crypto(void);
490
493#endif
DllExport int eid_vwr_createcallbacks(struct eid_vwr_ui_callbacks *cb)
Initialize the callbacks.
Definition oslayer.c:13
eid_vwr_states
Possible states.
Definition oslayer.h:75
DllExport const char * eid_vwr_be_get_xmlform(void)
Get the currently-open data in XML form.
Definition oslayer.c:126
DllExport void eid_vwr_be_select_slot(int automatic, unsigned long manualslot)
Select the current reader.
Definition oslayer.c:139
DllExport void eid_vwr_be_deserialize(const EID_CHAR *source_file)
Open a file.
Definition oslayer.c:121
DllExport void eid_vwr_close_file(void)
Close the current file.
Definition oslayer.c:147
DllExport int eid_vwr_poll(void)
Check if there is an event to be handled.
Definition oslayer.c:57
DllExport void eid_vwr_release_preview(struct eid_vwr_preview *prv)
Release the data returned by eid_vwr_get_preview()
Definition preview.c:54
eid_vwr_result
Definition oslayer.h:63
DllExport enum eid_vwr_langs eid_vwr_convert_get_lang(void)
Return the backend language.
Definition convert.cpp:83
DllExport void eid_vwr_convert_set_lang(enum eid_vwr_langs which)
Set the backend language.
Definition convert.cpp:54
eid_vwr_graphvers
Definition oslayer.h:112
DllExport void eid_vwr_be_export_photo(const EID_CHAR *target_file)
Export the photo from eid card as a JPEG file.
Definition oslayer.c:116
eid_vwr_source
Definition oslayer.h:31
DllExport void eid_vwr_be_serialize(const EID_CHAR *target_file)
Save the currently-open data.
Definition oslayer.c:111
DllExport struct eid_vwr_preview * eid_vwr_get_preview(const EID_CHAR *filename)
Create a preview for the given file.
Definition preview.c:16
void * eid_vwr_be_mainloop(void *val) NORETURN
Loops over waiting function for pkcs11 card and reader insertion/removal event.
DllExport struct eid_vwr_ui_callbacks * eid_vwr_cbstruct(void)
Create the eid_vwr_ui_callbacks struct.
Definition backend.c:63
eid_vwr_loglevel
Log levels.
Definition oslayer.h:43
DllExport void eid_vwr_pinop(enum eid_vwr_pinops op)
Perform a PIN operation.
Definition backend.c:75
eid_vwr_pinops
Definition oslayer.h:56
DllExport int eid_vwr_challenge(const unsigned char *challenge, int challengelen)
Perform an internal authenticate operation on the card.
Definition backend.c:95
eid_vwr_langs
Definition oslayer.h:102
DllExport void eid_vwr_be_set_invalid(void)
Mark the current data as invalid.
Definition oslayer.c:143
@ STATE_FILE_READING
We're reading from the file currently.
Definition oslayer.h:87
@ STATE_TOKEN_IDLE
not performing any action in the taoken_wait state
Definition oslayer.h:92
@ STATE_TOKEN_PINOP
Performing a PIN operation.
Definition oslayer.h:83
@ STATE_FILE_EXPORT_PHOTO
Exporting the photo from file data.
Definition oslayer.h:95
@ STATE_TOKEN_CHALLENGE
Performing a challenge operation.
Definition oslayer.h:93
@ STATE_READY
Ready to receive a token (eID card)
Definition oslayer.h:78
@ STATE_TOKEN_EXPORT_PHOTO
Exporting the photo from card data.
Definition oslayer.h:94
@ STATE_TOKEN_ID
Reading identity data.
Definition oslayer.h:81
@ STATE_LIBOPEN
The library has been opened. Used as an initializer.
Definition oslayer.h:76
@ STATE_FILE
We're dealing with files.
Definition oslayer.h:86
@ STATE_TOKEN_ERROR
An error occurred while dealing with the card.
Definition oslayer.h:85
@ STATE_CALLBACKS
The callbacks have been defined.
Definition oslayer.h:77
@ STATE_TOKEN_SERIALIZE
Saving data to a file.
Definition oslayer.h:84
@ STATE_NO_TOKEN
We don't have a card, and we also don't have a file.
Definition oslayer.h:90
@ STATE_TOKEN_CERTS
Reading certificates.
Definition oslayer.h:82
@ STATE_TOKEN_WAIT
The card has been read, we're now waiting for events to do something else.
Definition oslayer.h:80
@ STATE_TOKEN
A token (eID card) has been found.
Definition oslayer.h:79
@ STATE_FILE_WAIT
We finished parsing the file.
Definition oslayer.h:88
@ STATE_NO_READER
We don't have a reader (yet?)
Definition oslayer.h:91
@ STATE_CARD_INVALID
The data was determined to be invalid. That is, the card could be read, but signature validation fail...
Definition oslayer.h:89
@ EID_VWR_RES_SUCCESS
the operation returned successfully
Definition oslayer.h:65
@ EID_VWR_RES_WARNING
the operation finished with warnings
Definition oslayer.h:67
@ EID_VWR_RES_FAILED
operation failed
Definition oslayer.h:64
@ EID_VWR_RES_UNKNOWN
the operation did not finish
Definition oslayer.h:66
@ EID_VWR_GRAPH_VERSION_EIGHT
version eight
Definition oslayer.h:114
@ EID_VWR_GRAPH_VERSION_NONE
No graphical version had been set, could be old data.
Definition oslayer.h:113
@ EID_VWR_SRC_FILE
File source. "Print", "Validate" and "Close" operations should be allowed, PIN-related operations are...
Definition oslayer.h:33
@ EID_VWR_SRC_CARD
Card source. Close should not be allowed, everything else should be.
Definition oslayer.h:34
@ EID_VWR_SRC_NONE
No source. UI should be cleared.
Definition oslayer.h:32
@ EID_VWR_SRC_UNKNOWN
Unknown. Used as initializer.
Definition oslayer.h:35
@ EID_VWR_LOG_ERROR
Definition oslayer.h:51
@ EID_VWR_LOG_NORMAL
Definition oslayer.h:47
@ EID_VWR_LOG_DETAIL
Definition oslayer.h:45
@ EID_VWR_LOG_COARSE
Definition oslayer.h:49
@ EID_VWR_PINOP_CHG
change the PIN code of the card
Definition oslayer.h:58
@ EID_VWR_PINOP_TEST
perform a login and return whether the login was successful
Definition oslayer.h:57
@ EID_VWR_LANG_EN
English.
Definition oslayer.h:105
@ EID_VWR_LANG_DE
German.
Definition oslayer.h:104
@ EID_VWR_LANG_NONE
No language has yet been selected. Used as initializer.
Definition oslayer.h:103
@ EID_VWR_LANG_FR
French.
Definition oslayer.h:106
@ EID_VWR_LANG_NL
Dutch.
Definition oslayer.h:107
Definition oslayer.h:24
unsigned long slot
The number of the slot, to be used with eid_vwr_be_select_slot()
Definition oslayer.h:25
EID_CHAR * description
A human-readable name for the reader.
Definition oslayer.h:26
Definition oslayer.h:275
unsigned char * response
the response as a byte array
Definition oslayer.h:278
size_t responselen
length of the response
Definition oslayer.h:279
size_t challengelen
length of the challenge
Definition oslayer.h:277
unsigned char * challenge
the challenge as a byte array
Definition oslayer.h:276
Definition oslayer.h:267
int have_data
nonzero if there is actually any data
Definition oslayer.h:270
size_t imagelen
length of imagedata
Definition oslayer.h:269
void * imagedata
JPEG photo of the inspected XML file.
Definition oslayer.h:268
Callbacks which the backend can perform towards the UI.
Definition oslayer.h:130
void(* newsrc)(enum eid_vwr_source new_source)
Called when the data source has changed.
Definition oslayer.h:158
void(* newstringdata)(const EID_CHAR *label, const EID_CHAR *data)
new string data to be displayed in UI.
Definition oslayer.h:172
void(* pinop_result)(enum eid_vwr_pinops op, enum eid_vwr_result res)
Return the result of a PIN operation.
Definition oslayer.h:238
void(* challenge_result)(const unsigned char *response, int responselen, enum eid_vwr_result res)
Return the result of a challenge operation.
Definition oslayer.h:262
void(* newbindata)(const EID_CHAR *label, const unsigned char *data, int datalen)
New binary data to be displayed in UI.
Definition oslayer.h:185
void(* readers_changed)(unsigned long nreaders, slotdesc *slots)
The number of known readers has changed.
Definition oslayer.h:247
void(* newstate)(enum eid_vwr_states new_state)
State machine transition.
Definition oslayer.h:224
void(* logv)(enum eid_vwr_loglevel level, const EID_CHAR *line, va_list ap)
Log a string using varargs.
Definition oslayer.h:213
int version
The version number of this struct.
Definition oslayer.h:147
void(* log)(enum eid_vwr_loglevel level, const EID_CHAR *line)
Log a string at the given level.
Definition oslayer.h:196