S3Store cleanup.
[bluesky.git] / bluesky / bluesky.h
index 140310b..21fd855 100644 (file)
 extern "C" {
 #endif
 
+/* BlueSky status and error codes.  Various frontends should translate these to
+ * the appropriate error code for whatever protocol they implement. */
+typedef enum {
+    BSTATUS_OK = 0,             /* No error */
+    BSTATUS_IOERR,              /* I/O error of some form */
+    BSTATUS_NOENT,              /* File does not exist */
+} BlueSkyStatus;
+
 void bluesky_init(void);
 
 gchar *bluesky_lowercase(const gchar *s);
@@ -30,15 +38,18 @@ typedef struct {
 } BlueSkyRCStr;
 
 BlueSkyRCStr *bluesky_string_new(gpointer data, gsize len);
+BlueSkyRCStr *bluesky_string_new_from_gstring(GString *s);
 void bluesky_string_ref(BlueSkyRCStr *string);
 void bluesky_string_unref(BlueSkyRCStr *string);
 BlueSkyRCStr *bluesky_string_dup(BlueSkyRCStr *string);
+void bluesky_string_resize(BlueSkyRCStr *string, gsize len);
 
 /* Cryptographic operations. */
 #define CRYPTO_BLOCK_SIZE 16        /* 128-bit AES */
 #define CRYPTO_KEY_SIZE   16
 
 void bluesky_crypt_init();
+void bluesky_crypt_hash_key(const char *keystr, uint8_t *out);
 void bluesky_crypt_random_bytes(guchar *buf, gint len);
 BlueSkyRCStr *bluesky_crypt_encrypt(BlueSkyRCStr *in, const uint8_t *key);
 BlueSkyRCStr *bluesky_crypt_decrypt(BlueSkyRCStr *in, const uint8_t *key);
@@ -94,8 +105,6 @@ typedef struct {
     uint64_t next_inum;         /* Next available inode for allocation */
 
     BlueSkyStore *store;
-
-    uint8_t *encryption_key;
 } BlueSkyFS;
 
 /* Inode number of the root directory. */
@@ -202,6 +211,7 @@ void bluesky_insert_inode(BlueSkyFS *fs, BlueSkyInode *inode);
 void bluesky_dirent_destroy(gpointer dirent);
 uint64_t bluesky_directory_lookup(BlueSkyInode *inode, gchar *name);
 uint64_t bluesky_directory_ilookup(BlueSkyInode *inode, gchar *name);
+BlueSkyDirent *bluesky_directory_read(BlueSkyInode *dir, uint32_t cookie);
 gboolean bluesky_directory_insert(BlueSkyInode *dir, const gchar *name,
                                   uint64_t inum);
 void bluesky_directory_dump(BlueSkyInode *dir);