build-mac/curl/multi.h
author Krista Bennett <krista@pep-project.org>
Mon, 16 Apr 2018 12:45:27 +0200
branchENGINE-420
changeset 2605 e58854fccf2c
parent 531 a7cc26cc39f2
permissions -rw-r--r--
Closing branch
Edouard@340
     1
#ifndef __CURL_MULTI_H
Edouard@340
     2
#define __CURL_MULTI_H
Edouard@340
     3
/***************************************************************************
Edouard@340
     4
 *                                  _   _ ____  _
Edouard@340
     5
 *  Project                     ___| | | |  _ \| |
Edouard@340
     6
 *                             / __| | | | |_) | |
Edouard@340
     7
 *                            | (__| |_| |  _ <| |___
Edouard@340
     8
 *                             \___|\___/|_| \_\_____|
Edouard@340
     9
 *
Edouard@340
    10
 * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
Edouard@340
    11
 *
Edouard@340
    12
 * This software is licensed as described in the file COPYING, which
Edouard@340
    13
 * you should have received as part of this distribution. The terms
dirk@531
    14
 * are also available at https://curl.haxx.se/docs/copyright.html.
Edouard@340
    15
 *
Edouard@340
    16
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
Edouard@340
    17
 * copies of the Software, and permit persons to whom the Software is
Edouard@340
    18
 * furnished to do so, under the terms of the COPYING file.
Edouard@340
    19
 *
Edouard@340
    20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
Edouard@340
    21
 * KIND, either express or implied.
Edouard@340
    22
 *
Edouard@340
    23
 ***************************************************************************/
Edouard@340
    24
/*
Edouard@340
    25
  This is an "external" header file. Don't give away any internals here!
Edouard@340
    26
Edouard@340
    27
  GOALS
Edouard@340
    28
Edouard@340
    29
  o Enable a "pull" interface. The application that uses libcurl decides where
Edouard@340
    30
    and when to ask libcurl to get/send data.
Edouard@340
    31
Edouard@340
    32
  o Enable multiple simultaneous transfers in the same thread without making it
Edouard@340
    33
    complicated for the application.
Edouard@340
    34
Edouard@340
    35
  o Enable the application to select() on its own file descriptors and curl's
Edouard@340
    36
    file descriptors simultaneous easily.
Edouard@340
    37
Edouard@340
    38
*/
Edouard@340
    39
Edouard@340
    40
/*
Edouard@340
    41
 * This header file should not really need to include "curl.h" since curl.h
Edouard@340
    42
 * itself includes this file and we expect user applications to do #include
Edouard@340
    43
 * <curl/curl.h> without the need for especially including multi.h.
Edouard@340
    44
 *
Edouard@340
    45
 * For some reason we added this include here at one point, and rather than to
Edouard@340
    46
 * break existing (wrongly written) libcurl applications, we leave it as-is
Edouard@340
    47
 * but with this warning attached.
Edouard@340
    48
 */
Edouard@340
    49
#include "curl.h"
Edouard@340
    50
Edouard@340
    51
#ifdef  __cplusplus
Edouard@340
    52
