storj/lib/uplinkc/uplink_definitions.h

135 lines
3.4 KiB
C
Raw Normal View History

#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;
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
typedef struct UplinkConfig {
struct {
struct {
bool skip_peer_ca_whitelist;
char *peer_ca_whitelist_path;
} tls;
char *peer_id_version;
int32_t max_inline_size;
int32_t max_memory;
int32_t dial_timeout;
} 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 {
char *name;
int64_t created;
2019-06-21 19:44:00 +01:00
CipherSuite path_cipher;
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;
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;
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;
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;
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;