diff options
author | Bryan Ischo <bryan@ischo.com> | 2008-12-30 12:02:46 +0000 |
---|---|---|
committer | Bryan Ischo <bryan@ischo.com> | 2008-12-30 12:02:46 +0000 |
commit | 37d90995389c2aed1d37b7b3aa6215759e14b94a (patch) | |
tree | 45a0121b98f6843da1edd61579049825988592cb /inc | |
parent | ff546d9907178b66d844772840f763e34eca3bf8 (diff) | |
download | ceph-libs3-37d90995389c2aed1d37b7b3aa6215759e14b94a.tar.gz |
* tabify source, to fix the broken .emacs configuration I have been using
since forever (finally realized it was broken and fixed it today!)
Diffstat (limited to 'inc')
-rw-r--r-- | inc/error_parser.h | 44 | ||||
-rw-r--r-- | inc/libs3.h | 1914 | ||||
-rw-r--r-- | inc/mingw/pthread.h | 2 | ||||
-rw-r--r-- | inc/mingw/sys/utsname.h | 4 | ||||
-rw-r--r-- | inc/request.h | 158 | ||||
-rw-r--r-- | inc/request_context.h | 4 | ||||
-rw-r--r-- | inc/response_headers_handler.h | 28 | ||||
-rw-r--r-- | inc/simplexml.h | 16 | ||||
-rw-r--r-- | inc/string_buffer.h | 100 | ||||
-rw-r--r-- | inc/util.h | 18 |
10 files changed, 1144 insertions, 1144 deletions
diff --git a/inc/error_parser.h b/inc/error_parser.h index 8785201..ad75225 100644 --- a/inc/error_parser.h +++ b/inc/error_parser.h @@ -36,34 +36,34 @@ typedef struct ErrorParser { - // This is the S3ErrorDetails that this ErrorParser fills in from the - // data that it parses - S3ErrorDetails s3ErrorDetails; + // This is the S3ErrorDetails that this ErrorParser fills in from the + // data that it parses + S3ErrorDetails s3ErrorDetails; - // This is the error XML parser - SimpleXml errorXmlParser; + // This is the error XML parser + SimpleXml errorXmlParser; - // Set to 1 after the first call to add - int errorXmlParserInitialized; + // Set to 1 after the first call to add + int errorXmlParserInitialized; - // Used to buffer the S3 Error Code as it is read in - string_buffer(code, 1024); + // Used to buffer the S3 Error Code as it is read in + string_buffer(code, 1024); - // Used to buffer the S3 Error Message as it is read in - string_buffer(message, 1024); + // Used to buffer the S3 Error Message as it is read in + string_buffer(message, 1024); - // Used to buffer the S3 Error Resource as it is read in - string_buffer(resource, 1024); + // Used to buffer the S3 Error Resource as it is read in + string_buffer(resource, 1024); - // Used to buffer the S3 Error Further Details as it is read in - string_buffer(furtherDetails, 1024); - - // The extra details; we support up to EXTRA_DETAILS_SIZE of them - S3NameValue extraDetails[EXTRA_DETAILS_SIZE]; + // Used to buffer the S3 Error Further Details as it is read in + string_buffer(furtherDetails, 1024); + + // The extra details; we support up to EXTRA_DETAILS_SIZE of them + S3NameValue extraDetails[EXTRA_DETAILS_SIZE]; - // This is the buffer from which the names and values used in extraDetails - // are allocated - string_multibuffer(extraDetailsNamesValues, EXTRA_DETAILS_SIZE * 1024); + // This is the buffer from which the names and values used in extraDetails + // are allocated + string_multibuffer(extraDetailsNamesValues, EXTRA_DETAILS_SIZE * 1024); } ErrorParser; @@ -71,7 +71,7 @@ typedef struct ErrorParser void error_parser_initialize(ErrorParser *errorParser); S3Status error_parser_add(ErrorParser *errorParser, char *buffer, - int bufferSize); + int bufferSize); void error_parser_convert_status(ErrorParser *errorParser, S3Status *status); diff --git a/inc/libs3.h b/inc/libs3.h index 89fbcc4..8f9b199 100644 --- a/inc/libs3.h +++ b/inc/libs3.h @@ -44,31 +44,31 @@ extern "C" { * http://s3.amazonaws.com). Its design goals are: * * - To provide a simple and straightforward API for accessing all of S3's - * functionality + * functionality * - To not require the developer using libs3 to need to know anything about: - * - HTTP - * - XML - * - SSL - * In other words, this API is meant to stand on its own, without requiring - * any implicit knowledge of how S3 services are accessed using HTTP - * protocols. + * - HTTP + * - XML + * - SSL + * In other words, this API is meant to stand on its own, without requiring + * any implicit knowledge of how S3 services are accessed using HTTP + * protocols. * - To be usable from multithreaded code * - To be usable by code which wants to process multiple S3 requests - * simultaneously from a single thread + * simultaneously from a single thread * - To be usable in the simple, straightforward way using sequentialized - * blocking requests + * blocking requests * * The general usage pattern of libs3 is: * * - Initialize libs3 once per program by calling S3_initialize() at program - * start up time + * start up time * - Make any number of requests to S3 for getting, putting, or listing - * S3 buckets or objects, or modifying the ACLs associated with buckets - * or objects, using one of three general approaches: - * 1. Simple blocking requests, one at a time - * 2. Multiple threads each making simple blocking requests - * 3. From a single thread, managing multiple S3 requests simultaneously - * using file descriptors and a select()/poll() loop + * S3 buckets or objects, or modifying the ACLs associated with buckets + * or objects, using one of three general approaches: + * 1. Simple blocking requests, one at a time + * 2. Multiple threads each making simple blocking requests + * 3. From a single thread, managing multiple S3 requests simultaneously + * using file descriptors and a select()/poll() loop * - Shut down libs3 at program exit time by calling S3_deinitialize() * * In order to use libs3 with multiple threads, your program must provide @@ -92,27 +92,27 @@ extern "C" { * * NOTE: Because HTTP and the S3 REST protocol are highly under-specified, * libs3 must make some assumptions about the maximum length of certain HTTP - * elements (such as headers) that it will accept. While efforts have been + * elements (such as headers) that it will accept. While efforts have been * made to enforce maximums which are beyond that expected to be needed by any * user of S3, it is always possible that these maximums may be too low in - * some rare circumstances. Bug reports should this unlikely situation occur + * some rare circumstances. Bug reports should this unlikely situation occur * would be most appreciated. * * Threading Rules * --------------- * * 1. All arguments passed to any function must not be modified directly until - * the function returns. + * the function returns. * 2. All S3RequestContext and S3Request arguments passed to all functions may - * not be passed to any other libs3 function by any other thread until the - * function returns. + * not be passed to any other libs3 function by any other thread until the + * function returns. * 3. All functions may be called simultaneously by multiple threads as long - * as (1) and (2) are observed, EXCEPT for S3_initialize(), which must be - * called from one thread at a time only. + * as (1) and (2) are observed, EXCEPT for S3_initialize(), which must be + * called from one thread at a time only. * 4. All callbacks will be made in the thread of the caller of the function - * which invoked them, so the caller of all libs3 functions should not hold - * locks that it would try to re-acquire in a callback, as this may - * deadlock. + * which invoked them, so the caller of all libs3 functions should not hold + * locks that it would try to re-acquire in a callback, as this may + * deadlock. ************************************************************************** **/ @@ -125,32 +125,32 @@ extern "C" { * style requests will prepend the bucket name to this host name, and * path-style requests will use this hostname directly **/ -#define S3_HOSTNAME "s3.amazonaws.com" +#define S3_HOSTNAME "s3.amazonaws.com" /** * S3_MAX_BUCKET_NAME_SIZE is the maximum size of a bucket name. **/ -#define S3_MAX_BUCKET_NAME_SIZE 255 +#define S3_MAX_BUCKET_NAME_SIZE 255 /** * S3_MAX_KEY_SIZE is the maximum size of keys that Amazon S3 supports. **/ -#define S3_MAX_KEY_SIZE 1024 +#define S3_MAX_KEY_SIZE 1024 /** * S3_MAX_METADATA_SIZE is the maximum number of bytes allowed for * x-amz-meta header names and values in any request passed to Amazon S3 **/ -#define S3_MAX_METADATA_SIZE 2048 +#define S3_MAX_METADATA_SIZE 2048 /** * S3_METADATA_HEADER_NAME_PREFIX is the prefix of an S3 "meta header" **/ -#define S3_METADATA_HEADER_NAME_PREFIX "x-amz-meta-" +#define S3_METADATA_HEADER_NAME_PREFIX "x-amz-meta-" /** @@ -161,7 +161,7 @@ extern "C" { * "x-amz-meta-nv". **/ #define S3_MAX_METADATA_COUNT \ - (S3_MAX_METADATA_SIZE / (sizeof(S3_METADATA_HEADER_NAME_PREFIX "nv") - 1)) + (S3_MAX_METADATA_SIZE / (sizeof(S3_METADATA_HEADER_NAME_PREFIX "nv") - 1)) /** @@ -169,7 +169,7 @@ extern "C" { * set on a bucket or object at one time. It is also the maximum number of * ACL grants that the XML ACL parsing routine will parse. **/ -#define S3_MAX_ACL_GRANT_COUNT 100 +#define S3_MAX_ACL_GRANT_COUNT 100 /** @@ -183,7 +183,7 @@ extern "C" { * This is the maximum number of characters (including terminating \0) that * libs3 supports in an ACL grantee user id. **/ -#define S3_MAX_GRANTEE_USER_ID_SIZE 128 +#define S3_MAX_GRANTEE_USER_ID_SIZE 128 /** @@ -199,9 +199,9 @@ extern "C" { * query string **/ #define S3_MAX_AUTHENTICATED_QUERY_STRING_SIZE \ - (sizeof("https://" S3_HOSTNAME "/") + (S3_MAX_KEY_SIZE * 3) + \ - sizeof("?AWSAccessKeyId=") + 32 + sizeof("&Expires=") + 32 + \ - sizeof("&Signature=") + 28 + 1) + (sizeof("https://" S3_HOSTNAME "/") + (S3_MAX_KEY_SIZE * 3) + \ + sizeof("?AWSAccessKeyId=") + 32 + sizeof("&Expires=") + 32 + \ + sizeof("&Signature=") + 28 + 1) /** @@ -209,14 +209,14 @@ extern "C" { * the winsock library should be initialized by libs3; only relevent on * Microsoft Windows platforms. **/ -#define S3_INIT_WINSOCK 1 +#define S3_INIT_WINSOCK 1 /** * This convenience constant is used by the S3_initialize() function to * indicate that all libraries required by libs3 should be initialized. **/ -#define S3_INIT_ALL (S3_INIT_WINSOCK) +#define S3_INIT_ALL (S3_INIT_WINSOCK) /** ************************************************************************** @@ -230,138 +230,138 @@ extern "C" { **/ typedef enum { - S3StatusOK , - - /** - * Errors that prevent the S3 request from being issued or response from - * being read - **/ - S3StatusInternalError , - S3StatusOutOfMemory , - S3StatusInterrupted , - S3StatusInvalidBucketNameTooLong , - S3StatusInvalidBucketNameFirstCharacter , - S3StatusInvalidBucketNameCharacter , - S3StatusInvalidBucketNameCharacterSequence , - S3StatusInvalidBucketNameTooShort , - S3StatusInvalidBucketNameDotQuadNotation , - S3StatusQueryParamsTooLong , - S3StatusFailedToInitializeRequest , - S3StatusMetaDataHeadersTooLong , - S3StatusBadMetaData , - S3StatusBadContentType , - S3StatusContentTypeTooLong , - S3StatusBadMD5 , - S3StatusMD5TooLong , - S3StatusBadCacheControl , - S3StatusCacheControlTooLong , - S3StatusBadContentDispositionFilename , - S3StatusContentDispositionFilenameTooLong , - S3StatusBadContentEncoding , - S3StatusContentEncodingTooLong , - S3StatusBadIfMatchETag , - S3StatusIfMatchETagTooLong , - S3StatusBadIfNotMatchETag , - S3StatusIfNotMatchETagTooLong , - S3StatusHeadersTooLong , - S3StatusKeyTooLong , - S3StatusUriTooLong , - S3StatusXmlParseFailure , - S3StatusEmailAddressTooLong , - S3StatusUserIdTooLong , - S3StatusUserDisplayNameTooLong , - S3StatusGroupUriTooLong , - S3StatusPermissionTooLong , - S3StatusTargetBucketTooLong , - S3StatusTargetPrefixTooLong , - S3StatusTooManyGrants , - S3StatusBadGrantee , - S3StatusBadPermission , - S3StatusXmlDocumentTooLarge , - S3StatusNameLookupError , - S3StatusFailedToConnect , - S3StatusServerFailedVerification , - S3StatusConnectionFailed , - S3StatusAbortedByCallback , - - /** - * Errors from the S3 service - **/ - S3StatusErrorAccessDenied , - S3StatusErrorAccountProblem , - S3StatusErrorAmbiguousGrantByEmailAddress , - S3StatusErrorBadDigest , - S3StatusErrorBucketAlreadyExists , - S3StatusErrorBucketAlreadyOwnedByYou , - S3StatusErrorBucketNotEmpty , - S3StatusErrorCredentialsNotSupported , - S3StatusErrorCrossLocationLoggingProhibited , - S3StatusErrorEntityTooSmall , - S3StatusErrorEntityTooLarge , - S3StatusErrorExpiredToken , - S3StatusErrorIncompleteBody , - S3StatusErrorIncorrectNumberOfFilesInPostRequest , - S3StatusErrorInlineDataTooLarge , - S3StatusErrorInternalError , - S3StatusErrorInvalidAccessKeyId , - S3StatusErrorInvalidAddressingHeader , - S3StatusErrorInvalidArgument , - S3StatusErrorInvalidBucketName , - S3StatusErrorInvalidDigest , - S3StatusErrorInvalidLocationConstraint , - S3StatusErrorInvalidPayer , - S3StatusErrorInvalidPolicyDocument , - S3StatusErrorInvalidRange , - S3StatusErrorInvalidSecurity , - S3StatusErrorInvalidSOAPRequest , - S3StatusErrorInvalidStorageClass , - S3StatusErrorInvalidTargetBucketForLogging , - S3StatusErrorInvalidToken , - S3StatusErrorInvalidURI , - S3StatusErrorKeyTooLong , - S3StatusErrorMalformedACLError , - S3StatusErrorMalformedXML , - S3StatusErrorMaxMessageLengthExceeded , - S3StatusErrorMaxPostPreDataLengthExceededError , - S3StatusErrorMetadataTooLarge , - S3StatusErrorMethodNotAllowed , - S3StatusErrorMissingAttachment , - S3StatusErrorMissingContentLength , - S3StatusErrorMissingSecurityElement , - S3StatusErrorMissingSecurityHeader , - S3StatusErrorNoLoggingStatusForKey , - S3StatusErrorNoSuchBucket , - S3StatusErrorNoSuchKey , - S3StatusErrorNotImplemented , - S3StatusErrorNotSignedUp , - S3StatusErrorOperationAborted , - S3StatusErrorPermanentRedirect , - S3StatusErrorPreconditionFailed , - S3StatusErrorRedirect , - S3StatusErrorRequestIsNotMultiPartContent , - S3StatusErrorRequestTimeout , - S3StatusErrorRequestTimeTooSkewed , - S3StatusErrorRequestTorrentOfBucketError , - S3StatusErrorSignatureDoesNotMatch , - S3StatusErrorSlowDown , - S3StatusErrorTemporaryRedirect , - S3StatusErrorTokenRefreshRequired , - S3StatusErrorTooManyBuckets , - S3StatusErrorUnexpectedContent , - S3StatusErrorUnresolvableGrantByEmailAddress , - S3StatusErrorUserKeyMustBeSpecified , - S3StatusErrorUnknown , - - /** - * The following are HTTP errors returned by S3 without enough detail to - * distinguish any of the above S3StatusError conditions - **/ - S3StatusHttpErrorMovedTemporarily , - S3StatusHttpErrorBadRequest , - S3StatusHttpErrorForbidden , - S3StatusHttpErrorNotFound , - S3StatusHttpErrorConflict , - S3StatusHttpErrorUnknown + S3StatusOK , + + /** + * Errors that prevent the S3 request from being issued or response from + * being read + **/ + S3StatusInternalError , + S3StatusOutOfMemory , + S3StatusInterrupted , + S3StatusInvalidBucketNameTooLong , + S3StatusInvalidBucketNameFirstCharacter , + S3StatusInvalidBucketNameCharacter , + S3StatusInvalidBucketNameCharacterSequence , + S3StatusInvalidBucketNameTooShort , + S3StatusInvalidBucketNameDotQuadNotation , + S3StatusQueryParamsTooLong , + S3StatusFailedToInitializeRequest , + S3StatusMetaDataHeadersTooLong , + S3StatusBadMetaData , + S3StatusBadContentType , + S3StatusContentTypeTooLong , + S3StatusBadMD5 , + S3StatusMD5TooLong , + S3StatusBadCacheControl , + S3StatusCacheControlTooLong , + S3StatusBadContentDispositionFilename , + S3StatusContentDispositionFilenameTooLong , + S3StatusBadContentEncoding , + S3StatusContentEncodingTooLong , + S3StatusBadIfMatchETag , + S3StatusIfMatchETagTooLong , + S3StatusBadIfNotMatchETag , + S3StatusIfNotMatchETagTooLong , + S3StatusHeadersTooLong , + S3StatusKeyTooLong , + S3StatusUriTooLong , + S3StatusXmlParseFailure , + S3StatusEmailAddressTooLong , + S3StatusUserIdTooLong , + S3StatusUserDisplayNameTooLong , + S3StatusGroupUriTooLong , + S3StatusPermissionTooLong , + S3StatusTargetBucketTooLong , + S3StatusTargetPrefixTooLong , + S3StatusTooManyGrants , + S3StatusBadGrantee , + S3StatusBadPermission , + S3StatusXmlDocumentTooLarge , + S3StatusNameLookupError , + S3StatusFailedToConnect , + S3StatusServerFailedVerification , + S3StatusConnectionFailed , + S3StatusAbortedByCallback , + + /** + * Errors from the S3 service + **/ + S3StatusErrorAccessDenied , + S3StatusErrorAccountProblem , + S3StatusErrorAmbiguousGrantByEmailAddress , + S3StatusErrorBadDigest , + S3StatusErrorBucketAlreadyExists , + S3StatusErrorBucketAlreadyOwnedByYou , + S3StatusErrorBucketNotEmpty , + S3StatusErrorCredentialsNotSupported , + S3StatusErrorCrossLocationLoggingProhibited , + S3StatusErrorEntityTooSmall , + S3StatusErrorEntityTooLarge , + S3StatusErrorExpiredToken , + S3StatusErrorIncompleteBody , + S3StatusErrorIncorrectNumberOfFilesInPostRequest , + S3StatusErrorInlineDataTooLarge , + S3StatusErrorInternalError , + S3StatusErrorInvalidAccessKeyId , + S3StatusErrorInvalidAddressingHeader , + S3StatusErrorInvalidArgument , + S3StatusErrorInvalidBucketName , + S3StatusErrorInvalidDigest , + S3StatusErrorInvalidLocationConstraint , + S3StatusErrorInvalidPayer , + S3StatusErrorInvalidPolicyDocument , + S3StatusErrorInvalidRange , + S3StatusErrorInvalidSecurity , + S3StatusErrorInvalidSOAPRequest , + S3StatusErrorInvalidStorageClass , + S3StatusErrorInvalidTargetBucketForLogging , + S3StatusErrorInvalidToken , + S3StatusErrorInvalidURI , + S3StatusErrorKeyTooLong , + S3StatusErrorMalformedACLError , + S3StatusErrorMalformedXML , + S3StatusErrorMaxMessageLengthExceeded , + S3StatusErrorMaxPostPreDataLengthExceededError , + S3StatusErrorMetadataTooLarge , + S3StatusErrorMethodNotAllowed , + S3StatusErrorMissingAttachment , + S3StatusErrorMissingContentLength , + S3StatusErrorMissingSecurityElement , + S3StatusErrorMissingSecurityHeader , + S3StatusErrorNoLoggingStatusForKey , + S3StatusErrorNoSuchBucket , + S3StatusErrorNoSuchKey , + S3StatusErrorNotImplemented , + S3StatusErrorNotSignedUp , + S3StatusErrorOperationAborted , + S3StatusErrorPermanentRedirect , + S3StatusErrorPreconditionFailed , + S3StatusErrorRedirect , + S3StatusErrorRequestIsNotMultiPartContent , + S3StatusErrorRequestTimeout , + S3StatusErrorRequestTimeTooSkewed , + S3StatusErrorRequestTorrentOfBucketError , + S3StatusErrorSignatureDoesNotMatch , + S3StatusErrorSlowDown , + S3StatusErrorTemporaryRedirect , + S3StatusErrorTokenRefreshRequired , + S3StatusErrorTooManyBuckets , + S3StatusErrorUnexpectedContent , + S3StatusErrorUnresolvableGrantByEmailAddress , + S3StatusErrorUserKeyMustBeSpecified , + S3StatusErrorUnknown , + + /** + * The following are HTTP errors returned by S3 without enough detail to + * distinguish any of the above S3StatusError conditions + **/ + S3StatusHttpErrorMovedTemporarily , + S3StatusHttpErrorBadRequest , + S3StatusHttpErrorForbidden , + S3StatusHttpErrorNotFound , + S3StatusHttpErrorConflict , + S3StatusHttpErrorUnknown } S3Status; @@ -371,102 +371,102 @@ typedef enum * * In general, HTTPS is greatly preferred (and should be the default of any * application using libs3) because it protects any data being sent to or - * from S3 using strong encryption. However, HTTPS is much more CPU intensive + * from S3 using strong encryption. However, HTTPS is much more CPU intensive * than HTTP, and if the caller is absolutely certain that it is OK for the * data to be viewable by anyone in transit, then HTTP can be used. **/ typedef enum { - S3ProtocolHTTPS = 0, - S3ProtocolHTTP = 1 + S3ProtocolHTTPS = 0, + S3ProtocolHTTP = 1 } S3Protocol; /** * S3UriStyle defines the form that an Amazon S3 URI identifying a bucket or - * object can take. They are of these forms: + * object can take. They are of these forms: * * Virtual Host: ${protocol}://${bucket}.s3.amazonaws.com/[${key}] * Path: ${protocol}://s3.amazonaws.com/${bucket}/[${key}] * * It is generally better to use the Virual Host URI form, because it ensures * that the bucket name used is compatible with normal HTTP GETs and POSTs of - * data to/from the bucket. However, if DNS lookups for the bucket are too + * data to/from the bucket. However, if DNS lookups for the bucket are too * slow or unreliable for some reason, Path URI form may be used. **/ typedef enum { - S3UriStyleVirtualHost = 0, - S3UriStylePath = 1 + S3UriStyleVirtualHost = 0, + S3UriStylePath = 1 } S3UriStyle; /** * S3GranteeType defines the type of Grantee used in an S3 ACL Grant. * Amazon Customer By Email - identifies the Grantee using their Amazon S3 - * account email address + * account email address * Canonical User - identifies the Grantee by S3 User ID and Display Name, - * which can only be obtained by making requests to S3, for example, by - * listing owned buckets + * which can only be obtained by making requests to S3, for example, by + * listing owned buckets * All AWS Users - identifies all authenticated AWS users * All Users - identifies all users * Log Delivery - identifies the Amazon group responsible for writing - * server access logs into buckets + * server access logs into buckets **/ typedef enum { - S3GranteeTypeAmazonCustomerByEmail = 0, - S3GranteeTypeCanonicalUser = 1, - S3GranteeTypeAllAwsUsers = 2, - S3GranteeTypeAllUsers = 3, - S3GranteeTypeLogDelivery = 4 + S3GranteeTypeAmazonCustomerByEmail = 0, + S3GranteeTypeCanonicalUser = 1, + S3GranteeTypeAllAwsUsers = 2, + S3GranteeTypeAllUsers = 3, + S3GranteeTypeLogDelivery = 4 } S3GranteeType; /** * This is an individual permission granted to a grantee in an S3 ACL Grant. * Read permission gives the Grantee the permission to list the bucket, or - * read the object or its metadata + * read the object or its metadata * Write permission gives the Grantee the permission to create, overwrite, or - * delete any object in the bucket, and is not supported for objects + * delete any object in the bucket, and is not supported for objects * ReadACP permission gives the Grantee the permission to read the ACP for - * the bucket or object; the owner of the bucket or object always has - * this permission implicitly + * the bucket or object; the owner of the bucket or object always has + * this permission implicitly * WriteACP permission gives the Grantee the permission to overwrite the ACP - * for the bucket or object; the owner of the bucket or object always has - * this permission implicitly + * for the bucket or object; the owner of the bucket or object always has + * this permission implicitly * FullControl permission gives the Grantee all permissions specified by the - * Read, Write, ReadACP, and WriteACP permissions + * Read, Write, ReadACP, and WriteACP permissions **/ typedef enum { - S3PermissionRead = 0, - S3PermissionWrite = 1, - S3PermissionReadACP = 2, - S3PermissionWriteACP = 3, - S3PermissionFullControl = 4 + S3PermissionRead = 0, + S3PermissionWrite = 1, + S3PermissionReadACP = 2, + S3PermissionWriteACP = 3, + S3PermissionFullControl = 4 } S3Permission; /** * S3CannedAcl is an ACL that can be specified when an object is created or - * updated. Each canned ACL has a predefined value when expanded to a full + * updated. Each canned ACL has a predefined value when expanded to a full * set of S3 ACL Grants. * Private canned ACL gives the owner FULL_CONTROL and no other permissions - * are issued + * are issued * Public Read canned ACL gives the owner FULL_CONTROL and all users Read - * permission + * permission * Public Read Write canned ACL gives the owner FULL_CONTROL and all users - * Read and Write permission + * Read and Write permission * AuthenticatedRead canned ACL gives the owner FULL_CONTROL and authenticated - * S3 users Read permission + * S3 users Read permission **/ typedef enum { - S3CannedAclPrivate = 0, /* private */ - S3CannedAclPublicRead = 1, /* public-read */ - S3CannedAclPublicReadWrite = 2, /* public-read-write */ - S3CannedAclAuthenticatedRead = 3 /* authenticated-read */ + S3CannedAclPrivate = 0, /* private */ + S3CannedAclPublicRead = 1, /* public-read */ + S3CannedAclPublicReadWrite = 2, /* public-read-write */ + S3CannedAclAuthenticatedRead = 3 /* authenticated-read */ } S3CannedAcl; @@ -487,296 +487,296 @@ typedef struct S3RequestContext S3RequestContext; **/ typedef struct S3NameValue { - /** - * The name part of the Name - Value pair - **/ - const char *name; - - /** - * The value part of the Name - Value pair - **/ - const char *value; + /** + * The name part of the Name - Value pair + **/ + const char *name; + + /** + * The value part of the Name - Value pair + **/ + const char *value; } S3NameValue; /** * S3ResponseProperties is passed to the properties callback function which is - * called when the complete response properties have been received. Some of + * called when the complete response properties have been received. Some of * the fields of this structure are optional and may not be provided in the * response, and some will always be provided in the response. **/ typedef struct S3ResponseProperties { - /** - * This optional field identifies the request ID and may be used when - * reporting problems to Amazon. - **/ - const char *requestId; - - /** - * This optional field identifies the request ID and may be used when - * reporting problems to Amazon. - **/ - const char *requestId2; - - /** - * This optional field is the content type of the data which is returned - * by the request. If not provided, the default can be assumed to be - * "binary/octet-stream". - **/ - const char *contentType; - - /** - * This optional field is the content length of the data which is returned - * in the response. A negative value means that this value was not - * provided in the response. A value of 0 means that there is no content - * provided. A positive value gives the number of bytes in the content of - * the response. - **/ - uint64_t contentLength; - - /** - * This optional field names the server which serviced the request. - **/ - const char *server; - - /** - * This optional field provides a string identifying the unique contents - * of the resource identified by the request, such that the contents can - * be assumed not to be changed if the same eTag is returned at a later - * time decribing the same resource. This is an MD5 sum of the contents. - **/ - const char *eTag; - - /** - * 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 time was not provided in the response. If this value is >= 0, - * then the last modified date of the contents are available as a number - * of seconds since the UNIX epoch. - * - **/ - int64_t lastModified; - - /** - * This is the number of user-provided meta data associated with the - * resource. - **/ - int metaDataCount; - - /** - * These are the meta data associated with the resource. In each case, - * the name will not include any S3-specific header prefixes - * (i.e. x-amz-meta- will have been removed from the beginning), and - * leading and trailing whitespace will have been stripped from the value. - **/ - const S3NameValue *metaData; + /** + * This optional field identifies the request ID and may be used when + * reporting problems to Amazon. + **/ + const char *requestId; + + /** + * This optional field identifies the request ID and may be used when + * reporting problems to Amazon. + **/ + const char *requestId2; + + /** + * This optional field is the content type of the data which is returned + * by the request. If not provided, the default can be assumed to be + * "binary/octet-stream". + **/ + const char *contentType; + + /** + * This optional field is the content length of the data which is returned + * in the response. A negative value means that this value was not + * provided in the response. A value of 0 means that there is no content + * provided. A positive value gives the number of bytes in the content of + * the response. + **/ + uint64_t contentLength; + + /** + * This optional field names the server which serviced the request. + **/ + const char *server; + + /** + * This optional field provides a string identifying the unique contents + * of the resource identified by the request, such that the contents can + * be assumed not to be changed if the same eTag is returned at a later + * time decribing the same resource. This is an MD5 sum of the contents. + **/ + const char *eTag; + + /** + * 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 time was not provided in the response. If this value is >= 0, + * then the last modified date of the contents are available as a number + * of seconds since the UNIX epoch. + * + **/ + int64_t lastModified; + + /** + * This is the number of user-provided meta data associated with the + * resource. + **/ + int metaDataCount; + + /** + * These are the meta data associated with the resource. In each case, + * the name will not include any S3-specific header prefixes + * (i.e. x-amz-meta- will have been removed from the beginning), and + * leading and trailing whitespace will have been stripped from the value. + **/ + const S3NameValue *metaData; } S3ResponseProperties; /** - * S3AclGrant identifies a single grant in the ACL for a bucket or object. An + * S3AclGrant identifies a single grant in the ACL for a bucket or object. An * ACL is composed of any number of grants, which specify a grantee and the * permissions given to that grantee. S3 does not normalize ACLs in any way, * so a redundant ACL specification will lead to a redundant ACL stored in S3. **/ typedef struct S3AclGrant { - /** - * The granteeType gives the type of grantee specified by this grant. - **/ - S3GranteeType granteeType; - /** - * The identifier of the grantee that is set is determined by the - * granteeType: - * - * S3GranteeTypeAmazonCustomerByEmail - amazonCustomerByEmail.emailAddress - * S3GranteeTypeCanonicalUser - canonicalUser.id, canonicalUser.displayName - * S3GranteeTypeAllAwsUsers - none - * S3GranteeTypeAllUsers - none - **/ - union - { - /** - * This structure is used iff the granteeType is - * S3GranteeTypeAmazonCustomerByEmail. - **/ - struct - { - /** - * This is the email address of the Amazon Customer being granted - * permissions by this S3AclGrant. - **/ - char emailAddress[S3_MAX_GRANTEE_EMAIL_ADDRESS_SIZE]; - } amazonCustomerByEmail; - /** - * This structure is used iff the granteeType is - * S3GranteeTypeCanonicalUser. - **/ - struct - { - /** - * This is the CanonicalUser ID of the grantee - **/ - char id[S3_MAX_GRANTEE_USER_ID_SIZE]; - /** - * This is the display name of the grantee - **/ - char displayName[S3_MAX_GRANTEE_DISPLAY_NAME_SIZE]; - } canonicalUser; - } grantee; - /** - * This is the S3Permission to be granted to the grantee - **/ - S3Permission permission; + /** + * The granteeType gives the type of grantee specified by this grant. + **/ + S3GranteeType granteeType; + /** + * The identifier of the grantee that is set is determined by the + * granteeType: + * + * S3GranteeTypeAmazonCustomerByEmail - amazonCustomerByEmail.emailAddress + * S3GranteeTypeCanonicalUser - canonicalUser.id, canonicalUser.displayName + * S3GranteeTypeAllAwsUsers - none + * S3GranteeTypeAllUsers - none + **/ + union + { + /** + * This structure is used iff the granteeType is + * S3GranteeTypeAmazonCustomerByEmail. + **/ + struct + { + /** + * This is the email address of the Amazon Customer being granted + * permissions by this S3AclGrant. + **/ + char emailAddress[S3_MAX_GRANTEE_EMAIL_ADDRESS_SIZE]; + } amazonCustomerByEmail; + /** + * This structure is used iff the granteeType is + * S3GranteeTypeCanonicalUser. + **/ + struct + { + /** + * This is the CanonicalUser ID of the grantee + **/ + char id[S3_MAX_GRANTEE_USER_ID_SIZE]; + /** + * This is the display name of the grantee + **/ + char displayName[S3_MAX_GRANTEE_DISPLAY_NAME_SIZE]; + } canonicalUser; + } grantee; + /** + * This is the S3Permission to be granted to the grantee + **/ + S3Permission permission; } S3AclGrant; /** - * A context for working with objects within a bucket. A bucket context holds + * A context for working with objects within a bucket. A bucket context holds * all information necessary for working with a bucket, and may be used * repeatedly over many consecutive (or simultaneous) calls into libs3 bucket * operation functions. **/ typedef struct S3BucketContext { - /** - * The name of the bucket to use in the bucket context - **/ - const char *bucketName; - - /** - * The protocol to use when accessing the bucket - **/ - S3Protocol protocol; - - /** - * The URI style to use for all URIs sent to Amazon S3 while working with - * this bucket context - **/ - S3UriStyle uriStyle; - - /** - * The Amazon Access Key ID to use for access to the bucket - **/ - const char *accessKeyId; - - /** - * The Amazon Secret Access Key to use for access to the bucket - **/ - const char *secretAccessKey; + /** + * The name of the bucket to use in the bucket context + **/ + const char *bucketName; + + /** + * The protocol to use when accessing the bucket + **/ + S3Protocol protocol; + + /** + * The URI style to use for all URIs sent to Amazon S3 while working with + * this bucket context + **/ + S3UriStyle uriStyle; + + /** + * The Amazon Access Key ID to use for access to the bucket + **/ + const char *accessKeyId; + + /** + * The Amazon Secret Access Key to use for access to the bucket + **/ + const char *secretAccessKey; } 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 + * S3_list_bucket. It identifies a single matching key from the list * operation. **/ typedef struct S3ListBucketContent { - /** - * This is the next key in the list bucket results. - **/ - const char *key; - - /** - * This is the number of seconds since UNIX epoch of the last modified - * date of the object identified by the key. - **/ - int64_t lastModified; - - /** - * This gives a tag which gives a signature of the contents of the object, - * which is the MD5 of the contents of the object. - **/ - const char *eTag; - - /** - * This is the size of the object in bytes. - **/ - uint64_t size; - - /** - * 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; + /** + * This is the next key in the list bucket results. + **/ + const char *key; + + /** + * This is the number of seconds since UNIX epoch of the last modified + * date of the object identified by the key. + **/ + int64_t lastModified; + + /** + * This gives a tag which gives a signature of the contents of the object, + * which is the MD5 of the contents of the object. + **/ + const char *eTag; + + /** + * This is the size of the object in bytes. + **/ + uint64_t size; + + /** + * 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; /** * S3PutProperties is the set of properties that may optionally be set by the - * user when putting objects to S3. Each field of this structure is optional + * user when putting objects to S3. Each field of this structure is optional * and may or may not be present. **/ typedef struct S3PutProperties { - /** - * If present, this is the Content-Type that should be associated with the - * object. If not provided, S3 defaults to "binary/octet-stream". - **/ - const char *contentType; - - /** - * If present, this provides the MD5 signature of the contents, and is - * used to validate the contents. This is highly recommended by Amazon - * but not required. Its format is as a base64-encoded MD5 sum. - **/ - const char *md5; - - /** - * If present, this gives a Cache-Control header string to be supplied to - * HTTP clients which download this - **/ - const char *cacheControl; - - /** - * If present, this gives the filename to save the downloaded file to, - * whenever the object is downloaded via a web browser. This is only - * relevent for objects which are intended to be shared to users via web - * browsers and which is additionally intended to be downloaded rather - * than viewed. - **/ - const char *contentDispositionFilename; - - /** - * If present, this identifies the content encoding of the object. This - * is only applicable to encoded (usually, compressed) content, and only - * relevent if the object is intended to be downloaded via a browser. - **/ - const char *contentEncoding; - - /** - * If >= 0, this gives an expiration date for the content. This - * information is typically only delivered to users who download the - * content via a web browser. - **/ - int64_t expires; - - /** - * This identifies the "canned ACL" that should be used for this object. - * The default (0) gives only the owner of the object access to it. - **/ - S3CannedAcl cannedAcl; - - /** - * This is the number of values in the metaData field. - **/ - int metaDataCount; - - /** - * These are the meta data to pass to S3. In each case, the name part of - * the Name - Value pair should not include any special S3 HTTP header - * prefix (i.e., should be of the form 'foo', NOT 'x-amz-meta-foo'). - **/ - const S3NameValue *metaData; + /** + * If present, this is the Content-Type that should be associated with the + * object. If not provided, S3 defaults to "binary/octet-stream". + **/ + const char *contentType; + + /** + * If present, this provides the MD5 signature of the contents, and is + * used to validate the contents. This is highly recommended by Amazon + * but not required. Its format is as a base64-encoded MD5 sum. + **/ + const char *md5; + + /** + * If present, this gives a Cache-Control header string to be supplied to + * HTTP clients which download this + **/ + const char *cacheControl; + + /** + * If present, this gives the filename to save the downloaded file to, + * whenever the object is downloaded via a web browser. This is only + * relevent for objects which are intended to be shared to users via web + * browsers and which is additionally intended to be downloaded rather + * than viewed. + **/ + const char *contentDispositionFilename; + + /** + * If present, this identifies the content encoding of the object. This + * is only applicable to encoded (usually, compressed) content, and only + * relevent if the object is intended to be downloaded via a browser. + **/ + const char *contentEncoding; + + /** + * If >= 0, this gives an expiration date for the content. This + * information is typically only delivered to users who download the + * content via a web browser. + **/ + int64_t expires; + + /** + * This identifies the "canned ACL" that should be used for this object. + * The default (0) gives only the owner of the object access to it. + **/ + S3CannedAcl cannedAcl; + + /** + * This is the number of values in the metaData field. + **/ + int metaDataCount; + + /** + * These are the meta data to pass to S3. In each case, the name part of + * the Name - Value pair should not include any special S3 HTTP header + * prefix (i.e., should be of the form 'foo', NOT 'x-amz-meta-foo'). + **/ + const S3NameValue *metaData; } S3PutProperties; @@ -786,76 +786,76 @@ typedef struct S3PutProperties **/ typedef struct S3GetConditions { - /** - * The request will be processed if the Last-Modification header of the - * object is greater than or equal to this value, specified as a number of - * seconds since Unix epoch. If this value is less than zero, it will not - * be used in the conditional. - **/ - int64_t ifModifiedSince; - - /** - * The request will be processed if the Last-Modification header of the - * object is less than this value, specified as a number of seconds since - * Unix epoch. If this value is less than zero, it will not be used in - * the conditional. - **/ - int64_t ifNotModifiedSince; - - /** - * If non-NULL, this gives an eTag header value which the object must - * match in order to be returned. Note that altough the eTag is simply an - * MD5, this must be presented in the S3 eTag form, which typically - * includes double-quotes. - **/ - const char *ifMatchETag; - - /** - * If non-NULL, this gives an eTag header value which the object must not - * match in order to be returned. Note that altough the eTag is simply an - * MD5, this must be presented in the S3 eTag form, which typically - * includes double-quotes. - **/ - const char *ifNotMatchETag; + /** + * The request will be processed if the Last-Modification header of the + * object is greater than or equal to this value, specified as a number of + * seconds since Unix epoch. If this value is less than zero, it will not + * be used in the conditional. + **/ + int64_t ifModifiedSince; + + /** + * The request will be processed if the Last-Modification header of the + * object is less than this value, specified as a number of seconds since + * Unix epoch. If this value is less than zero, it will not be used in + * the conditional. + **/ + int64_t ifNotModifiedSince; + + /** + * If non-NULL, this gives an eTag header value which the object must + * match in order to be returned. Note that altough the eTag is simply an + * MD5, this must be presented in the S3 eTag form, which typically + * includes double-quotes. + **/ + const char *ifMatchETag; + + /** + * If non-NULL, this gives an eTag header value which the object must not + * match in order to be returned. Note that altough the eTag is simply an + * MD5, this must be presented in the S3 eTag form, which typically + * includes double-quotes. + **/ + const char *ifNotMatchETag; } S3GetConditions; /** - * S3ErrorDetails provides detailed information describing an S3 error. This + * S3ErrorDetails provides detailed information describing an S3 error. This * is only presented when the error is an S3-generated error (i.e. one of the * S3StatusErrorXXX values). **/ typedef struct S3ErrorDetails { - /** - * This is the human-readable message that Amazon supplied describing the - * error - **/ - const char *message; - - /** - * This identifies the resource for which the error occurred - **/ - const char *resource; - - /** - * This gives human-readable further details describing the specifics of - * this error - **/ - const char *furtherDetails; - - /** - * This gives the number of S3NameValue pairs present in the extraDetails - * array - **/ - int extraDetailsCount; - - /** - * S3 can provide extra details in a freeform Name - Value pair format. - * Each error can have any number of these, and this array provides these - * additional extra details. - **/ - S3NameValue *extraDetails; + /** + * This is the human-readable message that Amazon supplied describing the + * error + **/ + const char *message; + + /** + * This identifies the resource for which the error occurred + **/ + const char *resource; + + /** + * This gives human-readable further details describing the specifics of + * this error + **/ + const char *furtherDetails; + + /** + * This gives the number of S3NameValue pairs present in the extraDetails + * array + **/ + int extraDetailsCount; + + /** + * S3 can provide extra details in a freeform Name - Value pair format. + * Each error can have any number of these, and this array provides these + * additional extra details. + **/ + S3NameValue *extraDetails; } S3ErrorDetails; @@ -869,38 +869,38 @@ typedef struct S3ErrorDetails * * @param properties are the properties that are available from the response * @param callbackData is the callback data as specified when the request - * was issued. + * was issued. * @return S3StatusOK to continue processing the request, anything else to - * immediately abort the request with a status which will be - * passed to the S3ResponseCompleteCallback for this request. - * Typically, this will return either S3StatusOK or - * S3StatusAbortedByCallback. + * immediately abort the request with a status which will be + * passed to the S3ResponseCompleteCallback for this request. + * Typically, this will return either S3StatusOK or + * S3StatusAbortedByCallback. **/ typedef S3Status (S3ResponsePropertiesCallback) - (const S3ResponseProperties *properties, void *callbackData); + (const S3ResponseProperties *properties, void *callbackData); /** * This callback is made when the response has been completely received, or an * error has occurred which has prematurely aborted the request, or one of the * other user-supplied callbacks returned a value intended to abort the - * request. This callback is always made for every request, as the very last + * request. This callback is always made for every request, as the very last * callback made for that request. * * @param status gives the overall status of the response, indicating success - * or failure; use S3_status_is_retryable() as a simple way to detect - * whether or not the status indicates that the request failed but may - * be retried. + * or failure; use S3_status_is_retryable() as a simple way to detect + * whether or not the status indicates that the request failed but may + * be retried. * @param errorDetails if non-NULL, gives details as returned by the S3 - * service, describing the error + * service, describing the error * @param callbackData is the callback data as specified when the request - * was issued. + * was issued. **/ typedef void (S3ResponseCompleteCallback)(S3Status status, - const S3ErrorDetails *errorDetails, - void *callbackData); + const S3ErrorDetails *errorDetails, + void *callbackData); - + /** * This callback is made for each bucket resulting from a list service * operation. @@ -909,21 +909,21 @@ typedef void (S3ResponseCompleteCallback)(S3Status status, * @param ownerDisplayName is the owner display name of the owner of the bucket * @param bucketName is the name of the bucket * @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 + * supplied for the bucket; if >= 0 indicates the number of seconds + * since UNIX Epoch of the creation date of the bucket * @param callbackData is the callback data as specified when the request - * was issued. + * was issued. * @return S3StatusOK to continue processing the request, anything else to - * immediately abort the request with a status which will be - * passed to the S3ResponseCompleteCallback for this request. - * Typically, this will return either S3StatusOK or - * S3StatusAbortedByCallback. + * immediately abort the request with a status which will be + * passed to the S3ResponseCompleteCallback for this request. + * Typically, this will return either S3StatusOK or + * S3StatusAbortedByCallback. **/ typedef S3Status (S3ListServiceCallback)(const char *ownerId, - const char *ownerDisplayName, - const char *bucketName, - int64_t creationDateSeconds, - void *callbackData); + const char *ownerDisplayName, + const char *bucketName, + int64_t creationDateSeconds, + void *callbackData); /** @@ -933,37 +933,37 @@ typedef S3Status (S3ListServiceCallback)(const char *ownerId, * report all items resulting from the list bucket operation. * * @param isTruncated is true if the list bucket request was truncated by the - * S3 service, in which case the remainder of the list may be obtained - * by querying again using the Marker parameter to start the query - * after this set of results + * S3 service, in which case the remainder of the list may be obtained + * by querying again using the Marker parameter to start the query + * after this set of results * @param nextMarker if present, gives the largest (alphabetically) key - * returned in the response, which, if isTruncated is true, may be used - * as the marker in a subsequent list buckets operation to continue - * listing + * returned in the response, which, if isTruncated is true, may be used + * as the marker in a subsequent list buckets operation to continue + * listing * @param contentsCount is the number of ListBucketContent structures in the - * contents parameter + * contents parameter * @param contents is an array of ListBucketContent structures, each one - * describing an object in the bucket + * describing an object in the bucket * @param commonPrefixesCount is the number of common prefixes strings in the - * commonPrefixes parameter + * commonPrefixes parameter * @param commonPrefixes is an array of strings, each specifing one of the - * common prefixes as returned by S3 + * common prefixes as returned by S3 * @param callbackData is the callback data as specified when the request - * was issued. + * was issued. * @return S3StatusOK to continue processing the request, anything else to - * immediately abort the request with a status which will be - * passed to the S3ResponseCompleteCallback for this request. - * Typically, this will return either S3StatusOK or - * S3StatusAbortedByCallback. + * immediately abort the request with a status which will be + * passed to the S3ResponseCompleteCallback for this request. + * Typically, this will return either S3StatusOK or + * S3StatusAbortedByCallback. **/ typedef S3Status (S3ListBucketCallback)(int isTruncated, - const char *nextMarker, - int contentsCount, - const S3ListBucketContent *contents, - int commonPrefixesCount, - const char **commonPrefixes, - void *callbackData); - + const char *nextMarker, + int contentsCount, + const S3ListBucketContent *contents, + int commonPrefixesCount, + const char **commonPrefixes, + void *callbackData); + /** * This callback is made during a put object operation, to obtain the next @@ -972,19 +972,19 @@ typedef S3Status (S3ListBucketCallback)(int isTruncated, * write to the service, until a negative or 0 value is returned. * * @param bufferSize gives the maximum number of bytes that may be written - * into the buffer parameter by this callback + * into the buffer parameter by this callback * @param buffer gives the buffer to fill with at most bufferSize bytes of - * data as the next chunk of data to send to S3 as the contents of this - * object + * data as the next chunk of data to send to S3 as the contents of this + * object * @param callbackData is the callback data as specified when the request - * was issued. + * was issued. * @return < 0 to abort the request with the S3StatusAbortedByCallback, which - * will be pased to the response complete callback for this request, or - * 0 to indicate the end of data, or > 0 to identify the number of - * bytes that were written into the buffer by this callback + * will be pased to the response complete callback for this request, or + * 0 to indicate the end of data, or > 0 to identify the number of + * bytes that were written into the buffer by this callback **/ typedef int (S3PutObjectDataCallback)(int bufferSize, char *buffer, - void *callbackData); + void *callbackData); /** @@ -998,16 +998,16 @@ typedef int (S3PutObjectDataCallback)(int bufferSize, char *buffer, * @param bufferSize gives the number of bytes in buffer * @param buffer is the data being passed into the callback * @param callbackData is the callback data as specified when the request - * was issued. + * was issued. * @return S3StatusOK to continue processing the request, anything else to - * immediately abort the request with a status which will be - * passed to the S3ResponseCompleteCallback for this request. - * Typically, this will return either S3StatusOK or - * S3StatusAbortedByCallback. + * immediately abort the request with a status which will be + * passed to the S3ResponseCompleteCallback for this request. + * Typically, this will return either S3StatusOK or + * S3StatusAbortedByCallback. **/ typedef S3Status (S3GetObjectDataCallback)(int bufferSize, const char *buffer, - void *callbackData); - + void *callbackData); + /** ************************************************************************** * Callback Structures @@ -1020,20 +1020,20 @@ typedef S3Status (S3GetObjectDataCallback)(int bufferSize, const char *buffer, **/ typedef struct S3ResponseHandler { - /** - * The propertiesCallback is made when the response properties have - * successfully been returned from S3. This function may not be called - * if the response properties were not successfully returned from S3. - **/ - S3ResponsePropertiesCallback *propertiesCallback; - - /** - * The completeCallback is always called for every request made to S3, - * regardless of the outcome of the request. It provides the status of - * the request upon its completion, as well as extra error details in the - * event of an S3 error. - **/ - S3ResponseCompleteCallback *completeCallback; + /** + * The propertiesCallback is made when the response properties have + * successfully been returned from S3. This function may not be called + * if the response properties were not successfully returned from S3. + **/ + S3ResponsePropertiesCallback *propertiesCallback; + + /** + * The completeCallback is always called for every request made to S3, + * regardless of the outcome of the request. It provides the status of + * the request upon its completion, as well as extra error details in the + * event of an S3 error. + **/ + S3ResponseCompleteCallback *completeCallback; } S3ResponseHandler; @@ -1043,16 +1043,16 @@ typedef struct S3ResponseHandler **/ typedef struct S3ListServiceHandler { - /** - * responseHandler provides the properties and complete callback - **/ - S3ResponseHandler responseHandler; - - /** - * The listServiceCallback is called as items are reported back from S3 as - * responses to the request - **/ - S3ListServiceCallback *listServiceCallback; + /** + * responseHandler provides the properties and complete callback + **/ + S3ResponseHandler responseHandler; + + /** + * The listServiceCallback is called as items are reported back from S3 as + * responses to the request + **/ + S3ListServiceCallback *listServiceCallback; } S3ListServiceHandler; @@ -1062,18 +1062,18 @@ typedef struct S3ListServiceHandler **/ typedef struct S3ListBucketHandler { - /** - * responseHandler provides the properties and complete callback - **/ - S3ResponseHandler responseHandler; - - /** - * The listBucketCallback is called as items are reported back from S3 as - * responses to the request. This may be called more than one time per - * list bucket request, each time providing more items from the list - * operation. - **/ - S3ListBucketCallback *listBucketCallback; + /** + * responseHandler provides the properties and complete callback + **/ + S3ResponseHandler responseHandler; + + /** + * The listBucketCallback is called as items are reported back from S3 as + * responses to the request. This may be called more than one time per + * list bucket request, each time providing more items from the list + * operation. + **/ + S3ListBucketCallback *listBucketCallback; } S3ListBucketHandler; @@ -1083,18 +1083,18 @@ typedef struct S3ListBucketHandler **/ typedef struct S3PutObjectHandler { - /** - * responseHandler provides the properties and complete callback - **/ - S3ResponseHandler responseHandler; - - /** - * The putObjectDataCallback is called to acquire data to send to S3 as - * the contents of the put_object request. It is made repeatedly until it - * returns a negative number (indicating that the request should be - * aborted), or 0 (indicating that all data has been supplied). - **/ - S3PutObjectDataCallback *putObjectDataCallback; + /** + * responseHandler provides the properties and complete callback + **/ + S3ResponseHandler responseHandler; + + /** + * The putObjectDataCallback is called to acquire data to send to S3 as + * the contents of the put_object request. It is made repeatedly until it + * returns a negative number (indicating that the request should be + * aborted), or 0 (indicating that all data has been supplied). + **/ + S3PutObjectDataCallback *putObjectDataCallback; } S3PutObjectHandler; @@ -1104,19 +1104,19 @@ typedef struct S3PutObjectHandler **/ typedef struct S3GetObjectHandler { - /** - * responseHandler provides the properties and complete callback - **/ - S3ResponseHandler responseHandler; - - /** - * The getObjectDataCallback is called as data is read from S3 as the - * contents of the object being read in the get_object request. It is - * called repeatedly until there is no more data provided in the request, - * or until the callback returns an error status indicating that the - * request should be aborted. - **/ - S3GetObjectDataCallback *getObjectDataCallback; + /** + * responseHandler provides the properties and complete callback + **/ + S3ResponseHandler responseHandler; + + /** + * The getObjectDataCallback is called as data is read from S3 as the + * contents of the object being read in the get_object request. It is + * called repeatedly until there is no more data provided in the request, + * or until the callback returns an error status indicating that the + * request should be aborted. + **/ + S3GetObjectDataCallback *getObjectDataCallback; } S3GetObjectHandler; @@ -1128,39 +1128,39 @@ typedef struct S3GetObjectHandler * Initializes libs3 for use. This function must be called before any other * libs3 function is called. It may be called multiple times, with the same * effect as calling it once, as long as S3_deinitialize() is called an - * equal number of times when the program has finished. This function is NOT + * equal number of times when the program has finished. This function is NOT * thread-safe and must only be called by one thread at a time. * * @param userAgentInfo is a string that will be included in the User-Agent - * header of every request made to the S3 service. You may provide - * NULL or the empty string if you don't care about this. The value - * will not be copied by this function and must remain unaltered by the - * caller until S3_deinitialize() is called. + * header of every request made to the S3 service. You may provide + * NULL or the empty string if you don't care about this. The value + * will not be copied by this function and must remain unaltered by the + * caller until S3_deinitialize() is called. * @param flags is a bitmask of some combination of S3_INIT_XXX flag, or - * S3_INIT_ALL, indicating which of the libraries that libs3 depends - * upon should be initialized by S3_initialize(). Only if your program - * initializes one of these dependency libraries itself should anything - * other than S3_INIT_ALL be passed in for this bitmask. + * S3_INIT_ALL, indicating which of the libraries that libs3 depends + * upon should be initialized by S3_initialize(). Only if your program + * initializes one of these dependency libraries itself should anything + * other than S3_INIT_ALL be passed in for this bitmask. * - * You should pass S3_INIT_WINSOCK if and only if your application does - * not initialize winsock elsewhere. On non-Microsoft Windows - * platforms it has no effect. + * You should pass S3_INIT_WINSOCK if and only if your application does + * not initialize winsock elsewhere. On non-Microsoft Windows + * platforms it has no effect. * - * As a convenience, the macro S3_INIT_ALL is provided, which will do - * all necessary initialization; however, be warned that things may - * break if your application re-initializes the dependent libraries - * later. + * As a convenience, the macro S3_INIT_ALL is provided, which will do + * all necessary initialization; however, be warned that things may + * break if your application re-initializes the dependent libraries + * later. * @return One of: - * S3StatusOK on success - * S3StatusInternalError if dependent libraries could not be - * initialized - * S3StatusOutOfMemory on failure due to out of memory + * S3StatusOK on success + * S3StatusInternalError if dependent libraries could not be + * initialized + * S3StatusOutOfMemory on failure due to out of memory **/ S3Status S3_initialize(const char *userAgentInfo, int flags); /** - * Must be called once per program for each call to libs3_initialize(). After + * Must be called once per program for each call to libs3_initialize(). After * this call is complete, no libs3 function may be called except * S3_initialize(). **/ @@ -1180,73 +1180,73 @@ const char *S3_get_status_name(S3Status status); * This function may be used to validate an S3 bucket name as being in the * correct form for use with the S3 service. Amazon S3 limits the allowed * characters in S3 bucket names, as well as imposing some additional rules on - * the length of bucket names and their structure. There are actually two + * the length of bucket names and their structure. There are actually two * limits; one for bucket names used only in path-style URIs, and a more - * strict limit used for bucket names used in virtual-host-style URIs. It is + * strict limit used for bucket names used in virtual-host-style URIs. It is * advisable to use only bucket names which meet the more strict requirements * regardless of how the bucket expected to be used. * * This method does NOT validate that the bucket is available for use in the * S3 service, so the return value of this function cannot be used to decide * whether or not a bucket with the give name already exists in Amazon S3 or - * is accessible by the caller. It merely validates that the bucket name is + * is accessible by the caller. It merely validates that the bucket name is * valid for use with S3. * * @param bucketName is the bucket name to validate * @param uriStyle gives the URI style to validate the bucket name against. - * It is advisable to always use S3UriStyleVirtuallHost. + * It is advisable to always use S3UriStyleVirtuallHost. * @return One of: - * S3StatusOK if the bucket name was validates successfully - * S3StatusInvalidBucketNameTooLong if the bucket name exceeded the - * length limitation for the URI style, which is 255 bytes for - * path style URIs and 63 bytes for virtual host type URIs - * S3StatusInvalidBucketNameTooShort if the bucket name is less than - * 3 characters - * S3StatusInvalidBucketNameFirstCharacter if the bucket name as an - * invalid first character, which is anything other than - * an alphanumeric character - * S3StatusInvalidBucketNameCharacterSequence if the bucket name - * includes an invalid character sequence, which for virtual host - * style buckets is ".-" or "-." - * S3StatusInvalidBucketNameCharacter if the bucket name includes an - * invalid character, which is anything other than alphanumeric, - * '-', '.', or for path style URIs only, '_'. - * S3StatusInvalidBucketNameDotQuadNotation if the bucket name is in - * dot-quad notation, i.e. the form of an IP address, which is - * not allowed by Amazon S3. + * S3StatusOK if the bucket name was validates successfully + * S3StatusInvalidBucketNameTooLong if the bucket name exceeded the + * length limitation for the URI style, which is 255 bytes for + * path style URIs and 63 bytes for virtual host type URIs + * S3StatusInvalidBucketNameTooShort if the bucket name is less than + * 3 characters + * S3StatusInvalidBucketNameFirstCharacter if the bucket name as an + * invalid first character, which is anything other than + * an alphanumeric character + * S3StatusInvalidBucketNameCharacterSequence if the bucket name + * includes an invalid character sequence, which for virtual host + * style buckets is ".-" or "-." + * S3StatusInvalidBucketNameCharacter if the bucket name includes an + * invalid character, which is anything other than alphanumeric, + * '-', '.', or for path style URIs only, '_'. + * S3StatusInvalidBucketNameDotQuadNotation if the bucket name is in + * dot-quad notation, i.e. the form of an IP address, which is + * not allowed by Amazon S3. **/ S3Status S3_validate_bucket_name(const char *bucketName, S3UriStyle uriStyle); /** * Converts an XML representation of an ACL to a libs3 structured - * representation. This method is not strictly necessary for working with + * representation. This method is not strictly necessary for working with * ACLs using libs3, but may be convenient for users of the library who read * ACLs from elsewhere in XML format and need to use these ACLs with libs3. * - * @param aclXml is the XML representation of the ACL. This must be a - * zero-terminated character string. + * @param aclXml is the XML representation of the ACL. This must be a + * zero-terminated character string. * @param ownerId will be filled in with the Owner ID specified in the XML. - * At most MAX_GRANTEE_USER_ID_SIZE bytes will be stored at this - * location. + * At most MAX_GRANTEE_USER_ID_SIZE bytes will be stored at this + * location. * @param ownerDisplayName will be filled in with the Owner Display Name - * specified in the XML. At most MAX_GRANTEE_DISPLAY_NAME_SIZE bytes - * will be stored at this location. + * specified in the XML. At most MAX_GRANTEE_DISPLAY_NAME_SIZE bytes + * will be stored at this location. * @param aclGrantCountReturn returns the number of S3AclGrant structures - * returned in the aclGrantsReturned array + * returned in the aclGrantsReturned array * @param aclGrants must be passed in as an array of at least S3_ACL_MAXCOUNT - * structures, and on return from this function, the first - * aclGrantCountReturn structures will be filled in with the ACLs - * represented by the input XML. + * structures, and on return from this function, the first + * aclGrantCountReturn structures will be filled in with the ACLs + * represented by the input XML. * @return One of: - * S3StatusOK on successful conversion of the ACL - * S3StatusInternalError on internal error representing a bug in the - * libs3 library - * S3StatusXmlParseFailure if the XML document was malformed + * S3StatusOK on successful conversion of the ACL + * S3StatusInternalError on internal error representing a bug in the + * libs3 library + * S3StatusXmlParseFailure if the XML document was malformed **/ S3Status S3_convert_acl(char *aclXml, char *ownerId, char *ownerDisplayName, - int *aclGrantCountReturn, S3AclGrant *aclGrants); - + int *aclGrantCountReturn, S3AclGrant *aclGrants); + /** * Returns nonzero if the status indicates that the request should be @@ -1273,15 +1273,15 @@ int S3_status_is_retryable(S3Status status); * request function has returned. * * @param requestContextReturn returns the newly-created S3RequestContext - * structure, which if successfully returned, must be destroyed via a - * call to S3_destroy_request_context when it is no longer needed. If - * an error status is returned from this function, then - * requestContextReturn will not have been filled in, and - * S3_destroy_request_context should not be called on it + * structure, which if successfully returned, must be destroyed via a + * call to S3_destroy_request_context when it is no longer needed. If + * an error status is returned from this function, then + * requestContextReturn will not have been filled in, and + * S3_destroy_request_context should not be called on it * @return One of: - * S3StatusOK if the request context was successfully created - * S3StatusOutOfMemory if the request context could not be created due - * to an out of memory error + * S3StatusOK if the request context was successfully created + * S3StatusOutOfMemory if the request context could not be created due + * to an out of memory error **/ S3Status S3_create_request_context(S3RequestContext **requestContextReturn); @@ -1302,13 +1302,13 @@ void S3_destroy_request_context(S3RequestContext *requestContext); * or until an error occurs. * * @param requestContext is the S3RequestContext to run until all requests - * within it have completed or until an error occurs + * within it have completed or until an error occurs * @return One of: - * S3Status if all requests were successfully run to completion - * S3StatusInternalError if an internal error prevented the - * S3RequestContext from running one or more requests - * S3StatusOutOfMemory if requests could not be run to completion - * due to an out of memory error + * S3Status if all requests were successfully run to completion + * S3StatusInternalError if an internal error prevented the + * S3RequestContext from running one or more requests + * S3StatusOutOfMemory if requests could not be run to completion + * due to an out of memory error **/ S3Status S3_runall_request_context(S3RequestContext *requestContext); @@ -1322,22 +1322,22 @@ S3Status S3_runall_request_context(S3RequestContext *requestContext); * * @param requestContext is the S3RequestContext to process * @param requestsRemainingReturn returns the number of requests remaining - * and not yet completed within the S3RequestContext after this - * function returns. + * and not yet completed within the S3RequestContext after this + * function returns. * @return One of: - * S3StatusOK if request processing proceeded without error - * S3StatusInternalError if an internal error prevented the - * S3RequestContext from running one or more requests - * S3StatusOutOfMemory if requests could not be processed due to - * an out of memory error + * S3StatusOK if request processing proceeded without error + * S3StatusInternalError if an internal error prevented the + * S3RequestContext from running one or more requests + * S3StatusOutOfMemory if requests could not be processed due to + * an out of memory error **/ S3Status S3_runonce_request_context(S3RequestContext *requestContext, - int *requestsRemainingReturn); + int *requestsRemainingReturn); /** * This function, in conjunction allows callers to manually manage a set of - * requests using an S3RequestContext. This function returns the set of file + * requests using an S3RequestContext. This function returns the set of file * descriptors which the caller can watch (typically using select()), along * with any other file descriptors of interest to the caller, and using * whatever timeout (if any) the caller wishes, until one or more file @@ -1347,27 +1347,27 @@ S3Status S3_runonce_request_context(S3RequestContext *requestContext, * * @param requestContext is the S3RequestContext to get fd_sets from * @param readFdSet is a pointer to an fd_set which will have all file - * descriptors to watch for read events for the requests in the - * S3RequestContext set into it upon return. Should be zero'd out - * (using FD_ZERO) before being passed into this function. + * descriptors to watch for read events for the requests in the + * S3RequestContext set into it upon return. Should be zero'd out + * (using FD_ZERO) before being passed into this function. * @param writeFdSet is a pointer to an fd_set which will have all file - * descriptors to watch for write events for the requests in the - * S3RequestContext set into it upon return. Should be zero'd out - * (using FD_ZERO) before being passed into this function. + * descriptors to watch for write events for the requests in the + * S3RequestContext set into it upon return. Should be zero'd out + * (using FD_ZERO) before being passed into this function. * @param exceptFdSet is a pointer to an fd_set which will have all file - * descriptors to watch for exception events for the requests in the - * S3RequestContext set into it upon return. Should be zero'd out - * (using FD_ZERO) before being passed into this function. + * descriptors to watch for exception events for the requests in the + * S3RequestContext set into it upon return. Should be zero'd out + * (using FD_ZERO) before being passed into this function. * @param maxFd returns the highest file descriptor set into any of the - * fd_sets, or -1 if no file descriptors were set + * fd_sets, or -1 if no file descriptors were set * @return One of: - * S3StatusOK if all fd_sets were successfully set - * S3StatusInternalError if an internal error prevented this function - * from completing successfully + * S3StatusOK if all fd_sets were successfully set + * S3StatusInternalError if an internal error prevented this function + * from completing successfully **/ S3Status S3_get_request_context_fdsets(S3RequestContext *requestContext, - fd_set *readFdSet, fd_set *writeFdSet, - fd_set *exceptFdSet, int *maxFd); + fd_set *readFdSet, fd_set *writeFdSet, + fd_set *exceptFdSet, int *maxFd); /** @@ -1382,7 +1382,7 @@ S3Status S3_get_request_context_fdsets(S3RequestContext *requestContext, * * @param requestContext is the S3RequestContext to get the timeout from * @return the maximum number of milliseconds to select() on fdsets. Callers - * could wait a shorter time if they wish, but not longer. + * could wait a shorter time if they wish, but not longer. **/ int64_t S3_get_request_context_timeout(S3RequestContext *requestContext); @@ -1398,27 +1398,27 @@ int64_t S3_get_request_context_timeout(S3RequestContext *requestContext); * of authenticated query string request. * * @param buffer is the output buffer for the authenticated query string. - * It must be at least S3_MAX_AUTHENTICATED_QUERY_STRING_SIZE bytes in - * length. + * It must be at least S3_MAX_AUTHENTICATED_QUERY_STRING_SIZE bytes in + * length. * @param bucketContext gives the bucket and associated parameters for the - * request to generate. + * request to generate. * @param key gives the key which the authenticated request will GET. * @param expires gives the number of seconds since Unix epoch for the - * expiration date of the request; after this time, the request will - * no longer be valid. If this value is negative, the largest - * expiration date possible is used (currently, Jan 19, 2038). + * expiration date of the request; after this time, the request will + * no longer be valid. If this value is negative, the largest + * expiration date possible is used (currently, Jan 19, 2038). * @param resource gives a sub-resource to be fetched for the request, or NULL - * for none. This should be of the form "?<resource>", i.e. - * "?torrent". + * for none. This should be of the form "?<resource>", i.e. + * "?torrent". * @return One of: - * S3StatusUriTooLong if, due to an internal error, the generated URI - * is longer than S3_MAX_AUTHENTICATED_QUERY_STRING_SIZE bytes in - * length and thus will not fit into the supplied buffer - * S3StatusOK on success + * S3StatusUriTooLong if, due to an internal error, the generated URI + * is longer than S3_MAX_AUTHENTICATED_QUERY_STRING_SIZE bytes in + * length and thus will not fit into the supplied buffer + * S3StatusOK on success **/ S3Status S3_generate_authenticated_query_string - (char *buffer, const S3BucketContext *bucketContext, - const char *key, int64_t expires, const char *resource); + (char *buffer, const S3BucketContext *bucketContext, + const char *key, int64_t expires, const char *resource); /** ************************************************************************** @@ -1430,23 +1430,23 @@ S3Status S3_generate_authenticated_query_string * * @param protocol gives the protocol to use for this request * @param accessKeyId gives the Amazon Access Key ID for which to list owned - * buckets + * buckets * @param secretAccessKey gives the Amazon Secret Access Key for which to list - * owned buckets + * owned buckets * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_list_service(S3Protocol protocol, const char *accessKeyId, - const char *secretAccessKey, - S3RequestContext *requestContext, - const S3ListServiceHandler *handler, - void *callbackData); - + const char *secretAccessKey, + S3RequestContext *requestContext, + const S3ListServiceHandler *handler, + void *callbackData); + /** ************************************************************************** * Bucket Functions @@ -1459,60 +1459,60 @@ void S3_list_service(S3Protocol protocol, const char *accessKeyId, * @param protocol gives the protocol to use for this request * @param uriStyle gives the URI style to use for this request * @param accessKeyId gives the Amazon Access Key ID for which to list owned - * buckets + * buckets * @param secretAccessKey gives the Amazon Secret Access Key for which to list - * owned buckets + * owned buckets * @param bucketName is the bucket name to test * @param locationConstraintReturnSize gives the number of bytes in the - * locationConstraintReturn parameter + * locationConstraintReturn parameter * @param locationConstraintReturn provides the location into which to write - * the name of the location constraint naming the geographic location - * of the S3 bucket. This must have at least as many characters in it - * as specified by locationConstraintReturn, and should start out - * NULL-terminated. On successful completion of this request, this - * will be set to the name of the geographic location of S3 bucket, or - * will be left as a zero-length string if no location was available. + * the name of the location constraint naming the geographic location + * of the S3 bucket. This must have at least as many characters in it + * as specified by locationConstraintReturn, and should start out + * NULL-terminated. On successful completion of this request, this + * will be set to the name of the geographic location of S3 bucket, or + * will be left as a zero-length string if no location was available. * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_test_bucket(S3Protocol protocol, S3UriStyle uriStyle, - const char *accessKeyId, const char *secretAccessKey, - const char *bucketName, int locationConstraintReturnSize, - char *locationConstraintReturn, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); + const char *accessKeyId, const char *secretAccessKey, + const char *bucketName, int locationConstraintReturnSize, + char *locationConstraintReturn, + S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); - + /** * Creates a new bucket. * * @param protocol gives the protocol to use for this request * @param accessKeyId gives the Amazon Access Key ID for which to list owned - * buckets + * buckets * @param secretAccessKey gives the Amazon Secret Access Key for which to list - * owned buckets + * owned buckets * @param bucketName is the name of the bucket to be created * @param cannedAcl gives the "REST canned ACL" to use for the created bucket * @param locationConstraint if non-NULL, gives the geographic location for - * the bucket to create. + * the bucket to create. * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_create_bucket(S3Protocol protocol, const char *accessKeyId, - const char *secretAccessKey, const char *bucketName, - S3CannedAcl cannedAcl, const char *locationConstraint, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); + const char *secretAccessKey, const char *bucketName, + S3CannedAcl cannedAcl, const char *locationConstraint, + S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); /** @@ -1522,49 +1522,49 @@ void S3_create_bucket(S3Protocol protocol, const char *accessKeyId, * @param protocol gives the protocol to use for this request * @param uriStyle gives the URI style to use for this request * @param accessKeyId gives the Amazon Access Key ID for which to list owned - * buckets + * buckets * @param secretAccessKey gives the Amazon Secret Access Key for which to list - * owned buckets + * owned buckets * @param bucketName is the name of the bucket to be deleted * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_delete_bucket(S3Protocol protocol, S3UriStyle uriStyle, - const char *accessKeyId, const char *secretAccessKey, - const char *bucketName, S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); + const char *accessKeyId, const char *secretAccessKey, + const char *bucketName, S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); /** * Lists keys within a bucket. * * @param bucketContext gives the bucket and associated parameters for this - * request + * request * @param prefix if present, gives a prefix for matching keys * @param marker if present, only keys occuring after this value will be - * listed + * listed * @param delimiter if present, causes keys that contain the same string - * between the prefix and the first occurrence of the delimiter to be - * rolled up into a single result element + * between the prefix and the first occurrence of the delimiter to be + * rolled up into a single result element * @param maxkeys is the maximum number of keys to return * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_list_bucket(const S3BucketContext *bucketContext, - const char *prefix, const char *marker, - const char *delimiter, int maxkeys, - S3RequestContext *requestContext, - const S3ListBucketHandler *handler, void *callbackData); + const char *prefix, const char *marker, + const char *delimiter, int maxkeys, + S3RequestContext *requestContext, + const S3ListBucketHandler *handler, void *callbackData); /** ************************************************************************** @@ -1572,31 +1572,31 @@ void S3_list_bucket(const S3BucketContext *bucketContext, ************************************************************************** **/ /** - * Puts object data to S3. This overwrites any existing object at that key; - * note that S3 currently only supports full-object upload. The data to + * Puts object data to S3. This overwrites any existing object at that key; + * note that S3 currently only supports full-object upload. The data to * upload will be acquired by calling the handler's putObjectDataCallback. * * @param bucketContext gives the bucket and associated parameters for this - * request + * request * @param key is the key of the object to put to * @param contentLength is required and gives the total number of bytes that - * will be put + * will be put * @param putProperties optionally provides additional properties to apply to - * the object that is being put to + * the object that is being put to * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_put_object(const S3BucketContext *bucketContext, const char *key, - uint64_t contentLength, - const S3PutProperties *putProperties, - S3RequestContext *requestContext, - const S3PutObjectHandler *handler, void *callbackData); - + uint64_t contentLength, + const S3PutProperties *putProperties, + S3RequestContext *requestContext, + const S3PutObjectHandler *handler, void *callbackData); + /** * Copies an object from one location to another. The object may be copied @@ -1604,106 +1604,106 @@ void S3_put_object(const S3BucketContext *bucketContext, const char *key, * the object. * * @param bucketContext gives the source bucket and associated parameters for - * this request + * this request * @param key is the source key * @param destinationBucket gives the destination bucket into which to copy - * the object. If NULL, the source bucket will be used. + * the object. If NULL, the source bucket will be used. * @param destinationKey gives the destination key into which to copy the - * object. If NULL, the source key will be used. + * object. If NULL, the source key will be used. * @param putProperties optionally provides properties to apply to the object - * that is being put to. If not supplied (i.e. NULL is passed in), - * then the copied object will retain the metadata of the copied - * object. + * that is being put to. If not supplied (i.e. NULL is passed in), + * then the copied object will retain the metadata of the copied + * object. * @param lastModifiedReturn returns the last modified date of the copied - * object + * object * @param eTagReturnSize specifies the number of bytes provided in the - * eTagReturn buffer + * eTagReturn buffer * @param eTagReturn is a buffer into which the resulting eTag of the copied - * object will be written + * object will be written * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_copy_object(const S3BucketContext *bucketContext, - const char *key, const char *destinationBucket, - const char *destinationKey, - const S3PutProperties *putProperties, - int64_t *lastModifiedReturn, int eTagReturnSize, - char *eTagReturn, S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); + const char *key, const char *destinationBucket, + const char *destinationKey, + const S3PutProperties *putProperties, + int64_t *lastModifiedReturn, int eTagReturnSize, + char *eTagReturn, S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); /** - * Gets an object from S3. The contents of the object are returned in the + * Gets an object from S3. The contents of the object are returned in the * handler's getObjectDataCallback. * * @param bucketContext gives the bucket and associated parameters for this - * request + * request * @param key is the key of the object to get * @param getConditions if non-NULL, gives a set of conditions which must be - * met in order for the request to succeed + * met in order for the request to succeed * @param startByte gives the start byte for the byte range of the contents - * to be returned + * to be returned * @param byteCount gives the number of bytes to return; a value of 0 - * indicates that the contents up to the end should be returned + * indicates that the contents up to the end should be returned * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_get_object(const S3BucketContext *bucketContext, const char *key, - const S3GetConditions *getConditions, - uint64_t startByte, uint64_t byteCount, - S3RequestContext *requestContext, - const S3GetObjectHandler *handler, void *callbackData); + const S3GetConditions *getConditions, + uint64_t startByte, uint64_t byteCount, + S3RequestContext *requestContext, + const S3GetObjectHandler *handler, void *callbackData); /** * Gets the response properties for the object, but not the object contents. * * @param bucketContext gives the bucket and associated parameters for this - * request + * request * @param key is the key of the object to get the properties of * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_head_object(const S3BucketContext *bucketContext, const char *key, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); - + S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); + /** * Deletes an object from S3. * * @param bucketContext gives the bucket and associated parameters for this - * request + * request * @param key is the key of the object to delete * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_delete_object(const S3BucketContext *bucketContext, const char *key, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); + S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); /** ************************************************************************** @@ -1714,65 +1714,65 @@ void S3_delete_object(const S3BucketContext *bucketContext, const char *key, * Gets the ACL for the given bucket or object. * * @param bucketContext gives the bucket and associated parameters for this - * request + * request * @param key is the key of the object to get the ACL of; or NULL to get the - * ACL of the bucket + * ACL of the bucket * @param ownerId must be supplied as a buffer of at least - * S3_MAX_GRANTEE_USER_ID_SIZE bytes, and will be filled in with the - * owner ID of the object/bucket + * S3_MAX_GRANTEE_USER_ID_SIZE bytes, and will be filled in with the + * owner ID of the object/bucket * @param ownerDisplayName must be supplied as a buffer of at least - * S3_MAX_GRANTEE_DISPLAY_NAME_SIZE bytes, and will be filled in with - * the display name of the object/bucket + * S3_MAX_GRANTEE_DISPLAY_NAME_SIZE bytes, and will be filled in with + * the display name of the object/bucket * @param aclGrantCountReturn returns the number of S3AclGrant structures - * returned in the aclGrants parameter + * returned in the aclGrants parameter * @param aclGrants must be passed in as an array of at least - * S3_MAX_ACL_GRANT_COUNT S3AclGrant structures, which will be filled - * in with the grant information for the ACL + * S3_MAX_ACL_GRANT_COUNT S3AclGrant structures, which will be filled + * in with the grant information for the ACL * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_get_acl(const S3BucketContext *bucketContext, const char *key, - char *ownerId, char *ownerDisplayName, - int *aclGrantCountReturn, S3AclGrant *aclGrants, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); + char *ownerId, char *ownerDisplayName, + int *aclGrantCountReturn, S3AclGrant *aclGrants, + S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); /** * Sets the ACL for the given bucket or object. * * @param bucketContext gives the bucket and associated parameters for this - * request + * request * @param key is the key of the object to set the ACL for; or NULL to set the - * ACL for the bucket - * @param ownerId is the owner ID of the object/bucket. Unfortunately, S3 - * requires this to be valid and thus it must have been fetched by a - * previous S3 request, such as a list_buckets request. + * ACL for the bucket + * @param ownerId is the owner ID of the object/bucket. Unfortunately, S3 + * requires this to be valid and thus it must have been fetched by a + * previous S3 request, such as a list_buckets request. * @param ownerDisplayName is the owner display name of the object/bucket. - * Unfortunately, S3 requires this to be valid and thus it must have - * been fetched by a previous S3 request, such as a list_buckets - * request. + * Unfortunately, S3 requires this to be valid and thus it must have + * been fetched by a previous S3 request, such as a list_buckets + * request. * @param aclGrantCount is the number of ACL grants to set for the - * object/bucket + * object/bucket * @param aclGrants are the ACL grants to set for the object/bucket * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_set_acl(const S3BucketContext *bucketContext, const char *key, - const char *ownerId, const char *ownerDisplayName, - int aclGrantCount, const S3AclGrant *aclGrants, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, void *callbackData); + const char *ownerId, const char *ownerDisplayName, + int aclGrantCount, const S3AclGrant *aclGrants, + S3RequestContext *requestContext, + const S3ResponseHandler *handler, void *callbackData); /** ************************************************************************** @@ -1786,44 +1786,44 @@ void S3_set_acl(const S3BucketContext *bucketContext, const char *key, * settings controlling how these logs will be written. * * @param bucketContext gives the bucket and associated parameters for this - * request; this is the bucket for which service access logging is - * being requested + * request; this is the bucket for which service access logging is + * being requested * @param targetBucketReturn must be passed in as a buffer of at least - * (S3_MAX_BUCKET_NAME_SIZE + 1) bytes in length, and will be filled - * in with the target bucket name for access logging for the given - * bucket, which is the bucket into which access logs for the specified - * bucket will be written. This is returned as an empty string if - * service access logging is not enabled for the given bucket. + * (S3_MAX_BUCKET_NAME_SIZE + 1) bytes in length, and will be filled + * in with the target bucket name for access logging for the given + * bucket, which is the bucket into which access logs for the specified + * bucket will be written. This is returned as an empty string if + * service access logging is not enabled for the given bucket. * @param targetPrefixReturn must be passed in as a buffer of at least - * (S3_MAX_KEY_SIZE + 1) bytes in length, and will be filled in - * with the key prefix for server access logs for the given bucket, - * or the empty string if no such prefix is specified. + * (S3_MAX_KEY_SIZE + 1) bytes in length, and will be filled in + * with the key prefix for server access logs for the given bucket, + * or the empty string if no such prefix is specified. * @param aclGrantCountReturn returns the number of ACL grants that are - * associated with the server access logging for the given bucket. + * associated with the server access logging for the given bucket. * @param aclGrants must be passed in as an array of at least - * S3_MAX_ACL_GRANT_COUNT S3AclGrant structures, and these will be - * filled in with the target grants associated with the server access - * logging for the given bucket, whose number is returned in the - * aclGrantCountReturn parameter. These grants will be applied to the - * ACL of any server access logging log files generated by the S3 - * service for the given bucket. + * S3_MAX_ACL_GRANT_COUNT S3AclGrant structures, and these will be + * filled in with the target grants associated with the server access + * logging for the given bucket, whose number is returned in the + * aclGrantCountReturn parameter. These grants will be applied to the + * ACL of any server access logging log files generated by the S3 + * service for the given bucket. * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_get_server_access_logging(const S3BucketContext *bucketContext, - char *targetBucketReturn, - char *targetPrefixReturn, - int *aclGrantCountReturn, - S3AclGrant *aclGrants, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, - void *callbackData); - + char *targetBucketReturn, + char *targetPrefixReturn, + int *aclGrantCountReturn, + S3AclGrant *aclGrants, + S3RequestContext *requestContext, + const S3ResponseHandler *handler, + void *callbackData); + /** * Sets the service access logging settings for a bucket. The service access @@ -1832,36 +1832,36 @@ void S3_get_server_access_logging(const S3BucketContext *bucketContext, * settings controlling how these logs will be written. * * @param bucketContext gives the bucket and associated parameters for this - * request; this is the bucket for which service access logging is - * being set + * request; this is the bucket for which service access logging is + * being set * @param targetBucket gives the target bucket name for access logging for the - * given bucket, which is the bucket into which access logs for the - * specified bucket will be written. + * given bucket, which is the bucket into which access logs for the + * specified bucket will be written. * @param targetPrefix is an option parameter which specifies the key prefix - * for server access logs for the given bucket, or NULL if no such - * prefix is to be used. + * for server access logs for the given bucket, or NULL if no such + * prefix is to be used. * @param aclGrantCount specifies the number of ACL grants that are to be - * associated with the server access logging for the given bucket. + * associated with the server access logging for the given bucket. * @param aclGrants is as an array of S3AclGrant structures, whose number is - * given by the aclGrantCount parameter. These grants will be applied - * to the ACL of any server access logging log files generated by the - * S3 service for the given bucket. + * given by the aclGrantCount parameter. These grants will be applied + * to the ACL of any server access logging log files generated by the + * S3 service for the given bucket. * @param requestContext if non-NULL, gives the S3RequestContext to add this - * request to, and does not perform the request immediately. If NULL, - * performs the request immediately and synchronously. + * request to, and does not perform the request immediately. If NULL, + * performs the request immediately and synchronously. * @param handler gives the callbacks to call as the request is processed and - * completed + * completed * @param callbackData will be passed in as the callbackData parameter to - * all callbacks for this request + * all callbacks for this request **/ void S3_set_server_access_logging(const S3BucketContext *bucketContext, - const char *targetBucket, - const char *targetPrefix, int aclGrantCount, - const S3AclGrant *aclGrants, - S3RequestContext *requestContext, - const S3ResponseHandler *handler, - void *callbackData); - + const char *targetBucket, + const char *targetPrefix, int aclGrantCount, + const S3AclGrant *aclGrants, + S3RequestContext *requestContext, + const S3ResponseHandler *handler, + void *callbackData); + #ifdef __cplusplus } diff --git a/inc/mingw/pthread.h b/inc/mingw/pthread.h index 674a62a..44a029a 100644 --- a/inc/mingw/pthread.h +++ b/inc/mingw/pthread.h @@ -34,7 +34,7 @@ unsigned long pthread_self(); typedef struct { - CRITICAL_SECTION criticalSection; + CRITICAL_SECTION criticalSection; } pthread_mutex_t; int pthread_mutex_init(pthread_mutex_t *mutex, void *); diff --git a/inc/mingw/sys/utsname.h b/inc/mingw/sys/utsname.h index 1e6b470..1501b84 100644 --- a/inc/mingw/sys/utsname.h +++ b/inc/mingw/sys/utsname.h @@ -32,8 +32,8 @@ struct utsname { - const char *sysname; - const char *machine; + const char *sysname; + const char *machine; }; int uname(struct utsname *); diff --git a/inc/request.h b/inc/request.h index afb4929..cbfaf67 100644 --- a/inc/request.h +++ b/inc/request.h @@ -35,71 +35,71 @@ // Describes a type of HTTP request (these are our supported HTTP "verbs") typedef enum { - HttpRequestTypeGET, - HttpRequestTypeHEAD, - HttpRequestTypePUT, - HttpRequestTypeCOPY, - HttpRequestTypeDELETE + HttpRequestTypeGET, + HttpRequestTypeHEAD, + HttpRequestTypePUT, + HttpRequestTypeCOPY, + HttpRequestTypeDELETE } HttpRequestType; -// This completely describes a request. A RequestParams is not required to be +// This completely describes a request. A RequestParams is not required to be // allocated from the heap and its lifetime is not assumed to extend beyond // the lifetime of the function to which it has been passed. typedef struct RequestParams { - // Request type, affects the HTTP verb used - HttpRequestType httpRequestType; + // Request type, affects the HTTP verb used + HttpRequestType httpRequestType; - // Bucket context for request - S3BucketContext bucketContext; + // Bucket context for request + S3BucketContext bucketContext; - // Key, if any - const char *key; + // Key, if any + const char *key; - // Query params - ready to append to URI (i.e. ?p1=v1?p2=v2) - const char *queryParams; + // Query params - ready to append to URI (i.e. ?p1=v1?p2=v2) + const char *queryParams; - // sub resource, like ?acl, ?location, ?torrent, ?logging - const char *subResource; + // sub resource, like ?acl, ?location, ?torrent, ?logging + const char *subResource; - // If this is a copy operation, this gives the source bucket - const char *copySourceBucketName; + // If this is a copy operation, this gives the source bucket + const char *copySourceBucketName; - // If this is a copy operation, this gives the source key - const char *copySourceKey; + // If this is a copy operation, this gives the source key + const char *copySourceKey; - // Get conditions - const S3GetConditions *getConditions; + // Get conditions + const S3GetConditions *getConditions; - // Start byte - uint64_t startByte; + // Start byte + uint64_t startByte; - // Byte count - uint64_t byteCount; + // Byte count + uint64_t byteCount; - // Put properties - const S3PutProperties *putProperties; + // Put properties + const S3PutProperties *putProperties; - // Callback to be made when headers are available. Might not be called. - S3ResponsePropertiesCallback *propertiesCallback; + // Callback to be made when headers are available. Might not be called. + S3ResponsePropertiesCallback *propertiesCallback; - // Callback to be made to supply data to send to S3. Might not be called. - S3PutObjectDataCallback *toS3Callback; + // Callback to be made to supply data to send to S3. Might not be called. + S3PutObjectDataCallback *toS3Callback; - // Number of bytes total that readCallback will supply - int64_t toS3CallbackTotalSize; + // Number of bytes total that readCallback will supply + int64_t toS3CallbackTotalSize; - // Callback to be made that supplies data read from S3. - // Might not be called. - S3GetObjectDataCallback *fromS3Callback; + // Callback to be made that supplies data read from S3. + // Might not be called. + S3GetObjectDataCallback *fromS3Callback; - // Callback to be made when request is complete. This will *always* be - // called. - S3ResponseCompleteCallback *completeCallback; + // Callback to be made when request is complete. This will *always* be + // called. + S3ResponseCompleteCallback *completeCallback; - // Data passed to the callbacks - void *callbackData; + // Data passed to the callbacks + void *callbackData; } RequestParams; @@ -107,57 +107,57 @@ typedef struct RequestParams // (and thus live while a curl_multi is in use). typedef struct Request { - // These put the request on a doubly-linked list of requests in a - // request context, *if* the request is in a request context (else these - // will both be 0) - struct Request *prev, *next; + // These put the request on a doubly-linked list of requests in a + // request context, *if* the request is in a request context (else these + // will both be 0) + struct Request *prev, *next; - // The status of this Request, as will be reported to the user via the - // complete callback - S3Status status; + // The status of this Request, as will be reported to the user via the + // complete callback + S3Status status; - // The HTTP code returned by the S3 server, if it is known. Would rather - // not have to keep track of this but S3 doesn't always indicate its - // errors the same way - int httpResponseCode; + // The HTTP code returned by the S3 server, if it is known. Would rather + // not have to keep track of this but S3 doesn't always indicate its + // errors the same way + int httpResponseCode; - // The HTTP headers to use for the curl request - struct curl_slist *headers; + // The HTTP headers to use for the curl request + struct curl_slist *headers; - // The CURL structure driving the request - CURL *curl; + // The CURL structure driving the request + CURL *curl; - // libcurl requires that the uri be stored outside of the curl handle - char uri[MAX_URI_SIZE + 1]; + // libcurl requires that the uri be stored outside of the curl handle + char uri[MAX_URI_SIZE + 1]; - // Callback to be made when headers are available. Might not be called. - S3ResponsePropertiesCallback *propertiesCallback; + // Callback to be made when headers are available. Might not be called. + S3ResponsePropertiesCallback *propertiesCallback; - // Callback to be made to supply data to send to S3. Might not be called. - S3PutObjectDataCallback *toS3Callback; + // Callback to be made to supply data to send to S3. Might not be called. + S3PutObjectDataCallback *toS3Callback; - // Number of bytes total that readCallback has left to supply - int64_t toS3CallbackBytesRemaining; + // Number of bytes total that readCallback has left to supply + int64_t toS3CallbackBytesRemaining; - // Callback to be made that supplies data read from S3. - // Might not be called. - S3GetObjectDataCallback *fromS3Callback; + // Callback to be made that supplies data read from S3. + // Might not be called. + S3GetObjectDataCallback *fromS3Callback; - // Callback to be made when request is complete. This will *always* be - // called. - S3ResponseCompleteCallback *completeCallback; + // Callback to be made when request is complete. This will *always* be + // called. + S3ResponseCompleteCallback *completeCallback; - // Data passed to the callbacks - void *callbackData; + // Data passed to the callbacks + void *callbackData; - // Handler of response headers - ResponseHeadersHandler responseHeadersHandler; + // Handler of response headers + ResponseHeadersHandler responseHeadersHandler; - // This is set to nonzero after the properties callback has been made - int propertiesCallbackMade; + // This is set to nonzero after the properties callback has been made + int propertiesCallbackMade; - // Parser of errors - ErrorParser errorParser; + // Parser of errors + ErrorParser errorParser; } Request; diff --git a/inc/request_context.h b/inc/request_context.h index 8074c50..1aa940b 100644 --- a/inc/request_context.h +++ b/inc/request_context.h @@ -31,9 +31,9 @@ struct S3RequestContext { - CURLM *curlm; + CURLM *curlm; - struct Request *requests; + struct Request *requests; }; diff --git a/inc/response_headers_handler.h b/inc/response_headers_handler.h index 2813e9a..7491035 100644 --- a/inc/response_headers_handler.h +++ b/inc/response_headers_handler.h @@ -34,31 +34,31 @@ typedef struct ResponseHeadersHandler { - // The structure to pass to the headers callback. This is filled in by - // the ResponseHeadersHandler from the headers added to it. - S3ResponseProperties responseProperties; + // The structure to pass to the headers callback. This is filled in by + // the ResponseHeadersHandler from the headers added to it. + S3ResponseProperties responseProperties; - // Set to 1 after the done call has been made - int done; + // Set to 1 after the done call has been made + int done; - // copied into here. We allow 128 bytes for each header, plus \0 term. - string_multibuffer(responsePropertyStrings, 5 * 129); + // copied into here. We allow 128 bytes for each header, plus \0 term. + string_multibuffer(responsePropertyStrings, 5 * 129); - // responseproperties.metaHeaders strings get copied into here - string_multibuffer(responseMetaDataStrings, - COMPACTED_METADATA_BUFFER_SIZE); + // responseproperties.metaHeaders strings get copied into here + string_multibuffer(responseMetaDataStrings, + COMPACTED_METADATA_BUFFER_SIZE); - // Response meta data - S3NameValue responseMetaData[S3_MAX_METADATA_COUNT]; + // Response meta data + S3NameValue responseMetaData[S3_MAX_METADATA_COUNT]; } ResponseHeadersHandler; void response_headers_handler_initialize(ResponseHeadersHandler *handler); void response_headers_handler_add(ResponseHeadersHandler *handler, - char *data, int dataLen); + char *data, int dataLen); void response_headers_handler_done(ResponseHeadersHandler *handler, - CURL *curl); + CURL *curl); #endif /* RESPONSE_HEADERS_HANDLER_H */ diff --git a/inc/simplexml.h b/inc/simplexml.h index 66d5ef9..74445a2 100644 --- a/inc/simplexml.h +++ b/inc/simplexml.h @@ -41,21 +41,21 @@ // // data is passed in as 0 on end of element typedef S3Status (SimpleXmlCallback)(const char *elementPath, const char *data, - int dataLen, void *callbackData); + int dataLen, void *callbackData); typedef struct SimpleXml { - void *xmlParser; + void *xmlParser; - SimpleXmlCallback *callback; + SimpleXmlCallback *callback; - void *callbackData; + void *callbackData; - char elementPath[512]; + char elementPath[512]; - int elementPathLen; + int elementPathLen; - S3Status status; + S3Status status; } SimpleXml; @@ -64,7 +64,7 @@ typedef struct SimpleXml // Always call this, even if the simplexml doesn't end up being used void simplexml_initialize(SimpleXml *simpleXml, SimpleXmlCallback *callback, - void *callbackData); + void *callbackData); S3Status simplexml_add(SimpleXml *simpleXml, const char *data, int dataLen); diff --git a/inc/string_buffer.h b/inc/string_buffer.h index eed9bd4..1b96b58 100644 --- a/inc/string_buffer.h +++ b/inc/string_buffer.h @@ -31,77 +31,77 @@ // Declare a string_buffer with the given name of the given maximum length -#define string_buffer(name, len) \ - char name[len + 1]; \ - int name##Len +#define string_buffer(name, len) \ + char name[len + 1]; \ + int name##Len // Initialize a string_buffer -#define string_buffer_initialize(sb) \ - do { \ - sb[0] = 0; \ - sb##Len = 0; \ - } while (0) +#define string_buffer_initialize(sb) \ + do { \ + sb[0] = 0; \ + sb##Len = 0; \ + } while (0) // Append [len] bytes of [str] to [sb], setting [all_fit] to 1 if it fit, and // 0 if it did not -#define string_buffer_append(sb, str, len, all_fit) \ - do { \ - sb##Len += snprintf(&(sb[sb##Len]), sizeof(sb) - sb##Len - 1, \ - "%.*s", (int) (len), str); \ - if (sb##Len > (int) (sizeof(sb) - 1)) { \ - sb##Len = sizeof(sb) - 1; \ - all_fit = 0; \ - } \ - else { \ - all_fit = 1; \ - } \ - } while (0) +#define string_buffer_append(sb, str, len, all_fit) \ + do { \ + sb##Len += snprintf(&(sb[sb##Len]), sizeof(sb) - sb##Len - 1, \ + "%.*s", (int) (len), str); \ + if (sb##Len > (int) (sizeof(sb) - 1)) { \ + sb##Len = sizeof(sb) - 1; \ + all_fit = 0; \ + } \ + else { \ + all_fit = 1; \ + } \ + } while (0) // Declare a string multibuffer with the given name of the given maximum size -#define string_multibuffer(name, size) \ - char name[size]; \ - int name##Size +#define string_multibuffer(name, size) \ + char name[size]; \ + int name##Size // Initialize a string_multibuffer -#define string_multibuffer_initialize(smb) \ - do { \ - smb##Size = 0; \ - } while (0) +#define string_multibuffer_initialize(smb) \ + do { \ + smb##Size = 0; \ + } while (0) // Evaluates to the current string within the string_multibuffer -#define string_multibuffer_current(smb) \ - &(smb[smb##Size]) +#define string_multibuffer_current(smb) \ + &(smb[smb##Size]) // Adds a new string to the string_multibuffer -#define string_multibuffer_add(smb, str, len, all_fit) \ - do { \ - smb##Size += (snprintf(&(smb[smb##Size]), \ - sizeof(smb) - smb##Size, \ - "%.*s", (int) (len), str) + 1); \ - if (smb##Size > (int) sizeof(smb)) { \ - smb##Size = sizeof(smb); \ - all_fit = 0; \ - } \ - else { \ - all_fit = 1; \ - } \ - } while (0) - - -// Appends to the current string in the string_multibuffer. There must be a +#define string_multibuffer_add(smb, str, len, all_fit) \ + do { \ + smb##Size += (snprintf(&(smb[smb##Size]), \ + sizeof(smb) - smb##Size, \ + "%.*s", (int) (len), str) + 1); \ + if (smb##Size > (int) sizeof(smb)) { \ + smb##Size = sizeof(smb); \ + all_fit = 0; \ + } \ + else { \ + all_fit = 1; \ + } \ + } while (0) + + +// Appends to the current string in the string_multibuffer. There must be a // current string, meaning that string_multibuffer_add must have been called // at least once for this string_multibuffer. -#define string_multibuffer_append(smb, str, len, all_fit) \ - do { \ - smb##Size--; \ - string_multibuffer_add(smb, str, len, all_fit); \ - } while (0) +#define string_multibuffer_append(smb, str, len, all_fit) \ + do { \ + smb##Size--; \ + string_multibuffer_add(smb, str, len, all_fit); \ + } while (0) #endif /* STRING_BUFFER_H */ @@ -38,7 +38,7 @@ // This is the maximum number of bytes needed in a "compacted meta header" // buffer, which is a buffer storing all of the compacted meta headers. #define COMPACTED_METADATA_BUFFER_SIZE \ - (S3_MAX_METADATA_COUNT * sizeof(S3_METADATA_HEADER_NAME_PREFIX "n: v")) + (S3_MAX_METADATA_COUNT * sizeof(S3_METADATA_HEADER_NAME_PREFIX "n: v")) // Maximum url encoded key size; since every single character could require // URL encoding, it's 3 times the size of a key (since each url encoded @@ -49,18 +49,18 @@ // https://s3.amazonaws.com/${BUCKET}/${KEY}?acl // 255 is the maximum bucket length #define MAX_URI_SIZE \ - ((sizeof("https://" S3_HOSTNAME "/") - 1) + 255 + 1 + \ - MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent" - 1)) + 1) + ((sizeof("https://" S3_HOSTNAME "/") - 1) + 255 + 1 + \ + MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent" - 1)) + 1) // Maximum size of a canonicalized resource #define MAX_CANONICALIZED_RESOURCE_SIZE \ - (1 + 255 + 1 + MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent") - 1) + 1) + (1 + 255 + 1 + MAX_URLENCODED_KEY_SIZE + (sizeof("?torrent") - 1) + 1) // Utilities ----------------------------------------------------------------- -// 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 +// 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); @@ -70,15 +70,15 @@ int64_t parseIso8601Time(const char *str); uint64_t parseUnsignedInt(const char *str); -// base64 encode bytes. The output buffer must have at least -// ((4 * (inLen + 1)) / 3) bytes in it. Returns the number of bytes written +// base64 encode bytes. The output buffer must have at least +// ((4 * (inLen + 1)) / 3) bytes in it. Returns the number of bytes written // to [out]. int base64Encode(const unsigned char *in, int inLen, char *out); // Compute HMAC-SHA-1 with key [key] and message [message], storing result // in [hmac] void HMAC_SHA1(unsigned char hmac[20], const unsigned char *key, int key_len, - const unsigned char *message, int message_len); + const unsigned char *message, int message_len); // Compute a 64-bit hash values given a set of bytes uint64_t hash(const unsigned char *k, int length); |