Search by Tags

Cloud Sns Lib API

 

Compare with Revision

Subscribe for this article updates

Contains function declarations to be used to access AWS Cloud Sns Services Colibri Modules [PXAxxx, Tegra T20], WinCE 6.0 / 7.0 Number of Topics are restricted to 100, number of subscriptions per Topic are limited to 100. More...

Macros

#define  AWS_SNS_ACCESS_ID_MAX_LENGTH  20
AWS Account ID string Length.
#define  AWS_SNS_SECRET_KEY_MAX_LENGTH  40
AWS Account Secret Kay String Length.
#define  AWS_SNS_OWNER_ID_MAX_LENGTH  12
AWS Account Owner ID String Length.
#define  SNS_TOPIC_NAME_MAX_LENGTH  256
Maximum number of characters allowed in Topic Name.
#define  SNS_DISPLAY_NAME_MAX_LENGTH  100
Maximum number of characters allowed in Topic's Display Name.
#define  SNS_MAX_TIME_STRING_LENGTH  24
AWS Sns Formatted Time String Length.
#define  AWS_SNS_SIGNATURE_HASH_LEN  32
HMAC-SHA2 HASH Length.
#define  AWS_SNS_SIGNATURE_STRING_LEN  44
HMAC-SHA2 Signature String Length.
#define  AWS_SNS_MESSAGE_SIZE_MAX  (32 * 1024)
Maximum allowed message length 32 KB (Applicable to SnsPublish)
#define  AWS_SNS_SUBJECT_MAX  (100)
Maximum number of characters allowed in subject (Applicable to SnsPublish)
#define  SNS_LIST_TOPIC_RECEIVE_CHUNK  (32 * 1024)
Buffer Size used when receiving list of Topics.
#define  SNS_LIST_SUBSCRIPTION_RECEIVE_CHUNK  (32 * 1024)
Buffer Size used when receiving list of Subscriptions.
#define  PROTOCOL_TYPE_HTTP  1
http Protocol
#define  PROTOCOL_TYPE_HTTPS  2
https Protocol
#define  PROTOCOL_TYPE_EMAIL  3
email Protocol
#define  PROTOCOL_TYPE_EMAIL_JSON  4
email-json Protocol
#define  PROTOCOL_TYPE_SMS  5
sms Protocol
#define  PROTOCOL_TYPE_SQS  6
sqs Protocol
#define  ATTRIBUTE_TYPE_POLICY  1
Attribute Type Selection Policy.
#define  ATTRIBUTE_TYPE_DISPLAYNAME  2
Attribute Type Selection Display Name.
#define  ATTRIBUTE_TYPE_DELIVERYPOLICY  3
Attribute Type Selection Delivery Policy.
#define  SNS_HANDLE_MEMORY_ALLOCATION_SIZE  (7 * 4)
#define  SNS_HTTP_RESPONSE_DATA_BUFFER_SMALL  (1 * 1024)
#define  SNS_HTTP_RESPONSE_DATA_BUFFER_LARGE  (3 * 1024)
#define  SNS_HTTP_ARGUMENT_BUFFER_SMALL  (2 * 1024)
#define  SNS_STRING_TO_SIGN_BUFFER_SMALL  (2 * 1024)
#define  URL_ENCODED_TOPIC_NAME_BUFFER  1024
#define  URL_ENCODED_TOPIC_ARN_BUFFER  1024
#define  URL_ENCODED_SUB_ARN_BUFFER  1024
#define  URL_ENCODED_ENDPOINT_BUFFER  1024
#define  URL_ENCODED_SUBJECT_BUFFER  512
#define  URL_ENCODED_ATTRIBUTE_VALUE_BUFFER  512
#define  PROTOCOL_STRING_LENGTH  10
#define  ATTRIBUTE_VALUE_BUFFER_SIZE  256

Functions

