Commit bab9407b8edfb0e773f7f865e632b13679b4d95b
1 parent
58faca3f
Exists in
master
and in
10 other branches
DDClient is now an external project
Showing
24 changed files
with
61 additions
and
2015 deletions
Show diff stats
CMakeLists.txt
@@ -25,9 +25,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") | @@ -25,9 +25,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") | ||
25 | find_package( Threads REQUIRED ) | 25 | find_package( Threads REQUIRED ) |
26 | find_package( CRYPT REQUIRED ) | 26 | find_package( CRYPT REQUIRED ) |
27 | find_package( NetCDF REQUIRED ) | 27 | find_package( NetCDF REQUIRED ) |
28 | +find_package( DDClient REQUIRED ) | ||
28 | find_package( CDF REQUIRED ) | 29 | find_package( CDF REQUIRED ) |
29 | 30 | ||
30 | get_filename_component(NETCDFLIB_DIR ${NETCDFLIBRARIES} PATH) | 31 | get_filename_component(NETCDFLIB_DIR ${NETCDFLIBRARIES} PATH) |
32 | +get_filename_component(DDCLIENTLIB_DIR ${DDCLIENTLIBRARIES} PATH) | ||
31 | 33 | ||
32 | configure_file ( | 34 | configure_file ( |
33 | "${CMAKE_SOURCE_DIR}/scripts/StartServer.in" | 35 | "${CMAKE_SOURCE_DIR}/scripts/StartServer.in" |
@@ -35,7 +37,6 @@ configure_file ( | @@ -35,7 +37,6 @@ configure_file ( | ||
35 | ) | 37 | ) |
36 | 38 | ||
37 | MESSAGE( STATUS "Build DD_Server Project" ) | 39 | MESSAGE( STATUS "Build DD_Server Project" ) |
38 | -add_subdirectory(src/CLIENT) | ||
39 | add_subdirectory(src/SERVER) | 40 | add_subdirectory(src/SERVER) |
40 | add_subdirectory(src/DECODERS/ascii2nc) | 41 | add_subdirectory(src/DECODERS/ascii2nc) |
41 | add_subdirectory(src/DECODERS/cdf2nc) | 42 | add_subdirectory(src/DECODERS/cdf2nc) |
@@ -50,7 +51,6 @@ add_subdirectory(src/TIMESUPDATENODATA) | @@ -50,7 +51,6 @@ add_subdirectory(src/TIMESUPDATENODATA) | ||
50 | add_subdirectory(tests) | 51 | add_subdirectory(tests) |
51 | 52 | ||
52 | install(FILES "scripts/StartServer" DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | 53 | install(FILES "scripts/StartServer" DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) |
53 | -install(DIRECTORY "src/INCLUDE/" DESTINATION include) | ||
54 | install(DIRECTORY "src/CALLEXT/" DESTINATION bin/CALLEXT) | 54 | install(DIRECTORY "src/CALLEXT/" DESTINATION bin/CALLEXT) |
55 | 55 | ||
56 | SET(CMAKE_VERBOSE_MAKEFILE ON) | 56 | SET(CMAKE_VERBOSE_MAKEFILE ON) |
README
1 | 1. Set NETCDF_ROOT to use a specific netcdf installation directory : | 1 | 1. Set NETCDF_ROOT to use a specific netcdf installation directory : |
2 | > export NETCDF_ROOT="/usr/lib/" | 2 | > export NETCDF_ROOT="/usr/lib/" |
3 | 3 | ||
4 | -2. Make the build directory : | 4 | +2. Set DDCLIENT_ROOT to define DDClient installation directory : |
5 | +> export DDCLIENT_ROOT="/home/benjamin/DDClient/" | ||
6 | + | ||
7 | +3. Make the build directory : | ||
5 | > cmake -E make_directory build | 8 | > cmake -E make_directory build |
6 | 9 | ||
7 | -3. Configure the build. Set CMAKE_BUILD_TYPE to Debug or Release to configure the build type. Set CMAKE_INSTALL_PREFIX to configure the install directory : | 10 | +4. Configure the build. Set CMAKE_BUILD_TYPE to Debug or Release to configure the build type. Set CMAKE_INSTALL_PREFIX to configure the install directory : |
8 | > cmake -E chdir build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/benjamin/DDServer .. | 11 | > cmake -E chdir build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/benjamin/DDServer .. |
9 | 12 | ||
10 | -4. Build DDServer : | 13 | +5. Build DDServer : |
11 | > cmake --build build | 14 | > cmake --build build |
12 | 15 | ||
13 | -5. Install DDServer : | 16 | +6. Install DDServer : |
14 | > make -C build install VERBOSE=1 | 17 | > make -C build install VERBOSE=1 |
15 | 18 | ||
16 | -6. Configure DDServer : | 19 | +7. Configure DDServer : |
17 | In the install directory, open "StartServer" and set DDPATH and DDBASE. | 20 | In the install directory, open "StartServer" and set DDPATH and DDBASE. |
18 | 21 | ||
19 | -7. Run DDServer: | 22 | +8. Run DDServer: |
20 | > ./StartServer | 23 | > ./StartServer |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +FIND_PATH(DDCLIENTINCLUDE_DIR DD.h | ||
2 | + HINTS | ||
3 | + $ENV{DDCLIENT_ROOT}/include/DDClientLibC | ||
4 | + ${DDCLIENT_ROOT}/include/DDClientLibC | ||
5 | +) | ||
6 | +mark_as_advanced(DDCLIENTINCLUDE_DIR) | ||
7 | + | ||
8 | +find_library(DDCLIENTLIBRARY | ||
9 | + NAMES DDClientLibC | ||
10 | + HINTS | ||
11 | + $ENV{DDCLIENT_ROOT} | ||
12 | + ${DDCLIENT_ROOT} | ||
13 | + PATH_SUFFIXES lib | ||
14 | +) | ||
15 | +mark_as_advanced(DDCLIENTLIBRARY) | ||
16 | + | ||
17 | +include(FindPackageHandleStandardArgs) | ||
18 | +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DDClient DEFAULT_MSG DDCLIENTLIBRARY DDCLIENTINCLUDE_DIR) | ||
19 | + | ||
20 | +if(DDCLIENT_FOUND) | ||
21 | + set(DDCLIENTINCLUDE_DIRS ${DDCLIENTINCLUDE_DIR}) | ||
22 | + set(DDCLIENTLIBRARIES ${DDCLIENTLIBRARY}) | ||
23 | +endif() | ||
24 | + |
scripts/StartServer.in
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | #------------------------------------------------------------------- | 4 | #------------------------------------------------------------------- |
5 | DDBASE=/home/budnik/AMDA-NG.core/DDBASE/DATA | 5 | DDBASE=/home/budnik/AMDA-NG.core/DDBASE/DATA |
6 | DDPATH=/home/budnik/AMDA-NG.core/DDBASE | 6 | DDPATH=/home/budnik/AMDA-NG.core/DDBASE |
7 | -DDLIB=@CMAKE_INSTALL_PREFIX@/lib | 7 | +DDLIB=@DDCLIENTLIB_DIR@ |
8 | DDBASEBIN=@CMAKE_INSTALL_PREFIX@/bin | 8 | DDBASEBIN=@CMAKE_INSTALL_PREFIX@/bin |
9 | LD_LIBRARY_PATH=$DDLIB/:@NETCDFLIB_DIR@:@libcdf_LIBRARY_DIR@:@USRLIB_DIR@ | 9 | LD_LIBRARY_PATH=$DDLIB/:@NETCDFLIB_DIR@:@libcdf_LIBRARY_DIR@:@USRLIB_DIR@ |
10 | export DDBASE DDPATH DDBASEBIN DDLIB LD_LIBRARY_PATH | 10 | export DDBASE DDPATH DDBASEBIN DDLIB LD_LIBRARY_PATH |
src/CLIENT/CMakeLists.txt deleted
@@ -1,22 +0,0 @@ | @@ -1,22 +0,0 @@ | ||
1 | - | ||
2 | -PROJECT(DD_Client) | ||
3 | - | ||
4 | -include_directories( | ||
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | ||
6 | -) | ||
7 | - | ||
8 | -#Library configuration | ||
9 | -file( | ||
10 | - GLOB_RECURSE | ||
11 | - source_files | ||
12 | - ./* | ||
13 | -) | ||
14 | - | ||
15 | -ADD_LIBRARY( DD_Client SHARED ${source_files} ) | ||
16 | - | ||
17 | -target_link_libraries( | ||
18 | - DD_Client | ||
19 | - ${CMAKE_THREAD_LIBS_INIT} | ||
20 | -) | ||
21 | - | ||
22 | -install (TARGETS DD_Client DESTINATION lib) |
src/CLIENT/DD_client.c deleted
@@ -1,931 +0,0 @@ | @@ -1,931 +0,0 @@ | ||
1 | -/* $Id: DD_client.c,v 1.4 2012/10/18 09:25:58 budnik Exp $ */ | ||
2 | -/*============================================================== | ||
3 | - * DD SYSTEM | ||
4 | - * DD_client.c | ||
5 | - * V.6.0 | ||
6 | - * List of changes: | ||
7 | - * November 1995, Version 1.0 | ||
8 | - * August 1999 :Access security system was installed by Alexandr Grigoriev (v3.0) | ||
9 | - * October 22, 2002 - Communication ideology is changed (V.4.0) | ||
10 | - * Oct 29, 2002 - Add DD_GetVersion() and some bags are corrected (V.4.1) | ||
11 | - * May 1, 2003 - Network error is developped. (The header receiving is changed): V.4.2 | ||
12 | - * Nov 18, 2004 - Cach error is fixed. | ||
13 | - * Jun 17, 2007 - Fedorov, V.4.5 Create new VI and Update data requests | ||
14 | - * Sep 24, 2007 - Fedorov, V.4.6 Processing of return of Get_Data | ||
15 | - * Dec 03, 2007 - Budnik, V.4.7 There may be several sessions with DD Server inside ONE | ||
16 | - * Client session. Keep UserHost & UserName | ||
17 | - * Oct 18, 2012 - Knizhnikova, V.4.8 new DD_SetTimeInfo() function | ||
18 | - * Dec 15, 2012 - Fedorov, V.6.0. DD_GetMultiData(). Request structure is very changed, CurrentData is not a global structure | ||
19 | - *===============================================================*/ | ||
20 | - | ||
21 | -#include <unistd.h> | ||
22 | -#include "DD.h" | ||
23 | -#include "DD_comm.h" | ||
24 | -#include "DD_Access.h" | ||
25 | -#include <stdio.h> | ||
26 | -#include <string.h> | ||
27 | - | ||
28 | -#define VERSION "V.6.0" | ||
29 | - | ||
30 | -/*------------------ GLOBAL STATIC VARIABLES --------------------------*/ | ||
31 | -int SocketID = -1; /* Global socket id for this communication session */ | ||
32 | -char UserName[USRLENGTH]="\0"; /* string for user name */ | ||
33 | -char UserHost[MAXHOSTLENGTH] = "\0"; /* IP of user's host in a string form */ | ||
34 | -int UserID; /* ID of user at the user's host */ | ||
35 | -extern int errno; | ||
36 | - | ||
37 | -/*================== FUNCTIONS =================================*/ | ||
38 | -/*----------------------- GET User Host-------------------------------*/ | ||
39 | -int GetUserHost() | ||
40 | -{ | ||
41 | - char HostName[HOSTNAMELENGTH]; | ||
42 | - struct hostent *Host; | ||
43 | - unsigned int HostAddress; | ||
44 | - int userid; | ||
45 | - static unsigned int m1 = 0X000000FF; | ||
46 | - static unsigned int m2 = 0X0000FF00; | ||
47 | - static unsigned int m3 = 0X00FF0000; | ||
48 | - static unsigned int m4 = 0XFF000000; | ||
49 | - unsigned int b1,b2,b3,b4; | ||
50 | - | ||
51 | - userid = getuid(); /* Get a client user ID */ | ||
52 | - | ||
53 | -/* UserHost can be set by extern WEB function in case of WEB communicatio, | ||
54 | - * or it should be defined as local host if DD_client is installed at USER | ||
55 | - * computer | ||
56 | - */ | ||
57 | - if(UserHost[0] == '\0') | ||
58 | - { | ||
59 | - gethostname(HostName,HOSTNAMELENGTH); /* Get a client host name */ | ||
60 | - | ||
61 | - if((Host = gethostbyname(HostName)) == NULL) return NOHOST; | ||
62 | - HostAddress = *((unsigned int *)Host->h_addr_list[0]); | ||
63 | - | ||
64 | - b1 = HostAddress & m1; | ||
65 | - b2 = (HostAddress & m2) >> 8; | ||
66 | - b3 = (HostAddress & m3) >> 16; | ||
67 | - b4 = (HostAddress & m4) >> 24; | ||
68 | - | ||
69 | - sprintf(UserHost,"%03u.%03u.%03u.%03u\0",b1,b2,b3,b4); | ||
70 | - } | ||
71 | - return userid; | ||
72 | -} | ||
73 | -/*-------------------------------------------------------------------*/ | ||
74 | - | ||
75 | -/*------------------ MAKE_CONNECTION ---------------------------*/ | ||
76 | -/* | ||
77 | - * The function returns opened socket, ready to read and write | ||
78 | - */ | ||
79 | -int GetSocket() | ||
80 | -/* | ||
81 | - * Connect with remote server, and returns socket ID | ||
82 | - * In case of error return error number according DD_comm.h | ||
83 | - */ | ||
84 | -{ | ||
85 | -/*-------- Variables for resource file -----------------*/ | ||
86 | - char rname[PATHLENGTH]; /* name of res file */ | ||
87 | - char line[PATHLENGTH]; | ||
88 | - char *path; | ||
89 | - FILE *resfile; /* resource file */ | ||
90 | - char *pline; | ||
91 | - | ||
92 | -/*---------- Variables for network ---------------------*/ | ||
93 | - static struct hostent *Host; /* name & internet (32b) address for | ||
94 | - remout hosts (see netdb.h) */ | ||
95 | - static char RemSerName[PATHLENGTH]; /* name of remote server */ | ||
96 | - | ||
97 | - struct servent *serv; /* pointer to static structure of | ||
98 | - port number of registrated service */ | ||
99 | - | ||
100 | - static struct sockaddr_in IntAFAddr; /* structure of internet address of type AF_INET | ||
101 | - see <netinet/in.h> | ||
102 | - to get name of socket we should | ||
103 | - to convert pointer to this structure | ||
104 | - to pointer to "srtruct sockaddr" where | ||
105 | - all fields are "char array". */ | ||
106 | - | ||
107 | - int AFAddrLen = sizeof(struct sockaddr_in); /* size of internet address, <netinet/in.h> 18 bytes*/ | ||
108 | - int ScAddrLen = sizeof(struct sockaddr); /* size of socket address, <sys/socket.h> 18 bytes*/ | ||
109 | - | ||
110 | - int cc,i; | ||
111 | - int arg = 0; | ||
112 | - int normaddr; | ||
113 | -/* | ||
114 | - *---------- Getting socket and its address ---------------------*/ | ||
115 | -/*---------------- HOST and PORT ------------------------------*/ | ||
116 | - if((path = getenv("DDPATH")) == NULL) | ||
117 | - { | ||
118 | - strcpy(rname,"DD.res"); | ||
119 | - } | ||
120 | - else | ||
121 | - { | ||
122 | - strcpy(rname,path); | ||
123 | - strcat(rname, "/DD.res"); | ||
124 | - } | ||
125 | -/* | ||
126 | - (void *)strcpy(rname,"./DD.res"); | ||
127 | -*/ | ||
128 | - if((resfile = fopen(rname,"r")) == NULL) | ||
129 | - { | ||
130 | - fprintf(stderr,"No resource file, sorry\n"); | ||
131 | - exit(1); | ||
132 | - } | ||
133 | - | ||
134 | - pline = fgets(RemSerName, PATHLENGTH-1, resfile); | ||
135 | - pline = fgets(line, PATHLENGTH-1, resfile); | ||
136 | - fclose(resfile); | ||
137 | - | ||
138 | - RemSerName[strlen(RemSerName)-1] = '\0'; | ||
139 | - sscanf(line,"%d",&(normaddr)); | ||
140 | - | ||
141 | - IntAFAddr.sin_port = htons((uint16_t)normaddr); /* Conversion of the port number to | ||
142 | - universal net form */ | ||
143 | -/*---------------- END of FILE READING --------------------------*/ | ||
144 | -/* | ||
145 | - *------- Trying to open socket with this address and name --------- | ||
146 | - */ | ||
147 | - if((Host = gethostbyname(RemSerName)) == NULL) /* Get address and other information by | ||
148 | - host name, see netdb.h */ | ||
149 | - { | ||
150 | - fprintf(stderr,"Server %s not found\n",RemSerName); | ||
151 | - return(-1); | ||
152 | - } | ||
153 | - | ||
154 | - if((SocketID = socket(AF_INET,SOCK_STREAM,PROTOCOL)) < 0) | ||
155 | - { | ||
156 | - perror("Socket:"); return(-1); | ||
157 | - } | ||
158 | - | ||
159 | -/* Filling full internet address for socket "name" | ||
160 | - * this address will be used to get communication point */ | ||
161 | - | ||
162 | - IntAFAddr.sin_family = Host->h_addrtype; | ||
163 | - memcpy(&IntAFAddr.sin_addr.s_addr,Host->h_addr_list[0],Host->h_length); | ||
164 | - | ||
165 | - /* Connection to server socket on remote computer */ | ||
166 | - if(connect(SocketID,(struct sockaddr *)&IntAFAddr,AFAddrLen) < 0) | ||
167 | - { perror("connect"); return(-1); } | ||
168 | - | ||
169 | -/* | ||
170 | - * Get Host name and Host ID for security application | ||
171 | - */ | ||
172 | - if((UserID = GetUserHost()) < 0) return(NOHOST); | ||
173 | - | ||
174 | - return SocketID; | ||
175 | -} | ||
176 | -/*------------------- end of GetSocket ---------------------*/ | ||
177 | - | ||
178 | -/*==================== Receive From Net ======================*/ | ||
179 | -/* | ||
180 | - * Smart buffered receiver | ||
181 | - */ | ||
182 | -int ReceiveFromNet(char *buf, int PacketSize) | ||
183 | -{ | ||
184 | - int CurLength = 0; | ||
185 | - int i,cc; | ||
186 | - do | ||
187 | - { | ||
188 | - i = 0; | ||
189 | - while(((cc = recv(SocketID,buf+ CurLength,PacketSize - CurLength,0)) < 0) && (i < TRY)) i++; | ||
190 | - if(cc < 0) return -1; | ||
191 | - CurLength = CurLength + cc; | ||
192 | - } while(CurLength < PacketSize); | ||
193 | - return 1; | ||
194 | -} | ||
195 | - | ||
196 | -/*------------------ Open Virtual Instrument -----------------------*/ | ||
197 | -/* | ||
198 | - * If no connection, connect to server, then try to order data set and return | ||
199 | - * ID if OK or ErrorNumber if not | ||
200 | - */ | ||
201 | -int DD_SetVariable(char *InstrName) | ||
202 | -{ | ||
203 | - static caddr_t buff = NULL; | ||
204 | - static XDR xdrs; | ||
205 | - int InstrID; /* Instrumnet ID to return */ | ||
206 | - int cc,i; | ||
207 | - int Request = OPENINSREQ; | ||
208 | - int hostlen,userlen; | ||
209 | - char *PUserHost = UserHost, *PUserName = UserName; | ||
210 | - /* We need this because XDR works with adresses of pointers */ | ||
211 | - | ||
212 | -/* If there is no connection, try to get it */ | ||
213 | - if(SocketID < 0) | ||
214 | - if((SocketID = GetSocket()) < 0) return(NOCONNECTION); | ||
215 | - | ||
216 | -/* Encoding request by XDR to buf */ | ||
217 | -/* Buffer and stream allocation */ | ||
218 | - buff = (caddr_t)malloc(REQUESTLENGTH); | ||
219 | - | ||
220 | - xdrmem_create(&xdrs, buff, REQUESTLENGTH, XDR_ENCODE); | ||
221 | - | ||
222 | - xdr_int(&xdrs,&Request); | ||
223 | - xdr_string(&xdrs, &InstrName, strlen(InstrName)); | ||
224 | - | ||
225 | -/* Send Open Virtual Instrument request */ | ||
226 | - | ||
227 | - if((cc = send(SocketID,buff,REQUESTLENGTH,0)) < 0) | ||
228 | - { | ||
229 | - perror("DD_SetVariable:"); | ||
230 | - free(buff); | ||
231 | - xdr_destroy(&xdrs); | ||
232 | - return(REQSENDERR); | ||
233 | - } | ||
234 | - xdrmem_create(&xdrs, buff, REQUESTLENGTH, XDR_FREE); | ||
235 | - | ||
236 | -/*-------- preparation an authorization request ----------------*/ | ||
237 | - if(UserName[0] == '\0') strcpy(UserName,NONAME); | ||
238 | - hostlen = strlen(UserHost); | ||
239 | - userlen = strlen(UserName); | ||
240 | - | ||
241 | - xdrmem_create(&xdrs, buff,REQUESTLENGTH, XDR_ENCODE); | ||
242 | - | ||
243 | - xdr_int(&xdrs,&UserID); | ||
244 | - xdr_string(&xdrs, &PUserHost, hostlen); | ||
245 | - xdr_string(&xdrs, &PUserName, userlen); | ||
246 | -/* fprintf(stderr,"userid %d host %s DD_name %s\n",UserID,UserHost,UserName); */ | ||
247 | - | ||
248 | -/* Send request */ | ||
249 | - if((cc = send(SocketID,buff,REQUESTLENGTH,0)) < 0) | ||
250 | - { | ||
251 | - perror("DD_Set_Variable:"); | ||
252 | - free(buff); | ||
253 | - xdr_destroy(&xdrs); | ||
254 | - return(REQSENDERR); | ||
255 | - } | ||
256 | - | ||
257 | - free(buff); | ||
258 | - xdr_destroy(&xdrs); | ||
259 | - | ||
260 | -/* Get reply */ | ||
261 | - buff = (caddr_t)malloc(REPLYLENGTH); | ||
262 | -/* | ||
263 | - i=0; | ||
264 | - while(((cc = recv(SocketID,buff,REPLYLENGTH,0)) < 0) && (i < TRY)) i++; | ||
265 | -*/ | ||
266 | - if((cc = ReceiveFromNet(buff, REPLYLENGTH)) < 0) | ||
267 | - { | ||
268 | - perror("DD_SET_Variable:"); | ||
269 | - free(buff); | ||
270 | - return(REPLYRECERR); | ||
271 | - } | ||
272 | - | ||
273 | - xdrmem_create(&xdrs, buff, REPLYLENGTH, XDR_DECODE); | ||
274 | - xdr_int(&xdrs,&InstrID); | ||
275 | - | ||
276 | -/* Free all */ | ||
277 | - free(buff); | ||
278 | - xdr_destroy(&xdrs); | ||
279 | - | ||
280 | - return InstrID; | ||
281 | -} | ||
282 | - | ||
283 | -/*----------------------- DD_GetInform -----------------------------*/ | ||
284 | -/* | ||
285 | - * Returns "OK" if OK, fill DD_Data structure | ||
286 | - * Return negative value if error | ||
287 | - */ | ||
288 | - | ||
289 | -int DD_GetInform(int VarID,char *AttrName,DD_data_t **data) | ||
290 | -{ | ||
291 | - static void *v = NULL; | ||
292 | - static DD_data_t idd = {DD_CHAR, 0, NULL,1, &v}; | ||
293 | - static caddr_t buf = NULL; | ||
294 | - static XDR xdrs; | ||
295 | - int id; | ||
296 | - int cc; | ||
297 | - int length; | ||
298 | - int op = DATAINFOREQ; | ||
299 | - int type; /* type of information or error */ | ||
300 | - int DimNumbers; | ||
301 | - int PacketSize; | ||
302 | - int CurLength; | ||
303 | - int i; | ||
304 | - u_int count; | ||
305 | - u_int MaxNumber; | ||
306 | - | ||
307 | -/*------------------- Empty static data ------------------------*/ | ||
308 | - if(idd.Dimensions != NULL) | ||
309 | - { | ||
310 | - free(idd.Dimensions); | ||
311 | - idd.Dimensions = NULL; | ||
312 | - } | ||
313 | - if(idd.Variables[0] != NULL) | ||
314 | - { | ||
315 | - free(idd.Variables[0]); | ||
316 | - idd.Variables[0] = NULL; | ||
317 | - } | ||
318 | - | ||
319 | -/*------------------ Check the Name length -----------------------*/ | ||
320 | - if(strlen(AttrName) > MAXVARLENGTH) length = MAXVARLENGTH; | ||
321 | - else length = strlen(AttrName); | ||
322 | - | ||
323 | -/*----------- Allocation of memory and stream --------------------*/ | ||
324 | - buf = (caddr_t)malloc(REQUESTLENGTH); | ||
325 | - xdrmem_create(&xdrs, buf, REQUESTLENGTH, XDR_ENCODE); | ||
326 | - | ||
327 | -/*------------------- Encoding the request ----------------------*/ | ||
328 | - xdr_int(&xdrs,&op); | ||
329 | - xdr_int(&xdrs,&VarID); | ||
330 | - xdr_string(&xdrs, &AttrName, length); | ||
331 | - | ||
332 | -/*------------------------ Send request ---------------------------*/ | ||
333 | - if((cc = send(SocketID,buf,REQUESTLENGTH,0)) < 0) | ||
334 | - { | ||
335 | - perror("DD_GetInform:"); | ||
336 | - free(buf); | ||
337 | - xdr_destroy(&xdrs); | ||
338 | - return(REQSENDERR); | ||
339 | - } | ||
340 | - free(buf); | ||
341 | - xdr_destroy(&xdrs); | ||
342 | - | ||
343 | -/*------------------------ Get reply header ------------------------*/ | ||
344 | - | ||
345 | - buf = (caddr_t)malloc(REPLYLENGTH); | ||
346 | -/* | ||
347 | - i=0; | ||
348 | - while(((cc = recv(SocketID,buf,REPLYLENGTH,0)) < 0) && (i < TRY)) i++; | ||
349 | - if(cc < 0) | ||
350 | -*/ | ||
351 | - if((cc = ReceiveFromNet(buf, REPLYLENGTH)) < 0) | ||
352 | - { | ||
353 | - perror("DD_GetInform:"); | ||
354 | - free(buf); | ||
355 | - return(REPLYRECERR); | ||
356 | - } | ||
357 | - | ||
358 | - xdrmem_create(&xdrs, buf, REPLYLENGTH, XDR_DECODE); | ||
359 | - xdr_int(&xdrs,&type); | ||
360 | - if(type < 0) | ||
361 | - { | ||
362 | - free(buf); | ||
363 | - xdr_destroy(&xdrs); | ||
364 | - return(type); | ||
365 | - } | ||
366 | - xdr_int(&xdrs,&DimNumbers); | ||
367 | - xdr_int(&xdrs,&PacketSize); | ||
368 | - free(buf); | ||
369 | - xdr_destroy(&xdrs); | ||
370 | - | ||
371 | - idd.DimNumber = DimNumbers; | ||
372 | - idd.type = type; | ||
373 | - | ||
374 | -/*---------------------------- Get Data Packet ----------------------*/ | ||
375 | - if(PacketSize > 0) buf = (caddr_t)malloc(PacketSize); | ||
376 | - else return(REPLYRECERR); | ||
377 | - | ||
378 | - if((cc = ReceiveFromNet(buf, PacketSize)) < 0) | ||
379 | - { | ||
380 | - perror("DD_GetInform:"); | ||
381 | - free(buf); | ||
382 | - return(REPLYRECERR); | ||
383 | - } | ||
384 | - | ||
385 | -/*--------------------- Decoding data packet ------------------------*/ | ||
386 | - if(DimNumbers > 0) | ||
387 | - { | ||
388 | -/*----------- Memory allocation and xdr creating -----------------*/ | ||
389 | - xdrmem_create(&xdrs, buf, (u_int)PacketSize, XDR_DECODE); | ||
390 | - | ||
391 | -/*----------------- Dimensions decoding -------------------------*/ | ||
392 | - if(idd.Dimensions !=NULL) free(idd.Dimensions); | ||
393 | - idd.Dimensions = (int *)malloc(DimNumbers*sizeof(int)); | ||
394 | - | ||
395 | - xdr_array(&xdrs, (caddr_t *)&(idd.Dimensions), | ||
396 | - &count, | ||
397 | - (u_int )DimNumbers, | ||
398 | - unixlen[DD_INT], | ||
399 | - (xdrproc_t)xdr_int); | ||
400 | - | ||
401 | - count = 1; | ||
402 | - for(i=0; i < DimNumbers;i++) | ||
403 | - count = count*idd.Dimensions[i]; | ||
404 | - MaxNumber = count; | ||
405 | - } | ||
406 | - else | ||
407 | - { | ||
408 | - free(buf); | ||
409 | - return(REPLYRECERR); | ||
410 | - } | ||
411 | - | ||
412 | -/*---------------- Allocate memory for Variables and decoding ------------------*/ | ||
413 | - if(idd.Variables[0] != NULL) free(idd.Variables[0]); | ||
414 | - idd.Variables[0] = (int *)malloc(unixlen[type] * MaxNumber); | ||
415 | - | ||
416 | - xdr_array(&xdrs,((caddr_t*)(&idd.Variables[0])),&count, | ||
417 | - MaxNumber, unixlen[type], (xdrproc_t)ConvFunc[type]); | ||
418 | - | ||
419 | -/*-------------------------- Free all ------------------------------*/ | ||
420 | - free(buf); | ||
421 | - xdr_destroy(&xdrs); | ||
422 | - | ||
423 | - *data = &idd; | ||
424 | - return OK; | ||
425 | -} | ||
426 | - | ||
427 | -/*==================================================== | ||
428 | - * DD_SetTime() | ||
429 | - *====================================================*/ | ||
430 | -/*----------------------------------------------------- | ||
431 | - * VarID - ID of Data Set | ||
432 | - * Time - string in DD type | ||
433 | - * Returns 1 if OK and negative in case of err | ||
434 | - *---------------------------------------------------*/ | ||
435 | - | ||
436 | -int DD_SetTime(int VarID,char *Time) | ||
437 | -{ | ||
438 | - static caddr_t buf = NULL; | ||
439 | - static XDR xdrs; | ||
440 | - static int op = TIMESETREQ; | ||
441 | - int type; | ||
442 | - int cc,i; | ||
443 | - int DoneFlag = 0; | ||
444 | - | ||
445 | - while(DoneFlag == 0) | ||
446 | - { | ||
447 | -/* Allocatein memory and stream */ | ||
448 | - buf = (caddr_t)malloc(REQUESTLENGTH); | ||
449 | - xdrmem_create(&xdrs, buf, REQUESTLENGTH, XDR_ENCODE); | ||
450 | - | ||
451 | -/* Encoding the request */ | ||
452 | - xdr_int(&xdrs,&op); | ||
453 | - xdr_int(&xdrs,&VarID); | ||
454 | - xdr_string(&xdrs, &Time, TIMELENGTH); | ||
455 | - | ||
456 | -/* Send request */ | ||
457 | - if((cc = send(SocketID,buf,REQUESTLENGTH,0)) < 0) | ||
458 | - { | ||
459 | - perror("DD_SetTime:"); | ||
460 | - free(buf); | ||
461 | - xdr_destroy(&xdrs); | ||
462 | - return(REQSENDERR); | ||
463 | - } | ||
464 | - free(buf); | ||
465 | - xdr_destroy(&xdrs); | ||
466 | - | ||
467 | -/* Get reply header */ | ||
468 | - | ||
469 | - buf = (caddr_t)malloc(REPLYLENGTH); | ||
470 | - if((cc = ReceiveFromNet(buf, REPLYLENGTH)) < 0) | ||
471 | - { | ||
472 | - perror("DD_SetTime:"); | ||
473 | - free(buf); | ||
474 | - return(REPLYRECERR); | ||
475 | - } | ||
476 | - | ||
477 | - xdrmem_create(&xdrs, buf, REPLYLENGTH, XDR_DECODE); | ||
478 | - xdr_int(&xdrs,&type); | ||
479 | - | ||
480 | - free(buf); | ||
481 | - xdr_destroy(&xdrs); | ||
482 | - | ||
483 | - if(type < 0) | ||
484 | - { | ||
485 | - if(type == CACHTOOREC) sleep((unsigned )(FILEACCMARG)); | ||
486 | - else return type; | ||
487 | - } | ||
488 | - else DoneFlag = 1; | ||
489 | - } | ||
490 | - return 1 ; | ||
491 | -} | ||
492 | - | ||
493 | -/*================================================================== | ||
494 | - * DD_SetTimeInfo() | ||
495 | - *=================================================================*/ | ||
496 | -/*---------------------------------------------------------- | ||
497 | - * VarID - ID of Data Set | ||
498 | - * Time - string in DD type | ||
499 | - * RealTime - double : time value pointer points to | ||
500 | - * Returns 1 if OK and negative in case of err | ||
501 | - *----------------------------------------------------------*/ | ||
502 | - | ||
503 | -int DD_SetTimeInfo(int VarID, char *Time, double *RealTime) | ||
504 | -{ | ||
505 | - int err; | ||
506 | - static char TimeInt[17] = "0000000000001000\0"; | ||
507 | - DD_data_t *data; | ||
508 | - | ||
509 | - err = DD_SetTime(VarID, Time); | ||
510 | - if (err < 1) return err; | ||
511 | - | ||
512 | - err = DD_GetData(VarID, "Time", TimeInt, &data); | ||
513 | - if (err < 0) return err; | ||
514 | - if (data->VarNumber < 1) return OUTOFTIME; | ||
515 | - | ||
516 | - *RealTime = DD_Time2Double((char *)data->Variables[0]); | ||
517 | - | ||
518 | - return 1 ; | ||
519 | -} | ||
520 | - | ||
521 | -/*========================================================= | ||
522 | - * DD_GetData() | ||
523 | - * Just an interface to the DD_GetMultiData() | ||
524 | - *========================================================*/ | ||
525 | -int DD_GetData(int VarID, char *VarName, char *TimeInt, DD_data_t **data) | ||
526 | -{ | ||
527 | - char *xxx=VarName; | ||
528 | - int err; | ||
529 | - err = DD_GetMultiData(VarID, 1, &xxx, TimeInt, data, 1); | ||
530 | - return err; | ||
531 | -} | ||
532 | -/*========================================================= | ||
533 | - * DD_GetMultiData() | ||
534 | - *========================================================*/ | ||
535 | -/*--------------------------------------------------------- | ||
536 | - * VarID - ID of open virtual instrument | ||
537 | - * VarSize - the size of the array names | ||
538 | - * VarNames - araay of the variables names | ||
539 | - * TimeInt - Time interval in DD_time style | ||
540 | - * data - returned data | ||
541 | - * Return values: | ||
542 | - * positives: | ||
543 | - * MOREDELAY - call this function again after delay | ||
544 | - * MOREDATA - call this function again to complete request | ||
545 | - * OK - all data received | ||
546 | - * negative value - error (see DD.h) | ||
547 | - *---------------------------------------------------------*/ | ||
548 | - | ||
549 | -int DD_GetMultiData(int VarID,size_t VarSize, char **VarNames,char *TimeInt,DD_data_t **data, int BackFlag) | ||
550 | -{ | ||
551 | - static DD_data_t *CurrentData = NULL; /* Data records array to keep until the next call */ | ||
552 | - static size_t OldVarSize = 0; | ||
553 | - static caddr_t buf = NULL; | ||
554 | - static XDR xdrs; | ||
555 | - static int LastPacketFlag = OK; | ||
556 | - int id; | ||
557 | - int cc; | ||
558 | - int *NameLength = NULL; /* Array of lengths */ | ||
559 | - int XDRStrLen; /* xdr length of a string */ | ||
560 | - int XDRReqlength; // Length in bytes the XDR stream | ||
561 | - int op = DATAGETREQ; | ||
562 | - int type; /* type of information or error */ | ||
563 | - int DimNumbers; | ||
564 | - int PacketSize; | ||
565 | - int CurLength; | ||
566 | - u_int count, MaxSize; | ||
567 | - int i; | ||
568 | - | ||
569 | - /* Empty static data */ | ||
570 | - for(id = 0; id < OldVarSize; id++) | ||
571 | - { | ||
572 | - if(CurrentData[id].Dimensions != NULL) | ||
573 | - { | ||
574 | - free(CurrentData[id].Dimensions); | ||
575 | - CurrentData[id].Dimensions = NULL; | ||
576 | - } | ||
577 | - if(CurrentData[id].Variables != NULL) | ||
578 | - { | ||
579 | - for(i = 0; i< CurrentData[id].VarNumber; i++) | ||
580 | - free(CurrentData[id].Variables[i]); | ||
581 | - free(CurrentData[id].Variables); | ||
582 | - CurrentData[id].Variables = NULL; | ||
583 | - } | ||
584 | - } | ||
585 | - free(CurrentData); | ||
586 | - | ||
587 | - /*-------------------------------------- | ||
588 | - * Create a new Current Data empty array | ||
589 | - *-------------------------------------*/ | ||
590 | - OldVarSize = VarSize; | ||
591 | - CurrentData = (DD_data_t *)malloc(sizeof(DD_data_t)*VarSize); | ||
592 | - for(id = 0; id < VarSize; id++) | ||
593 | - { | ||
594 | - CurrentData[id].Dimensions = NULL; | ||
595 | - CurrentData[id].Variables = NULL; | ||
596 | - CurrentData[id].DimNumber = 0; | ||
597 | - CurrentData[id].VarNumber = 0; | ||
598 | - CurrentData[id].type = 0; | ||
599 | - } | ||
600 | - /*-------------------------------------------------------------- | ||
601 | - * The follows request preparation and send is performed only | ||
602 | - * if the priveous data packed is completely received | ||
603 | - *--------------------------------------------------------------*/ | ||
604 | - if((LastPacketFlag == OK) || (LastPacketFlag == MOREDELAY)) | ||
605 | - { | ||
606 | - /*--------------------------------------- | ||
607 | - * Preparation of the array the name lengths | ||
608 | - * Note that the names are cut down to the MAXVARLENGTH | ||
609 | - * Calculation the packet size | ||
610 | - *---------------------------------------*/ | ||
611 | - NameLength = (int *)malloc(sizeof(int)*VarSize); | ||
612 | - XDRReqlength = 8; /* the length of the first+last arguments */ | ||
613 | - for(id = 0; id < VarSize; id++) | ||
614 | - { | ||
615 | - if(strlen(VarNames[id]) > MAXVARLENGTH) NameLength[id] = MAXVARLENGTH; | ||
616 | - else NameLength[id] = strlen(VarNames[id]); | ||
617 | - XDRStrLen = (NameLength[id] / 4) * 4; | ||
618 | - if((NameLength[id] % 4) > 0) XDRStrLen += 4; | ||
619 | - XDRReqlength += XDRStrLen + 4; // String length + 4 bytes length coding | ||
620 | - //fprintf(stderr,"Variable %s, length %d, total %d\n",VarNames[id],XDRStrLen,XDRReqlength); | ||
621 | - } | ||
622 | - /*-------------------------------- | ||
623 | - * The first packet of the request of the standard size | ||
624 | - * Allocation corresponding memory and stream | ||
625 | - *------------------------------*/ | ||
626 | - buf = (caddr_t)malloc(REQUESTLENGTH); | ||
627 | - xdrmem_create(&xdrs, buf, REQUESTLENGTH, XDR_ENCODE); | ||
628 | - | ||
629 | - /* Encoding the request */ | ||
630 | - xdr_int(&xdrs,&op); | ||
631 | - xdr_int(&xdrs,&VarID); | ||
632 | - xdr_string(&xdrs,&TimeInt,TIMELENGTH); | ||
633 | - xdr_int(&xdrs,&XDRReqlength); | ||
634 | - | ||
635 | - /* Send the first request */ | ||
636 | - if((cc = send(SocketID,buf,REQUESTLENGTH,0)) < 0) | ||
637 | - { | ||
638 | - perror("DD_GetData: First Request"); | ||
639 | - free(buf); | ||
640 | - xdr_destroy(&xdrs); | ||
641 | - return(REQSENDERR); | ||
642 | - } | ||
643 | - free(buf); | ||
644 | - xdr_destroy(&xdrs); | ||
645 | - | ||
646 | - /*-------------------------------- | ||
647 | - * The Second packet of XDRReqlength size | ||
648 | - * Allocation corresponding memory and stream | ||
649 | - *------------------------------*/ | ||
650 | - buf = (caddr_t)malloc(XDRReqlength); | ||
651 | - xdrmem_create(&xdrs, buf, XDRReqlength, XDR_ENCODE); | ||
652 | - xdr_int(&xdrs,(int *)(&VarSize)); | ||
653 | - for(id = 0; id < VarSize; id++) xdr_string(&xdrs, &VarNames[id], NameLength[id]); | ||
654 | - xdr_int(&xdrs,&BackFlag); | ||
655 | - | ||
656 | - /* Send the second request */ | ||
657 | - if((cc = send(SocketID,buf,XDRReqlength,0)) < 0) | ||
658 | - { | ||
659 | - perror("DD_GetData:Second Packet"); | ||
660 | - free(buf); | ||
661 | - xdr_destroy(&xdrs); | ||
662 | - return(REQSENDERR); | ||
663 | - } | ||
664 | - free(buf); | ||
665 | - xdr_destroy(&xdrs); | ||
666 | - } | ||
667 | - | ||
668 | - /*----------------------------------------------------------- | ||
669 | - * Get the VarSize reply headers and VarSize data | ||
670 | - *----------------------------------------------------------*/ | ||
671 | - for(id = 0; id < VarSize; id++) | ||
672 | - { | ||
673 | - /*------------------- | ||
674 | - * The header | ||
675 | - *-----------------*/ | ||
676 | - buf = (caddr_t)malloc(REPLYLENGTH); | ||
677 | - if((cc = ReceiveFromNet(buf, REPLYLENGTH)) < 0) | ||
678 | - { | ||
679 | - perror("DD_GetData:Error while header receive"); | ||
680 | - free(buf); | ||
681 | - return(REPLYRECERR); | ||
682 | - } | ||
683 | - | ||
684 | - xdrmem_create(&xdrs, buf, REPLYLENGTH, XDR_DECODE); | ||
685 | - xdr_int(&xdrs,&type); | ||
686 | - xdr_int(&xdrs,&DimNumbers); | ||
687 | - xdr_int(&xdrs,&PacketSize); | ||
688 | - free(buf); | ||
689 | - xdr_destroy(&xdrs); | ||
690 | - | ||
691 | - if((type < 0) && (type != NOVAR)) /* Server returns unrecoverable error */ | ||
692 | - { | ||
693 | - fprintf(stderr,"DD_GetData: Server returns %d, unrecovable error\n",type); | ||
694 | - return type; | ||
695 | - } | ||
696 | - | ||
697 | - /*----------- Header is received ----------------------*/ | ||
698 | - CurrentData[id].DimNumber = DimNumbers - 1; | ||
699 | - CurrentData[id].type = type; | ||
700 | - | ||
701 | - /*--------------- Receive Data Packet ------------------------------*/ | ||
702 | - if(PacketSize > 0) buf = (caddr_t)malloc(PacketSize); | ||
703 | - else return(REPLYRECERR); | ||
704 | - if((cc = ReceiveFromNet(buf, PacketSize)) < 0) | ||
705 | - { | ||
706 | - perror("DD_GetData: Error while data packet receive"); | ||
707 | - free(buf); | ||
708 | - return(REPLYRECERR); | ||
709 | - } | ||
710 | - /*----------------- Decoding data packet --------------------*/ | ||
711 | - if(DimNumbers > 1) | ||
712 | - { | ||
713 | - xdrmem_create(&xdrs, buf, (u_int)PacketSize, XDR_DECODE); | ||
714 | - count = DimNumbers-1; | ||
715 | - /* allocation memory for dimensions */ | ||
716 | - CurrentData[id].Dimensions = (int *)malloc((DimNumbers-1)*sizeof(int)); | ||
717 | - | ||
718 | - xdr_int(&xdrs,&LastPacketFlag); /* Last Paket Indicatort*/ | ||
719 | - xdr_int(&xdrs,&CurrentData[id].VarNumber); /* Variables number */ | ||
720 | - | ||
721 | - if(LastPacketFlag > 2) | ||
722 | - { | ||
723 | - LastPacketFlag = OK; | ||
724 | - CurrentData[id].VarNumber = 0; | ||
725 | - free(buf); | ||
726 | - return(REPLYRECERR); | ||
727 | - } | ||
728 | - | ||
729 | - /*----- Decoding dimensions array -------------------*/ | ||
730 | - xdr_array(&xdrs, (caddr_t *)&(CurrentData[id].Dimensions), | ||
731 | - &count, | ||
732 | - (u_int )DimNumbers-1, | ||
733 | - unixlen[DD_INT], | ||
734 | - (xdrproc_t)xdr_int); | ||
735 | - | ||
736 | - count = 1; | ||
737 | - for(i=0; i < DimNumbers-1;i++) | ||
738 | - { | ||
739 | - count = count*CurrentData[id].Dimensions[i]; | ||
740 | - } | ||
741 | - MaxSize = count; | ||
742 | - } | ||
743 | - else | ||
744 | - { | ||
745 | - if(type != NOVAR) | ||
746 | - { | ||
747 | - free(buf); | ||
748 | - return(REPLYRECERR); | ||
749 | - } | ||
750 | - else | ||
751 | - { | ||
752 | - CurrentData[id].VarNumber = 0; | ||
753 | - } | ||
754 | - } | ||
755 | - | ||
756 | - /*---------- Decoding variables -------------------------*/ | ||
757 | - if(CurrentData[id].VarNumber != 0) CurrentData[id].Variables = (void *)malloc(CurrentData[id].VarNumber*sizeof(void *)); | ||
758 | - else CurrentData[id].Variables = NULL; | ||
759 | - | ||
760 | - for(i = 0; i < CurrentData[id].VarNumber; i++) | ||
761 | - { | ||
762 | - CurrentData[id].Variables[i] = (void *)malloc(unixlen[type]*MaxSize); | ||
763 | - count = MaxSize; | ||
764 | - xdr_array(&xdrs,(caddr_t *)(&(CurrentData[id].Variables[i])),&count,MaxSize,unixlen[type], (xdrproc_t)ConvFunc[type]); | ||
765 | - } | ||
766 | - | ||
767 | - /* Free all */ | ||
768 | - free(buf); | ||
769 | - xdr_destroy(&xdrs); | ||
770 | - } | ||
771 | - *data = CurrentData; | ||
772 | - return(LastPacketFlag); | ||
773 | -} | ||
774 | -/*===================================================================*/ | ||
775 | - | ||
776 | -/*-------------------------- DD_CLOSE --------------------------------*/ | ||
777 | -/* | ||
778 | - * | ||
779 | - * VarID - entry point of ID table | ||
780 | - * Returns 1 if OK or negative err | ||
781 | - * Close Socket if no VarID more ( this information supplyed by server ) | ||
782 | - */ | ||
783 | - | ||
784 | -int DD_Close(int VarID) | ||
785 | -{ | ||
786 | - static caddr_t buf = NULL; | ||
787 | - static XDR xdrs; | ||
788 | - static int op = CLOSEINSREQ; | ||
789 | - int RemainedID; /* Server returns number of remained ID */ | ||
790 | - int cc,i; | ||
791 | -/* Allocatein memory and stream */ | ||
792 | - buf = (caddr_t)malloc(REQUESTLENGTH); | ||
793 | - xdrmem_create(&xdrs, buf, REQUESTLENGTH, XDR_ENCODE); | ||
794 | - | ||
795 | -/* Encoding the request */ | ||
796 | - xdr_int(&xdrs,&op); | ||
797 | - xdr_int(&xdrs,&VarID); | ||
798 | - | ||
799 | -/* Send request */ | ||
800 | - if((cc = send(SocketID,buf,REQUESTLENGTH,0)) < 0) | ||
801 | - { | ||
802 | - perror("DD_Close:"); | ||
803 | - free(buf); | ||
804 | - xdr_destroy(&xdrs); | ||
805 | - return(REQSENDERR); | ||
806 | - } | ||
807 | - free(buf); | ||
808 | - xdr_destroy(&xdrs); | ||
809 | - | ||
810 | -/* Get reply header */ | ||
811 | - | ||
812 | - buf = (caddr_t)malloc(REPLYLENGTH); | ||
813 | -/* | ||
814 | - i = 0; | ||
815 | - while(((cc = recv(SocketID,buf,REPLYLENGTH,0)) < 0) && (i < TRY)) i++; | ||
816 | - if(cc < 0) | ||
817 | -*/ | ||
818 | - if((cc = ReceiveFromNet(buf, REPLYLENGTH)) < 0) | ||
819 | - { | ||
820 | - perror("DD_Close:"); | ||
821 | - free(buf); | ||
822 | - return(REPLYRECERR); | ||
823 | - } | ||
824 | - | ||
825 | - xdrmem_create(&xdrs, buf, REPLYLENGTH, XDR_DECODE); | ||
826 | - xdr_int(&xdrs,&RemainedID); | ||
827 | - if(RemainedID< 0) | ||
828 | - { | ||
829 | - free(buf); | ||
830 | - xdr_destroy(&xdrs); | ||
831 | - return(RemainedID); | ||
832 | - } | ||
833 | - free(buf); | ||
834 | - xdr_destroy(&xdrs); | ||
835 | - | ||
836 | - if(RemainedID == 0) | ||
837 | - { | ||
838 | - shutdown(SocketID,2); | ||
839 | - close(SocketID); | ||
840 | - SocketID = -1; | ||
841 | -/* | ||
842 | - UserHost[0] = '\0'; | ||
843 | - UserName[0] = '\0'; | ||
844 | -*/ | ||
845 | - } | ||
846 | - | ||
847 | - return(1); | ||
848 | -} | ||
849 | -/*------------------------------------------------------------------------------*/ | ||
850 | - | ||
851 | -/*=============== DATABASE UPDATE FUNCTIONS ====================================*/ | ||
852 | -/*------------------ DD_AddDataSet() -------------------------------------------*/ | ||
853 | -int DD_AddDataSet(char *DataSetName, char *RemSetID, char *BaseName) | ||
854 | -{ | ||
855 | - static caddr_t buf = NULL; | ||
856 | - static XDR xdrs; | ||
857 | - static int op = ADDVIREQ; | ||
858 | - int Err; /* Server returns OK or NOEXEC */ | ||
859 | - int cc,i,length; | ||
860 | - int CloseFlag = 0; | ||
861 | - | ||
862 | -/* If there is no connection, try to get it */ | ||
863 | - if(SocketID < 0) | ||
864 | - { | ||
865 | - if((SocketID = GetSocket()) < 0) return(NOCONNECTION); | ||
866 | - CloseFlag = 1; // To close Connection at the end | ||
867 | - } | ||
868 | - | ||
869 | -/* Allocatein memory and stream */ | ||
870 | - buf = (caddr_t)malloc(REQUESTLENGTH); | ||
871 | - xdrmem_create(&xdrs, buf, REQUESTLENGTH, XDR_ENCODE); | ||
872 | - | ||
873 | -/* Encoding the request */ | ||
874 | - xdr_int(&xdrs,&op); | ||
875 | - | ||
876 | -/* Coding DataSetName */ | ||
877 | - if((length = strlen(DataSetName)) > MAXSETLENGTH) length = MAXSETLENGTH; | ||
878 | - xdr_string(&xdrs, &DataSetName, length); | ||
879 | -/* Coding RemSetID */ | ||
880 | - if((length = strlen(RemSetID)) > MAXVARLENGTH) length = MAXVARLENGTH; | ||
881 | - xdr_string(&xdrs, &RemSetID, length); | ||
882 | -/* Coding BaseName */ | ||
883 | - if((length = strlen(BaseName)) > MAXVARLENGTH) length = MAXVARLENGTH; | ||
884 | - xdr_string(&xdrs, &BaseName, length); | ||
885 | - | ||
886 | -/* Send request */ | ||
887 | - if((cc = send(SocketID,buf,REQUESTLENGTH,0)) < 0) | ||
888 | - { | ||
889 | - perror("DD_AddDataSet:"); | ||
890 | - free(buf); | ||
891 | - xdr_destroy(&xdrs); | ||
892 | - return(REQSENDERR); | ||
893 | - } | ||
894 | - free(buf); | ||
895 | - xdr_destroy(&xdrs); | ||
896 | - | ||
897 | -/* Get reply header */ | ||
898 | - buf = (caddr_t)malloc(REPLYLENGTH); | ||
899 | - if((cc = ReceiveFromNet(buf, REPLYLENGTH)) < 0) | ||
900 | - { | ||
901 | - perror("DD_AddDataSet:"); | ||
902 | - free(buf); | ||
903 | - return(REPLYRECERR); | ||
904 | - } | ||
905 | - | ||
906 | - xdrmem_create(&xdrs, buf, REPLYLENGTH, XDR_DECODE); | ||
907 | - xdr_int(&xdrs,&Err); | ||
908 | - | ||
909 | - if(CloseFlag) // Close everything if function established connection | ||
910 | - { | ||
911 | - shutdown(SocketID,2); | ||
912 | - close(SocketID); | ||
913 | - SocketID = -1; | ||
914 | -/* Session with DD Server was closed, but User Session continues !!!!! */ | ||
915 | - /* UserHost[0] = '\0'; | ||
916 | - UserName[0] = '\0'; */ | ||
917 | - } | ||
918 | - return Err; | ||
919 | -} | ||
920 | -/*-----------------------------------------------------------------------------*/ | ||
921 | - | ||
922 | -/*---------------------- DD GET VERSION ---------------------------------------*/ | ||
923 | -char *DD_GetVersion() | ||
924 | -/* | ||
925 | - * return static pointer to internal string with the DDLIB-SERVER package version | ||
926 | - */ | ||
927 | -{ | ||
928 | - static char Version[] = VERSION; | ||
929 | - return (char *)Version; | ||
930 | -} | ||
931 | -/*------------------------- End Library -------------------------------*/ |
src/CLIENT/DD_time.c deleted
@@ -1,321 +0,0 @@ | @@ -1,321 +0,0 @@ | ||
1 | -/* =================================================================== | ||
2 | - * Name : DD_time.c | ||
3 | - * Version: : 4.1 | ||
4 | - * Author : Andrey Fedorov | ||
5 | - * Institution : IRAP/UPS/CNRS Toulouse | ||
6 | - * Modifications list: | ||
7 | - * Oct 5, 2002: V.3.0, New functions DD_Time2Double and Double2DD_Time were added. | ||
8 | - * March 26, 2010: V.3.1 YEARS up to 2025 | ||
9 | - * May 17, 2011: V.4.0 Fedorov, completely revised version. | ||
10 | - * There is no more confuse between Time and Time Interval | ||
11 | - * Sept 05, 2011: V.4.1 SetIntNew => arg TimeKind => to work with 1970-1973 : BR | ||
12 | - *==================================================================*/ | ||
13 | - | ||
14 | -#include "DD_time.h" | ||
15 | -#include <stdio.h> | ||
16 | -#include <string.h> | ||
17 | -#include <stdarg.h> | ||
18 | - | ||
19 | -#define YEARS 56 | ||
20 | -#define STARTYEAR 1970 | ||
21 | - | ||
22 | -/*---- Static array of days shift from Jan-1-1970 -------*/ | ||
23 | -/* 1970 1971 1972 1973 1974 1975 1976 | ||
24 | - * 1977 1978 1979 1980 1981 1982 1983 | ||
25 | - * 1984 1985 1986 1987 1988 1989 1990 | ||
26 | - * 1991 1992 1993 1994 1995 1996 1997 | ||
27 | - * 1998 1999 2000 2001 2002 2003 2004 | ||
28 | - * 2005 2006 2007 2008 2009 2010 2011 | ||
29 | - * 2012 2013 2014 2015 2016 2017 2018 | ||
30 | - * 2019 2020 2021 2022 2023 2024 2025 | ||
31 | - */ | ||
32 | -static double | ||
33 | - YearDays[YEARS] = { 0.0, 365.0, 730.0, 1096.0, 1461.0, 1826.0, 2191.0, | ||
34 | - 2557.0, 2922.0, 3287.0, 3652.0, 4018.0, 4383.0, 4748.0, | ||
35 | - 5113.0, 5479.0, 5844.0, 6209.0, 6574.0, 6940.0, 7305.0, | ||
36 | - 7670.0, 8035.0, 8401.0, 8766.0, 9131.0, 9496.0, 9862.0, | ||
37 | - 10227.0, 10592.0, 10957.0, 11323.0, 11688.0, 12053.0, 12418.0, | ||
38 | - 12784.0, 13149.0, 13514.0, 13879.0, 14245.0, 14610.0, 14975.0, | ||
39 | - 15340.0, 15706.0, 16071.0, 16436.0, 16801.0, 17167.0, 17532.0, | ||
40 | - 17897.0, 18262.0, 18628.0, 18993.0, 19358.0, 19723.0, 20089.0}; | ||
41 | - | ||
42 | -/*------------------------------------------------------------- | ||
43 | - * DAY_OF_YEAR = monthday[*][month-1]+day_of_month -1 | ||
44 | - *------------------------------------------------------------*/ | ||
45 | -static int monthday[2][12] = | ||
46 | -{ | ||
47 | -{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}, | ||
48 | -{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335} | ||
49 | -}; | ||
50 | - | ||
51 | -/*------------------------------------------------------------ | ||
52 | - * Global static Flag to show the current state of the time | ||
53 | - * processor. Is it Time interval (0), or DD Time (1) | ||
54 | - *----------------------------------------------------------*/ | ||
55 | -static int TimeFlag = 1; | ||
56 | -/*================== INTERNAL FUNCTION ====================*/ | ||
57 | -/*-------------------- SetInt ----------------------------*/ | ||
58 | -void SetInt(dd_tmstr_t *UT) | ||
59 | -{ | ||
60 | - SetIntNew(UT,DD_TM_UNKNOWN); | ||
61 | -} | ||
62 | - | ||
63 | -void SetIntNew(dd_tmstr_t *UT,t_DDTimeKind timeKind) /* Fill int values of dd_tmstr_t */ | ||
64 | -/* If the double times field of UT structure is defined, | ||
65 | - * this function fills remains fields of Year, day .... separately | ||
66 | - */ | ||
67 | -{ | ||
68 | - static double msofday = 24.0*60.0*60.0; | ||
69 | - static double msofhour = 60.0*60.0; | ||
70 | - static double msofmin = 60.0; | ||
71 | - long daynumber; | ||
72 | - double msrest; | ||
73 | - int i; | ||
74 | - | ||
75 | - daynumber = (long)(UT->times / msofday); | ||
76 | - for(i=0;i<YEARS;i++) if(daynumber < (long)YearDays[i]) break; | ||
77 | - i--; | ||
78 | - | ||
79 | - switch(timeKind) | ||
80 | - { | ||
81 | - case DD_TM_DATE : | ||
82 | - { | ||
83 | - //it's a date | ||
84 | - UT->year = i+1970; | ||
85 | - UT->day = (int)(daynumber - (long)YearDays[i]); | ||
86 | - break; | ||
87 | - } | ||
88 | - case DD_TM_TIME_INTERVAL : | ||
89 | - { | ||
90 | - //it's a time interval | ||
91 | - UT->year = 0; | ||
92 | - UT->day = (int)(daynumber); | ||
93 | - break; | ||
94 | - } | ||
95 | - default : | ||
96 | - //compatibility mode | ||
97 | - if(i > 3) | ||
98 | - { | ||
99 | - UT->year = i+1970; | ||
100 | - UT->day = (int)(daynumber - (long)YearDays[i]); | ||
101 | - } | ||
102 | - else | ||
103 | - { | ||
104 | - UT->year = 0; | ||
105 | - UT->day = (int)(daynumber); | ||
106 | - } | ||
107 | - break; | ||
108 | - } | ||
109 | - | ||
110 | - msrest = UT->times - (double)daynumber * msofday; | ||
111 | - UT->hour = (int)(msrest / msofhour); | ||
112 | - msrest -= (double)(UT->hour)*msofhour; | ||
113 | - UT->min = (int)(msrest / msofmin); | ||
114 | - msrest -= (double)(UT->min)*msofmin; | ||
115 | - UT->sec = (int)(msrest); | ||
116 | - UT->msec = (int)((msrest - (double)(UT->sec))*1000.0); | ||
117 | - return; | ||
118 | -} | ||
119 | - | ||
120 | -/*---------------- end of SetInt -----------------------*/ | ||
121 | - | ||
122 | -/*------------------------------------------------------- | ||
123 | - * SetDouble() | ||
124 | - * Returns the double value of seconds since 1 Jan 1970 | ||
125 | - * The calculations are made from already filled dd_tmstr_t. | ||
126 | - * If UT->year | ||
127 | - *------------------------------------------------------*/ | ||
128 | -void SetDouble(dd_tmstr_t *UT) | ||
129 | -{ | ||
130 | - static double SecInMls = 1.0/1000.0; | ||
131 | - static double SecImMin = 60.0; | ||
132 | - static double SecInHour = 60.0*60.0; | ||
133 | - static double SecInDay = 60.0*60.0*24.0; | ||
134 | - if(UT->year >= STARTYEAR) // This is DD Time ! | ||
135 | - UT->times = (double)UT->msec*SecInMls + | ||
136 | - (double)UT->sec + | ||
137 | - (double)UT->min*SecImMin + | ||
138 | - (double)UT->hour*SecInHour + | ||
139 | - (double)UT->day*SecInDay + | ||
140 | - YearDays[(UT->year - 1970)]*SecInDay; | ||
141 | - else if(UT->year < STARTYEAR) // This is Time Interval | ||
142 | - UT->times = (double)UT->msec*SecInMls + | ||
143 | - (double)UT->sec + | ||
144 | - (double)UT->min*SecImMin + | ||
145 | - (double)UT->hour*SecInHour + | ||
146 | - (double)UT->day*SecInDay + | ||
147 | - YearDays[UT->year]*SecInDay; | ||
148 | - else | ||
149 | - UT->times = 0.0; | ||
150 | - return; | ||
151 | -} | ||
152 | -/*----------------- end of SetDouble ---------------------*/ | ||
153 | - | ||
154 | -/*=================== PUBLIC FUNCTIONS ==================*/ | ||
155 | -/*------------------- DD_Time2Double --------------------*/ | ||
156 | -double DD_Time2Double(dd_time_t UTstring) | ||
157 | -{ | ||
158 | - static dd_tmstr_t UT; | ||
159 | - static char year[5] = "0000\0"; | ||
160 | - static char day[4] = "000\0"; | ||
161 | - static char hour[3]= "00\0"; | ||
162 | - static char min[3] = "00\0"; | ||
163 | - static char sec[3]= "00\0"; | ||
164 | - static char msec[4] = "000\0"; | ||
165 | - | ||
166 | - strncpy(year,UTstring,4); | ||
167 | - strncpy(day,UTstring+4,3); | ||
168 | - strncpy(hour,UTstring+7,2); | ||
169 | - strncpy(min,UTstring+9,2); | ||
170 | - strncpy(sec,UTstring+11,2); | ||
171 | - strncpy(msec,UTstring+13,3); | ||
172 | - | ||
173 | - sscanf(year,"%d",&(UT.year)); | ||
174 | - sscanf(day,"%d",&(UT.day)); | ||
175 | - sscanf(min,"%d",&(UT.min)); | ||
176 | - sscanf(hour,"%d",&(UT.hour)); | ||
177 | - sscanf(sec,"%d",&(UT.sec)); | ||
178 | - sscanf(msec,"%d",&(UT.msec)); | ||
179 | - if(UT.year < STARTYEAR) TimeFlag = 0; // Time Inetrval | ||
180 | - | ||
181 | - SetDouble(&UT); | ||
182 | - return UT.times; | ||
183 | -} | ||
184 | -/*------------------------------------------------------*/ | ||
185 | - | ||
186 | -/*------------------- Double2DD_Time ---------------------*/ | ||
187 | - char *Double2DD_Time(double Time) | ||
188 | - { | ||
189 | - static dd_time_t UTstring; | ||
190 | - dd_tmstr_t UT; | ||
191 | - | ||
192 | - UT.times = Time; | ||
193 | - SetInt(&UT); | ||
194 | - sprintf(UTstring,"%04d%03d%02d%02d%02d%03d",(UT.year),(UT.day),(UT.hour), (UT.min), (UT.sec),(UT.msec)); | ||
195 | - return &(UTstring[0]); | ||
196 | - } | ||
197 | -/*------------------------------------------------------------*/ | ||
198 | - | ||
199 | -/*================== BACKUP COMPABILITY FUNCTIONS =================*/ | ||
200 | -/*----------------------------------------------------------------- | ||
201 | - * ReadTime() | ||
202 | - * Reads a standard DD time string as an argument | ||
203 | - * and converts it into dd_tmstr_t structure. | ||
204 | - * Function returns the pointer to the internal startic structure dd_tmstr_t. | ||
205 | - * Function redefines TimeFlag. | ||
206 | - *----------------------------------------------------------------*/ | ||
207 | -dd_tmstr_t *ReadTime(char *UTstring) | ||
208 | -{ | ||
209 | - static dd_tmstr_t UT; | ||
210 | - static char year[5] = "0000\0"; | ||
211 | - static char day[4] = "000\0"; | ||
212 | - static char hour[3]= "00\0"; | ||
213 | - static char min[3] = "00\0"; | ||
214 | - static char sec[3]= "00\0"; | ||
215 | - static char msec[4] = "000\0"; | ||
216 | - | ||
217 | - strncpy(year,UTstring,4); | ||
218 | - strncpy(day,UTstring+4,3); | ||
219 | - strncpy(hour,UTstring+7,2); | ||
220 | - strncpy(min,UTstring+9,2); | ||
221 | - strncpy(sec,UTstring+11,2); | ||
222 | - strncpy(msec,UTstring+13,3); | ||
223 | - | ||
224 | - sscanf(year,"%d",&(UT.year)); | ||
225 | - sscanf(day,"%d",&(UT.day)); | ||
226 | - sscanf(min,"%d",&(UT.min)); | ||
227 | - sscanf(hour,"%d",&(UT.hour)); | ||
228 | - sscanf(sec,"%d",&(UT.sec)); | ||
229 | - sscanf(msec,"%d",&(UT.msec)); | ||
230 | - | ||
231 | - if(UT.year < STARTYEAR) TimeFlag = 0; // Time Inetrval | ||
232 | - | ||
233 | - SetDouble(&UT); | ||
234 | - return(&UT); | ||
235 | -} | ||
236 | -/*-------------------- end of ReadTime ------------------------*/ | ||
237 | - | ||
238 | -/*---------------------- Write Time ---------------------------*/ | ||
239 | -/* Function Write time convert use only double times field | ||
240 | - * of dd_tmstr_t structure to print time in DD style | ||
241 | - * in internal static string. The integer fields redefined. | ||
242 | - * Function return string pointer. | ||
243 | - */ | ||
244 | - | ||
245 | -char *WriteTime(dd_tmstr_t *UT) | ||
246 | -{ | ||
247 | - static dd_time_t UTstring; | ||
248 | - | ||
249 | - SetInt(UT); | ||
250 | - sprintf(UTstring,"%04d%03d%02d%02d%02d%03d",(UT->year),(UT->day),(UT->hour), | ||
251 | - (UT->min), (UT->sec),(UT->msec)); | ||
252 | - return(UTstring); | ||
253 | -} | ||
254 | -/*------------------- end of WriteTime -------------------*/ | ||
255 | - | ||
256 | -void WriteFmtTime(dd_tmstr_t *UT,char *UTstring) | ||
257 | -{ | ||
258 | - SetInt(UT); | ||
259 | - sprintf(UTstring,"%04d:%03d:%02d:%02d:%02d",(UT->year),(UT->day),(UT->hour), | ||
260 | - (UT->min), (UT->sec)); | ||
261 | -} | ||
262 | -/*------------------- end of WriteFmtTime -------------------*/ | ||
263 | - | ||
264 | -/*========================================================= | ||
265 | - * Functions for DECODERs | ||
266 | - * These functions make conversion from/to DD double/DD_time_structure and | ||
267 | - * a integer array as follows: | ||
268 | - * {Year, Month, Day_Of_Month, Hour, Min, Sec, Mls} | ||
269 | - *========================================================*/ | ||
270 | -/*-------------------------------------------------------- | ||
271 | - * UT2double() | ||
272 | - * Fille the DD_time_structure with double fild from the | ||
273 | - * integer array (see the section header) | ||
274 | - *-------------------------------------------------------*/ | ||
275 | -dd_tmstr_t *UT2double(unsigned *ut) | ||
276 | -/* Fill the standard structure with double too using as | ||
277 | - * argument 7 int length array in Gavrilova Passport Standard | ||
278 | - */ | ||
279 | -{ | ||
280 | -static dd_tmstr_t UT; | ||
281 | -int visocos; | ||
282 | - | ||
283 | -if(ut[0]%4 == 0) visocos = 1; else visocos = 0; | ||
284 | -UT.year = ut[0]; | ||
285 | -UT.day = monthday[visocos][ut[1] - 1]+ut[2] - 1; | ||
286 | -UT.hour = ut[3]; | ||
287 | -UT.min = ut[4]; | ||
288 | -UT.sec = ut[5]; | ||
289 | -UT.msec = ut[6]; | ||
290 | - | ||
291 | -SetDouble(&UT); | ||
292 | -return(&UT); | ||
293 | -} | ||
294 | -/*-------------------------------------------------------*/ | ||
295 | -/*------------------------------------------------------- | ||
296 | - * Double2UT() | ||
297 | - * Converts Standard DD double time to interger array (see | ||
298 | - * the section header) | ||
299 | - *--------------------------------------------------------*/ | ||
300 | -unsigned *Double2UT(double t) | ||
301 | -{ | ||
302 | - static unsigned UT[7]; | ||
303 | - dd_tmstr_t tm; | ||
304 | - int i,visocos; | ||
305 | - | ||
306 | - tm.times = t; | ||
307 | - SetInt(&tm); | ||
308 | - if(tm.year % 4 == 0) visocos = 1; else visocos = 0; | ||
309 | - i = 0; | ||
310 | - while((i < 12) && (tm.day >= monthday[visocos][i])) i++; | ||
311 | - UT[0] = tm.year; | ||
312 | - UT[1] = i; | ||
313 | - UT[2] = tm.day +1 - monthday[visocos][i-1]; | ||
314 | - UT[3] = tm.hour; | ||
315 | - UT[4] = tm.min; | ||
316 | - UT[5] = tm.sec; | ||
317 | - UT[6] = tm.msec; | ||
318 | - | ||
319 | - return( (unsigned *)UT); | ||
320 | -} | ||
321 | -/*=======================================================================*/ |
src/DECODERS/ascii2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(ascii2nc) | 2 | PROJECT(ascii2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ) | 7 | ) |
8 | 8 | ||
@@ -17,7 +17,7 @@ ADD_EXECUTABLE (ascii2nc ${source_files} ) | @@ -17,7 +17,7 @@ ADD_EXECUTABLE (ascii2nc ${source_files} ) | ||
17 | 17 | ||
18 | target_link_libraries( | 18 | target_link_libraries( |
19 | ascii2nc | 19 | ascii2nc |
20 | - DD_Client | 20 | + ${DDCLIENTLIBRARY} |
21 | ${NETCDFLIBRARY} | 21 | ${NETCDFLIBRARY} |
22 | ) | 22 | ) |
23 | 23 |
src/DECODERS/cdf2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(cdf2nc) | 2 | PROJECT(cdf2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ${libcdf_INCLUDE_DIR} | 7 | ${libcdf_INCLUDE_DIR} |
8 | ) | 8 | ) |
@@ -18,7 +18,7 @@ ADD_EXECUTABLE (cdf2nc ${source_files} ) | @@ -18,7 +18,7 @@ ADD_EXECUTABLE (cdf2nc ${source_files} ) | ||
18 | 18 | ||
19 | target_link_libraries( | 19 | target_link_libraries( |
20 | cdf2nc | 20 | cdf2nc |
21 | - DD_Client | 21 | + ${DDCLIENTLIBRARY} |
22 | ${NETCDFLIBRARY} | 22 | ${NETCDFLIBRARY} |
23 | ${libcdf_LIBRARIES} | 23 | ${libcdf_LIBRARIES} |
24 | ) | 24 | ) |
src/DECODERS/nc2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(nc2nc) | 2 | PROJECT(nc2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ) | 7 | ) |
8 | 8 | ||
@@ -17,7 +17,7 @@ ADD_EXECUTABLE (nc2nc ${source_files} ) | @@ -17,7 +17,7 @@ ADD_EXECUTABLE (nc2nc ${source_files} ) | ||
17 | 17 | ||
18 | target_link_libraries( | 18 | target_link_libraries( |
19 | nc2nc | 19 | nc2nc |
20 | - DD_Client | 20 | + ${DDCLIENTLIBRARY} |
21 | ${NETCDFLIBRARY} | 21 | ${NETCDFLIBRARY} |
22 | ) | 22 | ) |
23 | 23 |
src/DECODERS/themis/esa2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(themis_esa2nc) | 2 | PROJECT(themis_esa2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ${libcdf_INCLUDE_DIR} | 7 | ${libcdf_INCLUDE_DIR} |
8 | ) | 8 | ) |
@@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_esa2nc ${source_files} ) | @@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_esa2nc ${source_files} ) | ||
18 | 18 | ||
19 | target_link_libraries( | 19 | target_link_libraries( |
20 | themis_esa2nc | 20 | themis_esa2nc |
21 | - DD_Client | 21 | + ${DDCLIENTLIBRARY} |
22 | ${NETCDFLIBRARY} | 22 | ${NETCDFLIBRARY} |
23 | ${libcdf_LIBRARIES} | 23 | ${libcdf_LIBRARIES} |
24 | ) | 24 | ) |
src/DECODERS/themis/esafull2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(themis_esafull2nc) | 2 | PROJECT(themis_esafull2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ${libcdf_INCLUDE_DIR} | 7 | ${libcdf_INCLUDE_DIR} |
8 | ) | 8 | ) |
@@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_esafull2nc ${source_files} ) | @@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_esafull2nc ${source_files} ) | ||
18 | 18 | ||
19 | target_link_libraries( | 19 | target_link_libraries( |
20 | themis_esafull2nc | 20 | themis_esafull2nc |
21 | - DD_Client | 21 | + ${DDCLIENTLIBRARY} |
22 | ${NETCDFLIBRARY} | 22 | ${NETCDFLIBRARY} |
23 | ${libcdf_LIBRARIES} | 23 | ${libcdf_LIBRARIES} |
24 | ) | 24 | ) |
src/DECODERS/themis/esamom2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(themis_esamom2nc) | 2 | PROJECT(themis_esamom2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ${libcdf_INCLUDE_DIR} | 7 | ${libcdf_INCLUDE_DIR} |
8 | ) | 8 | ) |
@@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_esamom2nc ${source_files} ) | @@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_esamom2nc ${source_files} ) | ||
18 | 18 | ||
19 | target_link_libraries( | 19 | target_link_libraries( |
20 | themis_esamom2nc | 20 | themis_esamom2nc |
21 | - DD_Client | 21 | + ${DDCLIENTLIBRARY} |
22 | ${NETCDFLIBRARY} | 22 | ${NETCDFLIBRARY} |
23 | ${libcdf_LIBRARIES} | 23 | ${libcdf_LIBRARIES} |
24 | ) | 24 | ) |
src/DECODERS/themis/fgm2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(themis_fgm2nc) | 2 | PROJECT(themis_fgm2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ${libcdf_INCLUDE_DIR} | 7 | ${libcdf_INCLUDE_DIR} |
8 | ) | 8 | ) |
@@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_fgm2nc ${source_files} ) | @@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_fgm2nc ${source_files} ) | ||
18 | 18 | ||
19 | target_link_libraries( | 19 | target_link_libraries( |
20 | themis_fgm2nc | 20 | themis_fgm2nc |
21 | - DD_Client | 21 | + ${DDCLIENTLIBRARY} |
22 | ${NETCDFLIBRARY} | 22 | ${NETCDFLIBRARY} |
23 | ${libcdf_LIBRARIES} | 23 | ${libcdf_LIBRARIES} |
24 | ) | 24 | ) |
src/DECODERS/themis/sst2nc/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(themis_sst2nc) | 2 | PROJECT(themis_sst2nc) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ${libcdf_INCLUDE_DIR} | 7 | ${libcdf_INCLUDE_DIR} |
8 | ) | 8 | ) |
@@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_sst2nc ${source_files} ) | @@ -18,7 +18,7 @@ ADD_EXECUTABLE (themis_sst2nc ${source_files} ) | ||
18 | 18 | ||
19 | target_link_libraries( | 19 | target_link_libraries( |
20 | themis_sst2nc | 20 | themis_sst2nc |
21 | - DD_Client | 21 | + ${DDCLIENTLIBRARY} |
22 | ${NETCDFLIBRARY} | 22 | ${NETCDFLIBRARY} |
23 | ${libcdf_LIBRARIES} | 23 | ${libcdf_LIBRARIES} |
24 | ) | 24 | ) |
src/INCLUDE/DD.h deleted
@@ -1,143 +0,0 @@ | @@ -1,143 +0,0 @@ | ||
1 | -/*================================================================================================= | ||
2 | - * DD SYSTEM | ||
3 | - * DD.h | ||
4 | - * Version: 6.0 | ||
5 | - * Description: The public header to use DD library libDD.a | ||
6 | - * List of changes: | ||
7 | - * Apr. 17, 2002 Fedorov, - New error constant to interrupt the | ||
8 | - * transmission if data dimensions are changed from file | ||
9 | - * to file | ||
10 | - * Nov 18, 2004 - V.4.2 - Fedorov, New errors for CACH manipulating | ||
11 | - * Jun 17, 2007 - V.4.6 Fedorov New requestes and external executables | ||
12 | - * Aug 02, 2007 - V.4.7 Fedorov Modification of call external executables | ||
13 | - * Sep 24, 2007 - V.5.0 Fedorov New status of Get Data: MOREDELAY | ||
14 | - * May 21, 2008 - V.5.1 Fedorov New Status of SetTime: CTIMEISSHIFTED | ||
15 | - * Oct 18, 2012 - V.5.2 Knizhnikova New DD_SetTimeInfo() function | ||
16 | - *=================================================================================================*/ | ||
17 | - | ||
18 | -#include "DD_time.h" | ||
19 | - | ||
20 | -typedef struct { int type; /* Type of variable in netcdf style */ | ||
21 | - int DimNumber; /* number of dimensions */ | ||
22 | - int *Dimensions; /* Dimensions array | ||
23 | - * fastest change is last */ | ||
24 | - int VarNumber; /* Dimension of variable array */ | ||
25 | - void **Variables;/* Variables array pointer | ||
26 | - * It is static array refreshed | ||
27 | - * each call | ||
28 | - */ | ||
29 | - } DD_data_t; | ||
30 | - | ||
31 | -/*------------------- FUNCTIONS ---------------------------*/ | ||
32 | - | ||
33 | -#ifdef __cplusplus | ||
34 | -extern "C" { | ||
35 | -#endif | ||
36 | - | ||
37 | -extern int DD_SetVariable(char *VarName); | ||
38 | -/* | ||
39 | - * VarName - full name of variable <project>:<instrument>:<Variable> | ||
40 | - * Returns VarID or negative in case of error (see bellow) | ||
41 | - */ | ||
42 | - | ||
43 | -extern int DD_GetInform(int VarID,char *AttrName, DD_data_t **data); | ||
44 | -/* | ||
45 | - * VarID - Variable ID from DD_SetVariable | ||
46 | - * AttrName - name of attribute ( defined by konvention ) | ||
47 | - * data - address of data structure | ||
48 | - * Returns 1 if OK and negative value in case of error (see bellow) | ||
49 | - */ | ||
50 | - | ||
51 | -extern int DD_SetTime(int VarID, char *Time); | ||
52 | -/* | ||
53 | - * VarID - Variable ID from DD_SetVariable | ||
54 | - * Time - string defined in DD_time.h | ||
55 | - * Returns 1 if OK and negative value in case of error (see bellow) | ||
56 | - */ | ||
57 | - | ||
58 | -extern int DD_SetTimeInfo(int VarID, char *Time, double *RealTime); | ||
59 | -/* | ||
60 | - * VarID - Variable ID from DD_SetVariable | ||
61 | - * Time - string defined in DD_time.h | ||
62 | - * RealTime - time pointer was set to | ||
63 | - * Returns 1 if OK and negative value in case of error (see bellow) | ||
64 | - */ | ||
65 | - | ||
66 | -extern int DD_GetMultiData(int VarID, size_t VarSize, char **VarNames, char *TimeInt, DD_data_t **data, int BackFlag); | ||
67 | -/* | ||
68 | - * VarID - Variable ID from DD_SetVariable | ||
69 | - * VarSize - number of variables to return | ||
70 | - * VarNames - the array of Names of the requested Variable | ||
71 | - * TimeInt - String of Time interval in DD_time style | ||
72 | - * data - Data structures array | ||
73 | - * BackFlag - 0 - pointer is at the lasy position, 1 - pointer returns to the start point | ||
74 | - * Returns 1 if OK and negative value in case of error (see bellow) | ||
75 | - */ | ||
76 | - | ||
77 | -/* ---------------------------------------- | ||
78 | - * This function below just call DD_GetMultiData | ||
79 | - * for backup | ||
80 | - *---------------------------------------*/ | ||
81 | -extern int DD_GetData(int VarID, char *VarName, char *TimeInt, DD_data_t **data); | ||
82 | - | ||
83 | -extern int DD_MovePoint(int VarID, int RecordNumber); | ||
84 | -/* | ||
85 | - * VarID - Open virtual instrument ID | ||
86 | - * int RecordNumber - +/- records to move | ||
87 | - * Move pointer in the open instrument and return 1 or negative if error | ||
88 | - */ | ||
89 | - | ||
90 | -extern int DD_Close(int VarID); | ||
91 | -/* | ||
92 | - * VarID - Variable ID from DD_SetVariable | ||
93 | - * Returns 1 if OK and negative value in case of error (see bellow) | ||
94 | - */ | ||
95 | - | ||
96 | -extern char *DD_GetVersion(); | ||
97 | -/* | ||
98 | - * return static pointer to internal string with the DDLIB-SERVER package version | ||
99 | - */ | ||
100 | - | ||
101 | -/*----------- Data Update functions -----------------------------------*/ | ||
102 | -extern int DD_AddDataSet(char *DataSetName, char *RemSetID, char *BaseName); | ||
103 | -/* | ||
104 | - * Request for new VI. See ../DOC/TECHDOC/DDServFunct.html | ||
105 | - */ | ||
106 | - | ||
107 | -#ifdef __cplusplus | ||
108 | -} | ||
109 | -#endif | ||
110 | - | ||
111 | -/*--------------------- CONSTANTS -----------------------------------------*/ | ||
112 | -#define MOREDATA 1 /* There is data, but we have to call GetData again right now*/ | ||
113 | -#define MOREDELAY 2 /* There is data, but we have to call GetData again after delay */ | ||
114 | -#define OK 0 /* It is last data packet */ | ||
115 | -#define NOCONNECTION -1 | ||
116 | -#define TOOMANYREQ -2 | ||
117 | -#define REQSENDERR -3 | ||
118 | -#define REPLYRECERR -4 | ||
119 | -#define NOID -5 | ||
120 | -#define NOREFFILE -6 | ||
121 | -#define NOTIMESFILE -7 | ||
122 | -#define NOINFOFILE -8 | ||
123 | -#define NOVAR -9 | ||
124 | -#define OUTOFTIME -10 | ||
125 | -#define CACHERR -11 /* The error occured when program manipulated the cach */ | ||
126 | -#define CACHTOOREC -33 /* Off files in the CASH are created less then 5 sec ago */ | ||
127 | -#define WAITEXTCALL -34 /* Server Waits external call finish */ | ||
128 | -#define TRYAGAIN -35 /* Times file is locked. This request should be repeated again */ | ||
129 | -#define NODATAATTIME -36 /* Requested time is inside NODATA time interval */ | ||
130 | -#define GAPISSMALL -37 /* Gap is too small to call external archive */ | ||
131 | -#define CTIMEISSHIFTED -38 /* The request was in NoData interval, try again with time at the end */ | ||
132 | -#define DATAFILEERR -12 /* The error while manipulate with data file */ | ||
133 | -#define ENVIRERROR -13 /* Error in Environments */ | ||
134 | -#define NOPOINTER -14 /* The pointer points nowhere, SetTime were failed */ | ||
135 | -#define INTSERERR -15 /* Server internal error */ | ||
136 | -#define TIMEINEMPTY -16 /* No data for specified time interval */ | ||
137 | -#define NOEXEC -17 /* No executable */ | ||
138 | - | ||
139 | -#define DD_SHORT 4 | ||
140 | -#define DD_INT 1 | ||
141 | -#define DD_FLOAT 2 | ||
142 | -#define DD_DOUBLE 3 | ||
143 | -#define DD_CHAR 0 |
src/INCLUDE/DD_Access.h deleted
@@ -1,93 +0,0 @@ | @@ -1,93 +0,0 @@ | ||
1 | -/* ====================================================== | ||
2 | - * | ||
3 | - * DD_Access.h | ||
4 | - * V.2.0 | ||
5 | - * Last revision: Oct 7, 2002 | ||
6 | - * List of revisions: 1997 - version 1.0 | ||
7 | - * Oct 7, 2002 - version 2.0 (update a little ) | ||
8 | - */ | ||
9 | - | ||
10 | -#define MAXHOSTLENGTH 16 /* IP-address: "255.255.255.255\0" */ | ||
11 | -#define USRLENGTH 21 /* Length of UserName: + \0 */ | ||
12 | -#define TICKETLENGTH 9 /* Length of passwd: 8 + \0 */ | ||
13 | -#define HOSTNAMELENGTH 120 /* Length of the user host name */ | ||
14 | -#define USERCASHLEN 100 /* Size of user_ticket.nc file must be 300 */ | ||
15 | -#define NONAME "no_name\0" /* Name of user in case of non-WEB connection */ | ||
16 | -#define ACCINSTR "iball:acc:all" /* Instrument which watch the access */ | ||
17 | -#define TICKET_PATH "/ACC/user_ticket.nc" | ||
18 | -#define USERREFNAME "/ACC/user_info.nc" | ||
19 | -#define LOGFILE "/ACC/login.log" | ||
20 | - | ||
21 | -/*------------ Errors of ACCESS ---------------------*/ | ||
22 | -#define NOPERMISSION -100 | ||
23 | -#define NOHOST -101 | ||
24 | -#define NOUSERSFILE -102 | ||
25 | - | ||
26 | -/*--------------- Extern global variables -------------------*/ | ||
27 | -extern char UserName[USRLENGTH]; /* defined in DD_client.c */ | ||
28 | -extern char UserHost[MAXHOSTLENGTH]; /* defined in DD_client.c */ | ||
29 | -extern int UserID; /* defined in DD_client.c */ | ||
30 | - | ||
31 | -/*--------------- Extern Functions ---------------------------*/ | ||
32 | -extern int FillStruct (int argc, void **argv); | ||
33 | -/* This function used to set up the host address from IDL (when WWW access used) | ||
34 | - * Arguments allocation is as follows: | ||
35 | - * UserName - 0 | ||
36 | - * UserHost - 1 | ||
37 | - * Location: DD_idl.c -> DD_idl.so | ||
38 | -*/ | ||
39 | - | ||
40 | -extern int GetTicket(int UID, char *HostName, int DD_user_id); | ||
41 | -/* Description: This function find the user data in user_cash.nc | ||
42 | - * If O'k rewrite the line with new time. | ||
43 | - * In case of a new user, remove the first line with | ||
44 | - * older time data then a current time + 4.5 hours. | ||
45 | - * | ||
46 | - Takes 3 arguments: UserId (id in the romote host) | ||
47 | - Remote host address(string,like "193.232.6.60\0") | ||
48 | - DD_user_id(can see in user_info.nc) | ||
49 | - | ||
50 | - Returns 0 if O'k or NOPERMISSIONS, or ERROR | ||
51 | - | ||
52 | - If DD_log_name equal NULL searching for UserId, IP-address | ||
53 | - If DD_log_name nonequal NULL searching for IP-address,DD_log_name* | ||
54 | - * | ||
55 | - */ | ||
56 | -extern int CheckTicket(char *NameUsr, char *Ticket); | ||
57 | -/* Description: This function check if user exosts | ||
58 | - * in user_info.nc file. Returns DD_id if O'k. | ||
59 | - * It returns NOPERMISSION or other errors | ||
60 | - */ | ||
61 | - | ||
62 | -extern int ShowTicket(int userid, char *hostname, char *DD_name); | ||
63 | -/* | ||
64 | - * Show if user has authorisation to work | ||
65 | - */ | ||
66 | - | ||
67 | -extern int LoginRequest(char *UserPasswd, char *UserLogin, char *HostName); | ||
68 | -/* Description: Library function for client-server using. | ||
69 | - * Send ID, Password,UserLogin, and host to server. | ||
70 | - * Compares the information with your {id,hostname and other}. | ||
71 | - * Returns 0 if O'k, or a negative value in case | ||
72 | - * of "NOPERMISSION" or error. | ||
73 | - * | ||
74 | - */ | ||
75 | -extern int SetUser(int UserID, char *HostName, char *LogName); | ||
76 | -/* Description: Library function for client-server using. | ||
77 | - * Send UserID, HostName to server. | ||
78 | - * Compares the information with your {id,hostname}. | ||
79 | - * Returns 1 if O'k, or a NOPERMISSION, or error number | ||
80 | - */ | ||
81 | - | ||
82 | -extern int CheckID(char *NameUsr); | ||
83 | -/* Description: This function check the user name in user_info.nc file. | ||
84 | - * Returns DD_id if exists. | ||
85 | - * It returns NOPERMISSION or other errors | ||
86 | - */ | ||
87 | - | ||
88 | -extern void Put2Log(int UID, char *Host, char *LogName, int error); | ||
89 | -/* Description: This function logs a user's ID, IP-address of a local host, | ||
90 | - * login name and permission information into log file. | ||
91 | - * | ||
92 | - */ | ||
93 | - |
src/INCLUDE/DD_comm.h deleted
@@ -1,412 +0,0 @@ | @@ -1,412 +0,0 @@ | ||
1 | -/*================================================================================= | ||
2 | - * DD SYSTEM base package | ||
3 | - * DD_Server DD_Client library | ||
4 | - * DD_comm.h | ||
5 | - * V. 6.0 | ||
6 | - * Changes listing: | ||
7 | - * Feb 27 1995 - V 1.0 | ||
8 | - * 13 Apr. 2002 - changed for NetCDF 3.3 | ||
9 | - * 03 Oct. 2002 - v.4.0 Fedorov, communication ideology is changed | ||
10 | - * Oct 31, 2002 - V.4.1 Fedorov, UserName, UserHost and UserID transferred into DD_Access.h | ||
11 | - * May 7, 2003 - V.4.2 Fedorov, The Cash structure is changed (flag of open file ) | ||
12 | - * June 17, 2003 - V.4.3 Fedorov, The Maximal Packet Size is changed | ||
13 | - * Nov 18, 2004 - V.4.4 Fedorov, Some changes | ||
14 | - * Aug 17, 2005 - V.4.5 Fedorov, Cach Time constant is changed | ||
15 | - * Jun 17, 2007 - V.4.6 Fedorov, New requestes and external executables | ||
16 | - * Aug 01, 2007 - V.4.7 Fedorov, Cache length = 20, New DD_Var_t structure | ||
17 | - * Sep 20, 2007 - V.5.0 Fedorov, Update Time Info library now in the separate file | ||
18 | - * Sep 23, 2007 - V.5.1 Fedorov, New interface of SetTime | ||
19 | - * Sep 25, 2007 - V.5.2 Fedorov, Individual minimal gap | ||
20 | - * Oct 08, 2007 - V.5.3 Budnik, php createVI.php <baseID> <remSetID> <ddSetID> | ||
21 | - * Jan 25, 2008 - V.5.3.1 Budnik, min data gap = 1 day!!!! | ||
22 | - * May 22, 2008 - V.5.4 Fedorov, DD_Var_t has a LockStartTime value | ||
23 | - * May 27, 2008 - V.5.5 Fedorov, Maximal tracnsmition buffer | ||
24 | - * Sep 19, 2008 - V.5.6 MAXVARLENGTH=64 REQUESTLENGTH 184 | ||
25 | - * Dec 15, 2012 - V.6.0 New multiparam Get_MultiData() function | ||
26 | - *===================================================================================*/ | ||
27 | - | ||
28 | -#include <stdio.h> | ||
29 | -#include <sys/errno.h> | ||
30 | -#include <stdlib.h> | ||
31 | -#include <string.h> | ||
32 | -#include <sys/types.h> | ||
33 | -#include <sys/time.h> | ||
34 | -#include <time.h> | ||
35 | -#include "DD_Access.h" | ||
36 | - | ||
37 | -#ifdef SOLARIS | ||
38 | -#include <sys/socket.h> | ||
39 | -#include <netdb.h> | ||
40 | -#include <netinet/in.h> /* internet stile addres */ | ||
41 | -#include <rpc/types.h> | ||
42 | -#include <rpc/xdr.h> | ||
43 | -#include <rpc/rpc.h> | ||
44 | -#endif /* SOLARIS */ | ||
45 | - | ||
46 | -#ifdef HPUX | ||
47 | -#include <sys/socket.h> | ||
48 | -#include <netinet/in.h> | ||
49 | -#include <netdb.h> | ||
50 | -#include <sys/un.h> | ||
51 | -#include <rpc/xdr.h> | ||
52 | -#include <rpc/rpc.h> | ||
53 | -#endif | ||
54 | - | ||
55 | -#ifdef OSF1 | ||
56 | -#include <sys/socket.h> | ||
57 | -#include <netdb.h> | ||
58 | -#include <arpa/inet.h> | ||
59 | -#include <rpc/xdr.h> | ||
60 | -#endif /* OSF1 */ | ||
61 | - | ||
62 | -#ifdef LINUX | ||
63 | -#include <sys/socket.h> | ||
64 | -#include <netinet/in.h> | ||
65 | -#include <netdb.h> | ||
66 | -#include <rpc/rpc.h> | ||
67 | -#include <rpc/xdr.h> | ||
68 | -#endif /* LINUX */ | ||
69 | - | ||
70 | -#ifdef SUNOS | ||
71 | -#include <sys/socket.h> | ||
72 | -#include <sys/socketvar.h> | ||
73 | -#include <netinet/in.h> | ||
74 | -#include <netdb.h> | ||
75 | -#include <rpc/xdr.h> | ||
76 | -#endif /* SUNOS */ | ||
77 | - | ||
78 | -/*----------------- Defenitions of request and server replies --------------------*/ | ||
79 | -/* 1. Data manipulation requests */ | ||
80 | -#define OPENINSREQ 0 /* Open virtual instrument */ | ||
81 | -#define DATAINFOREQ 1 /* Request of constant info */ | ||
82 | -#define TIMESETREQ 2 /* Position of pointer by StartTime*/ | ||
83 | -#define DATAGETREQ 3 /* Data request by time interval */ | ||
84 | -#define CLOSEINSREQ 4 /* Request to close virtual instrument */ | ||
85 | -#define MOVPOINTREQ 5 /* Move the pointer od data request*/ | ||
86 | -#define ADDVIREQ 6 /* Add New virtual instrument */ | ||
87 | - | ||
88 | -/* 2. Security requests */ | ||
89 | -#define GETTICKETREQ 10 | ||
90 | -#define SHOWTICKETREQ 11 | ||
91 | - | ||
92 | -/*-------- Some constants ------------------*/ | ||
93 | -#define EMPTY 0 /* Filler of the trailer */ | ||
94 | -#define FILEACCMARG 1 /* The minimum time from the last access to remove this file */ | ||
95 | - | ||
96 | -/*------------ Important lengths and pathes ----------------*/ | ||
97 | -#define PROTOCOL 0 /* protocol TCP */ | ||
98 | -#define REPLYLENGTH 12 /* Length of header of reply packet */ | ||
99 | -#define REQUESTLENGTH 196 /* Length of request packets MAXSETLENGTH + 2*MAXVARLENGTH + 16 */ | ||
100 | -#define MAXVARLENGTH 64 /* Length (with \0) of Variable Name */ | ||
101 | -#define MAXSETLENGTH 52 /* Max Length of VI name */ | ||
102 | -#define PATHLENGTH 128 /* Length of complete path */ | ||
103 | -#define MAXFILENAME 32 /* The maximal length of the data file (info, cach, times as well)*/ | ||
104 | -#define REFNAME "/refer.nc" /* path name for databse refer file */ | ||
105 | -#define CASHLEN 20 /* Length of cash array */ | ||
106 | -#define TRY 100 /* How many tymes to ask the socket */ | ||
107 | -#define MAXPACKSIZE 5000000 /* Maximal size of one packet of transmission in bytes */ | ||
108 | -#define MAXCOMMANDL 300 /* Command in system() maximal length | ||
109 | -/*------------------------------------------------- | ||
110 | - * XDR length to calcolate the total len | ||
111 | - *-------------------------------------------------*/ | ||
112 | -#define XDRINTLEN 4 | ||
113 | -#define XDRFLOATLEN 4 | ||
114 | -#define XDRDOUBLELEN 8 | ||
115 | -// String length is counted as 4B + N + r (to completed to 4 bytes) | ||
116 | - | ||
117 | -/*------------ List of External Call of DD_Server and ERRORS -------------------*/ | ||
118 | -#define ADDDATASETCALL "php %s/CALLEXT/createVI.php %s %s %s" /* Format to call to create new VI */ | ||
119 | -#define GETNEWDATACALL "php %s/CALLEXT/getData%s.php %s %s %s %s &" /* Format to call to get new data */ | ||
120 | -#define NOPHP 32512 | ||
121 | -#define NOSCRIPT 256 | ||
122 | -#define PHPOK 0 | ||
123 | - | ||
124 | -/*------ Constant to understand data availabilities -------------------------------*/ | ||
125 | -#define GLOBSTARTNAME "GlobalStart" | ||
126 | -#define GLOBSTOPNAME "GlobalStop" | ||
127 | -#define SAMPLNAME "MinSampling" | ||
128 | -#define REMARCHNAME "DataBaseID" | ||
129 | -#define REMINSTNAME "DataSetID" | ||
130 | -#define MINGAP 86400.0 /*Seconds. The minimal time gap to set up the flag DATAGAP */ | ||
131 | -#define REQTIMEINT 86400.0 /* One day, +/- of request time interval */ | ||
132 | -#define ISOTIMEF "%4u%*1c%2u%*1c%2u%*1c%2u%*1c%2u%*1c%2u%*1c%3u" /* Format to READ time in ISO format */ | ||
133 | -#define ISOTIMEP "%04u-%02u-%02uT%02u:%02u:%02u.%03uZ" /* Format to PRINT time in ISO format */ | ||
134 | -#define NODATASTR "NODATA" | ||
135 | -#define DIRLOCK "LOCK" | ||
136 | - | ||
137 | -#define QUANTOFFSET 0.01 | ||
138 | -/*------------- More internal specifications -----------------------*/ | ||
139 | -/* | ||
140 | - * See ../DOC/TECHDOC/DDGenProt.html (lyx) | ||
141 | - */ | ||
142 | - | ||
143 | -/* Reply variables: | ||
144 | - * Error - negative value described in DD.h | ||
145 | - * Type - int (see DD.h) | ||
146 | - * Dim_Number - int ( the dimension (vector, matrix, cube, etc) ov the variable) | ||
147 | - * Data_Size - int (the size of the data packet in bytes) | ||
148 | - * RemID - int (number of virtual instruments still open in this session) | ||
149 | - * Dim - int (the particular dimension ) | ||
150 | - * LastPacketFlag - int ( == OK in this packet is last, or MOREDATA) | ||
151 | - * Data - array of Type of Dim X Dim X....X Dim size | ||
152 | - * -------------------- | ||
153 | - * Dim_Number | ||
154 | - * DataPacket: | ||
155 | - * | ||
156 | - * <LastPacketFlag> | | ||
157 | - * <Dim> | | | ||
158 | - * <.....> | Dim_Number | Data_Size bytes | ||
159 | - * <Dim> | | | ||
160 | - * <data> | | ||
161 | - * ..... | only for real data | | ||
162 | - * <data> | | | ||
163 | - * | ||
164 | - * Note is the value is scalar - the Dim = 0 (???) | ||
165 | - */ | ||
166 | - | ||
167 | -/* REPLY SPECIFICATION | ||
168 | - * | ||
169 | - * Reply consists Header 12 bytes length and Data Block | ||
170 | - * | ||
171 | - * on Open Virtual instrument: | ||
172 | - * <OPENINSREQ><ID/Eroor><EMPTY><EMPTY> | ||
173 | - * on Constant Info request: | ||
174 | - * <DATAINFOREQ><Type/Error><Dim_Number><Data_Size><DataPacket> | ||
175 | - * on Set pointer by StartTime: | ||
176 | - * <SETTIMEREQ><EMPTY/Error><EMPTY><EMPTY> | ||
177 | - * on Get Data by TimeInt : | ||
178 | - * <DATAGETREQ><Type/Error><Dim_Numbers><Data_Size><LastRecordFlag><DataPacket> | ||
179 | - * on Move pointer with records number | ||
180 | - * <MOVPOINTREQ><EMPTY/Error><EMPTY><EMPTY> | ||
181 | - * on Close Virtual Instrument | ||
182 | - * <CLOSEINSREQ><RemID/Error><EMPTY><EMPTY> | ||
183 | - */ | ||
184 | - | ||
185 | -/*-------------------- TYPEDEF ---------------------------*/ | ||
186 | -typedef struct { | ||
187 | - char CacheFilePath[PATHLENGTH]; | ||
188 | - char names[CASHLEN][MAXSETLENGTH]; | ||
189 | - long times[CASHLEN]; | ||
190 | - int FileOpen[CASHLEN]; /* 1 if file is open */ | ||
191 | - int ID; /* ID of open cach file */ | ||
192 | - int nameID; /* ID of names array */ | ||
193 | - int timeID; /* ID of times array */ | ||
194 | - int fopenID; /* ID of fopen flag */ | ||
195 | - } DD_cash_t; /* The structure holding cash informaton | ||
196 | - * of particular virtual instrument DataBase | ||
197 | - */ | ||
198 | - | ||
199 | -/* | ||
200 | - * This structure corresponds to ONE requested variable | ||
201 | - * of some Virtual instrument | ||
202 | - */ | ||
203 | -typedef struct { char InstrName[MAXSETLENGTH]; /* Virtual Instrument Name */ | ||
204 | - char path[PATHLENGTH]; /* Path to directory of open virtual instrument */ | ||
205 | - /*--------------------------------------- | ||
206 | - * Cache part | ||
207 | - *--------------------------------------*/ | ||
208 | - DD_cash_t Cash; /* Cash holder */ | ||
209 | - int CurrCushN; /* Current cash pointer */ | ||
210 | - /*-------------------------------------- | ||
211 | - * This is the part of open data file and corresponding data set | ||
212 | - *-------------------------------------*/ | ||
213 | - int ncID; /* ID of open nc_file */ | ||
214 | - size_t nc_rec; /* the current record number nc_file */ | ||
215 | - size_t Maxnc_rec; /* Maximum of records number in in the current nc file */ | ||
216 | - DD_data_t *VarData; /* Static pointer. Variables Holder */ | ||
217 | - size_t ParamSize; /* Number or requested variables to save */ | ||
218 | - /*--------------------------------------------- | ||
219 | - * This is part of times file of given VI | ||
220 | - *--------------------------------------------*/ | ||
221 | - char TimesFileName[PATHLENGTH]; | ||
222 | - double SDTime; /* Requested Start Time in double form */ | ||
223 | - double FDTime; /* Requested Stop Time in double form */ | ||
224 | - double CDTime; /* Current Time in double form */ | ||
225 | - int tmID; /* ID of "times" file of this virtual instrument*/ | ||
226 | - int NameID; /* ID of FileName variable in times file */ | ||
227 | - int StartID; /* ID of Start variable in times file */ | ||
228 | - int StopID; /* ID of Stop variable in times file */ | ||
229 | - size_t TimeRecNumber; /* Current Record number in the "times" file */ | ||
230 | - size_t MaxTimeRecNum; /* Maximum records number in the "times" file */ | ||
231 | - int RValidMin; /* Minimal record with valid data */ | ||
232 | - int RValidMax; /* Maximal record with valid data */ | ||
233 | - double MinValidTime; | ||
234 | - double MaxValidTime; /* Start of RValidMin, and stop of RValidMax */ | ||
235 | - int CurrRmin; /* Sure that looking time is greater than stop; -1 if NOT */ | ||
236 | - int CurrRmax; /* Sure that looking time is less than start; -1 if NOT */ | ||
237 | - /*------- Working with external Data Base ------------------------------*/ | ||
238 | - int VILocked; /* Flag to show that request to remote database has been sent */ | ||
239 | - time_t LockStartTime; /* Value to calculate a time elapsed from lock made by THIS VI */ | ||
240 | - /*---------- This is the part of Info file of given VI -----------------*/ | ||
241 | - int attrID; /* ID of constant information nc_file */ | ||
242 | - char AttrName[PATHLENGTH]; /* Name of constant information file */ | ||
243 | - DD_data_t AttrData; /* Dimensions of Attributes */ | ||
244 | - /*---- Part concerning External call ------------------*/ | ||
245 | - double MinGap; /* The minimal gap between two files */ | ||
246 | - double GlobalStart; /* The principal begin of data */ | ||
247 | - double GlobalStop; /* The principal end of data */ | ||
248 | - char BaseName[MAXSETLENGTH]; /* The name of external data archive */ | ||
249 | - char RemSetID[MAXSETLENGTH]; /* The name of VI in exterval archiving */ | ||
250 | - int ExtCallAllowed; /* 1 If Server can call external archiving */ | ||
251 | - /*------------ Flow Control -----------------------------*/ | ||
252 | - int LastPacketFlag; /* OK - request is completed, | ||
253 | - * MOREDATA - one or several blocks expected, | ||
254 | - * MOREDELAY - wait, system is blocked */ | ||
255 | - int LastFileStatus; /* The file status after the last SetNewFile */ | ||
256 | - int NewFile; /* 1 if File was changed, VI has to be refreshed*/ | ||
257 | - int NewFileWasOpen; /* 1 if the original position of pointer | ||
258 | - * (in data file, times file) was lost after open | ||
259 | - * a new data file */ | ||
260 | - } DD_Var_t; | ||
261 | - | ||
262 | -/*---------------- Usefull enumerations ---------------------*/ | ||
263 | -enum SearchRet {REACHLEFT, REACHRIGHT, OKLEFT, OKRIGHT}; | ||
264 | - /* | ||
265 | - * enumerate of the status of time inteval searching | ||
266 | - * NOONEDATA - no data at al in this VI | ||
267 | - * INSIDE - CTime is inside valid data interval (tolerance is MINGAP) | ||
268 | - * DATAATRIGHT, DATAATLEFT - Valid interval is on the right/left from CTime | ||
269 | - */ | ||
270 | -enum SearchIntRet {NOONEDATA, INSIDE, DATAATRIGHT, DATAATLEFT, IDLE}; | ||
271 | - | ||
272 | -/* Return function IsTimesLocked */ | ||
273 | -enum LockStatus {NOLOCK, LOCKED, LOCKREMOVED}; | ||
274 | - | ||
275 | - | ||
276 | -/*------------------ Function for Server ---------------------*/ | ||
277 | -extern int OpenInstr(char *InstrName); | ||
278 | - | ||
279 | -/* | ||
280 | - * Init shared memory for cache system | ||
281 | - */ | ||
282 | -extern void Cache_Init(); | ||
283 | - | ||
284 | -/* | ||
285 | - * Free shared memory used for cache system | ||
286 | - */ | ||
287 | -extern void Cache_Free(); | ||
288 | - | ||
289 | -/* | ||
290 | - * Free shared memory used for cache system | ||
291 | - */ | ||
292 | -extern int Cache_RequestDataFileAccess(DD_Var_t *D, char* dataFileName); | ||
293 | - | ||
294 | -/* | ||
295 | - * Free shared memory used for cache system | ||
296 | - */ | ||
297 | -extern int Cache_ReleaseDataFileAccess(DD_Var_t *D); | ||
298 | - | ||
299 | -/* | ||
300 | - * Close cache file | ||
301 | - */ | ||
302 | -extern int Cache_CloseFile(DD_Var_t *D); | ||
303 | - | ||
304 | -/* | ||
305 | - * Open Virtual instrument by name and returns the ID | ||
306 | - * Returns negative value in case of error (see DD.h)or OK | ||
307 | - */ | ||
308 | -extern int GetAttribute(int ID, char *Name); | ||
309 | -/* | ||
310 | - * Variable - address of structure with variable description | ||
311 | - * Name - name of attribute | ||
312 | - * Returns OK or an error (see DD.h) | ||
313 | - */ | ||
314 | -extern int GetMultiData(int ID, int VarSize, char **VarNames, char *TimeInterval, int BackFlag); | ||
315 | -/* | ||
316 | - * VarSize - size of the array of Names | ||
317 | - * Names - array of strings with names of requested variables, | ||
318 | - * TimeInterval - Time in DD_time.h style | ||
319 | - * Returns negative value in case of error (see bellow) | ||
320 | - * Returnes MOREDATA if "there is more data", and OK if data is finished. | ||
321 | - */ | ||
322 | - | ||
323 | -extern int SetTime(DD_Var_t *D, double CTime); | ||
324 | -/*################################################################# | ||
325 | - * SET TIME | ||
326 | - * Set time and try to open appropriate data file. If not try to | ||
327 | - * call external archive | ||
328 | - * D - address of VI holder | ||
329 | - * Time - Time in DD_time.h style | ||
330 | - * Return: | ||
331 | - * OK | ||
332 | - * NOID - call with uncorrect VI holder | ||
333 | - * OUTOFTIME - Requested time is out of General time limitation | ||
334 | - * WAITEXTCALL - Server sent request to external archive | ||
335 | - * TRYAGAIN - VI is blocked by call to external database | ||
336 | - * NODATAATTIME - request time is inside NODATA time interval | ||
337 | - * some return of SetNewFile(); see ... | ||
338 | - *#################################################################*/ | ||
339 | - | ||
340 | -extern int CloseID(int ID); | ||
341 | -/* ID - integer identificator of opened Data Set | ||
342 | - * Returns number of remained IDs of this communication seasson | ||
343 | - * in case of 0 the server closes this comminication session | ||
344 | - */ | ||
345 | - | ||
346 | -int SetNewFile(DD_Var_t *D, int N); | ||
347 | -/* | ||
348 | - * Function tries to get new data for the gap beetween files, or just | ||
349 | - * open a new data file according to offset N referring to current position in the times file. | ||
350 | - * The current position changed if file is succesefully open. | ||
351 | - * Return values: | ||
352 | - * OK | ||
353 | - * OUTOFTIME - next interval exceeeds GlobalStart/Stop | ||
354 | - * TIMEINEMPTY - next interval marked as "NODATA" | ||
355 | - * TRYAGAIN - the VI is blocked while new data is arriving | ||
356 | - * WAITEXTCALL - new data is requested | ||
357 | - * CACHTOOREC - now free space in the CACH | ||
358 | - * CHACHERR - unrecovable error in CACH | ||
359 | - * DATAFILEERR - unrecovable error in data file | ||
360 | - */ | ||
361 | - | ||
362 | -size_t MaxRecord(int ncID); | ||
363 | -/* | ||
364 | - * Inspect all variables and dimensions of the file (exept Time associated) and | ||
365 | - * returm maximal record number to transmit | ||
366 | - */ | ||
367 | - | ||
368 | -/*------------------ Global constants ----------------------------------*/ | ||
369 | -static u_int xdrlen[] = {4,4,4,8,4}; | ||
370 | -static size_t unixlen[] = {sizeof(char),sizeof(int),sizeof(float),sizeof(double),sizeof(short)}; | ||
371 | -static bool_t ( *ConvFunc[5])() = {xdr_char, xdr_int, xdr_float, xdr_double, xdr_short}; | ||
372 | - | ||
373 | -/*------------------ Global data variable for entire session --------------------*/ | ||
374 | -extern DD_Var_t **DD_Var ; /* Actually this variable is implimented | ||
375 | - * in DD_GetData.c . The dimension of this array is defined | ||
376 | - * by sysconf(_SC_OPEN_MAX)*/ | ||
377 | -extern size_t MaxIDNumber; /* Size of DD_Var array. Defined actually in DD_GetData.c */ | ||
378 | - | ||
379 | -/* | ||
380 | - * Fuctions prototypes in ExtDataRequest.c file | ||
381 | - */ | ||
382 | -/*====================================================================== | ||
383 | - * IsTimesLocked | ||
384 | - * Return 1 if there is LOCK in the VI directory | ||
385 | - *======================================================================*/ | ||
386 | -extern int IsTimesLocked(DD_Var_t *DD_Var); | ||
387 | - | ||
388 | -/*====================================================================== | ||
389 | - * ExtDataRequest | ||
390 | - * Return folowing values: | ||
391 | - * OK - request is accepted SERVER has to wait when LOCK file is gone | ||
392 | - * NOEXEC - error in external executable | ||
393 | - * NODATAATTIME - time corresponds to the NODATA interval | ||
394 | - * GAPISSMALL - Time is inside too small gap | ||
395 | - *======================================================================*/ | ||
396 | -extern int ExtDataRequest(DD_Var_t *DD_Var, double CurrTime); | ||
397 | - | ||
398 | -/*======================================================================= | ||
399 | - * UpdateTimeInfo.c | ||
400 | - * int SearchLeft(DD_Var_t *DD_VarL, size_t Rmin, size_t Rmax) | ||
401 | - * int SearchRight(DD_Var_t *DD_VarL, size_t Rmin, size_t Rmax) | ||
402 | - * Search the next to the left(right) non-empty time interval | ||
403 | - * DD_VarL - common data structure corresponding to THIS open VI | ||
404 | - * Rmin, Rmax - start points | ||
405 | - * | ||
406 | - * int UpdateTimeInfo(DD_Var_t *DD_VarL) | ||
407 | - * Function reopen "times" file and update all time constants | ||
408 | - *======================================================================*/ | ||
409 | -extern int SearchLeft(DD_Var_t *DD_VarL, size_t Rmin, size_t Rmax); | ||
410 | -extern int SearchRight(DD_Var_t *DD_VarL, size_t Rmin, size_t Rmax); | ||
411 | -extern int UpdateTimeInfo(DD_Var_t *DD_VarL); | ||
412 | - |
src/INCLUDE/DD_time.h deleted
@@ -1,59 +0,0 @@ | @@ -1,59 +0,0 @@ | ||
1 | -/* This is header file for working with DD time */ | ||
2 | -/* V.4.1 */ | ||
3 | -/* name: DD_time.h | ||
4 | - * Author: Andrey Fredorov | ||
5 | - * Institution: IKI RAN | ||
6 | - * Date: 21-Feb-1995 | ||
7 | - * Last update Sept 05, 2011 | ||
8 | - * Sept 05, 2011: V.3.2 SetIntNew => arg TimeKind => to work with 1970-1973 : BR | ||
9 | - */ | ||
10 | - | ||
11 | -#define TIMELENGTH 17 | ||
12 | - | ||
13 | -typedef char dd_time_t[TIMELENGTH]; /* YYYYDDDHHMMSSMLS */ | ||
14 | - | ||
15 | -/* ---------------- Functions prototypes ----------------------*/ | ||
16 | -extern double DD_Time2Double(dd_time_t DD_Time); | ||
17 | -/* Convert string to double and return. | ||
18 | - * Return negative value in case of error string format | ||
19 | - */ | ||
20 | -extern char *Double2DD_Time(double Time); | ||
21 | -/* Convert double Time value into string form and return pointer to static string | ||
22 | - * allocated INSIDE the library. Thus the value is renoveted each function call. | ||
23 | - */ | ||
24 | - | ||
25 | -/*---------------- Backup compability with V.3.0 and earlier ----------*/ | ||
26 | -typedef struct { double times; /* time sec from 1970 */ | ||
27 | - int year; | ||
28 | - int day; | ||
29 | - int hour; | ||
30 | - int min; | ||
31 | - int sec; | ||
32 | - int msec; | ||
33 | - } dd_tmstr_t ; | ||
34 | - | ||
35 | - | ||
36 | -extern dd_tmstr_t *ReadTime(char *UT); /* Read time from sring and fill static | ||
37 | - * structure defined IN function. | ||
38 | - * Returns pointer of strusture */ | ||
39 | -extern char *WriteTime(dd_tmstr_t *UT); /* Get pointer of time structure | ||
40 | - * and convert it into string | ||
41 | - * Function returns pointer of | ||
42 | - * internal string */ | ||
43 | - | ||
44 | -extern void WriteFmtTime(dd_tmstr_t *UT,char *UTstring); | ||
45 | - | ||
46 | -extern void SetDouble(dd_tmstr_t *UT); /* Fill double value of dd_tmstr_t */ | ||
47 | - | ||
48 | -typedef enum {DD_TM_UNKNOWN, DD_TM_TIME_INTERVAL, DD_TM_DATE} t_DDTimeKind; | ||
49 | - | ||
50 | -extern void SetInt(dd_tmstr_t *UT); /* Fill int values of dd_tmstr_t */ | ||
51 | -extern void SetIntNew(dd_tmstr_t *UT,t_DDTimeKind timeKind); | ||
52 | - | ||
53 | -/*------- Functions for DECODERS ------------------------ | ||
54 | - *These functions works with with Gavrilova's UT representation */ | ||
55 | -extern dd_tmstr_t *UT2double(unsigned *UT); /* Set standard time | ||
56 | - * structure and return | ||
57 | - * its pointer | ||
58 | - */ | ||
59 | -extern unsigned *Double2UT(double Time); /*Converts Double to Gavrilova array */ |
src/SERVER/CMakeLists.txt
@@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
2 | PROJECT(DD_Server) | 2 | PROJECT(DD_Server) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | ||
6 | ${NETCDFINCLUDE_DIR} | 5 | ${NETCDFINCLUDE_DIR} |
6 | + ${DDCLIENTINCLUDE_DIR} | ||
7 | ) | 7 | ) |
8 | 8 | ||
9 | #Configuration de l'exécutable | 9 | #Configuration de l'exécutable |
@@ -18,7 +18,7 @@ ADD_EXECUTABLE (DD_Server ${source_files} ) | @@ -18,7 +18,7 @@ ADD_EXECUTABLE (DD_Server ${source_files} ) | ||
18 | target_link_libraries( | 18 | target_link_libraries( |
19 | DD_Server | 19 | DD_Server |
20 | ${CMAKE_THREAD_LIBS_INIT} | 20 | ${CMAKE_THREAD_LIBS_INIT} |
21 | - DD_Client | 21 | + ${DDCLIENTLIBRARY} |
22 | ${NETCDFLIBRARY} | 22 | ${NETCDFLIBRARY} |
23 | ${CRYPT_LIBRARY} | 23 | ${CRYPT_LIBRARY} |
24 | ) | 24 | ) |
src/TIMESUPDATE/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(TimesUpdate) | 2 | PROJECT(TimesUpdate) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ) | 7 | ) |
8 | 8 | ||
@@ -17,7 +17,7 @@ ADD_EXECUTABLE (TimesUpdate ${source_files} ) | @@ -17,7 +17,7 @@ ADD_EXECUTABLE (TimesUpdate ${source_files} ) | ||
17 | 17 | ||
18 | target_link_libraries( | 18 | target_link_libraries( |
19 | TimesUpdate | 19 | TimesUpdate |
20 | - DD_Client | 20 | + ${DDCLIENTLIBRARY} |
21 | ${NETCDFLIBRARY} | 21 | ${NETCDFLIBRARY} |
22 | ) | 22 | ) |
23 | 23 |
src/TIMESUPDATENODATA/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(TimesUpdateNoData) | 2 | PROJECT(TimesUpdateNoData) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ${NETCDFINCLUDE_DIR} | 6 | ${NETCDFINCLUDE_DIR} |
7 | ) | 7 | ) |
8 | 8 | ||
@@ -17,7 +17,7 @@ ADD_EXECUTABLE (TimesUpdateNoData ${source_files} ) | @@ -17,7 +17,7 @@ ADD_EXECUTABLE (TimesUpdateNoData ${source_files} ) | ||
17 | 17 | ||
18 | target_link_libraries( | 18 | target_link_libraries( |
19 | TimesUpdateNoData | 19 | TimesUpdateNoData |
20 | - DD_Client | 20 | + ${DDCLIENTLIBRARY} |
21 | ${NETCDFLIBRARY} | 21 | ${NETCDFLIBRARY} |
22 | ) | 22 | ) |
23 | 23 |
tests/CMakeLists.txt
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | PROJECT(testParallel) | 2 | PROJECT(testParallel) |
3 | 3 | ||
4 | include_directories( | 4 | include_directories( |
5 | - ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ | 5 | + ${DDCLIENTINCLUDE_DIR} |
6 | ) | 6 | ) |
7 | 7 | ||
8 | #Configuration de l'exécutable | 8 | #Configuration de l'exécutable |
@@ -17,7 +17,7 @@ ADD_EXECUTABLE (testParallel ${source_files} ) | @@ -17,7 +17,7 @@ ADD_EXECUTABLE (testParallel ${source_files} ) | ||
17 | target_link_libraries( | 17 | target_link_libraries( |
18 | testParallel | 18 | testParallel |
19 | ${CMAKE_THREAD_LIBS_INIT} | 19 | ${CMAKE_THREAD_LIBS_INIT} |
20 | - DD_Client | 20 | + ${DDCLIENTLIBRARY} |
21 | ) | 21 | ) |
22 | 22 | ||
23 | install (TARGETS testParallel DESTINATION tests) | 23 | install (TARGETS testParallel DESTINATION tests) |
tests/testParallel.c
@@ -100,7 +100,7 @@ int runRequest(char* ViName, char* StartTime, char* TimeInt, int NbPar, char** P | @@ -100,7 +100,7 @@ int runRequest(char* ViName, char* StartTime, char* TimeInt, int NbPar, char** P | ||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | - error = DD_SetTimeInfo(ID, StartTime, &RealTime); | 103 | + error = DD_SetTimeInfo(ID, StartTime, &RealTime); |
104 | if(error < 0) | 104 | if(error < 0) |
105 | { | 105 | { |
106 | error = DD_Close(ID); | 106 | error = DD_Close(ID); |