
#include <stdio.h>

#include "http_request_list_entry.h"

struct s_HttpRequestListEntry
{
    HttpRequestHandlerDelegate delegate;
    HttpRequest *request;
    void *context;
};

HttpRequestListEntry *
http_request_list_entry_new (HttpRequestHandlerDelegate delegate,
        HttpRequest *request, void *context)
{
    HttpRequestListEntry *instance = (HttpRequestListEntry *) malloc (sizeof (HttpRequestListEntry));

    instance->delegate = delegate;
    instance->request = request;
    instance->context = context;

    return (instance);
}

void
http_request_list_entry_destroy (void *ptr)
{
    HttpRequestListEntry *instance = (HttpRequestListEntry *) ptr;

    /* free other fields */

    free (instance);
}

void
http_request_list_entry_invokeEntry (void *ptr)
{
    HttpRequestListEntry *instance = (HttpRequestListEntry *) ptr;

    instance->delegate (instance->request, instance->context);

    http_request_list_entry_destroy (instance);
}