BOOL  SnsOpenTopic (char *accessID, char *secretKey, char *ownerId, char *path, char *topicName, char *displayName, HSNS *snsTopicHandle)
BOOL  SnsCloseTopic (HSNS *snsTopicHandle)
BOOL  SnsCreateTopic (HSNS snsTopicHandle)
BOOL  SnsPublish (HSNS snsTopicHandle, const char *subject, const char *message)
BOOL  SnsDeleteTopic (HSNS snsTopicHandle)
BOOL  SnsSubscribe (HSNS snsTopicHandle, char *endPoint, BYTE protocolType)
BOOL  SnsListTopics (HSNS snsTopicHandle, char *filePath)
BOOL  SnsUnsubscribe (HSNS snsTopicHandle, char *subArn)
BOOL  SnsListSubscriptions (HSNS snsTopicHandle, char *filePath)
BOOL  SnsFindTopic (const char *filePath, char *dataOut, DWORD dataOutSize, DWORD *pointerToNextTopic, DWORD fileSize)
BOOL  SnsFindSubscriptions (const char *filePath, char *dataOut, DWORD dataOutSize, DWORD *pointerToNextSubscriptionByTopic, DWORD fileSize)
BOOL  SnsGetSubscriptionAttribtues (HSNS snsTopicHandle, char *subArn, char *dataOut, DWORD dataOutSize)
BOOL  SnsGetTopicAttributes (HSNS snsTopicHandle, char *dataOut, DWORD dataOutSize)
BOOL  SnsSetTopicAttributes (HSNS snsTopicHandle, BYTE attributeType, char *attributeValue)

Detailed Description

Contains function declarations to be used to access AWS Cloud Sns Services Colibri Modules [PXAxxx, Tegra T20], WinCE 6.0 / 7.0 Number of Topics are restricted to 100, number of subscriptions per Topic are limited to 100.

Author
Author:
agp
Version
Rev:
1154
Date
Date:
2012-11-08 19:56:19 +0530 (Thu, 08 Nov 2012)

Function Documentation

BOOL SnsCloseTopic ( HSNS *  snsTopicHandle )

Deletes already created Sns Topic Handle

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsCreateTopic ( HSNS  snsTopicHandle )

Creates new Sns Topic

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsDeleteTopic ( HSNS  snsTopicHandle )

Deletes already existing Sns Topic

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsFindSubscriptions ( const char *  filePath,
char *  dataOut,
DWORD  dataOutSize,
DWORD *  pointerToNextSubscriptionByTopic,
DWORD  fileSize
)

Finds Subscription details by Topic from list of subscriptionsByTopic stored in a local file
The file must be initialized by calling SnsListSubscriptionsByTopic()

Parameters
[in] filePath File path in which list of subscription exists
[out] dataOut Pointer to the output string containing subscription details, user need to allocate memory
[in] dataOutSize Number of bytes allocated for dataOut
[in,out] pointerToNextSubscriptionByTopic Pointer to next Subscription details from list data, to find 1st Subscription by topic Detail, put NULL
[in] fileSize Size of the file in bytes
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsFindTopic ( const char *  filePath,
char *  dataOut,
DWORD  dataOutSize,
DWORD *  pointerToNextTopic,
DWORD  fileSize
)

Finds Topic Details from list of Topics stored in a local file
The file must be initialized by calling SnsListTopics()

Parameters
[in] filePath File path in which list of subscription exists
[out] dataOut Pointer to the output string containing Topic details, user need to allocate memory
[in] dataOutSize Number of bytes allocated for dataOut
[in,out] pointerToNextTopic Pointer to next Topic details from list data, to find 1st topic details, put NULL.
[in] fileSize Size of the file in bytes
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsGetSubscriptionAttribtues ( HSNS  snsTopicHandle,
char *  subArn,
char *  dataOut,
DWORD  dataOutSize
)

Gets Subscription Attributes

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[in] subArn Subscription Arn String
[out] dataOut Pointer to the output string containing subscription attributes details, user need to allocate memory
[in] dataOutSize Number of bytes allocated for dataOut
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsGetTopicAttributes ( HSNS  snsTopicHandle,
char *  dataOut,
DWORD  dataOutSize
)

