source: XIOS/dev/dev_olga/src/extern/src_netcdf4/ocinternal.h @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 5.2 KB
Line 
1/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc.
2   See the COPYRIGHT file for more information. */
3
4#ifndef OCINTERNAL_H
5#define OCINTERNAL_H
6
7#include "config.h"
8
9#ifdef _AIX
10#include <netinet/in.h>
11#endif
12
13#include <stdlib.h>
14#include <assert.h>
15#include <string.h>
16#ifndef WIN32
17#include <strings.h>
18#endif
19#include <stdarg.h>
20#ifdef HAVE_UNISTD_H
21#include <unistd.h>
22#endif
23#ifdef HAVE_SYS_TYPES_H
24#include <sys/types.h>
25#endif
26
27#define CURL_DISABLE_TYPECHECK 1
28#include <curl/curl.h>
29
30#include "oclist.h"
31#include "ocbytes.h"
32#include "ocuri.h"
33
34#define OCCACHEPOS
35
36#include "oc.h"
37#include "ocdatatypes.h"
38#include "occonstraints.h"
39#include "ocnode.h"
40#include "ocutil.h"
41#include "oclog.h"
42#include "xxdr.h"
43#include "ocdata.h"
44
45#ifndef nulldup
46#define nulldup(s) (s==NULL?NULL:strdup(s))
47#endif
48
49#define nullstring(s) (s==NULL?"(null)":s)
50#define PATHSEPARATOR "."
51
52/* Default initial memory packet size */
53#define DFALTPACKETSIZE 0x20000 /*approximately 100k bytes*/
54
55/* Default maximum memory packet size */
56#define DFALTMAXPACKETSIZE 0x3000000 /*approximately 50M bytes*/
57
58/* Extend the OCdxd type */
59#define OCVER 3
60
61/* Define a magic number to mark externally visible oc objects */
62#define OCMAGIC ((unsigned int)0x0c0c0c0c) /*clever, huh?*/
63
64/*! Specifies the OCstate. */
65typedef struct OCstate
66{
67    unsigned int magic; /* Mark each structure type */
68    CURL* curl; /* curl handle*/
69    OClist* trees; /* list<OCnode*> ; all root objects */
70    OCURI* uri; /* base URI*/
71    OCbytes* packet; /* shared by all trees during construction */
72    /* OCContent information */
73    struct OCcontent* contentlist;
74    struct OCerrdata {/* Hold info for an error return from server */
75        char* code;
76        char* message;
77        long  httpcode;
78        char  curlerrorbuf[CURL_ERROR_SIZE]; /* to get curl error message */
79    } error;
80    /* Store .rc file info */
81    struct OCcurlflags {
82        int compress;
83        int verbose;
84        int timeout;
85        int followlocation;
86        int maxredirs;
87        char* useragent;
88        char* cookiejar;
89        char* cookiefile;
90    } curlflags;
91    struct OCSSL {
92        int   validate;
93        char* certificate;
94        char* key;
95        char* keypasswd;
96        char* cainfo; /* certificate authority */
97        char* capath; 
98        int   verifypeer;
99    } ssl;
100    struct OCproxy {
101        char *host;
102        int port;
103    } proxy;
104    struct OCcredentials {
105        char *username;
106        char *password;
107    } creds;
108    long ddslastmodified;
109    long datalastmodified;
110} OCstate;
111
112
113/*! Specifies all the info about a particular DAP tree
114    i.e. DAS, DDS, or DATADDS as obtained from a fetch response
115    This is associated with the root object.
116*/
117typedef struct OCtree
118{
119    OCdxd  dxdclass;
120    char* constraint;
121    char* text;
122    struct OCnode* root; /* cross link */
123    struct OCstate* state; /* cross link */
124    OClist* nodes; /* all nodes in tree*/
125    /* when dxdclass == OCDATADDS */
126    struct {
127        char* memory;           /* allocated memory if OC_INMEMORY is set */
128        char* filename;
129        FILE* file;
130        unsigned long datasize; /* xdr size on disk or in memory */
131        unsigned long bod;      /* offset of the beginning of packet data */
132        unsigned long ddslen;   /* length of ddslen (assert(ddslen <= bod)) */
133        XXDR* xdrs;             /* access either memory or file */
134    } data;
135} OCtree;
136
137/* (Almost) All shared procedure definitions are kept here
138   except for: ocdebug.h ocutil.h
139   The true external interface is defined in oc.h
140*/
141
142/* Location: ocnode.c */
143extern OCnode* ocmakenode(char* name, OCtype ptype, OCnode* root);
144extern void occollectpathtonode(OCnode* node, OClist* path);
145extern void occomputefullnames(OCnode* root);
146extern void occomputesemantics(OClist*);
147extern void ocaddattribute(OCattribute* attr, OCnode* parent);
148extern OCattribute* ocmakeattribute(char* name, OCtype ptype, OClist* values);
149extern size_t ocsetsize(OCnode* node);
150extern OCerror occorrelate(OCnode*,OCnode*);
151extern OCerror occomputeskipdata(OCstate*, OCnode*);
152extern void ocmarkcacheable(OCstate* state, OCnode* ddsroot);
153
154/* Location: dapparselex.c*/
155extern int dapdebug;
156extern OCerror DAPparse(OCstate*, struct OCtree*, char*);
157extern char* dimnameanon(char* basename, unsigned int index);
158
159/* Location: ceparselex.c*/
160extern int cedebug;
161extern OClist* CEparse(OCstate*,char* input);
162
163/* Location: ocinternal.c*/
164extern OCerror ocopen(OCstate** statep, const char* url);
165extern void occlose(OCstate* state);
166
167extern OCerror ocfetchf(OCstate*, const char*, OCdxd, OCflags, OCnode**);
168
169/* Location: ocinternal.c */
170extern int oc_network_order;
171extern int oc_invert_xdr_double;
172extern int ocinternalinitialize(void);
173
174/* Location: ocnode.c */
175extern void ocfreetree(OCtree* tree);
176extern void ocfreeroot(OCnode* root);
177extern void ocfreenodes(OClist*);
178
179extern void ocddsclear(struct OCstate*);
180extern void ocdasclear(struct OCstate*);
181extern void ocdataddsclear(struct OCstate*);
182extern void* oclinearize(OCtype etype, unsigned int, char**);
183
184/* Merge DAS with DDS or DATADDS*/
185extern int ocddsdasmerge(struct OCstate*, OCnode* das, OCnode* dds);
186
187extern OCerror ocupdatelastmodifieddata(OCstate* state);
188
189extern int ocinternalinitialize(void);
190
191
192extern OCerror ocsetrcfile(char* rcfile);
193
194/* Global stateflags */
195extern int oc_curl_file_supported;
196extern int oc_curl_https_supported;
197
198#endif /*COMMON_H*/
Note: See TracBrowser for help on using the repository browser.