extern "C" {
Edouard@340
    53
#endif
Edouard@340
    54
Edouard@340
    55
typedef void CURLM;
Edouard@340
    56
Edouard@340
    57
typedef enum {
Edouard@340
    58
  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
Edouard@340
    59
                                    curl_multi_socket*() soon */
Edouard@340
    60
  CURLM_OK,
Edouard@340
    61
  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */
Edouard@340
    62
  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
Edouard@340
    63
  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */
Edouard@340
    64
  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */
Edouard@340
    65
  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */
Edouard@340
    66
  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */
Edouard@340
    67
  CURLM_ADDED_ALREADY,   /* an easy handle already added to a multi handle was
Edouard@340
    68
                            attempted to get added - again */
Edouard@340
    69
  CURLM_LAST
Edouard@340
    70
} CURLMcode;
Edouard@340
    71
Edouard@340
    72
/* just to make code nicer when using curl_multi_socket() you can now check
Edouard@340
    73
   for CURLM_CALL_MULTI_SOCKET too in the same style it works for
Edouard@340
    74
   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
Edouard@340
    75
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
Edouard@340
    76
Edouard@340
    77
/* bitmask bits for CURLMOPT_PIPELINING */
Edouard@340
    78
#define CURLPIPE_NOTHING   0L
Edouard@340
    79
#define CURLPIPE_HTTP1     1L
Edouard@340
    80
#define CURLPIPE_MULTIPLEX 2L
Edouard@340
    81
Edouard@340
    82
typedef enum {
Edouard@340
    83
  CURLMSG_NONE, /* first, not used */
Edouard@340
    84
  CURLMSG_DONE, /* This easy handle has completed. 'result' contains
Edouard@340
    85
                   the CURLcode of the transfer */
Edouard@340
    86
  CURLMSG_LAST /* last, not used */
Edouard@340
    87
} CURLMSG;
Edouard@340
    88
Edouard@340
    89
struct CURLMsg {
Edouard@340
    90
  CURLMSG msg;       /* what this message means */
Edouard@340
    91
  CURL *easy_handle; /* the handle it concerns */
Edouard@340
    92
  union {
Edouard@340
    93
    void *whatever;    /* message-specific data */
Edouard@340
    94
    CURLcode result;   /* return code for transfer */
Edouard@340
    95
  } data;
Edouard@340
    96
};
Edouard@340
    97
typedef struct CURLMsg CURLMsg;
Edouard@340
    98
Edouard@340
    99
/* Based on poll(2) structure and values.
Edouard@340
   100
 * We don't use pollfd and POLL* constants explicitly
Edouard@340
   101
 * to cover platforms without poll(). */
Edouard@340
   102
#define CURL_WAIT_POLLIN    0x0001
Edouard@340
   103
#define CURL_WAIT_POLLPRI   0x0002
Edouard@340
   104
#define CURL_WAIT_POLLOUT   0x0004
Edouard@340
   105
Edouard@340
   106
struct curl_waitfd {
Edouard@340
   107
  curl_socket_t fd;
Edouard@340
   108
  short events;
Edouard@340
   109
  short revents; /* not supported yet */
Edouard@340
   110
};
Edouard@340
   111
Edouard@340
   112
/*
Edouard@340
   113
 * Name:    curl_multi_init()
Edouard@340
   114
 *
Edouard@340
   115
 * Desc:    inititalize multi-style curl usage
Edouard@340
   116
 *
Edouard@340
   117
 * Returns: a new CURLM handle to use in all 'curl_multi' functions.
Edouard@340
   118
 */
Edouard@340
   119
CURL_EXTERN CURLM *curl_multi_init(void);
Edouard@340
   120
Edouard@340
   121
/*
Edouard@340
   122
 * Name:    curl_multi_add_handle()
Edouard@340
   123
 *
Edouard@340
   124
 * Desc:    add a standard curl handle to the multi stack
Edouard@340
   125
 *
Edouard@340
   126
 * Returns: CURLMcode type, general multi error code.
Edouard@340
   127
 */
Edouard@340
   128
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
Edouard@340
   129
                                            CURL *curl_handle);
Edouard@340
   130
Edouard@340
   131
 /*
Edouard@340
   132
  * Name:    curl_multi_remove_handle()
Edouard@340
   133
  *
Edouard@340
   134
  * Desc:    removes a curl handle from the multi stack again
Edouard@340
   135
  *
Edouard@340
   136
  * Returns: CURLMcode type, general multi error code.
Edouard@340
   137
  */
Edouard@340
   138
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
Edouard@340
   139
                                               CURL *curl_handle);
Edouard@340
   140
Edouard@340
   141
 /*
Edouard@340
   142
  * Name:    curl_multi_fdset()
Edouard@340
   143
  *
Edouard@340
   144
  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or
Edouard@340
   145
  *          poll() on. We want curl_multi_perform() called as soon as one of
Edouard@340
   146
  *          them are ready.
Edouard@340
   147
  *
Edouard@340
   148
  * Returns: CURLMcode type, general multi error code.
Edouard@340
   149
  */
Edouard@340
   150
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
Edouard@340
   151
                                       fd_set *read_fd_set,
Edouard@340
   152
                                       fd_set *write_fd_set,
Edouard@340
   153
                                       fd_set *exc_fd_set,
Edouard@340
   154
                                       int *max_fd);
Edouard@340
   155
Edouard@340
   156
/*
Edouard@340
   157
 * Name:     curl_multi_wait()
Edouard@340
   158
 *
Edouard@340
   159
 * Desc:     Poll on all fds within a CURLM set as well as any
Edouard@340
   160
 *           additional fds passed to the function.
Edouard@340
   161
 *
Edouard@340
   162
 * Returns:  CURLMcode type, general multi error code.
Edouard@340
   163
 */
Edouard@340
   164
CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
Edouard@340
   165
                                      struct curl_waitfd extra_fds[],
Edouard@340
   166
                                      unsigned int extra_nfds,
Edouard@340
   167
                                      int timeout_ms,
Edouard@340
   168
                                      int *ret);