Gets Topic Attributes of Sns Topic

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[out] dataOut Pointer to the output string containing TopicAttribute details, user need to allocate memory
[in] dataOutSize Number of bytes allocated for dataOut
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsListSubscriptions ( HSNS  snsTopicHandle,
char *  filePath
)

Lists Subscriptions by topic in an Sns Account, for a particular region (max 100)
Subscriptions by Topic are stored into a local file

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[in] filePath File in which list of Subscriptions by topics will be saved, user need to delete already existing file,
else list data will be appended in the same file
Return values
TRUE Success
FALSE See GetLastError() Number of Topics are restricted to 100, number of subscriptions per Topic are limited to 100
BOOL SnsListTopics ( HSNS  snsTopicHandle,
char *  filePath
)

Lists topics in an Sns Account, for a particular region (max 100)
Topics are stored into a local file

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[in] filePath File in which list of topics will be saved, user need to delete already existing file,
else list data will be appended in the same file
Return values
TRUE Success
FALSE See GetLastError() Number of Topics are restricted to 100, number of subscriptions per Topic are limited to 100
BOOL SnsOpenTopic ( char *  accessID,
char *  secretKey,
char *  ownerId,
char *  path,
char *  topicName,
char *  displayName,
HSNS *  snsTopicHandle
)

Opens handle for Sns topic, the returned snsTopicHandle is required as an input parameter to every Sns function call

Parameters
[in] accessID AWS Access ID [20 Characters]
[in] secretKey AWS Secret Key [40 Characters]
[in] ownerId AWS Owner ID [12 Characters]
[in] path AWS Sns path
[in] topicName Topic names must be constructed using only uppercase and lowercase ASCII letters,
numbers, underscore, hyphens and must be between 1 and 256 characters long
[in] displayName [OPTIONAL] if not NULL, Display names must be constructed using only uppercase/lowercase ASCII letters,
numbers, underscore, hyphens and must be between 1 and 100 characters long
[out] snsTopicHandle Structure to hold various sns related parameters.
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsPublish ( HSNS  snsTopicHandle,
const char *  subject,
const char *  message
)

Publishes/Sends a message to all the subscribed endpoints of a topic. When a messageId is returned,
the message has been saved and Amazon Sns will attempt to deliver it to the topic subscribers shortly
The format of the outgoing message to each subscribed endpoint depends on the notification protocol selected

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[in] subject Optional parameter to be used as the "Subject" line, when the message is delivered to e-mail endpoints, max 100 ASCII characters
[in] message The message you want to send to the topic. Maximum length is 32 x 1024 characters
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsSetTopicAttributes ( HSNS  snsTopicHandle,
BYTE  attributeType,
char *  attributeValue
)

Sets Topic Attributes

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[in] attributeType [1] - Policy,
[2] - DisplayName,
[3] - DeliveryPolicy
[in] attributeValue String containing respective attribute value
Return values
TRUE Success
FALSE See GetLastError() only attributes = 2 (DisplayName) is working
BOOL SnsSubscribe ( HSNS  snsTopicHandle,
char *  endPoint,
BYTE  protocolType
)

Subscribes an endpoint to a topic

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[in] endPoint URL "http://", URL "https://" , Email ID, Phone number for SMS, SQS: ARN of an Amazon SQS queue, etc
[in] protocolType Valid Values can be from 1 to 6,
[1] - "http",
[2] - "https",
[3] - "email",
[4] - "email-json",
[5] - "sms",
[6] - "sqs"
Return values
TRUE Success
FALSE See GetLastError()
BOOL SnsUnsubscribe ( HSNS  snsTopicHandle,
char *  subArn
)

Unsubscribes an endpoint from its subscription

Parameters
[in] snsTopicHandle Handle returned by call to SnsTopicOpen()
[in] subArn Subscription Arn String
Return values
TRUE Success
FALSE See GetLastError()