return 0;
}
+#define def_set_tktflag(type) \
+int ykp_set_tktflag_ ## type(CONFIG *cfg, bool state) \
+{ \
+ if (cfg) { \
+ if (state) \
+ cfg->tktFlags |= TKTFLAG_ ## type; \
+ else \
+ cfg->tktFlags &= ~TKTFLAG_ ## type; \
+ return 1; \
+ } \
+ ykp_errno = YKP_ENOCFG; \
+ return 0; \
+}
+
+#define def_set_cfgflag(type) \
+int ykp_set_cfgflag_ ## type(CONFIG *cfg, bool state) \
+{ \
+ if (cfg) { \
+ if (state) \
+ cfg->cfgFlags |= CFGFLAG_ ## type; \
+ else \
+ cfg->cfgFlags &= ~CFGFLAG_ ## type; \
+ return 1; \
+ } \
+ ykp_errno = YKP_ENOCFG; \
+ return 0; \
+}
+
+def_set_tktflag(TAB_FIRST)
+def_set_tktflag(APPEND_TAB1)
+def_set_tktflag(APPEND_TAB2)
+def_set_tktflag(APPEND_DELAY1)
+def_set_tktflag(APPEND_DELAY2)
+def_set_tktflag(APPEND_CR)
+
+def_set_cfgflag(SEND_REF)
+def_set_cfgflag(TICKET_FIRST)
+def_set_cfgflag(PACING_10MS)
+def_set_cfgflag(PACING_20MS)
+def_set_cfgflag(ALLOW_HIDTRIG)
+def_set_cfgflag(STATIC_TICKET)
+
+
const char str_key_value_separator[] = ":";
const char str_fixed[] = "fixed";
const char str_uid[] = "uid";
static const char *errtext[] = {
"",
- "not yet implemented"
+ "not yet implemented",
+ "no configuration structure given"
};
const char *ykp_strerror(int errnum)
{
int ykp_AES_key_from_passphrase(CONFIG *cfg, const char *passphrase,
const char *salt);
int ykp_set_access_code(CONFIG *cfg, unsigned char *access_code);
+int ykp_set_fixed(CONFIG *cfg, unsigned char *fixed);
+int ykp_set_uid(CONFIG *cfg, unsigned char *uid);
+
+int ykp_set_tktflag_TAB_FIRST(CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_TAB1(CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_TAB2(CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_DELAY1(CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_DELAY2(CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_CR(CONFIG *cfg, bool state);
+
+int ykp_set_cfgflag_SEND_REF(CONFIG *cfg, bool state);
+int ykp_set_cfgflag_TICKET_FIRST(CONFIG *cfg, bool state);
+int ykp_set_cfgflag_PACING_10MS(CONFIG *cfg, bool state);
+int ykp_set_cfgflag_PACING_20MS(CONFIG *cfg, bool state);
+int ykp_set_cfgflag_ALLOW_HIDTRIG(CONFIG *cfg, bool state);
+int ykp_set_cfgflag_STATIC_TICKET(CONFIG *cfg, bool state);
int ykp_write_config(const CONFIG *cfg,
int (*writer)(const char *buf, size_t count,
const char *ykp_strerror(int errnum);
#define YKP_ENOTYETIMPL 0x01
+#define YKP_ENOCFG 0x02
#endif // __YKPERS_H_INCLUDED__