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
97
107
110{
113 //EID_VWR_GRAPH_VERSION_NINE, ///< version nine
114};
115
128{
129
146
156 void (*newsrc) (enum eid_vwr_source new_source);
157
170 void (*newstringdata) (const EID_CHAR * label, const EID_CHAR * data);
171
183 void (*newbindata) (const EID_CHAR * label, const unsigned char *data,
184 int datalen);
185
194 void (*log) (enum eid_vwr_loglevel level, const EID_CHAR * line);
195
211 void (*logv) (enum eid_vwr_loglevel level, const EID_CHAR * line,
212 va_list ap);
213
222 void (*newstate) (enum eid_vwr_states new_state);
223
236 void (*pinop_result) (enum eid_vwr_pinops op,
237 enum eid_vwr_result res);
238
245 void (*readers_changed) (unsigned long nreaders, slotdesc * slots);
246
260 void(*challenge_result)(const unsigned char* response, int responselen, enum eid_vwr_result res);
261};
262
265{
266 void *imagedata;
267 size_t imagelen;
269};
270
273{
274 unsigned char* challenge;
276 unsigned char* response;
277 size_t responselen;
278 enum eid_vwr_result result;
279};
280
290DllExport void eid_vwr_pinop(enum eid_vwr_pinops op);
291
292
301DllExport int eid_vwr_challenge(const unsigned char* challenge, int challengelen);
302
303
316DllExport int eid_vwr_createcallbacks(struct eid_vwr_ui_callbacks *cb);
317
329DllExport struct eid_vwr_ui_callbacks *eid_vwr_cbstruct(void);
330
339DllExport struct eid_vwr_preview *eid_vwr_get_preview(const EID_CHAR *
340 filename);
341
347DllExport void eid_vwr_release_preview(struct eid_vwr_preview *prv);
348
358DllExport int eid_vwr_poll(void);
359
365#ifdef WIN32
366DWORD WINAPI eid_vwr_wait_for_pkcs11_event_loop(void* val);
367#else
368
374void* eid_vwr_be_mainloop(void* val) NORETURN;
375#endif
376
377
378
390DllExport void eid_vwr_be_serialize(const EID_CHAR * target_file);
391
402DllExport void eid_vwr_be_deserialize(const EID_CHAR * source_file);
403
416DllExport const char *eid_vwr_be_get_xmlform(void);
417
426DllExport void eid_vwr_be_select_slot(int automatic,
427 unsigned long manualslot);
428
446DllExport void eid_vwr_be_set_invalid(void);
447
453DllExport void eid_vwr_close_file(void);
454
465DllExport void eid_vwr_convert_set_lang(enum eid_vwr_langs which);
466
473DllExport enum eid_vwr_langs eid_vwr_convert_get_lang(void);
474
475DllExport void eid_vwr_init_crypto(void);
476
479#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:121
DllExport void eid_vwr_be_select_slot(int automatic, unsigned long manualslot)
Select the current reader.
Definition oslayer.c:134
DllExport void eid_vwr_be_deserialize(const EID_CHAR *source_file)
Open a file.
Definition oslayer.c:116
DllExport void eid_vwr_close_file(void)
Close the current file.
Definition oslayer.c:142
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:110
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:100
DllExport void eid_vwr_be_set_invalid(void)
Mark the current data as invalid.
Definition oslayer.c:138
@ 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_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_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:112
@ EID_VWR_GRAPH_VERSION_NONE
No graphical version had been set, could be old data.
Definition oslayer.h:111
@ 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:103
@ EID_VWR_LANG_DE
German.
Definition oslayer.h:102
@ EID_VWR_LANG_NONE
No language has yet been selected. Used as initializer.
Definition oslayer.h:101
@ EID_VWR_LANG_FR
French.
Definition oslayer.h:104
@ EID_VWR_LANG_NL
Dutch.
Definition oslayer.h:105
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:273
unsigned char * response
the response as a byte array
Definition oslayer.h:276
size_t responselen
length of the response
Definition oslayer.h:277
size_t challengelen
length of the challenge
Definition oslayer.h:275
unsigned char * challenge
the challenge as a byte array
Definition oslayer.h:274
Definition oslayer.h:265
int have_data
nonzero if there is actually any data
Definition oslayer.h:268
size_t imagelen
length of imagedata
Definition oslayer.h:267
void * imagedata
JPEG photo of the inspected XML file.
Definition oslayer.h:266
Callbacks which the backend can perform towards the UI.
Definition oslayer.h:128
void(* newsrc)(enum eid_vwr_source new_source)
Called when the data source has changed.
Definition oslayer.h:156
void(* newstringdata)(const EID_CHAR *label, const EID_CHAR *data)
new string data to be displayed in UI.
Definition oslayer.h:170
void(* pinop_result)(enum eid_vwr_pinops op, enum eid_vwr_result res)
Return the result of a PIN operation.
Definition oslayer.h:236
void(* challenge_result)(const unsigned char *response, int responselen, enum eid_vwr_result res)
Return the result of a challenge operation.
Definition oslayer.h:260
void(* newbindata)(const EID_CHAR *label, const unsigned char *data, int datalen)
New binary data to be displayed in UI.
Definition oslayer.h:183
void(* readers_changed)(unsigned long nreaders, slotdesc *slots)
The number of known readers has changed.
Definition oslayer.h:245
void(* newstate)(enum eid_vwr_states new_state)
State machine transition.
Definition oslayer.h:222
void(* logv)(enum eid_vwr_loglevel level, const EID_CHAR *line, va_list ap)
Log a string using varargs.
Definition oslayer.h:211
int version
The version number of this struct.
Definition oslayer.h:145
void(* log)(enum eid_vwr_loglevel level, const EID_CHAR *line)
Log a string at the given level.
Definition oslayer.h:194