AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
WebSocketConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 /*
17  * Based on code supplied by the websocketpp library, original licence below
18  *
19  * Copyright (c) 2014, Peter Thorson. All rights reserved.
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions are met:
23  * * Redistributions of source code must retain the above copyright
24  * notice, this list of conditions and the following disclaimer.
25  * * Redistributions in binary form must reproduce the above copyright
26  * notice, this list of conditions and the following disclaimer in the
27  * documentation and/or other materials provided with the distribution.
28  * * Neither the name of the WebSocket++ Project nor the
29  * names of its contributors may be used to endorse or promote products
30  * derived from this software without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35  * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
36  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  */
44 
45 #ifndef ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETCONFIG_H_
46 #define ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETCONFIG_H_
47 
48 #include <websocketpp/transport/asio/endpoint.hpp>
49 // Always include the no_tls config, even if ssl is enabled
50 #include <websocketpp/config/asio_no_tls.hpp>
51 #ifdef ENABLE_WEBSOCKET_SSL
52 #include <websocketpp/transport/asio/security/tls.hpp>
53 #endif
54 
55 #include "WebSocketSDKLogger.h"
56 
57 namespace alexaClientSDK {
58 namespace sampleApplications {
59 namespace ipcServerSampleApp {
60 namespace communication {
67 struct WebSocketConfig : public websocketpp::config::asio {
70 
72  typedef asio base;
73 
75  typedef base::concurrency_type concurrency_type;
76 
78  typedef base::request_type request_type;
79 
81  typedef base::response_type response_type;
82 
84  typedef base::message_type message_type;
85 
87  typedef base::con_msg_manager_type con_msg_manager_type;
88 
90  typedef base::endpoint_msg_manager_type endpoint_msg_manager_type;
91 
94 
97 
99  typedef base::rng_type rng_type;
100 
106  struct transport_config : public base::transport_config {
109 
112 
115 
118 
121 
122 #ifdef ENABLE_WEBSOCKET_SSL
123  typedef websocketpp::transport::asio::tls_socket::endpoint socket_type;
124 #else
125  typedef websocketpp::transport::asio::basic_socket::endpoint socket_type;
127 #endif
128  };
129 
131  typedef websocketpp::transport::asio::endpoint<transport_config> transport_type;
132 };
133 } // namespace communication
134 } // namespace ipcServerSampleApp
135 } // namespace sampleApplications
136 } // namespace alexaClientSDK
137 
138 #endif // ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETCONFIG_H_
WebSocketSDKLogger alog_type
Logger to use for access logs.
Definition: WebSocketConfig.h:93
base::message_type message_type
Type used to store messages.
Definition: WebSocketConfig.h:84
type::request_type request_type
The type of request policy (a http request parser)
Definition: WebSocketConfig.h:117
type::elog_type elog_type
Logger to use for error logs.
Definition: WebSocketConfig.h:114
base::con_msg_manager_type con_msg_manager_type
Connection message manager policy.
Definition: WebSocketConfig.h:87
base::concurrency_type concurrency_type
Concurrency policy used by websocketspp.
Definition: WebSocketConfig.h:75
base::rng_type rng_type
Random number generator type.
Definition: WebSocketConfig.h:99
base::endpoint_msg_manager_type endpoint_msg_manager_type
Endpoint message manager policy.
Definition: WebSocketConfig.h:90
asio base
The base class which this config is extending.
Definition: WebSocketConfig.h:72
WebSocketConfig type
The type of this struct.
Definition: WebSocketConfig.h:69
Wrapper around the Alexa Client SDK logger for use by websocketspp.
Definition: WebSocketSDKLogger.h:28
type::alog_type alog_type
Logger to use for access logs.
Definition: WebSocketConfig.h:111
WebSocketSDKLogger elog_type
Logger to use for error logs.
Definition: WebSocketConfig.h:96
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
websocketpp::transport::asio::endpoint< transport_config > transport_type
Typedef for the endpoint encapsulating the transport configuration defined above. ...
Definition: WebSocketConfig.h:131
base::request_type request_type
The type of request policy (a http request parser)
Definition: WebSocketConfig.h:78
type::response_type response_type
The type of response policy (http)
Definition: WebSocketConfig.h:120
websocketpp::transport::asio::basic_socket::endpoint socket_type
The socket type to use (basic, tls, etc)
Definition: WebSocketConfig.h:126
base::response_type response_type
The type of response policy (http)
Definition: WebSocketConfig.h:81
type::concurrency_type concurrency_type
Concurrency policy used by websocketspp.
Definition: WebSocketConfig.h:108

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0