netcdf-c/include/ncbytes.h
Dennis Heimbigner 6b69b9c52c Significantly Improve Amazon S3 Cloud Storage Support
## S3 Related Fixes

* Add comprehensive support for specifying AWS profiles to provide access credentials.
* Parse the files "~/.aws/config" and "~/.aws/credentials to provide credentials for the HDF5 ROS3 driver and to locate default region.
* Add a function to obtain the currently active S3 credentials. The search rules are defined in docs/nczarr.md.
* Provide documentation for the new features.
* Modify the struct NCauth (in include/ncauth.h) to replace specific S3 credentials with a profile name.
* Add a unit test to test the operation of profile and credentials management.
* Add support for URLS of the form "s3://<bucket>/<key>"; this requires obtaining a default region.
* Allows the specification of profile and/or region in a URL of the form "#mode=nczarr,...&aws.region=...&aws.profile=..."

## Misc. Fixes

* Move the ezxml code to libdispatch so that it can be used both by DAP4 and nczarr.
* Modify nclist to provide a deep clone operation.
* Modify ncuri to provide a deep clone operation.
* Modify the .rc file format to allow the specification of a path to be tested when looking for an entry in the .rc file.
* Ensure that the NC_rcload function is called.
* Modify nchttp to support setting request headers.
2021-09-27 18:36:33 -06:00

66 lines
2.1 KiB
C

/* Copyright 2018, UCAR/Unidata and OPeNDAP, Inc.
See the COPYRIGHT file for more information. */
#ifndef NCBYTES_H
#define NCBYTES_H 1
typedef struct NCbytes {
int nonextendible; /* 1 => fail if an attempt is made to extend this buffer*/
unsigned long alloc;
unsigned long length;
char* content;
} NCbytes;
#include "ncexternl.h"
#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__) || defined(__CPLUSPLUS)
extern "C" {
#endif
EXTERNL NCbytes* ncbytesnew(void);
EXTERNL void ncbytesfree(NCbytes*);
EXTERNL int ncbytessetalloc(NCbytes*,unsigned long);
EXTERNL int ncbytessetlength(NCbytes*,unsigned long);
EXTERNL int ncbytesfill(NCbytes*, char fill);
/* Produce a duplicate of the contents*/
EXTERNL char* ncbytesdup(NCbytes*);
/* Extract the contents and leave buffer empty */
EXTERNL char* ncbytesextract(NCbytes*);
/* Return the ith byte; -1 if no such index */
EXTERNL int ncbytesget(NCbytes*,unsigned long);
/* Set the ith byte */
EXTERNL int ncbytesset(NCbytes*,unsigned long,char);
/* Append one byte */
EXTERNL int ncbytesappend(NCbytes*,char); /* Add at Tail */
/* Append n bytes */
EXTERNL int ncbytesappendn(NCbytes*,const void*,unsigned long); /* Add at Tail */
/* Null terminate the byte string without extending its length (for debugging) */
EXTERNL int ncbytesnull(NCbytes*);
/* Remove char at position i */
EXTERNL int ncbytesremove(NCbytes*,unsigned long);
/* Concatenate a null-terminated string to the end of the buffer */
EXTERNL int ncbytescat(NCbytes*,const char*);
/* Set the contents of the buffer; mark the buffer as non-extendible */
EXTERNL int ncbytessetcontents(NCbytes*, void*, unsigned long);
/* Following are always "in-lined"*/
#define ncbyteslength(bb) ((bb)!=NULL?(bb)->length:0)
#define ncbytesalloc(bb) ((bb)!=NULL?(bb)->alloc:0)
#define ncbytescontents(bb) (((bb)!=NULL && (bb)->content!=NULL)?(bb)->content:(char*)"")
#define ncbytesextend(bb,len) ncbytessetalloc((bb),(len)+(bb->alloc))
#define ncbytesclear(bb) ((bb)!=NULL?(bb)->length=0:0)
#define ncbytesavail(bb,n) ((bb)!=NULL?((bb)->alloc - (bb)->length) >= (n):0)
#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__) || defined(__CPLUSPLUS)
}
#endif
#endif /*NCBYTES_H*/