Edouard@340
   169
Edouard@340
   170
 /*
Edouard@340
   171
  * Name:    curl_multi_perform()
Edouard@340
   172
  *
Edouard@340
   173
  * Desc:    When the app thinks there's data available for curl it calls this
Edouard@340
   174
  *          function to read/write whatever there is right now. This returns
Edouard@340
   175
  *          as soon as the reads and writes are done. This function does not
Edouard@340
   176
  *          require that there actually is data available for reading or that
Edouard@340
   177
  *          data can be written, it can be called just in case. It returns
Edouard@340
   178
  *          the number of handles that still transfer data in the second
Edouard@340
   179
  *          argument's integer-pointer.
Edouard@340
   180
  *
Edouard@340
   181
  * Returns: CURLMcode type, general multi error code. *NOTE* that this only
Edouard@340
   182
  *          returns errors etc regarding the whole multi stack. There might
Edouard@340
   183
  *          still have occurred problems on invidual transfers even when this
Edouard@340
   184
  *          returns OK.
Edouard@340
   185
  */
Edouard@340
   186
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
Edouard@340
   187
                                         int *running_handles);
Edouard@340
   188
Edouard@340
   189
 /*
Edouard@340
   190
  * Name:    curl_multi_cleanup()
Edouard@340
   191
  *
Edouard@340
   192
  * Desc:    Cleans up and removes a whole multi stack. It does not free or
Edouard@340
   193
  *          touch any individual easy handles in any way. We need to define
Edouard@340
   194
  *          in what state those handles will be if this function is called
Edouard@340
   195
  *          in the middle of a transfer.
Edouard@340
   196
  *
Edouard@340
   197
  * Returns: CURLMcode type, general multi error code.
Edouard@340
   198
  */
Edouard@340
   199
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
Edouard@340
   200
Edouard@340
   201
/*
Edouard@340
   202
 * Name:    curl_multi_info_read()
Edouard@340
   203
 *
Edouard@340
   204
 * Desc:    Ask the multi handle if there's any messages/informationals from
Edouard@340
   205
 *          the individual transfers. Messages include informationals such as
Edouard@340
   206
 *          error code from the transfer or just the fact that a transfer is
Edouard@340
   207
 *          completed. More details on these should be written down as well.
Edouard@340
   208
 *
Edouard@340
   209
 *          Repeated calls to this function will return a new struct each
Edouard@340
   210
 *          time, until a special "end of msgs" struct is returned as a signal
Edouard@340
   211
 *          that there is no more to get at this point.
Edouard@340
   212
 *
Edouard@340
   213
 *          The data the returned pointer points to will not survive calling
Edouard@340
   214
 *          curl_multi_cleanup().
Edouard@340
   215
 *
Edouard@340
   216
 *          The 'CURLMsg' struct is meant to be very simple and only contain
Edouard@340
   217
 *          very basic informations. If more involved information is wanted,
Edouard@340
   218
 *          we will provide the particular "transfer handle" in that struct
Edouard@340
   219
 *          and that should/could/would be used in subsequent
Edouard@340
   220
 *          curl_easy_getinfo() calls (or similar). The point being that we
Edouard@340
   221
 *          must never expose complex structs to applications, as then we'll
Edouard@340
   222
 *          undoubtably get backwards compatibility problems in the future.
Edouard@340
   223
 *
Edouard@340
   224
 * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
Edouard@340
   225
 *          of structs. It also writes the number of messages left in the
Edouard@340
   226
 *          queue (after this read) in the integer the second argument points
Edouard@340
   227
 *          to.
Edouard@340
   228
 */
Edouard@340
   229
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
Edouard@340
   230
                                          int *msgs_in_queue);
Edouard@340
   231
Edouard@340
   232
/*
Edouard@340
   233
 * Name:    curl_multi_strerror()
Edouard@340
   234
 *
Edouard@340
   235
 * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode
Edouard@340
   236
 *          value into the equivalent human readable error string.  This is
Edouard@340
   237
 *          useful for printing meaningful error messages.
Edouard@340
   238
 *
Edouard@340
   239
 * Returns: A pointer to a zero-terminated error message.
Edouard@340
   240
 */
Edouard@340
   241
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
Edouard@340
   242
Edouard@340
   243
/*
Edouard@340
   244
 * Name:    curl_multi_socket() and
Edouard@340
   245
 *          curl_multi_socket_all()
Edouard@340
   246
 *
Edouard@340
   247
 * Desc:    An alternative version of curl_multi_perform() that allows the
Edouard@340
   248
 *          application to pass in one of the file descriptors that have been
Edouard@340
   249
 *          detected to have "action" on them and let libcurl perform.
Edouard@340
   250
 *          See man page for details.
Edouard@340
   251
 */
