MT5APIConfigNetwork.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. //+------------------------------------------------------------------+
  2. //| MetaTrader 5 API |
  3. //| Copyright 2000-2019, MetaQuotes Software Corp. |
  4. //| http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #pragma once
  7. //+------------------------------------------------------------------+
  8. //| Logins, orders and deals range |
  9. //+------------------------------------------------------------------+
  10. class IMTConServerRange
  11. {
  12. public:
  13. //--- common methods
  14. virtual void Release(void)=0;
  15. virtual MTAPIRES Assign(const IMTConServerRange* param)=0;
  16. virtual MTAPIRES Clear(void)=0;
  17. //--- from
  18. virtual UINT64 From(void) const=0;
  19. virtual MTAPIRES From(const UINT64 from)=0;
  20. //--- to
  21. virtual UINT64 To(void) const=0;
  22. virtual MTAPIRES To(const UINT64 to)=0;
  23. //--- used range
  24. virtual UINT64 UsedFrom(void) const=0;
  25. virtual UINT64 UsedTo(void) const=0;
  26. };
  27. //+------------------------------------------------------------------+
  28. //| Network addresses range |
  29. //+------------------------------------------------------------------+
  30. class IMTConAddressRange
  31. {
  32. public:
  33. //--- common methods
  34. virtual void Release(void)=0;
  35. virtual MTAPIRES Assign(const IMTConAddressRange* range)=0;
  36. virtual MTAPIRES Clear(void)=0;
  37. //--- ip address range from
  38. virtual LPCWSTR From(void) const=0;
  39. virtual MTAPIRES From(LPCWSTR name)=0;
  40. //--- ip address range to
  41. virtual LPCWSTR To(void) const=0;
  42. virtual MTAPIRES To(LPCWSTR value)=0;
  43. };
  44. //+------------------------------------------------------------------+
  45. //| Server cluster server connection state |
  46. //+------------------------------------------------------------------+
  47. class IMTConClusterState
  48. {
  49. public:
  50. //--- common methods
  51. virtual void Release(void)=0;
  52. virtual MTAPIRES Assign(const IMTConClusterState* state)=0;
  53. virtual MTAPIRES Clear(void)=0;
  54. //--- server id
  55. virtual UINT64 Id(void) const=0;
  56. //--- connection state
  57. virtual bool Connected(void) const=0;
  58. virtual LPCWSTR ConnectedAddress(void) const=0;
  59. virtual INT64 ConnectedTime(void) const=0;
  60. //--- connection stats
  61. virtual INT64 StatsDay(void) const=0;
  62. virtual UINT StatsPing(void) const=0;
  63. virtual UINT StatsPingMin(void) const=0;
  64. virtual UINT StatsPingMax(void) const=0;
  65. virtual UINT StatsSpeed(void) const=0;
  66. virtual UINT StatsSpeedMin(void) const=0;
  67. virtual UINT StatsSpeedMax(void) const=0;
  68. };
  69. //+------------------------------------------------------------------+
  70. //| Trade and main platform server configuration |
  71. //+------------------------------------------------------------------+
  72. class IMTConServerTrade
  73. {
  74. public:
  75. //--- demo account allocation mode
  76. enum EnDemoMode
  77. {
  78. DEMO_DISABLED =0, // demo account allocation disabled
  79. DEMO_PROLONG =1, // prolong demo acounts after reconnect
  80. DEMO_FIXED =2, // demo account with fixed period
  81. //--- enumeration borders
  82. DEMO_FIRST =DEMO_DISABLED,
  83. DEMO_LAST =DEMO_FIXED
  84. };
  85. //--- enumeration borders
  86. enum EnOvernightMode
  87. {
  88. OVERNIGHT_END_DAY =0, // overnight performed at the end of the trading day
  89. OVERNIGHT_START_DAY =1, // overnight performed at the begin of the trading day
  90. //--- enumeration borders
  91. OVERNIGHT_FIRST =OVERNIGHT_END_DAY,
  92. OVERNIGHT_LAST =OVERNIGHT_START_DAY
  93. };
  94. //--- overmonth mode
  95. enum EnOvermonthMode
  96. {
  97. OVERMONTH_LAST_DAY =0, // overmonth performed at the last month day
  98. OVERMONTH_FIRST_DAY =1, // overmonth performed at the first month day
  99. //--- enumeration borders
  100. OVERMONTH_FIRST =OVERMONTH_LAST_DAY,
  101. OVERMONTH_LAST =OVERMONTH_FIRST_DAY
  102. };
  103. //--- overnigh days enumeration
  104. enum EnOvernightDays
  105. {
  106. OVERNIGHT_DAYS_SUN =0x00000001,
  107. OVERNIGHT_DAYS_MON =0x00000002,
  108. OVERNIGHT_DAYS_TUE =0x00000004,
  109. OVERNIGHT_DAYS_WED =0x00000008,
  110. OVERNIGHT_DAYS_THU =0x00000010,
  111. OVERNIGHT_DAYS_FRI =0x00000020,
  112. OVERNIGHT_DAYS_SAT =0x00000040,
  113. //--- rollovers schedule
  114. OVERNIGHT_DAYS_ROLLOVER_SUN=0x00000080,
  115. OVERNIGHT_DAYS_ROLLOVER_MON=0x00000100,
  116. OVERNIGHT_DAYS_ROLLOVER_TUE=0x00000200,
  117. OVERNIGHT_DAYS_ROLLOVER_WED=0x00000400,
  118. OVERNIGHT_DAYS_ROLLOVER_THU=0x00000800,
  119. OVERNIGHT_DAYS_ROLLOVER_FRI=0x00001000,
  120. OVERNIGHT_DAYS_ROLLOVER_SAT=0x00002000,
  121. //--- enumeration borders
  122. OVERNIGHT_DAYS_NONE =0x00000000,
  123. OVERNIGHT_DAYS_DEFAULT =OVERNIGHT_DAYS_MON | OVERNIGHT_DAYS_TUE | OVERNIGHT_DAYS_WED | OVERNIGHT_DAYS_THU | OVERNIGHT_DAYS_FRI |
  124. OVERNIGHT_DAYS_ROLLOVER_MON | OVERNIGHT_DAYS_ROLLOVER_TUE | OVERNIGHT_DAYS_ROLLOVER_WED | OVERNIGHT_DAYS_ROLLOVER_THU | OVERNIGHT_DAYS_ROLLOVER_FRI,
  125. OVERNIGHT_DAYS_ALL =OVERNIGHT_DAYS_SUN | OVERNIGHT_DAYS_MON | OVERNIGHT_DAYS_TUE | OVERNIGHT_DAYS_WED | OVERNIGHT_DAYS_THU | OVERNIGHT_DAYS_FRI | OVERNIGHT_DAYS_SAT |
  126. OVERNIGHT_DAYS_ROLLOVER_SUN | OVERNIGHT_DAYS_ROLLOVER_MON | OVERNIGHT_DAYS_ROLLOVER_TUE | OVERNIGHT_DAYS_ROLLOVER_WED | OVERNIGHT_DAYS_ROLLOVER_THU |
  127. OVERNIGHT_DAYS_ROLLOVER_FRI | OVERNIGHT_DAYS_ROLLOVER_SAT
  128. };
  129. //--- common methods
  130. virtual void Release(void)=0;
  131. virtual MTAPIRES Assign(const IMTConServerTrade* param)=0;
  132. virtual MTAPIRES Clear(void)=0;
  133. //--- demo accounts mode EnDemoMode
  134. virtual UINT DemoMode(void) const=0;
  135. virtual MTAPIRES DemoMode(const UINT mode)=0;
  136. //--- demo accounts period
  137. virtual UINT DemoPeriod(void) const=0;
  138. virtual MTAPIRES DemoPeriod(const UINT period)=0;
  139. //--- overnight mode
  140. virtual UINT OvernightMode(void) const=0;
  141. virtual MTAPIRES OvernightMode(const UINT mode)=0;
  142. //--- overnight time (in minutes)
  143. virtual UINT OvernightTime(void) const=0;
  144. virtual MTAPIRES OvernightTime(const UINT time)=0;
  145. virtual INT64 OvernightTimeLast(void) const=0;
  146. virtual INT64 OvernightTimePrev(void) const=0;
  147. //--- overnight mode
  148. virtual UINT OvermonthMode(void) const=0;
  149. virtual MTAPIRES OvermonthMode(const UINT mode)=0;
  150. //--- overmonth time (in minutes)
  151. virtual INT64 OvermonthTimeLast(void) const=0;
  152. virtual INT64 OvermonthTimePrev(void) const=0;
  153. //--- client logins ranges for this trade server
  154. virtual MTAPIRES LoginsRangeAdd(IMTConServerRange* range)=0;
  155. virtual MTAPIRES LoginsRangeUpdate(const UINT pos,const IMTConServerRange* range)=0;
  156. virtual MTAPIRES LoginsRangeDelete(const UINT pos)=0;
  157. virtual MTAPIRES LoginsRangeClear(void)=0;
  158. virtual MTAPIRES LoginsRangeShift(const UINT pos,const int shift)=0;
  159. virtual UINT LoginsRangeTotal(void) const=0;
  160. virtual MTAPIRES LoginsRangeNext(const UINT pos,IMTConServerRange* range) const=0;
  161. //--- orders tickets ranges for this trade server
  162. virtual MTAPIRES OrdersRangeAdd(IMTConServerRange* range)=0;
  163. virtual MTAPIRES OrdersRangeUpdate(const UINT pos,const IMTConServerRange* range)=0;
  164. virtual MTAPIRES OrdersRangeDelete(const UINT pos)=0;
  165. virtual MTAPIRES OrdersRangeClear(void)=0;
  166. virtual MTAPIRES OrdersRangeShift(const UINT pos,const int shift)=0;
  167. virtual UINT OrdersRangeTotal(void) const=0;
  168. virtual MTAPIRES OrdersRangeNext(const UINT pos,IMTConServerRange* range) const=0;
  169. //--- deals tickets ranges for this trade server
  170. virtual MTAPIRES DealsRangeAdd(IMTConServerRange* range)=0;
  171. virtual MTAPIRES DealsRangeUpdate(const UINT pos,const IMTConServerRange* range)=0;
  172. virtual MTAPIRES DealsRangeDelete(const UINT pos)=0;
  173. virtual MTAPIRES DealsRangeClear(void)=0;
  174. virtual MTAPIRES DealsRangeShift(const UINT pos,const int shift)=0;
  175. virtual UINT DealsRangeTotal(void) const=0;
  176. virtual MTAPIRES DealsRangeNext(const UINT pos,IMTConServerRange* range) const=0;
  177. //--- trade totals
  178. virtual UINT TotalUsers(void) const=0;
  179. virtual UINT TotalUsersReal(void) const=0;
  180. virtual UINT TotalDeals(void) const=0;
  181. virtual UINT TotalOrders(void) const=0;
  182. virtual UINT TotalOrdersHistory(void) const=0;
  183. virtual UINT TotalPositions(void) const=0;
  184. //--- overnight days EnOvernightDays
  185. virtual UINT OvernightDays(void) const=0;
  186. virtual MTAPIRES OvernightDays(const UINT days)=0;
  187. };
  188. //+------------------------------------------------------------------+
  189. //| History server configuration |
  190. //+------------------------------------------------------------------+
  191. class IMTConServerHistory
  192. {
  193. public:
  194. //--- common methods
  195. virtual void Release(void)=0;
  196. virtual MTAPIRES Assign(const IMTConServerHistory* param)=0;
  197. virtual MTAPIRES Clear(void)=0;
  198. //--- datafeeds switch timeout
  199. virtual UINT DatafeedsTimeout(void) const=0;
  200. virtual MTAPIRES DatafeedsTimeout(const UINT timeout)=0;
  201. //--- max news buffer
  202. virtual UINT NewsMax(void) const=0;
  203. virtual MTAPIRES NewsMax(const UINT news_max)=0;
  204. };
  205. //+------------------------------------------------------------------+
  206. //| Backup server configuration |
  207. //+------------------------------------------------------------------+
  208. class IMTConServerBackup
  209. {
  210. public:
  211. //--- backup flags
  212. enum EnBackupFlags
  213. {
  214. FLAG_ENABLE_BACKUPS =0x00000001,
  215. FLAG_ENABLE_TICKS =0x00000002,
  216. FLAG_ENABLE_FAILOVER=0x00000004,
  217. FLAG_ENABLE_LOGS =0x00000008
  218. };
  219. //--- backup period
  220. enum EnBackupPeriod
  221. {
  222. BACKUP_DISABLED =0,
  223. BACKUP_15MINUTES =1,
  224. BACKUP_30MINUTES =2,
  225. BACKUP_1HOUR =3,
  226. BACKUP_4HOURS =4,
  227. BACKUP_1DAY =5,
  228. //--- enumeration borders
  229. BACKUP_FIRST =BACKUP_DISABLED,
  230. BACKUP_LAST =BACKUP_1DAY
  231. };
  232. //--- backup copy time to live
  233. enum EnBackupTTL
  234. {
  235. BACKUP_TTL_1DAY =1,
  236. BACKUP_TTL_3DAYS =2,
  237. BACKUP_TTL_1WEEK =3,
  238. BACKUP_TTL_1MONTH =4,
  239. BACKUP_TTL_3MONTHS=5,
  240. BACKUP_TTL_6MONTHS=6,
  241. //--- enumeration borders
  242. BACKUP_TTL_FIRST =BACKUP_TTL_1DAY,
  243. BACKUP_TTL_LAST =BACKUP_TTL_6MONTHS
  244. };
  245. //--- SQL export modes
  246. enum EnSQLExportMode
  247. {
  248. SQL_MODE_NONE =0,
  249. SQL_MODE_MSSQL =1,
  250. SQL_MODE_FIREBIRD =2,
  251. SQL_MODE_MYSQL =3,
  252. SQL_MODE_ORACLE =4,
  253. SQL_MODE_POSTGRESQL=5,
  254. //--- enumeration borders
  255. SQL_MODE_FIRST =SQL_MODE_NONE,
  256. SQL_MODE_LAST =SQL_MODE_POSTGRESQL,
  257. };
  258. //--- SQL export flags
  259. enum EnSQLExportFlags
  260. {
  261. SQL_FLAG_NONE =0x00000000,
  262. SQL_FLAG_PARTITIONS=0x00000001, // split by years
  263. SQL_FLAG_SKIP_DEMO =0x00000002, // skip demo accounts
  264. //--- enumeration borders
  265. SQL_FLAG_ALL =SQL_FLAG_PARTITIONS|SQL_FLAG_SKIP_DEMO
  266. };
  267. //--- common methods
  268. virtual void Release(void)=0;
  269. virtual MTAPIRES Assign(const IMTConServerBackup* param)=0;
  270. virtual MTAPIRES Clear(void)=0;
  271. //--- master server
  272. virtual UINT64 MasterServer(void) const=0;
  273. virtual MTAPIRES MasterServer(const UINT64 id)=0;
  274. //--- backup path
  275. virtual LPCWSTR BackupPath(void) const=0;
  276. virtual MTAPIRES BackupPath(LPCWSTR path)=0;
  277. //--- full backup time (minutes)
  278. virtual UINT BackupFullTime(void) const=0;
  279. virtual MTAPIRES BackupFullTime(const UINT time)=0;
  280. //--- backup period - EnBackupPeriod
  281. virtual UINT BackupPeriod(void) const=0;
  282. virtual MTAPIRES BackupPeriod(const UINT period)=0;
  283. //--- backup copy TTL - EnBackupTTL
  284. virtual UINT BackupTTL(void) const=0;
  285. virtual MTAPIRES BackupTTL(const UINT period)=0;
  286. //--- backup flags - EnBackupFlags
  287. virtual UINT64 BackupFlags(void) const=0;
  288. virtual MTAPIRES BackupFlags(const UINT64 flags)=0;
  289. //--- sql export mode
  290. virtual UINT SQLExportMode(void) const=0;
  291. virtual MTAPIRES SQLExportMode(const UINT mode)=0;
  292. //--- sql export flags
  293. virtual UINT64 SQLExportFlags(void) const=0;
  294. virtual MTAPIRES SQLExportFlags(const UINT64 flags)=0;
  295. //--- sql export open trades refresh period in minutes
  296. virtual UINT SQLExportPeriod(void) const=0;
  297. virtual MTAPIRES SQLExportPeriod(const UINT period)=0;
  298. //--- sql export server
  299. virtual LPCWSTR SQLExportServer(void) const=0;
  300. virtual MTAPIRES SQLExportServer(LPCWSTR server)=0;
  301. //--- sql export login
  302. virtual LPCWSTR SQLExportLogin(void) const=0;
  303. virtual MTAPIRES SQLExportLogin(LPCWSTR login)=0;
  304. //--- sql export password
  305. virtual LPCWSTR SQLExportPassword(void) const=0;
  306. virtual MTAPIRES SQLExportPassword(LPCWSTR password)=0;
  307. //--- sql export folder
  308. virtual LPCWSTR SQLExportFolder(void) const=0;
  309. virtual MTAPIRES SQLExportFolder(LPCWSTR folder)=0;
  310. //--- last synchronization with master server
  311. virtual INT64 BackupLastSync(void) const=0;
  312. };
  313. //+------------------------------------------------------------------+
  314. //| Access server configuration |
  315. //+------------------------------------------------------------------+
  316. class IMTConServerAccess
  317. {
  318. public:
  319. //--- access mask
  320. enum EnAccessMask
  321. {
  322. ACCESS_ALLOW_CLIENT =1,
  323. ACCESS_ALLOW_MANAGER =2,
  324. ACCESS_ALLOW_ADMIN =4,
  325. ACCESS_ALLOW_RESERVED =8,
  326. ACCESS_ALLOW_MANAGER_API=16,
  327. ACCESS_ALLOW_WEB_API =32,
  328. //--- enumeration borders
  329. ACCESS_ALLOW_NONE =0,
  330. ACCESS_ALLOW_ALL =ACCESS_ALLOW_CLIENT|ACCESS_ALLOW_MANAGER|ACCESS_ALLOW_ADMIN|ACCESS_ALLOW_RESERVED|ACCESS_ALLOW_MANAGER_API|ACCESS_ALLOW_WEB_API
  331. };
  332. //--- access flags
  333. enum EnAccessFlags
  334. {
  335. ACCESS_FLAGS_INVISIBLE =1,
  336. //--- enumeration borders
  337. ACCESS_FLAGS_NONE =0,
  338. ACCESS_FLAGS_ALL =ACCESS_FLAGS_INVISIBLE
  339. };
  340. //--- EnServerPriority
  341. enum EnServerPriority
  342. {
  343. PRIORITY_HIGHEST =0,
  344. PRIORITY_LOWEST =15,
  345. PRIORITY_IDLE =255,
  346. //---
  347. PRIORITY_FIRST =PRIORITY_HIGHEST,
  348. PRIORITY_LAST =PRIORITY_IDLE
  349. };
  350. //--- common methods
  351. virtual void Release(void)=0;
  352. virtual MTAPIRES Assign(const IMTConServerAccess* param)=0;
  353. virtual MTAPIRES Clear(void)=0;
  354. //--- priority
  355. virtual UINT Priority(void) const=0;
  356. virtual MTAPIRES Priority(const UINT priority)=0;
  357. virtual UINT PriorityCurrent(void) const=0;
  358. //--- access flags EnAccessMask
  359. virtual UINT AccessMask(void) const=0;
  360. virtual MTAPIRES AccessMask(const UINT mask)=0;
  361. //--- max news buffer
  362. virtual UINT NewsMax(void) const=0;
  363. virtual MTAPIRES NewsMax(const UINT news_max)=0;
  364. //--- antiflood
  365. virtual UINT AntifloodEnabled(void) const=0;
  366. virtual MTAPIRES AntifloodEnabled(const UINT enabled)=0;
  367. //--- antiflood connects criterion
  368. virtual UINT AntifloodConnects(void) const=0;
  369. virtual MTAPIRES AntifloodConnects(const UINT connects)=0;
  370. //--- antiflood connects criterion
  371. virtual UINT AntifloodErrors(void) const=0;
  372. virtual MTAPIRES AntifloodErrors(const UINT errors)=0;
  373. //--- list of public addresses (address:port) available for terminals
  374. virtual MTAPIRES PointsAdd(LPCWSTR path)=0;
  375. virtual MTAPIRES PointsUpdate(const UINT pos,LPCWSTR address)=0;
  376. virtual MTAPIRES PointsDelete(const UINT pos)=0;
  377. virtual MTAPIRES PointsClear(void)=0;
  378. virtual MTAPIRES PointsShift(const UINT pos,const int shift)=0;
  379. virtual UINT PointsTotal(void) const=0;
  380. virtual LPCWSTR PointsNext(const UINT pos) const=0;
  381. //--- list of internal addresses (address:port) for server listening
  382. virtual MTAPIRES BindingsAdd(LPCWSTR path)=0;
  383. virtual MTAPIRES BindingsUpdate(const UINT pos,LPCWSTR address)=0;
  384. virtual MTAPIRES BindingsDelete(const UINT pos)=0;
  385. virtual MTAPIRES BindingsClear(void)=0;
  386. virtual MTAPIRES BindingsShift(const UINT pos,const int shift)=0;
  387. virtual UINT BindingsTotal(void) const=0;
  388. virtual LPCWSTR BindingsNext(const UINT pos) const=0;
  389. //--- list of trade attended trade servers
  390. virtual MTAPIRES ServersAdd(const UINT64 server_id)=0;
  391. virtual MTAPIRES ServersUpdate(const UINT pos,UINT64 server_id)=0;
  392. virtual MTAPIRES ServersDelete(const UINT pos)=0;
  393. virtual MTAPIRES ServersClear(void)=0;
  394. virtual MTAPIRES ServersShift(const UINT pos,const int shift)=0;
  395. virtual UINT ServersTotal(void) const=0;
  396. virtual UINT64 ServersNext(const UINT pos) const=0;
  397. //--- access flags EnAccessFlags
  398. virtual UINT AccessFlags(void) const=0;
  399. virtual MTAPIRES AccessFlags(const UINT flags)=0;
  400. };
  401. //+------------------------------------------------------------------+
  402. //| Ant DDoS server configuration |
  403. //+------------------------------------------------------------------+
  404. class IMTConServerAntiDDoS
  405. {
  406. public:
  407. //--- access mask
  408. enum EnAccessMask
  409. {
  410. ACCESS_ALLOW_CLIENT =1,
  411. ACCESS_ALLOW_MANAGER =2,
  412. ACCESS_ALLOW_ADMIN =4,
  413. ACCESS_ALLOW_CLIENT_API =8,
  414. ACCESS_ALLOW_MANAGER_API=16,
  415. ACCESS_ALLOW_WEB_API =32,
  416. //--- enumeration borders
  417. ACCESS_ALLOW_NONE =0,
  418. ACCESS_ALLOW_ALL =ACCESS_ALLOW_CLIENT|ACCESS_ALLOW_MANAGER|ACCESS_ALLOW_ADMIN|ACCESS_ALLOW_CLIENT_API|ACCESS_ALLOW_MANAGER_API|ACCESS_ALLOW_WEB_API
  419. };
  420. //--- EnServerPriority
  421. enum EnServerPriority
  422. {
  423. PRIORITY_HIGHEST =0,
  424. PRIORITY_LOWEST =15,
  425. PRIORITY_IDLE =255,
  426. //---
  427. PRIORITY_FIRST =PRIORITY_HIGHEST,
  428. PRIORITY_LAST =PRIORITY_IDLE
  429. };
  430. //--- common methods
  431. virtual void Release(void)=0;
  432. virtual MTAPIRES Assign(const IMTConServerAntiDDoS* param)=0;
  433. virtual MTAPIRES Clear(void)=0;
  434. //--- priority
  435. virtual UINT Priority(void) const=0;
  436. virtual MTAPIRES Priority(const UINT priority)=0;
  437. //--- access flags EnAccessMask
  438. virtual UINT AccessMask(void) const=0;
  439. virtual MTAPIRES AccessMask(const UINT mask)=0;
  440. //--- list of public addresses (address:port) available for terminals
  441. virtual MTAPIRES PointsAdd(LPCWSTR path)=0;
  442. virtual MTAPIRES PointsUpdate(const UINT pos,LPCWSTR address)=0;
  443. virtual MTAPIRES PointsDelete(const UINT pos)=0;
  444. virtual MTAPIRES PointsClear(void)=0;
  445. virtual MTAPIRES PointsShift(const UINT pos,const int shift)=0;
  446. virtual UINT PointsTotal(void) const=0;
  447. virtual LPCWSTR PointsNext(const UINT pos) const=0;
  448. //--- list of trade attended trade servers
  449. virtual MTAPIRES ServersAdd(const UINT64 server_id)=0;
  450. virtual MTAPIRES ServersUpdate(const UINT pos,UINT64 server_id)=0;
  451. virtual MTAPIRES ServersDelete(const UINT pos)=0;
  452. virtual MTAPIRES ServersClear(void)=0;
  453. virtual MTAPIRES ServersShift(const UINT pos,const int shift)=0;
  454. virtual UINT ServersTotal(void) const=0;
  455. virtual UINT64 ServersNext(const UINT pos) const=0;
  456. //--- list of source addresses
  457. virtual MTAPIRES SourcesAdd(IMTConAddressRange* range)=0;
  458. virtual MTAPIRES SourcesUpdate(const UINT pos,const IMTConAddressRange* range)=0;
  459. virtual MTAPIRES SourcesDelete(const UINT pos)=0;
  460. virtual MTAPIRES SourcesShift(const UINT pos,const int shift)=0;
  461. virtual UINT SourcesTotal(void) const=0;
  462. virtual MTAPIRES SourcesNext(const UINT pos,IMTConAddressRange* access) const=0;
  463. };
  464. //+------------------------------------------------------------------+
  465. //| Common platform server configuration |
  466. //+------------------------------------------------------------------+
  467. class IMTConServer
  468. {
  469. public:
  470. //--- server types
  471. enum EnServerTypes
  472. {
  473. NET_MAIN_TRADE_SERVER =0,
  474. NET_TRADE_SERVER =1,
  475. NET_HISTORY_SERVER =2,
  476. NET_ACCESS_SERVER =3,
  477. NET_BACKUP_SERVER =4,
  478. NET_OBSOLETE_SERVER_1 =5,
  479. NET_OBSOLETE_SERVER_2 =6,
  480. NET_ANTIDDOS_SERVER =7,
  481. //--- enumeration borders
  482. NET_SERVER_FIRST =NET_MAIN_TRADE_SERVER,
  483. NET_SERVER_LAST =NET_ANTIDDOS_SERVER
  484. };
  485. //--- failover mode
  486. enum EnFailoverModes
  487. {
  488. FAILOVER_MODE_DISABLED =0, // disabled
  489. FAILOVER_MODE_BY_MOST =1, // server is unaccessible for most witness servers
  490. FAILOVER_MODE_BY_ALL =2, // server is unaccessible for all witness servers
  491. //--- enumeration borders
  492. FAILOVER_MODE_FIRST =FAILOVER_MODE_DISABLED,
  493. FAILOVER_MODE_LAST =FAILOVER_MODE_BY_ALL
  494. };
  495. //--- common methods
  496. virtual void Release(void)=0;
  497. virtual MTAPIRES Assign(const IMTConServer* param)=0;
  498. virtual MTAPIRES Clear(void)=0;
  499. //--- server type
  500. virtual UINT Type(void) const=0;
  501. virtual MTAPIRES Type(const UINT type)=0;
  502. //--- server name
  503. virtual LPCWSTR Name(void) const=0;
  504. virtual MTAPIRES Name(LPCWSTR name)=0;
  505. //--- address
  506. virtual LPCWSTR Address(void) const=0;
  507. virtual MTAPIRES Address(LPCWSTR name)=0;
  508. //--- server id
  509. virtual UINT64 Id(void) const=0;
  510. virtual MTAPIRES Id(const UINT64 id)=0;
  511. //--- password
  512. virtual MTAPIRES Password(LPCWSTR password)=0;
  513. virtual MTAPIRES PasswordCheck(LPCWSTR password) const=0;
  514. //--- service time in minutes
  515. virtual UINT ServiceTime(void) const=0;
  516. virtual MTAPIRES ServiceTime(const UINT stime)=0;
  517. //--- list of network adapters
  518. virtual LPCWSTR AdaptersCurrent(void) const=0;
  519. virtual MTAPIRES AdaptersCurrent(LPCWSTR current)=0;
  520. virtual UINT AdaptersTotal(void) const=0;
  521. virtual LPCWSTR AdaptersNext(const UINT pos) const=0;
  522. //--- list of available ips
  523. virtual UINT AddressTotal(void) const=0;
  524. virtual UINT AddressNext(const UINT pos) const=0;
  525. //--- server info
  526. virtual UINT Version(void) const=0;
  527. virtual UINT Build(void) const=0;
  528. virtual LPCWSTR BuildDate(void) const=0;
  529. virtual INT64 LastBootTime(void) const=0;
  530. virtual bool Connected(void) const=0;
  531. virtual LPCWSTR OS(void) const=0;
  532. //--- cpu info
  533. virtual LPCWSTR CPU(void) const=0;
  534. virtual UINT CPUTotal(void) const=0;
  535. virtual UINT CPUUsageMax(void) const=0;
  536. virtual UINT CPUUsageCritical(void) const=0;
  537. //--- memory info (in MB)
  538. virtual UINT MemoryTotal(void) const=0;
  539. virtual UINT MemoryFree(void) const=0;
  540. virtual UINT MemoryFreeMin(void) const=0;
  541. virtual UINT MemoryFreeCritical(void) const=0;
  542. //--- hdd info (in MB)
  543. virtual UINT HDDTotal(void) const=0;
  544. virtual UINT HDDFree(void) const=0;
  545. virtual UINT HDDFreeCritical(void) const=0;
  546. virtual UINT HDDFragments(void) const=0;
  547. virtual UINT HDDFragmentsCritical(void) const=0;
  548. virtual UINT HDDSpeedRead(void) const=0;
  549. virtual UINT HDDSpeedReadCritical(void) const=0;
  550. virtual UINT HDDSpeedWrite(void) const=0;
  551. virtual UINT HDDSpeedWriteCritical(void) const=0;
  552. //--- connections info
  553. virtual UINT ConnectsMax(void) const=0;
  554. virtual UINT ConnectsCritical(void) const=0;
  555. //--- network info (Kbyte/s)
  556. virtual UINT NetworkMax(void) const=0;
  557. virtual UINT NetworkCritical(void) const=0;
  558. //--- specific server interfaces
  559. virtual IMTConServerTrade* TradeServer(void)=0;
  560. virtual IMTConServerHistory* HistoryServer(void)=0;
  561. virtual IMTConServerAccess* AccessServer(void)=0;
  562. virtual IMTConServerBackup* BackupServer(void)=0;
  563. virtual IMTConServerAntiDDoS* AntiDDoSServer(void)=0;
  564. virtual void* ReservedServer1(void)=0;
  565. virtual void* ReservedServer2(void)=0;
  566. virtual void* ReservedServer3(void)=0;
  567. virtual void* ReservedServer4(void)=0;
  568. //--- list of external addresses (address:port) for connections to server
  569. virtual MTAPIRES PointsAdd(LPCWSTR path)=0;
  570. virtual MTAPIRES PointsUpdate(const UINT pos,LPCWSTR address)=0;
  571. virtual MTAPIRES PointsDelete(const UINT pos)=0;
  572. virtual MTAPIRES PointsClear(void)=0;
  573. virtual MTAPIRES PointsShift(const UINT pos,const int shift)=0;
  574. virtual UINT PointsTotal(void) const=0;
  575. virtual LPCWSTR PointsNext(const UINT pos) const=0;
  576. //--- list of internal addresses (address:port) for server listening
  577. virtual MTAPIRES BindingsAdd(LPCWSTR path)=0;
  578. virtual MTAPIRES BindingsUpdate(const UINT pos,LPCWSTR address)=0;
  579. virtual MTAPIRES BindingsDelete(const UINT pos)=0;
  580. virtual MTAPIRES BindingsClear(void)=0;
  581. virtual MTAPIRES BindingsShift(const UINT pos,const int shift)=0;
  582. virtual UINT BindingsTotal(void) const=0;
  583. virtual LPCWSTR BindingsNext(const UINT pos) const=0;
  584. //--- failover mode
  585. virtual UINT FailoverMode(void) const=0;
  586. virtual MTAPIRES FailoverMode(const UINT mode)=0;
  587. //--- failover timeout
  588. virtual UINT FailoverTimeout(void) const=0;
  589. virtual MTAPIRES FailoverTimeout(const UINT timeout)=0;
  590. //--- cluster servers state
  591. virtual UINT ClusterStateTotal(void) const=0;
  592. virtual MTAPIRES ClusterStateNext(const UINT pos,IMTConClusterState* state) const=0;
  593. virtual MTAPIRES ClusterStateGet(const UINT64 id,IMTConClusterState* state) const=0;
  594. };
  595. //+------------------------------------------------------------------+
  596. //| Time config events notification interface |
  597. //+------------------------------------------------------------------+
  598. class IMTConServerSink
  599. {
  600. public:
  601. virtual void OnConServerAdd(const IMTConServer* /*server*/) { }
  602. virtual void OnConServerUpdate(const IMTConServer* /*server*/) { }
  603. virtual void OnConServerDelete(const IMTConServer* /*server*/) { }
  604. virtual void OnConServerSync(void) { }
  605. };
  606. //+------------------------------------------------------------------+