Skip to main content

Cloud S3 Lib API

danger

this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.


Contains function declarations to be used to access AWS Cloud S3 Services Colibri Modules [PXAxxx, Tegra T20], WinCE 6.0 / 7.0 . More...

Macros

#define AWS_S3_ACCESS_ID_MAX_LENGTH   20
 20 Characters
 
#define AWS_S3_SECRET_KEY_MAX_LENGTH   40
 40 Characters
 
#define MAX_RESOURCE_PATH_SIZE   1024
 Max Resource Path String Length allowed.
 
#define AWS_S3_TIME_STRING_LEN   32
 AWS Time String Length.
 
#define AWS_SIGNATURE_STRING_LEN   28
 Length of Signature String.
 
#define AWS_LIST_ALL_BUCKET_CHUNK_SIZE   (1024 * 32)
 
#define AWS_LIST_BUCKET_CHUNK_SIZE   (1024 * 32)
 
#define AWS_DOWNLOAD_FILE_CHUNK_SIZE   (1024 * 100)
 
#define AWS_UPLOAD_FILE_CHUNK_SIZE   (1024 * 100)
 
#define S3_HANDLE_MEMORY_ALLOCATION   (3 * 4)
 
#define S3_HEADER_BUFFER_SIZE   120
 
#define S3_HTTP_RESPONSE_DATA_BUFFER_SMALL   (1 * 1024)
 

Functions

BOOL S3Open (HS3 *s3Account, const char *accessId, const char *secretKey, const char *path)
 
BOOL S3ListAllBuckets (HS3 s3Account, char *listData, const char *filePath, DWORD *rawBytes)
 
BOOL S3ListBucket (HS3 s3Account, const char *bucketPath, const char *tmpFileName, DWORD *rawBytes)
 
BOOL FindFirstBucket (const char *filePath, DWORD fileSize, char *dataOut, DWORD dataOutSize, DWORD *pointerToNextFile)
 
BOOL FindFirstFileInBucket (const char *filePath, DWORD fileSize, char *dataOut, DWORD dataOutSize, DWORD *pointerToNextFile)
 
BOOL S3MakeDirectory (HS3 s3Account, const char *directoryPath)
 
BOOL S3RemoveDirectory (HS3 s3Account, const char *directoryPath)
 
BOOL S3DeleteFile (HS3 s3Account, const char *filePath)
 
BOOL S3DownloadFile (HS3 s3Account, const char *sourceFilePath, const char *destinationFilePath, DWORD fileSize, DWORD *bytesDownloaded, CallBackType callBack)
 
BOOL S3UploadFile (HS3 s3Account, const char *sourceFilePath, DWORD sourceFileSize, const char *destinationFilePath, DWORD *bytesUploaded, CallBackType callBack)
 
BOOL S3Close (HS3 *s3Account)
 

Detailed Description

Contains function declarations to be used to access AWS Cloud S3 Services Colibri Modules [PXAxxx, Tegra T20], WinCE 6.0 / 7.0 .
Author
Author:
agp
Version
Rev:
1154
Date
Date:
2012-11-08 19:56:19 +0530 (Thu, 08 Nov 2012)

Function Documentation

BOOL FindFirstBucket(const char * filePath,
  DWORD fileSize,
  char * dataOut,
  DWORD dataOutSize,
  DWORD * pointerToNextFile 
 )  
Finds Bucket details one by one from list stored in a local file
File should be initialized by calling S3ListAllBuckets()
Parameters
[in]filePathPointer to the file path string
[in]fileSizeSize of the file in bytes, this value is received from call to S3ListAllBuckets() in variable rawBytes
[out]dataOutPointer to the memory holding file information: "filename:size of file",
User need to allocate memory to hold data
[in]dataOutSizeSize of the memory allocated for dataOut
[in,out]pointerToNextFilePointer holds value to next file details, this parameter will be NULL for 1st call
Return values
TRUESuccess
FALSESee GetLastError()
BOOL FindFirstFileInBucket(const char * filePath,
  DWORD fileSize,
  char * dataOut,
  DWORD dataOutSize,
  DWORD * pointerToNextFile 
 )  
Finds file inside the bucket one by one, from the bucket list stored in a local file
File should be initialized by calling S3ListBucket()
Parameters
[in]filePathPointer to the file path string
[in]fileSizeSize of the file in bytes, this value is received from call to S3ListBucket() in variable rawBytes
[out]dataOutPointer to the memory holding file information: "filename:size of file", user need to allocate memory to hold data
[in]dataOutSizeSize of the memory allocated for dataOut
[in,out]pointerToNextFilePointer holds value to next file received from previous call to FindFirstFileInBucket(), this parameter will be NULL for 1st call
Return values
TRUESuccess
FALSESee GetLastError()
BOOL S3Close(HS3 * s3Account) 
Deletes already opened s3Account Handle
Parameters
[in]s3AccountHandle returned by call to S3Open()
Return values
TRUESuccess
FALSESee GetLastError()
BOOL S3DeleteFile(HS3 s3Account,
  const char * filePath 
 )  
