| 1 | /* |
| 2 | * Component of the D-ITG 2.8.1 (r1023) platform (http://traffic.comics.unina.it/software/ITG) |
| 3 | * |
| 4 | * Copyright : (C) 2004-2013 by Alessio Botta, Walter de Donato, Alberto Dainotti, |
| 5 | * Stefano Avallone, Antonio Pescape' (PI) |
| 6 | * COMICS (COMputer for Interaction and CommunicationS) Group |
| 7 | * Department of Electrical Engineering and Information Technologies |
| 8 | * University of Napoli "Federico II". |
| 9 | * email : [email protected], [email protected], [email protected], |
| 10 | * [email protected], [email protected] |
| 11 | * |
| 12 | * This program is free software: you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation, either version 3 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 | * |
| 25 | * For commercial use please refer to D-ITG Professional. |
| 26 | */ |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | #define OFFSET_LOG_PORT 1000 |
| 34 | |
| 35 | |
| 36 | #define SEED_LOG_PORT 9003 |
| 37 | |
| 38 | |
| 39 | struct paramLogThread { |
| 40 | int socket; |
| 41 | }; |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | extern ofstream out; |
| 49 | |
| 50 | |
| 51 | extern int flagTerm; |
| 52 | |
| 53 | |
| 54 | extern signaling signalingLog; |
| 55 | |
| 56 | |
| 57 | extern struct sockaddr_in senderLog; |
| 58 | |
| 59 | |
| 60 | extern int signalSocket; |
| 61 | |
| 62 | |
| 63 | #ifdef UNIX |
| 64 | extern const char DEFAULT_LOG_FILE[]; |
| 65 | |
| 66 | |
| 67 | #endif |
| 68 | |
| 69 | #ifdef WIN32 |
| 70 | extern const char DEFAULT_LOG_FILE[]; |
| 71 | |
| 72 | extern HANDLE mutexLog; |
| 73 | |
| 74 | #endif |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | void printHelpAndExit(); |
| 80 | |
| 81 | |
| 82 | void closeFileLog(ofstream *out); |
| 83 | |
| 84 | |
| 85 | void recvInfo(int signalingChannel,BYTE &protocol,char logFile[DIM_LOG_FILE]); |
| 86 | |
| 87 | |
| 88 | int findPortFree(int logSock); |
| 89 | |
| 90 | |
| 91 | char* allowedLogFile(char logFile[DIM_LOG_FILE]); |
| 92 | |
| 93 | |
| 94 | void *channelManager(void *param); |
| 95 | |
| 96 | |
| 97 | |
| 98 | void terminate(int sign); |
| 99 | |
| 100 | |
| 101 | |
| 102 | void reportErrorAndExit(const char *function, const char *program, const char *msg); |
| 103 | |
| 104 | |
| 105 | void createSignalingChannel(); |
| 106 | |
| 107 | |
| 108 | |
| 109 | void logInit(); |
| 110 | |
| 111 | |
| 112 | |
| 113 | void parserLog(int argc , char *argv[]); |
| 114 |