summaryrefslogtreecommitdiffstats
path: root/src/H5FDs3comms.h
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
commit1ba1f2f3222cbe8df0bf601929a4bffd478d7e02 (patch)
treeae51dfc33cf40432dad25a5088767115a98f195e /src/H5FDs3comms.h
parent8eef7d295cc3dd134aef0a826f1de4287629996d (diff)
downloadhdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.zip
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.gz
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.bz2
Source formatted
Diffstat (limited to 'src/H5FDs3comms.h')
-rw-r--r--src/H5FDs3comms.h149
1 files changed, 53 insertions, 96 deletions
diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h
index c9d6c9d..6bd3232 100644
--- a/src/H5FDs3comms.h
+++ b/src/H5FDs3comms.h
@@ -55,8 +55,7 @@
#ifndef H5FDs3comms_H
#define H5FDs3comms_H
-
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_ROS3_VFD
@@ -73,8 +72,7 @@
/* hexadecimal string of pre-computed sha256 checksum of the empty string
* hex(sha256sum(""))
*/
-#define EMPTY_SHA256 \
-"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+#define EMPTY_SHA256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
/* string length (plus null terminator)
* example ISO8601-format string: "20170713T145903Z" (YYYYmmdd'T'HHMMSS'_')
@@ -102,8 +100,7 @@
*
*---------------------------------------------------------------------------
*/
-#define ISO8601NOW(dest, now_gm) \
-strftime((dest), ISO8601_SIZE, "%Y%m%dT%H%M%SZ", (now_gm))
+#define ISO8601NOW(dest, now_gm) strftime((dest), ISO8601_SIZE, "%Y%m%dT%H%M%SZ", (now_gm))
/*---------------------------------------------------------------------------
*
@@ -121,9 +118,7 @@ strftime((dest), ISO8601_SIZE, "%Y%m%dT%H%M%SZ", (now_gm))
*
*---------------------------------------------------------------------------
*/
-#define RFC7231NOW(dest, now_gm) \
-strftime((dest), RFC7231_SIZE, "%a, %d %b %Y %H:%M:%S GMT", (now_gm))
-
+#define RFC7231NOW(dest, now_gm) strftime((dest), RFC7231_SIZE, "%a, %d %b %Y %H:%M:%S GMT", (now_gm))
/* Reasonable maximum length of a credential string.
* Provided for error-checking S3COMMS_FORMAT_CREDENTIAL (below).
@@ -135,7 +130,6 @@ strftime((dest), RFC7231_SIZE, "%a, %d %b %Y %H:%M:%S GMT", (now_gm))
*/
#define S3COMMS_MAX_CREDENTIAL_SIZE 155
-
/*---------------------------------------------------------------------------
*
* Macro: H5FD_S3COMMS_FORMAT_CREDENTIAL()
@@ -166,16 +160,14 @@ strftime((dest), RFC7231_SIZE, "%a, %d %b %Y %H:%M:%S GMT", (now_gm))
*
*---------------------------------------------------------------------------
*/
-#define S3COMMS_FORMAT_CREDENTIAL(dest, access, iso8601_date, region, service) \
-HDsnprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, \
- "%s/%s/%s/%s/aws4_request", \
- (access), (iso8601_date), (region), (service))
+#define S3COMMS_FORMAT_CREDENTIAL(dest, access, iso8601_date, region, service) \
+ HDsnprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, "%s/%s/%s/%s/aws4_request", (access), (iso8601_date), \
+ (region), (service))
/*********************
* PUBLIC STRUCTURES *
*********************/
-
/*----------------------------------------------------------------------------
*
* Structure: hrb_node_t
@@ -260,15 +252,14 @@ HDsnprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE,
*/
typedef struct hrb_node_t {
unsigned long magic;
- char *name;
- char *value;
- char *cat;
- char *lowername;
+ char * name;
+ char * value;
+ char * cat;
+ char * lowername;
struct hrb_node_t *next;
} hrb_node_t;
#define S3COMMS_HRB_NODE_MAGIC 0x7F5757UL
-
/*----------------------------------------------------------------------------
*
* Structure: hrb_t
@@ -336,17 +327,16 @@ typedef struct hrb_node_t {
*----------------------------------------------------------------------------
*/
typedef struct {
- unsigned long magic;
- char *body;
- size_t body_len;
- hrb_node_t *first_header;
- char *resource;
- char *verb;
- char *version;
+ unsigned long magic;
+ char * body;
+ size_t body_len;
+ hrb_node_t * first_header;
+ char * resource;
+ char * verb;
+ char * version;
} hrb_t;
#define S3COMMS_HRB_MAGIC 0x6DCC84UL
-
/*----------------------------------------------------------------------------
*
* Structure: parsed_url_t
@@ -400,16 +390,15 @@ typedef struct {
*----------------------------------------------------------------------------
*/
typedef struct {
- unsigned long magic;
- char *scheme; /* required */
- char *host; /* required */
- char *port;
- char *path;
- char *query;
+ unsigned long magic;
+ char * scheme; /* required */
+ char * host; /* required */
+ char * port;
+ char * path;
+ char * query;
} parsed_url_t;
#define S3COMMS_PARSED_URL_MAGIC 0x21D0DFUL
-
/*----------------------------------------------------------------------------
*
* Structure: s3r_t
@@ -490,12 +479,12 @@ typedef struct {
*/
typedef struct {
unsigned long magic;
- CURL *curlhandle;
+ CURL * curlhandle;
size_t filesize;
- char *httpverb;
- parsed_url_t *purl;
- char *region;
- char *secret_id;
+ char * httpverb;
+ parsed_url_t * purl;
+ char * region;
+ char * secret_id;
unsigned char *signing_key;
} s3r_t;
@@ -509,9 +498,7 @@ extern "C" {
* DECLARATION OF HTTP FIELD LIST ROUTINES *
*******************************************/
-H5_DLL herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L,
- const char *name,
- const char *value);
+H5_DLL herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value);
/***********************************************
* DECLARATION OF HTTP REQUEST BUFFER ROUTINES *
@@ -519,9 +506,7 @@ H5_DLL herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L,
H5_DLL herr_t H5FD_s3comms_hrb_destroy(hrb_t **buf);
-H5_DLL hrb_t * H5FD_s3comms_hrb_init_request(const char *verb,
- const char *resource,
- const char *host);
+H5_DLL hrb_t *H5FD_s3comms_hrb_init_request(const char *verb, const char *resource, const char *host);
/*************************************
* DECLARATION OF S3REQUEST ROUTINES *
@@ -531,74 +516,47 @@ H5_DLL herr_t H5FD_s3comms_s3r_close(s3r_t *handle);
H5_DLL size_t H5FD_s3comms_s3r_get_filesize(s3r_t *handle);
-H5_DLL s3r_t * H5FD_s3comms_s3r_open(const char url[],
- const char region[],
- const char id[],
- const unsigned char signing_key[]);
+H5_DLL s3r_t *H5FD_s3comms_s3r_open(const char url[], const char region[], const char id[],
+ const unsigned char signing_key[]);
-H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle,
- haddr_t offset,
- size_t len,
- void *dest);
+H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest);
/*********************************
* DECLARATION OF OTHER ROUTINES *
*********************************/
-H5_DLL struct tm * gmnow(void);
+H5_DLL struct tm *gmnow(void);
-H5_DLL herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest,
- int cr_size,
- char *signed_headers_dest,
- int sh_size,
- hrb_t *http_request);
+H5_DLL herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int cr_size,
+ char *signed_headers_dest, int sh_size, hrb_t *http_request);
-H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest,
- const unsigned char *msg,
- size_t msg_len,
- hbool_t lowercase);
+H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len,
+ hbool_t lowercase);
H5_DLL herr_t H5FD_s3comms_free_purl(parsed_url_t *purl);
-H5_DLL herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key,
- size_t key_len,
- const char *msg,
- size_t msg_len,
- char *dest);
+H5_DLL herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *msg,
+ size_t msg_len, char *dest);
-H5_DLL herr_t H5FD_s3comms_load_aws_profile(const char *name,
- char *key_id_out,
- char *secret_access_key_out,
- char *aws_region_out);
+H5_DLL herr_t H5FD_s3comms_load_aws_profile(const char *name, char *key_id_out, char *secret_access_key_out,
+ char *aws_region_out);
-H5_DLL herr_t H5FD_s3comms_nlowercase(char *dest,
- const char *s,
- size_t len);
+H5_DLL herr_t H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len);
-H5_DLL herr_t H5FD_s3comms_parse_url(const char *str,
- parsed_url_t **purl);
+H5_DLL herr_t H5FD_s3comms_parse_url(const char *str, parsed_url_t **purl);
-H5_DLL herr_t H5FD_s3comms_percent_encode_char(char *repr,
- const unsigned char c,
- size_t *repr_len);
+H5_DLL herr_t H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr_len);
-H5_DLL herr_t H5FD_s3comms_signing_key(unsigned char *md,
- const char *secret,
- const char *region,
- const char *iso8601now);
+H5_DLL herr_t H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *region,
+ const char *iso8601now);
-H5_DLL herr_t H5FD_s3comms_tostringtosign(char *dest,
- const char *req_str,
- const char *now,
- const char *region);
+H5_DLL herr_t H5FD_s3comms_tostringtosign(char *dest, const char *req_str, const char *now,
+ const char *region);
-H5_DLL herr_t H5FD_s3comms_trim(char *dest,
- char *s,
- size_t s_len,
- size_t *n_written);
+H5_DLL herr_t H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written);
-H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len,
- hbool_t encode_slash, size_t *n_written);
+H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_slash,
+ size_t *n_written);
#ifdef __cplusplus
}
@@ -607,4 +565,3 @@ H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len,
#endif /* H5_HAVE_ROS3_VFD */
#endif /* ifndef H5FDs3comms_H */
-