1 | /* |
---|
2 | * Author : Gérald FENOY |
---|
3 | * |
---|
4 | * Copyright (c) 2009-2013 GeoLabs SARL |
---|
5 | * |
---|
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
7 | * of this software and associated documentation files (the "Software"), to deal |
---|
8 | * in the Software without restriction, including without limitation the rights |
---|
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
10 | * copies of the Software, and to permit persons to whom the Software is |
---|
11 | * furnished to do so, subject to the following conditions: |
---|
12 | * |
---|
13 | * The above copyright notice and this permission notice shall be included in |
---|
14 | * all copies or substantial portions of the Software. |
---|
15 | * |
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
22 | * THE SOFTWARE. |
---|
23 | */ |
---|
24 | |
---|
25 | #ifndef ZOO_SERVICE_INTERNAL_H |
---|
26 | #define ZOO_SERVICE_INTERNAL_H 1 |
---|
27 | |
---|
28 | |
---|
29 | #include <fcgiapp.h> |
---|
30 | |
---|
31 | #pragma once |
---|
32 | |
---|
33 | /** |
---|
34 | * The default service url (overriden by serverAddress) |
---|
35 | */ |
---|
36 | #define DEFAULT_SERVICE_URL "http://www.zoo-project.org/" |
---|
37 | /** |
---|
38 | * The time size |
---|
39 | */ |
---|
40 | #define TIME_SIZE 40 |
---|
41 | |
---|
42 | //#include <libintl.h> |
---|
43 | #include <locale.h> |
---|
44 | /** |
---|
45 | * ZOO-Kernel internal messages translation function |
---|
46 | */ |
---|
47 | #define _(String) dgettext ("zoo-kernel",String) |
---|
48 | /** |
---|
49 | * ZOO-Services messages translation function |
---|
50 | */ |
---|
51 | #define _ss(String) dgettext ("zoo-services",String) |
---|
52 | |
---|
53 | /** |
---|
54 | * ZOO-Kernel was unable to create a lock |
---|
55 | */ |
---|
56 | #define ZOO_LOCK_CREATE_FAILED -4 |
---|
57 | /** |
---|
58 | * ZOO-Kernel was unable to acquire a lock |
---|
59 | */ |
---|
60 | #define ZOO_LOCK_ACQUIRE_FAILED -5 |
---|
61 | /** |
---|
62 | * ZOO-Kernel was unable to release a lock |
---|
63 | */ |
---|
64 | #define ZOO_LOCK_RELEASE_FAILED -6 |
---|
65 | /** |
---|
66 | * Number of time the ZOO-Kernel will try to acquire lock |
---|
67 | */ |
---|
68 | #define ZOO_LOCK_MAX_RETRY 10 |
---|
69 | |
---|
70 | //#include <sys/stat.h> |
---|
71 | //#include <sys/types.h> |
---|
72 | |
---|
73 | #ifndef WIN32 |
---|
74 | #include <sys/ipc.h> |
---|
75 | #include <sys/shm.h> |
---|
76 | #include <sys/sem.h> |
---|
77 | #else |
---|
78 | #include <direct.h> |
---|
79 | #endif |
---|
80 | #include <stdio.h> |
---|
81 | #include <time.h> |
---|
82 | #include <ctype.h> |
---|
83 | #ifndef USE_RUBY |
---|
84 | #include <unistd.h> |
---|
85 | #endif |
---|
86 | #ifndef WIN32 |
---|
87 | #include <xlocale.h> |
---|
88 | #endif |
---|
89 | |
---|
90 | #include "service.h" |
---|
91 | |
---|
92 | #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) |
---|
93 | |
---|
94 | #include <CoreServices/CoreServices.h> |
---|
95 | #include <SystemConfiguration/SystemConfiguration.h> |
---|
96 | |
---|
97 | #endif |
---|
98 | |
---|
99 | #ifdef __cplusplus |
---|
100 | extern "C" { |
---|
101 | #endif |
---|
102 | |
---|
103 | char *readVSIFile(maps*,const char*); |
---|
104 | int setOutputValue( maps*, const char*, char*, size_t); |
---|
105 | char* getInputValue( maps*,const char*,size_t*); |
---|
106 | |
---|
107 | void unhandleStatus(maps*); |
---|
108 | int _updateStatus(maps*); |
---|
109 | char* _getStatus(maps*,char*); |
---|
110 | char* _getStatusFile(maps*,char*); |
---|
111 | char* getStatus(int); |
---|
112 | char* getStatusId(maps*,char*); |
---|
113 | |
---|
114 | int updateStatus( maps*,const int,const char*); |
---|
115 | int removeShmLock(maps*, int); |
---|
116 | /** |
---|
117 | * Cross platform type used for Lock identifier |
---|
118 | */ |
---|
119 | #ifndef WIN32 |
---|
120 | #define semid int |
---|
121 | #else |
---|
122 | #define semid HANDLE |
---|
123 | #endif |
---|
124 | semid acquireLock(maps*); |
---|
125 | semid getShmLockId(maps*,int); |
---|
126 | int lockShm(semid); |
---|
127 | int unlockShm(semid); |
---|
128 | |
---|
129 | #ifdef __cplusplus |
---|
130 | } |
---|
131 | #endif |
---|
132 | |
---|
133 | #endif |
---|