7 #include "vcardt_internal.h"
9 /* create an ATR with appropriate historical bytes */
10 #define ATR_TS_DIRECT_CONVENTION 0x3b
11 #define ATR_TA_PRESENT 0x10
12 #define ATR_TB_PRESENT 0x20
13 #define ATR_TC_PRESENT 0x40
14 #define ATR_TD_PRESENT 0x80
16 unsigned char *vcard_alloc_atr(const char *postfix
, int *atr_len
)
19 const char prefix
[] = "VCARD_";
20 const char default_postfix
[] = "DEFAULT";
21 const int prefix_len
= sizeof(prefix
) - 1;
25 if (postfix
== NULL
) {
26 postfix
= default_postfix
;
28 postfix_len
= strlen(postfix
);
29 total_len
= 3 + prefix_len
+ postfix_len
;
30 atr
= g_malloc(total_len
);
31 atr
[0] = ATR_TS_DIRECT_CONVENTION
;
32 atr
[1] = ATR_TD_PRESENT
+ prefix_len
+ postfix_len
;
34 memcpy(&atr
[3], prefix
, prefix_len
);
35 memcpy(&atr
[3 + prefix_len
], postfix
, postfix_len
);