summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorBryan Ischo <bryan@ischo.com>2008-07-11 12:13:40 +0000
committerBryan Ischo <bryan@ischo.com>2008-07-11 12:13:40 +0000
commit037783a33a3c2f02307511bdadd4c85486217a40 (patch)
tree8f495fac334b8cba7027a73e90c366c7106b2341 /inc
parentc0535eabe25706904711f1453e724e659b93318c (diff)
downloadceph-libs3-037783a33a3c2f02307511bdadd4c85486217a40.tar.gz
* More work in progress. Initial list_bucket support.
Diffstat (limited to 'inc')
-rw-r--r--inc/libs3.h44
-rw-r--r--inc/util.h12
2 files changed, 34 insertions, 22 deletions
diff --git a/inc/libs3.h b/inc/libs3.h
index 190cf8d..495fe0e 100644
--- a/inc/libs3.h
+++ b/inc/libs3.h
@@ -95,6 +95,7 @@ typedef enum
S3StatusInvalidBucketNameCharacterSequence ,
S3StatusInvalidBucketNameTooShort ,
S3StatusInvalidBucketNameDotQuadNotation ,
+ S3StatusQueryParamsTooLong ,
S3StatusFailedToCreateRequest ,
S3StatusFailedToInitializeRequest ,
S3StatusFailedToCreateRequestContext ,
@@ -326,9 +327,10 @@ typedef struct S3ResponseHeaders
* This optional field provides the last modified time, relative to the
* Unix epoch, of the contents. If this value is > 0, then the last
* modified date of the contents are availableb as a number of seconds
- * since the UNIX epoch. Note that this is second precision.
+ * since the UNIX epoch. Note that this is second precision; HTTP
+ *
**/
- long lastModified;
+ time_t lastModified;
/**
* This is the number of user-provided metadata headers associated with
* the resource.
@@ -431,10 +433,9 @@ typedef struct S3BucketContext
/**
* This is a single entry supplied to the list bucket callback by a call to
* S3_list_bucket. It identifies a single matching key from the list
- * operation. All fields of this structure are non-optional and will be
- * present.
+ * operation.
**/
-typedef struct ListBucketContent
+typedef struct S3ListBucketContent
{
/**
* This is the next key in the list bucket results.
@@ -442,15 +443,9 @@ typedef struct ListBucketContent
const char *key;
/**
* This is the number of seconds since UNIX epoch of the last modified
- * date of the object identified by the key.
- **/
- int lastModifiedSeconds;
- /**
- * This is the number of microseconds within the second specified by
- * lastModifiedSeconds of the last modified date of the object identified
- * by the key.
+ * date of the object identified by the key.
**/
- int lastModifiedMilliseconds;
+ time_t lastModified;
/**
* This gives a tag which gives a signature of the contents of the object.
**/
@@ -459,7 +454,17 @@ typedef struct ListBucketContent
* This is the size of the object
**/
uint64_t size;
-} ListBucketContent;
+ /**
+ * This is the ID of the owner of the key; it is present only if
+ * access permissions allow it to be viewed.
+ **/
+ const char *ownerId;
+ /**
+ * This is the display name of the owner of the key; it is present only if
+ * access permissions allow it to be viewed.
+ **/
+ const char *ownerDisplayName;
+} S3ListBucketContent;
/**
@@ -614,15 +619,12 @@ typedef void (S3ResponseCompleteCallback)(S3Status status,
* @param creationDateSeconds if < 0 indicates that no creation date was
* supplied for the bucket; if > 0 indicates the number of seconds
* since UNIX Epoch of the creation date of the bucket
- * @param creationDateMilliseconds gives an offset from creationDateSeconds
- * at which the bucket was created
* @return S3Status???
**/
typedef S3Status (S3ListServiceCallback)(const char *ownerId,
const char *ownerDisplayName,
const char *bucketName,
- int creationDateSeconds,
- int creationDateMilliseconds,
+ time_t creationDateSeconds,
void *callbackData);
@@ -648,8 +650,10 @@ typedef S3Status (S3ListServiceCallback)(const char *ownerId,
**/
typedef S3Status (S3ListBucketCallback)(int isTruncated,
const char *nextMarker,
- int contentsLength,
- const ListBucketContent *contents,
+ int contentsCount,
+ const S3ListBucketContent *contents,
+ int commonPrefixesCount,
+ const char **commonPrefixes,
void *callbackData);
diff --git a/inc/util.h b/inc/util.h
index c56f3cc..5c6c865 100644
--- a/inc/util.h
+++ b/inc/util.h
@@ -83,8 +83,16 @@ void mutex_destroy(struct S3Mutex *mutex);
// Utilities -----------------------------------------------------------------
-// Returns 0 on success, nonzero on failure
-int parseIso8601Time(const char *str, time_t *secondsReturn, int *millisReturn);
+// URL-encodes a string from [src] into [dest]. [dest] must have at least
+// 3x the number of characters that [source] has. At most [maxSrcSize] bytes
+// from [src] are encoded; if more are present in [src], 0 is returned from
+// urlEncode, else nonzero is returned.
+int urlEncode(char *dest, const char *src, int maxSrcSize);
+
+// Returns < 0 on failure >= 0 on success
+time_t parseIso8601Time(const char *str);
+
+uint64_t parseUnsignedInt(const char *str);
#endif /* UTIL_H */