aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/spm.h35
-rw-r--r--include/url.h4
2 files changed, 29 insertions, 10 deletions
diff --git a/include/spm.h b/include/spm.h
index ad30b9d..4107a03 100644
--- a/include/spm.h
+++ b/include/spm.h
@@ -20,6 +20,9 @@
#include <time.h>
#include <sys/stat.h>
#include <wordexp.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
+
#if !defined(_WIN32)
#include <sys/utsname.h>
#endif
@@ -63,6 +66,13 @@
#define SPM_META_PREFIX_TEXT ".SPM_PREFIX_TEXT"
#define SPM_META_MANIFEST ".SPM_MANIFEST" // TODO: Implement
+
+#define SPM_MANIFEST_SEPARATOR '|'
+#define SPM_MANIFEST_SEPARATOR_MAX 7
+#define SPM_MANIFEST_NODATA "*"
+#define SPM_MANIFEST_HEADER "# SPM PACKAGE MANIFEST"
+#define SPM_MANIFEST_FILENAME "manifest.dat"
+
#define PREFIX_WRITE_BIN 0
#define PREFIX_WRITE_TEXT 1
@@ -75,6 +85,7 @@
#define SHELL_BENCHMARK 1 << 2
#define PACKAGE_MEMBER_SIZE 0xff
+#define PACKAGE_MEMBER_ORIGIN_SIZE PATH_MAX
#define VERSION_NOOP 1 << 0
#define VERSION_EQ 1 << 1
@@ -91,6 +102,9 @@ typedef struct {
char name[PACKAGE_MEMBER_SIZE];
char version[PACKAGE_MEMBER_SIZE];
char revision[PACKAGE_MEMBER_SIZE];
+ char checksum_md5[MD5_DIGEST_LENGTH];
+ char checksum_sha256[SHA256_DIGEST_LENGTH];
+ char origin[PACKAGE_MEMBER_ORIGIN_SIZE];
} ManifestPackage;
typedef struct {
@@ -119,15 +133,26 @@ typedef struct {
size_t value_length;
} ConfigItem;
+
+typedef struct {
+ char *binpath;
+ char *includepath;
+ char *libpath;
+ char *datapath;
+ char *manpath;
+} SPM_Hierarchy;
+
typedef struct {
char *package_dir;
char *tmp_dir;
char *package_manifest;
+ char *repo_target;
char *user_config_basedir;
char *user_config_file;
int verbose;
ConfigItem **config;
struct utsname sysinfo;
+ SPM_Hierarchy fs;
} spm_vars;
typedef struct {
@@ -154,14 +179,6 @@ typedef struct {
char **env;
} RuntimeEnv;
-typedef struct {
- char *binpath;
- char *includepath;
- char *libpath;
- char *datapath;
- char *manpath;
-} SPM_Hierarchy;
-
// GLOBALS
spm_vars SPM_GLOBAL;
@@ -265,7 +282,7 @@ void dep_show(Dependencies **deps);
// manifest.c
Manifest *manifest_from(const char *package_dir);
-Manifest *manifest_read(void);
+Manifest *manifest_read(char *file_or_url);
int manifest_write(Manifest *info);
void manifest_free(Manifest *info);
ManifestPackage *manifest_search(Manifest *info, const char *package);
diff --git a/include/url.h b/include/url.h
index 99a8b96..aa8f5b5 100644
--- a/include/url.h
+++ b/include/url.h
@@ -29,6 +29,7 @@ struct fcurl_data
size_t buffer_len; /* currently allocated buffers length */
size_t buffer_pos; /* end of data in buffer*/
int still_running; /* Is background url fetch still in progress */
+ long http_status; /* HTTP server response code */
};
typedef struct fcurl_data URL_FILE;
@@ -40,5 +41,6 @@ int url_feof(URL_FILE *file);
size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file);
char *url_fgets(char *ptr, size_t size, URL_FILE *file);
void url_rewind(URL_FILE *file);
-
+const char *http_response_str(long code);
+long get_http_response(CURLM *handle);
#endif // SPM_SPM_URL_H