├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── img
├── mt5.png
├── redis_bench.png
└── socket_bench.png
├── mt5
├── MQL5
│ ├── Experts
│ │ ├── MT5_to_Python_live_v4.1.ex5
│ │ └── MT5_to_Python_live_v4.1.mq5
│ ├── Include
│ │ ├── redis.mqh
│ │ └── socket-library-mt4-mt5.mqh
│ └── Libraries
│ │ ├── hiredis.dll
│ │ ├── libeay32.dll
│ │ └── ssleay32.dll
└── source
│ └── hiredis
│ ├── hiredis.sln
│ ├── hiredis
│ ├── async.c
│ ├── async.h
│ ├── dict.c
│ ├── dict.h
│ ├── fmacros.h
│ ├── hiredis.c
│ ├── hiredis.def
│ ├── hiredis.h
│ ├── hiredis.vcxproj
│ ├── hiredis.vcxproj.filters
│ ├── hiredis.vcxproj.user
│ ├── net.c
│ ├── net.h
│ ├── sds.c
│ ├── sds.h
│ ├── sdsalloc.h
│ ├── src
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ ├── Makefile.dep
│ │ ├── Win32_Interop
│ │ │ ├── EventLog.h
│ │ │ ├── EventLog.mc
│ │ │ ├── WS2tcpip.h
│ │ │ ├── Win32_ANSI.c
│ │ │ ├── Win32_ANSI.h
│ │ │ ├── Win32_APIs.c
│ │ │ ├── Win32_APIs.h
│ │ │ ├── Win32_Assert.h
│ │ │ ├── Win32_CommandLine.cpp
│ │ │ ├── Win32_CommandLine.h
│ │ │ ├── Win32_Common.cpp
│ │ │ ├── Win32_Common.h
│ │ │ ├── Win32_Error.c
│ │ │ ├── Win32_Error.h
│ │ │ ├── Win32_EventLog.cpp
│ │ │ ├── Win32_EventLog.h
│ │ │ ├── Win32_FDAPI.cpp
│ │ │ ├── Win32_FDAPI.h
│ │ │ ├── Win32_Interop.vcxproj
│ │ │ ├── Win32_PThread.c
│ │ │ ├── Win32_PThread.h
│ │ │ ├── Win32_Portability.h
│ │ │ ├── Win32_QFork.cpp
│ │ │ ├── Win32_QFork.h
│ │ │ ├── Win32_QFork_impl.c
│ │ │ ├── Win32_QFork_impl.h
│ │ │ ├── Win32_RedisLog.c
│ │ │ ├── Win32_RedisLog.h
│ │ │ ├── Win32_Service.h
│ │ │ ├── Win32_Signal_Process.c
│ │ │ ├── Win32_Signal_Process.h
│ │ │ ├── Win32_SmartHandle.h
│ │ │ ├── Win32_StackTrace.cpp
│ │ │ ├── Win32_StackTrace.h
│ │ │ ├── Win32_ThreadControl.c
│ │ │ ├── Win32_ThreadControl.h
│ │ │ ├── Win32_Time.c
│ │ │ ├── Win32_Time.h
│ │ │ ├── Win32_dlmalloc.c
│ │ │ ├── Win32_dlmalloc.h
│ │ │ ├── Win32_fdapi_crt.cpp
│ │ │ ├── Win32_fdapi_crt.h
│ │ │ ├── Win32_service.cpp
│ │ │ ├── Win32_variadicFunctor.cpp
│ │ │ ├── Win32_variadicFunctor.h
│ │ │ ├── resources
│ │ │ │ ├── EventLog.rc
│ │ │ │ ├── EventLog.res
│ │ │ │ └── EventLog_MSG00409.bin
│ │ │ ├── win32_rfdmap.cpp
│ │ │ ├── win32_rfdmap.h
│ │ │ ├── win32_types.h
│ │ │ ├── win32_types_hiredis.h
│ │ │ ├── win32_winapifamily.h
│ │ │ ├── win32_wsiocp.c
│ │ │ ├── win32_wsiocp.h
│ │ │ ├── win32_wsiocp2.h
│ │ │ ├── win32fixes.c
│ │ │ └── win32fixes.h
│ │ ├── adlist.c
│ │ ├── adlist.h
│ │ ├── ae.c
│ │ ├── ae.h
│ │ ├── ae_epoll.c
│ │ ├── ae_evport.c
│ │ ├── ae_kqueue.c
│ │ ├── ae_select.c
│ │ ├── ae_wsiocp.c
│ │ ├── anet.c
│ │ ├── anet.h
│ │ ├── aof.c
│ │ ├── asciilogo.h
│ │ ├── bio.c
│ │ ├── bio.h
│ │ ├── bitops.c
│ │ ├── blocked.c
│ │ ├── cluster.c
│ │ ├── cluster.h
│ │ ├── config.c
│ │ ├── config.h
│ │ ├── crc16.c
│ │ ├── crc64.c
│ │ ├── crc64.h
│ │ ├── db.c
│ │ ├── debug.c
│ │ ├── deps
│ │ │ └── lua
│ │ │ │ ├── COPYRIGHT
│ │ │ │ ├── HISTORY
│ │ │ │ ├── INSTALL
│ │ │ │ ├── Makefile
│ │ │ │ ├── README
│ │ │ │ ├── etc
│ │ │ │ ├── Makefile
│ │ │ │ ├── README
│ │ │ │ ├── all.c
│ │ │ │ ├── lua.hpp
│ │ │ │ ├── lua.ico
│ │ │ │ ├── lua.pc
│ │ │ │ ├── luavs.bat
│ │ │ │ ├── min.c
│ │ │ │ ├── noparser.c
│ │ │ │ └── strict.lua
│ │ │ │ ├── src
│ │ │ │ ├── Makefile
│ │ │ │ ├── fpconv.c
│ │ │ │ ├── fpconv.h
│ │ │ │ ├── lapi.c
│ │ │ │ ├── lapi.h
│ │ │ │ ├── lauxlib.c
│ │ │ │ ├── lauxlib.h
│ │ │ │ ├── lbaselib.c
│ │ │ │ ├── lcode.c
│ │ │ │ ├── lcode.h
│ │ │ │ ├── ldblib.c
│ │ │ │ ├── ldebug.c
│ │ │ │ ├── ldebug.h
│ │ │ │ ├── ldo.c
│ │ │ │ ├── ldo.h
│ │ │ │ ├── ldump.c
│ │ │ │ ├── lfunc.c
│ │ │ │ ├── lfunc.h
│ │ │ │ ├── lgc.c
│ │ │ │ ├── lgc.h
│ │ │ │ ├── linit.c
│ │ │ │ ├── liolib.c
│ │ │ │ ├── llex.c
│ │ │ │ ├── llex.h
│ │ │ │ ├── llimits.h
│ │ │ │ ├── lmathlib.c
│ │ │ │ ├── lmem.c
│ │ │ │ ├── lmem.h
│ │ │ │ ├── loadlib.c
│ │ │ │ ├── lobject.c
│ │ │ │ ├── lobject.h
│ │ │ │ ├── lopcodes.c
│ │ │ │ ├── lopcodes.h
│ │ │ │ ├── loslib.c
│ │ │ │ ├── lparser.c
│ │ │ │ ├── lparser.h
│ │ │ │ ├── lstate.c
│ │ │ │ ├── lstate.h
│ │ │ │ ├── lstring.c
│ │ │ │ ├── lstring.h
│ │ │ │ ├── lstrlib.c
│ │ │ │ ├── ltable.c
│ │ │ │ ├── ltable.h
│ │ │ │ ├── ltablib.c
│ │ │ │ ├── ltm.c
│ │ │ │ ├── ltm.h
│ │ │ │ ├── lua.c
│ │ │ │ ├── lua.h
│ │ │ │ ├── lua_bit.c
│ │ │ │ ├── lua_cjson.c
│ │ │ │ ├── lua_cmsgpack.c
│ │ │ │ ├── lua_struct.c
│ │ │ │ ├── luac.c
│ │ │ │ ├── luaconf.h
│ │ │ │ ├── lualib.h
│ │ │ │ ├── lundump.c
│ │ │ │ ├── lundump.h
│ │ │ │ ├── lvm.c
│ │ │ │ ├── lvm.h
│ │ │ │ ├── lzio.c
│ │ │ │ ├── lzio.h
│ │ │ │ ├── print.c
│ │ │ │ ├── strbuf.c
│ │ │ │ └── strbuf.h
│ │ │ │ └── test
│ │ │ │ ├── README
│ │ │ │ ├── bisect.lua
│ │ │ │ ├── cf.lua
│ │ │ │ ├── echo.lua
│ │ │ │ ├── env.lua
│ │ │ │ ├── factorial.lua
│ │ │ │ ├── fib.lua
│ │ │ │ ├── fibfor.lua
│ │ │ │ ├── globals.lua
│ │ │ │ ├── hello.lua
│ │ │ │ ├── life.lua
│ │ │ │ ├── luac.lua
│ │ │ │ ├── printf.lua
│ │ │ │ ├── readonly.lua
│ │ │ │ ├── sieve.lua
│ │ │ │ ├── sort.lua
│ │ │ │ ├── table.lua
│ │ │ │ ├── trace-calls.lua
│ │ │ │ ├── trace-globals.lua
│ │ │ │ └── xd.lua
│ │ ├── dict.c
│ │ ├── dict.h
│ │ ├── endianconv.c
│ │ ├── endianconv.h
│ │ ├── fmacros.h
│ │ ├── geo.c
│ │ ├── geo.h
│ │ ├── help.h
│ │ ├── hyperloglog.c
│ │ ├── intset.c
│ │ ├── intset.h
│ │ ├── latency.c
│ │ ├── latency.h
│ │ ├── lzf.h
│ │ ├── lzfP.h
│ │ ├── lzf_c.c
│ │ ├── lzf_d.c
│ │ ├── memtest.c
│ │ ├── mkreleasehdr.sh
│ │ ├── multi.c
│ │ ├── networking.c
│ │ ├── notify.c
│ │ ├── object.c
│ │ ├── pqsort.c
│ │ ├── pqsort.h
│ │ ├── pubsub.c
│ │ ├── quicklist.c
│ │ ├── quicklist.h
│ │ ├── rand.c
│ │ ├── rand.h
│ │ ├── rdb.c
│ │ ├── rdb.h
│ │ ├── redis-benchmark.c
│ │ ├── redis-check-aof.c
│ │ ├── redis-check-rdb.c
│ │ ├── redis-cli.c
│ │ ├── redis-trib.rb
│ │ ├── redisassert.h
│ │ ├── release.c
│ │ ├── replication.c
│ │ ├── rio.c
│ │ ├── rio.h
│ │ ├── scripting.c
│ │ ├── sds.c
│ │ ├── sds.h
│ │ ├── sdsalloc.h
│ │ ├── sentinel.c
│ │ ├── server.c_
│ │ ├── server.h_
│ │ ├── setproctitle.c
│ │ ├── sha1.c
│ │ ├── sha1.h
│ │ ├── slowlog.c
│ │ ├── slowlog.h
│ │ ├── solarisfixes.h
│ │ ├── sort.c
│ │ ├── sparkline.c
│ │ ├── sparkline.h
│ │ ├── syncio.c
│ │ ├── t_hash.c
│ │ ├── t_list.c
│ │ ├── t_set.c
│ │ ├── t_string.c
│ │ ├── t_zset.c
│ │ ├── testhelp.h
│ │ ├── util.c
│ │ ├── util.h
│ │ ├── valgrind.sup
│ │ ├── version.h
│ │ ├── ziplist.c
│ │ ├── ziplist.h
│ │ ├── zipmap.c
│ │ ├── zipmap.h
│ │ ├── zmalloc.c
│ │ └── zmalloc.h
│ ├── test.c
│ ├── win32_hiredis.h
│ └── zmalloc.h
│ └── x64
│ └── Release
│ └── hiredis.dll
└── python
├── example_Redis.py
├── example_Redis_benchmark.py
├── example_Socket.py
└── example_Socket_benchmark.py
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 |
50 | # Translations
51 | *.mo
52 | *.pot
53 |
54 | # Django stuff:
55 | *.log
56 | local_settings.py
57 | db.sqlite3
58 |
59 | # Flask stuff:
60 | instance/
61 | .webassets-cache
62 |
63 | # Scrapy stuff:
64 | .scrapy
65 |
66 | # Sphinx documentation
67 | docs/_build/
68 |
69 | # PyBuilder
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # pyenv
76 | .python-version
77 |
78 | # celery beat schedule file
79 | celerybeat-schedule
80 |
81 | # SageMath parsed files
82 | *.sage.py
83 |
84 | # Environments
85 | .env
86 | .venv
87 | env/
88 | venv/
89 | ENV/
90 | env.bak/
91 | venv.bak/
92 |
93 | # Spyder project settings
94 | .spyderproject
95 | .spyproject
96 |
97 | # Rope project settings
98 | .ropeproject
99 |
100 | # mkdocs documentation
101 | /site
102 |
103 | # mypy
104 | .mypy_cache/
105 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MT5_to_Python
2 |
3 | the repository show 2 ways to transfer data from mt5 to python.
4 | description will be in Russian, if necessary, use Google translate
5 |
6 |
7 | ## MT5
8 | в папке /mt5/MQL5/ все необходимое для работы, со всеми исходниками!
9 |
10 | терминал от Alpari MT5 Version 5.00 build 1940
11 |
12 |
13 |
14 |
15 |
16 | * Советник отправляет данные при изменении Close по выбранным инструментам
17 | * Если список инструментов оставить пустым - будет слать по всем парам из обзора рынка
18 |
19 |
20 | ## Python
21 | сделал 2 примера:
22 | 1) непосредственного получения и обработки данных
23 | 2) и тест скорости отправки. у меня по сокетам и по редис время, от отправки из терминала, до получения в питоне быстрее 0,001 sec (те Очень быстро и разницы на таком уровне нету)
24 |
25 |
26 |
   
