Skip to content

Commit c0856d0

Browse files
committed
buflist: lws_buflist_get_frag_start_or_NULL
1 parent de85794 commit c0856d0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/libwebsockets/lws-misc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ lws_buflist_destroy_all_segments(struct lws_buflist **head);
178178
LWS_VISIBLE LWS_EXTERN void
179179
lws_buflist_describe(struct lws_buflist **head, void *id, const char *reason);
180180

181+
LWS_VISIBLE LWS_EXTERN void *
182+
lws_buflist_get_frag_start_or_NULL(struct lws_buflist **head);
183+
184+
181185

182186
/*
183187
* Optional helpers for closely-managed stream flow control. These are useful

lib/core/buflist.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,17 @@ lws_buflist_describe(struct lws_buflist **head, void *id, const char *reason)
276276
}
277277
#endif
278278

279+
LWS_VISIBLE LWS_EXTERN void *
280+
lws_buflist_get_frag_start_or_NULL(struct lws_buflist **head)
281+
{
282+
struct lws_buflist *b = (*head);
283+
284+
if (!b)
285+
return NULL; /* there is no segment to work on */
286+
287+
return ((uint8_t *)b) + sizeof(*b) + LWS_PRE;
288+
}
289+
279290
lws_stateful_ret_t
280291
lws_flow_feed(lws_flow_t *flow)
281292
{

0 commit comments

Comments
 (0)