Edouard@340
   252
#define CURL_POLL_NONE   0
Edouard@340
   253
#define CURL_POLL_IN     1
Edouard@340
   254
#define CURL_POLL_OUT    2
Edouard@340
   255
#define CURL_POLL_INOUT  3
Edouard@340
   256
#define CURL_POLL_REMOVE 4
Edouard@340
   257
Edouard@340
   258
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
Edouard@340
   259
Edouard@340
   260
#define CURL_CSELECT_IN   0x01
Edouard@340
   261
#define CURL_CSELECT_OUT  0x02
Edouard@340
   262
#define CURL_CSELECT_ERR  0x04
Edouard@340
   263
Edouard@340
   264
typedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */
Edouard@340
   265
                                    curl_socket_t s, /* socket */
Edouard@340
   266
                                    int what,        /* see above */
Edouard@340
   267
                                    void *userp,     /* private callback
Edouard@340
   268
                                                        pointer */
Edouard@340
   269
                                    void *socketp);  /* private socket
Edouard@340
   270
                                                        pointer */
Edouard@340
   271
/*
Edouard@340
   272
 * Name:    curl_multi_timer_callback
Edouard@340
   273
 *
Edouard@340
   274
 * Desc:    Called by libcurl whenever the library detects a change in the
Edouard@340
   275
 *          maximum number of milliseconds the app is allowed to wait before
Edouard@340
   276
 *          curl_multi_socket() or curl_multi_perform() must be called
Edouard@340
   277
 *          (to allow libcurl's timed events to take place).
Edouard@340
   278
 *
Edouard@340
   279
 * Returns: The callback should return zero.
Edouard@340
   280
 */
Edouard@340
   281
typedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */
Edouard@340
   282
                                         long timeout_ms, /* see above */
Edouard@340
   283
                                         void *userp);    /* private callback
Edouard@340
   284
                                                             pointer */
Edouard@340
   285
Edouard@340
   286
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
Edouard@340
   287
                                        int *running_handles);
Edouard@340
   288
Edouard@340
   289
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
Edouard@340
   290
                                               curl_socket_t s,
Edouard@340
   291
                                               int ev_bitmask,
Edouard@340
   292
                                               int *running_handles);
Edouard@340
   293
Edouard@340
   294
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
Edouard@340
   295
                                            int *running_handles);
Edouard@340
   296
Edouard@340
   297
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
Edouard@340
   298
/* This macro below was added in 7.16.3 to push users who recompile to use
Edouard@340
   299
   the new curl_multi_socket_action() instead of the old curl_multi_socket()
Edouard@340
   300
*/
Edouard@340
   301
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
Edouard@340
   302
#endif
Edouard@340
   303
Edouard@340
   304
/*
Edouard@340
   305
 * Name:    curl_multi_timeout()
Edouard@340
   306
 *
Edouard@340
   307
 * Desc:    Returns the maximum number of milliseconds the app is allowed to
Edouard@340
   308
 *          wait before curl_multi_socket() or curl_multi_perform() must be
Edouard@340
   309
 *          called (to allow libcurl's timed events to take place).
Edouard@340
   310
 *
Edouard@340
   311
 * Returns: CURLM error code.
Edouard@340
   312
 */
Edouard@340
   313
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
Edouard@340
   314
                                         long *milliseconds);
Edouard@340
   315
Edouard@340
   316
#undef CINIT /* re-using the same name as in curl.h */
Edouard@340
   317
Edouard@340
   318
#ifdef CURL_ISOCPP
Edouard@340
   319
#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
Edouard@340
   320
#else
Edouard@340
   321
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
Edouard@340
   322
#define LONG          CURLOPTTYPE_LONG
Edouard@340
   323
#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
Edouard@340
   324
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
Edouard@340
   325
#define OFF_T         CURLOPTTYPE_OFF_T
Edouard@340
   326
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
Edouard@340
   327
#endif
Edouard@340
   328
Edouard@340
   329
