libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
class="ui-resizable-handle">
Loading...
Searching...
No Matches
lws-interceptor.h
Go to the documentation of this file.
1
#include <stddef.h>
2
#if defined(LWS_WITH_JOSE)
3
/*
4
* libwebsockets - small server side websockets and web server implementation
5
*
6
* Copyright (C) 2010 - 2025 Andy Green <andy@warmcat.com>
7
*
8
* Permission is hereby granted, free of charge, to any person obtaining a copy
9
* of this software and associated documentation files (the "Software"), to
10
* deal in the Software without restriction, including without limitation the
11
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12
* sell copies of the Software, and to permit persons to whom the Software is
13
* furnished to do so, subject to the following conditions:
14
*
15
* The above copyright notice and this permission notice shall be included in
16
* all copies or substantial portions of the Software.
17
*
18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
* IN THE SOFTWARE.
25
*/
26
36
37
typedef
enum
{
38
LWS_INTERCEPTOR_RET_REJECT = 0,
/* Failed the challenge */
39
LWS_INTERCEPTOR_RET_PASS = 1,
/* Passed immediately */
40
LWS_INTERCEPTOR_RET_DELAYED = 2,
/* Use a timer before passing (for ratelimiting) */
41
} lws_interceptor_result_t;
42
43
struct
lws_interceptor_ops {
44
const
char
*name;
/* e.g., "ratelimit" or "puzzle" */
45
50
int (*get_config_js)(
struct
lws *wsi,
char
*buf,
size_t
len);
51
56
int (*init_visit_cookie)(
struct
lws *wsi,
char
*buf,
size_t
len);
57
62
lws_interceptor_result_t (*verify)(
struct
lws *wsi,
const
void
*data,
size_t
len);
63
68
void (*on_delay_expired)(
struct
lws *wsi);
69
};
70
79
LWS_VISIBLE
LWS_EXTERN
int
80
lws_interceptor_check(
struct
lws *wsi,
const
struct
lws_protocols
*prot);
81
92
LWS_VISIBLE
LWS_EXTERN
int
93
lws_interceptor_handle_http(
struct
lws *wsi,
void
*user,
const
struct
lws_interceptor_ops *ops);
94
98
LWS_VISIBLE
LWS_EXTERN
int
99
lws_callback_interceptor(
struct
lws *wsi,
enum
lws_callback_reasons
reason,
100
void
*user,
void
*in,
size_t
len,
101
const
struct
lws_interceptor_ops *ops);
102
104
105
#endif
lws_protocols
Definition
lws-protocols-plugins.h:44
lws_callback_reasons
lws_callback_reasons
Definition
lws-callbacks.h:100
LWS_EXTERN
#define LWS_EXTERN
Definition
libwebsockets.h:296
LWS_VISIBLE
#define LWS_VISIBLE
Definition
libwebsockets.h:291
include
libwebsockets
lws-interceptor.h
Generated on
for libwebsockets by
1.18.0