summaryrefslogtreecommitdiff
path: root/src/third_party/kms-message/src/kms_message/kms_request.h
blob: 15438ba4eebc4c607fc5f215fb55e6d059e232df (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * Copyright 2018-present MongoDB, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef KMS_REQUEST_H
#define KMS_REQUEST_H

#include "kms_message.h"

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _kms_request_t kms_request_t;

KMS_MSG_EXPORT (kms_request_t *)
kms_request_new (const char *method,
                 const char *path_and_query,
                 const kms_request_opt_t *opt);
KMS_MSG_EXPORT (void)
kms_request_destroy (kms_request_t *request);
KMS_MSG_EXPORT (const char *)
kms_request_get_error (kms_request_t *request);
KMS_MSG_EXPORT (bool)
kms_request_set_date (kms_request_t *request, const struct tm *tm);
KMS_MSG_EXPORT (bool)
kms_request_set_region (kms_request_t *request, const char *region);
KMS_MSG_EXPORT (bool)
kms_request_set_service (kms_request_t *request, const char *service);
KMS_MSG_EXPORT (bool)
kms_request_set_access_key_id (kms_request_t *request, const char *akid);
KMS_MSG_EXPORT (bool)
kms_request_set_secret_key (kms_request_t *request, const char *key);
KMS_MSG_EXPORT (bool)
kms_request_add_header_field (kms_request_t *request,
                              const char *field_name,
                              const char *value);
KMS_MSG_EXPORT (bool)
kms_request_append_header_field_value (kms_request_t *request,
                                       const char *value,
                                       size_t len);
KMS_MSG_EXPORT (bool)
kms_request_append_payload (kms_request_t *request,
                            const char *payload,
                            size_t len);
KMS_MSG_EXPORT (char *)
kms_request_get_canonical (kms_request_t *request);
KMS_MSG_EXPORT (char *)
kms_request_get_string_to_sign (kms_request_t *request);
KMS_MSG_EXPORT (bool)
kms_request_get_signing_key (kms_request_t *request, unsigned char *key);
KMS_MSG_EXPORT (char *)
kms_request_get_signature (kms_request_t *request);
KMS_MSG_EXPORT (char *)
kms_request_get_signed (kms_request_t *request);
KMS_MSG_EXPORT (void)
kms_request_free_string (char* ptr);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* KMS_REQUEST_H */