File: miniwget.h

package info (click to toggle)
miniupnpc 2.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 992 kB
  • sloc: ansic: 7,885; makefile: 325; xml: 207; python: 170; sh: 161; java: 89
file content (54 lines) | stat: -rw-r--r-- 1,844 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* $Id: miniwget.h,v 1.15 2025/03/02 01:14:38 nanard Exp $ */
/* Project : miniupnp
 * Author : Thomas Bernard
 * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
 * Copyright (c) 2005-2025 Thomas Bernard
 * This software is subject to the conditions detailed in the
 * LICENCE file provided in this distribution.
 * */
#ifndef MINIWGET_H_INCLUDED
#define MINIWGET_H_INCLUDED

/*! \file miniwget.h
 * \brief Lightweight HTTP client API
 */
#include "miniupnpc_declspec.h"

#ifdef __cplusplus
extern "C" {
#endif

/*! \brief perform HTTP GET on an URL
 *
 * \param[in] url HTTP URL to GET
 * \param[out] size length of the returned buffer. -1 in case of memory
 *             allocation error
 * \param[in] scope_id interface id for IPv6 to use if not specified in the URL
 * \param[out] status_code HTTP response status code (200, 404, etc.)
 * \return the body of the HTTP response
 */
MINIUPNP_LIBSPEC void * miniwget(const char * url, int * size,
                                 unsigned int scope_id, int * status_code);

/*! \brief perform HTTP GET on an URL
 *
 * Also get the local address used to reach the HTTP server
 *
 * \param[in] url HTTP URL to GET
 * \param[out] size length of the returned buffer. -1 in case of memory
 *             allocation error
 * \param[out] addr local address used to connect to the server
 * \param[in] addrlen size of the addr buffer
 * \param[in] scope_id interface id for IPv6 to use if not specified in the URL
 * \param[out] status_code HTTP response status code (200, 404, etc.)
 * \return the body of the HTTP response
 */
MINIUPNP_LIBSPEC void * miniwget_getaddr(const char * url, int * size,
                                         char * addr, int addrlen,
                                         unsigned int scope_id, int * status_code);

#ifdef __cplusplus
}
#endif

#endif