Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-http-client.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <sol-http.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
61 
72 #ifndef SOL_NO_API_VERSION
73 #define SOL_HTTP_REQUEST_INTERFACE_API_VERSION (1)
74 
78  uint16_t api_version;
79 #endif
80 
96  ssize_t (*on_data)(void *user_data, struct sol_http_client_connection *connection,
97  const struct sol_buffer *buffer);
118  ssize_t (*on_send)(void *user_data, struct sol_http_client_connection *connection,
119  struct sol_buffer *buffer);
131  void (*on_response)(void *user_data, struct sol_http_client_connection *connection,
132  struct sol_http_response *response);
133 
141 
221  const char *url, const struct sol_http_params *params,
222  void (*cb)(void *data, struct sol_http_client_connection *connection,
223  struct sol_http_response *response),
224  const void *data)
225 #ifndef DOXYGEN_RUN
227 #endif
228 ;
229 
250  const char *url, const struct sol_http_params *params,
251  const struct sol_http_request_interface *interface,
252  const void *data)
253 #ifndef DOXYGEN_RUN
255 #endif
256 ;
257 
265 
270 #ifdef __cplusplus
271 }
272 #endif
struct sol_http_client_connection * pending
Definition: download.c:29
Handle for an HTTP response.
Definition: sol-http.h:248
struct sol_http_client_connection sol_http_client_connection
Opaque handler for an HTTP client connection.
Definition: sol-http-client.h:60
void sol_http_client_connection_cancel(struct sol_http_client_connection *pending)
Cancel a pending request and release its resources.
size_t data_buffer_size
The size in bytes of the receiving data buffer.
Definition: sol-http-client.h:139
uint16_t api_version
api_version must match SOL_HTTP_REQUEST_INTERFACE_API_VERSION at runtime.
Definition: sol-http-client.h:78
#define SOL_ATTR_WARN_UNUSED_RESULT
Causes a warning to be emitted if a caller of the function with this attribute does not use its retur...
Definition: sol-macros.h:187
void(* on_response)(void *user_data, struct sol_http_client_connection *connection, struct sol_http_response *response)
This callback is called when the request finishes, the result of request is available on response...
Definition: sol-http-client.h:131
struct sol_http_request_interface sol_http_request_interface
The HTTP request interface to use when creating a new request.
ssize_t(* on_send)(void *user_data, struct sol_http_client_connection *connection, struct sol_buffer *buffer)
This callback is called data should be written, it's commonly used for POST.
Definition: sol-http-client.h:118
sol_http_method
Type of HTTP method.
Definition: sol-http.h:47
Keep vector of HTTP parameters to be sent in a request.
Definition: sol-http.h:178
#define SOL_ATTR_NON_NULL(...)
Specifies that some function parameters should be non-null pointers.
Definition: sol-macros.h:193
struct sol_http_client_connection * sol_http_client_request_with_interface(enum sol_http_method method, const char *url, const struct sol_http_params *params, const struct sol_http_request_interface *interface, const void *data)
Create a request for the specified URL using the given method.
ssize_t(* on_data)(void *user_data, struct sol_http_client_connection *connection, const struct sol_buffer *buffer)
This callback is called whenever data comes.
Definition: sol-http-client.h:96
struct sol_http_client_connection * sol_http_client_request(enum sol_http_method method, const char *url, const struct sol_http_params *params, void(*cb)(void *data, struct sol_http_client_connection *connection, struct sol_http_response *response), const void *data)
Create a request for the specified URL using the given method.
The HTTP request interface to use when creating a new request.
Definition: sol-http-client.h:71
A sol_buffer is a dynamic array, that can be resized if needed.
Definition: sol-buffer.h:130