cURL / Mailing Lists / curl-library / Single Mail


Re: CURL and CULM data structure

From: Miloš Ljumović <>
Date: Fri, 28 Oct 2016 17:58:25 +0200

I think what you're looking for is this:

/* This is the struct known as CURLM on the outside */
struct Curl_multi {
   /* First a simple identifier to easier detect if a user mix up
      this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */
   long type;

   /* We have a doubly-linked circular list with easy handles */
   struct Curl_easy *easyp;
   struct Curl_easy *easylp; /* last node */

   int num_easy; /* amount of entries in the linked list above. */
   int num_alive; /* amount of easy handles that are added but have not yet
                     reached COMPLETE state */

   struct curl_llist *msglist; /* a list of messages from completed transfers */

   struct curl_llist *pending; /* Curl_easys that are in the
                                  CURLM_STATE_CONNECT_PEND state */

   /* callback function and user data pointer for the *socket() API */
   curl_socket_callback socket_cb;
   void *socket_userp;

   /* callback function and user data pointer for server push */
   curl_push_callback push_cb;
   void *push_userp;

   /* Hostname cache */
   struct curl_hash hostcache;

   /* timetree points to the splay-tree of time nodes to figure out expire
      times of all currently set timers */
   struct Curl_tree *timetree;

   /* 'sockhash' is the lookup hash for socket descriptor => easy handles (note
      the pluralis form, there can be more than one easy handle waiting on the
      same actual socket) */
   struct curl_hash sockhash;

   /* pipelining wanted bits (CURLPIPE*) */
   long pipelining;

   bool recheckstate; /* see Curl_multi_connchanged */

   /* Shared connection cache (bundles)*/
   struct conncache conn_cache;

   /* This handle will be used for closing the cached connections in
      curl_multi_cleanup() */
   struct Curl_easy *closure_handle;

   long maxconnects; /* if >0, a fixed limit of the maximum number of entries
                        we're allowed to grow the connection cache to */

   long max_host_connections; /* if >0, a fixed limit of the maximum number
                                 of connections per host */

   long max_total_connections; /* if >0, a fixed limit of the maximum number
                                  of connections in total */

   long max_pipeline_length; /* if >0, maximum number of requests in a
                                pipeline */

   long content_length_penalty_size; /* a connection with a
                                        content-length bigger than
                                        this is not considered
                                        for pipelining */

   long chunk_length_penalty_size; /* a connection with a chunk length
                                      bigger than this is not
                                      considered for pipelining */

   struct curl_llist *pipelining_site_bl; /* List of sites that are blacklisted
                                             from pipelining */

   struct curl_llist *pipelining_server_bl; /* List of server types that are
                                               blacklisted from pipelining */

   /* timer callback and user data pointer for the *socket() API */
   curl_multi_timer_callback timer_cb;
   void *timer_userp;
   struct timeval timer_lastcall; /* the fixed time for the timeout for the
                                     previous callback */

You can find it in multihandle.h
I'm using it in my C++ project like this:

#define HAVE_BOOL_T

#ifndef __CURL_INCLUDED__

#define __CURL_INCLUDED__

#include <curl/curl.h>

#include <hash.h>

#include <multihandle.h>


Miloš Ljumović
Operating systems specialist Spec.App.
List admin:
Received on 2016-10-28