Changeset 680 for trunk/zoo-project
- Timestamp:
- Jun 24, 2015, 1:58:17 AM (10 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/makefile.vc
r601 r680 41 41 $(CPP) $(CFLAGS) /c zcfg2yaml.c 42 42 43 service_internal.obj: service_internal.c mimetypes.h43 service_internal.obj: service_internal.c service_internal.h 44 44 $(CPP) $(CFLAGS) /c service_internal.c 45 46 server_internal.obj: server_internal.c server_internal.h 47 $(CPP) $(CFLAGS) /c server_internal.c 48 49 caching.obj: caching.c caching.h 50 $(CPP) $(CFLAGS) /c caching.c 51 52 request_parser.obj: request_parser.c request_parser.h 53 $(CPP) $(CFLAGS) /c request_parser.c 54 55 response_print.obj: response_print.c response_print.h 56 $(CPP) $(CFLAGS) /c response_print.c 57 58 service.obj: service.c service.h 59 $(CPP) $(CFLAGS) /c service.c 60 61 sqlapi.obj: sqlapi.c sqlapi.h 62 $(CPP) $(CFLAGS) /c sqlapi.c 45 63 46 64 service_internal_js.obj: service_internal_js.c service.h … … 68 86 $(CPP) /EHsc /c $(CFLAGS) zoo_loader.c 69 87 70 $(PROGRAMNAME): version.h zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj 71 link zoo_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj zoo_service_loader.obj /out:$(PROGRAMNAME) $(LDFLAGS) $(LDFLAGSCGI) 88 89 $(LIBZOO_SERVICE): service_internal.obj service.obj sqlapi.obj 90 link /dll /out:$(LIBZOO_SERVICE) ./service.obj ./service_internal.obj ./sqlapi.obj $(LDFLAGS) /FORCE:MULTIPLE 91 92 $(PROGRAMNAME): version.h $(LIBZOO_SERVICE) zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj request_parser.obj response_print.obj server_internal.obj caching.obj 93 link zoo_loader.obj request_parser.obj response_print.obj server_internal.obj caching.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj zoo_service_loader.obj ./libzoo_service.lib /out:$(PROGRAMNAME) $(LDFLAGS) $(LDFLAGSCGI) 72 94 73 95 zcfg2yaml: version.h zcfg2yaml.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj 74 link zcfg2yaml.obj serv ice_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj/out:zcfg2yaml.exe $(LDFLAGS) $(LDFLAGSCGI)96 link zcfg2yaml.obj server_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj response_print.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj ./libzoo_service.lib /out:zcfg2yaml.exe $(LDFLAGS) $(LDFLAGSCGI) 75 97 76 98 clean: 77 erase -f *.cgi *.obj *.tab.c* *.tab.h *.sr.c* lex.* *.lreg *.sibling 99 erase -f *.cgi *.obj *.tab.c* *.tab.h *.sr.c* lex.* *.lreg *.sibling *.lib *.dll -
trunk/zoo-project/zoo-kernel/nmake.opt
r582 r680 1 1 PROGRAMNAME=zoo_loader.cgi 2 LIBZOO_SERVICE=libzoo_service.dll 2 3 3 4 CC=cl $(CFLAGS) … … 64 65 PYTHON_CPATH=$(PY_DIR) 65 66 66 CFLAGS= $(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 /DPROGRAMNAME=\"$(PROGRAMNAME)\" $(CJFLAGS) -I$(ZOOK_DIR) $(RUBY_CFLAGS) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF 67 !IFDEF DB 68 DB_FLAGS=-DRELY_ON_DB 69 !ENDIF 70 71 CFLAGS= $(DB_FLAGS) $(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 /DPROGRAMNAME=\"$(PROGRAMNAME)\" $(CJFLAGS) -I$(ZOOK_DIR) $(RUBY_CFLAGS) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF 67 72 68 73 LDFLAGSCGI=$(TROOT)/../../thirds/cgic206/libcgic.lib -
trunk/zoo-project/zoo-kernel/request_parser.c
r654 r680 1088 1088 } 1089 1089 } 1090 return 0; 1090 1091 } 1091 1092 -
trunk/zoo-project/zoo-kernel/response_print.c
r676 r680 43 43 #include <dlfcn.h> 44 44 #endif 45 46 #define ERROR_MSG_MAX_LENGTH 102447 45 48 46 #include "mimetypes.h" -
trunk/zoo-project/zoo-kernel/server_internal.c
r676 r680 29 29 #ifndef WIN32 30 30 #include <dlfcn.h> 31 #endif32 31 #include <uuid/uuid.h> 32 #else 33 #include <rpc.h> 34 #define ERROR_MSG_MAX_LENGTH 1024 35 #endif 33 36 #include <signal.h> 34 37 … … 57 60 char *get_uuid(){ 58 61 char *res=(char*)malloc(37*sizeof(char)); 62 #ifdef WIN32 63 UUID uuid; 64 UuidCreate(&uuid); 65 RPC_CSTR rest = NULL; 66 UuidToString(&uuid,&rest); 67 #else 59 68 uuid_t uuid; 60 69 uuid_generate_time(uuid); 61 70 char rest[128]; 62 71 uuid_unparse(uuid,rest); 63 sprintf(res,"%s", rest); 72 #endif 73 sprintf(res,"%s",rest); 64 74 return res; 65 75 } … … 780 790 #endif 781 791 LocalFree(lpMsgBuf); 782 792 783 793 return msg; 784 794 #else … … 950 960 fcontent[flen]=0; 951 961 fclose(f0); 962 #ifndef WIN32 952 963 kill(atoi(fcontent),SIGKILL); 964 #else 965 HANDLE myZooProcess=OpenProcess(PROCESS_ALL_ACCESS,false,atoi(fcontent)); 966 TerminateProcess(myZooProcess,1); 967 CloseHandle(myZooProcess); 968 #endif 953 969 free(fcontent); 954 970 } … … 1089 1105 return 0; 1090 1106 } 1107 1108 #ifdef WIN32 1109 /** 1110 * Create a KVP request for executing background task. 1111 * TODO: use the XML request in case of input POST request. 1112 * 1113 * @param m the maps containing the parameters from the main.cfg file 1114 * @param length the total length of the KVP parameters 1115 * @param type 1116 */ 1117 char* getMapsAsKVP(maps* m,int length,int type){ 1118 char *dataInputsKVP=(char*) malloc(length*sizeof(char)); 1119 char *dataInputsKVPi=NULL; 1120 maps* curs=m; 1121 int i=0; 1122 while(curs!=NULL){ 1123 map *inRequest=getMap(curs->content,"inRequest"); 1124 map *hasLength=getMap(curs->content,"length"); 1125 if((inRequest!=NULL && strncasecmp(inRequest->value,"true",4)==0) || 1126 inRequest==NULL){ 1127 if(i==0) 1128 if(type==0){ 1129 sprintf(dataInputsKVP,"%s=",curs->name); 1130 if(hasLength!=NULL){ 1131 dataInputsKVPi=(char*)malloc((strlen(curs->name)+2)*sizeof(char)); 1132 sprintf(dataInputsKVPi,"%s=",curs->name); 1133 } 1134 } 1135 else 1136 sprintf(dataInputsKVP,"%s",curs->name); 1137 else{ 1138 char *temp=zStrdup(dataInputsKVP); 1139 if(type==0) 1140 sprintf(dataInputsKVP,"%s;%s=",temp,curs->name); 1141 else 1142 sprintf(dataInputsKVP,"%s;%s",temp,curs->name); 1143 } 1144 map* icurs=curs->content; 1145 if(type==0){ 1146 char *temp=zStrdup(dataInputsKVP); 1147 if(getMap(curs->content,"xlink:href")!=NULL) 1148 sprintf(dataInputsKVP,"%sReference",temp); 1149 else{ 1150 if(hasLength!=NULL){ 1151 int j; 1152 for(j=0;j<atoi(hasLength->value);j++){ 1153 map* tmp0=getMapArray(curs->content,"value",j); 1154 if(j==0) 1155 free(temp); 1156 temp=zStrdup(dataInputsKVP); 1157 if(j==0) 1158 sprintf(dataInputsKVP,"%s%s",temp,tmp0->value); 1159 else 1160 sprintf(dataInputsKVP,"%s;%s%s",temp,dataInputsKVPi,tmp0->value); 1161 } 1162 } 1163 else 1164 sprintf(dataInputsKVP,"%s%s",temp,icurs->value); 1165 } 1166 free(temp); 1167 } 1168 while(icurs!=NULL){ 1169 if(strncasecmp(icurs->name,"value",5)!=0 && 1170 strncasecmp(icurs->name,"mimeType_",9)!=0 && 1171 strncasecmp(icurs->name,"dataType_",9)!=0 && 1172 strncasecmp(icurs->name,"size",4)!=0 && 1173 strncasecmp(icurs->name,"length",4)!=0 && 1174 strncasecmp(icurs->name,"isArray",7)!=0 && 1175 strcasecmp(icurs->name,"Reference")!=0 && 1176 strcasecmp(icurs->name,"minOccurs")!=0 && 1177 strcasecmp(icurs->name,"maxOccurs")!=0 && 1178 strncasecmp(icurs->name,"fmimeType",9)!=0 && 1179 strcasecmp(icurs->name,"inRequest")!=0){ 1180 char *itemp=zStrdup(dataInputsKVP); 1181 if(strcasecmp(icurs->name,"xlink:href")!=0) 1182 sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,icurs->value); 1183 else 1184 sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,url_encode(icurs->value)); 1185 free(itemp); 1186 } 1187 icurs=icurs->next; 1188 } 1189 } 1190 curs=curs->next; 1191 i++; 1192 } 1193 return dataInputsKVP; 1194 } 1195 #endif -
trunk/zoo-project/zoo-kernel/server_internal.h
r676 r680 22 22 * THE SOFTWARE. 23 23 */ 24 25 #ifdef WIN32 26 #pragma comment(lib, "rpcrt4.lib") 27 #endif 24 28 25 29 #include "ulinet.h" … … 61 65 int createRegistry (maps*,registry **,char *); 62 66 67 #ifdef WIN32 68 char* getMapsAsKVP(maps*,int,int); 69 #endif 70 63 71 #ifdef __cplusplus 64 72 } -
trunk/zoo-project/zoo-kernel/service.c
r676 r680 62 62 map* tmp=t; 63 63 while(tmp!=NULL){ 64 #ifdef DEBUG65 fprintf(stderr,"%s = %s\n",tmp->name,tmp->value);66 #endif67 64 fprintf(file,"%s = %s\n",tmp->name,tmp->value); 68 65 tmp=tmp->next; … … 91 88 */ 92 89 void dumpMapsToFile(maps* m,char* file_path){ 93 FILE* file=fopen(file_path,"w ");90 FILE* file=fopen(file_path,"w+"); 94 91 maps* tmp=m; 95 92 while(tmp!=NULL){ … … 99 96 tmp=tmp->next; 100 97 } 98 fflush(file); 101 99 fclose(file); 102 100 } 103 101 104 102 /** 105 103 * Create a new map … … 1429 1427 m=&trorf; 1430 1428 } 1431 1432 #ifdef WIN321433 char* getMapsAsKVP(maps* m,int length,int type){1434 char *dataInputsKVP=(char*) malloc(length*sizeof(char));1435 char *dataInputsKVPi=NULL;1436 maps* curs=m;1437 int i=0;1438 while(curs!=NULL){1439 map *inRequest=getMap(curs->content,"inRequest");1440 map *hasLength=getMap(curs->content,"length");1441 if((inRequest!=NULL && strncasecmp(inRequest->value,"true",4)==0) ||1442 inRequest==NULL){1443 if(i==0)1444 if(type==0){1445 sprintf(dataInputsKVP,"%s=",curs->name);1446 if(hasLength!=NULL){1447 dataInputsKVPi=(char*)malloc((strlen(curs->name)+2)*sizeof(char));1448 sprintf(dataInputsKVPi,"%s=",curs->name);1449 }1450 }1451 else1452 sprintf(dataInputsKVP,"%s",curs->name);1453 else{1454 char *temp=zStrdup(dataInputsKVP);1455 if(type==0)1456 sprintf(dataInputsKVP,"%s;%s=",temp,curs->name);1457 else1458 sprintf(dataInputsKVP,"%s;%s",temp,curs->name);1459 }1460 map* icurs=curs->content;1461 if(type==0){1462 char *temp=zStrdup(dataInputsKVP);1463 if(getMap(curs->content,"xlink:href")!=NULL)1464 sprintf(dataInputsKVP,"%sReference",temp);1465 else{1466 if(hasLength!=NULL){1467 int j;1468 for(j=0;j<atoi(hasLength->value);j++){1469 map* tmp0=getMapArray(curs->content,"value",j);1470 if(j==0)1471 free(temp);1472 temp=zStrdup(dataInputsKVP);1473 if(j==0)1474 sprintf(dataInputsKVP,"%s%s",temp,tmp0->value);1475 else1476 sprintf(dataInputsKVP,"%s;%s%s",temp,dataInputsKVPi,tmp0->value);1477 }1478 }1479 else1480 sprintf(dataInputsKVP,"%s%s",temp,icurs->value);1481 }1482 free(temp);1483 }1484 while(icurs!=NULL){1485 if(strncasecmp(icurs->name,"value",5)!=0 &&1486 strncasecmp(icurs->name,"mimeType_",9)!=0 &&1487 strncasecmp(icurs->name,"dataType_",9)!=0 &&1488 strncasecmp(icurs->name,"size",4)!=0 &&1489 strncasecmp(icurs->name,"length",4)!=0 &&1490 strncasecmp(icurs->name,"isArray",7)!=0 &&1491 strcasecmp(icurs->name,"Reference")!=0 &&1492 strcasecmp(icurs->name,"minOccurs")!=0 &&1493 strcasecmp(icurs->name,"maxOccurs")!=0 &&1494 strncasecmp(icurs->name,"fmimeType",9)!=0 &&1495 strcasecmp(icurs->name,"inRequest")!=0){1496 char *itemp=zStrdup(dataInputsKVP);1497 if(strcasecmp(icurs->name,"xlink:href")!=0)1498 sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,icurs->value);1499 else1500 sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,url_encode(icurs->value));1501 free(itemp);1502 }1503 icurs=icurs->next;1504 }1505 }1506 curs=curs->next;1507 i++;1508 }1509 return dataInputsKVP;1510 }1511 #endif -
trunk/zoo-project/zoo-kernel/service.h
r640 r680 29 29 30 30 #ifdef WIN32 31 #define ZOO_DLL_EXPORT __declspec( dllexport ) 32 #else 33 #define ZOO_DLL_EXPORT 34 #endif 35 36 #ifdef WIN32 31 37 #ifndef USE_MS 32 38 #define strncasecmp _strnicmp 33 39 #define strcasecmp _stricmp 34 #endif 35 #ifndef snprintf 40 #else 36 41 #define snprintf sprintf_s 37 42 #endif … … 101 106 #include <stdlib.h> 102 107 #include <ctype.h> 108 #ifndef WIN32 103 109 #include <stdio.h> 110 #endif 104 111 #include <string.h> 105 112 #ifndef WIN32 … … 261 268 } registry; 262 269 263 264 void _dumpMap(map*); 265 void dumpMap(map*); 266 void dumpMapToFile(map*,FILE*); 267 void dumpMaps(maps* m); 268 void dumpMapsToFile(maps*,char*); 269 map* createMap(const char*,const char*); 270 int count(map*); 271 bool hasKey(map*,const char*); 272 maps* getMaps(maps*,const char*); 273 map* getMap(map*,const char*); 274 map* getLastMap(map*); 275 map* getMapFromMaps(maps*,const char*,const char*); 276 void freeMap(map**); 277 void freeMaps(maps** mo); 270 ZOO_DLL_EXPORT void _dumpMap(map*); 271 ZOO_DLL_EXPORT void dumpMap(map*); 272 ZOO_DLL_EXPORT void dumpMaps(maps* m); 273 ZOO_DLL_EXPORT void dumpMapToFile(map*,FILE*); // Not required 274 ZOO_DLL_EXPORT void dumpMapsToFile(maps*,char*); 275 ZOO_DLL_EXPORT map* createMap(const char*,const char*); 276 ZOO_DLL_EXPORT int count(map*); 277 ZOO_DLL_EXPORT bool hasKey(map*,const char*); 278 ZOO_DLL_EXPORT maps* getMaps(maps*,const char*); 279 ZOO_DLL_EXPORT map* getMap(map*,const char*); 280 ZOO_DLL_EXPORT map* getLastMap(map*); 281 ZOO_DLL_EXPORT map* getMapFromMaps(maps*,const char*,const char*); 282 ZOO_DLL_EXPORT void freeMap(map**); 283 ZOO_DLL_EXPORT void freeMaps(maps** mo); 278 284 279 285 280 bool hasElement(elements*,const char*); 281 elements* getElements(elements*,char*); 282 void freeIOType(iotype**); 283 void freeElements(elements**); 284 void freeService(service**); 285 void addToMap(map*,const char*,const char*); 286 void addIntToMap(map*,const char*,const int); 287 void addToMapWithSize(map*,const char*,const char*,int); 288 void addMapToMap(map**,map*); 289 void addMapToIoType(iotype**,map*); 290 map* getMapOrFill(map**,const char*,const char*); 291 bool contains(map*,map*); 292 iotype* getIoTypeFromElement(elements*,char*, map*); 293 void loadMapBinary(map**,map*,int); 294 void loadMapBinaries(map**,map*); 295 maps* dupMaps(maps**); 296 void addMapsToMaps(maps**,maps*); 297 map* getMapArray(map*,const char*,int); 298 void setMapArray(map*,const char*,int,const char*); 299 map* getMapType(map*); 300 int addMapsArrayToMaps(maps**,maps*,char*); 301 void setMapInMaps(maps*,const char*,const char*,const char*); 302 void dumpElements(elements*); 303 void dumpElementsAsYAML(elements*); 304 elements* dupElements(elements*); 305 void addToElements(elements**,elements*); 306 void dumpService(service*); 307 void dumpServiceAsYAML(service*); 308 service* dupService(service*); 309 void dumpRegistry(registry*); 310 bool addServiceToRegistry(registry**,char*,service*); 311 void freeRegistry(registry**); 312 service* getServiceFromRegistry(registry*,char*,char*); 313 void inheritMap(map**,map*); 314 void inheritIOType(iotype**,iotype*); 315 void inheritElements(elements**,elements*); 316 void inheritance(registry*,service**); 317 void mapsToCharXXX(maps*,char***); 318 void charxxxToMaps(char***,maps**); 319 #ifdef WIN32 320 extern char *url_encode(char *); 321 char* getMapsAsKVP(maps*,int,int); 322 #endif 286 ZOO_DLL_EXPORT bool hasElement(elements*,const char*); 287 ZOO_DLL_EXPORT elements* getElements(elements*,char*); 288 ZOO_DLL_EXPORT void freeIOType(iotype**); 289 ZOO_DLL_EXPORT void freeElements(elements**); 290 ZOO_DLL_EXPORT void freeService(service**); 291 ZOO_DLL_EXPORT void addToMap(map*,const char*,const char*); 292 ZOO_DLL_EXPORT void addIntToMap(map*,const char*,const int); 293 ZOO_DLL_EXPORT void addToMapWithSize(map*,const char*,const char*,int); 294 ZOO_DLL_EXPORT void addMapToMap(map**,map*); 295 ZOO_DLL_EXPORT void addMapToIoType(iotype**,map*); 296 ZOO_DLL_EXPORT map* getMapOrFill(map**,const char*,const char*); 297 ZOO_DLL_EXPORT bool contains(map*,map*); 298 ZOO_DLL_EXPORT iotype* getIoTypeFromElement(elements*,char*, map*); 299 ZOO_DLL_EXPORT void loadMapBinary(map**,map*,int); 300 ZOO_DLL_EXPORT void loadMapBinaries(map**,map*); 301 ZOO_DLL_EXPORT maps* dupMaps(maps**); 302 ZOO_DLL_EXPORT void addMapsToMaps(maps**,maps*); 303 ZOO_DLL_EXPORT map* getMapArray(map*,const char*,int); 304 ZOO_DLL_EXPORT void setMapArray(map*,const char*,int,const char*); 305 ZOO_DLL_EXPORT map* getMapType(map*); 306 ZOO_DLL_EXPORT int addMapsArrayToMaps(maps**,maps*,char*); 307 ZOO_DLL_EXPORT void setMapInMaps(maps*,const char*,const char*,const char*); 308 ZOO_DLL_EXPORT void dumpElements(elements*); 309 ZOO_DLL_EXPORT void dumpElementsAsYAML(elements*); 310 ZOO_DLL_EXPORT elements* dupElements(elements*); 311 ZOO_DLL_EXPORT void addToElements(elements**,elements*); 312 ZOO_DLL_EXPORT void dumpService(service*); 313 ZOO_DLL_EXPORT void dumpServiceAsYAML(service*); 314 ZOO_DLL_EXPORT service* dupService(service*); 315 ZOO_DLL_EXPORT void dumpRegistry(registry*); 316 ZOO_DLL_EXPORT bool addServiceToRegistry(registry**,char*,service*); 317 ZOO_DLL_EXPORT void freeRegistry(registry**); 318 ZOO_DLL_EXPORT service* getServiceFromRegistry(registry*,char*,char*); 319 ZOO_DLL_EXPORT void inheritMap(map**,map*); 320 ZOO_DLL_EXPORT void inheritIOType(iotype**,iotype*); 321 ZOO_DLL_EXPORT void inheritElements(elements**,elements*); 322 ZOO_DLL_EXPORT void inheritance(registry*,service**); 323 ZOO_DLL_EXPORT void mapsToCharXXX(maps*,char***); 324 ZOO_DLL_EXPORT void charxxxToMaps(char***,maps**); 323 325 324 326 #ifdef __cplusplus -
trunk/zoo-project/zoo-kernel/service_internal.c
r654 r680 23 23 */ 24 24 25 #include "fcgi_stdio.h"26 25 #include "service_internal.h" 27 26 #ifdef USE_MS … … 90 89 ){ 91 90 #ifdef WIN32 92 return NULL 91 return NULL; 93 92 #else 94 93 return -1; … … 96 95 } 97 96 if(lockShm(lockid)<0){ 97 #ifdef WIN32 98 return NULL; 99 #else 98 100 if(itn<ZOO_LOCK_MAX_RETRY){ 99 101 itn++; 100 102 goto toRetry1; 101 103 }else 102 #ifdef WIN32 103 return NULL 104 #else 105 return -1; 104 return -1; 106 105 #endif 107 106 }else … … 211 210 free(fbkpid); 212 211 if(stat!=NULL){ 212 #ifndef WIN32 213 213 removeShmLock(conf,1); 214 #else 215 unlockShm(lockid); 216 #endif 214 217 free(stat); 215 218 } … … 271 274 if(stat!=NULL){ 272 275 lockid=acquireLock(conf); 273 if(lockid<0) 276 if(lockid<0){ 277 dumpMap(status); 274 278 return ZOO_LOCK_ACQUIRE_FAILED; 279 } 275 280 } 276 281 FILE* fstatus=fopen(fbkpid,"w"); … … 292 297 #ifdef WIN32 293 298 294 #include <windows.h>295 #include <fcgi_stdio.h>296 #include <stdio.h>297 #include <conio.h>298 #include <tchar.h>299 300 299 #define SHMEMSIZE 4096 301 300 … … 308 307 map *tmpMap=getMapFromMaps(conf,"lenv","lid"); 309 308 if(tmpMap==NULL) 310 309 tmpMap=getMapFromMaps(conf,"lenv","osid"); 311 310 312 311 if(tmpMap!=NULL){ 313 312 snprintf(key, length, "zoo_sem_%s", tmpMap->value); 314 313 } 315 314 else { 316 strncpy(key, "-1", length); 315 strncpy(key, "-1", length); 317 316 } 318 317 return strlen(key); … … 321 320 322 321 semid getShmLockId(maps* conf, int nsems){ 323 semid sem_id; 324 char key[MAX_PATH]; 325 getKeyValue(conf, key, MAX_PATH); 326 327 sem_id = CreateSemaphore( NULL, nsems, nsems+1, key); 328 if(sem_id==NULL){ 329 #ifdef DEBUG 330 fprintf(stderr,"Semaphore failed to create: %s\n", getLastErrorMessage()); 331 #endif 332 return NULL; 333 } 334 #ifdef DEBUG 335 fprintf(stderr,"%s Accessed !\n",key); 336 #endif 337 338 return sem_id; 322 semid sem_id; 323 char key[MAX_PATH]; 324 getKeyValue(conf, key, MAX_PATH); 325 326 sem_id = CreateSemaphore( NULL, nsems, nsems+1, key); 327 if(sem_id==NULL){ 328 #ifdef DEBUG 329 fprintf(stderr,"Semaphore failed to create: %s\n", getLastErrorMessage()); 330 #endif 331 return NULL; 332 } 333 #ifdef DEBUG 334 fprintf(stderr,"%s Accessed !\n",key); 335 #endif 336 return sem_id; 339 337 } 340 338 -
trunk/zoo-project/zoo-kernel/service_internal.h
r654 r680 98 98 #endif 99 99 100 char *readVSIFile(maps*,const char*);101 int setOutputValue( maps*, const char*, char*, size_t);102 char* getInputValue( maps*,const char*,size_t*);100 ZOO_DLL_EXPORT char *readVSIFile(maps*,const char*); 101 ZOO_DLL_EXPORT int setOutputValue( maps*, const char*, char*, size_t); 102 ZOO_DLL_EXPORT char* getInputValue( maps*,const char*,size_t*); 103 103 104 void unhandleStatus(maps*);105 int _updateStatus(maps*);106 char* _getStatus(maps*,char*);107 char* _getStatusFile(maps*,char*);108 char* getStatus(int);109 char* getStatusId(maps*,char*);104 ZOO_DLL_EXPORT void unhandleStatus(maps*); 105 ZOO_DLL_EXPORT int _updateStatus(maps*); 106 ZOO_DLL_EXPORT char* _getStatus(maps*,char*); 107 ZOO_DLL_EXPORT char* _getStatusFile(maps*,char*); 108 ZOO_DLL_EXPORT char* getStatus(int); 109 ZOO_DLL_EXPORT char* getStatusId(maps*,char*); 110 110 111 int updateStatus( maps*,const int,const char*);112 int removeShmLock(maps*, int);111 ZOO_DLL_EXPORT int updateStatus( maps*,const int,const char*); 112 ZOO_DLL_EXPORT int removeShmLock(maps*, int); 113 113 /** 114 114 * Cross platform type used for Lock identifier … … 117 117 #define semid int 118 118 #else 119 #include <windows.h> 119 120 #define semid HANDLE 120 121 #endif 121 semid acquireLock(maps*);122 semid getShmLockId(maps*,int);123 int lockShm(semid);124 int unlockShm(semid);122 ZOO_DLL_EXPORT semid acquireLock(maps*); 123 ZOO_DLL_EXPORT semid getShmLockId(maps*,int); 124 ZOO_DLL_EXPORT int lockShm(semid); 125 ZOO_DLL_EXPORT int unlockShm(semid); 125 126 126 127 #ifdef __cplusplus -
trunk/zoo-project/zoo-kernel/sqlapi.h
r654 r680 33 33 #include "service.h" 34 34 #include "service_internal.h" 35 void init_sql(maps*);36 void close_sql(maps*);37 int execSql(maps*,const char*);38 void recordStoredFile(maps*,const char*,const char*,const char*);39 void recordServiceStatus(maps*);40 void recordResponse(maps*,char*);41 void readFinalRes(maps*,char*,map*);42 int isRunning(maps*,char*);43 char* getStatusId(maps*,char*);44 void removeService(maps*,char*);35 ZOO_DLL_EXPORT void init_sql(maps*); 36 ZOO_DLL_EXPORT void close_sql(maps*); 37 ZOO_DLL_EXPORT int execSql(maps*,const char*); 38 ZOO_DLL_EXPORT void recordStoredFile(maps*,const char*,const char*,const char*); 39 ZOO_DLL_EXPORT void recordServiceStatus(maps*); 40 ZOO_DLL_EXPORT void recordResponse(maps*,char*); 41 ZOO_DLL_EXPORT void readFinalRes(maps*,char*,map*); 42 ZOO_DLL_EXPORT int isRunning(maps*,char*); 43 ZOO_DLL_EXPORT char* getStatusId(maps*,char*); 44 ZOO_DLL_EXPORT void removeService(maps*,char*); 45 45 #endif 46 46 -
trunk/zoo-project/zoo-kernel/zoo_loader.c
r674 r680 56 56 #include "service_internal.h" 57 57 #include "request_parser.h" 58 59 #ifdef WIN32 60 #include "server_internal.h" 61 #endif 58 62 59 63 int runRequest(map**); -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r676 r680 56 56 #include "request_parser.h" 57 57 #include "sqlapi.h" 58 #ifdef WIN32 59 #include "caching.h" 60 #endif 58 61 59 62 #ifdef USE_PYTHON … … 707 710 fprintf (stderr, "DATAOUTPUTSKVP %s\n", dataOutputsKVP); 708 711 #endif 709 map *sid = getMapFromMaps (m, "lenv", "sid"); 712 map *sid = getMapFromMaps (m, "lenv", "osid"); 713 map *usid = getMapFromMaps (m, "lenv", "usid"); 710 714 map *r_inputs = getMapFromMaps (m, "main", "tmpPath"); 711 715 map *r_inputs1 = getMap (request_inputs, "metapath"); … … 725 729 726 730 if(r_inputs2 != NULL && tmpReq != NULL) { 727 728 729 730 731 732 731 const char key[] = "rfile="; 732 char* kvp = (char*) malloc((FILENAME_MAX + strlen(key))*sizeof(char)); 733 char* filepath = kvp + strlen(key); 734 strncpy(kvp, key, strlen(key)); 735 addToCache(m, tmpReq->value, tmpReq->value, "text/xml", strlen(tmpReq->value), 736 filepath, FILENAME_MAX); 733 737 if (filepath == NULL) { 734 735 738 errorException( m, _("Unable to cache HTTP POST Execute request."), "InternalError", NULL); 739 return; 736 740 } 737 sprintf(tmp,"\"metapath=%s&%s&cgiSid=%s",738 r_inputs1->value,kvp,sid->value);741 sprintf(tmp,"\"metapath=%s&%s&cgiSid=%s&usid=%s\"", 742 r_inputs1->value,kvp,sid->value,usid->value); 739 743 sprintf(tmpq,"metapath=%s&%s", 740 741 free(kvp);744 r_inputs1->value,kvp); 745 free(kvp); 742 746 } 743 747 else if (r_inputs2 != NULL) 744 748 { 745 749 sprintf (tmp, 746 "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s&cgiSid=%s ",750 "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s&cgiSid=%s&usid=%s\"", 747 751 r_inputs1->value, req->value, id->value, dataInputsKVP, 748 r_inputs2->name, dataOutputsKVP, sid->value );752 r_inputs2->name, dataOutputsKVP, sid->value, usid->value); 749 753 sprintf (tmpq, 750 754 "metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s", … … 755 759 { 756 760 sprintf (tmp, 757 "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&cgiSid=%s ",761 "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&cgiSid=%s&usid=%s\"", 758 762 r_inputs1->value, req->value, id->value, dataInputsKVP, 759 sid->value );763 sid->value, usid->value); 760 764 sprintf (tmpq, 761 765 "metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s", … … 777 781 #endif 778 782 779 map*usid = getMapFromMaps (m, "lenv", "usid");783 usid = getMapFromMaps (m, "lenv", "usid"); 780 784 if (usid != NULL && usid->value != NULL) { 781 785 SetEnvironmentVariable("USID", TEXT (usid->value)); 782 786 } 783 784 787 SetEnvironmentVariable ("CGISID", TEXT (sid->value)); 785 788 SetEnvironmentVariable ("QUERY_STRING", TEXT (tmpq)); … … 911 914 } 912 915 913 914 916 /** 915 917 * Manage our own error log file (usefull to separate standard apache debug … … 991 993 char tmpUrl[1024]; 992 994 993 if ( getenv("HTTPS") != NULL && strncmp(getenv("HTTPS"), "on", 2) == 0 ) { // Knut: check if non-empty instead of "on"? 995 if ( getenv("HTTPS") != NULL && strncmp(getenv("HTTPS"), "on", 2) == 0 ) { 996 // Knut: check if non-empty instead of "on"? 994 997 if ( strncmp(cgiServerPort, "443", 3) == 0 ) { 995 998 sprintf(tmpUrl, "https://%s%s", cgiServerName, cgiScriptName); … … 1927 1930 1928 1931 map *test1 = getMap (request_inputs, "cgiSid"); 1929 if (test1 != NULL) 1930 { 1932 if (test1 != NULL){ 1931 1933 cgiSid = test1->value; 1932 1934 addToMap (request_inputs, "storeExecuteResponse", "true"); … … 1935 1937 status = getMap (request_inputs, "status"); 1936 1938 } 1939 test1 = getMap (request_inputs, "usid"); 1940 if (test1 != NULL){ 1941 setMapInMaps (m, "lenv", "usid", test1->value); 1942 setMapInMaps (m, "lenv", "uusid", test1->value); 1943 } 1937 1944 #endif 1938 1945 char *fbkp, *fbkpid, *fbkpres, *fbkp1, *flog; … … 1983 1990 pid = 0; 1984 1991 cpid = atoi (cgiSid); 1992 updateStatus(m,0,_("Initializing")); 1985 1993 } 1986 1994 #endif … … 2029 2037 sprintf (fbkpid, "%s/%s.pid", r_inputs->value, usid->value); 2030 2038 2031 f0 = freopen (fbkpid, "w+", 2032 fprintf(stdout,"%d",getpid());2039 f0 = freopen (fbkpid, "w+",stdout); 2040 printf("%d",getpid()); 2033 2041 fflush(stdout); 2034 2042 … … 2039 2047 strlen (usid->value) + 7) * sizeof (char)); 2040 2048 sprintf (fbkp, "%s/%s.sid", r_inputs->value, usid->value); 2041 2042 FILE* f2 = fopen (fbkp, "w+"); 2043 fprintf(f2,"%s",tmpm->value); 2049 FILE* f2 = freopen (fbkp, "w+",stdout); 2050 printf("%s",tmpm->value); 2044 2051 fflush(f2); 2045 fclose(f2);2046 2052 free(fbkp); 2047 2053 … … 2071 2077 fclose (stdin); 2072 2078 #endif 2073 fprintf(stderr,"DEBUG START %s %d \n",__FILE__,__LINE__);2074 2079 #ifdef RELY_ON_DB 2075 2080 init_sql(m); … … 2163 2168 { 2164 2169 fclose (stdout); 2165 //fclose (stderr);2170 fclose (stderr); 2166 2171 /** 2167 2172 * Dump back the final file fbkp1 to fbkp -
trunk/zoo-project/zoo-services/utils/status/makefile.vc
r478 r680 2 2 !INCLUDE $(ZOOK_DIR)/nmake.opt 3 3 4 FILES=$(ZOOK_DIR)/service_internal.obj $(ZOOK_DIR)/ulinet.obj5 !IFDEF JS_DIR6 FILES=$(FILES) $(ZOOK_DIR)$(JS_FILE)7 !ENDIF8 !IFDEF JDK_DIR9 FILES=$(FILES) $(ZOOK_DIR)$(JAVA_FILE)10 !ENDIF11 !IFDEF PY_DIR12 FILES=$(FILES) $(ZOOK_DIR)$(PY_FILE)13 !ENDIF14 !IFDEF MS_DIR15 FILES=$(FILES) $(ZOOK_DIR)$(MS_FILE)16 !ENDIF17 18 4 cgi-env/wps_status.zo: service.c 19 5 $(CPP) /D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DZOO_SERVICE $(CFLAGS) /c service.c 20 link /dll /out:cgi-env/wps_status.zo $(FILES) ./service.obj $(LDFLAGS) $(XSLT_DIR)\win32\bin.msvc\libxslt.lib /FORCE:MULTIPLE6 link /dll /out:cgi-env/wps_status.zo $(FILES) ./service.obj $(LDFLAGS) $(XSLT_DIR)\win32\bin.msvc\libxslt.lib $(ZOOK_DIR)\libzoo_service.lib /FORCE:MULTIPLE 21 7 22 8 clean: -
trunk/zoo-project/zoo-services/utils/status/service.c
r652 r680 51 51 * return the final ExecuteResponse stored on the Server file system. 52 52 */ 53 #ifdef WIN32 54 __declspec(dllexport) 55 #endif 56 int GetStatus(maps*& conf,maps*& inputs,maps*& outputs){ 53 ZOO_DLL_EXPORT int GetStatus(maps*& conf,maps*& inputs,maps*& outputs){ 57 54 const char *params[4 + 1]; 58 55 int xmlLoadExtDtdDefaultValue;
Note: See TracChangeset
for help on using the changeset viewer.