mco_lews_handle_func_h

Prototype

    typedef void (*mco_lews_handle_func_h)(lews_connection_context_h context_handle);

Description

This function is invoked after the incoming connection is established, the HTTP request is obtained and parsed. context_handle contains a pointer to the incoming connection context.

    void handler(lews_connection_context_h p_ctx) {
    MCO_RET ret;
    ...
    if (IS_METHOD(p_ctx, "GET")) {
        if (IS_URL(p_ctx, "/test")) {
            ...
        }
    }
    }
    ...
    int main( int argc, char ** argv ) {
        char *interface = "0.0.0.0";
        int port = 8083;
        mco_sock_params_t sock_param;
        ...
        if ((ret = mco_lews_initialize(interface, port, &sock_param, handler)) != MCO_S_OK) {
            printf("mco_lews_initialize error %d", ret);
            return 1;
        }
        ...

Files

Header file:
mcoewslite.h
Source file:
mcoewslite.c
Library:
mcoewslite.a