|
Packit Service |
ca3877 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
|
Packit Service |
ca3877 |
/*
|
|
Packit Service |
ca3877 |
* soup-websocket.h: This file was originally part of Cockpit.
|
|
Packit Service |
ca3877 |
*
|
|
Packit Service |
ca3877 |
* Copyright 2013, 2014 Red Hat, Inc.
|
|
Packit Service |
ca3877 |
*
|
|
Packit Service |
ca3877 |
* Cockpit is free software; you can redistribute it and/or modify it
|
|
Packit Service |
ca3877 |
* under the terms of the GNU Lesser General Public License as published by
|
|
Packit Service |
ca3877 |
* the Free Software Foundation; either version 2.1 of the License, or
|
|
Packit Service |
ca3877 |
* (at your option) any later version.
|
|
Packit Service |
ca3877 |
*
|
|
Packit Service |
ca3877 |
* Cockpit is distributed in the hope that it will be useful, but
|
|
Packit Service |
ca3877 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
ca3877 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
ca3877 |
* Lesser General Public License for more details.
|
|
Packit Service |
ca3877 |
*
|
|
Packit Service |
ca3877 |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
ca3877 |
* along with this library; If not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
ca3877 |
*/
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
#ifndef __SOUP_WEBSOCKET_H__
|
|
Packit Service |
ca3877 |
#define __SOUP_WEBSOCKET_H__
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
#include <libsoup/soup-types.h>
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
G_BEGIN_DECLS
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
#define SOUP_WEBSOCKET_ERROR (soup_websocket_error_get_quark ())
|
|
Packit Service |
ca3877 |
SOUP_AVAILABLE_IN_2_50
|
|
Packit Service |
ca3877 |
GQuark soup_websocket_error_get_quark (void) G_GNUC_CONST;
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
typedef enum {
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_ERROR_FAILED,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_ERROR_BAD_ORIGIN,
|
|
Packit Service |
ca3877 |
} SoupWebsocketError;
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
typedef enum {
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CONNECTION_UNKNOWN,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CONNECTION_CLIENT,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CONNECTION_SERVER
|
|
Packit Service |
ca3877 |
} SoupWebsocketConnectionType;
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
typedef enum {
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_DATA_TEXT = 0x01,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_DATA_BINARY = 0x02,
|
|
Packit Service |
ca3877 |
} SoupWebsocketDataType;
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
typedef enum {
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_NORMAL = 1000,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_GOING_AWAY = 1001,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR = 1002,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_UNSUPPORTED_DATA = 1003,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_NO_STATUS = 1005,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_ABNORMAL = 1006,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_BAD_DATA = 1007,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_POLICY_VIOLATION = 1008,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_TOO_BIG = 1009,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_NO_EXTENSION = 1010,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_SERVER_ERROR = 1011,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_CLOSE_TLS_HANDSHAKE = 1015,
|
|
Packit Service |
ca3877 |
} SoupWebsocketCloseCode;
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
typedef enum {
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_STATE_OPEN = 1,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_STATE_CLOSING = 2,
|
|
Packit Service |
ca3877 |
SOUP_WEBSOCKET_STATE_CLOSED = 3,
|
|
Packit Service |
ca3877 |
} SoupWebsocketState;
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
SOUP_AVAILABLE_IN_2_50
|
|
Packit Service |
ca3877 |
void soup_websocket_client_prepare_handshake (SoupMessage *msg,
|
|
Packit Service |
ca3877 |
const char *origin,
|
|
Packit Service |
ca3877 |
char **protocols);
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
SOUP_AVAILABLE_IN_2_50
|
|
Packit Service |
ca3877 |
gboolean soup_websocket_client_verify_handshake (SoupMessage *msg,
|
|
Packit Service |
ca3877 |
GError **error);
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
SOUP_AVAILABLE_IN_2_50
|
|
Packit Service |
ca3877 |
gboolean soup_websocket_server_check_handshake (SoupMessage *msg,
|
|
Packit Service |
ca3877 |
const char *origin,
|
|
Packit Service |
ca3877 |
char **protocols,
|
|
Packit Service |
ca3877 |
GError **error);
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
SOUP_AVAILABLE_IN_2_50
|
|
Packit Service |
ca3877 |
gboolean soup_websocket_server_process_handshake (SoupMessage *msg,
|
|
Packit Service |
ca3877 |
const char *expected_origin,
|
|
Packit Service |
ca3877 |
char **protocols);
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
G_END_DECLS
|
|
Packit Service |
ca3877 |
|
|
Packit Service |
ca3877 |
#endif /* __SOUP_WEBSOCKET_H__ */
|