[579] | 1 | /* |
---|
[1] | 2 | * Author : Gérald FENOY |
---|
| 3 | * |
---|
[392] | 4 | * Copyright (c) 2009-2013 GeoLabs SARL |
---|
[1] | 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 | #pragma once |
---|
| 29 | |
---|
[579] | 30 | /** |
---|
| 31 | * The default service url (overriden by serverAddress) |
---|
| 32 | */ |
---|
[34] | 33 | #define DEFAULT_SERVICE_URL "http://www.zoo-project.org/" |
---|
[579] | 34 | /** |
---|
| 35 | * The time size |
---|
| 36 | */ |
---|
[1] | 37 | #define TIME_SIZE 40 |
---|
| 38 | |
---|
[34] | 39 | #include <libintl.h> |
---|
| 40 | #include <locale.h> |
---|
[579] | 41 | /** |
---|
| 42 | * ZOO-Kernel internal messages translation function |
---|
| 43 | */ |
---|
[34] | 44 | #define _(String) dgettext ("zoo-kernel",String) |
---|
[579] | 45 | /** |
---|
| 46 | * ZOO-Services messages translation function |
---|
| 47 | */ |
---|
[34] | 48 | #define _ss(String) dgettext ("zoo-services",String) |
---|
| 49 | |
---|
[579] | 50 | /** |
---|
| 51 | * ZOO-Kernel was unable to create a lock |
---|
| 52 | */ |
---|
[507] | 53 | #define ZOO_LOCK_CREATE_FAILED -4 |
---|
[579] | 54 | /** |
---|
| 55 | * ZOO-Kernel was unable to acquire a lock |
---|
| 56 | */ |
---|
[507] | 57 | #define ZOO_LOCK_ACQUIRE_FAILED -5 |
---|
[579] | 58 | /** |
---|
| 59 | * ZOO-Kernel was unable to release a lock |
---|
| 60 | */ |
---|
[507] | 61 | #define ZOO_LOCK_RELEASE_FAILED -6 |
---|
| 62 | |
---|
[26] | 63 | #include <sys/stat.h> |
---|
[1] | 64 | #include <sys/types.h> |
---|
[478] | 65 | #include "cgic.h" |
---|
[216] | 66 | #ifndef WIN32 |
---|
[26] | 67 | #include <sys/ipc.h> |
---|
| 68 | #include <sys/shm.h> |
---|
[507] | 69 | #include <sys/sem.h> |
---|
[216] | 70 | #else |
---|
| 71 | #include <direct.h> |
---|
| 72 | #endif |
---|
[26] | 73 | #include <stdio.h> |
---|
[1] | 74 | #include <time.h> |
---|
| 75 | #include <ctype.h> |
---|
[453] | 76 | #ifndef USE_RUBY |
---|
| 77 | #include <unistd.h> |
---|
| 78 | #endif |
---|
[1] | 79 | #ifndef WIN32 |
---|
| 80 | #include <xlocale.h> |
---|
| 81 | #endif |
---|
[490] | 82 | |
---|
[1] | 83 | #include "service.h" |
---|
| 84 | |
---|
[640] | 85 | #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) |
---|
[1] | 86 | |
---|
[640] | 87 | #include <CoreServices/CoreServices.h> |
---|
| 88 | #include <SystemConfiguration/SystemConfiguration.h> |
---|
| 89 | |
---|
[364] | 90 | #endif |
---|
[26] | 91 | |
---|
[1] | 92 | #ifdef __cplusplus |
---|
| 93 | extern "C" { |
---|
| 94 | #endif |
---|
[280] | 95 | |
---|
[640] | 96 | int setOutputValue( maps*, const char*, char*, size_t); |
---|
| 97 | char* getInputValue( maps*,const char*,size_t*); |
---|
[579] | 98 | |
---|
[216] | 99 | void unhandleStatus(maps*); |
---|
[471] | 100 | int _updateStatus(maps*); |
---|
[507] | 101 | char* _getStatus(maps*,int); |
---|
[26] | 102 | char* getStatus(int); |
---|
[640] | 103 | int updateStatus( maps*,const int,const char*); |
---|
[507] | 104 | int removeShmLock(maps*, int); |
---|
[579] | 105 | /** |
---|
| 106 | * Cross platform type used for Lock identifier |
---|
| 107 | */ |
---|
[507] | 108 | #ifndef WIN32 |
---|
| 109 | #define semid int |
---|
| 110 | #else |
---|
| 111 | #define semid HANDLE |
---|
| 112 | #endif |
---|
| 113 | semid getShmLockId(maps*,int); |
---|
| 114 | int lockShm(semid); |
---|
| 115 | int unlockShm(semid); |
---|
[9] | 116 | |
---|
[26] | 117 | #ifdef USE_JS |
---|
| 118 | #endif |
---|
| 119 | |
---|
[1] | 120 | #ifdef __cplusplus |
---|
| 121 | } |
---|
| 122 | #endif |
---|
| 123 | |
---|
| 124 | #endif |
---|