netcdf-c/oc2/ocutil.h
dmh f423f27693 Sync with oc project.
This supports better authorization
handling for DAP requests, especially redirection
based authorization. I also added a new test case
ncdap_tests/testauth.sh.

Specifically, suppose I have a netrc file /tmp/netrc
containing this.
    machine uat.urs.earthdata.nasa.gov login xxxxxx password yyyyyy
Also suppose I have a .ocrc file containing these lines
    HTTP.COOKIEJAR=/tmp/cookies
    HTTP.NETRC=/tmp/netrc
Assume that .ocrc is in the local directory or HOME.

Then this command should work (assuming a valid login and password).
    ncdump -h "https://54.86.135.31/opendap/data/nc/fnoc1.nc"
2014-12-24 10:22:47 -07:00

60 lines
1.8 KiB
C

/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc.
See the COPYRIGHT file for more information. */
#ifndef OCUTIL_H
#define OCUTIL_H 1
/* Forward */
struct OCstate;
#define ocmax(x,y) ((x) > (y) ? (x) : (y))
extern char* ocstrndup(const char* s, size_t len);
extern int ocstrncmp(const char* s1, const char* s2, size_t len);
extern int occopycat(char* dst, size_t size, size_t n, ...);
extern int occoncat(char* dst, size_t size, size_t n, ...);
extern size_t octypesize(OCtype etype);
extern char* octypetostring(OCtype octype);
extern char* octypetoddsstring(OCtype octype);
extern char* ocerrstring(int err);
extern OCerror ocsvcerrordata(struct OCstate*,char**,char**,long*);
extern OCerror octypeprint(OCtype etype, void* value, size_t bufsize, char* buf);
extern size_t xxdrsize(OCtype etype);
extern int oc_ispacked(OCnode* node);
extern size_t octotaldimsize(size_t,size_t*);
extern size_t ocarrayoffset(size_t rank, size_t*, size_t*);
extern void ocarrayindices(size_t index, size_t rank, size_t*, size_t*);
extern size_t ocedgeoffset(size_t rank, size_t*, size_t*);
extern int ocvalidateindices(size_t rank, size_t*, size_t*);
extern void ocmakedimlist(OClist* path, OClist* dims);
extern int ocfindbod(OCbytes* buffer, size_t*, size_t*);
/* Reclaimers*/
extern void ocfreeprojectionclause(OCprojectionclause* clause);
/* Misc. */
/* merge two envv style lists */
extern char** ocmerge(const char** list1, const char** list2);
extern int ocmktmp(const char* base, char** tmpnamep);
extern void ocdataddsmsg(struct OCstate*, struct OCtree*);
extern const char* ocdtmodestring(OCDT mode,int compact);
/* Define some classifiers */
#define ociscontainer(t) ((t) == OC_Dataset || (t) == OC_Structure || (t) == OC_Sequence || (t) == OC_Grid || (t) == OC_Attributeset)
#define ocisatomic(t) ((t) == OC_Atomic)
#endif /*UTIL_H*/