libdap Updated for version 3.20.11
libdap4 is an implementation of OPeNDAP's DAP protocol.
HTTPCacheMacros.h
1/*
2 * HTTPCacheMacros.h
3 *
4 * Created on: Dec 28, 2011
5 * Author: jimg
6 */
7
8#ifndef HTTPCACHEMACROS_H_
9#define HTTPCACHEMACROS_H_
10
11#ifdef WIN32
12#include <direct.h>
13#include <time.h>
14#include <fcntl.h>
15#define MKDIR(a,b) _mkdir((a))
16#define UMASK(a) _umask((a))
17
18#if 0
19#define REMOVE(a) do { \
20 int s = remove((a)); \
21 if (s != 0) \
22 throw InternalErr(__FILE__, __LINE__, "Cache error; could not remove file: " + long_to_string(s)); \
23 } while(0)
24#endif
25
26#define REMOVE_BOOL(a) remove((a))
27#define REMOVE(a) ((void)remove((a)))
28#define MKSTEMP(a) _open(_mktemp((a)),_O_CREAT,_S_IREAD|_S_IWRITE)
29#define DIR_SEPARATOR_CHAR '\\'
30#define DIR_SEPARATOR_STR "\\"
31
32#else
33#include <cerrno>
34#define MKDIR(a,b) mkdir((a), (b))
35#define UMASK(a) umask((a))
36
37#if 0
38// Replaced this with something that signals errors. jhrg 12/28/2011
39// A great idea, but it breaks things in ways that complicate
40// testing. Push this change forward to H 1.9. jhrg 12/28/2011
41#define REMOVE(a) do { \
42 errno = 0; \
43 int s = remove((a)); \
44 if (s != 0) \
45 throw InternalErr(__FILE__, __LINE__, "Cache error; could not remove file: " + long_to_string(errno)); \
46 } while(0)
47#endif
48
49#define REMOVE_BOOL(a) remove((a))
50#define REMOVE(a) ((void)remove((a)))
51
52#define MKSTEMP(a) mkstemp((a))
53#define DIR_SEPARATOR_CHAR '/'
54#define DIR_SEPARATOR_STR "/"
55#endif
56
57#ifdef WIN32
58#define CACHE_LOCATION "\\tmp\\"
59#define CACHE_ROOT "dods-cache\\"
60#else
61#define CACHE_LOCATION "/tmp/"
62#define CACHE_ROOT "dods-cache/"
63#endif
64
65#define CACHE_INDEX ".index"
66#define CACHE_LOCK ".lock"
67#define CACHE_META ".meta"
68#define CACHE_EMPTY_ETAG "@cache@"
69
70
71#endif /* HTTPCACHEMACROS_H_ */