Mercurial > projects > libpws
annotate include/pws.h @ 13:2bb1bbac1d0a default tip
Added tag version-1.0.0 for changeset 1926dfc9feb0
author | Guido Berhoerster <guido+libpws@berhoerster.name> |
---|---|
date | Sun, 04 Aug 2019 21:37:56 +0200 |
parents | 96a507a110c8 |
children |
rev | line source |
---|---|
0
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
1 /* |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
2 * Copyright (C) 2015 Guido Berhoerster <guido+libpws@berhoerster.name> |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
3 * |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
4 * Permission is hereby granted, free of charge, to any person obtaining |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
5 * a copy of this software and associated documentation files (the |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
6 * "Software"), to deal in the Software without restriction, including |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
7 * without limitation the rights to use, copy, modify, merge, publish, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
8 * distribute, sublicense, and/or sell copies of the Software, and to |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
9 * permit persons to whom the Software is furnished to do so, subject to |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
10 * the following conditions: |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
11 * |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
12 * The above copyright notice and this permission notice shall be included |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
13 * in all copies or substantial portions of the Software. |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
14 * |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
22 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
23 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
24 #ifndef PWS_H |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
25 #define PWS_H |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
26 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
27 #ifdef __cplusplus |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
28 extern "C" { |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
29 #endif /* __cplusplus */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
30 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
31 #include <stdint.h> |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
32 #include <sys/types.h> |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
33 #include <stdio.h> |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
34 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
35 #define LIBPWS_VERSION_MAJOR 1 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
36 #define LIBPWS_VERSION_MINOR 0 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
37 #define LIBPWS_VERSION_MICRO 0 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
38 |
11
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
39 #define PWS3_VERSION 0x030E |
0
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
40 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
41 #define PWS3_MAX_FIELD_SIZE (16 * 1024) |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
42 #define PWS3_MAX_PASSWORD_LEN 1023 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
43 #define PWS3_UUID_SIZE 16 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
44 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
45 struct pws3_field; |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
46 struct pws3_record; |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
47 struct pws3_file; |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
48 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
49 enum pws_error_code { |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
50 PWS_ERR_GENERIC_ERROR, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
51 PWS_ERR_NO_MEMORY, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
52 PWS_ERR_IO_ERROR, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
53 PWS_ERR_TRUNCATED_FILE, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
54 PWS_ERR_INVALID_CHECKSUM, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
55 PWS_ERR_INVALID_RECORD, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
56 PWS_ERR_INVALID_HEADER, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
57 PWS_ERR_UNSUPPORTED_VERSION |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
58 }; |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
59 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
60 enum pws_data_type { |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
61 PWS_DATA_TYPE_BYTES, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
62 PWS_DATA_TYPE_UUID, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
63 PWS_DATA_TYPE_TEXT, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
64 PWS_DATA_TYPE_TIME, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
65 PWS_DATA_TYPE_UINT8, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
66 PWS_DATA_TYPE_UINT16, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
67 PWS_DATA_TYPE_UINT32 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
68 }; |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
69 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
70 enum pws3_header_field_type { |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
71 PWS3_HEADER_FIELD_VERSION, /* 0x00 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
72 PWS3_HEADER_FIELD_UUID, /* 0x01 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
73 PWS3_HEADER_FIELD_NON_DEFAULT_PREFERENCES, /* 0x02 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
74 PWS3_HEADER_FIELD_TREE_DISPLAY_STATUS, /* 0x03 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
75 PWS3_HEADER_FIELD_SAVE_TIMESTAMP, /* 0x04 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
76 PWS3_HEADER_FIELD_SAVE_USER_HOST, /* 0x05 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
77 PWS3_HEADER_FIELD_SAVE_APPLICATION, /* 0x06 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
78 PWS3_HEADER_FIELD_SAVE_USER, /* 0x07 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
79 PWS3_HEADER_FIELD_SAVE_HOST, /* 0x08 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
80 PWS3_HEADER_FIELD_DATABASE_NAME, /* 0x09 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
81 PWS3_HEADER_FIELD_DATABASE_DESCRIPTION, /* 0x0a */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
82 PWS3_HEADER_FIELD_DATABASE_FILTERS, /* 0x0b */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
83 PWS3_HEADER_FIELD_RESERVED_1, /* 0x0c */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
84 PWS3_HEADER_FIELD_RESERVED_2, /* 0x0d */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
85 PWS3_HEADER_FIELD_RESERVED_3, /* 0x0e */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
86 PWS3_HEADER_FIELD_RECENTLY_USED_ENTRIES, /* 0x0f */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
87 PWS3_HEADER_FIELD_NAMED_PASSWORD_POLICIES, /* 0x10 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
88 PWS3_HEADER_FIELD_EMPTY_GROUPS, /* 0x11 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
89 PWS3_HEADER_FIELD_YUBICO, /* 0x12 */ |
11
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
90 PWS3_HEADER_FIELD_PASSWORD_TIMESTAMP, /* 0x13 */ |
0
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
91 PWS3_HEADER_FIELD_END = 0xff |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
92 }; |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
93 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
94 enum pws3_record_field_type { |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
95 PWS3_RECORD_FIELD_UUID = 0x01, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
96 PWS3_RECORD_FIELD_GROUP, /* 0x02 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
97 PWS3_RECORD_FIELD_TITLE, /* 0x03 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
98 PWS3_RECORD_FIELD_USERNAME, /* 0x04 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
99 PWS3_RECORD_FIELD_NOTES, /* 0x05 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
100 PWS3_RECORD_FIELD_PASSWORD, /* 0x06 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
101 PWS3_RECORD_FIELD_CREATION_TIME, /* 0x07 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
102 PWS3_RECORD_FIELD_PASSWORD_MODIFICATION_TIME, /* 0x08 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
103 PWS3_RECORD_FIELD_ACCESS_TIME, /* 0x09 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
104 PWS3_RECORD_FIELD_PASSWORD_EXPIRY_TIME, /* 0x0a */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
105 PWS3_RECORD_FIELD_RESERVED_1, /* 0x0b */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
106 PWS3_RECORD_FIELD_MODIFICATION_TIME, /* 0x0c */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
107 PWS3_RECORD_FIELD_URL, /* 0x0d */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
108 PWS3_RECORD_FIELD_AUTOTYPE, /* 0x0e */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
109 PWS3_RECORD_FIELD_PASSWORD_HISTORY, /* 0x0f */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
110 PWS3_RECORD_FIELD_PASSWORD_POLICY, /* 0x10 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
111 PWS3_RECORD_FIELD_PASSWORD_EXPIRY_INTERVAL, /* 0x11 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
112 PWS3_RECORD_FIELD_RUN_COMMAND, /* 0x12 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
113 PWS3_RECORD_FIELD_DOUBLE_CLICK_ACTION, /* 0x13 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
114 PWS3_RECORD_FIELD_EMAIL_ADDRESS, /* 0x14 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
115 PWS3_RECORD_FIELD_PROTECTED, /* 0x15 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
116 PWS3_RECORD_FIELD_ALLOWED_PASSWORD_SYMBOLS, /* 0x16 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
117 PWS3_RECORD_FIELD_SHIFT_DOUBLE_CLICK_ACTION, /* 0x17 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
118 PWS3_RECORD_FIELD_PASSWORD_POLICY_NAME, /* 0x18 */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
119 PWS3_RECORD_FIELD_KEYBOARD_SHORTCUT, /* 0x19 */ |
11
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
120 PWS3_RECORD_FIELD_RESERVED_2, /* 0x1a */ |
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
121 PWS3_RECORD_FIELD_TWO_FACTOR_KEY, /* 0x1b */ |
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
122 PWS3_RECORD_FIELD_CREDIT_CARD_NUMBER, /* 0x1c */ |
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
123 PWS3_RECORD_FIELD_CREDIT_CARD_EXPIRATION, /* 0x1d */ |
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
124 PWS3_RECORD_FIELD_CREDIT_CARD_VERIFICATION_VALUE, /* 0x1e */ |
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
125 PWS3_RECORD_FIELD_CREDIT_CARD_PIN, /* 0x1f */ |
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
126 PWS3_RECORD_FIELD_QR_CODE, /* 0x20 */ |
96a507a110c8
Add support for format 0x030E
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
0
diff
changeset
|
127 PWS3_RECORD_FIELD_TESTING_1, /* 0xdf */ |
0
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
128 PWS3_RECORD_FIELD_END = 0xff |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
129 }; |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
130 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
131 int pws_init(void); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
132 void pws_finalize(void); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
133 void pws_set_alloc_functions(void *(*)(size_t), |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
134 void *(*)(void *, size_t), void (*)(void *, size_t), void *(*)(size_t), |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
135 void *(*)(void *, size_t), void (*)(void *, size_t)); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
136 int pws_generate_uuid(unsigned char [static PWS3_UUID_SIZE]); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
137 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
138 struct pws3_field * pws3_field_create(int, uint8_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
139 void pws3_field_destroy(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
140 int pws3_field_is_header(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
141 uint8_t pws3_field_get_type(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
142 enum pws_data_type pws3_field_get_data_type(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
143 int pws3_field_set_uuid(struct pws3_field *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
144 const unsigned char [static PWS3_UUID_SIZE]); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
145 int pws3_field_set_text(struct pws3_field *, const char [static 1]); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
146 int pws3_field_set_time(struct pws3_field *, time_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
147 int pws3_field_set_uint8(struct pws3_field *, uint8_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
148 int pws3_field_set_uint16(struct pws3_field *, uint16_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
149 int pws3_field_set_uint32(struct pws3_field *, uint32_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
150 int pws3_field_set_bytes(struct pws3_field *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
151 const unsigned char [static 1], size_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
152 const unsigned char * pws3_field_get_uuid(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
153 const char * pws3_field_get_text(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
154 time_t pws3_field_get_time(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
155 uint8_t pws3_field_get_uint8(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
156 uint16_t pws3_field_get_uint16(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
157 uint32_t pws3_field_get_uint32(struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
158 void pws3_field_get_bytes(struct pws3_field *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
159 const unsigned char **, size_t *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
160 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
161 void pws3_record_destroy(struct pws3_record *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
162 struct pws3_record * pws3_record_create(void); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
163 void pws3_record_set_field(struct pws3_record *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
164 struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
165 struct pws3_field * pws3_record_get_field(struct pws3_record *, uint8_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
166 struct pws3_field * pws3_record_remove_field(struct pws3_record *, uint8_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
167 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
168 void pws3_file_destroy(struct pws3_file *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
169 struct pws3_file * pws3_file_create(void); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
170 enum pws_error_code pws3_file_get_error_code(struct pws3_file *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
171 const char * pws3_file_get_error_message(struct pws3_file *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
172 int pws3_file_read_mem(struct pws3_file *, const char *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
173 unsigned char *, size_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
174 int pws3_file_read_stream(struct pws3_file *, const char *, FILE *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
175 int pws3_file_write_mem(struct pws3_file *, const char *, uint32_t, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
176 unsigned char **, size_t *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
177 int pws3_file_write_stream(struct pws3_file *, const char *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
178 uint32_t, FILE *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
179 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
180 void pws3_file_set_header_field(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
181 struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
182 struct pws3_field * pws3_file_get_header_field(struct pws3_file *, uint8_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
183 struct pws3_field * pws3_file_remove_header_field(struct pws3_file *, uint8_t); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
184 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
185 void pws3_file_insert_empty_group(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
186 struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
187 struct pws3_field * pws3_file_get_empty_group(struct pws3_file *, const char *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
188 struct pws3_field * pws3_file_remove_empty_group(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
189 const char *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
190 struct pws3_field * pws3_file_first_empty_group(struct pws3_file *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
191 struct pws3_field * pws3_file_last_empty_group(struct pws3_file *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
192 struct pws3_field * pws3_file_next_empty_group(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
193 struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
194 struct pws3_field * pws3_file_prev_empty_group(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
195 struct pws3_field *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
196 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
197 void pws3_file_insert_record(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
198 struct pws3_record *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
199 struct pws3_record * pws3_file_get_record(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
200 const unsigned char [static PWS3_UUID_SIZE]); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
201 struct pws3_record * pws3_file_remove_record(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
202 const unsigned char [static PWS3_UUID_SIZE]); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
203 struct pws3_record * pws3_file_first_record(struct pws3_file *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
204 struct pws3_record * pws3_file_last_record(struct pws3_file *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
205 struct pws3_record * pws3_file_next_record(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
206 struct pws3_record *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
207 struct pws3_record * pws3_file_prev_record(struct pws3_file *, |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
208 struct pws3_record *); |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
209 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
210 #ifdef __cplusplus |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
211 } |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
212 #endif /* __cplusplus */ |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
213 |
d541e748cfd8
Initial revision
Guido Berhoerster <guido+libpws@berhoerster.name>
parents:
diff
changeset
|
214 #endif /* !PWS_H */ |