nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
rest_client.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef REST_CLIENT_H__
8#define REST_CLIENT_H__
9
20#include <zephyr/kernel.h>
21#include <zephyr/net/http/client.h>
22#include <zephyr/net/http/parser.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
29#define REST_CLIENT_SEC_TAG_NO_SEC -1
30
32#define REST_CLIENT_TLS_DEFAULT_PEER_VERIFY -1
33
35#define REST_CLIENT_SCKT_CONNECT -1
36
49};
50
62
65
68
73
76
78 const char *host;
79
81 uint16_t port;
82
84 const char *url;
85
89 const char **header_fields;
90
92 const char *body;
93
95 size_t body_len;
96
103 int32_t timeout_ms;
104
107
110};
111
121
124
126 char *response;
127
130
135 char http_status_code_str[HTTP_STATUS_STR_SIZE];
136
141
144};
145
160 struct rest_client_resp_context *resp_ctx);
161
170
171#ifdef __cplusplus
172}
173#endif
174
177#endif /* REST_CLIENT_H__ */
void rest_client_request_defaults_set(struct rest_client_req_context *req_ctx)
Sets the default values into a given request context.
rest_client_http_status
Common HTTP status codes.
Definition: rest_client.h:38
@ REST_CLIENT_HTTP_STATUS_UNAUTH
Definition: rest_client.h:44
@ REST_CLIENT_HTTP_STATUS_OK
Definition: rest_client.h:40
@ REST_CLIENT_HTTP_STATUS_NOT_FOUND
Definition: rest_client.h:48
@ REST_CLIENT_HTTP_STATUS_BAD_REQ
Definition: rest_client.h:42
@ REST_CLIENT_HTTP_STATUS_FORBIDDEN
Definition: rest_client.h:46
int rest_client_request(struct rest_client_req_context *req_ctx, struct rest_client_resp_context *resp_ctx)
REST client request.
enum http_method http_method
Definition: rest_client.h:75
size_t body_len
Definition: rest_client.h:95
int tls_peer_verify
Definition: rest_client.h:72
const char * host
Definition: rest_client.h:78
bool keep_alive
Definition: rest_client.h:64
const char ** header_fields
Definition: rest_client.h:89
uint16_t port
Definition: rest_client.h:81
size_t resp_buff_len
Definition: rest_client.h:109
const char * body
Definition: rest_client.h:92
char * resp_buff
Definition: rest_client.h:106
int connect_socket
Definition: rest_client.h:61
int32_t timeout_ms
Definition: rest_client.h:103
const char * url
Definition: rest_client.h:84
int sec_tag
Definition: rest_client.h:67
REST client request context.
Definition: rest_client.h:57
int used_socket_is_alive
Definition: rest_client.h:143
uint16_t http_status_code
Definition: rest_client.h:129
char http_status_code_str[HTTP_STATUS_STR_SIZE]
Definition: rest_client.h:135
size_t response_len
Definition: rest_client.h:123
char * response
Definition: rest_client.h:126
size_t total_response_len
Definition: rest_client.h:120
int used_socket_id
Definition: rest_client.h:140
REST client response context.
Definition: rest_client.h:118