libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
Loading...
Searching...
No Matches
lws-region.h
Go to the documentation of this file.
1
/*
2
* libwebsockets - small server side websockets and web server implementation
3
*
4
* Copyright (C) 2010 - 2026 Andy Green <andy@warmcat.com>
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to
8
* deal in the Software without restriction, including without limitation the
9
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
* sell copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
* DEALINGS IN THE SOFTWARE.
23
*/
24
53
55
typedef
struct
lws_region_claim
{
56
const
uint8_t
*
s
;
/* NULL: slot free */
57
const
uint8_t
*
e
;
58
const
char
*
who
;
59
uint16_t
gen
;
/* distinguishes reuses of the slot */
60
}
lws_region_claim_t
;
61
63
typedef
struct
lws_region
{
64
const
char
*
name
;
65
const
uint8_t
*
base
;
66
size_t
len
;
67
lws_region_claim_t
*
claims
;
68
uint8_t
count_claims
;
69
uint8_t
flags
;
70
}
lws_region_t
;
71
72
/* lws_region_init() flags */
73
#define LWS_REGION_F_ABORT (1 << 0)
/* abort() on violation */
74
75
/* lws_region_claim() results other than a handle */
76
enum
{
77
LWS_REGION_NOT_TRACKED
= -1,
/* p is not in the buffer */
78
LWS_REGION_E_OVERRUN
= -2,
/* runs past the end */
79
LWS_REGION_E_OVERLAP
= -3,
/* overlaps a live claim */
80
LWS_REGION_E_FULL
= -4,
/* no free claim slot */
81
};
82
96
LWS_VISIBLE
LWS_EXTERN
int
97
lws_region_init
(
lws_region_t
*r,
const
char
*name,
const
void
*base,
98
size_t
len,
lws_region_claim_t
*claims,
size_t
count_claims,
99
unsigned
int
flags);
100
114
LWS_VISIBLE
LWS_EXTERN
int
115
lws_region_claim
(
lws_region_t
*r,
const
void
*p,
size_t
len,
const
char
*who);
116
127
LWS_VISIBLE
LWS_EXTERN
void
128
lws_region_release
(
lws_region_t
*r,
int
handle);
129
139
LWS_VISIBLE
LWS_EXTERN
void
140
lws_region_release_containing
(
lws_region_t
*r,
const
void
*p);
141
151
LWS_VISIBLE
LWS_EXTERN
void
152
lws_region_trim
(
lws_region_t
*r,
const
void
*p);
153
163
LWS_VISIBLE
LWS_EXTERN
int
164
lws_region_idle
(
const
lws_region_t
*r,
const
char
*where);
165
lws_region::count_claims
uint8_t count_claims
Definition
lws-region.h:68
lws_region::claims
lws_region_claim_t * claims
Definition
lws-region.h:67
lws_region::base
const uint8_t * base
Definition
lws-region.h:65
lws_region_claim::e
const uint8_t * e
Definition
lws-region.h:57
lws_region_claim::who
const char * who
Definition
lws-region.h:58
lws_region::name
const char * name
Definition
lws-region.h:64
lws_region::flags
uint8_t flags
Definition
lws-region.h:69
lws_region::len
size_t len
Definition
lws-region.h:66
lws_region_claim::s
const uint8_t * s
Definition
lws-region.h:56
lws_region_claim::gen
uint16_t gen
Definition
lws-region.h:59
lws_region_release_containing
LWS_VISIBLE LWS_EXTERN void lws_region_release_containing(lws_region_t *r, const void *p)
lws_region_t
struct lws_region lws_region_t
lws_region_trim
LWS_VISIBLE LWS_EXTERN void lws_region_trim(lws_region_t *r, const void *p)
lws_region_release
LWS_VISIBLE LWS_EXTERN void lws_region_release(lws_region_t *r, int handle)
lws_region_idle
LWS_VISIBLE LWS_EXTERN int lws_region_idle(const lws_region_t *r, const char *where)
lws_region_claim
LWS_VISIBLE LWS_EXTERN int lws_region_claim(lws_region_t *r, const void *p, size_t len, const char *who)
lws_region_init
LWS_VISIBLE LWS_EXTERN int lws_region_init(lws_region_t *r, const char *name, const void *base, size_t len, lws_region_claim_t *claims, size_t count_claims, unsigned int flags)
lws_region_claim_t
struct lws_region_claim lws_region_claim_t
LWS_REGION_E_OVERLAP
@ LWS_REGION_E_OVERLAP
Definition
lws-region.h:79
LWS_REGION_E_OVERRUN
@ LWS_REGION_E_OVERRUN
Definition
lws-region.h:78
LWS_REGION_E_FULL
@ LWS_REGION_E_FULL
Definition
lws-region.h:80
LWS_REGION_NOT_TRACKED
@ LWS_REGION_NOT_TRACKED
Definition
lws-region.h:77
lws_region
Definition
lws-region.h:63
lws_region_claim
Definition
lws-region.h:55
uint16_t
unsigned short uint16_t
Definition
libwebsockets.h:745
LWS_EXTERN
#define LWS_EXTERN
Definition
libwebsockets.h:327
uint8_t
unsigned char uint8_t
Definition
libwebsockets.h:746
LWS_VISIBLE
#define LWS_VISIBLE
Definition
libwebsockets.h:322
include
libwebsockets
lws-region.h
Generated on
for libwebsockets by
1.18.0