]> pd.if.org Git - zpackage/blobdiff - zpm.h
add support for notes
[zpackage] / zpm.h
diff --git a/zpm.h b/zpm.h
index 43c6687a1208af219dd6dcc0f75715c8000675e4..c7144649940bfd6bbf8008732a480d4f646a85ef 100644 (file)
--- a/zpm.h
+++ b/zpm.h
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <limits.h>
+#include <stdarg.h>
 
 #include <sqlite3.h>
 
@@ -16,6 +17,8 @@
 #define ZPM_PATH_MAX 256
 #endif
 
+#define ZPM_LOCAL_DB "/var/lib/zpm/local.db"
+
 #define ZPM_PACKAGE_NAME_MAX 191
 #define ZPM_PACKAGE_VERSION_MAX 58
 #define ZPM_PACKAGE_RELEASE_MAX 4
@@ -29,6 +32,8 @@ struct zpm {
        sqlite3 *db;
        char *path; /* path to db file */
        int error;
+       int dbresult;
+       char *dberrmsg;
        char *errmsg;
        char *pkgid;
        struct zpm_package *current_package;
@@ -167,12 +172,44 @@ int zpm_addvercmp(struct zpm *pkg);
 
 int zpm_exec(struct zpm *z, const char *sql, int(*callback)(void *, int, char **, char**), void *arg, char **errmsg);
 
-int zpm_foreach_path(struct zpm *zpm, char *pkgid, 
+int zpm_foreach_path(struct zpm *zpm, char *pkgid, char *where,
 int (*callback)(void *f, int ncols, char **vals, char **cols),
 void *data, char **errmsg);
 
+
 int zpm_script_hash(struct zpm *zpm, char *pkgstr, char *phase, char *hash);
+int zpm_package_hash(struct zpm *zpm, char *pkgid, char *hash);
+int zpm_package_sethash(struct zpm *zpm, char *pkgid, char *hash);
 
+sqlite3_stmt *zpm_dbqueryv(struct zpm *zpm, char *query, va_list args);
 sqlite3_stmt *zpm_dbquery(struct zpm *zpm, char *query, ...);
+char *zpm_db_string(struct zpm *zpm, char *query, ...);
+int zpm_db_int(struct zpm *zpm, char *query, ...);
+void zpm_db_run(struct zpm *zpm, char *query, ...);
+void zpm_seterror(struct zpm *zpm, char *msgfmt, ...);
+
+struct zpm *zpm_clearmem(struct zpm *zpm);
+
+struct zpm_note {
+       int64_t id;
+       time_t ts; /* or timespec */
+       char *note;
+       char *pkgid;
+       char *path;
+       char *file;
+       char *hash;
+       int ack;
+};
+
+void zpm_note_ack(struct zpm *zpm, int64_t note);
+void zpm_note_unack(struct zpm *zpm, int64_t note);
+void zpm_note_del(struct zpm *zpm, int64_t note);
+int64_t zpm_note(struct zpm *zpm, struct zpm_note *n, unsigned int flags);
+void zpm_note_free(struct zpm_note *n);
+int zpm_notes(struct zpm *zpm, int n, struct zpm_note *note);
+int64_t zpm_note_next(struct zpm *zpm, struct zpm_note *n);
+int64_t zpm_note_add(struct zpm *zpm, char *pkgid, char *path, char *filehash,
+               char *notefmt, ...);
+int zpm_notes_available(struct zpm *zpm, int flags);
 
 #endif