27 |
28 |
29 |
30 | Сам я остановился на варианте с Redis тк:
31 | + достаточно одного терминала на множество скриптов. (работа идет как с единым БД).
32 | + по скорости, для моих нужд, более чем быстро и не уступает socket
33 |
34 | ## Install
35 | ### Redis
36 | Если под винды: https://github.com/MicrosoftArchive/redis/releases
37 |
38 | ## Contacts
39 | Telegram: @Lxbinary
40 |
--------------------------------------------------------------------------------
/img/mt5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/img/mt5.png
--------------------------------------------------------------------------------
/img/redis_bench.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/img/redis_bench.png
--------------------------------------------------------------------------------
/img/socket_bench.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/img/socket_bench.png
--------------------------------------------------------------------------------
/mt5/MQL5/Experts/MT5_to_Python_live_v4.1.ex5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Experts/MT5_to_Python_live_v4.1.ex5
--------------------------------------------------------------------------------
/mt5/MQL5/Experts/MT5_to_Python_live_v4.1.mq5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Experts/MT5_to_Python_live_v4.1.mq5
--------------------------------------------------------------------------------
/mt5/MQL5/Include/redis.mqh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Include/redis.mqh
--------------------------------------------------------------------------------
/mt5/MQL5/Libraries/hiredis.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Libraries/hiredis.dll
--------------------------------------------------------------------------------
/mt5/MQL5/Libraries/libeay32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Libraries/libeay32.dll
--------------------------------------------------------------------------------
/mt5/MQL5/Libraries/ssleay32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Libraries/ssleay32.dll
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hiredis", "hiredis\hiredis.vcxproj", "{7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x64.ActiveCfg = Debug|x64
17 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x64.Build.0 = Debug|x64
18 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x86.ActiveCfg = Debug|Win32
19 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x86.Build.0 = Debug|Win32
20 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x64.ActiveCfg = Release|x64
21 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x64.Build.0 = Release|x64
22 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x86.ActiveCfg = Release|Win32
23 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/fmacros.h:
--------------------------------------------------------------------------------
1 | #ifndef __HIREDIS_FMACRO_H
2 | #define __HIREDIS_FMACRO_H
3 |
4 | #if !defined(_BSD_SOURCE)
5 | #define _BSD_SOURCE
6 | #endif
7 |
8 | #if defined(_AIX)
9 | #define _ALL_SOURCE
10 | #endif
11 |
12 | #if defined(__sun__)
13 | #define _POSIX_C_SOURCE 200112L
14 | #elif defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__)
15 | #define _XOPEN_SOURCE 600
16 | #else
17 | #define _XOPEN_SOURCE
18 | #endif
19 |
20 | #if __APPLE__ && __MACH__
21 | #define _OSX
22 | #endif
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/hiredis.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | freeReplyObject
3 | redisConnect
4 | redisConnectWithTimeout
5 | redisConnectNonBlock
6 | redisSetTimeout
7 | redisEnableKeepAlive
8 | redisFree
9 | _redisFree
10 | redisFreeKeepFd
11 | redisBufferRead
12 | redisBufferWrite
13 | redisvAppendCommand
14 | redisAppendCommand
15 | redisAppendCommandArgv
16 | redisvCommand
17 | redisCommand
18 | redisCommandArgv
19 | __redisSetError
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/hiredis.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/net.h:
--------------------------------------------------------------------------------
1 | /* Extracted from anet.c to work properly with Hiredis error reporting.
2 | *
3 | * Copyright (c) 2006-2011, Salvatore Sanfilippo
4 | * Copyright (c) 2010-2011, Pieter Noordhuis
5 | *
6 | * All rights reserved.
7 | *
8 | * Redistribution and use in source and binary forms, with or without
9 | * modification, are permitted provided that the following conditions are met:
10 | *
11 | * * Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * * Redistributions in binary form must reproduce the above copyright
14 | * notice, this list of conditions and the following disclaimer in the
15 | * documentation and/or other materials provided with the distribution.
16 | * * Neither the name of Redis nor the names of its contributors may be used
17 | * to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | #ifndef __NET_H
34 | #define __NET_H
35 |
36 | #include "hiredis.h"
37 |
38 | #if defined(__sun) || defined(_AIX)
39 | #define AF_LOCAL AF_UNIX
40 | #endif
41 |
42 | int redisCheckSocketError(redisContext *c);
43 | int redisContextSetTimeout(redisContext *c, const struct timeval tv);
44 | int redisContextConnectTcp(redisContext *c, const char *addr, int port, const struct timeval *timeout);
45 | int redisContextConnectBindTcp(redisContext *c, const char *addr, int port,
46 | const struct timeval *timeout,
47 | const char *source_addr);
48 | int redisContextConnectUnix(redisContext *c, const char *path, const struct timeval *timeout);
49 | int redisKeepAlive(redisContext *c, int interval);
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/sdsalloc.h:
--------------------------------------------------------------------------------
1 | /* SDSLib 2.0 -- A C dynamic strings library
2 | *
3 | * Copyright (c) 2006-2015, Salvatore Sanfilippo
4 | * Copyright (c) 2015, Redis Labs, Inc
5 | * All rights reserved.
6 | *
7 | * Redistribution and use in source and binary forms, with or without
8 | * modification, are permitted provided that the following conditions are met:
9 | *
10 | * * Redistributions of source code must retain the above copyright notice,
11 | * this list of conditions and the following disclaimer.
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | * * Neither the name of Redis nor the names of its contributors may be used
16 | * to endorse or promote products derived from this software without
17 | * specific prior written permission.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | * POSSIBILITY OF SUCH DAMAGE.
30 | */
31 |
32 | /* SDS allocator selection.
33 | *
34 | * This file is used in order to change the SDS allocator at compile time.
35 | * Just define the following defines to what you want to use. Also add
36 | * the include of your alternate allocator if needed (not needed in order
37 | * to use the default libc allocator). */
38 |
39 | #include "zmalloc.h"
40 | #define s_malloc zmalloc
41 | #define s_realloc zrealloc
42 | #define s_free zfree
43 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/.gitignore:
--------------------------------------------------------------------------------
1 | *.gcda
2 | *.gcno
3 | *.gcov
4 | redis.info
5 | lcov-html
6 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/Win32_Interop/EventLog.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 | // Values are 32 bit values laid out as follows:
4 | //
5 | // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
6 | // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
7 | // +---+-+-+-----------------------+-------------------------------+
8 | // |Sev|C|R| Facility | Code |
9 | // +---+-+-+-----------------------+-------------------------------+
10 | //
11 | // where
12 | //
13 | // Sev - is the severity code
14 | //
15 | // 00 - Success
16 | // 01 - Informational
17 | // 10 - Warning
18 | // 11 - Error
19 | //
20 | // C - is the Customer code flag
21 | //
22 | // R - is a reserved bit
23 | //
24 | // Facility - is the facility code
25 | //
26 | // Code - is the facility's status code
27 | //
28 | //
29 | // Define the facility codes
30 | //
31 |
32 |
33 | //
34 | // Define the severity codes
35 | //
36 |
37 |
38 | //
39 | // MessageId: MSG_INFO_1
40 | //
41 | // MessageText:
42 | //
43 | // %1
44 | //
45 | #define MSG_INFO_1 0x60000000L
46 |
47 | //
48 | // MessageId: MSG_WARNING_1
49 | //
50 | // MessageText:
51 | //
52 | // %1
53 | //
54 | #define MSG_WARNING_1 0xA0000001L
55 |
56 | //
57 | // MessageId: MSG_ERROR_1
58 | //
59 | // MessageText:
60 | //
61 | // %1
62 | //
63 | #define MSG_ERROR_1 0xE0000002L
64 |
65 | //
66 | // MessageId: MSG_SUCCESS_1
67 | //
68 | // MessageText:
69 | //
70 | // %1
71 | //
72 | #define MSG_SUCCESS_1 0x20000003L
73 |
74 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/Win32_Interop/EventLog.mc:
--------------------------------------------------------------------------------
1 | ;#pragma once
2 |
3 | LanguageNames=(EnglishUS=0x409:MSG00409)
4 |
5 | MessageId=0x0
6 | SymbolicName=MSG_INFO_1
7 | Severity=Informational
8 | Facility=Application
9 | Language=EnglishUS
10 | %1
11 | .
12 |
13 | MessageId=0x1
14 | SymbolicName=MSG_WARNING_1
15 | Severity=Warning
16 | Facility=Application
17 | Language=EnglishUS
18 | %1
19 | .
20 |
21 | MessageId=0x2
22 | SymbolicName=MSG_ERROR_1
23 | Severity=Error
24 | Facility=Application
25 | Language=EnglishUS
26 | %1
27 | .
28 |
29 | MessageId=0x3
30 | SymbolicName=MSG_SUCCESS_1
31 | Severity=Success
32 | Facility=Application
33 | Language=EnglishUS
34 | %1
35 | .
36 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_ANSI.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c), Microsoft Open Technologies, Inc.
3 | * All rights reserved.
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * - Redistributions of source code must retain the above copyright notice,
7 | * this list of conditions and the following disclaimer.
8 | * - Redistributions in binary form must reproduce the above copyright notice,
9 | * this list of conditions and the following disclaimer in the documentation
10 | * and/or other materials provided with the distribution.
11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 | */
22 |
23 |
24 | #ifndef WIN32_INTEROPA_ANSI_H
25 | #define WIN32_INTEROPA_ANSI_H
26 |
27 | #include
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 | BOOL ParseAndPrintANSIString(HANDLE hDev, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten);
34 | void ANSI_printf(char *format, ...);
35 |
36 | // include this file after stdio.h in order to redirect printf to the one that supports ANSI escape sequences
37 | #define printf ANSI_printf
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_APIs.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c), Microsoft Open Technologies, Inc.
3 | * All rights reserved.
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * - Redistributions of source code must retain the above copyright notice,
7 | * this list of conditions and the following disclaimer.
8 | * - Redistributions in binary form must reproduce the above copyright notice,
9 | * this list of conditions and the following disclaimer in the documentation
10 | * and/or other materials provided with the distribution.
11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 | */
22 |
23 | #include "Win32_APIs.h"
24 | #include
25 |
26 | /* Replace MS C rtl rand which is 15bit with 32 bit */
27 | int replace_random() {
28 | unsigned int x = 0;
29 | if (RtlGenRandom == NULL) {
30 | // Load proc if not loaded
31 | HMODULE lib = LoadLibraryA("advapi32.dll");
32 | RtlGenRandom = (RtlGenRandomFunc) GetProcAddress(lib, "SystemFunction036");
33 | if (RtlGenRandom == NULL) return 1;
34 | }
35 | RtlGenRandom(&x, sizeof(unsigned int));
36 | return (int) (x >> 1);
37 | }
38 |
39 | /* Rename which works on Windows when file exists */
40 | int replace_rename(const char *src, const char *dst) {
41 | int retries = 50;
42 | while (1) {
43 | if (MoveFileExA(src, dst, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH)) {
44 | return 0;
45 | } else {
46 | errno = GetLastError();
47 | // Anti-virus may lock file - error code 5.
48 | if (errno != 5) {
49 | break;
50 | }
51 | retries--;
52 | if (retries == 0) {
53 | break;
54 | }
55 | Sleep(10);
56 | }
57 | }
58 | // On error we will return generic error code without GetLastError()
59 | return -1;
60 | }
61 |
62 | int truncate(const char *path, PORT_LONGLONG length) {
63 | LARGE_INTEGER newSize;
64 | HANDLE toTruncate = CreateFileA(path,
65 | GENERIC_READ | GENERIC_WRITE,
66 | FILE_SHARE_WRITE | FILE_SHARE_READ,
67 | NULL,
68 | OPEN_EXISTING,
69 | 0,
70 | NULL);
71 | if (toTruncate != INVALID_HANDLE_VALUE) {
72 | int result = 0;
73 | newSize.QuadPart = length;
74 | if (FALSE == (SetFilePointerEx(toTruncate, newSize, NULL, FILE_BEGIN)
75 | && SetEndOfFile(toTruncate))) {
76 | errno = ENOENT;
77 | result = -1;
78 | }
79 | CloseHandle(toTruncate);
80 | return result;
81 | } else {
82 | errno = ENOENT;
83 | return -1;
84 | }
85 | }
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_APIs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c), Microsoft Open Technologies, Inc.
3 | * All rights reserved.
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * - Redistributions of source code must retain the above copyright notice,
7 | * this list of conditions and the following disclaimer.
8 | * - Redistributions in binary form must reproduce the above copyright notice,
9 | * this list of conditions and the following disclaimer in the documentation
10 | * and/or other materials provided with the distribution.
11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 | */
22 |
23 | #ifndef WIN32_INTEROP_APIS_H
24 | #define WIN32_INTEROP_APIS_H
25 |
26 | #include "Win32_types.h"
27 | #include
28 | #include // for rename
29 |
30 | // API replacement for non-fd stdio functions
31 | #define fseeko _fseeki64
32 | #define ftello _ftelli64
33 | #define snprintf _snprintf
34 | #define strcasecmp _stricmp
35 | #define strtoll _strtoi64
36 |
37 | #ifdef _WIN64
38 | #define strtol _strtoi64
39 | #define strtoul _strtoui64
40 | #endif
41 |
42 | #define sleep(x) Sleep((x)*1000)
43 | /* Redis calls usleep(1) to give thread some time.
44 | * Sleep(0) should do the same on Windows.
45 | * In other cases, usleep is called with millisec resolution
46 | * which can be directly translated to WinAPI Sleep() */
47 | #undef usleep
48 | #define usleep(x) (x == 1) ? Sleep(0) : Sleep((int)((x)/1000))
49 |
50 |
51 | /* following defined to choose little endian byte order */
52 | #define __i386__ 1
53 | #if !defined(va_copy)
54 | #define va_copy(d,s) d = (s)
55 | #endif
56 |
57 | #ifndef __RTL_GENRANDOM
58 | #define __RTL_GENRANDOM 1
59 | typedef BOOLEAN(_stdcall* RtlGenRandomFunc)(void * RandomBuffer, ULONG RandomBufferLength);
60 | #endif
61 | RtlGenRandomFunc RtlGenRandom;
62 |
63 | #define random() replace_random()
64 | #define rand() replace_random()
65 | #define srandom srand
66 | int replace_random();
67 |
68 | #define rename(a,b) replace_rename(a,b)
69 | int replace_rename(const char *src, const char *dest);
70 |
71 | int truncate(const char *path, PORT_LONGLONG length);
72 |
73 | #define lseek lseek64
74 |
75 | #endif
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Assert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c), Microsoft Open Technologies, Inc.
3 | * All rights reserved.
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * - Redistributions of source code must retain the above copyright notice,
7 | * this list of conditions and the following disclaimer.
8 | * - Redistributions in binary form must reproduce the above copyright notice,
9 | * this list of conditions and the following disclaimer in the documentation
10 | * and/or other materials provided with the distribution.
11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 | */
22 |
23 | #ifndef WIN32_INTEROP_ASSERT_H
24 | #define WIN32_INTEROP_ASSERT_H
25 |
26 | #ifdef _DEBUG
27 | #define ASSERT(condition) do { if(!(condition)){ fprintf(stderr, "Assertion failed: %s @ %s::%s (%d)\n", #condition , __FILE__, __FUNCTION__, __LINE__); DebugBreak();} } while(0)
28 | #else
29 | #define ASSERT(condition)
30 | #endif
31 |
32 | #endif
--------------------------------------------------------------------------------
/mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_CommandLine.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c), Microsoft Open Technologies, Inc.
3 | * All rights reserved.
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * - Redistributions of source code must retain the above copyright notice,
7 | * this list of conditions and the following disclaimer.
8 | * - Redistributions in binary form must reproduce the above copyright notice,
9 | * this list of conditions and the following disclaimer in the documentation
10 | * and/or other materials provided with the distribution.
11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 | */
22 |
23 | #ifndef WIN32_INTEROPA_COMMANDLINE_H
24 | #define WIN32_INTEROPA_COMMANDLINE_H
25 |
26 | #include