2019-03-24 01:03:31 +00:00
|
|
|
#ifndef WSFS_ADAPTER_IMPL_SESSION_H
|
|
|
|
#define WSFS_ADAPTER_IMPL_SESSION_H
|
2019-03-23 21:53:14 +00:00
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#else
|
|
|
|
#include <cstddef>
|
|
|
|
using std::size_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wsfs/message_queue.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct lws;
|
|
|
|
struct wsfs_message;
|
2019-03-24 03:00:06 +00:00
|
|
|
struct credentials;
|
2019-03-24 02:25:29 +00:00
|
|
|
struct authenticators;
|
|
|
|
struct jsonrpc_server;
|
2019-03-23 21:53:14 +00:00
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
struct session
|
2019-03-23 21:53:14 +00:00
|
|
|
{
|
|
|
|
struct lws * wsi;
|
|
|
|
bool is_authenticated;
|
|
|
|
struct wsfs_message_queue queue;
|
2019-03-24 02:25:29 +00:00
|
|
|
struct authenticators * authenticators;
|
|
|
|
struct jsonrpc_server * rpc;
|
2019-03-23 21:53:14 +00:00
|
|
|
};
|
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
extern void session_init(
|
|
|
|
struct session * session,
|
2019-03-23 21:53:14 +00:00
|
|
|
struct lws * wsi,
|
2019-03-24 02:25:29 +00:00
|
|
|
struct authenticators * authenticators,
|
|
|
|
struct jsonrpc_server * rpc);
|
2019-03-23 21:53:14 +00:00
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
extern void session_authenticate(
|
|
|
|
struct session * session,
|
2019-03-24 03:00:06 +00:00
|
|
|
struct credentials * creds);
|
2019-03-23 21:53:14 +00:00
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
extern bool session_send(
|
|
|
|
struct session * session,
|
2019-03-23 21:53:14 +00:00
|
|
|
struct wsfs_message * message);
|
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
extern void session_receive(
|
|
|
|
struct session * session,
|
2019-03-23 21:53:14 +00:00
|
|
|
char const * data,
|
|
|
|
size_t length);
|
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
extern void session_onwritable(
|
|
|
|
struct session * session);
|
2019-03-23 21:53:14 +00:00
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
extern void session_cleanup(
|
|
|
|
struct session * session);
|
2019-03-23 21:53:14 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|