Deletes existing file from a Bucket
Parameters
[in]s3AccountHandle returned by call to S3Open()
[in]filePathPointer to the s3 file path string
Return values
TRUESuccess
FALSESee GetLastError() if filePath does not exists, it will report success
BOOL S3DownloadFile(HS3 s3Account,
  const char * sourceFilePath,
  const char * destinationFilePath,
  DWORD fileSize,
  DWORD * bytesDownloaded,
  CallBackType callBack 
 )  
Downloads a file from a bucket to local system
Parameters
[in]s3AccountHandle returned by call to S3Open()
[in]sourceFilePathPointer to the remote/s3 file path string
[in]destinationFilePathPointer to the local file path string
[in]fileSizeOptional to use, Size of the file to download, user need to find out using call to S3ListAllBuckets()
if doesn't want to use this feature put NULL
[out]bytesDownloadedPointer to the variable which holds number of bytes downloaded
[in]callBackPointer to the function which will be called during download in progress
Function will be called, after every 32KB of data is downloaded
Return values
TRUESuccess
FALSESee GetLastError() "+" character is not allowed in sourceFilePath & destinationFilePath
BOOL S3ListAllBuckets(HS3 s3Account,
  char * listData,
  const char * filePath,
  DWORD * rawBytes 
 )  
Lists all the bucket in S3 account List is stored in a local file
Parameters
[in]s3AccountHandle returned by call to S3Open()
[out]listDataPointer to the Bucket list
Data will be like "Bucket1Name:CreationDate" User need to allocate sufficient memory to hold the data before using this function
[NULL] if this parameter is set NULL, it will give only noOfBuckets & rawBytes as output
[pointer variable] after knowing number of buckets/number of raw data bytes required to hold bucket list data
User can decide how many bytes are required to allocate for bucket list
User can allocate rawBytes number of bytes
[in]filePathPointer to the file path, in which all bucket list data to be stored.
[out]rawBytesPointer to the variable holding number of bytes required for bucket list data
Return values
TRUESuccess
FALSESee GetLastError() User need to check & if file exists, delete the file(filePath) before using the function
BOOL S3ListBucket(HS3 s3Account,
  const char * bucketPath,
  const char * tmpFileName,
  DWORD * rawBytes 
 )  
Lists all the files inside a bucket
List is stored in a local file
Parameters
[in]s3AccountHandle returned by call to S3Open()
[in]bucketPathPointer to the path of the bucket, for example "/awswebdrive1/"
[in]tmpFileNamePointer to the local file path string in which list data will be stored
[out]rawBytesPointer to the variable which holds size of file in number of bytes
Return values
TRUESuccess
FALSESee GetLastError() User need to check & if file exists, delete the file(filePath) before using the function
BOOL S3MakeDirectory(HS3 s3Account,
  const char * directoryPath 
 )  
Makes new directory in a Bucket
Parameters
[in]s3AccountHandle returned by call to S3Open()
[in]directoryPathPointer to the s3 directory path string
Return values
TRUESuccess
FALSESee GetLastError() if existing directory path is given, it will report successful
BOOL S3Open(HS3 * s3Account,
  const char * accessId,
  const char * secretKey,
  const char * path 
 )  
Opens Handle for s3Account
Parameters
[out]s3Accounts3Account Handle
[in]accessIdPointer to the aws account Access Id string [20 Characters]
[in]secretKeyPointer to the aws account Secret Key [40 Characters]
[in]pathPointer to the aws s3 path string
Return values
TRUESuccess
FALSESee GetLastError()
BOOL S3RemoveDirectory(HS3 s3Account,
  const char * directoryPath 
 )  
Deletes existing directory from a Bucket
Parameters
[in]s3AccountHandle returned by call to S3Open()
[in]directoryPathPointer to the s3 directory path string
Return values
TRUESuccess
FALSESee GetLastError() if non existing directory path is given, it will report success
BOOL S3UploadFile(HS3 s3Account,
  const char * sourceFilePath,
  DWORD sourceFileSize,
  const char * destinationFilePath,
  DWORD * bytesUploaded,
  CallBackType callBack 
 )  
Uploads a file to a bucket, existing on a local system
Parameters
[in]s3AccountHandle returned by call to S3Open()
[in]sourceFilePathPointer to the local file path string
[in]sourceFileSizesize of the file in bytes (sourceFilePath)
[in]destinationFilePathPointer to the remote/S3 file path string
[out]bytesUploadedPointer to the variable which will holds, number of bytes uploaded
[in]callBackPointer to the function which will be called during upload in progress
Function will be called after, every 32KB of data is uploaded
Return values
TRUESuccess
FALSESee GetLastError() "+" character is not allowed in sourceFilePath & destinationFilePath


Send Feedback!