Filter results by

Older Versions

Older API versions are available as a download. To view, extract the file and open the index.html file in a web browser.

artik_http.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  */
18 
19 #ifndef INCLUDE_ARTIK_HTTP_H_
20 #define INCLUDE_ARTIK_HTTP_H_
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "artik_error.h"
27 #include "artik_types.h"
28 #include "artik_ssl.h"
29 
49 #define MAX_HEADER_SIZE 256
50 
57 typedef struct {
61  char *name;
65  char *data;
67 
74 typedef struct {
84 
93 typedef int (*artik_http_stream_callback)(char *data,
94  unsigned int len, void *user_data);
95 
109 typedef void (*artik_http_response_callback)(artik_error result, int status,
110  char *response, void *user_data);
111 
119 typedef struct {
139  artik_error (*get_stream)(const char *url,
140  artik_http_headers *headers,
141  int *status,
143  void *user_data,
144  artik_ssl_config *ssl);
163  artik_error (*get_stream_async)(const char *url,
164  artik_http_headers *headers,
165  artik_http_stream_callback stream_callback,
166  artik_http_response_callback response_callback,
167  void *user_data,
168  artik_ssl_config *ssl);
188  artik_error (*get)(const char *url,
189  artik_http_headers *headers,
190  char **response, int *status,
191  artik_ssl_config *ssl);
207  artik_error (*get_async)(const char *url,
208  artik_http_headers *headers,
210  void *user_data,
211  artik_ssl_config *ssl);
233  artik_error (*post)(const char *url,
234  artik_http_headers *headers,
235  const char *body, char **response,
236  int *status, artik_ssl_config *ssl);
254  artik_error (*post_async)(const char *url,
255  artik_http_headers *headers,
256  const char *body,
258  void *user_data,
259  artik_ssl_config *ssl);
281  artik_error (*put)(const char *url,
282  artik_http_headers *headers,
283  const char *body, char **response,
284  int *status, artik_ssl_config *ssl);
302  artik_error (*put_async)(const char *url,
303  artik_http_headers *headers,
304  const char *body,
306  void *user_data,
307  artik_ssl_config *ssl);
327  artik_error (*del)(const char *url,
328  artik_http_headers *headers,
329  char **response, int *status,
330  artik_ssl_config *ssl);
346  artik_error (*del_async)(const char *url,
347  artik_http_headers *headers,
349  void *user_data,
350  artik_ssl_config *ssl);
351 
353 
354 extern const artik_http_module http_module;
355 
356 #ifdef __cplusplus
357 }
358 #endif
359 #endif /* INCLUDE_ARTIK_HTTP_H_ */
artik_http_header_field * fields
Pointer to an array containing the header fields.
Definition: artik_http.h:82
char * data
Content of the HTTP header field.
Definition: artik_http.h:65
Custom types.
int num_fields
Number of header fields pointed to by "fields".
Definition: artik_http.h:78
HTTP header field structure.
Definition: artik_http.h:57
int artik_error
Error type.
Definition: artik_error.h:35
HTTP headers structure.
Definition: artik_http.h:74
char * name
Name of the HTTP header field (e.g. "user-agent")
Definition: artik_http.h:61
int(* artik_http_stream_callback)(char *data, unsigned int len, void *user_data)
Stream data callback prototype.
Definition: artik_http.h:93
HTTP module operations.
Definition: artik_http.h:119
SSL/TLS related definitions.
void(* artik_http_response_callback)(artik_error result, int status, char *response, void *user_data)
Response callback prototype.
Definition: artik_http.h:109
Error codes.
SSL configuration structure.
Definition: artik_ssl.h:106
Last updated on: