netcdf-c/libdap4/d4util.h
Dennis Heimbigner 591e6b2f6d Fix DAP4 remotetest server
Warning: This PR is a follow on to PR https://github.com/Unidata/netcdf-c/pull/2555 and should not be merged until that prior PR has been merged. The changeset for this PR is a delta on the PR https://github.com/Unidata/netcdf-c/pull/2555.

This PR re-enables the use of the server *remotetest.unidata.ucar.edu/d4ts*
to test several features:
1. Show that access over the Internet to servers using the DAP4 protocol works.
2. Test that DAP4 support in the [Thredds Data Server](https://github.com/Unidata/tds) is operating correctly.
4. Test that the DAP4 support in the [netcdf-java library](https://github.com/Unidata/netcdf-java) library and the DAP4 support in the netcdf-c library are consistent and are interoperable.

The test inputs (primarily *\*.nc* files) provided in the netcdf-c library
are also used by the DAP4 Test Server (aka d4ts) to present web access to a
collection of data files accessible via the DAP4 protocol and which can be
used for testing Internet access to a working server.

To be precise, this version of d4ts is currently in unmerged branches
of the *netcdf-java* and *tds* Github repositories and so are not actually
in the main repositories *yet*. However, the *d4ts.war* file was created
from that branch and used to populate the *remotetest.unidata.ucar.edu*
server

The two other remote servers that were used in the past are *Hyrax* (OPenDAP.org)
and *thredds-test*. These will continue to remain disabled until
those servers can be fixed.

## Primary Changes

* Rebuild the *baselineremote* directory. This directory contains the validation data needed to test the remote servers.
* Re-enable using remotetest.unidata.ucar.edu as part of the DAP4 testing process.
* Fix the *dap4_test/test_remote.sh* test script to match the current available test data.
* Make some changes to libdap4 to improve the ability to catch malformed data streams [affects a lot of files in libdap4].

## Misc. Unrelated Changes

* Remove a raft of warnings, especially in nc_test4/tst_quantize.c.
* Add some additional explanatory information to the NCZarr documentation.
* Cleanup some Doxygen errors in the docs file and reorder some files.
2022-11-15 20:29:21 -07:00

85 lines
2.4 KiB
C

/*********************************************************************
* Copyright 2018, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
*********************************************************************/
#ifndef D4UTIL_H
#define D4UTIL_H 1
#ifdef HAVE_MEMMOVE
#define d4memmove(dst,src,n) memmove(dst,src,n)
#else
#define d4memmove(dst,src,n) localmemmove(dst,src,n)
#endif
/* This is intended to be big enough to work as
an offset/position/size for a file or a memory block.
*/
typedef unsigned long long d4size_t;
/* Define a counted memory marker */
typedef struct D4blob {d4size_t size; void* memory;} D4blob;
#define OFFSET2BLOB(blob,offset) do{(blob).size = ((offset)->limit - (offset)->base); (blob).memory = (offset)->base; }while(0)
#define BLOB2OFFSET(offset,blob) do{\
(offset)->base = (blob).memory; \
(offset)->limit = ((char*)(blob).memory) + (blob).size; \
(offset)->offset = (offset)->base; \
} while(0)
/**************************************************/
/* signature: void swapinline16(void* ip) */
#define swapinline16(ip) \
{ \
char b[2]; \
char* src = (char*)(ip); \
b[0] = src[1]; \
b[1] = src[0]; \
memcpy(ip, b, 2); \
}
/* signature: void swapinline32(void* ip) */
#define swapinline32(ip) \
{ \
char b[4]; \
char* src = (char*)(ip); \
b[0] = src[3]; \
b[1] = src[2]; \
b[2] = src[1]; \
b[3] = src[0]; \
memcpy(ip, b, 4); \
}
/* signature: void swapinline64(void* ip) */
#define swapinline64(ip) \
{ \
char b[8]; \
char* src = (char*)(ip); \
b[0] = src[7]; \
b[1] = src[6]; \
b[2] = src[5]; \
b[3] = src[4]; \
b[4] = src[3]; \
b[5] = src[2]; \
b[6] = src[1]; \
b[7] = src[0]; \
memcpy(ip, b, 8); \
}
/***************************************************/
/* Define the NCD4node.data.flags */
#define HASNIL (0) /* no flags set */
#define HASSEQ (1) /* transitively contains sequence(s)*/
#define HASSTR (2) /* transitively contains strings */
#define HASOPFIX (4) /* transitively contains fixed size opaques */
#define HASOPVAR (8) /* transitively contains variable size opaques */
#define LEAFSEQ (16) /* mark leaf sequences */
#define HASANY (HASNIL|HASSEQ|HASSTR|HASOPTFIX|HASOPVAR)
/***************************************************/
extern int ncd4__testurl(const char* parth, char** basename);
#endif /*D4UTIL_H*/