WebSocket.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2018, 2020 Wind River Systems, Inc. and others. All Rights Reserved.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v2.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  * https://www.eclipse.org/legal/epl-2.0/
10  * and the Eclipse Distribution License is available at
11  * http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  * Keith Holman - initial implementation and documentation
15  *******************************************************************************/
16 
17 #if !defined(WEBSOCKET_H)
18 #define WEBSOCKET_H
19 
20 #include "MQTTPacket.h"
21 
26 #define WebSocket_OP_CONTINUE 0x0 /* 0000 - continue frame */
27 #define WebSocket_OP_TEXT 0x1 /* 0001 - text frame */
28 #define WebSocket_OP_BINARY 0x2 /* 0010 - binary frame */
29 #define WebSocket_OP_CLOSE 0x8 /* 1000 - close frame */
30 #define WebSocket_OP_PING 0x9 /* 1001 - ping frame */
31 #define WebSocket_OP_PONG 0xA /* 1010 - pong frame */
32 
38 #define WebSocket_CLOSE_NORMAL 1000
39 #define WebSocket_CLOSE_GOING_AWAY 1001
40 #define WebSocket_CLOSE_PROTOCOL_ERROR 1002
41 #define WebSocket_CLOSE_UNKNOWN_DATA 1003
42 #define WebSocket_CLOSE_RESERVED 1004
43 #define WebSocket_CLOSE_NO_STATUS_CODE 1005 /* reserved: not to be used */
44 #define WebSocket_CLOSE_ABNORMAL 1006 /* reserved: not to be used */
45 #define WebSocket_CLOSE_BAD_DATA 1007
46 #define WebSocket_CLOSE_POLICY 1008
47 #define WebSocket_CLOSE_MSG_TOO_BIG 1009
48 #define WebSocket_CLOSE_NO_EXTENSION 1010
49 #define WebScoket_CLOSE_UNEXPECTED 1011
50 #define WebSocket_CLOSE_TLS_FAIL 1015 /* reserved: not be used */
51 
53 /* closes a websocket connection */
54 void WebSocket_close(networkHandles *net, int status_code, const char *reason);
55 
56 /* sends upgrade request */
57 int WebSocket_connect(networkHandles *net, const char *uri);
58 
59 /* obtain data from network socket */
60 int WebSocket_getch(networkHandles *net, char* c);
61 char *WebSocket_getdata(networkHandles *net, size_t bytes, size_t* actual_len);
62 size_t WebSocket_framePos();
63 void WebSocket_framePosSeekTo(size_t);
64 
65 /* send data out, in websocket format only if required */
66 int WebSocket_putdatas(networkHandles* net, char** buf0, size_t* buf0len, PacketBuffers* bufs);
67 
68 /* releases any resources used by the websocket system */
69 void WebSocket_terminate(void);
70 
71 /* handles websocket upgrade request */
73 
74 /* Notify the IP address and port of the endpoint to proxy, and wait connection to endpoint */
75 int WebSocket_proxy_connect( networkHandles *net, int ssl, const char *hostname);
76 
77 #endif /* WEBSOCKET_H */
char * WebSocket_getdata(networkHandles *net, size_t bytes, size_t *actual_len)
receives data from a socket. It should receive all data from the socket that is immediately available...
Definition: WebSocket.c:669
int WebSocket_putdatas(networkHandles *net, char **buf0, size_t *buf0len, PacketBuffers *bufs)
Definition: WebSocket.c:938
int WebSocket_upgrade(networkHandles *net)
Definition: WebSocket.c:1306
void WebSocket_framePosSeekTo(size_t)
Definition: WebSocket.c:647
void WebSocket_terminate(void)
Definition: WebSocket.c:1257
size_t WebSocket_framePos()
Definition: WebSocket.c:634
MQTTClient c
Definition: test10.c:1656
void WebSocket_close(networkHandles *net, int status_code, const char *reason)
Definition: WebSocket.c:521
int WebSocket_connect(networkHandles *net, const char *uri)
Definition: WebSocket.c:383
int WebSocket_getch(networkHandles *net, char *c)
receives 1 byte from a socket
Definition: WebSocket.c:589
int WebSocket_proxy_connect(networkHandles *net, int ssl, const char *hostname)
Definition: WebSocket.c:1445
Definition: format.h:3618
string hostname
Definition: test2.py:6


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:48