[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] client HTTPS with evhttp



This is what the "callback" API would look like:

typedef struct bufferevent* (*bev_factory_cb)(void *arg);

/**
 * Create and return a connection object that can be used for making
 * HTTP requests.  The connection object tries to resolve address and
 * establish the connection when it is given an http request object.
 * The specified factory function is called with the user-supplied
 * argument to retrieve a new bufferevent whenever the underlying HTTP
 * connection needs to be reestablished.  This is what you want if, for
 * example, you have a bufferevent that needs to perform some setup for
 * new connections, such as an SSL bufferevent.
 *
 * @param base the event_base to use for handling the connection
 * @param dnsbase the dns_base to use for resolving host names; if not
 *     specified host name resolution will block.
 * @param cb a callback that returns a new bufferevent to use for
 *     connecting to the server; if NULL, behavior is the same as in
 *     calling evhttp_connection_base_bufferevent_new with a NULL
 *     bufferevent.  The returned bufferevents will be freed when the
 *     underlying TCP connection closes.  The returned bufferevents
 *     must have no fd set on them.
 * @param arg the argument to supply to the callback
 * @param address the address to which to connect
 * @param port the port to connect to
 * @return an evhttp_connection object that can be used for making
 *     requests
 */
struct evhttp_connection*
evhttp_connection_base_bufferevent_factory_new(
        struct event_base *base, struct evdns_base *dnsbase,
        bev_factory_cb cb, void * arg,
        const char *address, unsigned short port);
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.