9 #ifndef __AM_ARCHIVER_H
10 #define __AM_ARCHIVER_H
18 #if !defined(__AM_CSV_H)
19 #include "am_csvstream.h"
26 #include "fb_archiver.h"
30 #define SECS_PER_MIN (60)
31 #define SECS_PER_HOUR (60 * SECS_PER_MIN)
32 #define SECS_PER_DAY (24 * SECS_PER_HOUR)
33 #define SECS_PER_WEEK (7 * SECS_PER_DAY)
34 #define SECS_PER_MONTH (31 * SECS_PER_DAY)
39 enum AM_ArchiveFileAction
45 enum AM_ArchiveFtpServer
76 bool ftpPrimaryFailed;
77 bool ftpSecondaryFailed;
80 double *pTimeLastWrite;
81 uint8 *pUnattendedStrategy;
86 bool transferInProgress;
101 void accessTimeLastWriteFile(uint8 z_action);
103 double calculateNextArchiveTime(
double z_currentTime,
104 uint8 z_unattendedStrategy);
110 uint32 z_activeSliceSize,
111 uint16 z_groupNumber,
113 bool *z_pTranslationStarted,
114 char *z_pszMediaRoot);
115 bool moreMediaSpace(uint32 z_requiredSize);
119 uint8 getCurrentAutoStrategy();
121 void detachFromQueues(
void);
124 void displayTime(
double z_time);
131 uint32 z_activeSliceSize,
132 uint16 z_groupNumber,
135 bool *z_pTranslationStarted);
139 bool getTransferInProgress(AM_RouteNumber z_routeNumber );
140 void lockDreHistory(
void);
143 void sendGroupMessage(
double z_time, uint8 z_msgClass, uint8 z_msgNum, uint16 z_groupNumber);
144 void sendSystemMessage(
double z_time, uint8 z_msgClass, uint8 z_msgNum);
145 void sendMediaInsertedMessage(
double z_time, uint16 z_groupNumber);
146 void setResourceStarting(
void);
147 void signalUpdateComplete(
void);
149 void stopArchive(AM_RouteNumber z_routeNumber);
150 void unlockDreHistory(
void);
152 bool startTranslation();
161 double calculateTimeMediaFull(
double z_currentTime);
163 bool deleteOldestFile(uint32 z_uInstr,
const char *z_szDirectory);
164 bool deleteFilesOfTime(uint32 z_uInstr,
const char *z_szDirectory, uint32 z_ModTime);
165 uint32 findOldestFile(uint32 z_uInstr,
166 const char *z_szDirectory,
168 uint32 z_oldestModTime);
169 bool deletable(
const char * z_szDirectory,
170 const char * z_szFileName,
175 void getMediaStatus(
char *z_pszMediaRoot,
double *z_pMediaSize,
double *z_pMediaFree);
176 void getMessage(
exchange_id z_xid, uint32 *z_pMsg);
178 double z_currentTime);
180 void makeFtpPath(
char *z_pszFtpServer,
183 char *z_pszPassword );
184 void mediaRouteWait(uint32 z_seconds);
185 void performArchiving(
double z_currentTime);
187 void sendMessage(
exchange_id z_xid, uint32 *z_pMsg);
188 bool copyFileToMedia(FILE *z_pSourceFile,
189 uint32 z_sourceFileTime,
190 char *z_pFileDestPath,
193 uint32 z_activeSliceSize);
194 bool ftpFileToServer(FILE *z_pSourceFile,
195 char *z_pszFtpServer,
201 uint32 z_activeSliceSize);
202 bool csvFileToMedia( FILE *z_pSourceFile,
203 uint32 z_sourceFileTime,
204 char *z_pszFileDestPath,
207 uint32 z_activeSliceSize,
208 uint32 z_CsvMaxFileSize,
209 bool *z_pTranslationStarted);
210 bool csvFileToServer(FILE *z_pSourceFile,
211 char *z_pszFtpServer,
217 uint32 z_activeSliceSize,
218 bool *z_pTranslationStarted);
219 char * generateCsvFilename(
char * pBatchName,
220 struct tm * pLocalStartTime,
221 struct tm * pLocalEndTime,
228 uint16 m_mediaFullStrategy;
233 uint16 m_numberOfGroups;
239 bool m_resourceStarting;
241 double m_timeMediaFull;
242 sint32 m_timeSegment;
243 bool m_timeZoneChanged;
244 sint32 m_timeZoneRawOffset;
245 uint8 m_ftpArchivingTooSlow;
246 uint8 m_mediaArchivingTooSlow;
248 string_100 m_szUsbPath;
252 string_40 m_szFtpPrimaryPassword;
253 string_100 m_szFtpPrimaryServer;
254 string_40 m_szFtpPrimaryUser;
255 string_40 m_szFtpSecondaryPassword;
256 string_100 m_szFtpSecondaryServer;
257 string_40 m_szFtpSecondaryUser;
262 char *m_pszMediaRoot;
263 string_100 m_szUnattendedMediaRoot;
264 string_100 m_szDemandedMediaRoot;
265 string_100 m_ActHistoryDestPath;
266 string_100 m_ActGroupDestPath;
267 string_100 m_ActFileDestPath;
268 string_100 m_CsvFileDestPath;
269 uint32 m_ActInstrumentId;
273 network_data_t *m_net_ramdata;
274 network_nvdata_t *m_net_nvdata;
285 inline bool AM_Archiver::routeActive()
288 (m_pActRoute != NULL) &&
289 !m_pActRoute->stopArchive &&
290 (m_pActRoute->status == ARCHIVING_ACTIVE));
293 #endif // __AM_ARCHIVER_H
Definition: dre_hist.h:19
Definition: am_archive.h:50
Definition: am_archiver.h:73
Definition: dre_hist.h:35
Definition: am_csvstream.h:49
Definition: stdtypes.h:204
Definition: am_archive.h:37
Definition: am_archiver.h:90
Definition: am_archivecontrol.h:39
Definition: stdtypes.h:223
Definition: stdtypes.h:213
Definition: dre_hist.h:54
Definition: am_manager.h:12