2019-06-13 16:09:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
2019-06-21 13:24:06 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2019-06-13 16:09:05 +01:00
|
|
|
|
2019-06-21 19:44:00 +01:00
|
|
|
typedef enum CipherSuite {
|
|
|
|
STORJ_ENC_UNSPECIFIED = 0,
|
|
|
|
STORJ_ENC_NULL = 1,
|
|
|
|
STORJ_ENC_AESGCM = 2,
|
|
|
|
STORJ_ENC_SECRET_BOX = 3
|
|
|
|
} CipherSuite;
|
|
|
|
|
|
|
|
typedef enum RedundancyAlgorithm {
|
|
|
|
STORJ_INVALID_REDUNDANCY_ALGORITHM = 0,
|
|
|
|
STORJ_REED_SOLOMON = 1
|
|
|
|
} RedundancyAlgorithm;
|
|
|
|
|
2019-06-21 13:24:06 +01:00
|
|
|
typedef struct APIKey { long _handle; } APIKeyRef;
|
|
|
|
typedef struct Uplink { long _handle; } UplinkRef;
|
|
|
|
typedef struct Project { long _handle; } ProjectRef;
|
|
|
|
typedef struct Bucket { long _handle; } BucketRef;
|
2019-06-21 19:44:00 +01:00
|
|
|
typedef struct Object { long _handle; } ObjectRef;
|
2019-06-21 13:24:06 +01:00
|
|
|
typedef struct Downloader { long _handle; } DownloaderRef;
|
|
|
|
typedef struct Uploader { long _handle; } UploaderRef;
|
2019-06-15 12:23:12 +01:00
|
|
|
|
2019-06-13 16:09:05 +01:00
|
|
|
typedef struct UplinkConfig {
|
|
|
|
struct {
|
|
|
|
struct {
|
2019-06-15 12:23:12 +01:00
|
|
|
bool SkipPeerCAWhitelist;
|
2019-06-13 16:09:05 +01:00
|
|
|
} TLS;
|
2019-06-21 19:44:00 +01:00
|
|
|
// TODO: add support for MaxMemory
|
2019-06-13 16:09:05 +01:00
|
|
|
} Volatile;
|
|
|
|
} UplinkConfig;
|
2019-06-15 12:23:12 +01:00
|
|
|
|
2019-06-21 13:24:06 +01:00
|
|
|
typedef struct ProjectOptions {
|
|
|
|
char key[32];
|
|
|
|
} ProjectOptions;
|
|
|
|
|
2019-06-15 12:23:12 +01:00
|
|
|
typedef struct EncryptionParameters {
|
2019-06-21 19:44:00 +01:00
|
|
|
CipherSuite cipher_suite;
|
|
|
|
int32_t block_size;
|
2019-06-15 12:23:12 +01:00
|
|
|
} EncryptionParameters;
|
|
|
|
|
|
|
|
typedef struct RedundancyScheme {
|
2019-06-21 19:44:00 +01:00
|
|
|
RedundancyAlgorithm algorithm;
|
|
|
|
int32_t share_size;
|
|
|
|
int16_t required_shares;
|
|
|
|
int16_t repair_shares;
|
|
|
|
int16_t optimal_shares;
|
|
|
|
int16_t total_shares;
|
2019-06-15 12:23:12 +01:00
|
|
|
} RedundancyScheme;
|
|
|
|
|
|
|
|
typedef struct BucketInfo {
|
2019-06-21 13:24:06 +01:00
|
|
|
char *name;
|
|
|
|
int64_t created;
|
2019-06-21 19:44:00 +01:00
|
|
|
CipherSuite path_cipher;
|
2019-06-21 13:24:06 +01:00
|
|
|
uint64_t segment_size;
|
2019-06-15 12:23:12 +01:00
|
|
|
EncryptionParameters encryption_parameters;
|
|
|
|
RedundancyScheme redundancy_scheme;
|
|
|
|
} BucketInfo;
|
|
|
|
|
|
|
|
typedef struct BucketConfig {
|
2019-06-21 19:44:00 +01:00
|
|
|
CipherSuite path_cipher;
|
2019-06-15 12:23:12 +01:00
|
|
|
EncryptionParameters encryption_parameters;
|
|
|
|
RedundancyScheme redundancy_scheme;
|
|
|
|
} BucketConfig;
|
|
|
|
|
|
|
|
typedef struct BucketListOptions {
|
|
|
|
char *cursor;
|
|
|
|
int8_t direction;
|
|
|
|
int64_t limit;
|
|
|
|
} BucketListOptions;
|
|
|
|
|
|
|
|
typedef struct BucketList {
|
|
|
|
bool more;
|
|
|
|
BucketInfo *items;
|
|
|
|
int32_t length;
|
|
|
|
} BucketList;
|
|
|
|
|
|
|
|
typedef struct EncryptionAccess {
|
|
|
|
char key[32];
|
|
|
|
} EncryptionAccess;
|
2019-06-21 13:24:06 +01:00
|
|
|
|
2019-06-21 19:44:00 +01:00
|
|
|
typedef struct ObjectInfo {
|
|
|
|
uint32_t version;
|
|
|
|
BucketInfo bucket;
|
|
|
|
char *path;
|
|
|
|
bool is_prefix;
|
|
|
|
char *content_type;
|
|
|
|
int64_t created;
|
|
|
|
int64_t modified;
|
|
|
|
int64_t expires;
|
|
|
|
} ObjectInfo;
|
|
|
|
|
|
|
|
typedef struct ObjectList {
|
|
|
|
char *bucket;
|
|
|
|
char *prefix;
|
|
|
|
bool more;
|
|
|
|
ObjectInfo *items;
|
|
|
|
int32_t length;
|
|
|
|
} ObjectList;
|
|
|
|
|
2019-06-21 13:24:06 +01:00
|
|
|
typedef struct UploadOptions {
|
|
|
|
char *content_type;
|
|
|
|
int64_t expires;
|
|
|
|
} UploadOptions;
|
2019-06-21 19:44:00 +01:00
|
|
|
|
|
|
|
typedef struct ListOptions {
|
|
|
|
char *prefix;
|
|
|
|
char *cursor;
|
|
|
|
char delimiter;
|
|
|
|
bool recursive;
|
|
|
|
int8_t direction;
|
|
|
|
int64_t limit;
|
|
|
|
} ListOptions;
|
|
|
|
|
|
|
|
typedef struct ObjectMeta {
|
|
|
|
char *bucket;
|
|
|
|
char *path;
|
|
|
|
bool is_prefix;
|
|
|
|
char *content_type;
|
|
|
|
int64_t created;
|
|
|
|
int64_t modified;
|
|
|
|
int64_t expires;
|
|
|
|
uint64_t size;
|
|
|
|
uint8_t *checksum_bytes;
|
|
|
|
uint64_t checksum_length;
|
|
|
|
} ObjectMeta;
|