typedef enum {
Edouard@340
   330
  /* This is the socket callback function pointer */
Edouard@340
   331
  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
Edouard@340
   332
Edouard@340
   333
  /* This is the argument passed to the socket callback */
Edouard@340
   334
  CINIT(SOCKETDATA, OBJECTPOINT, 2),
Edouard@340
   335
Edouard@340
   336
    /* set to 1 to enable pipelining for this multi handle */
Edouard@340
   337
  CINIT(PIPELINING, LONG, 3),
Edouard@340
   338
Edouard@340
   339
   /* This is the timer callback function pointer */
Edouard@340
   340
  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
Edouard@340
   341
Edouard@340
   342
  /* This is the argument passed to the timer callback */
Edouard@340
   343
  CINIT(TIMERDATA, OBJECTPOINT, 5),
Edouard@340
   344
Edouard@340
   345
  /* maximum number of entries in the connection cache */
Edouard@340
   346
  CINIT(MAXCONNECTS, LONG, 6),
Edouard@340
   347
Edouard@340
   348
  /* maximum number of (pipelining) connections to one host */
Edouard@340
   349
  CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
Edouard@340
   350
Edouard@340
   351
  /* maximum number of requests in a pipeline */
Edouard@340
   352
  CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
Edouard@340
   353
Edouard@340
   354
  /* a connection with a content-length longer than this
Edouard@340
   355
     will not be considered for pipelining */
Edouard@340
   356
  CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
Edouard@340
   357
Edouard@340
   358
  /* a connection with a chunk length longer than this
Edouard@340
   359
     will not be considered for pipelining */
Edouard@340
   360
  CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
Edouard@340
   361
Edouard@340
   362
  /* a list of site names(+port) that are blacklisted from
Edouard@340
   363
     pipelining */
Edouard@340
   364
  CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
Edouard@340
   365
Edouard@340
   366
  /* a list of server types that are blacklisted from
Edouard@340
   367
     pipelining */
Edouard@340
   368
  CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
Edouard@340
   369
Edouard@340
   370
  /* maximum number of open connections in total */
Edouard@340
   371
  CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
Edouard@340
   372
dirk@531
   373
   /* This is the server push callback function pointer */
dirk@531
   374
  CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
dirk@531
   375
dirk@531
   376
  /* This is the argument passed to the server push callback */
dirk@531
   377
  CINIT(PUSHDATA, OBJECTPOINT, 15),
dirk@531
   378
Edouard@340
   379
  CURLMOPT_LASTENTRY /* the last unused */
Edouard@340
   380
} CURLMoption;
Edouard@340
   381
Edouard@340
   382
Edouard@340
   383
/*
Edouard@340
   384
 * Name:    curl_multi_setopt()
Edouard@340
   385
 *
Edouard@340
   386
 * Desc:    Sets options for the multi handle.
Edouard@340
   387
 *
Edouard@340
   388
 * Returns: CURLM error code.
Edouard@340
   389
 */
Edouard@340
   390
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
Edouard@340
   391
                                        CURLMoption option, ...);
Edouard@340
   392
Edouard@340
   393
Edouard@340
   394
/*
Edouard@340
   395
 * Name:    curl_multi_assign()
Edouard@340
   396
 *
Edouard@340
   397
 * Desc:    This function sets an association in the multi handle between the
Edouard@340
   398
 *          given socket and a private pointer of the application. This is
Edouard@340
   399
 *          (only) useful for curl_multi_socket uses.
Edouard@340
   400
 *
Edouard@340
   401
 * Returns: CURLM error code.
Edouard@340
   402
 */
Edouard@340
   403
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
Edouard@340
   404
                                        curl_socket_t sockfd, void *sockp);
Edouard@340
   405
dirk@531
   406
dirk@531
   407
/*
dirk@531
   408
 * Name: curl_push_callback
dirk@531
   409
 *
dirk@531
   410
 * Desc: This callback gets called when a new stream is being pushed by the
dirk@531
   411
 *       server. It approves or denies the new stream.
dirk@531
   412
 *
dirk@531
   413
 * Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
dirk@531
   414
 */
dirk@531
   415
#define CURL_PUSH_OK   0
dirk@531
   416
#define CURL_PUSH_DENY 1
dirk@531
   417
dirk@531
   418
struct curl_pushheaders;  /* forward declaration only */
dirk@531
   419
dirk@531
   420
CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
dirk@531
   421
                                        size_t num);
dirk@531
   422
CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
dirk@531
   423
                                         const char *name);
dirk@531
   424
dirk@531
   425
typedef int (*curl_push_callback)(CURL *parent,
dirk@531
   426
                                  CURL *easy,
dirk@531
   427
                                  size_t num_headers,
dirk@531
   428
                                  struct curl_pushheaders *headers,
dirk@531
   429
                                  void *userp);
dirk@531
   430
Edouard@340
   431
#ifdef __cplusplus
Edouard@340
   432
} /* end of extern "C" */
Edouard@340
   433
#endif
Edouard@340
   434
Edouard@340
   435
#endif