Prusa MINI Firmware overview
|
u16_t len
Definition: pbuf.h:159
const char * response
Definition: lwsapi_app.hpp:212
State state
Definition: connection.hpp:30
Message_t message
Definition: connection.hpp:32
err_t lwsapi_init(void)
Init (start) the LwIP WSAPI server.
Definition: lwsapi.cpp:413
static err_t lwsapi_accept(void *arg, struct tcp_pcb *pcb, err_t err)
tcp_accept callback defined in LwIP
Definition: lwsapi.cpp:387
#define LIGHT_WSAPI_RETRIES
Definition: lwsapi.cpp:11
uint16_t u16_t
Definition: arch.h:121
static const char * http_bad_request
Full Bad Request response.
Definition: lwsapi.cpp:15
u16_t tot_len
Definition: pbuf.h:156
#define IP_ANY_TYPE
Definition: ip_addr.h:400
#define TCP_SND_QUEUELEN
Definition: opt.h:1212
IHeader * number_header_factory(const char *key, const char *value, size_t value_length)
Response new NumberHeader.
Definition: lwsapi.cpp:445
uint8_t data[8]
Definition: masstorage.h:49
err_t fill_request_buffer(const struct pbuf *p)
Append pbuf to request_buffer.
Definition: connection.cpp:17
err_t lwsapi_init(void)
Init (start) the LwIP WSAPI server.
Definition: lwsapi.cpp:413
struct pbuf * next
Definition: pbuf.h:144
u8_t pbuf_free(struct pbuf *p)
Definition: pbuf.c:715
#define LIGHT_WSAPI_PORT
Definition: lwsapi.cpp:10
#define lwsapi_error
Definition: lwsapi_app.hpp:42
static err_t close_conn(struct tcp_pcb *pcb, Context *ctx=nullptr)
Close connection and clean callbacks and other connection environment.
Definition: lwsapi.cpp:51
IResponse::unique_ptr_t application(Environment &env)
application_fn callback, which is called from LwIP WSAPI http server
Definition: connect.cpp:306
err_t prepare_response()
Process message.response to internal buffer.
Definition: connection.cpp:152
Internal connection structure which is used in LwIP tcp_ callbacks as arg.
Definition: connection.hpp:20
err_t prepare_header()
Process message.headers to internal buffer.
Definition: connection.cpp:171
Definition: connect.cpp:77
static void lwsapi_call(Context *ctx, const struct pbuf *input=nullptr)
Process message from IResponse::generator, and call generator for next work.
Definition: lwsapi.cpp:107
IHeader * dynamics_header_factory(const char *key, const char *value, size_t value_length)
Return new DynamicsHeader.
Definition: lwsapi.cpp:440
uint8_t retries
Definition: connection.hpp:29
size_t find_eoh(const void *data=nullptr, size_t length=0)
Try to find End Of Header (\r \r ) in buffer.
Definition: connection.cpp:39
static err_t lwsapi_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
tcp_sent callback defined in LwIP
Definition: lwsapi.cpp:368
#define lwsapi_dbg
Definition: lwsapi_app.hpp:41
#define LIGHT_WSAPI_POLL_INTERVAL
Definition: lwsapi.cpp:12
int length
Definition: lwsapi_app.hpp:215
struct tcp_pcb * pcb
Definition: connection.hpp:28
IResponse::unique_ptr_t response
Definition: connection.hpp:37
void free_buffer()
Definition: connection.hpp:94
const uint8_t[]
Definition: 404_html.c:3
static err_t lwsapi_poll(void *arg, struct tcp_pcb *pcb)
The poll function is called every 2nd second.
Definition: lwsapi.cpp:83
Message which must be returned from coroutine generator.
Definition: lwsapi_app.hpp:211
s8_t err_t
Definition: err.h:57
const uint8_t * payload
Definition: lwsapi_app.hpp:214
static err_t lwsapi_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
Process http request and call application.
Definition: lwsapi.cpp:249
static const char * http_internal_server
Full Internal Server Error response.
Definition: lwsapi.cpp:22
static void lwsapi_err(void *arg, err_t err)
tcp_err callback defined in LwIP
Definition: lwsapi.cpp:344
size_t m_position
Definition: connection.hpp:34
Environment env
Definition: connection.hpp:31
void * mem_malloc(mem_size_t size)
Definition: mem.c:603
static bool empty_message(const Message_t &msg)
Check when message is empty - all data was processed yet.
Definition: lwsapi.cpp:39
void add_header(IHeader *header)
Definition: lwsapi.cpp:28
#define EOF
Definition: ff.h:286
void mem_free(void *rmem)
Definition: mem.c:419
static size_t lwsapi_write(Context *ctx, const uint8_t *data, size_t len)
Write data to TCP output buffer.
Definition: lwsapi.cpp:182
err_t parse_request(const void *data=nullptr, size_t length=0)
parste the request header (request line + request headers)
Definition: connection.cpp:110
#define memshift(ptr, size)
Definition: connection.hpp:10
void * payload
Definition: pbuf.h:147
const IHeader * headers
Definition: lwsapi_app.hpp:213
static png_bytep size_t size
Definition: pngwrite.c:2170
char * buffer
Definition: connection.hpp:33