2017-03-09 08:01:10 +08:00
|
|
|
/*********************************************************************
|
2018-12-07 05:13:56 +08:00
|
|
|
* Copyright 2018, UCAR/Unidata
|
2017-03-09 08:01:10 +08:00
|
|
|
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#ifndef NCDAP_H
|
|
|
|
#define NCDAP_H 1
|
|
|
|
|
|
|
|
#ifndef nullfree
|
|
|
|
#define nullfree(m) {if((m)!=NULL) {free(m);} else {}}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
/*
|
|
|
|
Collect single bit flags that
|
|
|
|
affect the operation of the system.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef unsigned int NCFLAGS;
|
2018-09-05 01:27:47 +08:00
|
|
|
# define SETFLAG(controls,flag) (((controls).flags) |= (flag))
|
|
|
|
# define CLRFLAG(controls,flag) (((controls).flags) &= ~(flag))
|
2017-03-09 08:01:10 +08:00
|
|
|
# define FLAGSET(controls,flag) (((controls.flags) & (flag)) != 0)
|
|
|
|
|
|
|
|
/* Defined flags */
|
|
|
|
#define NCF_NC3 (0x0001) /* DAP->netcdf-3 */
|
|
|
|
#define NCF_NC4 (0x0002) /* DAP->netcdf-4 */
|
|
|
|
#define NCF_NCDAP (0x0004) /* Do libnc-dap mimic */
|
|
|
|
#define NCF_CACHE (0x0008) /* Cache enabled/disabled */
|
|
|
|
#define NCF_UPGRADE (0x0010) /* Do proper type upgrades */
|
|
|
|
#define NCF_UNCONSTRAINABLE (0x0020) /* Not a constrainable URL */
|
|
|
|
#define NCF_SHOWFETCH (0x0040) /* show fetch calls */
|
|
|
|
#define NCF_ONDISK (0x0080) /* cause oc to store data on disk */
|
|
|
|
#define NCF_WHOLEVAR (0x0100) /* retrieve only whole variables (as opposed to partial variable) into cache */
|
|
|
|
#define NCF_PREFETCH (0x0200) /* Cache prefetch enabled/disabled */
|
|
|
|
#define NCF_PREFETCH_EAGER (0x0400) /* Do eager prefetch; 0=>lazy */
|
|
|
|
#define NCF_PREFETCH_ALL (0x0800) /* Prefetch all variables */
|
2018-10-02 05:51:43 +08:00
|
|
|
/* Allow _FillValue/Variable type mismatch */
|
|
|
|
#define NCF_FILLMISMATCH (0x1000)
|
Yet another fix for DAP2 double URL encoding.
re: https://github.com/Unidata/netcdf-c/issues/1876
and: https://github.com/Unidata/netcdf-c/pull/1835
and: https://github.com/Unidata/netcdf4-python/issues/1041
The change in PR 1835 was correct with respect to using %20 instead of '+'
for encoding blanks. However, it was a mistake to assume everything was
unencoded and then to do encoding ourselves. The problem is that
different servers do different things, with Columbia being an outlier.
So, I have added a set of client controls that can at least give
the caller some control over this. The caller can append
the following fragment to his URL to control what gets encoded before
sending it to the server. The syntax is as follows:
````
https://<host>/<path>/<query>#encode=path|query|all|none
````
The possible values:
* path -- URL encode (i.e. %xx encode) as needed in the path part of the URL.
* query -- URL encode as needed in the query part of the URL.
* all -- equivalent to ````#encode=path,query````.
* none -- do not url encode any part of the URL sent to the server; not strictly necessary, so mostly for completeness.
Note that if "encode=" is used, then before it is processed, all encoding
is turned of so that ````#encode=path```` will only encode the path
and not the query.
The default is ````#encode=query````, so the path is left untouched,
but the query is always encoded.
Internally, this required changes to pass the encode flags down into
the OC2 library.
Misc. Unrelated Changes:
* Shut up those irritating warning from putget.m4
2020-11-06 02:04:56 +08:00
|
|
|
/* Hack to control URL encoding */
|
|
|
|
#define NCF_ENCODE_PATH (0x2000)
|
|
|
|
#define NCF_ENCODE_QUERY (0x4000)
|
2017-03-09 08:01:10 +08:00
|
|
|
/*COLUMBIA_HACK*/
|
|
|
|
#define NCF_COLUMBIA (0x80000000) /* Hack for columbia server */
|
|
|
|
|
|
|
|
/* Define all the default on flags */
|
2021-01-08 04:17:53 +08:00
|
|
|
#define DFALT_ON_FLAGS (NCF_CACHE|NCF_PREFETCH|NCF_FILLMISMATCH)
|
2017-03-09 08:01:10 +08:00
|
|
|
|
|
|
|
typedef struct NCCONTROLS {
|
|
|
|
NCFLAGS flags;
|
|
|
|
} NCCONTROLS;
|
|
|
|
|
|
|
|
/* Misc. Constants */
|
|
|
|
|
|
|
|
#ifndef DFALTPACKETSIZE
|
|
|
|
#define DFALTPACKETSIZE 0x20000 /*approximately 100k bytes*/
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef DFALTUSERAGENT
|
|
|
|
#define DFALTUSERAGENT "netCDF"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /*NCDAP_H*/
|
|
|
|
|