Skip to main content

Cloud Sqs 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 SQS Services Colibri Modules [PXAxxx, Tegra T20], WinCE 6.0 / 7.0 . More...

Macros

#define AWS_SQS_ACCESS_ID_MAX_LENGTH   20
 AWS Account ID string Length.
 
#define AWS_SQS_SECRET_KEY_MAX_LENGTH   40
 AWS Account Secret Kay String Length.
 
#define AWS_SQS_OWNER_ID_MAX_LENGTH   12
 AWS Account Owner ID String Length.
 
#define AWS_SQS_SIGNATURE_HASH_LENGTH   32
 
#define AWS_SQS_SIGNATURE_STRING_LENGTH   44
 
#define SQS_QUEUE_NAME_MAX_LENGTH   80
 
#define SQS_MAX_TIME_STRING_LENGTH   24
 
#define SQS_MESSAGE_ID_LENGTH   100
 
#define SQS_MESSAGE_DELAY_SECONDS_MAX   900
 
#define SQS_MESSAGE_BODY_MAX_LENGTH   (64 * 1024)
 
#define SQS_RECIEPT_HANDLE_MAX_LENGTH   1024
 
#define SQS_ATTRIBUTE_NAME_BUFFER_SIZE   24
 
#define SQS_HTTP_RESPONSE_DATA_BUFFER_SMALL   (2 * 1024)
 
#define SQS_HTTP_RESPONSE_DATA_BUFFER_LARGE   (4 * 1024)
 
#define SQS_HTTP_ARGUMENT_BUFFER_SMALL   (2 * 1024)
 
#define SQS_HTTP_ARGUMENT_BUFFER_LARGE   (4 * 1024)
 
#define SQS_STRING_TO_SIGN_BUFFER_SMALL   (2 * 1024)
 
#define SQS_STRING_TO_SIGN_BUFFER_LARGE   (4 * 1024)
 
#define URL_ENCODED_RECEIPT_HANDLE_BUFFER   (4 * 1024)
 
#define SQS_HANDLE_MEMORY_ALLOCATION   (4 * 5)
 
#define QUEUE_ATTRIBUTE_VISIBILITY_TIMEOUT   1
 
#define QUEUE_ATTRIBUTE_MAXIMUM_MESSAGE_SIZE   2
 
#define QUEUE_ATTRIBUTE_MESSAGE_RETENTION_PERIOD   3
 
#define QUEUE_ATTRIBUTE_DELAY_SECONDS   4
 

Functions

BOOL SqsOpenQueue (char *accessID, char *secretKey, char *path, char *accountOwnerID, char *queueName, HSQS *sqsQueue)
 
BOOL SqsCloseQueue (HSQS *sqsQueue)
 
BOOL SqsSendMessage (HSQS sqsQueue, char *message, DWORD delaySeconds, char *messageID, DWORD messageIDSize)
 
BOOL SqsReceiveMessage (HSQS sqsQueue, char *attributeName, BYTE maxNumberOfMessages, DWORD visibilityTimeout, char *message, char *messageID, char *recieptHandle)
 
BOOL SqsDeleteQueue (HSQS sqsQueue)
 
BOOL SqsCreateQueue (HSQS sqsQueue)
 
BOOL SqsGetQueueUrl (HSQS sqsQueue, char *dataOut, DWORD dataOutSize)
 
BOOL SqsListQueues (HSQS sqsQueue, char *queueNamePrefix, char *filePath)
 
BOOL SqsFindQueue (const char *filePath, char *dataOut, DWORD dataOutSize, DWORD *pointerToNextTopic, DWORD fileSize)
 
BOOL SqsGetQueueAttributes (HSQS sqsQueue, char *dataOut, DWORD dataOutSize)
 
BOOL SqsSetQueueAttributes (HSQS sqsQueue, DWORD attributeName, int attributeValue)
 
BOOL SqsDeleteMessage (HSQS sqsQueue, char *receiptHandle)
 
BOOL SqsChangeMessageVisibility (HSQS sqsQueue, char *receiptHandle, DWORD visibilityTimeoutValue)
 

Detailed Description

Contains function declarations to be used to access AWS Cloud SQS 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 SqsChangeMessageVisibility(HSQS sqsQueue,
  char * receiptHandle,
  DWORD visibilityTimeoutValue 
 )  
Changes Message's Visibility Timeout attribute
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[in]receiptHandlePointer to the string returned by call to SqsReceiveMessage()
[in]visibilityTimeoutValueNew value for timeout, Range [0 - 900] Seconds
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsCloseQueue(HSQS * sqsQueue) 
Deletes already opened SQS Queue Handle
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsCreateQueue(HSQS sqsQueue) 
Creates a Queue
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsDeleteMessage(HSQS sqsQueue,
  char * receiptHandle 
 )  
