Mercurial > projects > pwm
comparison pwfile.h @ 10:17fb30016e64
Enable access to record and file metadata
Add info command to show file metadata.
Enable display of creation and modification dates of records.
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Fri, 28 Jul 2017 15:53:57 +0200 |
parents | a7e41e1a79c8 |
children | efef93e54c5f |
comparison
equal
deleted
inserted
replaced
9:60c8ab006e55 | 10:17fb30016e64 |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2016 Guido Berhoerster <guido+pwm@berhoerster.name> | 2 * Copyright (C) 2017 Guido Berhoerster <guido+pwm@berhoerster.name> |
3 * | 3 * |
4 * Permission is hereby granted, free of charge, to any person obtaining | 4 * Permission is hereby granted, free of charge, to any person obtaining |
5 * a copy of this software and associated documentation files (the | 5 * a copy of this software and associated documentation files (the |
6 * "Software"), to deal in the Software without restriction, including | 6 * "Software"), to deal in the Software without restriction, including |
7 * without limitation the rights to use, copy, modify, merge, publish, | 7 * without limitation the rights to use, copy, modify, merge, publish, |
49 } group; | 49 } group; |
50 }; | 50 }; |
51 | 51 |
52 struct record_id_tree; | 52 struct record_id_tree; |
53 | 53 |
54 struct metadata { | |
55 int version; | |
56 char *user; | |
57 char *host; | |
58 char *application; | |
59 time_t timestamp; | |
60 }; | |
61 | |
54 struct record { | 62 struct record { |
55 char *title; | 63 char *title; |
56 char *group; | 64 char *group; |
57 char *username; | 65 char *username; |
58 char *password; | 66 char *password; |
59 char *notes; | 67 char *notes; |
60 char *url; | 68 char *url; |
69 time_t ctime; | |
70 time_t mtime; | |
61 }; | 71 }; |
62 | 72 |
63 void pwfile_init(struct pwm_ctx *ctx); | 73 void pwfile_init(struct pwm_ctx *ctx); |
64 void pwfile_destroy(struct pwm_ctx *); | 74 void pwfile_destroy(struct pwm_ctx *); |
65 int pwfile_read_file(struct pwm_ctx *, FILE *); | 75 int pwfile_read_file(struct pwm_ctx *, FILE *); |
66 int pwfile_write_file(struct pwm_ctx *); | 76 int pwfile_write_file(struct pwm_ctx *); |
67 union list_item ** pwfile_create_list(struct pwm_ctx *); | 77 union list_item ** pwfile_create_list(struct pwm_ctx *); |
68 void pwfile_destroy_list(union list_item **); | 78 void pwfile_destroy_list(union list_item **); |
79 struct metadata * pwfile_get_metadata(struct pwm_ctx *); | |
80 void pwfile_destroy_metadata(struct metadata *); | |
69 int pwfile_create_record(struct pwm_ctx *, struct record *); | 81 int pwfile_create_record(struct pwm_ctx *, struct record *); |
70 int pwfile_modify_record(struct pwm_ctx *, unsigned int, | 82 int pwfile_modify_record(struct pwm_ctx *, unsigned int, |
71 struct record *); | 83 struct record *); |
72 int pwfile_remove_record(struct pwm_ctx *, unsigned int); | 84 int pwfile_remove_record(struct pwm_ctx *, unsigned int); |
73 int pwfile_create_group(struct pwm_ctx *, const char *); | 85 int pwfile_create_group(struct pwm_ctx *, const char *); |