Embedded TCP/IP stack: fnet_http_cgi_send_t

FNET

typedef fnet_size_t(* fnet_http_cgi_send_t) (fnet_uint8_t *buffer, fnet_size_t buffer_size, fnet_bool_t *eof, fnet_uint32_t *cookie)

Callback function prototype of the CGI response function.

Parameters
bufferOutput buffer where CGI response content will be copied to.
buffer_sizeSize of the output buffer.
It's defined by the FNET_CFG_HTTP_REQUEST_SIZE_MAX parameter.
eofCondition flag:
  • FNET_FALSE = there is still more data to send. The fnet_http_cgi_send_t function will be called during the next iteration again.
  • FNET_FALSE = no more data is available for the CGI response. It was the last call of the fnet_http_cgi_send_t function for the current CGI response.
cookieThis parameter points to the value, initially set to zero, which can be used to associate a custom information with a connection instance. If application store context information in the cookie, it will be preserved for future calls for this request. This allows the application to associate some request-specific state.
Returns
This function returns the number of bytes actually written to the buffer pointed to by buffer.
The condition flag eof indicates if the CGI data-end condition has occurred.
See also
fnet_http_cgi, fnet_http_cgi_handle_t

This function creates the CGI response content.
An application should use the buffer as output buffer for the dynamic content and set eof flag to 1 if no data for output are available.
The CGI handler invokes this callback function after successful call of the fnet_http_cgi_handle_t function and continues to call this function repeatedly till the eof will be set to 1 or the return result is set to 0.

Definition at line 111 of file fnet_http_cgi.h.


© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net