Skip to content

Commit c0f552c

Browse files
authored
Bump aws-c-iot version to pull in secure tunnel fixes (#626)
* Fix secure tunnel readme * Update secure tunnel user guide
1 parent 785bdc0 commit c0f552c

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

documents/Secure_Tunnel_Userguide.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ When a WebSocket upgrade request fails to connect, this callback will return an
9494
When the WebSocket connection shuts down, this callback will be invoked.
9595
9696
### OnSendMessageComplete
97-
When a message has been completely written to the socket, this callback will be invoked.
97+
98+
This callback is invoked when either a message has been completely written to the socket or an error occured.
99+
The callback is invoked for the following operations:
100+
- SendMessage
101+
- SendStreamStart
102+
- SendConnectionStart
103+
104+
See [Send Message](#send-message) for additional details.
98105
99106
### OnMessageReceived
100107
When a message is received on an open Secure Tunnel stream, this callback will return the message.
@@ -208,9 +215,18 @@ Service Ids can be added to outbound Messages as shown below in the Send Message
208215
Connection Ids can be added to outbound Messages as shown below in the Send Message example. If there is an active stream currently open using the combination of the Service Id and Connection Id, the message will be sent. If a Connection Id is not set on an outbound message, a Connecion Id of 1 is assumed and applied to the Message. When additional streams are activated, the `OnConnectionStarted` callback is invoked and returns a `ConnectionStartedEventData` which can be parsed to determine the Connection Id of the newly activated stream. A Connection Id will also be present in the `StreamStartedEventData` that is returned when the `OnStreamStarted` callback is invoked.
209216
210217
# Send Message
211-
The `SendMessage()` operation takes a description of the Message you wish to send and returns a success/failure in the synchronous logic that kicks off the `SendMessage()` operation. When the message is fully written to the socket, the `OnSendDataComplete` callback will be invoked.
218+
219+
The `SendMessage()` operation takes a description of the Message you wish to send and enques the message for sending it asynchronously to the destination. The call returns a success/failure in the synchronous logic that kicks off the asynchronous operation. However, since the main validation actions are performed asynchronously, the user code should setup the `OnSendMessageComplete` callback for catching errors.
212220
213221
```cpp
222+
builder.WithOnSendMessageComplete(
223+
[&](SecureTunnel *secureTunnel, int errorCode, const SendMessageCompleteEventData &eventData) {
224+
if (errorCode)
225+
{
226+
fprintf(stdout, "Send Message failed with error code %d(%s)\n", errorCode, ErrorDebugString(errorCode));
227+
}
228+
});
229+
214230
Crt::String serviceId_string = "ssh";
215231
Crt::String message_string = "any payload";
216232
@@ -230,6 +246,7 @@ message->withPayload(payload);
230246
// Send Message
231247
secureTunnel->SendMessage(message);
232248
```
249+
233250
# Secure Tunnel Best Practices
234251
* You MUST NOT perform blocking operations on any callback, or you will cause a deadlock.
235252
* If you do not provide a Client Token during creation of the Secure Tunnel, one will be automatically generated for you to use in reconnections. This token is not saved outside of the current Secure Tunnel Client. If the Client is destroyed, the original access tokens must be rotated to connect to the secure tunnel again. Information on rotating tokens can be found here: https://docs.aws.amazon.com/iot/latest/developerguide/iot-secure-tunneling-troubleshooting.html

samples/secure_tunneling/secure_tunnel/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ The sample will create a Secure Tunnel connection and remain connected in `DESTI
2020

2121
### Source Mode
2222

23-
While the focus of the Secure Tunnel Client for the IoT Device SDK is to connect with Secure Tunnels in `DESTINATION MODE` we also support connecting in `SOURCE MODE`. The token file should be the Source Token in this instance and you must add the `--localProxyModeSource` flag:
23+
While the focus of the Secure Tunnel Client for the IoT Device SDK is to connect with Secure Tunnels in `DESTINATION MODE` we also support connecting in `SOURCE MODE`. The token file should be the Source Token in this instance and you must add the `--local_proxy_mode_source` flag:
2424

2525
``` sh
26-
./secure-tunnel --signing_region <signing_region> --access_token_file <path to source access token> --localProxyModeSource
26+
./secure-tunnel --signing_region <signing_region> --access_token_file <path to source access token> --local_proxy_mode_source
2727
```
2828

29-
Then two samples will then connect to each other through the AWS Secure Tunnel endpoint and establish a stream through which data can be transmitted in either direction.
29+
Then two samples will connect to each other through the AWS Secure Tunnel endpoint and establish a stream through which data can be transmitted in either direction.
3030
The sample will create a Secure Tunnel connection in `SOURCE MODE` and will open a stream using an available `Service Id`. It will then send n messages on the opened stream. It will then create a new simultaneous TCP connection on the stream and send an additional n messages on the new TCP connection. It will then exit.
3131

3232
### Proxy
33+
3334
Note that a proxy server may be used via the `--proxy_host` and `--proxy_port` argument. If the proxy server requires a user name and password to connect, you can use `--proxy_user_name` and `--proxy_password` to in the sample to pass the required data to the sample.

0 commit comments

Comments
 (0)