storj/lib/uplinkc/uplink_definitions.h

132 lines
3.1 KiB
C
Raw Normal View History

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.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 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;
typedef struct Downloader { long _handle; } DownloaderRef;
typedef struct Uploader { long _handle; } UploaderRef;
2019-06-15 12:23:12 +01:00
typedef struct UplinkConfig {
struct {
struct {
2019-06-15 12:23:12 +01:00
bool SkipPeerCAWhitelist;
} TLS;
2019-06-21 19:44:00 +01:00
// TODO: add support for MaxMemory
} Volatile;
} UplinkConfig;
2019-06-15 12:23:12 +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 {
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;
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 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;
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;