2019-06-13 16:09:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
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-07-30 12:40:05 +01:00
|
|
|
typedef enum ListDirection {
|
|
|
|
STORJ_BEFORE = -2,
|
|
|
|
STORJ_BACKWARD = -1,
|
|
|
|
STORJ_FORWARD = 1,
|
|
|
|
STORJ_AFTER = 2
|
|
|
|
} ListDirection;
|
|
|
|
|
|
|
|
typedef struct APIKey { long _handle; } APIKeyRef;
|
|
|
|
typedef struct Uplink { long _handle; } UplinkRef;
|
|
|
|
typedef struct Project { long _handle; } ProjectRef;
|
|
|
|
typedef struct Bucket { long _handle; } BucketRef;
|
|
|
|
typedef struct Object { long _handle; } ObjectRef;
|
|
|
|
typedef struct Downloader { long _handle; } DownloaderRef;
|
|
|
|
typedef struct Uploader { long _handle; } UploaderRef;
|
|
|
|
typedef struct EncryptionAccess { long _handle; } EncryptionAccessRef;
|
2019-06-15 12:23:12 +01:00
|
|
|
|
2019-06-13 16:09:05 +01:00
|
|
|
typedef struct UplinkConfig {
|
|
|
|
struct {
|
|
|
|
struct {
|
2019-07-30 12:40:05 +01:00
|
|
|
bool skip_peer_ca_whitelist;
|
2019-11-12 16:45:40 +00:00
|
|
|
char *peer_ca_whitelist_path;
|
2019-07-30 12:40:05 +01:00
|
|
|
} tls;
|
2019-11-12 16:45:40 +00:00
|
|
|
char *peer_id_version;
|
|
|
|
int32_t max_inline_size;
|
|
|
|
int32_t max_memory;
|
|
|
|
int32_t dial_timeout;
|
2019-06-13 16:09:05 +01:00
|
|
|
} Volatile;
|
|
|
|
} UplinkConfig;
|
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;
|
2019-09-05 07:25:27 +01:00
|
|
|
ListDirection direction;
|
2019-06-15 12:23:12 +01:00
|
|
|
int64_t limit;
|
|
|
|
} BucketListOptions;
|
|
|
|
|
|
|
|
typedef struct BucketList {
|
|
|
|
bool more;
|
|
|
|
BucketInfo *items;
|
|
|
|
int32_t length;
|
|
|
|
} BucketList;
|
|
|
|
|
2019-06-21 19:44:00 +01:00
|
|
|
typedef struct ObjectInfo {
|
|
|
|
uint32_t version;
|
|
|
|
BucketInfo bucket;
|
|
|
|
char *path;
|
|
|
|
bool is_prefix;
|
|
|
|
char *content_type;
|
2019-08-06 10:36:35 +01:00
|
|
|
int64_t size;
|
2019-06-21 19:44:00 +01:00
|
|
|
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 {
|
2019-07-30 12:40:05 +01:00
|
|
|
char *prefix;
|
|
|
|
char *cursor;
|
|
|
|
char delimiter;
|
|
|
|
bool recursive;
|
|
|
|
ListDirection direction;
|
|
|
|
int64_t limit;
|
2019-06-21 19:44:00 +01:00
|
|
|
} 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;
|