Deletes a Message from a Queue
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[in]receiptHandlePointer to the string returned by call to SqsReceiveMessage()
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsDeleteQueue(HSQS sqsQueue) 
Deletes the Queue
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsFindQueue(const char * filePath,
  char * dataOut,
  DWORD dataOutSize,
  DWORD * pointerToNextTopic,
  DWORD fileSize 
 )  
Finds one by one Queue details stored in a local file as a result of function call to SnsListQueues()
File must be initialized by calling SqsListQueues()
Parameters
[in]filePathLocal file path in which queue list data is saved
[out]dataOutPointer to the allocated memory to store returned queue detail, user need to allocate memory
[in]dataOutSizeSize of the allocated memory pointed by dataOut
[in,out]pointerToNextTopicPoints to next location of detail, to find 1st in the list put NULL
[in]fileSizeSize of the file in bytes, pointed by filePath
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsGetQueueAttributes(HSQS sqsQueue,
  char * dataOut,
  DWORD dataOutSize 
 )  
Gets Queue Attributes
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[out]dataOutPointer to the allocated memory to hold Queue attributes data returned by function, user need to allocate memory
[in]dataOutSizeSize of the allocated memory
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsGetQueueUrl(HSQS sqsQueue,
  char * dataOut,
  DWORD dataOutSize 
 )  
Gets Queue Url
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[out]dataOutPointer to the allocated memory to hold Queue string returned by the function, user need to allocate memory
[in]dataOutSizeSize of the allocated memory for dataOut
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsListQueues(HSQS sqsQueue,
  char * queueNamePrefix,
  char * filePath 
 )  
Lists all Queues in a local file starting with prefix mentioned
Queues are stores in a local file
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[in]queueNamePrefixPrefix example "test" to get a list of all queues starting with test or
"t" to get list of all queue starting with letter t
[in]filePathLocal file path in which queue list data will be saved
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsOpenQueue(char * accessID,
  char * secretKey,
  char * path,
  char * accountOwnerID,
  char * queueName,
  HSQS * sqsQueue 
 )  
Opens Handle for SQS Queue, the returned sqsQueue Handle is required as an input parameter to every Sqs function call
Parameters
[in]accessIDAWS Access ID [20 Characters]
[in]secretKeyAWS Secret Key [40 Characters]
[in]pathAWS SQS path
[in]accountOwnerID12 digit unique ID number like, AWS Access ID
[in]queueNameQueue names must be constructed using only uppercase/lowercase ASCII letters,
numbers, underscore, hyphen, and must be between 1 and 80 characters long.
[out]sqsQueueHandle to hold various sqs related parameters.
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsReceiveMessage(HSQS sqsQueue,
  char * attributeName,
  BYTE maxNumberOfMessages,
  DWORD visibilityTimeout,
  char * message,
  char * messageID,
  char * recieptHandle 
 )  
Receives message from an existing Queue
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[in]attributeNameValid String values: All | SenderId | SentTimestamp | ApproximateReceiveCount | ApproximateFirstReceiveTimestamp
[in]maxNumberOfMessagesMaximum number of messages to return, 1 to 10(maximum)
[in]visibilityTimeoutThe duration (in seconds) that the received messages are hidden
from subsequent retrieve requests after being retrieved by a SqsReceiveMessage() request.
[out]messagePointer to the received Message as string (64KB maximum)
[out]messageIDPointer to the received Message's ID as string, maximum length = 100
[out]recieptHandlePointer to the recieptHandle as string, it is required by SnsDeleteMessage() call. Maximum length = 1024
Return values
TRUESuccess
FALSESee GetLastError() AttributeName, visibilityTimeout, maxNumberOfMessages - working in default mode only for now (kept it for future use)
Put NULL for these input parameters
BOOL SqsSendMessage(HSQS sqsQueue,
  char * message,
  DWORD delaySeconds,
  char * messageID,
  DWORD messageIDSize 
 )  
Sends a message to the Queue
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[in]messageThe message you want to send to the queue. Maximum length is 64KB
[in]delaySecondsNumber of seconds to delay the message
Messages with a positive delay seconds becomes available for processing after the delay time has elapsed
[out]messageIDSuccessful call to this function will put message ID string on the memory pointed by this pointer, user need to allocate memory
[in]messageIDSizeSize of the memory allocated for messageID
Return values
TRUESuccess
FALSESee GetLastError()
BOOL SqsSetQueueAttributes(HSQS sqsQueue,
  DWORD attributeName,
  int attributeValue 
 )  
Sets Queue Attribute
Parameters
[in]sqsQueueHandle returned by call to SqsOpenQueue()
[in]attributeNameValid values can be from 1 to 4, user should use macros QUEUE_ATTRIBUTE_XXXXXXXXX
[in]attributeValueValue associated with attributeName
Return values
TRUESuccess
FALSESee GetLastError()


Send Feedback!