libwebsockets
Lightweight C library for HTML5 websockets
|
Go to the source code of this file.
Data Structures | |
struct | lhp_atr |
struct | lhp_table_row_t |
struct | lhp_table_col_t |
struct | lhp_pstack |
struct | lcsp_atr |
struct | lcsp_defs |
struct | lcsp_names |
struct | lcsp_stanza |
struct | lcsp_stanza_ptr |
struct | lcsp_atr_ptr |
struct | lhp_ctx |
union | lcsp_atr.u |
union | lhp_ctx.u |
struct | lhp_ctx.u.f |
Macros | |
#define | LHP_MAX_ELEMS_NEST 32 |
#define | LHP_MAX_DEPTH 12 |
#define | LHP_STRING_CHUNK 254 |
#define | CCPAS_TOP 0 |
#define | CCPAS_RIGHT 1 |
#define | CCPAS_BOTTOM 2 |
#define | CCPAS_LEFT 3 |
#define | LHP_FLAG_DOCUMENT_END (1 << 0) |
#define | LHP_CSS_PROPVAL_INT_WHOLE 1 |
#define | LHP_CSS_PROPVAL_INT_FRAC 2 |
#define | LHP_CSS_PROPVAL_INT_UNIT 3 |
#define | LWS_LHPREF_WIDTH 0 |
#define | LWS_LHPREF_HEIGHT 1 |
#define | LWS_LHPREF_NONE 2 |
Typedefs | |
typedef enum lcsp_props | lcsp_props_t |
typedef lws_stateful_ret_t(* | lhp_callback) (struct lhp_ctx *ctx, char reason) |
typedef struct lhp_atr | lhp_atr_t |
typedef struct lhp_pstack | lhp_pstack_t |
typedef enum lcsp_css_units | lcsp_css_units_t |
typedef struct lcsp_atr | lcsp_atr_t |
typedef struct lcsp_defs | lcsp_defs_t |
typedef struct lcsp_names | lcsp_names_t |
typedef struct lcsp_stanza | lcsp_stanza_t |
typedef struct lcsp_stanza_ptr | lcsp_stanza_ptr_t |
typedef struct lcsp_atr_ptr | lcsp_atr_ptr_t |
typedef struct lhp_ctx | lhp_ctx_t |
struct lhp_atr |
Definition at line 330 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
size_t | name_len | |
size_t | value_len |
struct lhp_table_row_t |
Definition at line 344 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
lws_dll2_owner_t | row_dlos | |
lws_fx_t | height |
struct lhp_table_col_t |
Definition at line 352 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
lws_dll2_owner_t | col_dlos | |
lws_fx_t | width |
struct lhp_pstack |
Definition at line 367 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
void * | user | |
lhp_callback | cb | |
lws_box_t | drt | |
lws_fx_t | curx | |
lws_fx_t | cury | |
lws_fx_t | widest | |
lws_fx_t | deepest | |
lws_dlo_t * | dlo_set_curx | |
lws_dlo_t * | dlo_set_cury | |
lws_dll2_owner_t | atr | |
const lws_display_font_t * | f | |
const struct lcsp_atr * | css_background_color | |
const struct lcsp_atr * | css_color | |
const struct lcsp_atr * | css_position | |
const struct lcsp_atr * | css_display | |
const struct lcsp_atr * | css_width | |
const struct lcsp_atr * | css_height | |
const struct lcsp_atr * | css_border_radius[4] | |
const struct lcsp_atr * | css_pos[4] | |
const struct lcsp_atr * | css_margin[4] | |
const struct lcsp_atr * | css_padding[4] | |
uint16_t | tr_idx | |
uint16_t | td_idx | |
uint8_t | is_block:1 | |
uint8_t | is_table:1 | |
lws_dlo_t * | dlo | |
const lws_display_font_t * | font | |
int | oi[4] | |
int | positioned[4] | |
int | rel_layout_cursor[4] | |
uint8_t | runon |
struct lcsp_atr |
Definition at line 447 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
int | propval | |
size_t | value_len | |
lcsp_css_units_t | unit | |
union lcsp_atr | u | |
lws_fx_t | r | |
uint8_t | op |
struct lcsp_defs |
Definition at line 468 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
lws_dll2_owner_t | atrs | |
lcsp_props_t | prop |
struct lcsp_names |
Definition at line 474 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
size_t | name_len |
struct lcsp_stanza |
Definition at line 481 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
lws_dll2_owner_t | names | |
lws_dll2_owner_t | defs |
struct lcsp_stanza_ptr |
Definition at line 498 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
lcsp_stanza_t * | stz |
struct lcsp_atr_ptr |
Definition at line 504 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_t | list | |
lcsp_atr_t * | atr |
struct lhp_ctx |
Definition at line 512 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_dll2_owner_t | stack | |
struct lwsac * | cssac | |
struct lwsac * | cascadeac | |
struct lwsac * | propatrac | |
lws_dll2_owner_t | css | |
lws_dll2_owner_t * | ids | |
lws_fx_t | tf | |
lcsp_css_units_t | unit | |
lcsp_stanza_t * | stz | |
lcsp_defs_t * | def | |
lws_dll2_owner_t | active_stanzas | |
lws_dll2_owner_t | active_atr | |
lws_surface_info_t | ic | |
const char * | base_url | |
sul_cb_t | ssevcb | |
lws_sorted_usec_list_t * | ssevsul | |
sul_cb_t | sshtmlevcb | |
lws_sorted_usec_list_t * | sshtmlevsul | |
void * | user | |
void * | user1 | |
const char * | tag | |
size_t | tag_len | |
int | npos | |
int | state | |
int | state_css_comm | |
int | nl_temp | |
int | temp_count | |
uint32_t | flags | |
uint32_t | temp | |
int32_t | window | |
union lhp_ctx | u | |
int | prop | |
int | propval | |
int16_t | css_state | |
int16_t | cssval_state | |
uint8_t | in_body:1 | |
uint8_t | finish_css:1 | |
uint8_t | is_css:1 | |
uint8_t | await_css_done:1 | |
char | buf[LHP_STRING_CHUNK+1] |
union lcsp_atr.u |
Definition at line 455 of file lws-html.h.
Data Fields | ||
---|---|---|
lws_fx_t | i | |
uint32_t | rgba |
union lhp_ctx.u |
Definition at line 555 of file lws-html.h.
Data Fields | ||
---|---|---|
uint32_t | s | |
u | f |
struct lhp_ctx.u.f |
#define LHP_MAX_ELEMS_NEST 32 |
Definition at line 29 of file lws-html.h.
#define LHP_MAX_DEPTH 12 |
Definition at line 32 of file lws-html.h.
#define LHP_STRING_CHUNK 254 |
Definition at line 35 of file lws-html.h.
#define CCPAS_TOP 0 |
Definition at line 362 of file lws-html.h.
#define CCPAS_RIGHT 1 |
Definition at line 363 of file lws-html.h.
#define CCPAS_BOTTOM 2 |
Definition at line 364 of file lws-html.h.
#define CCPAS_LEFT 3 |
Definition at line 365 of file lws-html.h.
#define LHP_FLAG_DOCUMENT_END (1 << 0) |
Definition at line 510 of file lws-html.h.
#define LHP_CSS_PROPVAL_INT_WHOLE 1 |
Definition at line 566 of file lws-html.h.
#define LHP_CSS_PROPVAL_INT_FRAC 2 |
Definition at line 567 of file lws-html.h.
#define LHP_CSS_PROPVAL_INT_UNIT 3 |
Definition at line 568 of file lws-html.h.
#define LWS_LHPREF_WIDTH 0 |
Definition at line 712 of file lws-html.h.
#define LWS_LHPREF_HEIGHT 1 |
Definition at line 713 of file lws-html.h.
#define LWS_LHPREF_NONE 2 |
Definition at line 714 of file lws-html.h.
typedef enum lcsp_props lcsp_props_t |
typedef lws_stateful_ret_t(* lhp_callback) (struct lhp_ctx *ctx, char reason) |
Definition at line 326 of file lws-html.h.
typedef struct lhp_pstack lhp_pstack_t |
typedef enum lcsp_css_units lcsp_css_units_t |
typedef struct lcsp_atr lcsp_atr_t |
typedef struct lcsp_defs lcsp_defs_t |
typedef struct lcsp_names lcsp_names_t |
typedef struct lcsp_stanza lcsp_stanza_t |
typedef struct lcsp_stanza_ptr lcsp_stanza_ptr_t |
typedef struct lcsp_atr_ptr lcsp_atr_ptr_t |
enum lhp_callbacks |
Definition at line 38 of file lws-html.h.
enum lcsp_props |
Definition at line 66 of file lws-html.h.
enum lcsp_propvals_t |
Definition at line 195 of file lws-html.h.
enum lcsp_css_units |
Definition at line 419 of file lws-html.h.
LWS_VISIBLE LWS_EXTERN int lws_lhp_construct | ( | lhp_ctx_t * | ctx, |
lhp_callback | cb, | ||
void * | user, | ||
const lws_surface_info_t * | ic | ||
) |
LWS_VISIBLE LWS_EXTERN void lws_lhp_destruct | ( | lhp_ctx_t * | ctx | ) |
LWS_VISIBLE LWS_EXTERN int lws_lhp_ss_browse | ( | struct lws_context * | cx, |
lws_display_render_state_t * | rs, | ||
const char * | url, | ||
sul_cb_t | render | ||
) |
lws_lhp_ss_browse() - browse url using SS and parse via lhp to DLOs
cx | the lws_context |
rs | the user's render state object |
url | the https://x.com/y.xyz URL to browse |
render | the user's linewise render callback (called from rs.sul ) |
High level network fetch via SS and render html via lhp / DLO
rs->ic must be prepared before calling.
Returns nonzero if an early, fatal problem, else returns 0 and continues asynchronously.
If rs->box is (0,0,0,0) on entry, it is set to represent the whole display surface. Otherwise if not representing the whole display surface, it indicates partial mode should be used.
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_lhp_parse | ( | lhp_ctx_t * | ctx, |
const uint8_t ** | buf, | ||
size_t * | len | ||
) |
lws_lhp_parse() - parses a chunk of input HTML
ctx:
the parsing context buf:
pointer to the start of the chunk of html len:
pointer the number of bytes of html available at *\pbuf
Parses up to *len bytes at *buf. On exit, *buf and *len are adjusted according to how much data was used. May return before processing all the input.
Returns LWS_SRET_WANT_INPUT if the parsing is stalled on some other async event (eg, fetch of image to find out the dimensions).
The lws_lhp_ss_browse() api wraps this.
LWS_VISIBLE LWS_EXTERN const lcsp_atr_t* lws_css_cascade_get_prop_atr | ( | lhp_ctx_t * | ctx, |
lcsp_props_t | prop | ||
) |
lws_css_cascade_get_prop_atr() - create active css atr list for property
ctx:
the parsing context prop:
the LCSP_PROP_ property to generate the attribute list for
Returns NULL if no atr or OOM.
Otherwise produces a list of active CSS property attributes walkable via ctx->active_atr, and returns the tail one. For simple attributes where the last definition is the active one, this points to the last definition.
LWS_VISIBLE LWS_EXTERN int lws_http_rel_to_url | ( | char * | dest, |
size_t | len, | ||
const char * | base, | ||
const char * | rel | ||
) |
lws_http_rel_to_url() - make absolute url from base and relative
dest | place to store the result |
len | max length of result including NUL |
base | a reference url including a file part |
rel | the absolute or relative url or path to apply to base |
Copy the url formof rel into dest, using base to fill in missing context
If base is https://x.com/y/z.html
a.html -> https://x.com/y/a/html ../b.html -> https://x.com/b.html /c.html -> https://x.com/c.html https://y.com/a.html -> https://y.com/a.html
LWS_VISIBLE LWS_EXTERN lhp_pstack_t* lws_css_get_parent_block | ( | lhp_ctx_t * | ctx, |
lhp_pstack_t * | ps | ||
) |
LWS_VISIBLE LWS_EXTERN const char* lws_css_pstack_name | ( | lhp_pstack_t * | ps | ) |
LWS_VISIBLE LWS_EXTERN const char* lws_html_get_atr | ( | lhp_pstack_t * | ps, |
const char * | aname, | ||
size_t | aname_len | ||
) |
LWS_VISIBLE LWS_EXTERN const lws_fx_t* lws_csp_px | ( | const lcsp_atr_t * | a, |
lhp_pstack_t * | ps | ||
) |
LWS_VISIBLE LWS_EXTERN void lws_lhp_tag_dlo_id | ( | lhp_ctx_t * | ctx, |
lhp_pstack_t * | ps, | ||
lws_dlo_t * | dlo | ||
) |
void lhp_set_dlo_padding_margin | ( | lhp_pstack_t * | ps, |
lws_dlo_t * | dlo | ||
) |
LWS_VISIBLE LWS_EXTERN int lhp_prop_axis | ( | const lcsp_atr_t * | a | ) |