Filter results by

Older Versions

Older API versions are available as a download. To view, extract the file and open the index.html file in a web browser.

artik_websocket.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  */
18 
19 #ifndef INCLUDE_ARTIK_WEBSOCKET_H_
20 #define INCLUDE_ARTIK_WEBSOCKET_H_
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "artik_error.h"
27 #include "artik_types.h"
28 #include "artik_ssl.h"
29 
48 typedef enum {
49  ARTIK_WEBSOCKET_CLOSED = 1,
50  ARTIK_WEBSOCKET_CONNECTED,
51  ARTIK_WEBSOCKET_HANDSHAKE_ERROR
53 
60 typedef void *artik_websocket_handle;
61 
68 typedef struct {
72  char *uri;
82 
88 typedef void (*artik_websocket_callback)(void *user_data,
89  void *result);
90 
98 typedef struct {
109  artik_error(*websocket_request) (
110  artik_websocket_handle * handle,
111  artik_websocket_config * config
112  );
121  artik_error(*websocket_open_stream) (
122  artik_websocket_handle
123  handle
124  );
134  artik_error(*websocket_write_stream) (
135  artik_websocket_handle
136  handle, char *message
137  );
152  artik_error(*websocket_set_connection_callback) (
153  artik_websocket_handle
154  handle,
155  artik_websocket_callback callback,
156  void *user_data
157  );
171  artik_error(*websocket_set_receive_callback) (artik_websocket_handle
172  handle, artik_websocket_callback callback, void *user_data);
181  artik_error(*websocket_close_stream) (artik_websocket_handle
182  handle);
184 
185 extern const artik_websocket_module websocket_module;
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 #endif /* INCLUDE_ARTIK_WEBSOCKET_H_ */
artik_websocket_connection_state
Websocket connection state.
void * artik_websocket_handle
WEBSOCKET handle type.
Custom types.
void * private_data
Pointer to data for internal use by the API.
int artik_error
Error type.
Definition: artik_error.h:35
void(* artik_websocket_callback)(void *user_data, void *result)
Websocket callback type.
char * uri
URI of the websocket server.
SSL/TLS related definitions.
artik_ssl_config ssl_config
SSL configuration.
Error codes.
Websocket module operations.
SSL configuration structure.
Definition: artik_ssl.h:106
websocket configuration structure
Last updated on: