117 Commits

Author SHA1 Message Date
lnk
44852a0846 fix mq log control 2025-12-15 10:55:58 +08:00
lnk
50f82af3f3 add mq log control 2025-12-15 10:29:46 +08:00
lnk
2c48d7ae0a fix data race 2025-12-11 15:07:54 +08:00
lnk
7dbd4593fa remove useless code 2025-12-11 09:26:08 +08:00
lnk
e615188bb1 fix memleak 2025-12-09 16:29:55 +08:00
lnk
b4ce0fa5f9 Merge branch '测试2' of http://192.168.1.22:3000/zhangwen/front_linux into 测试2 2025-12-08 15:34:53 +08:00
lnk
56382e9ccd modify threads 2025-12-08 15:34:46 +08:00
0c239be9a7 正负零分量调整 2025-12-08 15:21:15 +08:00
b08c632de4 Merge branch '测试2' of http://192.168.1.22:3000/zhangwen/front_linux into 测试2 2025-12-02 10:53:52 +08:00
a1d8a55357 统计数据转换结构调整 2025-12-02 10:52:06 +08:00
lnk
93143fcba6 modify recall 2025-11-05 15:24:59 +08:00
lnk
02d2b021cd fix recall 2025-11-04 15:42:40 +08:00
lnk
beedb9aeca modify timeout 2025-11-04 10:00:29 +08:00
lnk
ba142d3fd3 fix single recall wave 2025-11-03 15:39:29 +08:00
lnk
c02f0cbbdd fix recall 2025-10-31 10:59:30 +08:00
lnk
5e63adc8f9 fix recall 2025-10-30 20:57:19 +08:00
lnk
06a2f3a75b fix wave 2025-10-28 20:59:05 +08:00
lnk
f69a6d2105 fix recall 2025-10-24 17:07:51 +08:00
lnk
07ac84d612 Merge branch '测试2' of http://192.168.1.22:3000/zhangwen/front_linux into 测试2 2025-10-24 08:51:01 +08:00
lnk
fdd6a30fe2 modify recall 2025-10-24 08:50:54 +08:00
5ebb179c44 Merge branch '测试2' of http://192.168.1.22:3000/zhangwen/front_linux into 测试2 2025-10-24 08:46:29 +08:00
fdbefa50ac 取消了测试告警的代码 2025-10-24 08:46:24 +08:00
lnk
a755c6faab recall modify 2025-10-22 15:57:50 +08:00
c7e7cd9078 Merge branch '测试2' of http://192.168.1.22:3000/zhangwen/front_linux into 测试2 2025-10-16 15:04:28 +08:00
ff67e5320f 调整了设备移除函数,现在不会异常崩溃了 2025-10-16 15:04:22 +08:00
lnk
c55f2ab1af modify recall 2025-10-15 16:29:54 +08:00
24e1bf0125 Merge branch '测试2' of http://192.168.1.22:3000/zhangwen/front_linux into 测试2 2025-10-15 13:36:36 +08:00
8fb922e8c6 调整了设备的移除机制 2025-10-15 13:36:31 +08:00
lnk
4e15ffff06 fix ledger update 2025-10-14 10:46:30 +08:00
lnk
fbbb96a64a fix ledger update 2025-10-11 15:57:22 +08:00
lnk
987dba34dc finish git rebase 2025-10-11 10:31:39 +08:00
lnk
a43afb15c5 fix bash 2025-10-11 10:26:23 +08:00
lnk
c494225b38 fix some error and add some fun 2025-10-11 10:26:23 +08:00
lnk
35231baae7 modify ledger update and rtdata 2025-10-11 10:26:22 +08:00
lnk
caf3c308c1 add ledger update 2025-10-11 10:26:22 +08:00
lnk
5616d9096a add rtdata idx 2025-10-11 10:26:22 +08:00
lnk
a6127f0d28 add rtdata idx 2025-10-11 10:26:18 +08:00
lnk
4fe8aee149 modify logs 2025-10-11 10:23:18 +08:00
lnk
e997c88d82 fix deadlock 2025-10-11 10:19:04 +08:00
zw
b976795573 完成实时数据拆分 2025-09-30 08:40:18 +08:00
zw
1b00804522 添加了装置告警 2025-09-23 14:03:11 +08:00
lnk
0f16968452 fix file upload 2025-09-23 10:19:53 +08:00
lnk
db8aa8c07d fix qvvr 2025-09-22 16:46:33 +08:00
lnk
169aa9b34a add tag and key 2025-09-22 13:26:52 +08:00
lnk
825315440d fix qvvr 2025-09-16 16:42:15 +08:00
lnk
016caeb07c use tag 2025-09-16 11:15:04 +08:00
zw
7183cc1673 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-09-16 11:11:49 +08:00
zw
cc5d5e2f81 调整了实时上送个数 2025-09-16 11:11:40 +08:00
lnk
0638b1dbf8 add comments 2025-09-16 11:07:10 +08:00
lnk
6056ea167a add 2025-09-16 10:13:58 +08:00
zw
729a6b8fda 暂降新增终止符识别 2025-09-16 10:10:32 +08:00
zw
c301de5aab 同步 2025-09-16 08:41:46 +08:00
zw
03a1ae4583 回调了数据默认值配置 2025-09-16 08:40:35 +08:00
lnk
f27d208959 add recall reply 2025-09-15 16:36:21 +08:00
zw
a298ff847a 调整了不存在时标的占位 -9999.0f 2025-09-15 14:00:35 +08:00
lnk
e434f66986 finish file recall 2025-09-12 17:08:25 +08:00
zw
58ffb3a6aa 处理线程添加了错误通知 2025-09-11 15:25:57 +08:00
lnk
5d20597993 fix event fun 2025-09-10 17:09:12 +08:00
lnk
124df41911 add event fun 2025-09-10 16:59:50 +08:00
zw
2ef5b69dd8 新增了补招暂态波形文件和补招稳态数据功能码 2025-09-10 13:45:47 +08:00
zw
8dd6b1f0ea 添加了状态翻转和设备在线函数 2025-09-09 13:55:29 +08:00
lnk
d526ffe415 add connect interface and log4 with code 2025-09-08 16:06:53 +08:00
zw
374dd3e7b0 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-09-08 14:37:43 +08:00
zw
1e2dcf76a0 新增暂态事件补招功能 2025-09-08 14:37:39 +08:00
lnk
9dc138a617 finish dz function 2025-09-05 16:28:26 +08:00
lnk
869189d18e add function 2025-09-04 20:59:17 +08:00
zw
722512fad6 修改了装置重连相关代码,调整了状态翻转通知方法。增加了30分钟定时对时功能。 2025-09-04 15:37:26 +08:00
zw
bf805e1238 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-09-03 08:49:45 +08:00
zw
f4c74c7d67 装置运行信息报文与装置版本配置信息报文读取 2025-09-03 08:49:38 +08:00
zw
24fc98407f 装置运行信息报文与装置版本配置信息报文读取 2025-09-03 08:48:49 +08:00
lnk
0af8d02bb2 add function 2025-09-02 14:58:19 +08:00
lnk
077c3f45a2 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-08-11 08:53:35 +08:00
lnk
13e0bc18b3 add cloud mq 2025-08-08 16:35:36 +08:00
zw
e0b2c6d356 合并 2025-08-08 16:26:01 +08:00
zw
f310cb49a3 台账修改 2025-08-08 16:24:17 +08:00
lnk
16ccb567d0 runing with ledger interface 2025-08-08 11:16:38 +08:00
lnk
83986c35cb add qvvr interface 2025-08-07 18:59:11 +08:00
lnk
ee6d9c2689 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-08-05 20:00:28 +08:00
lnk
afc079465e add qvvr interface 2025-08-05 20:00:20 +08:00
zw
81667f3b0d Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-08-05 15:41:18 +08:00
zw
5539c10c0d 定值与内部定值修改完毕 2025-08-05 15:41:04 +08:00
lnk
0eab1e6fb5 add comments 2025-08-04 13:28:51 +08:00
lnk
868de7a909 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-07-31 13:40:26 +08:00
lnk
78938827f7 添加文件路径接口函数和文件下载接口函数 2025-07-31 13:38:55 +08:00
zw
cc9d651b5a 添加了文件管理:文件目录读取,文件下载功能 2025-07-30 13:52:52 +08:00
zw
fff1312c6e 调整了实时的转换方式,添加了不同接线方式的转换 2025-07-25 10:50:49 +08:00
zw
95cd3049a7 合并 2025-07-25 10:49:34 +08:00
zw
900569e5de 调整了实时数据与统计数据的转换方式。更新了暂态事件与波形的处理 2025-07-25 10:47:50 +08:00
lnk
8e4e45ce31 use set_real_state_count 2025-07-14 13:27:38 +08:00
lnk
3fb8ac84f5 rtdata use mq interface 2025-07-11 14:12:47 +08:00
zw
b1963098eb 完成了实时数据的接收和组装字节流 2025-07-10 10:32:29 +08:00
zw
7cfcdd0c5a Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-07-09 10:03:44 +08:00
zw
3ae8ba5900 添加了实时数据的报文组装 2025-07-09 10:03:37 +08:00
lnk
9ebcd5d443 use interface send statistic data to mq 2025-07-09 09:39:29 +08:00
zw
af85c24870 修复 2025-07-04 13:56:09 +08:00
zw
3c3c71a561 修复 2025-07-04 13:54:39 +08:00
zw
21f94e01f0 修复 2025-07-04 13:53:25 +08:00
zw
fa2e02c705 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-07-04 13:38:44 +08:00
zw
0f8305facf 完成了各类组件的集成 2025-07-04 13:38:35 +08:00
lnk
3172faf88e Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-07-04 09:51:24 +08:00
lnk
2ae87cb022 fix bash in process control 2025-07-04 09:50:59 +08:00
zw
408d2a8c9b Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-07-03 11:13:33 +08:00
zw
50b21bcd3e 修改了socket通讯框架,添加了统计数据时间获取,统计数据数据读取 2025-07-03 11:13:16 +08:00
lnk
cc909101df multi front process 2025-06-27 16:33:41 +08:00
lnk
747d6c757c generate ledger to main thread 2025-06-26 16:44:21 +08:00
lnk
4e6ba12b25 modify ledger 2025-06-26 14:39:34 +08:00
lnk
3dc54a9b75 fix segfault 2025-06-25 13:37:17 +08:00
zw
7fdc689f4e 导入了mq运行环境 2025-06-25 13:37:01 +08:00
zw
6dda40f8a0 Merge branch '测试2' of http://192.168.1.22:3000/zw/Linux_Front1056 into 测试2 2025-06-25 10:54:25 +08:00
zw
3b4a4704db 添加了socket数据处理,处理粘包和分包的问题 2025-06-25 10:54:09 +08:00
lnk
969f794919 fix build 2025-06-25 10:48:50 +08:00
lnk
ec8689c9f5 add front thread 2025-06-25 10:28:14 +08:00
lnk
e14e3f9678 add front demo in this project 2025-06-25 10:14:22 +08:00
lnk
768eebbc2b fix compile problem in otherplace 2025-06-25 10:05:07 +08:00
zw
ccd7a3bb59 新增了装置通讯管理,现在可以在外部动态的添加和删除连接设备了,同时添加了设备的消息发送功能。 2025-06-24 18:40:10 +08:00
zw
1fd504add4 添加了多装置测试 2025-06-24 14:50:50 +08:00
zw
e8201af982 调整了通讯结构,新增了装置台账结构 2025-06-24 10:33:31 +08:00
320 changed files with 79042 additions and 266 deletions

18
.vscode/c_cpp_properties.json vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "C:/Users/lnk/Downloads/mingw32/bin/gcc.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

24
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "d:/canneng/云前置移植项目/zw/Linux_Front1056/LFtid1056",
"program": "d:/canneng/云前置移植项目/zw/Linux_Front1056/LFtid1056/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

134
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,134 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false,
"files.associations": {
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"format": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"semaphore": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"text_encoding": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"unordered_set": "cpp"
},
"cmake.sourceDirectory": "D:/canneng/云前置移植项目/zw/Linux_Front1056/LFtid1056/lib/libuv-v1.51.0"
}

BIN
LFtid1056.rar Normal file

Binary file not shown.

60
LFtid1056/LFtid1056.rc Normal file
View File

@@ -0,0 +1,60 @@
// Microsoft Visual C++ <20><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Դ<EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// <20><> TEXTINCLUDE 2 <20><>Դ<EFBFBD><D4B4><EFBFBD>ɡ<EFBFBD>
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>й<EFBFBD>) <20><>Դ
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 4, 2
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>й<EFBFBD>) <20><>Դ
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// <20><> TEXTINCLUDE 3 <20><>Դ<EFBFBD><D4B4><EFBFBD>ɡ<EFBFBD>
//
/////////////////////////////////////////////////////////////////////////////
#endif // <20><><EFBFBD><EFBFBD> APSTUDIO_INVOKED

View File

@@ -77,23 +77,244 @@
<PropertyGroup Label="UserMacros" />
<ItemGroup>
<ClCompile Include="client2.cpp" />
<ClCompile Include="cloudfront\code\cfg_parser.cpp" />
<ClCompile Include="cloudfront\code\interface.cpp" />
<ClCompile Include="cloudfront\code\log4.cpp" />
<ClCompile Include="cloudfront\code\main.cpp" />
<ClCompile Include="cloudfront\code\rocketmq.cpp" />
<ClCompile Include="cloudfront\code\tinyxml2.cpp" />
<ClCompile Include="cloudfront\code\worker.cpp" />
<ClCompile Include="dealMsg.cpp" />
<ClCompile Include="main_thread.cpp" />
<ClCompile Include="PQSMsg.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="client2.h" />
<ClInclude Include="cloudfront\code\curl\curl.h" />
<ClInclude Include="cloudfront\code\curl\curlver.h" />
<ClInclude Include="cloudfront\code\curl\easy.h" />
<ClInclude Include="cloudfront\code\curl\header.h" />
<ClInclude Include="cloudfront\code\curl\mprintf.h" />
<ClInclude Include="cloudfront\code\curl\multi.h" />
<ClInclude Include="cloudfront\code\curl\options.h" />
<ClInclude Include="cloudfront\code\curl\stdcheaders.h" />
<ClInclude Include="cloudfront\code\curl\system.h" />
<ClInclude Include="cloudfront\code\curl\typecheck-gcc.h" />
<ClInclude Include="cloudfront\code\curl\urlapi.h" />
<ClInclude Include="cloudfront\code\curl\websockets.h" />
<ClInclude Include="cloudfront\code\front.h" />
<ClInclude Include="cloudfront\code\interface.h" />
<ClInclude Include="cloudfront\code\log4.h" />
<ClInclude Include="cloudfront\code\log4cplus\appender.h" />
<ClInclude Include="cloudfront\code\log4cplus\asyncappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\boost\deviceappender.hxx" />
<ClInclude Include="cloudfront\code\log4cplus\callbackappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\clfsappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\clogger.h" />
<ClInclude Include="cloudfront\code\log4cplus\config.h" />
<ClInclude Include="cloudfront\code\log4cplus\config.hxx" />
<ClInclude Include="cloudfront\code\log4cplus\configurator.h" />
<ClInclude Include="cloudfront\code\log4cplus\config\defines.hxx" />
<ClInclude Include="cloudfront\code\log4cplus\config\macosx.h" />
<ClInclude Include="cloudfront\code\log4cplus\config\win32.h" />
<ClInclude Include="cloudfront\code\log4cplus\config\windowsh-inc-full.h" />
<ClInclude Include="cloudfront\code\log4cplus\config\windowsh-inc.h" />
<ClInclude Include="cloudfront\code\log4cplus\consoleappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\exception.h" />
<ClInclude Include="cloudfront\code\log4cplus\fileappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\fstreams.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\appenderattachableimpl.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\connectorthread.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\eventcounter.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\fileinfo.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\lockfile.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\loglog.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\pointer.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\property.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\queue.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\snprintf.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\socket.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\socketbuffer.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\stringhelper.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\thread-config.h" />
<ClInclude Include="cloudfront\code\log4cplus\helpers\timehelper.h" />
<ClInclude Include="cloudfront\code\log4cplus\hierarchy.h" />
<ClInclude Include="cloudfront\code\log4cplus\hierarchylocker.h" />
<ClInclude Include="cloudfront\code\log4cplus\initializer.h" />
<ClInclude Include="cloudfront\code\log4cplus\internal\customloglevelmanager.h" />
<ClInclude Include="cloudfront\code\log4cplus\internal\cygwin-win32.h" />
<ClInclude Include="cloudfront\code\log4cplus\internal\env.h" />
<ClInclude Include="cloudfront\code\log4cplus\internal\internal.h" />
<ClInclude Include="cloudfront\code\log4cplus\internal\socket.h" />
<ClInclude Include="cloudfront\code\log4cplus\layout.h" />
<ClInclude Include="cloudfront\code\log4cplus\log4cplus.h" />
<ClInclude Include="cloudfront\code\log4cplus\log4judpappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\logger.h" />
<ClInclude Include="cloudfront\code\log4cplus\loggingmacros.h" />
<ClInclude Include="cloudfront\code\log4cplus\loglevel.h" />
<ClInclude Include="cloudfront\code\log4cplus\mdc.h" />
<ClInclude Include="cloudfront\code\log4cplus\msttsappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\ndc.h" />
<ClInclude Include="cloudfront\code\log4cplus\nteventlogappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\nullappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\qt4debugappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\qt5debugappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\socketappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\appenderattachable.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\factory.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\filter.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\loggerfactory.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\loggerimpl.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\loggingevent.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\objectregistry.h" />
<ClInclude Include="cloudfront\code\log4cplus\spi\rootlogger.h" />
<ClInclude Include="cloudfront\code\log4cplus\streams.h" />
<ClInclude Include="cloudfront\code\log4cplus\syslogappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\tchar.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\syncprims-cxx11.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\syncprims-impl.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\syncprims-pmsm.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\threads-impl.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\tls.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\syncprims-pub-impl.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\syncprims.h" />
<ClInclude Include="cloudfront\code\log4cplus\thread\threads.h" />
<ClInclude Include="cloudfront\code\log4cplus\tracelogger.h" />
<ClInclude Include="cloudfront\code\log4cplus\tstring.h" />
<ClInclude Include="cloudfront\code\log4cplus\version.h" />
<ClInclude Include="cloudfront\code\log4cplus\win32consoleappender.h" />
<ClInclude Include="cloudfront\code\log4cplus\win32debugappender.h" />
<ClInclude Include="cloudfront\code\nlohmann\adl_serializer.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\byte_container_with_subtype.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\abi_macros.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\conversions\from_json.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\conversions\to_chars.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\conversions\to_json.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\exceptions.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\hash.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\input\binary_reader.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\input\input_adapters.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\input\json_sax.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\input\lexer.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\input\parser.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\input\position_t.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\internal_iterator.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\iteration_proxy.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\iterator_traits.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\iter_impl.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\json_reverse_iterator.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\primitive_iterator.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\json_custom_base_class.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\json_pointer.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\json_ref.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\macro_scope.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\macro_unscope.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\call_std\begin.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\call_std\end.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\cpp_future.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\detected.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\identity_tag.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\is_sax.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\std_fs.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\type_traits.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\void_t.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\output\binary_writer.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\output\output_adapters.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\output\serializer.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\string_concat.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\string_escape.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\detail\value_t.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\json.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\json_fwd.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\ordered_map.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\thirdparty\hedley\hedley.hpp" />
<ClInclude Include="cloudfront\code\nlohmann\thirdparty\hedley\hedley_undef.hpp" />
<ClInclude Include="cloudfront\code\rocketmq.h" />
<ClInclude Include="cloudfront\code\rocketmq\Arg_helper.h" />
<ClInclude Include="cloudfront\code\rocketmq\AsyncCallback.h" />
<ClInclude Include="cloudfront\code\rocketmq\CBatchMessage.h" />
<ClInclude Include="cloudfront\code\rocketmq\CCommon.h" />
<ClInclude Include="cloudfront\code\rocketmq\CErrorMessage.h" />
<ClInclude Include="cloudfront\code\rocketmq\CMessage.h" />
<ClInclude Include="cloudfront\code\rocketmq\CMessageExt.h" />
<ClInclude Include="cloudfront\code\rocketmq\CMessageQueue.h" />
<ClInclude Include="cloudfront\code\rocketmq\CMQException.h" />
<ClInclude Include="cloudfront\code\rocketmq\ConsumeType.h" />
<ClInclude Include="cloudfront\code\rocketmq\CProducer.h" />
<ClInclude Include="cloudfront\code\rocketmq\CPullConsumer.h" />
<ClInclude Include="cloudfront\code\rocketmq\CPullResult.h" />
<ClInclude Include="cloudfront\code\rocketmq\CPushConsumer.h" />
<ClInclude Include="cloudfront\code\rocketmq\CSendResult.h" />
<ClInclude Include="cloudfront\code\rocketmq\CTransactionStatus.h" />
<ClInclude Include="cloudfront\code\rocketmq\DefaultMQProducer.h" />
<ClInclude Include="cloudfront\code\rocketmq\DefaultMQPullConsumer.h" />
<ClInclude Include="cloudfront\code\rocketmq\DefaultMQPushConsumer.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQClient.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQClientException.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQMessage.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQMessageExt.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQMessageListener.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQMessageQueue.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQSelector.h" />
<ClInclude Include="cloudfront\code\rocketmq\MQueueListener.h" />
<ClInclude Include="cloudfront\code\rocketmq\PullResult.h" />
<ClInclude Include="cloudfront\code\rocketmq\RocketMQClient.h" />
<ClInclude Include="cloudfront\code\rocketmq\SendResult.h" />
<ClInclude Include="cloudfront\code\rocketmq\SessionCredentials.h" />
<ClInclude Include="cloudfront\code\rocketmq\TransactionListener.h" />
<ClInclude Include="cloudfront\code\rocketmq\TransactionMQProducer.h" />
<ClInclude Include="cloudfront\code\rocketmq\TransactionSendResult.h" />
<ClInclude Include="cloudfront\code\tinyxml2.h" />
<ClInclude Include="cloudfront\code\worker.h" />
<ClInclude Include="dealMsg.h" />
<ClInclude Include="PQSMsg.h" />
</ItemGroup>
<ItemGroup>
<None Include="build.sh" />
<None Include="cloudfront\code\curl\Makefile" />
<None Include="cloudfront\code\curl\Makefile.am" />
<None Include="cloudfront\code\curl\Makefile.in" />
<None Include="cloudfront\code\log4cplus\config.h.cmake.in" />
<None Include="cloudfront\code\log4cplus\config.h.in" />
<None Include="cloudfront\code\log4cplus\config\defines.hxx.in" />
<None Include="cloudfront\code\log4cplus\config\stamp-h2" />
<None Include="cloudfront\code\log4cplus\stamp-h1" />
<None Include="cloudfront\lib\libcrypto.so.1.0.0" />
<None Include="cloudfront\lib\libcrypto.so.1.1" />
<None Include="cloudfront\lib\libcurl.la" />
<None Include="cloudfront\lib\libcurl.so.4" />
<None Include="cloudfront\lib\libcurl.so.4.3.0" />
<None Include="cloudfront\lib\libcurl.so.4.7.0" />
<None Include="cloudfront\lib\liblog4cplus.so.9" />
<None Include="cloudfront\lib\libssl.so.1.0.0" />
<None Include="cloudfront\lib\libssl.so.1.1" />
</ItemGroup>
<ItemGroup>
<Library Include="cloudfront\lib\libcrypto.so" />
<Library Include="cloudfront\lib\libcurl.a" />
<Library Include="cloudfront\lib\libcurl.so" />
<Library Include="cloudfront\lib\liblog4cplus.so" />
<Library Include="cloudfront\lib\liblog4cplusS.a" />
<Library Include="cloudfront\lib\librocketmq.a" />
<Library Include="cloudfront\lib\librocketmq.so" />
<Library Include="cloudfront\lib\libssl.so" />
<Library Include="libuv.a" />
</ItemGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(RemoteRootDir)/cloudfront/code;$(RemoteRootDir)/cloudfront/code/nlohmann;$(RemoteRootDir)/cloudfront/code/curl;$(RemoteRootDir)/cloudfront/code/log4cplus;$(RemoteRootDir)/cloudfront/code/rocketmq;$(RemoteRootDir)/lib/libuv-v1.51.0/include;$(RemoteRootDir);D:\Git代码\frontlinux\LFtid1056\cloudfront\code;D:\Git代码\frontlinux\LFtid1056;D:\Git代码\frontlinux\LFtid1056\lib\libuv-v1.51.0\include;D:\Git代码\frontlinux\LFtid1056\cloudfront\code\curl;D:\Git代码\frontlinux\LFtid1056\cloudfront\code\log4cplus;D:\Git代码\frontlinux\LFtid1056\cloudfront\code\nlohmann;D:\Git代码\frontlinux\LFtid1056\cloudfront\code\rocketmq;./cloudfront/code;./cloudfront/code/nlohmann;./cloudfront/code/curl;./cloudfront/code/log4cplus;./cloudfront/code/rocketmq;./lib/libuv-v1.51.0/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-std=c++11 -O2 -static-libstdc++ -static-libgcc -pthread %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<LibraryDependencies>uv;pthread;%(LibraryDependencies)</LibraryDependencies>
<AdditionalLibraryDirectories>D:\Git代码\frontlinux;D:\Git代码\frontlinux\LFtid1056\cloudfront\lib;$(RemoteRootDir)/cloudfront/lib;$(RemoteRootDir);/usr/lib64;/usr/local/lib;D:\Git代码\frontlinux\LFtid1056;./cloudfront/lib;./usr/lib64;./usr/local/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<LibraryDependencies>uv;pthread;dl;rt;stdc++fs;z;%(LibraryDependencies)</LibraryDependencies>
<AdditionalDependencies>/root/projects/LFtid1056/cloudfront/lib/librocketmq.a;/root/projects/LFtid1056/cloudfront/lib/libcurl.so;/root/projects/LFtid1056/cloudfront/lib/libssl.so;/root/projects/LFtid1056/cloudfront/lib/libcrypto.so;/root/projects/LFtid1056/cloudfront/lib/liblog4cplus.so;/root/projects/LFtid1056/libuv.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>-Wl,-rpath=/root/projects/LFtid1056/cloudfront/lib %(AdditionalOptions)</AdditionalOptions>
</Link>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />

View File

@@ -0,0 +1,718 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="client2.cpp" />
<ClCompile Include="dealMsg.cpp" />
<ClCompile Include="main_thread.cpp" />
<ClCompile Include="PQSMsg.cpp" />
<ClCompile Include="cloudfront\code\main.cpp">
<Filter>cloudfront\code</Filter>
</ClCompile>
<ClCompile Include="cloudfront\code\cfg_parser.cpp">
<Filter>cloudfront\code</Filter>
</ClCompile>
<ClCompile Include="cloudfront\code\interface.cpp">
<Filter>cloudfront\code</Filter>
</ClCompile>
<ClCompile Include="cloudfront\code\log4.cpp">
<Filter>cloudfront\code</Filter>
</ClCompile>
<ClCompile Include="cloudfront\code\rocketmq.cpp">
<Filter>cloudfront\code</Filter>
</ClCompile>
<ClCompile Include="cloudfront\code\tinyxml2.cpp">
<Filter>cloudfront\code</Filter>
</ClCompile>
<ClCompile Include="cloudfront\code\worker.cpp">
<Filter>cloudfront\code</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="client2.h" />
<ClInclude Include="dealMsg.h" />
<ClInclude Include="PQSMsg.h" />
<ClInclude Include="cloudfront\code\interface.h">
<Filter>cloudfront\code</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\json.hpp">
<Filter>cloudfront\code\nlohmann</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\adl_serializer.hpp">
<Filter>cloudfront\code\nlohmann</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\abi_macros.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\conversions\from_json.hpp">
<Filter>cloudfront\code\nlohmann\detail\conversions</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\exceptions.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\value_t.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\macro_scope.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\detected.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\void_t.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\thirdparty\hedley\hedley.hpp">
<Filter>cloudfront\code\nlohmann\thirdparty\hedley</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\string_escape.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\input\position_t.hpp">
<Filter>cloudfront\code\nlohmann\detail\input</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\cpp_future.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\type_traits.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\iterator_traits.hpp">
<Filter>cloudfront\code\nlohmann\detail\iterators</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\call_std\begin.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta\call_std</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\call_std\end.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta\call_std</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\json_fwd.hpp">
<Filter>cloudfront\code\nlohmann</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\string_concat.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\identity_tag.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\std_fs.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\conversions\to_json.hpp">
<Filter>cloudfront\code\nlohmann\detail\conversions</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\iteration_proxy.hpp">
<Filter>cloudfront\code\nlohmann\detail\iterators</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\byte_container_with_subtype.hpp">
<Filter>cloudfront\code\nlohmann</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\hash.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\input\binary_reader.hpp">
<Filter>cloudfront\code\nlohmann\detail\input</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\input\input_adapters.hpp">
<Filter>cloudfront\code\nlohmann\detail\input</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\input\lexer.hpp">
<Filter>cloudfront\code\nlohmann\detail\input</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\input\parser.hpp">
<Filter>cloudfront\code\nlohmann\detail\input</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\input\json_sax.hpp">
<Filter>cloudfront\code\nlohmann\detail\input</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\meta\is_sax.hpp">
<Filter>cloudfront\code\nlohmann\detail\meta</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\internal_iterator.hpp">
<Filter>cloudfront\code\nlohmann\detail\iterators</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\iter_impl.hpp">
<Filter>cloudfront\code\nlohmann\detail\iterators</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\json_reverse_iterator.hpp">
<Filter>cloudfront\code\nlohmann\detail\iterators</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\iterators\primitive_iterator.hpp">
<Filter>cloudfront\code\nlohmann\detail\iterators</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\json_custom_base_class.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\json_pointer.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\json_ref.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\output\binary_writer.hpp">
<Filter>cloudfront\code\nlohmann\detail\output</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\output\output_adapters.hpp">
<Filter>cloudfront\code\nlohmann\detail\output</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\output\serializer.hpp">
<Filter>cloudfront\code\nlohmann\detail\output</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\conversions\to_chars.hpp">
<Filter>cloudfront\code\nlohmann\detail\conversions</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\ordered_map.hpp">
<Filter>cloudfront\code\nlohmann</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\detail\macro_unscope.hpp">
<Filter>cloudfront\code\nlohmann\detail</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\nlohmann\thirdparty\hedley\hedley_undef.hpp">
<Filter>cloudfront\code\nlohmann\thirdparty\hedley</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\logger.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\loggingmacros.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\appender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\worker.h">
<Filter>cloudfront\code</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq.h">
<Filter>cloudfront\code</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\front.h">
<Filter>cloudfront\code</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\curl.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQClientException.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\curlver.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\system.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\easy.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\multi.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\urlapi.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\options.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\header.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\websockets.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\mprintf.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\DefaultMQPushConsumer.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\DefaultMQProducer.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQSelector.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQMessageExt.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQMessageListener.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQMessageQueue.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\SendResult.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\SessionCredentials.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\AsyncCallback.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\ConsumeType.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQClient.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\RocketMQClient.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\PullResult.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQMessage.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4.h">
<Filter>cloudfront\code</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\tinyxml2.h">
<Filter>cloudfront\code</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\stdcheaders.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\curl\typecheck-gcc.h">
<Filter>cloudfront\code\curl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\Arg_helper.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CBatchMessage.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CCommon.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CErrorMessage.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CMessage.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CMessageExt.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CMessageQueue.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CMQException.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CProducer.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CPullConsumer.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CPullResult.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CPushConsumer.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CSendResult.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\CTransactionStatus.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\DefaultMQPullConsumer.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\MQueueListener.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\TransactionListener.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\TransactionMQProducer.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\rocketmq\TransactionSendResult.h">
<Filter>cloudfront\code\rocketmq</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\asyncappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\callbackappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\clfsappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\clogger.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\config.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\config.hxx">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\configurator.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\consoleappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\exception.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\fileappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\fstreams.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\hierarchy.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\hierarchylocker.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\initializer.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\layout.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\log4cplus.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\log4judpappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\loglevel.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\mdc.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\msttsappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\ndc.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\nteventlogappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\nullappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\qt4debugappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\qt5debugappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\socketappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\streams.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\syslogappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\tchar.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\tracelogger.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\tstring.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\version.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\win32consoleappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\win32debugappender.h">
<Filter>cloudfront\code\log4cplus</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\boost\deviceappender.hxx">
<Filter>cloudfront\code\log4cplus\boost</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\config\defines.hxx">
<Filter>cloudfront\code\log4cplus\config</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\config\macosx.h">
<Filter>cloudfront\code\log4cplus\config</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\config\win32.h">
<Filter>cloudfront\code\log4cplus\config</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\config\windowsh-inc.h">
<Filter>cloudfront\code\log4cplus\config</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\config\windowsh-inc-full.h">
<Filter>cloudfront\code\log4cplus\config</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\appenderattachableimpl.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\connectorthread.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\eventcounter.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\fileinfo.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\lockfile.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\loglog.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\pointer.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\property.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\queue.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\snprintf.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\socket.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\socketbuffer.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\stringhelper.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\thread-config.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\helpers\timehelper.h">
<Filter>cloudfront\code\log4cplus\helpers</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\internal\customloglevelmanager.h">
<Filter>cloudfront\code\log4cplus\internal</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\internal\cygwin-win32.h">
<Filter>cloudfront\code\log4cplus\internal</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\internal\env.h">
<Filter>cloudfront\code\log4cplus\internal</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\internal\internal.h">
<Filter>cloudfront\code\log4cplus\internal</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\internal\socket.h">
<Filter>cloudfront\code\log4cplus\internal</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\appenderattachable.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\factory.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\filter.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\loggerfactory.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\loggerimpl.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\loggingevent.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\objectregistry.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\spi\rootlogger.h">
<Filter>cloudfront\code\log4cplus\spi</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\syncprims.h">
<Filter>cloudfront\code\log4cplus\thread</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\syncprims-pub-impl.h">
<Filter>cloudfront\code\log4cplus\thread</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\threads.h">
<Filter>cloudfront\code\log4cplus\thread</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\syncprims-cxx11.h">
<Filter>cloudfront\code\log4cplus\thread\impl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\syncprims-impl.h">
<Filter>cloudfront\code\log4cplus\thread\impl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\syncprims-pmsm.h">
<Filter>cloudfront\code\log4cplus\thread\impl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\threads-impl.h">
<Filter>cloudfront\code\log4cplus\thread\impl</Filter>
</ClInclude>
<ClInclude Include="cloudfront\code\log4cplus\thread\impl\tls.h">
<Filter>cloudfront\code\log4cplus\thread\impl</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="cloudfront">
<UniqueIdentifier>{e569c345-343c-4c70-b52e-1188cb7eb2a0}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code">
<UniqueIdentifier>{3aa4794b-faf1-449a-b331-d701ebafc085}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\curl">
<UniqueIdentifier>{f67e6a10-2961-4892-8537-bd8ab15a5bd3}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus">
<UniqueIdentifier>{9d9e729c-19ee-46f3-97be-d46b4fc4bb9a}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\rocketmq">
<UniqueIdentifier>{17a8acb0-648d-4bb8-82f1-74a3c132e1ef}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann">
<UniqueIdentifier>{b22c4f25-4b96-48dc-bb52-7f642bc742d0}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\detail">
<UniqueIdentifier>{2b9bfc19-7f39-4a2f-80ad-f39e96a96b40}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\thirdparty">
<UniqueIdentifier>{a0f6b856-c407-420c-86ef-4c48a3c4df2e}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\thirdparty\hedley">
<UniqueIdentifier>{0cb06b60-69a9-4dd4-a963-4aedd6b4d7e3}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\detail\conversions">
<UniqueIdentifier>{73b4c759-6aba-40d3-8773-72a196af5a77}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\detail\input">
<UniqueIdentifier>{cb07968a-09c4-45ca-a73c-20d328df3216}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\detail\iterators">
<UniqueIdentifier>{3a75fc98-7cc2-4003-a060-73147b374fed}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\detail\meta">
<UniqueIdentifier>{100fee77-5ece-4d12-b55e-2183e5790d1b}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\detail\meta\call_std">
<UniqueIdentifier>{c10e4535-fe1d-4a33-a38f-29805e4e9b92}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\nlohmann\detail\output">
<UniqueIdentifier>{a147fc02-f373-49a8-a11f-a8914da54a7d}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus\boost">
<UniqueIdentifier>{422223c2-2cfe-4998-b31d-7b59532b6d1f}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus\config">
<UniqueIdentifier>{dc41a517-5a25-4d36-848d-8a21c9e35117}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus\helpers">
<UniqueIdentifier>{f8ee7436-8072-4ba7-b219-3d33e410de0d}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus\internal">
<UniqueIdentifier>{a66dc9bc-1acc-4048-adb2-7326395c7568}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus\spi">
<UniqueIdentifier>{6039e9c3-2685-4a49-a08e-842dfc4d80d1}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus\thread">
<UniqueIdentifier>{2f9e665b-d0f0-4de0-9b4d-23d002ec9990}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\log4cplus\thread\impl">
<UniqueIdentifier>{b40f40d0-492d-4fcf-8125-4db493497930}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\code\lib">
<UniqueIdentifier>{d64ce5f1-cb40-4da4-a7da-766e5a2d1656}</UniqueIdentifier>
</Filter>
<Filter Include="cloudfront\lib">
<UniqueIdentifier>{ca2cfaa3-ac76-42f8-a17f-67b4f693b719}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="cloudfront\code\curl\Makefile">
<Filter>cloudfront\code\curl</Filter>
</None>
<None Include="cloudfront\code\curl\Makefile.am">
<Filter>cloudfront\code\curl</Filter>
</None>
<None Include="cloudfront\code\curl\Makefile.in">
<Filter>cloudfront\code\curl</Filter>
</None>
<None Include="cloudfront\code\log4cplus\config.h.cmake.in">
<Filter>cloudfront\code\log4cplus</Filter>
</None>
<None Include="cloudfront\code\log4cplus\config.h.in">
<Filter>cloudfront\code\log4cplus</Filter>
</None>
<None Include="cloudfront\code\log4cplus\stamp-h1">
<Filter>cloudfront\code\log4cplus</Filter>
</None>
<None Include="cloudfront\code\log4cplus\config\defines.hxx.in">
<Filter>cloudfront\code\log4cplus\config</Filter>
</None>
<None Include="cloudfront\code\log4cplus\config\stamp-h2">
<Filter>cloudfront\code\log4cplus\config</Filter>
</None>
<None Include="build.sh" />
<None Include="cloudfront\lib\libcrypto.so.1.0.0">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\libcrypto.so.1.1">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\libcurl.la">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\libcurl.so.4">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\libcurl.so.4.3.0">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\libcurl.so.4.7.0">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\liblog4cplus.so.9">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\libssl.so.1.0.0">
<Filter>cloudfront\lib</Filter>
</None>
<None Include="cloudfront\lib\libssl.so.1.1">
<Filter>cloudfront\lib</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Library Include="cloudfront\lib\libcrypto.so">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="cloudfront\lib\libcurl.a">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="cloudfront\lib\libcurl.so">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="cloudfront\lib\liblog4cplus.so">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="cloudfront\lib\liblog4cplusS.a">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="cloudfront\lib\librocketmq.a">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="cloudfront\lib\librocketmq.so">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="cloudfront\lib\libssl.so">
<Filter>cloudfront\lib</Filter>
</Library>
<Library Include="libuv.a" />
</ItemGroup>
</Project>

View File

@@ -7,10 +7,89 @@
#include <cctype>
#include <cstdlib>
#include "client2.h"
#include "PQSMsg.h"
#include <iostream>
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
float IntToFloat(int num) {
return static_cast<float>(num) / 65536.0f;
}
float ShorToFloat100(short num) {
return static_cast<float>(num) / 100.0f;
}
float ShorToFloat1000(short num) {
return static_cast<float>(num) / 1000.0f;
}
float ShorToFloat10000(short num) {
return static_cast<float>(num) / 10000.0f;
}
// <20>ֽ<EFBFBD><D6BD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ReversalBuff(uint8_t* buff, int start, int length) {
for (int i = 0; i < length / 2; i++) {
std::swap(buff[start + i], buff[start + length - 1 - i]);
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MAC<41><43>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void GetMAC(const std::string& strMAC, std::vector<unsigned char>& packet, size_t startIndex) {
//lnk20250808
static inline int hex_nibble(char c) {
if (c >= '0' && c <= '9') return c - '0';
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
if (c >= 'a' && c <= 'f') return 10 + (c - 'a');
return -1;
}
// <20><>ȫ<EFBFBD><EFBFBD><E6A3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true/false
bool GetMAC(const std::string& strMAC,
std::vector<unsigned char>& packet,
size_t startIndex,
std::string* err = nullptr) {
// 1) <20><EFBFBD><E6B7B6><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5> '-', ':', ' '
std::string s;
s.reserve(strMAC.size());
for (char c : strMAC) {
if (c == '-' || c == ':' || c == ' ') continue;
s.push_back(c);
}
// 2) <20><><EFBFBD><EFBFBD>У<EFBFBD><D0A3>
if (s.size() != 12) {
if (err) *err = "MAC<EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD><EFBFBD><EFBFBD>Ϊ12<EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>";
return false;
}
// 3) ʮ<><CAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3> + <20><><EFBFBD><EFBFBD>
std::array<unsigned char, 6> mac{};
for (int i = 0; i < 6; ++i) {
int hi = hex_nibble(s[2*i]);
int lo = hex_nibble(s[2*i + 1]);
if (hi < 0 || lo < 0) {
if (err) *err = "MAC<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ַ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-9<><39>A-F)";
return false;
}
mac[i] = static_cast<unsigned char>((hi << 4) | lo);
}
// 4) ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㹻д<E3B9BB><D0B4>64<36>ֽڣ<D6BD>MAC 6<>ֽ<EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
const size_t need = startIndex + 64;
if (packet.size() < need) packet.resize(need, 0);
// 5) д<><D0B4>MAC
for (int i = 0; i < 6; ++i) {
packet[startIndex + i] = mac[i];
}
// 6) <20><><EFBFBD><EFBFBD>λ<EFBFBD>ò<EFBFBD><C3B2><EFBFBD><E3A3A8> resize <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤һ<D6A4>£<EFBFBD>
for (size_t i = 6; i < 64; ++i) {
packet[startIndex + i] = 0;
}
return true;
}
/*void GetMAC(const std::string& strMAC, std::vector<unsigned char>& packet, size_t startIndex) {
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD>пո<D0BF><D5B8>Ͷ̺<CDB6><CCBA><EFBFBD>
std::string cleanedMAC = strMAC;
cleanedMAC.erase(std::remove(cleanedMAC.begin(), cleanedMAC.end(), ' '), cleanedMAC.end());
@@ -48,6 +127,202 @@ void GetMAC(const std::string& strMAC, std::vector<unsigned char>& packet, size_
catch (const std::exception& e) {
throw std::invalid_argument("<22><>Ч<EFBFBD><D0A7>MAC<41><43>ַ: " + std::string(e.what()));
}
}*/
// CRC<52><43><EFBFBD><EFBFBD><E3BAAF>
unsigned char GetCrcSum(const std::vector<unsigned char>& Check, int nOffset, int nLen) {
unsigned char reg_b = 0x00;
for (int i = 0; i < nLen; ++i) {
if (static_cast<size_t>(i + nOffset) >= Check.size()) {
throw std::out_of_range("Index out of range in GetCrcSum");
}
reg_b += Check[i + nOffset];
}
return reg_b;
}
// ʱ<><CAB1>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TagMsTime -> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint64_t convertTagMsTimeToMsTimestamp(const TagMsTime& t) {
struct tm tm_time = {};
tm_time.tm_year = t.Year - 1900;
tm_time.tm_mon = t.Month - 1;
tm_time.tm_mday = t.Day;
tm_time.tm_hour = t.Hour;
tm_time.tm_min = t.Min;
tm_time.tm_sec = t.Sec;
tm_time.tm_isdst = -1; // <20>Զ<EFBFBD><D4B6>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ʱ
// ת<><D7AA>Ϊʱ<CEAA><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
time_t seconds = mktime(&tm_time);
if (seconds == -1) return 0;
// <20><><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD>
return static_cast<uint64_t>(seconds) * 1000 + t.Ms;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>QVVRRecord
QVVRRecord DynamicLog_GetQVVRRecordFromLogBuffer(
const std::string& strScale,
uint32_t nPTType,
float fPT,
const NewTaglogbuffer& log) {
QVVRRecord record;
try {
// ת<><D7AA>ʱ<EFBFBD><CAB1>
record.triggerTimeMs = convertTagMsTimeToMsTimestamp(log.head.Devtime);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
float fParam1 = 0.0f; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
float fParam2 = 0.0f; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
float fParam3 = 0.0f; // <20><><EFBFBD><EFBFBD><EFBFBD>ż<EFBFBD>ֵ
for (const auto& body : log.bodyList) {
switch (body.ParaCode) {
case 0: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
fParam2 = static_cast<float>(body.ParaValue) / 65536.0f;
break;
case 1: // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>(˲̬<CBB2><CCAC><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>)
fParam1 = static_cast<float>(body.ParaValue) / 65536.0f;
break;
case 25: // <20><><EFBFBD><EFBFBD><EFBFBD>ż<EFBFBD>ֵ(˲̬<CBB2><CCAC><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>)
fParam3 = static_cast<float>(body.ParaValue) / 65536.0f;
break;
case 3: //<2F><>ѹ<EFBFBD><D1B9><EFBFBD>ȣ<EFBFBD>˲̬<CBB2><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
record.fMagntitude = (static_cast<float>(body.ParaValue) / 65536.0f) / 100.0f;
break;
case 5: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲̬<CBB2><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
record.phase = static_cast<float>(body.ParaValue) / 65536.0f;
break;
case 6: //˲<><CBB2><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>˲̬<CBB2><CCAC><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>
record.transientValue = (static_cast<float>(body.ParaValue) / 65536.0f) / 100.0f;
break;
default:
break;
}
}
record.fPersisstime = fParam1;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼ֵfBase
float fBase = 0.0f;
if (fParam3 < 50.0f) { // δ<><CEB4><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>ż<EFBFBD>
if (fPT != 1.0f) { // <20><><EFBFBD>Ȳ<EFBFBD>Ϊ1
fBase = (nPTType == 0) ? 57.74f : 100.0f;
}
else {
std::string strTemp = strScale;
std::transform(strTemp.begin(), strTemp.end(), strTemp.begin(), ::tolower);
size_t pos = strTemp.find('k');
if (pos != std::string::npos) {
std::string numPart = strTemp.substr(0, pos);
try {
float fTemp = std::stof(numPart) * 1000.0f;
fBase = (nPTType == 0) ? (fTemp / std::sqrt(3.0f)) : fTemp;
}
catch (...) {
fBase = (nPTType == 0) ? 57.74f : 100.0f;
}
}
else {
fBase = (nPTType == 0) ? 57.74f : 100.0f;
}
}
}
else {
fBase = fParam3; // ʹ<>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>ż<EFBFBD>ֵ
}
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>
switch (log.head.LogCode) {
case 0: case 26: case 40: case 54: case 68: case 82:
record.nType = 3;
break;
case 1: case 27: case 41: case 55: case 69: case 83:
record.nType = 1;
break;
case 13: case 36: case 50: case 64: case 78: case 92:
record.nType = 2;
break;
case 24:
// <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
break;
case 100:
record.nType = 1; // ģ<><C4A3><EFBFBD><EFBFBD>ѹ<EFBFBD>ݽ<EFBFBD>
break;
case 3:
record.nType = 4; // ˲̬<CBB2>¼<EFBFBD>
default:
// δ֪<CEB4><D6AA><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>0
break;
}
// <20><><EFBFBD><EFBFBD><E2B4A6><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>¼<EFBFBD><C2BC>ҷ<EFBFBD>ֵ<EFBFBD>ϴ<EFBFBD>
if (record.nType == 3 && fParam2 > fBase * 0.1f) {
fParam2 /= 100.0f;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
record.fMagntitude = fParam2 / fBase;
}
catch (...) {
// <20>쳣ʱ<ECB3A3><CAB1><EFBFBD>ؿռ<D8BF>¼
record = QVVRRecord{};
}
return record;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>
std::vector<unsigned char> GetMsg(const std::vector<unsigned char>& SrcData, unsigned char nType) {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (SrcData.empty() ||
((nType < 0x01 || nType > 0xA4) && nType != 0xFF)) {
return {};
}
try {
// <20><><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD>ͷ(6) + <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>(2) + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1) + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + CRC+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(2)
const size_t total_len = 6 + 2 + 1 + SrcData.size() + 2;
std::vector<unsigned char> msg(total_len);
// <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ͷ (6<>ֽ<EFBFBD>)
msg[0] = 0xEB; // <20><><EFBFBD><EFBFBD>ͷ
msg[1] = 0x90; // <20><><EFBFBD><EFBFBD>ͷ
msg[2] = 0x00; // <20><><EFBFBD><EFBFBD>
msg[3] = 0x00; // <20><><EFBFBD><EFBFBD>
// <20><><EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B3A4>+<2B><><EFBFBD><EFBFBD><EFBFBD>
uint16_t data_len = static_cast<uint16_t>(SrcData.size() + 1);
msg[4] = static_cast<unsigned char>(data_len >> 8); // <20><><EFBFBD>ȸ<EFBFBD><C8B8>ֽ<EFBFBD>
msg[5] = static_cast<unsigned char>(data_len & 0xFF); // <20><><EFBFBD>ȵ<EFBFBD><C8B5>ֽ<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD> (2<>ֽ<EFBFBD>)
msg[6] = 0x00; // <20><><EFBFBD><EFBFBD>
msg[7] = 0xFF; // <20><><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
msg[8] = nType;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (!SrcData.empty()) {
std::copy(SrcData.begin(), SrcData.end(), msg.begin() + 9);
}
// <20><><EFBFBD><EFBFBD>CRC<52><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><38>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B><><EFBFBD><EFBFBD><EFBFBD>
unsigned char crc = GetCrcSum(msg, 8, 1 + SrcData.size());
msg[msg.size() - 2] = crc;
msg[msg.size() - 1] = 0x16; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return msg;
}
catch (const std::exception& ex) {
throw std::runtime_error(std::string("Exception in GetMsg: ") + ex.what());
}
catch (...) {
throw std::runtime_error("Unknown exception in GetMsg");
}
}
// <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
@@ -74,7 +349,13 @@ std::vector<unsigned char> generate_frontlogin_message(const std::string& strMac
// [16-19] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2 (<28><><EFBFBD><EFBFBD>Ϊ0)
// <20><><EFBFBD><EFBFBD>MAC<41><43>ַ (<28><>λ<EFBFBD><CEBB>20<32><30>ʼ<EFBFBD><CABC>64<36>ֽ<EFBFBD>)
GetMAC(strMac, packet, 20);
//GetMAC(strMac, packet, 20);
//lnk20250808
std::string err;
if (!GetMAC(strMac, packet, 20, &err)) {
std::cerr << "[GetMAC] parse failed: " << err << "\n";
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD>
}
// <20><><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD> (<28><>ƫ<EFBFBD><C6AB>8<EFBFBD><38>137)
unsigned char checksum = 0;
@@ -86,6 +367,402 @@ std::vector<unsigned char> generate_frontlogin_message(const std::string& strMac
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
packet[packetSize - 1] = 0x16;
//lnk20250808
// ======= <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =======
std::cout << "[generate_frontlogin_message] Packet (" << packet.size() << " bytes):\n";
for (size_t i = 0; i < packet.size(); ++i) {
printf("%02X ", packet[i]);
if ((i + 1) % 16 == 0) printf("\n");
}
if (packet.size() % 16 != 0) printf("\n");
return packet;
}
//ѯ<><D1AF>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><E4B1A8>
std::vector<unsigned char> generate_statequerytime_message() {
// <20><><EFBFBD><EFBFBD>2<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0<CEAA><30>
std::vector<unsigned char> DataBuf(2, 0x00);
// <20><><EFBFBD><EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_StatTime));
}
//ѯ<><D1AF>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>
std::vector<unsigned char> generate_statequerystat_message(tagTime time, uint16_t nDeviceNo, uint16_t nDataType) {
// <20><><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>С<EFBFBD><D0A1>3(<28><><EFBFBD><EFBFBD>) + 2(nDeviceNo) + 2(nDataType) + time<6D><EFBFBD><E1B9B9>С
const size_t totalSize = 3 + 2 * sizeof(uint16_t) + time.GetSize();
std::vector<unsigned char> DataBuf(totalSize, 0x00); // <20><>ʼ<EFBFBD><CABC>Ϊȫ0
size_t offset = 0;
// 1. <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ0<CEAA><30>
offset += 3;
// 2. д<><D0B4>nDeviceNo<4E><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
uint16_t netDeviceNo = htons(nDeviceNo);
memcpy(DataBuf.data() + offset, &netDeviceNo, sizeof(uint16_t));
offset += sizeof(uint16_t);
// 3. д<><D0B4>nDataType<70><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
uint16_t netDataType = htons(nDataType);
memcpy(DataBuf.data() + offset, &netDataType, sizeof(uint16_t));
offset += sizeof(uint16_t);
// 4. д<><D0B4>time<6D><EFBFBD><E1B9B9><EFBFBD>ڲ<EFBFBD><DAB2>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
time.GetStructBuf(DataBuf.data(), DataBuf.size(), offset);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Stat));
}
//ѯ<><D1AF>ʵʱ<CAB5><CAB1><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD> <20><><EFBFBD><EFBFBD>1-6 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-11 г<><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-2
std::vector<unsigned char> generate_realstat_message(unsigned char nCpuNo,
unsigned char StaTtype,
unsigned char flag)
{
// <20><><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>С<EFBFBD><D0A1>3(<28><><EFBFBD><EFBFBD>) + 1(nCpuNo) + 1(StaTtype) + 1(<28>̶<EFBFBD>ֵ) + 1(flag)
const size_t totalSize = 7;
std::vector<unsigned char> DataBuf(totalSize, 0x00); // <20><>ʼ<EFBFBD><CABC>Ϊȫ0
size_t offset = 0;
// 1. <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ0<CEAA><30>
offset += 3;
// 2. д<><D0B4>nCpuNo<4E><6F>1<EFBFBD>ֽڣ<D6BD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-6
memcpy(DataBuf.data() + offset, &nCpuNo, sizeof(unsigned char));
offset += sizeof(unsigned char);
// 3. д<><D0B4>StaTtype<70><65>1<EFBFBD>ֽڣ<D6BD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-11 һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-6
memcpy(DataBuf.data() + offset, &StaTtype, sizeof(unsigned char));
offset += sizeof(unsigned char);
// 4. д<><D0B4><EFBFBD>̶<EFBFBD>ֵ1<D6B5><31>1<EFBFBD>ֽڣ<D6BD> 3<><33>ʵʱ<CAB5><CAB1><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD>1 <20><>ʾƽ<CABE><C6BD>ֵ
const unsigned char fixedValue = 1;
memcpy(DataBuf.data() + offset, &fixedValue, sizeof(unsigned char));
offset += sizeof(unsigned char);
// 5. д<><D0B4>flag<61><67>1<EFBFBD>ֽڣ<D6BD> <20><>־λ 0-2 г<><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 25 50 100<30><30>
memcpy(DataBuf.data() + offset, &flag, sizeof(unsigned char));
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_New_3S));
}
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ǰ֡<C7B0><D6A1><EFBFBD><EFBFBD>+<2B>ļ<EFBFBD><C4BC><EFBFBD>
std::vector<unsigned char> generate_downloadfile_message(int frameIndex, const std::string& fileName) {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 3(<28><><EFBFBD><EFBFBD>) + 4(֡<><D6A1><EFBFBD><EFBFBD>) + 128(<28>ļ<EFBFBD><C4BC><EFBFBD>) = 135<33>ֽ<EFBFBD>
std::vector<unsigned char> dataBuf(135, 0x00);
// д<><D0B4>֡<EFBFBD><D6A1><EFBFBD><EFBFBD> (4<>ֽڣ<D6BD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
//uint32_t netFrameIndex = htonl(static_cast<uint32_t>(frameIndex));
//memcpy(dataBuf.data() + 3, &netFrameIndex, sizeof(uint32_t));
// <20>Ƴ<EFBFBD>htonlת<6C><D7AA><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9>ԭʼ֡<CABC><D6A1><EFBFBD><EFBFBD>(С<><D0A1><EFBFBD><EFBFBD>)
uint32_t rawFrameIndex = static_cast<uint32_t>(frameIndex);
memcpy(dataBuf.data() + 3, &rawFrameIndex, sizeof(uint32_t));
// д<><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> (<28><><EFBFBD><EFBFBD>128<32>ֽ<EFBFBD>)
size_t copyLen = std::min(fileName.size(), static_cast<size_t>(128));
if (copyLen > 0) {
memcpy(dataBuf.data() + 7, fileName.c_str(), copyLen);
}
// <20><><EFBFBD><EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_File_Download));
}
//<2F>ļ<EFBFBD>Ŀ¼<C4BF><C2BC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ȡ<EFBFBD><C8A1><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
std::vector<unsigned char> generate_getfilemenu_message(const std::string& filedir) {
// <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD>131<33>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD> (3 + 128)<29><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
std::vector<unsigned char> dataBuf(131, 0x00);
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>3<EFBFBD><33>ʼ<EFBFBD><CABC>
size_t copyLen = std::min(filedir.size(), static_cast<size_t>(128));
if (copyLen > 0) {
memcpy(dataBuf.data() + 3, filedir.c_str(), copyLen);
}
// <20><><EFBFBD><EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_FileDir));
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::vector<unsigned char> generate_requestFixValue_message(unsigned char nCpuNo) {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (nCpuNo < 1 || nCpuNo > 6)
return std::vector<unsigned char>();
// <20><><EFBFBD><EFBFBD>4<EFBFBD>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
std::vector<unsigned char> DataBuf(4, 0x00);
DataBuf[3] = nCpuNo; // CPU<50><55><EFBFBD>ŷ<EFBFBD><C5B7>ڵ<EFBFBD>4<EFBFBD>ֽ<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_FixValue));
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::vector<unsigned char> generate_requestFixDes_message() {
// <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
std::vector<unsigned char> DataBuf(3, 0x00);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_FixDes));
}
// <20><><EFBFBD>ö<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B>޸ĵĶ<C4B5>ֵ<EFBFBD><D6B5><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
std::vector<unsigned char> generate_requestSetFixValue_message(
unsigned char nCpuNo,
const std::vector<float>& value)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (nCpuNo < 1 || nCpuNo > 6)
return std::vector<unsigned char>();
// <20><><EFBFBD><EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 4(ͷ<><CDB7>) + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B3A4>*4
const size_t bufSize = 4 + value.size() * 4;
std::vector<unsigned char> DataBuf(bufSize, 0x00);
DataBuf[3] = nCpuNo; // CPU<50><55><EFBFBD>ŷ<EFBFBD><C5B7>ڵ<EFBFBD>4<EFBFBD>ֽ<EFBFBD>
// <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
for (size_t i = 0; i < value.size(); i++) {
// <20><>floatת<74><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
uint32_t intValue;
memcpy(&intValue, &value[i], sizeof(float));
uint32_t netValue = htonl(intValue);
// <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned char* dest = DataBuf.data() + 4 + i * 4;
memcpy(dest, &netValue, sizeof(uint32_t));
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Set_Fix));
}
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<unsigned char> generate_requestinterfixvalue_message()
{
// <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
std::vector<unsigned char> dataBuf(3, 0x00);
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_InterFix));
}
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
* @param nDesCW <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1-<2D>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>, 2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Чʱ<D0A7><CAB1><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<unsigned char> generate_requestinterfixdes_message(unsigned char nDesCW)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>
if (nDesCW < 1 || nDesCW > 2) {
return std::vector<unsigned char>();
}
// <20><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
std::vector<unsigned char> dataBuf(3, 0x00);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dataBuf[0] = nDesCW;
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_InterFixDes));
}
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
* @param values Ҫ<><D2AA><EFBFBD>õĶ<C3B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> (ushortֵ)
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<unsigned char> generate_requestsetinterfixvalue_message(const std::vector<uint16_t>& values)
{
// <20><><EFBFBD><EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 3<>ֽ<EFBFBD>ͷ<EFBFBD><CDB7> + ÿ<><C3BF>ֵռ2<D5BC>ֽ<EFBFBD>
const size_t bufSize = 3 + values.size() * 2;
std::vector<unsigned char> dataBuf(bufSize, 0x00);
// <20><><EFBFBD>䶨ֵ<E4B6A8><D6B5><EFBFBD><EFBFBD>
for (size_t i = 0; i < values.size(); i++) {
// <20><>ushortֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD> (<28><><EFBFBD><EFBFBD>)
uint16_t netValue = htons(values[i]);
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>λ<EFBFBD><CEBB>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD>ͷ<EFBFBD><CDB7>)
unsigned char* dest = dataBuf.data() + 3 + i * 2;
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
memcpy(dest, &netValue, sizeof(uint16_t));
}
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Set_InterFix));
}
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
* @param values Ҫ<><D2AA><EFBFBD>õĶ<C3B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> (ushortֵ)
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<unsigned char> generate_requestsetinterfixvalue_message_new(const std::vector<uint16_t>& value)
{
// <20><><EFBFBD><EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С: 3<>ֽ<EFBFBD>ͷ<EFBFBD><CDB7> + ÿ<><C3BF>ֵռ2<D5BC>ֽ<EFBFBD>
const size_t bufSize = 3 + value.size() * 2;
std::vector<unsigned char> dataBuf(bufSize, 0x00);
// <20><><EFBFBD>䶨ֵ<E4B6A8><D6B5><EFBFBD><EFBFBD>
for (size_t i = 0; i < value.size(); i++) {
// <20><>ֵת<D6B5><D7AA>Ϊ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
uint16_t rawValue = value[i];
unsigned char* bytes = reinterpret_cast<unsigned char*>(&rawValue);
// <20><>ת<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>C#<23><>ReversalBuff<66><66>
std::swap(bytes[0], bytes[1]);
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>λ<EFBFBD><CEBB>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>3<EFBFBD>ֽ<EFBFBD>ͷ<EFBFBD><CDB7>)
unsigned char* dest = dataBuf.data() + 3 + i * 2;
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
memcpy(dest, bytes, sizeof(uint16_t));
}
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD>
return GetMsg(dataBuf, static_cast<unsigned char>(MsgRequestType::Request_Set_InterFix));
}
/**
* @brief <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ȡָ<C8A1><EFBFBD><EEB1A8>
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<unsigned char> generate_machinestatus_message()
{
// <20><><EFBFBD><EFBFBD>10<31>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
std::vector<unsigned char> DataBuf(10, 0x00);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>ֵΪ1<CEAA><31><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD>ֽڣ<D6BD>
DataBuf[3] = 0x01;
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>14<31><34>Ӧװ<D3A6><D7B0>״̬<D7B4><CCAC>ȡ
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_RunningInformation));
}
/**
* @brief <20><><EFBFBD><EFBFBD>װ<EFBFBD>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ȡָ<C8A1><EFBFBD><EEB1A8>
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<unsigned char> generate_machineversion_message()
{
// <20><><EFBFBD><EFBFBD>10<31>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
std::vector<unsigned char> DataBuf(10, 0x00);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>ֵΪ1<CEAA><31><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD>ֽڣ<D6BD>
DataBuf[3] = 0x02;
// <20><><EFBFBD><EFBFBD>ͨ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>14<31><34>Ӧװ<D3A6><D7B0>״̬<D7B4><CCAC>ȡ
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_RunningInformation));
}
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>ö<EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
* @param time <20>·<EFBFBD><C2B7>Ķ<EFBFBD>ʱʱ<CAB1><CAB1> (tmֵ)
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<uint8_t> generate_righttime_message(const std::tm& time) {
std::vector<uint8_t> DataBuf(15, 0x00); // <20><><EFBFBD><EFBFBD>15<31>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
// ǰ3<C7B0>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ã<EFBFBD><C3A3>ѳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
// ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EBA3A8>ռ2<D5BC>ֽڣ<D6BD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint16_t year = static_cast<uint16_t>(time.tm_year + 1900);
DataBuf[3] = static_cast<uint8_t>((year >> 8) & 0xFF); // <20><><EFBFBD>ֽ<EFBFBD>
DataBuf[4] = static_cast<uint8_t>(year & 0xFF); // <20><><EFBFBD>ֽ<EFBFBD>
uint16_t month = static_cast<uint16_t>(time.tm_mon + 1);
DataBuf[5] = static_cast<uint8_t>((month >> 8) & 0xFF);
DataBuf[6] = static_cast<uint8_t>(month & 0xFF);
uint16_t day = static_cast<uint16_t>(time.tm_mday);
DataBuf[7] = static_cast<uint8_t>((day >> 8) & 0xFF);
DataBuf[8] = static_cast<uint8_t>(day & 0xFF);
uint16_t hour = static_cast<uint16_t>(time.tm_hour);
DataBuf[9] = static_cast<uint8_t>((hour >> 8) & 0xFF);
DataBuf[10] = static_cast<uint8_t>(hour & 0xFF);
uint16_t minute = static_cast<uint16_t>(time.tm_min);
DataBuf[11] = static_cast<uint8_t>((minute >> 8) & 0xFF);
DataBuf[12] = static_cast<uint8_t>(minute & 0xFF);
uint16_t second = static_cast<uint16_t>(time.tm_sec);
DataBuf[13] = static_cast<uint8_t>((second >> 8) & 0xFF);
DataBuf[14] = static_cast<uint8_t>(second & 0xFF);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>134(0x86)
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_RightTime));
}
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
* @param Time1 <20><>ʼʱ<CABC><CAB1>
* @param Time2 <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
* @param eventType <20>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ͣ<EFBFBD>Ĭ<EFBFBD><C4AC>2-<2D><>̬<EFBFBD>¼<EFBFBD> 4-<2D>澯ʱ<E6BEAF><CAB1>
* @param monitorPoint <20><><EFBFBD><EFBFBD><EFBFBD>㣬Ĭ<E3A3AC><C4AC>1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 1-6 <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
*/
std::vector<uint8_t> generate_recallevent_message(const std::tm& Time1, const std::tm& Time2,
uint8_t eventType, uint8_t monitorPoint)
{
std::vector<uint8_t> DataBuf(25, 0x00); // <20><><EFBFBD><EFBFBD>25<32>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
// ǰ3<C7B0>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ã<EFBFBD><C3A3>ѳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ0
DataBuf[3] = eventType; // 2-<2D><>̬<EFBFBD>¼<EFBFBD> 4-<2D><EFBFBD>¼<EFBFBD>
DataBuf[4] = monitorPoint; // 0-<2D><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>
// <20><>ʱ<EFBFBD><CAB1>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD>ֽڸ<D6BD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint16_t year1 = static_cast<uint16_t>(Time1.tm_year + 1900);
DataBuf[5] = static_cast<uint8_t>((year1 >> 8) & 0xFF);
DataBuf[6] = static_cast<uint8_t>(year1 & 0xFF);
uint16_t month1 = static_cast<uint16_t>(Time1.tm_mon + 1);
DataBuf[7] = static_cast<uint8_t>((month1 >> 8) & 0xFF);
DataBuf[8] = static_cast<uint8_t>(month1 & 0xFF);
uint16_t day1 = static_cast<uint16_t>(Time1.tm_mday);
DataBuf[9] = static_cast<uint8_t>((day1 >> 8) & 0xFF);
DataBuf[10] = static_cast<uint8_t>(day1 & 0xFF);
uint16_t hour1 = static_cast<uint16_t>(Time1.tm_hour);
DataBuf[11] = static_cast<uint8_t>((hour1 >> 8) & 0xFF);
DataBuf[12] = static_cast<uint8_t>(hour1 & 0xFF);
uint16_t minute1 = static_cast<uint16_t>(Time1.tm_min);
DataBuf[13] = static_cast<uint8_t>((minute1 >> 8) & 0xFF);
DataBuf[14] = static_cast<uint8_t>(minute1 & 0xFF);
uint16_t year2 = static_cast<uint16_t>(Time2.tm_year + 1900);
DataBuf[15] = static_cast<uint8_t>((year2 >> 8) & 0xFF);
DataBuf[16] = static_cast<uint8_t>(year2 & 0xFF);
uint16_t month2 = static_cast<uint16_t>(Time2.tm_mon + 1);
DataBuf[17] = static_cast<uint8_t>((month2 >> 8) & 0xFF);
DataBuf[18] = static_cast<uint8_t>(month2 & 0xFF);
uint16_t day2 = static_cast<uint16_t>(Time2.tm_mday);
DataBuf[19] = static_cast<uint8_t>((day2 >> 8) & 0xFF);
DataBuf[20] = static_cast<uint8_t>(day2 & 0xFF);
uint16_t hour2 = static_cast<uint16_t>(Time2.tm_hour);
DataBuf[21] = static_cast<uint8_t>((hour2 >> 8) & 0xFF);
DataBuf[22] = static_cast<uint8_t>(hour2 & 0xFF);
uint16_t minute2 = static_cast<uint16_t>(Time2.tm_min);
DataBuf[23] = static_cast<uint8_t>((minute2 >> 8) & 0xFF);
DataBuf[24] = static_cast<uint8_t>(minute2 & 0xFF);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>GetMsg<73><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x0D(<28>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>)
return GetMsg(DataBuf, static_cast<unsigned char>(MsgRequestType::Request_Read_Event));
}

File diff suppressed because it is too large Load Diff

BIN
LFtid1056/RCa04916 Normal file

Binary file not shown.

BIN
LFtid1056/RCa17100 Normal file

Binary file not shown.

BIN
LFtid1056/RCb04916 Normal file

Binary file not shown.

BIN
LFtid1056/RCb17100 Normal file

Binary file not shown.

29
LFtid1056/boot/feservice Normal file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
export CLOUD_PATH=/FeProject
if [ -z "$CLOUD_PATH" ]; then
echo "Error: CLOUD_PATH is not set. Please set it first."
exit 1
fi
case "$1" in
'start')
$CLOUD_PATH/boot/start_fe.sh
;;
'stop')
$CLOUD_PATH/boot/stop_fe.sh
;;
'restart')
$CLOUD_PATH/boot/stop_fe.sh
$CLOUD_PATH/boot/start_fe.sh
;;
*)
echo "Usage: feservice start|stop|restart"
exit 1
;;
esac

62
LFtid1056/boot/ps_fe.sh Normal file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
# ========= 0. 获取脚本所在路径的上一层,设置为 FEP_ENV =========
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
FEP_ENV="$(dirname "$SCRIPT_DIR")"
export FEP_ENV
# ========= 1. 初始化软连接 =========
TEMP_LINK_CREATED=0
if [ ! -L "/FeProject" ]; then
if [ ! -e "/FeProject" ]; then
sudo ln -s "$FEP_ENV" /FeProject
TEMP_LINK_CREATED=1
echo "Temporary symlink /FeProject created."
else
echo "/FeProject exists but is not a symlink. Please check manually."
fi
fi
if [ -z "$FEP_ENV" ]; then
echo "Error: FEP_ENV is not set. Please set it first."
exit 1
fi
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
while read LINE ; do
if [ -n "$LINE" ] ; then
if [ ${LINE:0:1} != "#" ]; then
BINPATH=`echo $LINE | awk -F '^' '{printf $1}'`
BINPATH=`echo "$BINPATH" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BINPATH
BIN=`echo $LINE | awk -F '^' '{printf $2}'`
BIN=`echo "$BIN" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BIN
SPECIAL=`echo $LINE | awk -F '^' '{printf $4}'`
SPECIAL=`echo "$SPECIAL" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SPECIAL
SLEEPSEC=`echo $LINE | awk -F '^' '{printf $5}'`
SLEEPSEC=`echo "$SLEEPSEC" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SLEEPSEC
STARTFLAG=`echo $LINE | awk -F '^' '{printf $7}'`
STARTFLAG=`echo "$STARTFLAG" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $STARTFLAG
# if [ "`echo $STARTFLAG`" != "IGNORE_START" ]; then
CMD_STR=" ps -w | grep `echo "'"``echo $BIN``echo "'"` | grep -v 'grep'"
BIN2=`echo $BIN`
ps -ef | grep "$BIN2" | grep -v 'grep'
# fi
fi
fi
done < $RUNTIME_CF_FILE
# ========= 4. 清理软链接(仅在本次脚本中创建) =========
if [ "$TEMP_LINK_CREATED" -eq 1 ]; then
if [ -L "/FeProject" ]; then
sudo rm -f /FeProject
echo "Temporary symlink /FeProject removed."
fi
fi

View File

@@ -0,0 +1,97 @@
#!/bin/bash
# ========= 0. <20><>ȡ<EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ϊ FEP_ENV =========
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
FEP_ENV="$(dirname "$SCRIPT_DIR")"
export FEP_ENV
# ========= 1. <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =========
TEMP_LINK_CREATED=0
if [ ! -L "/FeProject" ]; then
if [ ! -e "/FeProject" ]; then
sudo ln -s "$FEP_ENV" /FeProject
TEMP_LINK_CREATED=1
echo "Temporary symlink /FeProject created."
else
echo "/FeProject exists but is not a symlink. Please check manually."
fi
fi
if [ -z "$FEP_ENV" ]; then
echo "Error: FEP_ENV is not set. Please set it first."
exit 1
fi
# ========= 2. <20><>־<EFBFBD><D6BE>ת<EFBFBD><D7AA><EFBFBD><EFBFBD> =========
check_log_file() {
if [ -n "$1" ]; then
FILE_SIZE=$(du "$1" | awk '{print $1}')
if [ "$FILE_SIZE" -ge 5120 ]; then
[ -f "$1.3" ] && rm -f "$1.3"
[ -f "$1.2" ] && mv "$1.2" "$1.3"
[ -f "$1.1" ] && mv "$1.1" "$1.2"
mv "$1" "$1.1"
fi
fi
}
LOGFILE="$FEP_ENV/dat/log/start_fe.log"
check_log_file "$LOGFILE"
echo "" ; echo ""
echo "******* $(date "+%F %R:%S") Start Processes *******"
echo "" >>"$LOGFILE"
echo "" >>"$LOGFILE"
echo "******* $(date "+%F %R:%S") Start Processes *******" >>"$LOGFILE"
# ========= 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =========
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
echo "Using config file name: $RUNTIME_CF_FILE"
echo "Using config file name: $RUNTIME_CF_FILE" >>"$LOGFILE"
cd "$FEP_ENV/boot" || exit 1
CURDIR=$(pwd)
while read -r LINE; do
if [ -n "$LINE" ] && [[ ${LINE:0:1} != "#" ]]; then
BINPATH=$(echo "$LINE" | awk -F '^' '{print $1}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$BINPATH"
BIN=$(echo "$LINE" | awk -F '^' '{print $2}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$BIN"
SPECIAL=$(echo "$LINE" | awk -F '^' '{print $4}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$SPECIAL"
SLEEPSEC=$(echo "$LINE" | awk -F '^' '{print $5}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$SLEEPSEC"
STARTFLAG=$(echo "$LINE" | awk -F '^' '{print $7}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$STARTFLAG"
RESTARTFLAG=$(echo "$LINE" | awk -F '^' '{print $6}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$RESTARTFLAG"
if [ "$RESTARTFLAG" = "IGNORE_RESTART" ]; then
CMD_STR="sleep $SLEEPSEC"
echo "$CMD_STR"
echo "$CMD_STR" >>"$LOGFILE"
eval "$CMD_STR"
CMD_STR="$BINPATH$BIN $SPECIAL"
echo "$CMD_STR"
echo "$CMD_STR" >>"$LOGFILE"
eval "$CMD_STR" &>/dev/null
fi
fi
done < "$RUNTIME_CF_FILE"
cd "$CURDIR"
DT=$(date "+%F %R:%S.%N")
echo "******* ${DT:0:23} Start Processes Succcessfully *******"
echo "******* ${DT:0:23} Start Processes Succcessfully *******" >>"$LOGFILE"
# ========= 4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1>νű<CEBD><C5B1>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD> =========
if [ "$TEMP_LINK_CREATED" -eq 1 ]; then
if [ -L "/FeProject" ]; then
sudo rm -f /FeProject
echo "Temporary symlink /FeProject removed."
fi
fi

129
LFtid1056/boot/stop_fe.sh Normal file
View File

@@ -0,0 +1,129 @@
#!/bin/bash
# ========= 0. 获取脚本所在路径的上一层,设置为 FEP_ENV =========
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
FEP_ENV="$(dirname "$SCRIPT_DIR")"
export FEP_ENV
# ========= 1. 初始化软连接 =========
TEMP_LINK_CREATED=0
if [ ! -L "/FeProject" ]; then
if [ ! -e "/FeProject" ]; then
sudo ln -s "$FEP_ENV" /FeProject
TEMP_LINK_CREATED=1
echo "Temporary symlink /FeProject created."
else
echo "/FeProject exists but is not a symlink. Please check manually."
fi
fi
if [ -z "$FEP_ENV" ]; then
echo "Error: FEP_ENV is not set. Please set it first."
exit 1
fi
check_log_file()
{
if [ -n "$1" ] ; then
FILE_SIZE=0
FILE_SIZE=`du $1 | awk '{print $1}'`
if [ $FILE_SIZE -ge 5120 ]
then
if [ -f "$1".3 ]; then
rm -f "$1".3
fi
if [ -f "$1".2 ]; then
mv "$1".2 "$1".3
fi
if [ -f "$1".1 ]; then
mv "$1".1 "$1".2
fi
mv "$1" "$1".1
fi
fi
}
LOGFILE="$FEP_ENV/dat/log/start_fe.log"
check_log_file $LOGFILE
echo "" ; echo ""
echo "****** `date "+%F %R:%S"` Stop Processes ******"
echo "" >>"$LOGFILE"
echo "" >>"$LOGFILE"
echo "****** `date "+%F %R:%S"` Stop Processes ******" >>"$LOGFILE"
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
#cat $RUNTIME_CF_FILE |tac > /tmp/runtime.cf
sed '1!G;h;$!d' $RUNTIME_CF_FILE > /tmp/runtime.cf
echo "Using config file name: $RUNTIME_CF_FILE"
echo "Using config file name: $RUNTIME_CF_FILE">>"$LOGFILE"
while read LINE ; do
if [ -n "$LINE" ] ; then
if [ ${LINE:0:1} != "#" ]; then
BINPATH=`echo $LINE | awk -F '^' '{printf $1}'`
BINPATH=`echo "$BINPATH" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BINPATH
BIN=`echo $LINE | awk -F '^' '{printf $2}'`
BIN=`echo "$BIN" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BIN
SPECIAL=`echo $LINE | awk -F '^' '{printf $4}'`
SPECIAL=`echo "$SPECIAL" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SPECIAL
SLEEPSEC=`echo $LINE | awk -F '^' '{printf $5}'`
SLEEPSEC=`echo "$SLEEPSEC" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SLEEPSEC
STARTFLAG=`echo $LINE | awk -F '^' '{printf $7}'`
STARTFLAG=`echo "$STARTFLAG" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $STARTFLAG
if [ "`echo $STARTFLAG`" != "IGNORE_START" ]; then
# echo ""
# echo "" >>"$LOGFILE"
CMD_STR=" ps -w | grep `echo "'"``echo $BIN``echo "'"` | grep -v 'grep'"
BIN2=`echo $BIN`
BIN3=`echo $BIN |awk '{print$1}'`
# CMD_STR="killall `echo $BIN | awk '{print$1}'` 2>&1 "
PIDSTR=`ps -ef | grep "$BIN2" | grep -v 'grep'`
if [ -n "$PIDSTR" ] ; then
if [ "$BIN3" == "fe_main" ]; then
CMD_STR=" sleep 3 "
echo "$CMD_STR"
echo "$CMD_STR" >>"$LOGFILE"
$CMD_STR
fi
CMD_STR="kill -15 `echo $PIDSTR | awk '{print$2}'` "
echo " Kill process: \"$BIN\" with PID `echo $PIDSTR | awk '{print$2}'`"
echo " Kill process: \"$BIN\" with PID `echo $PIDSTR | awk '{print$2}'`" >>"$LOGFILE"
echo " Executing: $CMD_STR"
echo " Executing: $CMD_STR" >>"$LOGFILE"
CMD_RESULT=`$CMD_STR`
if [ -n "$CMD_RESULT" ] ; then
echo "$CMD_RESULT"
echo "$CMD_RESULT" >>"$LOGFILE"
fi
else
echo " Process \"$BIN\" not running."
fi
fi
fi
fi
done < /tmp/runtime.cf
DT=`date "+%F %R:%S.%N"`
echo "****** ${DT:0:23} Stop Processes Succcessfully ******"
echo "" >>"$LOGFILE"
echo "****** ${DT:0:23} Stop Processes Succcessfully ******" >>"$LOGFILE"
# ========= 4. 清理软链接(仅在本次脚本中创建) =========
if [ "$TEMP_LINK_CREATED" -eq 1 ]; then
if [ -L "/FeProject" ]; then
sudo rm -f /FeProject
echo "Temporary symlink /FeProject removed."
fi
fi

70
LFtid1056/build.sh Normal file
View File

@@ -0,0 +1,70 @@
#!/bin/bash
TARGET="cloud-front-test"
SRC_DIR="./cloudfront/code"
LIB_DIR="./cloudfront/lib"
OUT_DIR="./bin"
# 创建输出目录
mkdir -p "$OUT_DIR"
# 源文件,所有主 cpp 文件
SRC="$SRC_DIR/main.cpp \
$SRC_DIR/worker.cpp \
$SRC_DIR/log4.cpp \
$SRC_DIR/cfg_parser.cpp \
$SRC_DIR/interface.cpp \
$SRC_DIR/rocketmq.cpp \
$SRC_DIR/tinyxml2.cpp \
./client2.cpp \
./dealMsg.cpp \
./main_thread.cpp \
./PQSMsg.cpp "
INCLUDE_DIRS="-I$SRC_DIR \
-I$SRC_DIR/nlohmann \
-I$SRC_DIR/curl \
-I$SRC_DIR/log4cplus \
-I$SRC_DIR/rocketmq \
-I$SRC_DIR \
-I./lib/libuv-v1.51.0/include \
-I. "
LIB_DIRS="-L$LIB_DIR -L/usr/lib64 -L/usr/local/lib"
LIBS="./cloudfront/lib/libcurl.so \
./cloudfront/lib/libssl.so \
./cloudfront/lib/libcrypto.so \
./cloudfront/lib/liblog4cplus.so \
-lpthread -ldl -lrt \
-lstdc++fs \
-lz \
./libuv.a \
-pthread"
# 如果有静态 rocketmq 库就加上
if [ -f "$LIB_DIR/librocketmq.a" ]; then
LIBS="$LIB_DIR/librocketmq.a $LIBS"
fi
# 判断是否为 debug 版本
if [[ "$1" == "debug" ]]; then
CXXFLAGS="-std=c++11 -g -O0"
TARGET="${TARGET}d"
echo "🟢 编译调试版本 (-g -O0)"
else
CXXFLAGS="-std=c++11 -O2 -static-libstdc++ -static-libgcc"
echo "🔵 编译正式版本 (-O2 -static)"
fi
# 编译命令
g++ $CXXFLAGS $SRC $INCLUDE_DIRS $LIB_DIRS $LIBS -Wl,-rpath='$ORIGIN/../cloudfront/lib' -o "$OUT_DIR/$TARGET"
# 编译结果检查
if [ $? -eq 0 ]; then
echo "✅ 编译成功,生成可执行文件: $OUT_DIR/$TARGET"
echo "🔍 依赖库检查:"
ldd "$OUT_DIR/$TARGET" || echo "是静态编译程序 ✔"
else
echo "❌ 编译失败"
fi

File diff suppressed because it is too large Load Diff

View File

@@ -1,33 +1,474 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef CLIENT_H
#define CLIENT_H
#include <uv.h>
#include <pthread.h>
#include <unistd.h>
#include <math.h>
#include <string>
#include <vector>
#include <memory>
#include <unordered_map>
#include <mutex>
#include <queue>
#include "dealMsg.h"
#include "PQSMsg.h"
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>
struct PointInfo {
std::string point_id; // <20><><EFBFBD><EFBFBD>ID
std::string name; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::string device_id; // <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>ID
ushort nCpuNo; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-6
double PT1; // <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>1
double PT2; // <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>2
double CT1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
double CT2; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2
std::string strScale; // <20><>ѹ<EFBFBD>ȼ<EFBFBD>
int nPTType; // <20><><EFBFBD>߷<EFBFBD>ʽ 0-<2D><><EFBFBD><EFBFBD> 1-<2D><><EFBFBD><EFBFBD>
};
/* <20><><EFBFBD><EFBFBD>״̬ö<CCAC><C3B6> */
typedef enum {
STATE_DISCONNECTED, // δ<><CEB4><EFBFBD><EFBFBD>״̬
STATE_CONNECTING, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
STATE_CONNECTED // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
} connection_state_t;
// װ<><D7B0><EFBFBD><EFBFBD>Ϣ<EFBFBD>
struct DeviceInfo {
std::string device_id; // װ<><D7B0>ID
std::string name; // װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::string model; // װ<EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD>
std::string mac; // װ<><D7B0>MAC<41><43>ַ
int status; // <20><><EFBFBD><EFBFBD>״̬ (0: <20><><EFBFBD><EFBFBD>, 1: <20><><EFBFBD><EFBFBD>)
std::vector<PointInfo> points; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool righttime; //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
};
/* <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľṹ<C4BD><E1B9B9> */
typedef struct {
uv_loop_t* loop; // libuv<75>¼<EFBFBD>ѭ<EFBFBD><D1AD>
uv_tcp_t client; // TCP<43>ͻ<EFBFBD><CDBB>˾<EFBFBD><CBBE><EFBFBD>
int index; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uv_timer_t timer; // <20><><EFBFBD>ݷ<EFBFBD><DDB7>Ͷ<EFBFBD>ʱ<EFBFBD><CAB1>
uv_timer_t reconnect_timer;// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
connection_state_t state; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬
int reconnect_attempts; // <20><>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
volatile int shutdown; // <20>رձ<D8B1>־ (<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
} client_context_t;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void try_reconnect(uv_timer_t* timer);//<2F>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
void on_connect(uv_connect_t* req, int status);//<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻص<D3BB>
void on_close(uv_handle_t* handle);//<2F>ͻ<EFBFBD><CDBB>˶Ͽ<CBB6><CFBF>ص<EFBFBD>
void stop_all_clients(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ֹͣ<CDA3><D6B9><EFBFBD>пͻ<D0BF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void start_client_connect();//<2F><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void send_binary_data(client_context_t* ctx, const unsigned char* data, size_t data_size);
enum class ConnectionState {
DISCONNECTED,
CONNECTING,
CONNECTED
};
// <20><><EFBFBD>ӵ<EFBFBD>״̬ö<EFBFBD><EFBFBD>
enum class DeviceState {
IDLE, // <20><><EFBFBD><EFBFBD>״̬
READING_STATS, // <20><>ȡͳ<C8A1><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
READING_STATS_TIME, // <20><>ȡͳ<C8A1><CDB3>ʱ<EFBFBD><CAB1>
READING_REALSTAT, // <EFBFBD><EFBFBD>ȡʵʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
READING_EVENTFILE, // <20><>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
READING_FILEMENU, // <20><>ȡ<EFBFBD>ļ<EFBFBD>Ŀ¼
READING_FILEDATA, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
READING_FIXEDVALUE, // <20><>ȡ<EFBFBD><EFBFBD><EFBFBD>㶨ֵ
READING_FIXEDVALUEDES, // <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>㶨ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET_FIXEDVALUE, // <20><><EFBFBD>ò<EFBFBD><C3B2>㶨ֵ
READING_INTERFIXEDVALUE, // <20><>ȡ<EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ
READING_INTERFIXEDVALUEDES, // <20><>ȡ<EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
READING_CONTROLWORD, // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET_INTERFIXEDVALUE, // <20><><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ
READING_RUNNINGINFORMATION_1,// <20><>ȡװ<C8A1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
READING_RUNNINGINFORMATION_2,// <20><>ȡװ<C8A1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(<28><>ʱִ<CAB1><D6B4>)
READING_DEVVERSION, // <20><>ȡװ<C8A1>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
SET_RIGHTTIME, // <20><><EFBFBD><EFBFBD>װ<EFBFBD>ö<EFBFBD>ʱ
READING_EVENTLOG, // <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־
READING_STATSFILE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
// <20>ɸ<EFBFBD><C9B8><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD>״̬
CUSTOM_ACTION // <20>Զ<EFBFBD><D4B6><EFBFBD><E5B6AF>
};
// ״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B9B9>
struct StateAction {
DeviceState state;
std::vector<unsigned char> packet; // <20><>״̬<D7B4><CCAC>Ҫ<EFBFBD><D2AA><EFBFBD>͵ı<CDB5><C4B1><EFBFBD>
};
class ClientContext {
public:
uv_loop_t* loop;
uv_tcp_t client;
uv_timer_t timer;
uv_timer_t reconnect_timer;
ConnectionState state;
int reconnect_attempts;
volatile bool shutdown;
uint64_t last_state_query_time_ = 0; // ͳ<><CDB3><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ʱʱ<CAB1><CAB1><EFBFBD><EFBFBD>
uint64_t real_state_query_time_ = 0; // ʵʱ<CAB5><CAB1><EFBFBD>ݼ<EFBFBD>ʱʱ<CAB1><CAB1><EFBFBD><EFBFBD>
std::atomic<int> real_state_count{ 0 };//ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD> ԭ<>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>̰߳<DFB3>ȫ
std::atomic<ushort> real_point_id_{ 1 }; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>ԭ<EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>
uint64_t read_runninginformationMsg = 0; // װ<>ö<EFBFBD>ʱ<EFBFBD><CAB1>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD>
uint64_t right_time = 0; // װ<>ö<EFBFBD>ʱ<EFBFBD><CAB1>ʱʱ<CAB1><CAB1><EFBFBD><EFBFBD>
DeviceInfo device_info; // װ<><D7B0><EFBFBD><EFBFBD>Ϣ
int cloudstatus = 0; // <20><>ǰ<EFBFBD>õ<EFBFBD>¼״̬<D7B4><CCAC>0<EFBFBD><30>δ<EFBFBD><CEB4>¼ 1<><31><EFBFBD>ѵ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ĭ<EFBFBD><C4AC>Ϊ0
uint64_t get_cloudmessage_time = 0;//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
uint64_t login_cloud_time = 0;//װ<>õ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ij<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
std::string dev_CloudProtocolVer = "V1.0";//װ<><D7B0><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><E6B1BE> <20><><EFBFBD><EFBFBD>V1.5<EFBFBD><EFBFBD>װ<EFBFBD>õ<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡһ<EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж϶<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ΪV1.0
// <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
DeviceState current_state_; // <20><>ǰװ<C7B0><D7B0>״̬
uint64_t state_start_time_; // ״̬<D7B4><CCAC>ʼʱ<CABC><CAB1>(ms)
std::queue<StateAction> action_queue_; // ״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::mutex state_mutex_; // ״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::vector<unsigned char> current_packet_; // <20><>ǰ״̬<D7B4><CCAC>Ҫ<EFBFBD><D2AA><EFBFBD>͵ı<CDB5><C4B1><EFBFBD>
ClientContext(uv_loop_t* loop, const DeviceInfo& device, int index);
~ClientContext();
void init_tcp();//<2F><>ʼ<EFBFBD><CABC><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void start_timer();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧװ<D3A6>ü<EFBFBD>ʱ<EFBFBD><CAB1> 5<><35>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>
void start_reconnect_timer(int delay);//<2F><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
void stop_timers();//ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
void close_handles();//<2F>رտͻ<D5BF><CDBB>˸<EFBFBD><CBB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붨ʱ<EBB6A8><CAB1>
void append_and_process_data(const char* data, size_t len);//<2F><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD><EBBBBA>
void put_packet_into_queue(const std::vector<unsigned char>& packet);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void change_state(DeviceState new_state, const std::vector<unsigned char>& packet = {});//<2F>ı<EFBFBD>װ<EFBFBD><D7B0>״̬<D7B4>͵<EFBFBD>ǰ״̬<D7B4>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>
void add_action(DeviceState state, const std::vector<unsigned char>& packet = {});//<2F><><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void check_state_timeout();//װ<><D7B0>״̬<D7B4><CCAC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
void process_next_action();//װ<><D7B0>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>
void send_current_packet();//<2F><><EFBFBD>͵<EFBFBD>ǰ״̬<D7B4>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>
// <20><><EFBFBD><EFBFBD>: <20><>֡<EFBFBD><D6A1><EFBFBD>ݱ<EFBFBD><DDB1>Ļ<EFBFBD><C4BB><EFBFBD>
struct StatPacket {
int packet_index;
std::vector<unsigned char> data;
};
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>------------------------------------------------------------------------
std::vector<StatPacket> stat_packets_cache_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
int expected_total_packets_ = 0; // Ԥ<><D4A4><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>
std::mutex stat_cache_mutex_; // <20><><EFBFBD><EFBFBD><E6BBA5><EFBFBD><EFBFBD>
bool add_stat_packet(const std::vector<unsigned char>& packet, int current_packet, int total_packets);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::vector<StatPacket> get_and_clear_stat_packets();//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
void clear_stat_cache();//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-----------------------------------------------------------------
ushort event_lineNo = 1; // <20>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>
std::vector<StatPacket> event_stat_packets_cache_; // <20>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
int event_expected_total_packets_ = 0; // <20>¼<EFBFBD><C2BC><EFBFBD>־Ԥ<D6BE><D4A4><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>
std::mutex event_stat_cache_mutex_; // <20>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><E6BBA5><EFBFBD><EFBFBD>
bool event_add_stat_packet(const std::vector<unsigned char>& packet, int current_packet, int total_packets);//<2F>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::vector<StatPacket> event_get_and_clear_stat_packets();//<2F>¼<EFBFBD><C2BC><EFBFBD>־ȡ<D6BE><C8A1><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
void event_clear_stat_cache();//<2F>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
// ͳ<><CDB3><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
struct PointFloatCache {
std::array<tagPqData_Float, 4> data; // <20><EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(0-3)
std::array<bool, 4> received = { false }; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ѽ<EFBFBD><D1BD><EFBFBD>
};
// <20><><EFBFBD><EFBFBD>ͳ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
std::unordered_map<ushort, PointFloatCache> point_float_cache_;
std::mutex float_cache_mutex_; // <20><><EFBFBD><EFBFBD><EFBFBD><E6BBA5><EFBFBD><EFBFBD>
// <20><><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
bool add_float_data(ushort point_id, int data_type, const tagPqData_Float& float_data);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::array<tagPqData_Float, 4> get_and_clear_float_data(ushort point_id);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
void clear_float_cache();
// ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD>
struct RealtimePacket {
unsigned char packet_type;
std::vector<unsigned char> data;
};
std::vector<RealtimePacket> realtime_packets_cache_; // <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD>
std::mutex realtime_cache_mutex_; // <20><><EFBFBD><EFBFBD><E6BBA5><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void add_realtime_packet(unsigned char packet_type,
const unsigned char* data,
size_t size) {
std::lock_guard<std::mutex> lock(realtime_cache_mutex_);
realtime_packets_cache_.push_back({
packet_type,
std::vector<unsigned char>(data, data + size)
});
}
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
std::vector<RealtimePacket> get_and_clear_realtime_packets() {
std::lock_guard<std::mutex> lock(realtime_cache_mutex_);
auto packets = std::move(realtime_packets_cache_);
realtime_packets_cache_.clear();
return packets;
}
// <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void reset_realtime_data() {
std::lock_guard<std::mutex> lock(realtime_cache_mutex_);
realtime_packets_cache_.clear();
}
//<2F><>̬<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
struct FileDownloadPacket {
int frame_index;
std::vector<unsigned char> data;
};
std::vector<FileDownloadPacket> file_download_cache_; // <20>ļ<EFBFBD><C4BC><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>
std::string current_filename_; // <20><>ǰ<EFBFBD><C7B0><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>
std::mutex file_cache_mutex_; // <20><><EFBFBD><EFBFBD><E6BBA5><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void add_file_packet(int frame_index, const unsigned char* data, size_t size) {
std::lock_guard<std::mutex> lock(file_cache_mutex_);
file_download_cache_.push_back({ frame_index, std::vector<unsigned char>(data, data + size) });
}
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>з<EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::vector<std::vector<unsigned char>> get_and_clear_file_packets() {
std::lock_guard<std::mutex> lock(file_cache_mutex_);
// <20><>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::sort(file_download_cache_.begin(), file_download_cache_.end(),
[](const FileDownloadPacket& a, const FileDownloadPacket& b) {
return a.frame_index < b.frame_index;
});
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
std::vector<std::vector<unsigned char>> packets;
for (const auto& pkt : file_download_cache_) {
packets.push_back(pkt.data);
}
// <20><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
file_download_cache_.clear();
return packets;
}
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
void clear_file_cache() {
std::lock_guard<std::mutex> lock(file_cache_mutex_);
file_download_cache_.clear();
}
// <20><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>
void set_current_filename(const std::string& filename) {
std::lock_guard<std::mutex> lock(file_cache_mutex_);
current_filename_ = filename;
}
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>
std::string get_current_filename() {
std::lock_guard<std::mutex> lock(file_cache_mutex_);
return current_filename_;
}
private:
int index_;
private:
std::vector<unsigned char> recv_buffer_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
std::mutex buffer_mutex_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void process_buffer();
};
class ClientManager {
public:
static ClientManager& instance() {
static ClientManager inst;
return inst;
}
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ѭ<EFBFBD><D1AD>
void set_loop(uv_loop_t* loop) {
std::lock_guard<std::mutex> lock(mutex_);
loop_ = loop;
}
void add_device(const DeviceInfo& device);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void remove_device(const std::string& device_id);//ɾ<><C9BE>һ<EFBFBD><D2BB>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void restart_device(const std::string& device_id);//<2F>ر<EFBFBD>ָ<EFBFBD><D6B8>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void stop_all();//ֹͣ<CDA3><D6B9><EFBFBD>пͻ<D0BF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool set_cloud_status(const std::string& identifier, int status);//<2F>޸<EFBFBD><DEB8><EFBFBD>ǰ<EFBFBD>õ<EFBFBD>¼״̬
bool post_message_processing(const std::string& identifier);// <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ󴥷<C9BA>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>
bool add_action_to_device(const std::string& identifier,
DeviceState state,
const std::vector<unsigned char>& packet = {});
// <20>ı<EFBFBD>װ<EFBFBD>õ<EFBFBD>ǰ״̬
bool change_device_state(const std::string& identifier,
DeviceState new_state,
const std::vector<unsigned char>& packet = {});
// <20><><EFBFBD><EFBFBD>װ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool clear_action_queue(const std::string& identifier);
// <20><>ȡװ<C8A1>õ<EFBFBD>ǰ״̬
bool get_device_state(const std::string& identifier, DeviceState& out_state);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>ȡװ<C8A1>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>Ϣ
bool get_device_points(const std::string& identifier,std::vector<PointInfo>& out_points);
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>ͻ<EFBFBD><CDBB>˵Ķ<CBB5>֡<EFBFBD><D6A1><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EBBBBA><EFBFBD><EFBFBD>
bool add_stat_packet_to_device(const std::string& identifier,
const std::vector<unsigned char>& packet,
int current_packet,
int total_packets);
//<2F><>ȡָ<C8A1><D6B8><EFBFBD>ͻ<EFBFBD><CDBB>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>
std::vector<ClientContext::StatPacket> get_and_clear_stat_packets(const std::string& identifier);
//<2F><><EFBFBD>ն<EFBFBD>֡<EFBFBD><D6A1><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><E6BBBA><EFBFBD><EFBFBD>
bool clear_stat_cache(const std::string& identifier);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>ȫ
bool add_eventlog_packet_to_device(const std::string& identifier,
const std::vector<unsigned char>& packet,
int current_packet,
int total_packets);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>֡<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
std::vector<ClientContext::StatPacket> get_and_clear_event_packets(const std::string& identifier);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool clear_event_cache(const std::string& identifier);
// <20><>ȡָ<C8A1><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PT<50><54>CT<43><54><EFBFBD><EFBFBD>ֵ
bool get_pt_ct_ratio(const std::string& identifier,
int16_t nCpuNo,
float& pt_ratio,
float& ct_ratio);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool get_event_lineid(const std::string& identifier, int& nCpuNo);
// <20><>ȡ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
size_t client_count() {
std::lock_guard<std::mutex> lock(mutex_);
return clients_.size();
}
// <20><><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>
bool add_float_data_to_device(const std::string& identifier,
ushort point_id,
int data_type,
const tagPqData_Float& float_data);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::array<tagPqData_Float, 4> get_and_clear_float_data(
const std::string& identifier, ushort point_id);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD><E3BBBA>
bool clear_float_cache(const std::string& identifier);
// <20><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
bool add_realtime_packet_to_device(const std::string& identifier,
unsigned char packet_type,
const unsigned char* data,
size_t size) {
std::lock_guard<std::mutex> lock(mutex_);
for (auto& pair : clients_) {
auto& ctx = pair.second;
if (ctx->device_info.device_id == identifier ||
ctx->device_info.mac == identifier) {
ctx->add_realtime_packet(packet_type, data, size);
return true;
}
}
return false;
}
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
std::vector<ClientContext::RealtimePacket>
get_and_clear_realtime_packets(const std::string& identifier) {
std::lock_guard<std::mutex> lock(mutex_);
for (auto& pair : clients_) {
auto& ctx = pair.second;
if (ctx->device_info.device_id == identifier ||
ctx->device_info.mac == identifier) {
return ctx->get_and_clear_realtime_packets();
}
}
return {};
}
// <20><>ȡָ<C8A1><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ѹ<EFBFBD>ȼ<EFBFBD><C8BC>ͽ<EFBFBD><CDBD>߷<EFBFBD>ʽ
bool get_point_scale_and_pttype(const std::string& identifier,
ushort nCpuNo,
std::string& out_scale,
int& out_pttype);
//<2F>޸<EFBFBD><DEB8><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ĵ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
bool update_current_packet_frame(const std::string& identifier, int next_frame);
//<2F><>ȡ<EFBFBD><C8A1>̬<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ϣ
struct DownloadInfo {
std::string filename;
int current_frame;
};
bool parse_download_packet(const std::string& identifier, DownloadInfo& out_info);
bool add_file_packet_to_device(const std::string& identifier,
int frame_index,
const unsigned char* data,
size_t size);
std::vector<std::vector<unsigned char>> get_and_clear_file_packets(const std::string& identifier);
bool update_current_filename(const std::string& identifier, const std::string& filename);
std::string get_current_filename(const std::string& identifier);
//ˢ<>¿ͻ<C2BF><CDBB><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
bool set_cloudmessage_time(const std::string& identifier);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>޸Ŀͻ<C4BF><CDBB>˵<EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>Ϣ<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0B9A6>ʹ<EFBFBD><CAB9>
bool set_versioninformation(const std::string& identifier, string cloud_version);
//<2F><>ȡ<EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20>ļ<EFBFBD>·<EFBFBD><C2B7>
bool add_file_menu_action_to_device(const std::string& identifier, const std::string& file_path);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD> ʵʱ<CAB5><CAB1><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool set_real_state_count(const std::string& identifier, int count, ushort point_id);
//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20>ļ<EFBFBD>λ<EFBFBD><CEBB>
bool add_file_download_action_to_device(const std::string& identifier, const std::string& file_path);
//<2F><>ȡָ<C8A1><D6B8>װ<EFBFBD><D7B0>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĶ<C2B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool get_fixedvalue_action_to_device(const std::string& identifier, ushort point_id);
//<2F><>ȡָ<C8A1><D6B8>װ<EFBFBD>ö<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id
bool get_fixedvaluedes_action_to_device(const std::string& identifier);
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>mac/id + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
bool set_fixedvalue_action_to_device(const std::string& identifier, ushort point_id, const std::vector<float>& value);
//<2F><>ȡװ<C8A1><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ <20><><EFBFBD><EFBFBD>mac/id
bool get_interfixedvalue_action_to_device(const std::string& identifier);
//<2F><>ȡװ<C8A1><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>or<6F>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> 1-<2D>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
bool get_fixedvalucontrolword_action_to_device(const std::string& identifier, unsigned char nDesCW);
//<2F><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ֵ <20><><EFBFBD><EFBFBD>mac/id + <20>ڲ<EFBFBD><DAB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
bool set_interfixedvalue_action_to_device(const std::string& identifier, const std::vector<uint16_t>& values);
//<2F><>ȡװ<C8A1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
bool read_runninginformation_action_to_device(const std::string& identifier);
//<2F><>ȡװ<C8A1>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
bool read_devversion_action_to_device(const std::string& identifier);
//<2F><EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
bool get_dev_status(const std::string& identifier);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
* @param Time1 <20><>ʼʱ<CABC><CAB1>
* @param Time2 <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
* @param eventType <20>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ͣ<EFBFBD>Ĭ<EFBFBD><C4AC>2-<2D><>̬<EFBFBD>¼<EFBFBD> 4-<2D>澯ʱ<E6BEAF><CAB1>
* @param monitorPoint <20><><EFBFBD><EFBFBD><EFBFBD>㣬Ĭ<E3A3AC><C4AC>1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 1-6 <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
* @return <20><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD>ʧ<EFBFBD>ܵĽ<DCB5><C4BD><EFBFBD>
*/
bool read_eventlog_action_to_device(const std::string& identifier, const std::tm& Time1, const std::tm& Time2,uint8_t eventType = 2, uint8_t monitorPoint = 1);
private:
ClientManager() : loop_(nullptr) {}
std::unordered_map<std::string, std::unique_ptr<ClientContext>> clients_;
std::mutex mutex_;
uv_loop_t* loop_; // <20>¼<EFBFBD>ѭ<EFBFBD><D1AD>ָ<EFBFBD><D6B8>
};
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void start_client_connect(const std::vector<DeviceInfo>& devices);
void send_binary_data(ClientContext* ctx, const unsigned char* data, size_t data_size);
void safe_send_binary_data(ClientContext* ctx, std::vector<unsigned char> data);
void on_timer(uv_timer_t* handle);
void try_reconnect(uv_timer_t* timer);
void on_connect(uv_connect_t* req, int status);
void on_close(uv_handle_t* handle);
void init_clients(uv_loop_t* loop, const std::vector<DeviceInfo>& devices);
void stop_all_clients();
#endif

View File

@@ -0,0 +1,27 @@
#!/bin/bash
if [ -z "$FEP_ENV" ]; then
echo "Error: FEP_ENV is not set. Please set it first."
exit 1
fi
case "$1" in
'start')
$FEP_ENV/boot/start_fe.sh
;;
'stop')
$FEP_ENV/boot/stop_fe.sh
;;
'restart')
$FEP_ENV/boot/stop_fe.sh
$FEP_ENV/boot/start_fe.sh
;;
*)
echo "Usage: feservice start|stop|restart"
exit 1
;;
esac

View File

@@ -0,0 +1,37 @@
#!/bin/bash
if [ -z "$FEP_ENV" ]; then
echo "Error: FEP_ENV is not set. Please set it first."
exit 1
fi
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
while read LINE ; do
if [ -n "$LINE" ] ; then
if [ ${LINE:0:1} != "#" ]; then
BINPATH=`echo $LINE | awk -F '^' '{printf $1}'`
BINPATH=`echo "$BINPATH" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BINPATH
BIN=`echo $LINE | awk -F '^' '{printf $2}'`
BIN=`echo "$BIN" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BIN
SPECIAL=`echo $LINE | awk -F '^' '{printf $4}'`
SPECIAL=`echo "$SPECIAL" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SPECIAL
SLEEPSEC=`echo $LINE | awk -F '^' '{printf $5}'`
SLEEPSEC=`echo "$SLEEPSEC" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SLEEPSEC
STARTFLAG=`echo $LINE | awk -F '^' '{printf $7}'`
STARTFLAG=`echo "$STARTFLAG" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $STARTFLAG
# if [ "`echo $STARTFLAG`" != "IGNORE_START" ]; then
CMD_STR=" ps -w | grep `echo "'"``echo $BIN``echo "'"` | grep -v 'grep'"
BIN2=`echo $BIN`
ps -ef | grep "$BIN2" | grep -v 'grep'
# fi
fi
fi
done < $RUNTIME_CF_FILE

View File

@@ -0,0 +1,101 @@
#!/bin/bash
# ========= 0. <20><>ȡ<EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ϊ FEP_ENV =========
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
FEP_ENV="$(dirname "$SCRIPT_DIR")"
export FEP_ENV
# ========= 1. <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =========
TEMP_LINK_CREATED=0
# <20><>ȡ<EFBFBD><C8A1>ǰ·<C7B0><C2B7>
CURRENT_DIR=$(pwd)
if [ -L "/FeProject" ]; then
if [ "$CURRENT_DIR" = "/FeProject" ]; then
echo "Currently in /FeProject, skipping symlink replacement to avoid issues."
else
echo "/FeProject is an existing symlink. Replacing it..."
sudo rm -f /FeProject
sudo ln -s "$FEP_ENV" /FeProject
TEMP_LINK_CREATED=1
echo "Symlink /FeProject updated."
fi
elif [ ! -e "/FeProject" ]; then
echo "/FeProject does not exist. Creating new symlink..."
sudo ln -s "$FEP_ENV" /FeProject
TEMP_LINK_CREATED=1
echo "Symlink /FeProject created."
else
echo "/FeProject exists but is not a symlink. Please check manually."
fi
if [ -z "$FEP_ENV" ]; then
echo "Error: FEP_ENV is not set. Please set it first."
exit 1
fi
# ========= 2. <20><>־<EFBFBD><D6BE>ת<EFBFBD><D7AA><EFBFBD><EFBFBD> =========
check_log_file() {
if [ -n "$1" ]; then
FILE_SIZE=$(du "$1" | awk '{print $1}')
if [ "$FILE_SIZE" -ge 5120 ]; then
[ -f "$1.3" ] && rm -f "$1.3"
[ -f "$1.2" ] && mv "$1.2" "$1.3"
[ -f "$1.1" ] && mv "$1.1" "$1.2"
mv "$1" "$1.1"
fi
fi
}
LOGFILE="$FEP_ENV/dat/log/start_fe.log"
check_log_file "$LOGFILE"
echo "" ; echo ""
echo "******* $(date "+%F %R:%S") Start Processes *******"
echo "" >>"$LOGFILE"
echo "" >>"$LOGFILE"
echo "******* $(date "+%F %R:%S") Start Processes *******" >>"$LOGFILE"
# ========= 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =========
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
echo "Using config file name: $RUNTIME_CF_FILE"
echo "Using config file name: $RUNTIME_CF_FILE" >>"$LOGFILE"
cd "$FEP_ENV/boot" || exit 1
CURDIR=$(pwd)
while read -r LINE; do
if [ -n "$LINE" ] && [[ ${LINE:0:1} != "#" ]]; then
BINPATH=$(echo "$LINE" | awk -F '^' '{print $1}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$BINPATH"
BIN=$(echo "$LINE" | awk -F '^' '{print $2}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$BIN"
SPECIAL=$(echo "$LINE" | awk -F '^' '{print $4}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$SPECIAL"
SLEEPSEC=$(echo "$LINE" | awk -F '^' '{print $5}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$SLEEPSEC"
STARTFLAG=$(echo "$LINE" | awk -F '^' '{print $7}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$STARTFLAG"
RESTARTFLAG=$(echo "$LINE" | awk -F '^' '{print $6}' | grep -o "[^ ]\+\( \+[^ ]\+\)*")
echo "$RESTARTFLAG"
if [ "$RESTARTFLAG" = "IGNORE_RESTART" ]; then
CMD_STR="sleep $SLEEPSEC"
echo "$CMD_STR"
echo "$CMD_STR" >>"$LOGFILE"
eval "$CMD_STR"
CMD_STR="$BINPATH$BIN $SPECIAL"
echo "$CMD_STR"
echo "$CMD_STR" >>"$LOGFILE"
eval "$CMD_STR" &>/dev/null
fi
fi
done < "$RUNTIME_CF_FILE"
cd "$CURDIR"
DT=$(date "+%F %R:%S.%N")
echo "******* ${DT:0:23} Start Processes Succcessfully *******"
echo "******* ${DT:0:23} Start Processes Succcessfully *******" >>"$LOGFILE"

View File

@@ -0,0 +1,104 @@
#!/bin/bash
if [ -z "$FEP_ENV" ]; then
echo "Error: FEP_ENV is not set. Please set it first."
exit 1
fi
check_log_file()
{
if [ -n "$1" ] ; then
FILE_SIZE=0
FILE_SIZE=`du $1 | awk '{print $1}'`
if [ $FILE_SIZE -ge 5120 ]
then
if [ -f "$1".3 ]; then
rm -f "$1".3
fi
if [ -f "$1".2 ]; then
mv "$1".2 "$1".3
fi
if [ -f "$1".1 ]; then
mv "$1".1 "$1".2
fi
mv "$1" "$1".1
fi
fi
}
LOGFILE="$FEP_ENV/dat/log/start_fe.log"
check_log_file $LOGFILE
echo "" ; echo ""
echo "****** `date "+%F %R:%S"` Stop Processes ******"
echo "" >>"$LOGFILE"
echo "" >>"$LOGFILE"
echo "****** `date "+%F %R:%S"` Stop Processes ******" >>"$LOGFILE"
RUNTIME_CF_FILE="$FEP_ENV/etc/runtime.cf"
#cat $RUNTIME_CF_FILE |tac > /tmp/runtime.cf
sed '1!G;h;$!d' $RUNTIME_CF_FILE > /tmp/runtime.cf
echo "Using config file name: $RUNTIME_CF_FILE"
echo "Using config file name: $RUNTIME_CF_FILE">>"$LOGFILE"
while read LINE ; do
if [ -n "$LINE" ] ; then
if [ ${LINE:0:1} != "#" ]; then
BINPATH=`echo $LINE | awk -F '^' '{printf $1}'`
BINPATH=`echo "$BINPATH" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BINPATH
BIN=`echo $LINE | awk -F '^' '{printf $2}'`
BIN=`echo "$BIN" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $BIN
SPECIAL=`echo $LINE | awk -F '^' '{printf $4}'`
SPECIAL=`echo "$SPECIAL" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SPECIAL
SLEEPSEC=`echo $LINE | awk -F '^' '{printf $5}'`
SLEEPSEC=`echo "$SLEEPSEC" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $SLEEPSEC
STARTFLAG=`echo $LINE | awk -F '^' '{printf $7}'`
STARTFLAG=`echo "$STARTFLAG" | grep -o "[^ ]\+\( \+[^ ]\+\)*"`
# echo $STARTFLAG
if [ "`echo $STARTFLAG`" != "IGNORE_START" ]; then
# echo ""
# echo "" >>"$LOGFILE"
CMD_STR=" ps -w | grep `echo "'"``echo $BIN``echo "'"` | grep -v 'grep'"
BIN2=`echo $BIN`
BIN3=`echo $BIN |awk '{print$1}'`
# CMD_STR="killall `echo $BIN | awk '{print$1}'` 2>&1 "
PIDSTR=`ps -ef | grep "$BIN2" | grep -v 'grep'`
if [ -n "$PIDSTR" ] ; then
if [ "$BIN3" == "fe_main" ]; then
CMD_STR=" sleep 3 "
echo "$CMD_STR"
echo "$CMD_STR" >>"$LOGFILE"
$CMD_STR
fi
CMD_STR="kill -15 `echo $PIDSTR | awk '{print$2}'` "
echo " Kill process: \"$BIN\" with PID `echo $PIDSTR | awk '{print$2}'`"
echo " Kill process: \"$BIN\" with PID `echo $PIDSTR | awk '{print$2}'`" >>"$LOGFILE"
echo " Executing: $CMD_STR"
echo " Executing: $CMD_STR" >>"$LOGFILE"
CMD_RESULT=`$CMD_STR`
if [ -n "$CMD_RESULT" ] ; then
echo "$CMD_RESULT"
echo "$CMD_RESULT" >>"$LOGFILE"
fi
else
echo " Process \"$BIN\" not running."
fi
fi
fi
fi
done < /tmp/runtime.cf
DT=`date "+%F %R:%S.%N"`
echo "****** ${DT:0:23} Stop Processes Succcessfully ******"
echo "" >>"$LOGFILE"
echo "****** ${DT:0:23} Stop Processes Succcessfully ******" >>"$LOGFILE"

View File

@@ -0,0 +1,60 @@
#!/bin/bash
TARGET="cloud-front"
SRC_DIR="./code"
LIB_DIR="./lib"
OUT_DIR="./bin"
# 创建输出目录
mkdir -p "$OUT_DIR"
# 源文件,所有主 cpp 文件
SRC="$SRC_DIR/main.cpp \
$SRC_DIR/worker.cpp \
$SRC_DIR/log4.cpp \
$SRC_DIR/cfg_parser.cpp \
$SRC_DIR/interface.cpp \
$SRC_DIR/rocketmq.cpp \
$SRC_DIR/tinyxml2.cpp"
INCLUDE_DIRS="-I$SRC_DIR \
-I$SRC_DIR/nlohmann \
-I$SRC_DIR/curl \
-I$SRC_DIR/log4cplus \
-I$SRC_DIR/rocketmq \
-I$SRC_DIR" # tinyxml2.h 所在目录
LIB_DIRS="-L$LIB_DIR -L/usr/lib64 -L/usr/local/lib"
LIBS="-lcurl -lssl -lcrypto \
-lpthread -ldl -lrt \
-llog4cplus \
-lstdc++fs \
-lz"
# 如果有静态 rocketmq 库就加上
if [ -f "$LIB_DIR/librocketmq.a" ]; then
LIBS="$LIB_DIR/librocketmq.a $LIBS"
fi
# 判断是否为 debug 版本
if [[ "$1" == "debug" ]]; then
CXXFLAGS="-std=c++11 -g -O0"
TARGET="${TARGET}d"
echo "🟢 编译调试版本 (-g -O0)"
else
CXXFLAGS="-std=c++11 -O2 -static-libstdc++ -static-libgcc"
echo "🔵 编译正式版本 (-O2 -static)"
fi
# 编译命令
g++ $CXXFLAGS $SRC $INCLUDE_DIRS $LIB_DIRS $LIBS -o "$OUT_DIR/$TARGET"
# 编译结果检查
if [ $? -eq 0 ]; then
echo "✅ 编译成功,生成可执行文件: $OUT_DIR/$TARGET"
echo "🔍 依赖库检查:"
ldd "$OUT_DIR/$TARGET" || echo "是静态编译程序 ✔"
else
echo "❌ 编译失败"
fi

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,663 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# include/curl/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/curl
pkglibdir = $(libdir)/curl
pkglibexecdir = $(libexecdir)/curl
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-pc-linux-gnu
host_triplet = x86_64-pc-linux-gnu
subdir = include/curl
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/curl-amissl.m4 \
$(top_srcdir)/m4/curl-bearssl.m4 \
$(top_srcdir)/m4/curl-compilers.m4 \
$(top_srcdir)/m4/curl-confopts.m4 \
$(top_srcdir)/m4/curl-functions.m4 \
$(top_srcdir)/m4/curl-gnutls.m4 \
$(top_srcdir)/m4/curl-mbedtls.m4 \
$(top_srcdir)/m4/curl-openssl.m4 \
$(top_srcdir)/m4/curl-override.m4 \
$(top_srcdir)/m4/curl-reentrant.m4 \
$(top_srcdir)/m4/curl-rustls.m4 \
$(top_srcdir)/m4/curl-schannel.m4 \
$(top_srcdir)/m4/curl-sectransp.m4 \
$(top_srcdir)/m4/curl-sysconfig.m4 \
$(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/xc-am-iface.m4 \
$(top_srcdir)/m4/xc-cc-check.m4 \
$(top_srcdir)/m4/xc-lt-iface.m4 \
$(top_srcdir)/m4/xc-val-flgs.m4 \
$(top_srcdir)/m4/zz40-xc-ovr.m4 \
$(top_srcdir)/m4/zz50-xc-ovr.m4 \
$(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/lib/curl_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_$(V))
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgincludedir)"
HEADERS = $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = $(includedir)/curl
ACLOCAL = ${SHELL} '/home/pq/ToolProject/src/curl-8.12.1/missing' aclocal-1.16
AMTAR = $${TAR-tar}
AM_DEFAULT_VERBOSITY = 0
APXS =
AR = /opt/rh/devtoolset-8/root/usr/bin/ar
AR_FLAGS = cr
AS = as
AUTOCONF = ${SHELL} '/home/pq/ToolProject/src/curl-8.12.1/missing' autoconf
AUTOHEADER = ${SHELL} '/home/pq/ToolProject/src/curl-8.12.1/missing' autoheader
AUTOMAKE = ${SHELL} '/home/pq/ToolProject/src/curl-8.12.1/missing' automake-1.16
AWK = gawk
BLANK_AT_MAKETIME =
CADDY = /usr/bin/caddy
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
CFLAG_CURL_SYMBOL_HIDING = -fvisibility=hidden
CONFIGURE_OPTIONS = " '--with-ssl' '--without-libpsl'"
CPP = gcc -E
CPPFLAGS = -D_GNU_SOURCE
CSCOPE = cscope
CTAGS = ctags
CURLVERSION = 8.12.1
CURL_CA_BUNDLE = /etc/pki/tls/certs/ca-bundle.crt
CURL_CA_EMBED =
CURL_CFLAG_EXTRAS =
CURL_CPP = gcc -E -D_GNU_SOURCE
CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX =
CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME = 4
CURL_NETWORK_AND_TIME_LIBS =
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = false
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /usr/bin/grep -E
ENABLE_SHARED = yes
ENABLE_STATIC = yes
ETAGS = etags
EXEEXT =
FGREP = /usr/bin/grep -F
FILECMD = file
FISH_FUNCTIONS_DIR =
GCOV =
GREP = /usr/bin/grep
HAVE_LIBZ = 1
HTTPD =
HTTPD_NGHTTPX =
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LCOV =
LD = /opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld -m elf_x86_64
LDFLAGS =
LIBCURL_PC_CFLAGS =
LIBCURL_PC_CFLAGS_PRIVATE = -DCURL_STATICLIB
LIBCURL_PC_LDFLAGS_PRIVATE =
LIBCURL_PC_LIBS =
LIBCURL_PC_LIBS_PRIVATE = -lssl -lcrypto -lz -pthread
LIBCURL_PC_REQUIRES =
LIBCURL_PC_REQUIRES_PRIVATE = zlib,openssl
LIBOBJS =
LIBS = -lssl -lcrypto -lz
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLIBOBJS =
LT_SYS_LIBRARY_PATH =
MAINT = #
MAKEINFO = ${SHELL} '/home/pq/ToolProject/src/curl-8.12.1/missing' makeinfo
MANIFEST_TOOL = :
MKDIR_P = /usr/bin/mkdir -p
NM = /opt/rh/devtoolset-8/root/usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OTOOL =
OTOOL64 =
PACKAGE = curl
PACKAGE_BUGREPORT = a suitable curl mailing list: https://curl.se/mail/
PACKAGE_NAME = curl
PACKAGE_STRING = curl -
PACKAGE_TARNAME = curl
PACKAGE_URL =
PACKAGE_VERSION = -
PATH_SEPARATOR = :
PERL = /usr/bin/perl
PKGCONFIG = no
RANLIB = ranlib
RC =
SED = /usr/bin/sed
SET_MAKE =
SHELL = /bin/sh
SSL_BACKENDS = OpenSSL
STRIP = strip
SUPPORT_FEATURES = alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP UnixSockets
SUPPORT_PROTOCOLS = DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS IPFS IPNS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP WS WSS
TEST_NGHTTPX = nghttpx
VERSION = -
VERSIONNUM = 080c01
VSFTPD = /usr/sbin/vsftpd
ZLIB_LIBS = -lz
ZSH_FUNCTIONS_DIR =
abs_builddir = /home/pq/ToolProject/src/curl-8.12.1/include/curl
abs_srcdir = /home/pq/ToolProject/src/curl-8.12.1/include/curl
abs_top_builddir = /home/pq/ToolProject/src/curl-8.12.1
abs_top_srcdir = /home/pq/ToolProject/src/curl-8.12.1
ac_ct_AR =
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = $${TAR-tar} chof - "$$tardir"
am__untar = $${TAR-tar} xf -
bindir = ${exec_prefix}/bin
build = x86_64-pc-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = pc
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-pc-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = pc
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /home/pq/ToolProject/src/curl-8.12.1/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
libext = a
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = $(MKDIR_P)
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
runstatedir = ${localstatedir}/run
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../../
top_builddir = ../..
top_srcdir = ../..
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
pkginclude_HEADERS = \
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
typecheck-gcc.h system.h urlapi.h options.h header.h websockets.h
CHECKSRC = $(CS_$(V))
CS_0 = @echo " RUN " $@;
CS_1 =
CS_ = $(CS_0)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/curl/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu include/curl/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: # $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-local:
all-am: Makefile $(HEADERS) all-local
installdirs:
for dir in "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \
clean-generic clean-libtool cscopelist-am ctags ctags-am \
distclean distclean-generic distclean-libtool distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgincludeHEADERS \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-pkgincludeHEADERS
.PRECIOUS: Makefile
checksrc:
$(CHECKSRC)/usr/bin/perl $(top_srcdir)/scripts/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
# for debug builds, we scan the sources on all regular make invokes
#all-local: checksrc
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,41 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
pkginclude_HEADERS = \
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
typecheck-gcc.h system.h urlapi.h options.h header.h websockets.h
pkgincludedir= $(includedir)/curl
CHECKSRC = $(CS_$(V))
CS_0 = @echo " RUN " $@;
CS_1 =
CS_ = $(CS_0)
checksrc:
$(CHECKSRC)@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
if DEBUGBUILD
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif

View File

@@ -0,0 +1,663 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = include/curl
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/curl-amissl.m4 \
$(top_srcdir)/m4/curl-bearssl.m4 \
$(top_srcdir)/m4/curl-compilers.m4 \
$(top_srcdir)/m4/curl-confopts.m4 \
$(top_srcdir)/m4/curl-functions.m4 \
$(top_srcdir)/m4/curl-gnutls.m4 \
$(top_srcdir)/m4/curl-mbedtls.m4 \
$(top_srcdir)/m4/curl-openssl.m4 \
$(top_srcdir)/m4/curl-override.m4 \
$(top_srcdir)/m4/curl-reentrant.m4 \
$(top_srcdir)/m4/curl-rustls.m4 \
$(top_srcdir)/m4/curl-schannel.m4 \
$(top_srcdir)/m4/curl-sectransp.m4 \
$(top_srcdir)/m4/curl-sysconfig.m4 \
$(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/xc-am-iface.m4 \
$(top_srcdir)/m4/xc-cc-check.m4 \
$(top_srcdir)/m4/xc-lt-iface.m4 \
$(top_srcdir)/m4/xc-val-flgs.m4 \
$(top_srcdir)/m4/zz40-xc-ovr.m4 \
$(top_srcdir)/m4/zz50-xc-ovr.m4 \
$(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/lib/curl_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgincludedir)"
HEADERS = $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = $(includedir)/curl
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APXS = @APXS@
AR = @AR@
AR_FLAGS = @AR_FLAGS@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@
CADDY = @CADDY@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CURLVERSION = @CURLVERSION@
CURL_CA_BUNDLE = @CURL_CA_BUNDLE@
CURL_CA_EMBED = @CURL_CA_EMBED@
CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@
CURL_CPP = @CURL_CPP@
CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX = @CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX@
CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME = @CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME@
CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_SHARED = @ENABLE_SHARED@
ENABLE_STATIC = @ENABLE_STATIC@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
GCOV = @GCOV@
GREP = @GREP@
HAVE_LIBZ = @HAVE_LIBZ@
HTTPD = @HTTPD@
HTTPD_NGHTTPX = @HTTPD_NGHTTPX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBCURL_PC_CFLAGS = @LIBCURL_PC_CFLAGS@
LIBCURL_PC_CFLAGS_PRIVATE = @LIBCURL_PC_CFLAGS_PRIVATE@
LIBCURL_PC_LDFLAGS_PRIVATE = @LIBCURL_PC_LDFLAGS_PRIVATE@
LIBCURL_PC_LIBS = @LIBCURL_PC_LIBS@
LIBCURL_PC_LIBS_PRIVATE = @LIBCURL_PC_LIBS_PRIVATE@
LIBCURL_PC_REQUIRES = @LIBCURL_PC_REQUIRES@
LIBCURL_PC_REQUIRES_PRIVATE = @LIBCURL_PC_REQUIRES_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKGCONFIG = @PKGCONFIG@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SSL_BACKENDS = @SSL_BACKENDS@
STRIP = @STRIP@
SUPPORT_FEATURES = @SUPPORT_FEATURES@
SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@
TEST_NGHTTPX = @TEST_NGHTTPX@
VERSION = @VERSION@
VERSIONNUM = @VERSIONNUM@
VSFTPD = @VSFTPD@
ZLIB_LIBS = @ZLIB_LIBS@
ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libext = @libext@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
pkginclude_HEADERS = \
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
typecheck-gcc.h system.h urlapi.h options.h header.h websockets.h
CHECKSRC = $(CS_$(V))
CS_0 = @echo " RUN " $@;
CS_1 =
CS_ = $(CS_0)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/curl/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu include/curl/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
@DEBUGBUILD_FALSE@all-local:
all-am: Makefile $(HEADERS) all-local
installdirs:
for dir in "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \
clean-generic clean-libtool cscopelist-am ctags ctags-am \
distclean distclean-generic distclean-libtool distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgincludeHEADERS \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-pkgincludeHEADERS
.PRECIOUS: Makefile
checksrc:
$(CHECKSRC)@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
# for debug builds, we scan the sources on all regular make invokes
@DEBUGBUILD_TRUE@all-local: checksrc
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
#ifndef CURLINC_CURLVER_H
#define CURLINC_CURLVER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* This header file contains nothing but libcurl version info, generated by
a script at release-time. This was made its own header file in 7.11.2 */
/* This is the global package copyright */
#define LIBCURL_COPYRIGHT "Daniel Stenberg, <daniel@haxx.se>."
/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "8.12.1"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 8
#define LIBCURL_VERSION_MINOR 12
#define LIBCURL_VERSION_PATCH 1
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax:
0xXXYYZZ
Where XX, YY and ZZ are the main version, release and patch numbers in
hexadecimal (using 8 bits each). All three numbers are always represented
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
appears as "0x090b07".
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
Note: This define is the full hex number and _does not_ use the
CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
#define LIBCURL_VERSION_NUM 0x080c01
/*
* This is the date and time when the full source package was created. The
* timestamp is not stored in git, as the timestamp is properly set in the
* tarballs by the maketgz script.
*
* The format of the date follows this template:
*
* "2007-11-23"
*/
#define LIBCURL_TIMESTAMP "2025-02-13"
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
#define CURL_AT_LEAST_VERSION(x,y,z) \
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
#endif /* CURLINC_CURLVER_H */

View File

@@ -0,0 +1,125 @@
#ifndef CURLINC_EASY_H
#define CURLINC_EASY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/* Flag bits in the curl_blob struct: */
#define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */
#define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */
struct curl_blob {
void *data;
size_t len;
unsigned int flags; /* bit 0 is defined, the rest are reserved and should be
left zeroes */
};
CURL_EXTERN CURL *curl_easy_init(void);
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
/*
* NAME curl_easy_getinfo()
*
* DESCRIPTION
*
* Request internal information from the curl session with this function.
* The third argument MUST be pointing to the specific type of the used option
* which is documented in each manpage of the option. The data pointed to
* will be filled in accordingly and can be relied upon only if the function
* returns CURLE_OK. This function is intended to get used *AFTER* a performed
* transfer, all results from this function are undefined until the transfer
* is completed.
*/
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
/*
* NAME curl_easy_duphandle()
*
* DESCRIPTION
*
* Creates a new curl session handle with the same options set for the handle
* passed in. Duplicating a handle could only be a matter of cloning data and
* options, internal state info and things like persistent connections cannot
* be transferred. It is useful in multithreaded applications when you can run
* curl_easy_duphandle() for each new thread to avoid a series of identical
* curl_easy_setopt() invokes in every thread.
*/
CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
/*
* NAME curl_easy_reset()
*
* DESCRIPTION
*
* Re-initializes a curl handle to the default values. This puts back the
* handle to the same state as it was in when it was just created.
*
* It does keep: live connections, the Session ID cache, the DNS cache and the
* cookies.
*/
CURL_EXTERN void curl_easy_reset(CURL *curl);
/*
* NAME curl_easy_recv()
*
* DESCRIPTION
*
* Receives data from the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
size_t *n);
/*
* NAME curl_easy_send()
*
* DESCRIPTION
*
* Sends data over the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
size_t buflen, size_t *n);
/*
* NAME curl_easy_upkeep()
*
* DESCRIPTION
*
* Performs connection upkeep for the given session handle.
*/
CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif

View File

@@ -0,0 +1,74 @@
#ifndef CURLINC_HEADER_H
#define CURLINC_HEADER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
struct curl_header {
char *name; /* this might not use the same case */
char *value;
size_t amount; /* number of headers using this name */
size_t index; /* ... of this instance, 0 or higher */
unsigned int origin; /* see bits below */
void *anchor; /* handle privately used by libcurl */
};
/* 'origin' bits */
#define CURLH_HEADER (1<<0) /* plain server header */
#define CURLH_TRAILER (1<<1) /* trailers */
#define CURLH_CONNECT (1<<2) /* CONNECT headers */
#define CURLH_1XX (1<<3) /* 1xx headers */
#define CURLH_PSEUDO (1<<4) /* pseudo headers */
typedef enum {
CURLHE_OK,
CURLHE_BADINDEX, /* header exists but not with this index */
CURLHE_MISSING, /* no such header exists */
CURLHE_NOHEADERS, /* no headers at all exist (yet) */
CURLHE_NOREQUEST, /* no request with this number was used */
CURLHE_OUT_OF_MEMORY, /* out of memory while processing */
CURLHE_BAD_ARGUMENT, /* a function argument was not okay */
CURLHE_NOT_BUILT_IN /* if API was disabled in the build */
} CURLHcode;
CURL_EXTERN CURLHcode curl_easy_header(CURL *easy,
const char *name,
size_t index,
unsigned int origin,
int request,
struct curl_header **hout);
CURL_EXTERN struct curl_header *curl_easy_nextheader(CURL *easy,
unsigned int origin,
int request,
struct curl_header *prev);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* CURLINC_HEADER_H */

View File

@@ -0,0 +1,85 @@
#ifndef CURLINC_MPRINTF_H
#define CURLINC_MPRINTF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include <stdarg.h>
#include <stdio.h> /* needed for FILE */
#include "curl.h" /* for CURL_EXTERN */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CURL_TEMP_PRINTF
#if (defined(__GNUC__) || defined(__clang__) || \
defined(__IAR_SYSTEMS_ICC__)) && \
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
!defined(CURL_NO_FMT_CHECKS)
#if defined(__MINGW32__) && !defined(__clang__)
#if defined(__MINGW_PRINTF_FORMAT) /* mingw-w64 3.0.0+. Needs stdio.h. */
#define CURL_TEMP_PRINTF(fmt, arg) \
__attribute__((format(__MINGW_PRINTF_FORMAT, fmt, arg)))
#else
#define CURL_TEMP_PRINTF(fmt, arg)
#endif
#else
#define CURL_TEMP_PRINTF(fmt, arg) \
__attribute__((format(printf, fmt, arg)))
#endif
#else
#define CURL_TEMP_PRINTF(fmt, arg)
#endif
#endif
CURL_EXTERN int curl_mprintf(const char *format, ...)
CURL_TEMP_PRINTF(1, 2);
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...)
CURL_TEMP_PRINTF(2, 3);
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...)
CURL_TEMP_PRINTF(2, 3);
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
const char *format, ...)
CURL_TEMP_PRINTF(3, 4);
CURL_EXTERN int curl_mvprintf(const char *format, va_list args)
CURL_TEMP_PRINTF(1, 0);
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args)
CURL_TEMP_PRINTF(2, 0);
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args)
CURL_TEMP_PRINTF(2, 0);
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
const char *format, va_list args)
CURL_TEMP_PRINTF(3, 0);
CURL_EXTERN char *curl_maprintf(const char *format, ...)
CURL_TEMP_PRINTF(1, 2);
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args)
CURL_TEMP_PRINTF(1, 0);
#undef CURL_TEMP_PRINTF
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* CURLINC_MPRINTF_H */

View File

@@ -0,0 +1,481 @@
#ifndef CURLINC_MULTI_H
#define CURLINC_MULTI_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
This is an "external" header file. Do not give away any internals here!
GOALS
o Enable a "pull" interface. The application that uses libcurl decides where
and when to ask libcurl to get/send data.
o Enable multiple simultaneous transfers in the same thread without making it
complicated for the application.
o Enable the application to select() on its own file descriptors and curl's
file descriptors simultaneous easily.
*/
/*
* This header file should not really need to include "curl.h" since curl.h
* itself includes this file and we expect user applications to do #include
* <curl/curl.h> without the need for especially including multi.h.
*
* For some reason we added this include here at one point, and rather than to
* break existing (wrongly written) libcurl applications, we leave it as-is
* but with this warning attached.
*/
#include "curl.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void CURLM;
typedef enum {
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
curl_multi_socket*() soon */
CURLM_OK,
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
CURLM_OUT_OF_MEMORY, /* if you ever get this, you are in deep sh*t */
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
attempted to get added - again */
CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
callback */
CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */
CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */
CURLM_ABORTED_BY_CALLBACK,
CURLM_UNRECOVERABLE_POLL,
CURLM_LAST
} CURLMcode;
/* just to make code nicer when using curl_multi_socket() you can now check
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
/* bitmask bits for CURLMOPT_PIPELINING */
#define CURLPIPE_NOTHING 0L
#define CURLPIPE_HTTP1 1L
#define CURLPIPE_MULTIPLEX 2L
typedef enum {
CURLMSG_NONE, /* first, not used */
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
the CURLcode of the transfer */
CURLMSG_LAST /* last, not used */
} CURLMSG;
struct CURLMsg {
CURLMSG msg; /* what this message means */
CURL *easy_handle; /* the handle it concerns */
union {
void *whatever; /* message-specific data */
CURLcode result; /* return code for transfer */
} data;
};
typedef struct CURLMsg CURLMsg;
/* Based on poll(2) structure and values.
* We do not use pollfd and POLL* constants explicitly
* to cover platforms without poll(). */
#define CURL_WAIT_POLLIN 0x0001
#define CURL_WAIT_POLLPRI 0x0002
#define CURL_WAIT_POLLOUT 0x0004
struct curl_waitfd {
curl_socket_t fd;
short events;
short revents;
};
/*
* Name: curl_multi_init()
*
* Desc: initialize multi-style curl usage
*
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
*/
CURL_EXTERN CURLM *curl_multi_init(void);
/*
* Name: curl_multi_add_handle()
*
* Desc: add a standard curl handle to the multi stack
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
CURL *curl_handle);
/*
* Name: curl_multi_remove_handle()
*
* Desc: removes a curl handle from the multi stack again
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
CURL *curl_handle);
/*
* Name: curl_multi_fdset()
*
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
* poll() on. We want curl_multi_perform() called as soon as one of
* them are ready.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
fd_set *read_fd_set,
fd_set *write_fd_set,
fd_set *exc_fd_set,
int *max_fd);
/*
* Name: curl_multi_wait()
*
* Desc: Poll on all fds within a CURLM set as well as any
* additional fds passed to the function.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
int timeout_ms,
int *ret);
/*
* Name: curl_multi_poll()
*
* Desc: Poll on all fds within a CURLM set as well as any
* additional fds passed to the function.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
int timeout_ms,
int *ret);
/*
* Name: curl_multi_wakeup()
*
* Desc: wakes up a sleeping curl_multi_poll call.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);
/*
* Name: curl_multi_perform()
*
* Desc: When the app thinks there is data available for curl it calls this
* function to read/write whatever there is right now. This returns
* as soon as the reads and writes are done. This function does not
* require that there actually is data available for reading or that
* data can be written, it can be called just in case. It returns
* the number of handles that still transfer data in the second
* argument's integer-pointer.
*
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
* returns errors etc regarding the whole multi stack. There might
* still have occurred problems on individual transfers even when
* this returns OK.
*/
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
int *running_handles);
/*
* Name: curl_multi_cleanup()
*
* Desc: Cleans up and removes a whole multi stack. It does not free or
* touch any individual easy handles in any way. We need to define
* in what state those handles will be if this function is called
* in the middle of a transfer.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
/*
* Name: curl_multi_info_read()
*
* Desc: Ask the multi handle if there is any messages/informationals from
* the individual transfers. Messages include informationals such as
* error code from the transfer or just the fact that a transfer is
* completed. More details on these should be written down as well.
*
* Repeated calls to this function will return a new struct each
* time, until a special "end of msgs" struct is returned as a signal
* that there is no more to get at this point.
*
* The data the returned pointer points to will not survive calling
* curl_multi_cleanup().
*
* The 'CURLMsg' struct is meant to be simple and only contain basic
* information. If more involved information is wanted, we will
* provide the particular "transfer handle" in that struct and that
* should/could/would be used in subsequent curl_easy_getinfo() calls
* (or similar). The point being that we must never expose complex
* structs to applications, as then we will undoubtably get backwards
* compatibility problems in the future.
*
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
* of structs. It also writes the number of messages left in the
* queue (after this read) in the integer the second argument points
* to.
*/
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
int *msgs_in_queue);
/*
* Name: curl_multi_strerror()
*
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
* value into the equivalent human readable error string. This is
* useful for printing meaningful error messages.
*
* Returns: A pointer to a null-terminated error message.
*/
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
/*
* Name: curl_multi_socket() and
* curl_multi_socket_all()
*
* Desc: An alternative version of curl_multi_perform() that allows the
* application to pass in one of the file descriptors that have been
* detected to have "action" on them and let libcurl perform.
* See manpage for details.
*/
#define CURL_POLL_NONE 0
#define CURL_POLL_IN 1
#define CURL_POLL_OUT 2
#define CURL_POLL_INOUT 3
#define CURL_POLL_REMOVE 4
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
#define CURL_CSELECT_IN 0x01
#define CURL_CSELECT_OUT 0x02
#define CURL_CSELECT_ERR 0x04
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
int what, /* see above */
void *userp, /* private callback
pointer */
void *socketp); /* private socket
pointer */
/*
* Name: curl_multi_timer_callback
*
* Desc: Called by libcurl whenever the library detects a change in the
* maximum number of milliseconds the app is allowed to wait before
* curl_multi_socket() or curl_multi_perform() must be called
* (to allow libcurl's timed events to take place).
*
* Returns: The callback should return zero.
*/
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
long timeout_ms, /* see above */
void *userp); /* private callback
pointer */
CURL_EXTERN CURLMcode CURL_DEPRECATED(7.19.5, "Use curl_multi_socket_action()")
curl_multi_socket(CURLM *multi_handle, curl_socket_t s, int *running_handles);
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
curl_socket_t s,
int ev_bitmask,
int *running_handles);
CURL_EXTERN CURLMcode CURL_DEPRECATED(7.19.5, "Use curl_multi_socket_action()")
curl_multi_socket_all(CURLM *multi_handle, int *running_handles);
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
/* This macro below was added in 7.16.3 to push users who recompile to use
the new curl_multi_socket_action() instead of the old curl_multi_socket()
*/
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
#endif
/*
* Name: curl_multi_timeout()
*
* Desc: Returns the maximum number of milliseconds the app is allowed to
* wait before curl_multi_socket() or curl_multi_perform() must be
* called (to allow libcurl's timed events to take place).
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
long *milliseconds);
typedef enum {
/* This is the socket callback function pointer */
CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1),
/* This is the argument passed to the socket callback */
CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2),
/* set to 1 to enable pipelining for this multi handle */
CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3),
/* This is the timer callback function pointer */
CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4),
/* This is the argument passed to the timer callback */
CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5),
/* maximum number of entries in the connection cache */
CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6),
/* maximum number of (pipelining) connections to one host */
CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7),
/* maximum number of requests in a pipeline */
CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8),
/* a connection with a content-length longer than this
will not be considered for pipelining */
CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9),
/* a connection with a chunk length longer than this
will not be considered for pipelining */
CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10),
/* a list of site names(+port) that are blocked from pipelining */
CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11),
/* a list of server types that are blocked from pipelining */
CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12),
/* maximum number of open connections in total */
CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13),
/* This is the server push callback function pointer */
CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14),
/* This is the argument passed to the server push callback */
CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15),
/* maximum number of concurrent streams to support on a connection */
CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),
CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;
/*
* Name: curl_multi_setopt()
*
* Desc: Sets options for the multi handle.
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
CURLMoption option, ...);
/*
* Name: curl_multi_assign()
*
* Desc: This function sets an association in the multi handle between the
* given socket and a private pointer of the application. This is
* (only) useful for curl_multi_socket uses.
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
curl_socket_t sockfd, void *sockp);
/*
* Name: curl_multi_get_handles()
*
* Desc: Returns an allocated array holding all handles currently added to
* the multi handle. Marks the final entry with a NULL pointer. If
* there is no easy handle added to the multi handle, this function
* returns an array with the first entry as a NULL pointer.
*
* Returns: NULL on failure, otherwise a CURL **array pointer
*/
CURL_EXTERN CURL **curl_multi_get_handles(CURLM *multi_handle);
/*
* Name: curl_push_callback
*
* Desc: This callback gets called when a new stream is being pushed by the
* server. It approves or denies the new stream. It can also decide
* to completely fail the connection.
*
* Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT
*/
#define CURL_PUSH_OK 0
#define CURL_PUSH_DENY 1
#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */
struct curl_pushheaders; /* forward declaration only */
CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
size_t num);
CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
const char *name);
typedef int (*curl_push_callback)(CURL *parent,
CURL *easy,
size_t num_headers,
struct curl_pushheaders *headers,
void *userp);
/*
* Name: curl_multi_waitfds()
*
* Desc: Ask curl for fds for polling. The app can use these to poll on.
* We want curl_multi_perform() called as soon as one of them are
* ready. Passing zero size allows to get just a number of fds.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_waitfds(CURLM *multi,
struct curl_waitfd *ufds,
unsigned int size,
unsigned int *fd_count);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif

View File

@@ -0,0 +1,70 @@
#ifndef CURLINC_OPTIONS_H
#define CURLINC_OPTIONS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
CURLOT_LONG, /* long (a range of values) */
CURLOT_VALUES, /* (a defined set or bitmask) */
CURLOT_OFF_T, /* curl_off_t (a range of values) */
CURLOT_OBJECT, /* pointer (void *) */
CURLOT_STRING, /* (char * to null-terminated buffer) */
CURLOT_SLIST, /* (struct curl_slist *) */
CURLOT_CBPTR, /* (void * passed as-is to a callback) */
CURLOT_BLOB, /* blob (struct curl_blob *) */
CURLOT_FUNCTION /* function pointer */
} curl_easytype;
/* Flag bits */
/* "alias" means it is provided for old programs to remain functional,
we prefer another name */
#define CURLOT_FLAG_ALIAS (1<<0)
/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
to use for curl_easy_setopt() for the given id */
struct curl_easyoption {
const char *name;
CURLoption id;
curl_easytype type;
unsigned int flags;
};
CURL_EXTERN const struct curl_easyoption *
curl_easy_option_by_name(const char *name);
CURL_EXTERN const struct curl_easyoption *
curl_easy_option_by_id(CURLoption id);
CURL_EXTERN const struct curl_easyoption *
curl_easy_option_next(const struct curl_easyoption *prev);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* CURLINC_OPTIONS_H */

View File

@@ -0,0 +1,35 @@
#ifndef CURLINC_STDCHEADERS_H
#define CURLINC_STDCHEADERS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include <sys/types.h>
size_t fread(void *, size_t, size_t, FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
#endif /* CURLINC_STDCHEADERS_H */

View File

@@ -0,0 +1,440 @@
#ifndef CURLINC_SYSTEM_H
#define CURLINC_SYSTEM_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
* Try to keep one section per platform, compiler and architecture, otherwise,
* if an existing section is reused for a different one and later on the
* original is adjusted, probably the piggybacking one can be adversely
* changed.
*
* In order to differentiate between platforms/compilers/architectures use
* only compiler built-in predefined preprocessor symbols.
*
* curl_off_t
* ----------
*
* For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
* wide signed integral data type. The width of this data type must remain
* constant and independent of any possible large file support settings.
*
* As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
* wide signed integral data type if there is no 64-bit type.
*
* As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
* only be violated if off_t is the only 64-bit data type available and the
* size of off_t is independent of large file support settings. Keep your
* build on the safe side avoiding an off_t gating. If you have a 64-bit
* off_t then take for sure that another 64-bit data type exists, dig deeper
* and you will find it.
*
*/
#if defined(__DJGPP__)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__BORLANDC__)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__POCC__)
# if defined(_MSC_VER)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__LCC__)
# if defined(__MCST__) /* MCST eLbrus Compiler Collection */
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# else /* Local (or Little) C Compiler */
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# endif
#elif defined(macintosh)
# include <ConditionalMacros.h>
# if TYPE_LONGLONG
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
#elif defined(__TANDEM)
# if !defined(__LP64)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
# endif
#elif defined(_WIN32_WCE)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__MINGW32__)
# include <inttypes.h>
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T PRId64
# define CURL_FORMAT_CURL_OFF_TU PRIu64
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_PULL_SYS_TYPES_H 1
#elif defined(__VMS)
# if defined(__VAX)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
#elif defined(__OS400__)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#elif defined(__MVS__)
# if defined(_LONG_LONG)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# else /* _LP64 and default */
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#elif defined(__370__)
# if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_LONG_LONG)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# else /* _LP64 and default */
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# endif
#elif defined(TPF)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__TINYC__) /* also known as tcc */
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */
# if !defined(__LP64) && (defined(__ILP32) || \
defined(__i386) || \
defined(__sparcv8) || \
defined(__sparcv8plus))
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64) || \
defined(__amd64) || defined(__sparcv9)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#elif defined(__xlc__) /* IBM xlc compiler */
# if !defined(_LP64)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#elif defined(__hpux) /* HP aCC compiler */
# if !defined(_LP64)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
/* ===================================== */
/* KEEP MSVC THE PENULTIMATE ENTRY */
/* ===================================== */
#elif defined(_MSC_VER)
# if (_MSC_VER >= 1800)
# include <inttypes.h>
# define CURL_FORMAT_CURL_OFF_T PRId64
# define CURL_FORMAT_CURL_OFF_TU PRIu64
# else
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# endif
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# define CURL_TYPEOF_CURL_SOCKLEN_T int
/* ===================================== */
/* KEEP GENERIC GCC THE LAST ENTRY */
/* ===================================== */
#elif defined(__GNUC__) && !defined(_SCO_DS)
# if !defined(__LP64__) && \
(defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
defined(__XTENSA__) || \
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \
(defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
defined(__e2k__) || \
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
(defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#else
/* generic "safe guess" on old 32-bit style */
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#endif
#ifdef _AIX
/* AIX needs <sys/poll.h> */
#define CURL_PULL_SYS_POLL_H
#endif
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
/* sys/types.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_TYPES_H
# include <sys/types.h>
#endif
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
/* sys/socket.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_SOCKET_H
# include <sys/socket.h>
#endif
/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
/* sys/poll.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_POLL_H
# include <sys/poll.h>
#endif
/* Data type definition of curl_socklen_t. */
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
#endif
/* Data type definition of curl_off_t. */
#ifdef CURL_TYPEOF_CURL_OFF_T
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
#endif
/*
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
* these to be visible and exported by the external libcurl interface API,
* while also making them visible to the library internals, simply including
* curl_setup.h, without actually needing to include curl.h internally.
* If some day this section would grow big enough, all this should be moved
* to its own header file.
*/
/*
* Figure out if we can use the ## preprocessor operator, which is supported
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
* or __cplusplus so we need to carefully check for them too.
*/
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
defined(__POCC__) || defined(__HIGHC__) || \
defined(__ILEC400__)
/* This compiler is believed to have an ISO compatible preprocessor */
#define CURL_ISOCPP
#else
/* This compiler is believed NOT to have an ISO compatible preprocessor */
#undef CURL_ISOCPP
#endif
/*
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
*/
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
# define CURLINC_OFF_T_C_HLPR2(x) x
# define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x)
# define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
#else
# ifdef CURL_ISOCPP
# define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
# else
# define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
# endif
# define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix)
# define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
#endif
#endif /* CURLINC_SYSTEM_H */

View File

@@ -0,0 +1,718 @@
#ifndef CURLINC_TYPECHECK_GCC_H
#define CURLINC_TYPECHECK_GCC_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* wraps curl_easy_setopt() with typechecking */
/* To add a new kind of warning, add an
* if(curlcheck_sometype_option(_curl_opt))
* if(!curlcheck_sometype(value))
* _curl_easy_setopt_err_sometype();
* block and define curlcheck_sometype_option, curlcheck_sometype and
* _curl_easy_setopt_err_sometype below
*
* NOTE: We use two nested 'if' statements here instead of the && operator, in
* order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
* when compiling with -Wlogical-op.
*
* To add an option that uses the same type as an existing option, you will
* just need to extend the appropriate _curl_*_option macro
*/
#define curl_easy_setopt(handle, option, value) \
__extension__({ \
CURLoption _curl_opt = (option); \
if(__builtin_constant_p(_curl_opt)) { \
CURL_IGNORE_DEPRECATION( \
if(curlcheck_long_option(_curl_opt)) \
if(!curlcheck_long(value)) \
_curl_easy_setopt_err_long(); \
if(curlcheck_off_t_option(_curl_opt)) \
if(!curlcheck_off_t(value)) \
_curl_easy_setopt_err_curl_off_t(); \
if(curlcheck_string_option(_curl_opt)) \
if(!curlcheck_string(value)) \
_curl_easy_setopt_err_string(); \
if(curlcheck_write_cb_option(_curl_opt)) \
if(!curlcheck_write_cb(value)) \
_curl_easy_setopt_err_write_callback(); \
if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \
if(!curlcheck_resolver_start_callback(value)) \
_curl_easy_setopt_err_resolver_start_callback(); \
if((_curl_opt) == CURLOPT_READFUNCTION) \
if(!curlcheck_read_cb(value)) \
_curl_easy_setopt_err_read_cb(); \
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
if(!curlcheck_ioctl_cb(value)) \
_curl_easy_setopt_err_ioctl_cb(); \
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
if(!curlcheck_sockopt_cb(value)) \
_curl_easy_setopt_err_sockopt_cb(); \
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
if(!curlcheck_opensocket_cb(value)) \
_curl_easy_setopt_err_opensocket_cb(); \
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
if(!curlcheck_progress_cb(value)) \
_curl_easy_setopt_err_progress_cb(); \
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
if(!curlcheck_debug_cb(value)) \
_curl_easy_setopt_err_debug_cb(); \
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
if(!curlcheck_ssl_ctx_cb(value)) \
_curl_easy_setopt_err_ssl_ctx_cb(); \
if(curlcheck_conv_cb_option(_curl_opt)) \
if(!curlcheck_conv_cb(value)) \
_curl_easy_setopt_err_conv_cb(); \
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
if(!curlcheck_seek_cb(value)) \
_curl_easy_setopt_err_seek_cb(); \
if(curlcheck_cb_data_option(_curl_opt)) \
if(!curlcheck_cb_data(value)) \
_curl_easy_setopt_err_cb_data(); \
if((_curl_opt) == CURLOPT_ERRORBUFFER) \
if(!curlcheck_error_buffer(value)) \
_curl_easy_setopt_err_error_buffer(); \
if((_curl_opt) == CURLOPT_STDERR) \
if(!curlcheck_FILE(value)) \
_curl_easy_setopt_err_FILE(); \
if(curlcheck_postfields_option(_curl_opt)) \
if(!curlcheck_postfields(value)) \
_curl_easy_setopt_err_postfields(); \
if((_curl_opt) == CURLOPT_HTTPPOST) \
if(!curlcheck_arr((value), struct curl_httppost)) \
_curl_easy_setopt_err_curl_httpost(); \
if((_curl_opt) == CURLOPT_MIMEPOST) \
if(!curlcheck_ptr((value), curl_mime)) \
_curl_easy_setopt_err_curl_mimepost(); \
if(curlcheck_slist_option(_curl_opt)) \
if(!curlcheck_arr((value), struct curl_slist)) \
_curl_easy_setopt_err_curl_slist(); \
if((_curl_opt) == CURLOPT_SHARE) \
if(!curlcheck_ptr((value), CURLSH)) \
_curl_easy_setopt_err_CURLSH(); \
) \
} \
curl_easy_setopt(handle, _curl_opt, value); \
})
/* wraps curl_easy_getinfo() with typechecking */
#define curl_easy_getinfo(handle, info, arg) \
__extension__({ \
CURLINFO _curl_info = (info); \
if(__builtin_constant_p(_curl_info)) { \
CURL_IGNORE_DEPRECATION( \
if(curlcheck_string_info(_curl_info)) \
if(!curlcheck_arr((arg), char *)) \
_curl_easy_getinfo_err_string(); \
if(curlcheck_long_info(_curl_info)) \
if(!curlcheck_arr((arg), long)) \
_curl_easy_getinfo_err_long(); \
if(curlcheck_double_info(_curl_info)) \
if(!curlcheck_arr((arg), double)) \
_curl_easy_getinfo_err_double(); \
if(curlcheck_slist_info(_curl_info)) \
if(!curlcheck_arr((arg), struct curl_slist *)) \
_curl_easy_getinfo_err_curl_slist(); \
if(curlcheck_tlssessioninfo_info(_curl_info)) \
if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
_curl_easy_getinfo_err_curl_tlssesssioninfo(); \
if(curlcheck_certinfo_info(_curl_info)) \
if(!curlcheck_arr((arg), struct curl_certinfo *)) \
_curl_easy_getinfo_err_curl_certinfo(); \
if(curlcheck_socket_info(_curl_info)) \
if(!curlcheck_arr((arg), curl_socket_t)) \
_curl_easy_getinfo_err_curl_socket(); \
if(curlcheck_off_t_info(_curl_info)) \
if(!curlcheck_arr((arg), curl_off_t)) \
_curl_easy_getinfo_err_curl_off_t(); \
) \
} \
curl_easy_getinfo(handle, _curl_info, arg); \
})
/*
* For now, just make sure that the functions are called with three arguments
*/
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
* functions */
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
#define CURLWARNING(id, message) \
static void __attribute__((__warning__(message))) \
__attribute__((__unused__)) __attribute__((__noinline__)) \
id(void) { __asm__(""); }
CURLWARNING(_curl_easy_setopt_err_long,
"curl_easy_setopt expects a long argument for this option")
CURLWARNING(_curl_easy_setopt_err_curl_off_t,
"curl_easy_setopt expects a curl_off_t argument for this option")
CURLWARNING(_curl_easy_setopt_err_string,
"curl_easy_setopt expects a "
"string ('char *' or char[]) argument for this option"
)
CURLWARNING(_curl_easy_setopt_err_write_callback,
"curl_easy_setopt expects a curl_write_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_resolver_start_callback,
"curl_easy_setopt expects a "
"curl_resolver_start_callback argument for this option"
)
CURLWARNING(_curl_easy_setopt_err_read_cb,
"curl_easy_setopt expects a curl_read_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_ioctl_cb,
"curl_easy_setopt expects a curl_ioctl_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_sockopt_cb,
"curl_easy_setopt expects a curl_sockopt_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_opensocket_cb,
"curl_easy_setopt expects a "
"curl_opensocket_callback argument for this option"
)
CURLWARNING(_curl_easy_setopt_err_progress_cb,
"curl_easy_setopt expects a curl_progress_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_debug_cb,
"curl_easy_setopt expects a curl_debug_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb,
"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_conv_cb,
"curl_easy_setopt expects a curl_conv_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_seek_cb,
"curl_easy_setopt expects a curl_seek_callback argument for this option")
CURLWARNING(_curl_easy_setopt_err_cb_data,
"curl_easy_setopt expects a "
"private data pointer as argument for this option")
CURLWARNING(_curl_easy_setopt_err_error_buffer,
"curl_easy_setopt expects a "
"char buffer of CURL_ERROR_SIZE as argument for this option")
CURLWARNING(_curl_easy_setopt_err_FILE,
"curl_easy_setopt expects a 'FILE *' argument for this option")
CURLWARNING(_curl_easy_setopt_err_postfields,
"curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
CURLWARNING(_curl_easy_setopt_err_curl_httpost,
"curl_easy_setopt expects a 'struct curl_httppost *' "
"argument for this option")
CURLWARNING(_curl_easy_setopt_err_curl_mimepost,
"curl_easy_setopt expects a 'curl_mime *' "
"argument for this option")
CURLWARNING(_curl_easy_setopt_err_curl_slist,
"curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
CURLWARNING(_curl_easy_setopt_err_CURLSH,
"curl_easy_setopt expects a CURLSH* argument for this option")
CURLWARNING(_curl_easy_getinfo_err_string,
"curl_easy_getinfo expects a pointer to 'char *' for this info")
CURLWARNING(_curl_easy_getinfo_err_long,
"curl_easy_getinfo expects a pointer to long for this info")
CURLWARNING(_curl_easy_getinfo_err_double,
"curl_easy_getinfo expects a pointer to double for this info")
CURLWARNING(_curl_easy_getinfo_err_curl_slist,
"curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
"curl_easy_getinfo expects a pointer to "
"'struct curl_tlssessioninfo *' for this info")
CURLWARNING(_curl_easy_getinfo_err_curl_certinfo,
"curl_easy_getinfo expects a pointer to "
"'struct curl_certinfo *' for this info")
CURLWARNING(_curl_easy_getinfo_err_curl_socket,
"curl_easy_getinfo expects a pointer to curl_socket_t for this info")
CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
"curl_easy_getinfo expects a pointer to curl_off_t for this info")
/* groups of curl_easy_setops options that take the same type of argument */
/* To add a new option to one of the groups, just add
* (option) == CURLOPT_SOMETHING
* to the or-expression. If the option takes a long or curl_off_t, you do not
* have to do anything
*/
/* evaluates to true if option takes a long argument */
#define curlcheck_long_option(option) \
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
#define curlcheck_off_t_option(option) \
(((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))
/* evaluates to true if option takes a char* argument */
#define curlcheck_string_option(option) \
((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
(option) == CURLOPT_ACCEPT_ENCODING || \
(option) == CURLOPT_ALTSVC || \
(option) == CURLOPT_CAINFO || \
(option) == CURLOPT_CAPATH || \
(option) == CURLOPT_COOKIE || \
(option) == CURLOPT_COOKIEFILE || \
(option) == CURLOPT_COOKIEJAR || \
(option) == CURLOPT_COOKIELIST || \
(option) == CURLOPT_CRLFILE || \
(option) == CURLOPT_CUSTOMREQUEST || \
(option) == CURLOPT_DEFAULT_PROTOCOL || \
(option) == CURLOPT_DNS_INTERFACE || \
(option) == CURLOPT_DNS_LOCAL_IP4 || \
(option) == CURLOPT_DNS_LOCAL_IP6 || \
(option) == CURLOPT_DNS_SERVERS || \
(option) == CURLOPT_DOH_URL || \
(option) == CURLOPT_ECH || \
(option) == CURLOPT_EGDSOCKET || \
(option) == CURLOPT_FTP_ACCOUNT || \
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
(option) == CURLOPT_FTPPORT || \
(option) == CURLOPT_HSTS || \
(option) == CURLOPT_HAPROXY_CLIENT_IP || \
(option) == CURLOPT_INTERFACE || \
(option) == CURLOPT_ISSUERCERT || \
(option) == CURLOPT_KEYPASSWD || \
(option) == CURLOPT_KRBLEVEL || \
(option) == CURLOPT_LOGIN_OPTIONS || \
(option) == CURLOPT_MAIL_AUTH || \
(option) == CURLOPT_MAIL_FROM || \
(option) == CURLOPT_NETRC_FILE || \
(option) == CURLOPT_NOPROXY || \
(option) == CURLOPT_PASSWORD || \
(option) == CURLOPT_PINNEDPUBLICKEY || \
(option) == CURLOPT_PRE_PROXY || \
(option) == CURLOPT_PROTOCOLS_STR || \
(option) == CURLOPT_PROXY || \
(option) == CURLOPT_PROXY_CAINFO || \
(option) == CURLOPT_PROXY_CAPATH || \
(option) == CURLOPT_PROXY_CRLFILE || \
(option) == CURLOPT_PROXY_ISSUERCERT || \
(option) == CURLOPT_PROXY_KEYPASSWD || \
(option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
(option) == CURLOPT_PROXY_SERVICE_NAME || \
(option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
(option) == CURLOPT_PROXY_SSLCERT || \
(option) == CURLOPT_PROXY_SSLCERTTYPE || \
(option) == CURLOPT_PROXY_SSLKEY || \
(option) == CURLOPT_PROXY_SSLKEYTYPE || \
(option) == CURLOPT_PROXY_TLS13_CIPHERS || \
(option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
(option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
(option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
(option) == CURLOPT_PROXYPASSWORD || \
(option) == CURLOPT_PROXYUSERNAME || \
(option) == CURLOPT_PROXYUSERPWD || \
(option) == CURLOPT_RANDOM_FILE || \
(option) == CURLOPT_RANGE || \
(option) == CURLOPT_REDIR_PROTOCOLS_STR || \
(option) == CURLOPT_REFERER || \
(option) == CURLOPT_REQUEST_TARGET || \
(option) == CURLOPT_RTSP_SESSION_ID || \
(option) == CURLOPT_RTSP_STREAM_URI || \
(option) == CURLOPT_RTSP_TRANSPORT || \
(option) == CURLOPT_SASL_AUTHZID || \
(option) == CURLOPT_SERVICE_NAME || \
(option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 || \
(option) == CURLOPT_SSH_KNOWNHOSTS || \
(option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
(option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
(option) == CURLOPT_SSLCERT || \
(option) == CURLOPT_SSLCERTTYPE || \
(option) == CURLOPT_SSLENGINE || \
(option) == CURLOPT_SSLKEY || \
(option) == CURLOPT_SSLKEYTYPE || \
(option) == CURLOPT_SSL_CIPHER_LIST || \
(option) == CURLOPT_TLS13_CIPHERS || \
(option) == CURLOPT_TLSAUTH_PASSWORD || \
(option) == CURLOPT_TLSAUTH_TYPE || \
(option) == CURLOPT_TLSAUTH_USERNAME || \
(option) == CURLOPT_UNIX_SOCKET_PATH || \
(option) == CURLOPT_URL || \
(option) == CURLOPT_USERAGENT || \
(option) == CURLOPT_USERNAME || \
(option) == CURLOPT_AWS_SIGV4 || \
(option) == CURLOPT_USERPWD || \
(option) == CURLOPT_XOAUTH2_BEARER || \
(option) == CURLOPT_SSL_EC_CURVES || \
0)
/* evaluates to true if option takes a curl_write_callback argument */
#define curlcheck_write_cb_option(option) \
((option) == CURLOPT_HEADERFUNCTION || \
(option) == CURLOPT_WRITEFUNCTION)
/* evaluates to true if option takes a curl_conv_callback argument */
#define curlcheck_conv_cb_option(option) \
((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
(option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
/* evaluates to true if option takes a data argument to pass to a callback */
#define curlcheck_cb_data_option(option) \
((option) == CURLOPT_CHUNK_DATA || \
(option) == CURLOPT_CLOSESOCKETDATA || \
(option) == CURLOPT_DEBUGDATA || \
(option) == CURLOPT_FNMATCH_DATA || \
(option) == CURLOPT_HEADERDATA || \
(option) == CURLOPT_HSTSREADDATA || \
(option) == CURLOPT_HSTSWRITEDATA || \
(option) == CURLOPT_INTERLEAVEDATA || \
(option) == CURLOPT_IOCTLDATA || \
(option) == CURLOPT_OPENSOCKETDATA || \
(option) == CURLOPT_PREREQDATA || \
(option) == CURLOPT_PROGRESSDATA || \
(option) == CURLOPT_READDATA || \
(option) == CURLOPT_SEEKDATA || \
(option) == CURLOPT_SOCKOPTDATA || \
(option) == CURLOPT_SSH_KEYDATA || \
(option) == CURLOPT_SSL_CTX_DATA || \
(option) == CURLOPT_WRITEDATA || \
(option) == CURLOPT_RESOLVER_START_DATA || \
(option) == CURLOPT_TRAILERDATA || \
(option) == CURLOPT_SSH_HOSTKEYDATA || \
0)
/* evaluates to true if option takes a POST data argument (void* or char*) */
#define curlcheck_postfields_option(option) \
((option) == CURLOPT_POSTFIELDS || \
(option) == CURLOPT_COPYPOSTFIELDS || \
0)
/* evaluates to true if option takes a struct curl_slist * argument */
#define curlcheck_slist_option(option) \
((option) == CURLOPT_HTTP200ALIASES || \
(option) == CURLOPT_HTTPHEADER || \
(option) == CURLOPT_MAIL_RCPT || \
(option) == CURLOPT_POSTQUOTE || \
(option) == CURLOPT_PREQUOTE || \
(option) == CURLOPT_PROXYHEADER || \
(option) == CURLOPT_QUOTE || \
(option) == CURLOPT_RESOLVE || \
(option) == CURLOPT_TELNETOPTIONS || \
(option) == CURLOPT_CONNECT_TO || \
0)
/* groups of curl_easy_getinfo infos that take the same type of argument */
/* evaluates to true if info expects a pointer to char * argument */
#define curlcheck_string_info(info) \
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
(info) != CURLINFO_PRIVATE)
/* evaluates to true if info expects a pointer to long argument */
#define curlcheck_long_info(info) \
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
/* evaluates to true if info expects a pointer to double argument */
#define curlcheck_double_info(info) \
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
/* true if info expects a pointer to struct curl_slist * argument */
#define curlcheck_slist_info(info) \
(((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
#define curlcheck_tlssessioninfo_info(info) \
(((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
/* true if info expects a pointer to struct curl_certinfo * argument */
#define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
/* true if info expects a pointer to struct curl_socket_t argument */
#define curlcheck_socket_info(info) \
(CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
/* true if info expects a pointer to curl_off_t argument */
#define curlcheck_off_t_info(info) \
(CURLINFO_OFF_T < (info))
/* typecheck helpers -- check whether given expression has requested type */
/* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros,
* otherwise define a new macro. Search for __builtin_types_compatible_p
* in the GCC manual.
* NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
* the actual expression passed to the curl_easy_setopt macro. This
* means that you can only apply the sizeof and __typeof__ operators, no
* == or whatsoever.
*/
/* XXX: should evaluate to true if expr is a pointer */
#define curlcheck_any_ptr(expr) \
(sizeof(expr) == sizeof(void *))
/* evaluates to true if expr is NULL */
/* XXX: must not evaluate expr, so this check is not accurate */
#define curlcheck_NULL(expr) \
(__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
/* evaluates to true if expr is type*, const type* or NULL */
#define curlcheck_ptr(expr, type) \
(curlcheck_NULL(expr) || \
__builtin_types_compatible_p(__typeof__(expr), type *) || \
__builtin_types_compatible_p(__typeof__(expr), const type *))
/* evaluates to true if expr is one of type[], type*, NULL or const type* */
#define curlcheck_arr(expr, type) \
(curlcheck_ptr((expr), type) || \
__builtin_types_compatible_p(__typeof__(expr), type []))
/* evaluates to true if expr is a string */
#define curlcheck_string(expr) \
(curlcheck_arr((expr), char) || \
curlcheck_arr((expr), signed char) || \
curlcheck_arr((expr), unsigned char))
/* evaluates to true if expr is a long (no matter the signedness)
* XXX: for now, int is also accepted (and therefore short and char, which
* are promoted to int when passed to a variadic function) */
#define curlcheck_long(expr) \
(__builtin_types_compatible_p(__typeof__(expr), long) || \
__builtin_types_compatible_p(__typeof__(expr), signed long) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
__builtin_types_compatible_p(__typeof__(expr), int) || \
__builtin_types_compatible_p(__typeof__(expr), signed int) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
__builtin_types_compatible_p(__typeof__(expr), short) || \
__builtin_types_compatible_p(__typeof__(expr), signed short) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
__builtin_types_compatible_p(__typeof__(expr), char) || \
__builtin_types_compatible_p(__typeof__(expr), signed char) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned char))
/* evaluates to true if expr is of type curl_off_t */
#define curlcheck_off_t(expr) \
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
/* XXX: also check size of an char[] array? */
#define curlcheck_error_buffer(expr) \
(curlcheck_NULL(expr) || \
__builtin_types_compatible_p(__typeof__(expr), char *) || \
__builtin_types_compatible_p(__typeof__(expr), char[]))
/* evaluates to true if expr is of type (const) void* or (const) FILE* */
#if 0
#define curlcheck_cb_data(expr) \
(curlcheck_ptr((expr), void) || \
curlcheck_ptr((expr), FILE))
#else /* be less strict */
#define curlcheck_cb_data(expr) \
curlcheck_any_ptr(expr)
#endif
/* evaluates to true if expr is of type FILE* */
#define curlcheck_FILE(expr) \
(curlcheck_NULL(expr) || \
(__builtin_types_compatible_p(__typeof__(expr), FILE *)))
/* evaluates to true if expr can be passed as POST data (void* or char*) */
#define curlcheck_postfields(expr) \
(curlcheck_ptr((expr), void) || \
curlcheck_arr((expr), char) || \
curlcheck_arr((expr), unsigned char))
/* helper: __builtin_types_compatible_p distinguishes between functions and
* function pointers, hide it */
#define curlcheck_cb_compatible(func, type) \
(__builtin_types_compatible_p(__typeof__(func), type) || \
__builtin_types_compatible_p(__typeof__(func) *, type))
/* evaluates to true if expr is of type curl_resolver_start_callback */
#define curlcheck_resolver_start_callback(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_resolver_start_callback))
/* evaluates to true if expr is of type curl_read_callback or "similar" */
#define curlcheck_read_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), __typeof__(fread) *) || \
curlcheck_cb_compatible((expr), curl_read_callback) || \
curlcheck_cb_compatible((expr), _curl_read_callback1) || \
curlcheck_cb_compatible((expr), _curl_read_callback2) || \
curlcheck_cb_compatible((expr), _curl_read_callback3) || \
curlcheck_cb_compatible((expr), _curl_read_callback4) || \
curlcheck_cb_compatible((expr), _curl_read_callback5) || \
curlcheck_cb_compatible((expr), _curl_read_callback6))
typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
/* evaluates to true if expr is of type curl_write_callback or "similar" */
#define curlcheck_write_cb(expr) \
(curlcheck_read_cb(expr) || \
curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \
curlcheck_cb_compatible((expr), curl_write_callback) || \
curlcheck_cb_compatible((expr), _curl_write_callback1) || \
curlcheck_cb_compatible((expr), _curl_write_callback2) || \
curlcheck_cb_compatible((expr), _curl_write_callback3) || \
curlcheck_cb_compatible((expr), _curl_write_callback4) || \
curlcheck_cb_compatible((expr), _curl_write_callback5) || \
curlcheck_cb_compatible((expr), _curl_write_callback6))
typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
const void *);
typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
const void *);
typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
#define curlcheck_ioctl_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_ioctl_callback) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \
curlcheck_cb_compatible((expr), _curl_ioctl_callback4))
typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
#define curlcheck_sockopt_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_sockopt_callback) || \
curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \
curlcheck_cb_compatible((expr), _curl_sockopt_callback2))
typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
curlsocktype);
/* evaluates to true if expr is of type curl_opensocket_callback or
"similar" */
#define curlcheck_opensocket_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_opensocket_callback) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \
curlcheck_cb_compatible((expr), _curl_opensocket_callback4))
typedef curl_socket_t (*_curl_opensocket_callback1)
(void *, curlsocktype, struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback2)
(void *, curlsocktype, const struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback3)
(const void *, curlsocktype, struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback4)
(const void *, curlsocktype, const struct curl_sockaddr *);
/* evaluates to true if expr is of type curl_progress_callback or "similar" */
#define curlcheck_progress_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_progress_callback) || \
curlcheck_cb_compatible((expr), _curl_progress_callback1) || \
curlcheck_cb_compatible((expr), _curl_progress_callback2))
typedef int (*_curl_progress_callback1)(void *,
double, double, double, double);
typedef int (*_curl_progress_callback2)(const void *,
double, double, double, double);
/* evaluates to true if expr is of type curl_debug_callback or "similar" */
#define curlcheck_debug_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_debug_callback) || \
curlcheck_cb_compatible((expr), _curl_debug_callback1) || \
curlcheck_cb_compatible((expr), _curl_debug_callback2) || \
curlcheck_cb_compatible((expr), _curl_debug_callback3) || \
curlcheck_cb_compatible((expr), _curl_debug_callback4) || \
curlcheck_cb_compatible((expr), _curl_debug_callback5) || \
curlcheck_cb_compatible((expr), _curl_debug_callback6) || \
curlcheck_cb_compatible((expr), _curl_debug_callback7) || \
curlcheck_cb_compatible((expr), _curl_debug_callback8))
typedef int (*_curl_debug_callback1) (CURL *,
curl_infotype, char *, size_t, void *);
typedef int (*_curl_debug_callback2) (CURL *,
curl_infotype, char *, size_t, const void *);
typedef int (*_curl_debug_callback3) (CURL *,
curl_infotype, const char *, size_t, void *);
typedef int (*_curl_debug_callback4) (CURL *,
curl_infotype, const char *, size_t, const void *);
typedef int (*_curl_debug_callback5) (CURL *,
curl_infotype, unsigned char *, size_t, void *);
typedef int (*_curl_debug_callback6) (CURL *,
curl_infotype, unsigned char *, size_t, const void *);
typedef int (*_curl_debug_callback7) (CURL *,
curl_infotype, const unsigned char *, size_t, void *);
typedef int (*_curl_debug_callback8) (CURL *,
curl_infotype, const unsigned char *, size_t, const void *);
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
/* this is getting even messier... */
#define curlcheck_ssl_ctx_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8))
typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
const void *);
#ifdef HEADER_SSL_H
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
* this will of course break if we are included before OpenSSL headers...
*/
typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
const void *);
#else
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
#endif
/* evaluates to true if expr is of type curl_conv_callback or "similar" */
#define curlcheck_conv_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_conv_callback) || \
curlcheck_cb_compatible((expr), _curl_conv_callback1) || \
curlcheck_cb_compatible((expr), _curl_conv_callback2) || \
curlcheck_cb_compatible((expr), _curl_conv_callback3) || \
curlcheck_cb_compatible((expr), _curl_conv_callback4))
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
/* evaluates to true if expr is of type curl_seek_callback or "similar" */
#define curlcheck_seek_cb(expr) \
(curlcheck_NULL(expr) || \
curlcheck_cb_compatible((expr), curl_seek_callback) || \
curlcheck_cb_compatible((expr), _curl_seek_callback1) || \
curlcheck_cb_compatible((expr), _curl_seek_callback2))
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
#endif /* CURLINC_TYPECHECK_GCC_H */

View File

@@ -0,0 +1,155 @@
#ifndef CURLINC_URLAPI_H
#define CURLINC_URLAPI_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl.h"
#ifdef __cplusplus
extern "C" {
#endif
/* the error codes for the URL API */
typedef enum {
CURLUE_OK,
CURLUE_BAD_HANDLE, /* 1 */
CURLUE_BAD_PARTPOINTER, /* 2 */
CURLUE_MALFORMED_INPUT, /* 3 */
CURLUE_BAD_PORT_NUMBER, /* 4 */
CURLUE_UNSUPPORTED_SCHEME, /* 5 */
CURLUE_URLDECODE, /* 6 */
CURLUE_OUT_OF_MEMORY, /* 7 */
CURLUE_USER_NOT_ALLOWED, /* 8 */
CURLUE_UNKNOWN_PART, /* 9 */
CURLUE_NO_SCHEME, /* 10 */
CURLUE_NO_USER, /* 11 */
CURLUE_NO_PASSWORD, /* 12 */
CURLUE_NO_OPTIONS, /* 13 */
CURLUE_NO_HOST, /* 14 */
CURLUE_NO_PORT, /* 15 */
CURLUE_NO_QUERY, /* 16 */
CURLUE_NO_FRAGMENT, /* 17 */
CURLUE_NO_ZONEID, /* 18 */
CURLUE_BAD_FILE_URL, /* 19 */
CURLUE_BAD_FRAGMENT, /* 20 */
CURLUE_BAD_HOSTNAME, /* 21 */
CURLUE_BAD_IPV6, /* 22 */
CURLUE_BAD_LOGIN, /* 23 */
CURLUE_BAD_PASSWORD, /* 24 */
CURLUE_BAD_PATH, /* 25 */
CURLUE_BAD_QUERY, /* 26 */
CURLUE_BAD_SCHEME, /* 27 */
CURLUE_BAD_SLASHES, /* 28 */
CURLUE_BAD_USER, /* 29 */
CURLUE_LACKS_IDN, /* 30 */
CURLUE_TOO_LARGE, /* 31 */
CURLUE_LAST
} CURLUcode;
typedef enum {
CURLUPART_URL,
CURLUPART_SCHEME,
CURLUPART_USER,
CURLUPART_PASSWORD,
CURLUPART_OPTIONS,
CURLUPART_HOST,
CURLUPART_PORT,
CURLUPART_PATH,
CURLUPART_QUERY,
CURLUPART_FRAGMENT,
CURLUPART_ZONEID /* added in 7.65.0 */
} CURLUPart;
#define CURLU_DEFAULT_PORT (1<<0) /* return default port number */
#define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set,
if the port number matches the
default for the scheme */
#define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if
missing */
#define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */
#define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */
#define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */
#define CURLU_URLDECODE (1<<6) /* URL decode on get */
#define CURLU_URLENCODE (1<<7) /* URL encode on set */
#define CURLU_APPENDQUERY (1<<8) /* append a form style part */
#define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */
#define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the
scheme is unknown. */
#define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */
#define CURLU_PUNYCODE (1<<12) /* get the hostname in punycode */
#define CURLU_PUNY2IDN (1<<13) /* punycode => IDN conversion */
#define CURLU_GET_EMPTY (1<<14) /* allow empty queries and fragments
when extracting the URL or the
components */
#define CURLU_NO_GUESS_SCHEME (1<<15) /* for get, do not accept a guess */
typedef struct Curl_URL CURLU;
/*
* curl_url() creates a new CURLU handle and returns a pointer to it.
* Must be freed with curl_url_cleanup().
*/
CURL_EXTERN CURLU *curl_url(void);
/*
* curl_url_cleanup() frees the CURLU handle and related resources used for
* the URL parsing. It will not free strings previously returned with the URL
* API.
*/
CURL_EXTERN void curl_url_cleanup(CURLU *handle);
/*
* curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
* handle must also be freed with curl_url_cleanup().
*/
CURL_EXTERN CURLU *curl_url_dup(const CURLU *in);
/*
* curl_url_get() extracts a specific part of the URL from a CURLU
* handle. Returns error code. The returned pointer MUST be freed with
* curl_free() afterwards.
*/
CURL_EXTERN CURLUcode curl_url_get(const CURLU *handle, CURLUPart what,
char **part, unsigned int flags);
/*
* curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
* error code. The passed in string will be copied. Passing a NULL instead of
* a part string, clears that part.
*/
CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
const char *part, unsigned int flags);
/*
* curl_url_strerror() turns a CURLUcode value into the equivalent human
* readable error string. This is useful for printing meaningful error
* messages.
*/
CURL_EXTERN const char *curl_url_strerror(CURLUcode);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* CURLINC_URLAPI_H */

View File

@@ -0,0 +1,84 @@
#ifndef CURLINC_WEBSOCKETS_H
#define CURLINC_WEBSOCKETS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
struct curl_ws_frame {
int age; /* zero */
int flags; /* See the CURLWS_* defines */
curl_off_t offset; /* the offset of this data into the frame */
curl_off_t bytesleft; /* number of pending bytes left of the payload */
size_t len; /* size of the current data chunk */
};
/* flag bits */
#define CURLWS_TEXT (1<<0)
#define CURLWS_BINARY (1<<1)
#define CURLWS_CONT (1<<2)
#define CURLWS_CLOSE (1<<3)
#define CURLWS_PING (1<<4)
#define CURLWS_OFFSET (1<<5)
/*
* NAME curl_ws_recv()
*
* DESCRIPTION
*
* Receives data from the websocket connection. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
size_t *recv,
const struct curl_ws_frame **metap);
/* flags for curl_ws_send() */
#define CURLWS_PONG (1<<6)
/*
* NAME curl_ws_send()
*
* DESCRIPTION
*
* Sends data over the websocket connection. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer,
size_t buflen, size_t *sent,
curl_off_t fragsize,
unsigned int flags);
/* bits for the CURLOPT_WS_OPTIONS bitmask: */
#define CURLWS_RAW_MODE (1<<0)
CURL_EXTERN const struct curl_ws_frame *curl_ws_meta(CURL *curl);
#ifdef __cplusplus
}
#endif
#endif /* CURLINC_WEBSOCKETS_H */

View File

@@ -0,0 +1,133 @@
#ifndef FRONT_H
#define FRONT_H
#include <memory>
#include <thread>
#include <atomic>
#include <iostream>
#include <queue> //任务队列
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "rocketmq.h" // mq
#include "worker.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////命名空间
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////线程池类
class ThreadPool {
public:
explicit ThreadPool(size_t numThreads) : stop(false) {
for (size_t i = 0; i < numThreads; ++i) {
workers.emplace_back([this]() {
for (;;) {
std::function<void()> task;
{
std::unique_lock<std::mutex> lock(queueMutex);
condition.wait(lock, [this]() { return stop || !tasks.empty(); });
if (stop && tasks.empty())
return;
task = std::move(tasks.front());
tasks.pop();
}
task();
}
});
}
}
// 添加任务
template<class F>
void enqueue(F&& f) {
{
std::unique_lock<std::mutex> lock(queueMutex);
if (stop)
throw std::runtime_error("enqueue on stopped ThreadPool");
tasks.emplace(std::function<void()>(std::forward<F>(f)));
}
condition.notify_one();
}
// 析构:停止所有线程
~ThreadPool() {
{
std::unique_lock<std::mutex> lock(queueMutex);
stop = true;
}
condition.notify_all();
for (std::thread &worker : workers)
worker.join();
}
private:
std::vector<std::thread> workers; // 工作线程
std::queue<std::function<void()>> tasks; // 任务队列
std::mutex queueMutex; // 队列锁
std::condition_variable condition; // 条件变量
bool stop; // 停止标志
};
/////////////////////////////////////////////////////////////////////////////////////////front类
class Front {
public:
Worker m_worker;
std::unique_ptr<rocketmq::DefaultMQPushConsumer> m_mqConsumer;
std::shared_ptr<rocketmq::SubscriberListener> m_listener;
rocketmq::RocketMQProducer* m_producer = nullptr;
std::thread m_FrontThread;
std::thread m_MQConsumerThread;
std::thread m_MQProducerThread;
std::thread m_TimerThread;
std::atomic<bool> m_IsMQProducerCancel{false};
std::atomic<bool> m_IsTimerCancel{false};
std::atomic<bool> m_bIsFrontThreadCancle{false};
std::atomic<bool> m_IsMQConsumerCancel{false};
std::atomic<bool> m_frontRunning{false};
std::atomic<bool> m_consumerRunning{false};
std::atomic<bool> m_producerRunning{false};
std::atomic<bool> m_timerRunning{false};
std::mutex m_threadCheckMutex;
std::atomic<bool> m_needRestartFrontThread{false};
std::atomic<bool> m_needRestartConsumerThread{false};
std::atomic<bool> m_needRestartProducerThread{false};
std::atomic<bool> m_needRestartTimerThread{false};
Front();
~Front();
void FormClosing();
void StartFrontThread();
void StartMQConsumerThread();
void StartMQProducerThread();
void StartTimerThread();
// [ADD] 统一的停止接口(便于重启前先停干净)
void StopFrontThread();
void StopMQConsumerThread();
void StopMQProducerThread();
void StopTimerThread();
void FrontThread();
void mqconsumerThread();
void mqproducerThread();
void OnTimerThread();
private:
ThreadPool m_threadPool;
};
#endif // FRONT_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,511 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <ctime>
#include <sstream>
#include <mutex>
#include <thread>
#include <atomic>
#include <cstdio>
#include <unistd.h>
#include <cstring>
#include <sys/stat.h>
#include <sys/types.h>
#include <list>
#include <vector>
#include <array>
#include <fnmatch.h>
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "log4cplus/logger.h"
#include "log4cplus/configurator.h"
#include "log4cplus/fileappender.h"
#include "log4cplus/layout.h"
#include "log4cplus/ndc.h"
#include "log4cplus/spi/loggingevent.h"
#include "rocketmq.h"
#include "interface.h"
#include "log4.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//log4命名空间
using namespace log4cplus;
using namespace log4cplus::helpers;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//queue结构定义
extern std::mutex queue_data_list_mutex; //queue发送数据锁
extern std::list<queue_data_t> queue_data_list; //queue发送数据链表
extern unsigned int g_node_id;
extern int g_front_seg_index;
extern std::string FRONT_INST;
extern std::string subdir;
//日志主题
extern std::string G_LOG_TOPIC;
//////////////////////////////////////////////////////////
/* log4.cpp 顶部 */
#if __cplusplus >= 201103L
thread_local int g_log_code_tls = 0;
#else
__thread int g_log_code_tls = 0;
#endif
////////////////////////////////////////////////////////辅助函数
// 递归创建目录
bool create_directory_recursive(const std::string& path) {
size_t pos = 0;
std::string current;
while (pos != std::string::npos) {
pos = path.find('/', pos + 1);
current = path.substr(0, pos);
if (!current.empty() && access(current.c_str(), F_OK) != 0) {
if (mkdir(current.c_str(), 0755) != 0) {
perror(("mkdir failed: " + current).c_str());
return false;
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////
std::string extract_logger_id(const std::string& logger_name) {
size_t pos = logger_name.find('.');
if (pos != std::string::npos && pos + 1 < logger_name.size()) {
return logger_name.substr(pos + 1);
}
return ""; // 没有找到 '.' 或 '.' 后为空
}
std::string get_level_str(int level) {
switch (level) {
case 10000: return "DEBUG";
case 20000: return "NORMAL"; // 或 "INFO" 根据你业务定义
case 30000: return "WARN";
case 40000: return "ERROR";
default: return "UNKNOWN";
}
}
//////////////////////////////////////////////////////////////////////
TypedLogger::TypedLogger() {}
TypedLogger::TypedLogger(const Logger& l, int t) : logger(l), logtype(t) {}
DebugSwitch::DebugSwitch() : debug_open(false), min_level(WARN_LOG_LEVEL) {}
void DebugSwitch::open() { debug_open = true; }
void DebugSwitch::close() {
debug_open = false;
targets.clear();
type_enable.clear();
}
void DebugSwitch::set_target(const std::string& name) { targets.insert(name); }
void DebugSwitch::set_level(int level) { min_level = level; }
void DebugSwitch::enable_type(int type) { type_enable[type] = true; }
void DebugSwitch::disable_type(int type) { type_enable[type] = false; }
bool DebugSwitch::match(const std::string& logger_name, int level, int logtype) {
if (!debug_open) return false;
if (level < min_level) return false;
if (type_enable.count(logtype) && !type_enable[logtype]) return false;
std::set<std::string>::iterator it;
for (it = targets.begin(); it != targets.end(); ++it) {
if (logger_name.find(*it) != std::string::npos)
return true;
}
return false;
}
std::map<std::string, TypedLogger> logger_map;
DebugSwitch g_debug_switch;
class SendAppender : public Appender {
protected:
void append(const spi::InternalLoggingEvent& event) {
std::string logger_name = event.getLoggerName();
int level = event.getLogLevel();
std::string msg = event.getMessage();
int logtype = (logger_name.find(".COM") != std::string::npos) ? LOGTYPE_COM : LOGTYPE_DATA;
std::string level_str;
if (logger_name.find("process") == 0)
level_str = "process";
else if (logger_name.find("monitor") != std::string::npos)
level_str = "measurepoint";
else
level_str = "terminal";
// ★读取 TLS 中的 code在打日志的线程里由宏设定
int code = g_log_code_tls; // 若未显式传入,则为 0
if (level == ERROR_LOG_LEVEL || level == WARN_LOG_LEVEL || g_debug_switch.match(logger_name, level, logtype)) {
std::ostringstream oss;
oss << "{\"processNo\":\"" << std::to_string(g_front_seg_index)
<< "\",\"nodeId\":\"" << FRONT_INST
<< "\",\"businessId\":\"" << extract_logger_id(logger_name)
<< "\",\"level\":\"" << level_str
<< "\",\"time\":\"" << now_yyyy_mm_dd_hh_mm_ss()
<< "\",\"grade\":\"" << get_level_str(level)
// ★新增:输出 code 字段(整型)
<< "\",\"code\":\"" << code
<< "\",\"log\":\"" << escape_json(msg) << "\"}";
std::string jsonString = oss.str();
queue_data_t connect_info;
connect_info.strTopic = G_LOG_TOPIC;
connect_info.strText = jsonString;
connect_info.tag = G_LOG_TAG;
connect_info.key = G_LOG_KEY;
std::lock_guard<std::mutex> lock(queue_data_list_mutex);
queue_data_list.push_back(connect_info);
}
}
std::string escape_json(const std::string& input) {
std::ostringstream ss;
for (unsigned int i = 0; i < input.size(); ++i) {
switch (input[i]) {
case '\\': ss << "\\\\"; break;
case '"': ss << "\\\""; break;
case '\n': ss << "\\n"; break;
case '\r': ss << "\\r"; break;
case '\t': ss << "\\t"; break;
default: ss << input[i]; break;
}
}
return ss.str();
}
virtual void close() {
// 可空实现
}
public:
SendAppender() {}
virtual ~SendAppender() {
destructorImpl(); // 重要!释放 log4cplus 基类资源
}
};
//用来控制日志上送的结构
struct LOGEntry {
std::string id;
std::string level; // terminal / measurepoint
int logtype; // com / data
int min_grade;
int countdown;
};
//日志上送map管理
std::map<std::string, LOGEntry> g_log_entries;
pthread_mutex_t g_log_mutex = PTHREAD_MUTEX_INITIALIZER;
// 生成唯一 key
std::string build_debug_key(const std::string& id, const std::string& level, int logtype) {
return id + "|" + level + "|" + (logtype == 1 ? "COM" : "DATA");
}
// 外部线程中调用每秒更新所有倒计时0 则删除
void update_log_entries_countdown() {
pthread_mutex_lock(&g_log_mutex);
std::map<std::string, LOGEntry>::iterator it = g_log_entries.begin();
while (it != g_log_entries.end()) {
if (it->second.countdown > 0) {
it->second.countdown--;
if (it->second.countdown == 0) {
std::cout << "[LOG] debug日志上送自动关闭: " << it->first << std::endl;
it = g_log_entries.erase(it);
continue;
}
}
++it;
}
pthread_mutex_unlock(&g_log_mutex);
}
void process_log_command(const std::string& id, const std::string& level, const std::string& grade, const std::string& logtype_str) {
if (level != "terminal" && level != "measurepoint") return;
int type = (logtype_str == "com") ? LOGTYPE_COM : LOGTYPE_DATA;
int grade_level = (grade == "DEBUG") ? DEBUG_LOG_LEVEL : INFO_LOG_LEVEL;
std::string key = build_debug_key(id, level, type);
pthread_mutex_lock(&g_log_mutex);
LOGEntry& entry = g_log_entries[key]; // 会自动 insert 或取已有
entry.id = id;
entry.level = level;
entry.logtype = type;
entry.min_grade = grade_level;
entry.countdown = 60; // 重置倒计时
pthread_mutex_unlock(&g_log_mutex);
}
Logger init_logger(const std::string& full_name, const std::string& file_dir, const std::string& base_file, SharedAppenderPtr fileAppender) {
create_directory_recursive(file_dir);
Logger logger = Logger::getInstance(full_name);
if (!fileAppender) {
std::string file_path = file_dir + "/" + base_file + ".log";
fileAppender = SharedAppenderPtr(new RollingFileAppender(file_path, 1 * 1024 * 1024, 2));
fileAppender->setLayout(std::unique_ptr<Layout>(
new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
}
SharedAppenderPtr sendAppender(new SendAppender());
logger.addAppender(fileAppender);
logger.addAppender(sendAppender);
logger.setLogLevel(DEBUG_LOG_LEVEL);
return logger;
}
// 重载版本:无 Appender 传入时调用上面的实现
log4cplus::Logger init_logger(const std::string& full_name,
const std::string& file_dir,
const std::string& base_file) {
return init_logger(full_name, file_dir, base_file,
log4cplus::SharedAppenderPtr()); // 空指针
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////应用函数
//进程的日志
void init_logger_process() {
std::string base_dir = FRONT_PATH + "/" + subdir + "/processNo" + std::to_string(g_front_seg_index) + "/log";
logger_map["process"] = TypedLogger(init_logger(std::string("process"), base_dir, std::string("process")), LOGTYPE_DATA);
std::cout << "process log init ok" << std::endl;
}
//单个终端的日志初始化
void init_loggers_bydevid(const std::string& dev_id)
{
if (dev_id.empty()) return;
std::string terminal_id = dev_id;
std::string base_dir = FRONT_PATH + "/" + subdir + "/processNo" + std::to_string(g_front_seg_index) + "/log";
for (size_t i = 0; i < terminal_devlist.size(); ++i) {
terminal_dev& term = terminal_devlist[i];
// 跳过终端台账信息为空的节点
if (term.terminal_id.empty()) {
std::cout << "terminal_dev No." << i << " is null" << std::endl;
continue;
}
// 跳过不匹配的终端
if (term.terminal_id != dev_id) continue;
std::string ip_str = term.addr_str.empty() ? "unknown" : term.addr_str;
std::string device_dir = base_dir + "/" + ip_str;
std::string device_key = std::string("terminal.") + dev_id;
// 添加判断:终端日志 logger 是否已存在
if (logger_map.find(device_key) == logger_map.end()) {
// 所有终端日志com 和 data写到同一个 device 日志文件中
std::string file_path_t = device_dir + "/" + dev_id + ".log";
// 共用一个 appender 实例
SharedAppenderPtr device_appender(new RollingFileAppender(file_path_t, 1 * 1024 * 1024, 2));
device_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
Logger device_logger = init_logger(device_key, device_dir, dev_id, device_appender);
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DATA);
//DIY_WARNLOG(dev_id.c_str(), "【WARN】终端id:%s终端级日志初始化完毕", term.terminal_id.c_str());
}
// 初始化监测点日志monitor.<mp_id>.COM / .DATA
for (size_t j = 0; j < term.line.size(); ++j) {
const ledger_monitor& monitor = term.line[j];
if (!monitor.monitor_id.empty()) {
std::ostringstream mon_key, mon_path, mon_name;
mon_key << "monitor." << monitor.monitor_id;
mon_path << device_dir << "/monitor" << j;
mon_name << monitor.monitor_id;
// 判断监测点 logger 是否已存在
if (logger_map.find(mon_key.str()) == logger_map.end()) {
// 所有监测点日志com 和 data写到同一个 monitor 日志文件中
std::string file_path_m = mon_path.str() + "/" + mon_name.str() + ".log";
// 共用一个 appender 实例
SharedAppenderPtr monitor_appender(new RollingFileAppender(file_path_m, 1 * 1024 * 1024, 2));
monitor_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
Logger mon_logger = init_logger(mon_key.str(), mon_path.str(), mon_name.str(), monitor_appender);
logger_map[mon_key.str()] = TypedLogger(mon_logger, LOGTYPE_DATA);
//DIY_WARNLOG(monitor.monitor_id.c_str(), "【WARN】监测点:%s - id:%s监测点级日志初始化完毕", monitor.monitor_name.c_str(), monitor.logical_device_seq.c_str());
}
}
}
break; // 只匹配一个 terminal_id
}
}
//初始化台账日志
void init_loggers()
{
std::string base_dir = FRONT_PATH + "/" + subdir + "/processNo" + std::to_string(g_front_seg_index) + "/log";
// 遍历所有终端
for (size_t t = 0; t < terminal_devlist.size(); ++t) {
terminal_dev& term = terminal_devlist[t];
// 跳过无效终端
if (term.terminal_id.empty()) {
std::cout << "terminal_dev No." << t << " is null" << std::endl;
continue;
}
std::string ip_str = term.addr_str.empty() ? "unknown" : term.addr_str;
std::string device_dir = base_dir + "/" + ip_str;
std::string device_key = std::string("terminal.") + term.terminal_id;
// 所有终端日志com 和 data写到同一个 device 日志文件中
std::string file_path_t = device_dir + "/" + term.terminal_id + ".log";
// 共用一个 appender 实例
SharedAppenderPtr device_appender(new RollingFileAppender(file_path_t, 1 * 1024 * 1024, 2));
device_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
Logger device_logger = init_logger(device_key, device_dir, term.terminal_id, device_appender);
logger_map[device_key] = TypedLogger(device_logger, LOGTYPE_DATA);
//DIY_WARNLOG(term.terminal_id.c_str(), "【WARN】终端id:%s终端级日志初始化完毕", term.terminal_id.c_str());
// 初始化监测点日志
for (size_t i = 0; i < term.line.size(); ++i) {
const ledger_monitor& monitor = term.line[i];
if (!monitor.monitor_id.empty()) {
std::ostringstream mon_key, mon_path, mon_name;
mon_key << "monitor." << monitor.monitor_id;
mon_path << device_dir << "/monitor" << i; // 用monitor+序号作为目录
mon_name << monitor.monitor_id;
std::string file_path_m = mon_path.str() + "/" + mon_name.str() + ".log";
// 共用一个 appender 实例
SharedAppenderPtr monitor_appender(new RollingFileAppender(file_path_m, 1 * 1024 * 1024, 2));
monitor_appender->setLayout(std::unique_ptr<Layout>(new PatternLayout("%D{%Y-%m-%d %H:%M:%S} [%p] [%c] %m%n")));
Logger mon_logger = init_logger(mon_key.str(), mon_path.str(), mon_name.str(), monitor_appender);
logger_map[mon_key.str()] = TypedLogger(mon_logger, LOGTYPE_DATA);
//DIY_WARNLOG(mon_key.str().c_str(), "【WARN】监测点:%s - id:%s监测点级日志初始化完毕",
//monitor.monitor_name.c_str(), monitor.logical_device_seq.c_str());
}
}
}
}
//单个终端的日志删除
void remove_loggers_by_terminal_id(const std::string& terminal_id) {
// 遍历所有终端
for (size_t t = 0; t < terminal_devlist.size(); ++t) {
terminal_dev& term = terminal_devlist[t];
if (term.terminal_id != terminal_id) continue;
// 删除终端日志 logger
std::string terminal_key = "terminal." + terminal_id;
if (logger_map.count(terminal_key)) {
logger_map[terminal_key].logger.removeAllAppenders();
logger_map.erase(terminal_key);
}
// 删除监测点日志 logger
for (size_t i = 0; i < term.line.size(); ++i) {
const ledger_monitor& monitor = term.line[i];
if (!monitor.monitor_id.empty()) {
std::string mon_prefix = "monitor." + monitor.monitor_id;
std::string mon_key = mon_prefix;
if (logger_map.count(mon_key)) {
logger_map[mon_key].logger.removeAllAppenders();
logger_map.erase(mon_key);
}
}
}
std::cout << "[LOG] Logger for terminal_id=" << terminal_id << " removed." << std::endl;
break; // 找到匹配终端后退出
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////封装函数C/C++通用
#ifdef __cplusplus
extern "C" {
#endif
// 公共函数
void log4_log_with_level(const char* key, const char* msg, int level) {
std::map<std::string, TypedLogger>::iterator it = logger_map.find(key);
if (it == logger_map.end()) return;
Logger logger = it->second.logger;
switch (level) {
case 0: LOG4CPLUS_DEBUG(logger, msg); break;
case 1: LOG4CPLUS_INFO(logger, msg); break;
case 2: LOG4CPLUS_WARN(logger, msg); break;
case 3: LOG4CPLUS_ERROR(logger, msg); break;
default: break;
}
}
// 四个包装函数
void log_debug(const char* key, const char* msg) { log4_log_with_level(key, msg, 0); }
void log_info (const char* key, const char* msg) { log4_log_with_level(key, msg, 1); }
void log_warn (const char* key, const char* msg) { log4_log_with_level(key, msg, 2); }
void log_error(const char* key, const char* msg) { log4_log_with_level(key, msg, 3); }
//标准化日志接口
// #define LOGMSG_WITH_TS // 需要时间时再打开
void format_log_msg(char* buf, size_t buf_size, const char* fmt, ...) {
if (!buf || buf_size == 0) return;
buf[0] = '\0';
if (!fmt) return;
va_list args;
va_start(args, fmt);
#ifdef LOGMSG_WITH_TS
// 写入时间
time_t now = time(NULL);
struct tm tm_info;
localtime_r(&now, &tm_info);
size_t n = strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S ", &tm_info);
if (n < buf_size) {
vsnprintf(buf + n, buf_size - n, fmt, args);
}
#else
vsnprintf(buf, buf_size, fmt, args);
#endif
va_end(args);
}
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,193 @@
#ifndef LOG4_H
#define LOG4_H
#if defined(__cplusplus) && __cplusplus >= 201103L
#define LOG_TLS_SPEC thread_local
#else
/* C 或旧编译器,走 GCC 扩展 */
#define LOG_TLS_SPEC __thread
#endif
/* ★统一的对外声明(别在其他头/源里再声明不同版本!) */
extern LOG_TLS_SPEC int g_log_code_tls;
#ifdef __cplusplus
#include <string>
#include <map>
//防止#include <log4cplus/logger.h>里的冲突
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
//防止#include <log4cplus/logger.h>里的冲突
#include "logger.h"
#include <set>
#include "loggingmacros.h"
#include "appender.h"
#define LOGTYPE_COM 1
#define LOGTYPE_DATA 2
struct TypedLogger {
log4cplus::Logger logger;
int logtype;
TypedLogger();
TypedLogger(const log4cplus::Logger& l, int t);
};
struct DebugSwitch {
bool debug_open;
std::set<std::string> targets;
int min_level;
std::map<int, bool> type_enable;
DebugSwitch();
void open();
void close();
void set_target(const std::string& name);
void set_level(int level);
void enable_type(int type);
void disable_type(int type);
bool match(const std::string& logger_name, int level, int logtype);
};
extern std::map<std::string, TypedLogger> logger_map;
extern DebugSwitch g_debug_switch;
extern void send_reply_to_queue(const std::string& guid, const int code, const std::string& result);
//std::string get_front_type_from_subdir();
// 不带 Appender 的版本
log4cplus::Logger init_logger(const std::string& full_name,
const std::string& file_dir,
const std::string& base_file);
// 带 Appender 的版本
log4cplus::Logger init_logger(const std::string& full_name,
const std::string& file_dir,
const std::string& base_file,
log4cplus::SharedAppenderPtr fileAppender);
void process_log_command(const std::string& id, const std::string& level, const std::string& grade, const std::string& logtype_str);
void update_log_entries_countdown();
extern "C" {
#endif
void remove_loggers_by_terminal_id(const std::string& terminal_id_cstr);
void init_logger_process();
void init_loggers();
void init_loggers_bydevid(const std::string& dev_id);
void log_debug(const char* key, const char* msg);
void log_info(const char* key, const char* msg);
void log_warn(const char* key, const char* msg);
void log_error(const char* key, const char* msg);
void format_log_msg(char* buf, size_t buf_size, const char* fmt, ...);
// ====================== ★新增:线程局部变量透传 code ======================
// 说明:使用编译器的 TLS__thread保存当前日志的 code 值。
// 在每次打日志前写入打完后恢复Appender 读取该值写入 JSON。
// ====================== ★新增结束 ======================
typedef enum LogCode {
LOG_CODE_OTHER = 99, /* 其他类型 */
LOG_CODE_LEDGER = 100, /* 台账类型 */
LOG_CODE_RPTINIT = 101, /* 报告初始化 */
LOG_CODE_ICD_AND_DOWNLOAD = 200, /* ICD 和文件下载类型 */
LOG_CODE_TRANSIENT = 300, /* 暂态发生 */
LOG_CODE_TRANSIENT_COMM = 301, /* 暂态接口 */
LOG_CODE_COMTRADE_FILE = 302, /* 录波文件Comtrade */
LOG_CODE_MQ = 400, /* MQ发送 */
LOG_CODE_RT_DATA = 401, /* 实时数据 */
LOG_CODE_LEDGER_UPDATE = 402, /* 台账更新 */
LOG_CODE_PROCESS_CONTROL = 403, /* 进程控制 */
LOG_CODE_RECALL = 404, /* 补招相关 */
LOG_CODE_LOG_REQUEST = 405, /* 日志请求 */
LOG_CODE_REPORT = 500, /* 报告处理 */
LOG_CODE_COMM = 600, /* 通讯状态 */
LOG_CODE_SPACE_ALARM = 700, /* 空间告警 */
LOG_CODE_DEV_ALARM = 800 /* 设备告警 */
} LogCode;
// ====================== 日志宏区域 ======================
// ★新增:带 code 的实现C/C++ 通用,使用 TLS 保存/恢复)
#define DIY_LOG_CODE(LEVEL_FUNC, KEY, LEVEL_INT, CODE_INT, ...) \
do { \
/* 备份并设置本次日志 code */ \
int __old_code__ = g_log_code_tls; \
g_log_code_tls = static_cast<int>(CODE_INT); \
\
/* 组装消息 */ \
char __msg_buf__[256]; \
format_log_msg(__msg_buf__, sizeof(__msg_buf__), __VA_ARGS__); \
\
/* 将 KEY 规范化为字符串(兼容 const char* / std::string 等) */ \
std::ostringstream __oss_key__; \
__oss_key__ << (KEY); \
std::string __key_raw__ = __oss_key__.str(); \
\
/* 根据 LEVEL_INT 构造最终 key */ \
char __key_buf__[256]; \
switch (static_cast<int>(LEVEL_INT)) { \
case 0: \
std::snprintf(__key_buf__, sizeof(__key_buf__), "process"); \
break; \
case 1: \
std::snprintf(__key_buf__, sizeof(__key_buf__), \
"terminal.%s", __key_raw__.c_str()); \
break; \
case 2: \
std::snprintf(__key_buf__, sizeof(__key_buf__), \
"monitor.%s", __key_raw__.c_str()); \
break; \
default: \
std::snprintf(__key_buf__, sizeof(__key_buf__), "%s", \
__key_raw__.c_str()); \
break; \
} \
\
/* 输出日志 */ \
LEVEL_FUNC(__key_buf__, __msg_buf__); \
\
/* 恢复旧值 */ \
g_log_code_tls = __old_code__; \
} while (0)
// ★修改:默认宏改为 code=0兼容原有用法
#define DIY_ERRORLOG(KEY, ...) DIY_LOG_CODE(log_error, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
#define DIY_WARNLOG(KEY, ...) DIY_LOG_CODE(log_warn, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
#define DIY_INFOLOG(KEY, ...) DIY_LOG_CODE(log_info, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
#define DIY_DEBUGLOG(KEY, ...) DIY_LOG_CODE(log_debug, KEY, 0, LOG_CODE_OTHER,__VA_ARGS__) // ★修改:默认 code=0
// ★新增:显式传入 code 的便捷宏
// 用法示例DIY_WARNLOG_CODE(full_key_m_c, warn_recallstart, "【WARN】监测点:%s ...", ...);
#define DIY_ERRORLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_error, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
#define DIY_WARNLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_warn, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
#define DIY_INFOLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_info, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
#define DIY_DEBUGLOG_CODE(KEY, LEVEL_INT,CODE_INT, ...) DIY_LOG_CODE(log_debug, KEY, LEVEL_INT, CODE_INT, __VA_ARGS__) // ★新增
// ====================== 日志宏区域 ======================
#ifdef __cplusplus
}
#endif
#endif // LOG4_H

View File

@@ -0,0 +1,340 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: appender.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_APPENDER_HEADER_
#define LOG4CPLUS_APPENDER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/layout.h>
#include <log4cplus/loglevel.h>
#include <log4cplus/tstring.h>
#include <log4cplus/helpers/pointer.h>
#include <log4cplus/spi/filter.h>
#include <log4cplus/helpers/lockfile.h>
#include <memory>
#include <mutex>
#include <atomic>
#include <condition_variable>
namespace log4cplus {
namespace helpers
{
class Properties;
}
/**
* This class is used to "handle" errors encountered in an {@link
* log4cplus::Appender}.
*/
class LOG4CPLUS_EXPORT ErrorHandler
{
public:
ErrorHandler ();
virtual ~ErrorHandler() = 0;
virtual void error(const log4cplus::tstring& err) = 0;
virtual void reset() = 0;
};
class LOG4CPLUS_EXPORT OnlyOnceErrorHandler
: public ErrorHandler
{
public:
// Ctor
OnlyOnceErrorHandler();
virtual ~OnlyOnceErrorHandler ();
virtual void error(const log4cplus::tstring& err);
virtual void reset();
private:
bool firstTime;
};
/**
* Extend this class for implementing your own strategies for printing log
* statements.
*
* <h3>Properties</h3>
* <dl>
*
* <dt><tt>layout</tt></dt>
* <dd>This property specifies message layout used by
* Appender.
* \sa Layout
* </dd>
*
* <dt><tt>filters</tt></dt>
* <dd>This property specifies possibly multiple filters used by
* Appender. Each of multple filters and its properties is under a
* numbered subkey of filters key. E.g.:
* <tt>filters.<em>1</em>=log4cplus::spi::LogLevelMatchFilter</tt>. Filter
* subkey numbers must be consecutive.</dd>
*
* <dt><tt>Threshold</tt></dt>
* <dd>This property specifies log level threshold. Events with
* lower log level than the threshold will not be logged by
* appender.</dd>
*
* <dt><tt>UseLockFile</tt></dt>
* <dd>Set this property to <tt>true</tt> if you want your output
* through this appender to be synchronized between multiple
* processes. When this property is set to true then log4cplus
* uses OS specific facilities (e.g., <code>lockf()</code>) to
* provide inter-process locking. With the exception of
* FileAppender and its derived classes, it is also necessary to
* provide path to a lock file using the <tt>LockFile</tt>
* property.
* \sa FileAppender
* </dd>
*
* <dt><tt>LockFile</tt></dt>
* <dd>This property specifies lock file, file used for
* inter-process synchronization of log file access. The property
* is only used when <tt>UseLockFile</tt> is set to true. Then it
* is mandatory.
* \sa FileAppender
* </dd>
*
* <dt><tt>AsyncAppend</tt></dt>
* <dd>Set this property to <tt>true</tt> if you want all appends using
* this appender to be done asynchronously. Default is <tt>false</tt>.</dd>
*
* </dl>
*/
class LOG4CPLUS_EXPORT Appender
: public virtual log4cplus::helpers::SharedObject
{
public:
// Ctor
Appender();
Appender(const log4cplus::helpers::Properties & properties);
// Dtor
virtual ~Appender();
/**
* This function is for derived appenders to call from their
* destructors. All classes derived from `Appender` class
* _must_ call this function from their destructors. It
* ensures that appenders will get properly closed during
* shutdown by call to `close()` function before they are
* destroyed.
*/
void destructorImpl();
// Methods
/**
* Release any resources allocated within the appender such as file
* handles, network connections, etc.
*
* It is a programming error to append to a closed appender.
*/
virtual void close() = 0;
/**
* Check if this appender is in closed state.
*/
bool isClosed() const;
/**
* This method performs threshold checks and invokes filters before
* delegating actual logging to the subclasses specific {@link
* #append} method.
*/
void syncDoAppend(const log4cplus::spi::InternalLoggingEvent& event);
/**
* This method performs book keeping related to asynchronous logging
* and executes `syncDoAppend()` to do the actual logging.
*/
void asyncDoAppend(const log4cplus::spi::InternalLoggingEvent& event);
/**
* This function checks `async` flag. It either executes
* `syncDoAppend()` directly or enqueues its execution to thread pool
* thread.
*/
void doAppend(const log4cplus::spi::InternalLoggingEvent& event);
/**
* Get the name of this appender. The name uniquely identifies the
* appender.
*/
virtual log4cplus::tstring getName();
/**
* Set the name of this appender. The name is used by other
* components to identify this appender.
*/
virtual void setName(const log4cplus::tstring& name);
/**
* Set the {@link ErrorHandler} for this Appender.
*/
virtual void setErrorHandler(std::unique_ptr<ErrorHandler> eh);
/**
* Return the currently set {@link ErrorHandler} for this
* Appender.
*/
virtual ErrorHandler* getErrorHandler();
/**
* Set the layout for this appender. Note that some appenders have
* their own (fixed) layouts or do not use one. For example, the
* SocketAppender ignores the layout set here.
*/
virtual void setLayout(std::unique_ptr<Layout> layout);
/**
* Returns the layout of this appender. The value may be NULL.
*
* This class owns the returned pointer.
*/
virtual Layout* getLayout();
/**
* Set the filter chain on this Appender.
*/
void setFilter(log4cplus::spi::FilterPtr f);
/**
* Get the filter chain on this Appender.
*/
log4cplus::spi::FilterPtr getFilter() const;
/**
* Add filter at the end of the filters chain.
*/
void addFilter (log4cplus::spi::FilterPtr f);
/**
* Add filter at the end of the filters chain.
*/
void addFilter (std::function<
spi::FilterResult (const log4cplus::spi::InternalLoggingEvent &)>);
/**
* Returns this appenders threshold LogLevel. See the {@link
* #setThreshold} method for the meaning of this option.
*/
LogLevel getThreshold() const { return threshold; }
/**
* Set the threshold LogLevel. All log events with lower LogLevel
* than the threshold LogLevel are ignored by the appender.
*
* In configuration files this option is specified by setting the
* value of the <b>Threshold</b> option to a LogLevel
* string, such as "DEBUG", "INFO" and so on.
*/
void setThreshold(LogLevel th) { threshold = th; }
/**
* Check whether the message LogLevel is below the appender's
* threshold. If there is no threshold set, then the return value is
* always <code>true</code>.
*/
bool isAsSevereAsThreshold(LogLevel ll) const {
return ((ll != NOT_SET_LOG_LEVEL) && (ll >= threshold));
}
/**
* This method waits for all events that are being asynchronously
* logged to finish.
*/
void waitToFinishAsyncLogging();
protected:
// Methods
/**
* Subclasses of <code>Appender</code> should implement this
* method to perform actual logging.
* @see doAppend method.
*/
virtual void append(const log4cplus::spi::InternalLoggingEvent& event) = 0;
tstring & formatEvent (const log4cplus::spi::InternalLoggingEvent& event) const;
// Data
/** The layout variable does not need to be set if the appender
* implementation has its own layout. */
std::unique_ptr<Layout> layout;
/** Appenders are named. */
log4cplus::tstring name;
/** There is no LogLevel threshold filtering by default. */
LogLevel threshold;
/** The first filter in the filter chain. Set to <code>null</code>
* initially. */
log4cplus::spi::FilterPtr filter;
/** It is assumed and enforced that errorHandler is never null. */
std::unique_ptr<ErrorHandler> errorHandler;
//! Optional system wide synchronization lock.
std::unique_ptr<helpers::LockFile> lockFile;
//! Use lock file for inter-process synchronization of access
//! to log file.
bool useLockFile;
//! Asynchronous append.
bool async;
#if ! defined (LOG4CPLUS_SINGLE_THREADED)
std::atomic<std::size_t> in_flight;
std::mutex in_flight_mutex;
std::condition_variable in_flight_condition;
#endif
/** Is this appender closed? */
bool closed;
private:
#if ! defined (LOG4CPLUS_SINGLE_THREADED)
void subtract_in_flight();
#endif
};
/** This is a pointer to an Appender. */
typedef helpers::SharedObjectPtr<Appender> SharedAppenderPtr;
} // end namespace log4cplus
#endif // LOG4CPLUS_APPENDER_HEADER_

View File

@@ -0,0 +1,110 @@
// -*- C++ -*-
// Module: Log4cplus
// File: asyncappender.h
// Created: 1/2009
// Author: Vaclav Haisman
//
//
// Copyright (C) 2009-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
/** @file */
#ifndef LOG4CPLUS_ASYNCAPPENDER_H
#define LOG4CPLUS_ASYNCAPPENDER_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#ifndef LOG4CPLUS_SINGLE_THREADED
#include <log4cplus/helpers/queue.h>
#include <log4cplus/appender.h>
#include <log4cplus/thread/threads.h>
#include <log4cplus/helpers/appenderattachableimpl.h>
namespace log4cplus
{
/**
This `Appender` is a wrapper to which other appenders can be attached. The
attached appendres are then appended to from a separate thread which reads
events appended to this appender from a queue.
<h3>Properties</h3>
<dl>
<dt><tt>QueueLimit</tt></dt>
<dd>Events queue size limit. Default is 100.</dd>
</dt>
<dt><tt>Appender</tt></dt>
<dd>`Appender` and its properties to use as sink for logged events.</dd>
</dt>
</dl>
\sa helpers::AppenderAttachableImpl
*/
class LOG4CPLUS_EXPORT AsyncAppender
: public Appender
, public helpers::AppenderAttachableImpl
{
public:
AsyncAppender (SharedAppenderPtr const & app, unsigned max_len);
AsyncAppender (helpers::Properties const &);
virtual ~AsyncAppender ();
virtual void close ();
protected:
virtual void append (spi::InternalLoggingEvent const &);
void init_queue_thread (unsigned);
thread::AbstractThreadPtr queue_thread;
thread::QueuePtr queue;
private:
AsyncAppender (AsyncAppender const &);
AsyncAppender & operator = (AsyncAppender const &);
};
typedef helpers::SharedObjectPtr<AsyncAppender> AsyncAppenderPtr;
} // namespace log4cplus
#endif // LOG4CPLUS_SINGLE_THREADED
#endif // LOG4CPLUS_ASYNCAPPENDER_H

View File

@@ -0,0 +1,201 @@
// Copyright (C) 2009-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_BOOST_DEVICEAPPENDER_HXX
#define LOG4CPLUS_BOOST_DEVICEAPPENDER_HXX
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/not.hpp>
#include <boost/iostreams/operations.hpp>
#include <boost/shared_ptr.hpp>
#include <log4cplus/appender.h>
namespace log4cplus
{
namespace device_appender_detail
{
template <typename T>
struct device_type_traits
{
typedef T & device_type;
static
device_type
unwrap (device_type x)
{
return x;
}
};
template <typename T>
struct device_type_traits<boost::shared_ptr<T> >
{
typedef boost::shared_ptr<T> device_type;
static
T &
unwrap (device_type const & ptr)
{
return *ptr;
}
};
} // namespace device_appender_detail
template <typename Device>
class DeviceAppender
: public Appender
{
public:
typedef device_appender_detail::device_type_traits<Device> device_traits;
typedef typename device_traits::device_type device_type;
template <typename D>
DeviceAppender (D & d, bool close_device = true)
: device (d)
, close_flag (close_device)
{ }
template <typename D>
DeviceAppender (boost::shared_ptr<D> const & d, bool close_device = true)
: device (d)
, close_flag (close_device)
{ }
template <typename D>
DeviceAppender (D & d, const helpers::Properties & props)
: Appender (props)
, device (d)
{
if (props.exists (LOG4CPLUS_TEXT ("CloseDevice")))
close_flag = true;
else
close_flag = false;
}
template <typename D>
DeviceAppender (boost::shared_ptr<D> const & d,
const helpers::Properties & props)
: Appender (props)
, device (d)
{
if (props.exists (LOG4CPLUS_TEXT ("CloseDevice")))
close_flag = true;
else
close_flag = false;
}
virtual
~DeviceAppender ()
{ }
virtual
void
close ()
{
if (close_flag)
boost::iostreams::close (device_traits::unwrap (device));
}
protected:
virtual
void
append (log4cplus::spi::InternalLoggingEvent const & event)
{
tstring & str = formatEvent (event);
boost::iostreams::write (device_traits::unwrap (device),
str.c_str (), str.size ());
}
device_type device;
bool close_flag;
private:
DeviceAppender (DeviceAppender const &);
DeviceAppender & operator = (DeviceAppender const &);
};
template <typename T>
inline
SharedAppenderPtr
make_device_appender (T & d, bool close_device = true)
{
SharedAppenderPtr app (new DeviceAppender<T> (d, close_device));
return app;
}
template <typename T>
inline
SharedAppenderPtr
make_device_appender (T & d, const helpers::Properties & props)
{
SharedAppenderPtr app (new DeviceAppender<T> (d, props));
return app;
}
template <typename T>
inline
SharedAppenderPtr
make_device_appender_sp (boost::shared_ptr<T> const & p,
bool close_device = true)
{
SharedAppenderPtr app (
new DeviceAppender<boost::shared_ptr<T> > (p, close_device));
return app;
}
template <typename T>
inline
SharedAppenderPtr
make_device_appender_sp (boost::shared_ptr<T> const & p,
const helpers::Properties & props)
{
SharedAppenderPtr app (
new DeviceAppender<boost::shared_ptr<T> > (p, props));
return app;
}
} // namespace log4cplus
#endif // LOG4CPLUS_BOOST_DEVICEAPPENDER_HXX

View File

@@ -0,0 +1,73 @@
// -*- C++ -*-
// Copyright (C) 2015-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file */
#ifndef LOG4CPLUS_CALLBACK_APPENDER_HEADER_
#define LOG4CPLUS_CALLBACK_APPENDER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/appender.h>
#include <log4cplus/clogger.h>
namespace log4cplus {
/**
* Send log events to a C function callback.
*/
class LOG4CPLUS_EXPORT CallbackAppender
: public Appender {
public:
CallbackAppender();
CallbackAppender(log4cplus_log_event_callback_t callback, void * cookie);
CallbackAppender(const log4cplus::helpers::Properties&);
virtual ~CallbackAppender();
virtual void close();
void setCookie(void *);
void setCallback(log4cplus_log_event_callback_t);
protected:
virtual void append(const log4cplus::spi::InternalLoggingEvent& event);
private:
log4cplus_log_event_callback_t callback;
void * cookie;
// Disallow copying of instances of this class
CallbackAppender(const CallbackAppender&) = delete;
CallbackAppender& operator=(const CallbackAppender&) = delete;
};
} // end namespace log4cplus
#endif // LOG4CPLUS_CALLBACK_APPENDER_HEADER_

View File

@@ -0,0 +1,98 @@
// -*- C++ -*-
// Module: Log4cplus
// File: clfsappender.h
// Created: 5/2012
// Author: Vaclav Zeman
//
//
// Copyright (C) 2012-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
/** @file */
#ifndef LOG4CPLUS_CLFSAPPENDER_H
#define LOG4CPLUS_CLFSAPPENDER_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/appender.h>
#if defined (LOG4CPLUS_CLFSAPPENDER_BUILD_DLL)
# if defined (INSIDE_LOG4CPLUS_CLFSAPPENDER)
# define LOG4CPLUS_CLFSAPPENDER_EXPORT __declspec(dllexport)
# else
# define LOG4CPLUS_CLFSAPPENDER_EXPORT __declspec(dllimport)
# endif
#else
# define LOG4CPLUS_CLFSAPPENDER_EXPORT
#endif
namespace log4cplus
{
class LOG4CPLUS_CLFSAPPENDER_EXPORT CLFSAppender
: public Appender
{
public:
CLFSAppender (tstring const & logname, unsigned long logsize,
unsigned long buffersize);
explicit CLFSAppender (helpers::Properties const &);
virtual ~CLFSAppender ();
virtual void close ();
static void registerAppender ();
protected:
virtual void append (spi::InternalLoggingEvent const &);
void init (tstring const & logname, unsigned long logsize,
unsigned long buffersize);
struct Data;
Data * data;
private:
CLFSAppender (CLFSAppender const &);
CLFSAppender & operator = (CLFSAppender const &);
};
typedef helpers::SharedObjectPtr<CLFSAppender> CLFSAppenderPtr;
} // namespace log4cplus
#endif // LOG4CPLUS_CLFSAPPENDER_H

View File

@@ -0,0 +1,126 @@
// -*- C -*-
/**
* Module: Log4CPLUS
* File: clogger.h
* Created: 01/2011
* Author: Jens Rehsack
*
*
* Copyright 2011-2017 Jens Rehsack & Tad E. Smith
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @file
* This header defines the C API for log4cplus and the logging macros. */
#ifndef LOG4CPLUS_CLOGGERHEADER_
#define LOG4CPLUS_CLOGGERHEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#ifdef __cplusplus
extern "C"
{
#endif
// TODO UNICDE capable
typedef void * log4cplus_logger_t;
typedef log4cplus_logger_t logger_t;
typedef int log4cplus_loglevel_t;
typedef log4cplus_loglevel_t loglevel_t;
#define L4CP_OFF_LOG_LEVEL 60000
#define L4CP_FATAL_LOG_LEVEL 50000
#define L4CP_ERROR_LOG_LEVEL 40000
#define L4CP_WARN_LOG_LEVEL 30000
#define L4CP_INFO_LOG_LEVEL 20000
#define L4CP_DEBUG_LOG_LEVEL 10000
#define L4CP_TRACE_LOG_LEVEL 0
#define L4CP_ALL_LOG_LEVEL TRACE_LOG_LEVEL
#define L4CP_NOT_SET_LOG_LEVEL -1
#ifdef UNICODE
typedef wchar_t log4cplus_char_t;
#else
typedef char log4cplus_char_t;
#endif // UNICODE
#if ! defined (LOG4CPLUS_TEXT)
#ifdef UNICODE
# define LOG4CPLUS_TEXT2(STRING) L##STRING
#else
# define LOG4CPLUS_TEXT2(STRING) STRING
#endif // UNICODE
#define LOG4CPLUS_TEXT(STRING) LOG4CPLUS_TEXT2(STRING)
#endif // LOG4CPLUS_TEXT
LOG4CPLUS_EXPORT void * log4cplus_initialize(void);
LOG4CPLUS_EXPORT int log4cplus_deinitialize(void * initializer);
LOG4CPLUS_EXPORT int log4cplus_file_configure(const log4cplus_char_t *pathname);
LOG4CPLUS_EXPORT int log4cplus_file_reconfigure(const log4cplus_char_t *pathname);
LOG4CPLUS_EXPORT int log4cplus_str_configure(const log4cplus_char_t *config);
LOG4CPLUS_EXPORT int log4cplus_str_reconfigure(const log4cplus_char_t *config);
LOG4CPLUS_EXPORT int log4cplus_basic_configure(void);
LOG4CPLUS_EXPORT int log4cplus_basic_reconfigure(int logToStdErr);
LOG4CPLUS_EXPORT void log4cplus_shutdown(void);
LOG4CPLUS_EXPORT int log4cplus_logger_exists(const log4cplus_char_t *name);
LOG4CPLUS_EXPORT int log4cplus_logger_is_enabled_for(
const log4cplus_char_t *name, log4cplus_loglevel_t ll);
LOG4CPLUS_EXPORT int log4cplus_logger_log(const log4cplus_char_t *name,
log4cplus_loglevel_t ll, const log4cplus_char_t *msgfmt, ...)
LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4);
LOG4CPLUS_EXPORT int log4cplus_logger_log_str(const log4cplus_char_t *name,
log4cplus_loglevel_t ll, const log4cplus_char_t *msg);
LOG4CPLUS_EXPORT int log4cplus_logger_force_log(const log4cplus_char_t *name,
log4cplus_loglevel_t ll, const log4cplus_char_t *msgfmt, ...)
LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4);
LOG4CPLUS_EXPORT int log4cplus_logger_force_log_str(const log4cplus_char_t *name,
log4cplus_loglevel_t ll, const log4cplus_char_t *msg);
//! CallbackAppender callback type.
typedef void (* log4cplus_log_event_callback_t)(void * cookie,
log4cplus_char_t const * message, log4cplus_char_t const * loggerName,
log4cplus_loglevel_t ll, log4cplus_char_t const * thread,
log4cplus_char_t const * thread2,
unsigned long long timestamp_secs, unsigned long timestamp_usecs,
log4cplus_char_t const * file, log4cplus_char_t const * function, int line);
LOG4CPLUS_EXPORT int log4cplus_add_callback_appender(
const log4cplus_char_t * logger, log4cplus_log_event_callback_t callback,
void * cookie);
// Custom LogLevel
LOG4CPLUS_EXPORT int log4cplus_add_log_level(unsigned int ll,
const log4cplus_char_t *ll_name);
LOG4CPLUS_EXPORT int log4cplus_remove_log_level(unsigned int ll,
const log4cplus_char_t *ll_name);
#ifdef __cplusplus
}
#endif
#endif /*?LOG4CPLUS_CLOGGERHEADER_*/

View File

@@ -0,0 +1,472 @@
/* include/log4cplus/config.h. Generated from config.h.in by configure. */
/* include/log4cplus/config.h.in. Generated from configure.ac by autoheader. */
#ifndef LOG4CPLUS_CONFIG_H
#define LOG4CPLUS_CONFIG_H
/* define if the compiler supports basic C++11 syntax */
/* #undef HAVE_CXX11 */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `fcntl' function. */
#define HAVE_FCNTL 1
/* Define to 1 if you have the `flock' function. */
#define HAVE_FLOCK 1
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
/* Define to 1 if the system has the `constructor' function attribute */
#define HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR 1
/* Define to 1 if the system has the `constructor_priority' function attribute
*/
#define HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY 1
/* */
#define HAVE_GETADDRINFO 1
/* */
#define HAVE_GETHOSTBYNAME_R 1
/* Define to 1 if you have the `getpid' function. */
#define HAVE_GETPID 1
/* Define to 1 if you have the `gmtime_r' function. */
#define HAVE_GMTIME_R 1
/* Define to 1 if you have the `htonl' function. */
#define HAVE_HTONL 1
/* Define to 1 if you have the `htons' function. */
#define HAVE_HTONS 1
/* Define to 1 if you have the `iconv' function. */
/* #undef HAVE_ICONV */
/* Define to 1 if you have the `iconv_close' function. */
/* #undef HAVE_ICONV_CLOSE */
/* Define to 1 if you have the `iconv_open' function. */
/* #undef HAVE_ICONV_OPEN */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `advapi32' library (-ladvapi32). */
/* #undef HAVE_LIBADVAPI32 */
/* Define to 1 if you have the `libiconv' function. */
/* #undef HAVE_LIBICONV */
/* Define to 1 if you have the `libiconv_close' function. */
/* #undef HAVE_LIBICONV_CLOSE */
/* Define to 1 if you have the `libiconv_open' function. */
/* #undef HAVE_LIBICONV_OPEN */
/* Define to 1 if you have the `kernel32' library (-lkernel32). */
/* #undef HAVE_LIBKERNEL32 */
/* Define to 1 if you have the `oleaut32' library (-loleaut32). */
/* #undef HAVE_LIBOLEAUT32 */
/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
/* #undef HAVE_LIBWS2_32 */
/* Define to 1 if you have the `localtime_r' function. */
#define HAVE_LOCALTIME_R 1
/* Define to 1 if you have the `lockf' function. */
#define HAVE_LOCKF 1
/* Define to 1 if you have the `lstat' function. */
#define HAVE_LSTAT 1
/* Define to 1 if you have the `mbstowcs' function. */
#define HAVE_MBSTOWCS 1
/* Define to 1 if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define to 1 if you have the `ntohl' function. */
#define HAVE_NTOHL 1
/* Define to 1 if you have the `ntohs' function. */
#define HAVE_NTOHS 1
/* Define to 1 if you have the `OutputDebugStringW' function. */
/* #undef HAVE_OUTPUTDEBUGSTRINGW */
/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
/* Define to 1 if you have the `pipe2' function. */
#define HAVE_PIPE2 1
/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
/* Have PTHREAD_PRIO_INHERIT. */
#define HAVE_PTHREAD_PRIO_INHERIT 1
/* If available, contains the Python version number currently in use. */
/* #undef HAVE_PYTHON */
/* Define to 1 if you have the `shutdown' function. */
#define HAVE_SHUTDOWN 1
/* Define to 1 if you have the `stat' function. */
#define HAVE_STAT 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Defined if the compiler understands __thread or __declspec(thread)
construct. */
#define HAVE_TLS_SUPPORT 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if the system has the `init_priority' variable attribute */
#define HAVE_VAR_ATTRIBUTE_INIT_PRIORITY 1
/* Define to 1 if you have the `vfprintf_s' function. */
/* #undef HAVE_VFPRINTF_S */
/* Define to 1 if you have the `vfwprintf_s' function. */
/* #undef HAVE_VFWPRINTF_S */
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `vsnwprintf' function. */
/* #undef HAVE_VSNWPRINTF */
/* Define to 1 if you have the `vsprintf_s' function. */
/* #undef HAVE_VSPRINTF_S */
/* Define to 1 if you have the `vswprintf_s' function. */
/* #undef HAVE_VSWPRINTF_S */
/* Define to 1 if you have the `wcstombs' function. */
#define HAVE_WCSTOMBS 1
/* Define to 1 if you have the `_vsnprintf' function. */
/* #undef HAVE__VSNPRINTF */
/* Define to 1 if you have the `_vsnprintf_s' function. */
/* #undef HAVE__VSNPRINTF_S */
/* Define to 1 if you have the `_vsnwprintf' function. */
/* #undef HAVE__VSNWPRINTF */
/* Define to 1 if you have the `_vsnwprintf_s' function. */
/* #undef HAVE__VSNWPRINTF_S */
/* Defined if the compiler supports __FUNCTION__ macro. */
/* #undef HAVE___FUNCTION___MACRO */
/* Defined if the compiler supports __func__ symbol. */
/* #undef HAVE___FUNC___SYMBOL */
/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */
/* #undef HAVE___PRETTY_FUNCTION___MACRO */
/* Defined for --enable-debugging builds. */
/* #undef LOG4CPLUS_DEBUGGING */
/* Defined if the compiler understands __declspec(dllimport) or
__attribute__((visibility("default"))) or __global construct. */
#define LOG4CPLUS_DECLSPEC_EXPORT __attribute__ ((visibility("default")))
/* Defined if the compiler understands __declspec(dllimport) or
__attribute__((visibility("default"))) or __global construct. */
#define LOG4CPLUS_DECLSPEC_IMPORT __attribute__ ((visibility("default")))
/* Defined if the compiler understands __attribute__((visibility("hidden")))
or __hidden construct. */
#define LOG4CPLUS_DECLSPEC_PRIVATE __attribute__ ((visibility("hidden")))
/* */
#define LOG4CPLUS_HAVE_ARPA_INET_H 1
/* */
#define LOG4CPLUS_HAVE_ENAMETOOLONG 1
/* */
#define LOG4CPLUS_HAVE_ERRNO_H 1
/* */
#define LOG4CPLUS_HAVE_FCNTL 1
/* */
#define LOG4CPLUS_HAVE_FCNTL_H 1
/* */
#define LOG4CPLUS_HAVE_FLOCK 1
/* */
#define LOG4CPLUS_HAVE_FTIME 1
/* */
#define LOG4CPLUS_HAVE_FUNCTION_MACRO 1
/* */
#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR 1
/* */
#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY 1
/* */
#define LOG4CPLUS_HAVE_FUNC_SYMBOL 1
/* */
#define LOG4CPLUS_HAVE_GETADDRINFO 1
/* */
#define LOG4CPLUS_HAVE_GETHOSTBYNAME_R 1
/* */
#define LOG4CPLUS_HAVE_GETPID 1
/* */
#define LOG4CPLUS_HAVE_GETTID 1
/* */
#define LOG4CPLUS_HAVE_GMTIME_R 1
/* */
#define LOG4CPLUS_HAVE_HTONL 1
/* */
#define LOG4CPLUS_HAVE_HTONS 1
/* */
/* #undef LOG4CPLUS_HAVE_ICONV */
/* */
/* #undef LOG4CPLUS_HAVE_ICONV_CLOSE */
/* */
/* #undef LOG4CPLUS_HAVE_ICONV_H */
/* */
/* #undef LOG4CPLUS_HAVE_ICONV_OPEN */
/* */
#define LOG4CPLUS_HAVE_LIMITS_H 1
/* */
#define LOG4CPLUS_HAVE_LOCALTIME_R 1
/* */
#define LOG4CPLUS_HAVE_LOCKF 1
/* */
#define LOG4CPLUS_HAVE_LSTAT 1
/* */
#define LOG4CPLUS_HAVE_MBSTOWCS 1
/* */
#define LOG4CPLUS_HAVE_NETDB_H 1
/* */
#define LOG4CPLUS_HAVE_NETINET_IN_H 1
/* */
#define LOG4CPLUS_HAVE_NETINET_TCP_H 1
/* */
#define LOG4CPLUS_HAVE_NTOHL 1
/* */
#define LOG4CPLUS_HAVE_NTOHS 1
/* */
/* #undef LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING */
/* */
#define LOG4CPLUS_HAVE_PIPE 1
/* */
#define LOG4CPLUS_HAVE_PIPE2 1
/* */
#define LOG4CPLUS_HAVE_POLL 1
/* */
#define LOG4CPLUS_HAVE_POLL_H 1
/* */
#define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO 1
/* */
#define LOG4CPLUS_HAVE_SHUTDOWN 1
/* */
#define LOG4CPLUS_HAVE_STAT 1
/* */
#define LOG4CPLUS_HAVE_STDARG_H 1
/* */
#define LOG4CPLUS_HAVE_STDIO_H 1
/* */
#define LOG4CPLUS_HAVE_STDLIB_H 1
/* */
#define LOG4CPLUS_HAVE_SYSLOG_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_FILE_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_SOCKET_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_STAT_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_SYSCALL_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_TIMEB_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_TIME_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_TYPES_H 1
/* */
#define LOG4CPLUS_HAVE_TIME_H 1
/* */
#define LOG4CPLUS_HAVE_TLS_SUPPORT 1
/* */
#define LOG4CPLUS_HAVE_UNISTD_H 1
/* */
#define LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY 1
/* */
/* #undef LOG4CPLUS_HAVE_VFPRINTF_S */
/* */
/* #undef LOG4CPLUS_HAVE_VFWPRINTF_S */
/* */
#define LOG4CPLUS_HAVE_VSNPRINTF 1
/* */
/* #undef LOG4CPLUS_HAVE_VSNWPRINTF */
/* */
/* #undef LOG4CPLUS_HAVE_VSPRINTF_S */
/* */
/* #undef LOG4CPLUS_HAVE_VSWPRINTF_S */
/* */
#define LOG4CPLUS_HAVE_WCHAR_H 1
/* */
#define LOG4CPLUS_HAVE_WCSTOMBS 1
/* */
/* #undef LOG4CPLUS_HAVE__VSNPRINTF */
/* */
/* #undef LOG4CPLUS_HAVE__VSNPRINTF_S */
/* */
/* #undef LOG4CPLUS_HAVE__VSNWPRINTF */
/* */
/* #undef LOG4CPLUS_HAVE__VSNWPRINTF_S */
/* Define if this is a single-threaded library. */
/* #undef LOG4CPLUS_SINGLE_THREADED */
/* */
#define LOG4CPLUS_THREAD_LOCAL_VAR thread_local
/* */
/* #undef LOG4CPLUS_USE_PTHREADS */
/* Define when iconv() is available. */
/* #undef LOG4CPLUS_WITH_ICONV */
/* Defined to enable unit tests. */
/* #undef LOG4CPLUS_WITH_UNIT_TESTS */
/* Define for C99 compilers/standard libraries that support more than just the
"C" locale. */
/* #undef LOG4CPLUS_WORKING_C_LOCALE */
/* Define for compilers/standard libraries that support more than just the "C"
locale. */
/* #undef LOG4CPLUS_WORKING_LOCALE */
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "log4cplus"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "log4cplus 2.1.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "log4cplus"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.1.2"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Defined to the actual TLS support construct. */
#define TLS_SUPPORT_CONSTRUCT thread_local
/* Substitute for socklen_t */
/* #undef socklen_t */
#endif // LOG4CPLUS_CONFIG_H

View File

@@ -0,0 +1,335 @@
/* include/log4cplus/config.h.in. Generated from configure.in by autoheader. */
#ifndef LOG4CPLUS_CONFIG_H
#define LOG4CPLUS_CONFIG_H
/* Defined if the compiler supports C99 style variadic macros with
__VA_ARGS__. */
/* #undef HAS_C99_VARIADIC_MACROS */
/* Defined if the compiler supports GNU style variadic macros. */
/* #undef HAS_GNU_VARIADIC_MACROS */
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
/* Define to 1 if you have the `ftime' function. */
#cmakedefine HAVE_FTIME 1
/* */
#cmakedefine HAVE_GETADDRINFO 1
/* */
#cmakedefine HAVE_GETHOSTBYNAME_R 1
/* Define to 1 if you have the `getpid' function. */
#cmakedefine HAVE_GETPID 1
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `gmtime_r' function. */
#cmakedefine HAVE_GMTIME_R 1
/* Define to 1 if you have the `htonl' function. */
#cmakedefine HAVE_HTONL 1
/* Define to 1 if you have the `htons' function. */
#cmakedefine HAVE_HTONS 1
/* Define to 1 if you have the `iconv' function. */
#cmakedefine HAVE_ICONV 1
/* Define to 1 if you have the `iconv_close' function. */
#cmakedefine HAVE_ICONV_CLOSE 1
/* Define to 1 if you have the `iconv_open' function. */
#cmakedefine HAVE_ICONV_OPEN 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Define to 1 if you have the `advapi32' library (-ladvapi32). */
#cmakedefine HAVE_LIBADVAPI32 1
/* Define to 1 if you have the `libiconv' function. */
/* #undef HAVE_LIBICONV */
/* Define to 1 if you have the `libiconv_close' function. */
/* #undef HAVE_LIBICONV_CLOSE */
/* Define to 1 if you have the `libiconv_open' function. */
/* #undef HAVE_LIBICONV_OPEN */
/* Define to 1 if you have the `kernel32' library (-lkernel32). */
#cmakedefine HAVE_LIBKERNEL32 1
/* Define to 1 if you have the `nsl' library (-lnsl). */
#cmakedefine HAVE_LIBNSL 1
/* Define to 1 if you have the `rt' library (-lrt). */
#cmakedefine HAVE_LIBRT 1
/* Define to 1 if you have the `socket' library (-lsocket). */
#cmakedefine HAVE_LIBSOCKET 1
/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
#cmakedefine HAVE_LIBWS2_32 1
/* Define to 1 if you have the `localtime_r' function. */
#cmakedefine HAVE_LOCALTIME_R 1
/* Define to 1 if you have the `lstat' function. */
#cmakedefine HAVE_LSTAT 1
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1
/* Define to 1 if you have the `ntohl' function. */
#cmakedefine HAVE_NTOHL 1
/* Define to 1 if you have the `ntohs' function. */
#cmakedefine HAVE_NTOHS 1
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Define to 1 if you have the `stat' function. */
#cmakedefine HAVE_STAT 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
/* Define to 1 if you have the `vfprintf_s' function. */
#cmakedefine HAVE_VFPRINTF_S 1
/* Define to 1 if you have the `vfwprintf_s' function. */
#cmakedefine HAVE_VFWPRINTF_S 1
/* Define to 1 if you have the `vsnprintf' function. */
#cmakedefine HAVE_VSNPRINTF 1
/* Define to 1 if you have the `vsprintf_s' function. */
#cmakedefine HAVE_VSPRINTF_S 1
/* Define to 1 if you have the `vswprintf_s' function. */
#cmakedefine HAVE_VSWPRINTF_S 1
/* Define to 1 if you have the `_vsnprintf' function. */
#cmakedefine HAVE__VSNPRINTF 1
/* Define to 1 if you have the `_vsnprintf_s' function. */
#cmakedefine HAVE__VSNPRINTF_S 1
/* Define to 1 if you have the `_vsnwprintf_s' function. */
#cmakedefine HAVE__VSNWPRINTF_S 1
/* Defined if the compiler supports __FUNCTION__ macro. */
#cmakedefine HAVE___FUNCTION___MACRO 1
/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */
#cmakedefine HAVE___PRETTY_FUNCTION___MACRO 1
/* Defined if the compiler provides __sync_add_and_fetch(). */
#cmakedefine HAVE___SYNC_ADD_AND_FETCH 1
/* Defined if the compiler provides __sync_sub_and_fetch(). */
#cmakedefine HAVE___SYNC_SUB_AND_FETCH 1
/* Defined for --enable-debugging builds. */
#undef LOG4CPLUS_DEBUGGING
/* Defined if the compiler understands __declspec(dllimport) or
__attribute__((visibility("default"))) construct. */
#define LOG4CPLUS_DECLSPEC_EXPORT @LOG4CPLUS_DECLSPEC_EXPORT@
/* Defined if the compiler understands __declspec(dllexport) or construct. */
#define LOG4CPLUS_DECLSPEC_IMPORT @LOG4CPLUS_DECLSPEC_IMPORT@ /**/
/* */
#cmakedefine LOG4CPLUS_HAVE_CLOCK_GETTIME 1
/* */
#cmakedefine LOG4CPLUS_HAVE_ENAMETOOLONG 1
/* */
#cmakedefine LOG4CPLUS_HAVE_ERRNO_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_FTIME 1
/* */
#define LOG4CPLUS_HAVE_FUNCTION_MACRO 1
/* */
#cmakedefine LOG4CPLUS_HAVE_GETADDRINFO 1
/* */
#cmakedefine LOG4CPLUS_HAVE_GETHOSTBYNAME_R 1
/* */
#cmakedefine LOG4CPLUS_HAVE_GETPID 1
/* */
#cmakedefine LOG4CPLUS_HAVE_GETTID 1
/* */
#cmakedefine LOG4CPLUS_HAVE_GETTIMEOFDAY 1
/* */
#cmakedefine LOG4CPLUS_HAVE_GMTIME_R 1
/* */
#cmakedefine LOG4CPLUS_HAVE_HTONL 1
/* */
#cmakedefine LOG4CPLUS_HAVE_HTONS 1
/* */
#cmakedefine LOG4CPLUS_HAVE_ICONV 1
/* */
#cmakedefine LOG4CPLUS_HAVE_ICONV_CLOSE 1
/* */
#cmakedefine LOG4CPLUS_HAVE_ICONV_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_ICONV_OPEN 1
/* */
#cmakedefine LOG4CPLUS_HAVE_LIMITS_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_LOCALTIME_R 1
/* */
#cmakedefine LOG4CPLUS_HAVE_LSTAT 1
/* */
#cmakedefine LOG4CPLUS_HAVE_NETDB_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_NETINET_IN_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_NETINET_TCP_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_NTOHL 1
/* */
#cmakedefine LOG4CPLUS_HAVE_NTOHS 1
/* */
#cmakedefine LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO 1
/* */
#cmakedefine LOG4CPLUS_HAVE_STAT 1
/* */
#cmakedefine LOG4CPLUS_HAVE_STDARG_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_STDIO_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_STDLIB_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_SYSLOG_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_SYS_SOCKET_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_SYS_STAT_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_SYS_SYSCALL_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_SYS_TIMEB_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_SYS_TIME_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_SYS_TYPES_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_TIME_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_UNISTD_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE_VFPRINTF_S 1
/* */
#cmakedefine LOG4CPLUS_HAVE_VFWPRINTF_S 1
/* */
#cmakedefine LOG4CPLUS_HAVE_VSNPRINTF 1
/* */
#cmakedefine LOG4CPLUS_HAVE_VSPRINTF_S 1
/* */
#cmakedefine LOG4CPLUS_HAVE_VSWPRINTF_S 1
/* */
#cmakedefine LOG4CPLUS_HAVE_WCHAR_H 1
/* */
#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF 1
/* */
#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF_S 1
/* */
#cmakedefine LOG4CPLUS_HAVE__VSNWPRINTF_S 1
/* Define if this is a single-threaded library. */
#undef LOG4CPLUS_SINGLE_THREADED
/* */
#undef LOG4CPLUS_USE_PTHREADS
/* Define for compilers/standard libraries that support more than just the "C"
locale. */
#undef LOG4CPLUS_WORKING_LOCALE
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* Define to 1 if you have the ANSI C header files. Seems to be unused*/
#cmakedefine STDC_HEADERS 1
/* Define to int if undefined. */
#cmakedefine socklen_t int
#endif // LOG4CPLUS_CONFIG_H

View File

@@ -0,0 +1,471 @@
/* include/log4cplus/config.h.in. Generated from configure.ac by autoheader. */
#ifndef LOG4CPLUS_CONFIG_H
#define LOG4CPLUS_CONFIG_H
/* define if the compiler supports basic C++11 syntax */
#undef HAVE_CXX11
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL
/* Define to 1 if you have the `flock' function. */
#undef HAVE_FLOCK
/* Define to 1 if you have the `ftime' function. */
#undef HAVE_FTIME
/* Define to 1 if the system has the `constructor' function attribute */
#undef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR
/* Define to 1 if the system has the `constructor_priority' function attribute
*/
#undef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY
/* */
#undef HAVE_GETADDRINFO
/* */
#undef HAVE_GETHOSTBYNAME_R
/* Define to 1 if you have the `getpid' function. */
#undef HAVE_GETPID
/* Define to 1 if you have the `gmtime_r' function. */
#undef HAVE_GMTIME_R
/* Define to 1 if you have the `htonl' function. */
#undef HAVE_HTONL
/* Define to 1 if you have the `htons' function. */
#undef HAVE_HTONS
/* Define to 1 if you have the `iconv' function. */
#undef HAVE_ICONV
/* Define to 1 if you have the `iconv_close' function. */
#undef HAVE_ICONV_CLOSE
/* Define to 1 if you have the `iconv_open' function. */
#undef HAVE_ICONV_OPEN
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `advapi32' library (-ladvapi32). */
#undef HAVE_LIBADVAPI32
/* Define to 1 if you have the `libiconv' function. */
#undef HAVE_LIBICONV
/* Define to 1 if you have the `libiconv_close' function. */
#undef HAVE_LIBICONV_CLOSE
/* Define to 1 if you have the `libiconv_open' function. */
#undef HAVE_LIBICONV_OPEN
/* Define to 1 if you have the `kernel32' library (-lkernel32). */
#undef HAVE_LIBKERNEL32
/* Define to 1 if you have the `oleaut32' library (-loleaut32). */
#undef HAVE_LIBOLEAUT32
/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
#undef HAVE_LIBWS2_32
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
/* Define to 1 if you have the `lockf' function. */
#undef HAVE_LOCKF
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if you have the `mbstowcs' function. */
#undef HAVE_MBSTOWCS
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `ntohl' function. */
#undef HAVE_NTOHL
/* Define to 1 if you have the `ntohs' function. */
#undef HAVE_NTOHS
/* Define to 1 if you have the `OutputDebugStringW' function. */
#undef HAVE_OUTPUTDEBUGSTRINGW
/* Define to 1 if you have the `pipe' function. */
#undef HAVE_PIPE
/* Define to 1 if you have the `pipe2' function. */
#undef HAVE_PIPE2
/* Define to 1 if you have the `poll' function. */
#undef HAVE_POLL
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* If available, contains the Python version number currently in use. */
#undef HAVE_PYTHON
/* Define to 1 if you have the `shutdown' function. */
#undef HAVE_SHUTDOWN
/* Define to 1 if you have the `stat' function. */
#undef HAVE_STAT
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Defined if the compiler understands __thread or __declspec(thread)
construct. */
#undef HAVE_TLS_SUPPORT
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the `init_priority' variable attribute */
#undef HAVE_VAR_ATTRIBUTE_INIT_PRIORITY
/* Define to 1 if you have the `vfprintf_s' function. */
#undef HAVE_VFPRINTF_S
/* Define to 1 if you have the `vfwprintf_s' function. */
#undef HAVE_VFWPRINTF_S
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the `vsnwprintf' function. */
#undef HAVE_VSNWPRINTF
/* Define to 1 if you have the `vsprintf_s' function. */
#undef HAVE_VSPRINTF_S
/* Define to 1 if you have the `vswprintf_s' function. */
#undef HAVE_VSWPRINTF_S
/* Define to 1 if you have the `wcstombs' function. */
#undef HAVE_WCSTOMBS
/* Define to 1 if you have the `_vsnprintf' function. */
#undef HAVE__VSNPRINTF
/* Define to 1 if you have the `_vsnprintf_s' function. */
#undef HAVE__VSNPRINTF_S
/* Define to 1 if you have the `_vsnwprintf' function. */
#undef HAVE__VSNWPRINTF
/* Define to 1 if you have the `_vsnwprintf_s' function. */
#undef HAVE__VSNWPRINTF_S
/* Defined if the compiler supports __FUNCTION__ macro. */
#undef HAVE___FUNCTION___MACRO
/* Defined if the compiler supports __func__ symbol. */
#undef HAVE___FUNC___SYMBOL
/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */
#undef HAVE___PRETTY_FUNCTION___MACRO
/* Defined for --enable-debugging builds. */
#undef LOG4CPLUS_DEBUGGING
/* Defined if the compiler understands __declspec(dllimport) or
__attribute__((visibility("default"))) or __global construct. */
#undef LOG4CPLUS_DECLSPEC_EXPORT
/* Defined if the compiler understands __declspec(dllimport) or
__attribute__((visibility("default"))) or __global construct. */
#undef LOG4CPLUS_DECLSPEC_IMPORT
/* Defined if the compiler understands __attribute__((visibility("hidden")))
or __hidden construct. */
#undef LOG4CPLUS_DECLSPEC_PRIVATE
/* */
#undef LOG4CPLUS_HAVE_ARPA_INET_H
/* */
#undef LOG4CPLUS_HAVE_ENAMETOOLONG
/* */
#undef LOG4CPLUS_HAVE_ERRNO_H
/* */
#undef LOG4CPLUS_HAVE_FCNTL
/* */
#undef LOG4CPLUS_HAVE_FCNTL_H
/* */
#undef LOG4CPLUS_HAVE_FLOCK
/* */
#undef LOG4CPLUS_HAVE_FTIME
/* */
#undef LOG4CPLUS_HAVE_FUNCTION_MACRO
/* */
#undef LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR
/* */
#undef LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY
/* */
#undef LOG4CPLUS_HAVE_FUNC_SYMBOL
/* */
#undef LOG4CPLUS_HAVE_GETADDRINFO
/* */
#undef LOG4CPLUS_HAVE_GETHOSTBYNAME_R
/* */
#undef LOG4CPLUS_HAVE_GETPID
/* */
#undef LOG4CPLUS_HAVE_GETTID
/* */
#undef LOG4CPLUS_HAVE_GMTIME_R
/* */
#undef LOG4CPLUS_HAVE_HTONL
/* */
#undef LOG4CPLUS_HAVE_HTONS
/* */
#undef LOG4CPLUS_HAVE_ICONV
/* */
#undef LOG4CPLUS_HAVE_ICONV_CLOSE
/* */
#undef LOG4CPLUS_HAVE_ICONV_H
/* */
#undef LOG4CPLUS_HAVE_ICONV_OPEN
/* */
#undef LOG4CPLUS_HAVE_LIMITS_H
/* */
#undef LOG4CPLUS_HAVE_LOCALTIME_R
/* */
#undef LOG4CPLUS_HAVE_LOCKF
/* */
#undef LOG4CPLUS_HAVE_LSTAT
/* */
#undef LOG4CPLUS_HAVE_MBSTOWCS
/* */
#undef LOG4CPLUS_HAVE_NETDB_H
/* */
#undef LOG4CPLUS_HAVE_NETINET_IN_H
/* */
#undef LOG4CPLUS_HAVE_NETINET_TCP_H
/* */
#undef LOG4CPLUS_HAVE_NTOHL
/* */
#undef LOG4CPLUS_HAVE_NTOHS
/* */
#undef LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING
/* */
#undef LOG4CPLUS_HAVE_PIPE
/* */
#undef LOG4CPLUS_HAVE_PIPE2
/* */
#undef LOG4CPLUS_HAVE_POLL
/* */
#undef LOG4CPLUS_HAVE_POLL_H
/* */
#undef LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
/* */
#undef LOG4CPLUS_HAVE_SHUTDOWN
/* */
#undef LOG4CPLUS_HAVE_STAT
/* */
#undef LOG4CPLUS_HAVE_STDARG_H
/* */
#undef LOG4CPLUS_HAVE_STDIO_H
/* */
#undef LOG4CPLUS_HAVE_STDLIB_H
/* */
#undef LOG4CPLUS_HAVE_SYSLOG_H
/* */
#undef LOG4CPLUS_HAVE_SYS_FILE_H
/* */
#undef LOG4CPLUS_HAVE_SYS_SOCKET_H
/* */
#undef LOG4CPLUS_HAVE_SYS_STAT_H
/* */
#undef LOG4CPLUS_HAVE_SYS_SYSCALL_H
/* */
#undef LOG4CPLUS_HAVE_SYS_TIMEB_H
/* */
#undef LOG4CPLUS_HAVE_SYS_TIME_H
/* */
#undef LOG4CPLUS_HAVE_SYS_TYPES_H
/* */
#undef LOG4CPLUS_HAVE_TIME_H
/* */
#undef LOG4CPLUS_HAVE_TLS_SUPPORT
/* */
#undef LOG4CPLUS_HAVE_UNISTD_H
/* */
#undef LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY
/* */
#undef LOG4CPLUS_HAVE_VFPRINTF_S
/* */
#undef LOG4CPLUS_HAVE_VFWPRINTF_S
/* */
#undef LOG4CPLUS_HAVE_VSNPRINTF
/* */
#undef LOG4CPLUS_HAVE_VSNWPRINTF
/* */
#undef LOG4CPLUS_HAVE_VSPRINTF_S
/* */
#undef LOG4CPLUS_HAVE_VSWPRINTF_S
/* */
#undef LOG4CPLUS_HAVE_WCHAR_H
/* */
#undef LOG4CPLUS_HAVE_WCSTOMBS
/* */
#undef LOG4CPLUS_HAVE__VSNPRINTF
/* */
#undef LOG4CPLUS_HAVE__VSNPRINTF_S
/* */
#undef LOG4CPLUS_HAVE__VSNWPRINTF
/* */
#undef LOG4CPLUS_HAVE__VSNWPRINTF_S
/* Define if this is a single-threaded library. */
#undef LOG4CPLUS_SINGLE_THREADED
/* */
#undef LOG4CPLUS_THREAD_LOCAL_VAR
/* */
#undef LOG4CPLUS_USE_PTHREADS
/* Define when iconv() is available. */
#undef LOG4CPLUS_WITH_ICONV
/* Defined to enable unit tests. */
#undef LOG4CPLUS_WITH_UNIT_TESTS
/* Define for C99 compilers/standard libraries that support more than just the
"C" locale. */
#undef LOG4CPLUS_WORKING_C_LOCALE
/* Define for compilers/standard libraries that support more than just the "C"
locale. */
#undef LOG4CPLUS_WORKING_LOCALE
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Defined to the actual TLS support construct. */
#undef TLS_SUPPORT_CONSTRUCT
/* Substitute for socklen_t */
#undef socklen_t
#endif // LOG4CPLUS_CONFIG_H

View File

@@ -0,0 +1,217 @@
// Copyright (C) 2009-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_CONFIG_HXX
#define LOG4CPLUS_CONFIG_HXX
#if defined (_WIN32)
# include <log4cplus/config/win32.h>
#elif (defined(__MWERKS__) && defined(__MACOS__))
# include <log4cplus/config/macosx.h>
#else
# include <log4cplus/config/defines.hxx>
#endif
# if ! defined (LOG4CPLUS_WORKING_LOCALE) \
&& ! defined (LOG4CPLUS_WORKING_C_LOCALE) \
&& ! defined (LOG4CPLUS_WITH_ICONV)
# define LOG4CPLUS_POOR_MANS_CHCONV
#endif
#ifndef LOG4CPLUS_DECLSPEC_EXPORT
#define LOG4CPLUS_DECLSPEC_EXPORT /* empty */
#endif
#ifndef LOG4CPLUS_DECLSPEC_IMPORT
#define LOG4CPLUS_DECLSPEC_IMPORT /* empty */
#endif
#ifndef LOG4CPLUS_DECLSPEC_PRIVATE
#define LOG4CPLUS_DECLSPEC_PRIVATE /* empty */
#endif
#define LOG4CPLUS_PRIVATE LOG4CPLUS_DECLSPEC_PRIVATE
#if !defined(_WIN32)
# define LOG4CPLUS_USE_BSD_SOCKETS
# if !defined(LOG4CPLUS_SINGLE_THREADED)
# define LOG4CPLUS_USE_PTHREADS
# endif
# if defined (INSIDE_LOG4CPLUS)
# define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_EXPORT
# else
# define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_IMPORT
# endif // defined (INSIDE_LOG4CPLUS)
#endif // !_WIN32
#if defined (LOG4CPLUS_INLINES_ARE_EXPORTED) \
&& defined (LOG4CPLUS_BUILD_DLL)
# define LOG4CPLUS_INLINE_EXPORT inline
#else
# define LOG4CPLUS_INLINE_EXPORT
#endif
#if defined (UNICODE)
# if defined (_MSC_VER) && _MSC_VER >= 1400
# define LOG4CPLUS_FSTREAM_ACCEPTS_WCHAR_T
# endif
# if defined (_MSC_VER) && _MSC_VER >= 1600
# define LOG4CPLUS_HAVE_CODECVT_UTF8_FACET
# define LOG4CPLUS_HAVE_CODECVT_UTF16_FACET
# endif
#endif
// C++11 stuff
#if ! defined (__has_feature)
//! __has_feature(X) is Clangs way for testing features.
//! Define it to 0 if it does not exist.
# define __has_feature(X) 0
#endif
#if __has_feature (cxx_noexcept) \
|| (defined (__GNUC__) \
&& (__GNUC__ > 4 \
|| __GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
|| (defined (_MSC_VER) && _MSC_VER >= 1900)
# define LOG4CPLUS_NOEXCEPT noexcept
# define LOG4CPLUS_NOEXCEPT_FALSE noexcept(false)
#else
# define LOG4CPLUS_NOEXCEPT /* empty */
# define LOG4CPLUS_NOEXCEPT_FALSE /* empty */
#endif
#if ! defined (UNICODE) && defined (__GNUC__) && __GNUC__ >= 3
# define LOG4CPLUS_FORMAT_ATTRIBUTE(archetype, format_index, first_arg_index) \
__attribute__ ((format (archetype, format_index, first_arg_index)))
#else
# define LOG4CPLUS_FORMAT_ATTRIBUTE(archetype, fmt_index, first_arg_index) \
/* empty */
#endif
#if defined (__GNUC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) \
&& ! defined (__INTEL_COMPILER) \
&& ! defined (__CUDACC__)
# define LOG4CPLUS_CALLER_FILE() __builtin_FILE ()
# define LOG4CPLUS_CALLER_LINE() __builtin_LINE ()
# define LOG4CPLUS_CALLER_FUNCTION() __builtin_FUNCTION ()
#else
# define LOG4CPLUS_CALLER_FILE() (nullptr)
# define LOG4CPLUS_CALLER_LINE() (-1)
# define LOG4CPLUS_CALLER_FUNCTION() (nullptr)
#endif
#if defined (__GNUC__) && __GNUC__ >= 3
# define LOG4CPLUS_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
# define LOG4CPLUS_ATTRIBUTE_PURE __attribute__ ((__pure__))
# define LOG4CPLUS_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
# define LOG4CPLUS_BUILTIN_EXPECT(exp, c) __builtin_expect ((exp), (c))
#else
# if ! defined (LOG4CPLUS_ATTRIBUTE_NORETURN)
# define LOG4CPLUS_ATTRIBUTE_NORETURN /* empty */
# endif
# define LOG4CPLUS_ATTRIBUTE_PURE /* empty */
# define LOG4CPLUS_ATTRIBUTE_DEPRECATED /* empty */
# define LOG4CPLUS_BUILTIN_EXPECT(exp, c) (exp)
#endif
#define LOG4CPLUS_LIKELY(cond) LOG4CPLUS_BUILTIN_EXPECT(!! (cond), 1)
#define LOG4CPLUS_UNLIKELY(cond) LOG4CPLUS_BUILTIN_EXPECT(!! (cond), 0)
#if defined (_MSC_VER) \
|| (defined (__BORLANDC__) && __BORLANDC__ >= 0x0650) \
|| (defined (__COMO__) && __COMO_VERSION__ >= 400) /* ??? */ \
|| (defined (__DMC__) && __DMC__ >= 0x700) /* ??? */ \
|| (defined (__clang__) && __clang_major__ >= 3) \
|| (defined (__GNUC__) && (__GNUC__ >= 4 \
|| (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)))
# define LOG4CPLUS_HAVE_PRAGMA_ONCE
# pragma once
#endif
#if defined (LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY)
# define LOG4CPLUS_CONSTRUCTOR_FUNC(prio) \
__attribute__ ((__constructor__ ((prio))))
#elif defined (LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR)
# define LOG4CPLUS_CONSTRUCTOR_FUNC(prio) \
__attribute__ ((__constructor__))
#else
# define LOG4CPLUS_CONSTRUCTOR_FUNC(prio) /* empty */
#endif
#if defined (LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY)
# define LOG4CPLUS_INIT_PRIORITY(prio) \
__attribute__ ((__init_priority__ ((prio))))
#else
# define LOG4CPLUS_INIT_PRIORITY(prio) /* empty */
#endif
#define LOG4CPLUS_INIT_PRIORITY_BASE (65535 / 2)
#include <log4cplus/helpers/thread-config.h>
#if defined (LOG4CPLUS_SINGLE_THREADED)
#define LOG4CPLUS_THREADED(x)
#else
#define LOG4CPLUS_THREADED(x) x
#endif
#if defined(__cplusplus)
#include <cstddef>
namespace log4cplus
{
//! Per thread cleanup function. Users should call this function before
//! a thread ends its execution. It frees resources allocated in thread local
//! storage. It is important only for multi-threaded static library builds
//! of log4cplus and user threads. In all other cases the clean up is provided
//! automatically by other means.
LOG4CPLUS_EXPORT void threadCleanup ();
//! Initializes log4cplus.
//!
//! \note using `log4cplus::Initializer` is preferred
LOG4CPLUS_EXPORT void initialize ();
//! Deinitializes log4cplus.
//!
//! \note using `log4cplus::Initializer` is preferred
LOG4CPLUS_EXPORT void deinitialize ();
//! Set thread pool size.
LOG4CPLUS_EXPORT void setThreadPoolSize (std::size_t pool_size);
//! Set behaviour on full thread pool queue. Default is to block.
LOG4CPLUS_EXPORT void setThreadPoolBlockOnFull (bool block);
//! Set thread pool queue size limit.
LOG4CPLUS_EXPORT void setThreadPoolQueueSizeLimit (std::size_t queue_size_limit);
} // namespace log4cplus
#endif
#endif // LOG4CPLUS_CONFIG_HXX

View File

@@ -0,0 +1,248 @@
/* include/log4cplus/config/defines.hxx. Generated from defines.hxx.in by configure. */
#ifndef LOG4CPLUS_CONFIG_DEFINES_HXX
#define LOG4CPLUS_CONFIG_DEFINES_HXX
/* */
#define LOG4CPLUS_HAVE_SYSLOG_H 1
/* */
#define LOG4CPLUS_HAVE_ARPA_INET_H 1
/* */
#define LOG4CPLUS_HAVE_NETINET_IN_H 1
/* */
#define LOG4CPLUS_HAVE_NETINET_TCP_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_TIMEB_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_TIME_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_TYPES_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_STAT_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_SYSCALL_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_FILE_H 1
/* */
#define LOG4CPLUS_HAVE_TIME_H 1
/* */
#define LOG4CPLUS_HAVE_SYS_SOCKET_H 1
/* */
#define LOG4CPLUS_HAVE_NETDB_H 1
/* */
#define LOG4CPLUS_HAVE_UNISTD_H 1
/* */
#define LOG4CPLUS_HAVE_FCNTL_H 1
/* */
#define LOG4CPLUS_HAVE_STDARG_H 1
/* */
#define LOG4CPLUS_HAVE_STDIO_H 1
/* */
#define LOG4CPLUS_HAVE_STDLIB_H 1
/* */
#define LOG4CPLUS_HAVE_ERRNO_H 1
/* */
#define LOG4CPLUS_HAVE_WCHAR_H 1
/* */
/* #undef LOG4CPLUS_HAVE_ICONV_H */
/* */
#define LOG4CPLUS_HAVE_LIMITS_H 1
/* */
#define LOG4CPLUS_HAVE_FTIME 1
/* */
#define LOG4CPLUS_HAVE_GETADDRINFO 1
/* */
#define LOG4CPLUS_HAVE_GETHOSTBYNAME_R 1
/* */
#define LOG4CPLUS_HAVE_GETPID 1
/* */
#define LOG4CPLUS_HAVE_GMTIME_R 1
/* */
#define LOG4CPLUS_HAVE_HTONL 1
/* */
#define LOG4CPLUS_HAVE_HTONS 1
/* */
#define LOG4CPLUS_HAVE_LOCALTIME_R 1
/* */
#define LOG4CPLUS_HAVE_LSTAT 1
/* */
#define LOG4CPLUS_HAVE_FCNTL 1
/* */
#define LOG4CPLUS_HAVE_LOCKF 1
/* */
#define LOG4CPLUS_HAVE_FLOCK 1
/* */
#define LOG4CPLUS_HAVE_NTOHL 1
/* */
#define LOG4CPLUS_HAVE_NTOHS 1
/* Define to 1 if you have the `shutdown' function. */
#define LOG4CPLUS_HAVE_SHUTDOWN 1
/* */
#define LOG4CPLUS_HAVE_PIPE 1
/* */
#define LOG4CPLUS_HAVE_PIPE2 1
/* */
#define LOG4CPLUS_HAVE_POLL 1
/* */
#define LOG4CPLUS_HAVE_POLL_H 1
/* */
#define LOG4CPLUS_HAVE_STAT 1
/* Define if this is a single-threaded library. */
/* #undef LOG4CPLUS_SINGLE_THREADED */
/* */
/* #undef LOG4CPLUS_USE_PTHREADS */
/* Define for compilers/standard libraries that support more than just the "C"
locale. */
/* #undef LOG4CPLUS_WORKING_LOCALE */
/* Define for C99 compilers/standard libraries that support more than just the
"C" locale. */
/* #undef LOG4CPLUS_WORKING_C_LOCALE */
/* Define to int if undefined. */
/* #undef socklen_t */
/* Defined for --enable-debugging builds. */
/* #undef LOG4CPLUS_DEBUGGING */
/* Defined if the compiler understands __declspec(dllexport) or
__attribute__((visibility("default"))) construct. */
#define LOG4CPLUS_DECLSPEC_EXPORT __attribute__ ((visibility("default")))
/* Defined if the compiler understands __declspec(dllimport) or
__attribute__((visibility("default"))) construct. */
#define LOG4CPLUS_DECLSPEC_IMPORT __attribute__ ((visibility("default")))
/* Defined if the compiler understands
__attribute__((visibility("hidden"))) construct. */
#define LOG4CPLUS_DECLSPEC_PRIVATE __attribute__ ((visibility("hidden")))
/* */
#define LOG4CPLUS_HAVE_TLS_SUPPORT 1
/* */
#define LOG4CPLUS_THREAD_LOCAL_VAR thread_local
/* Defined if the host OS provides ENAMETOOLONG errno value. */
#define LOG4CPLUS_HAVE_ENAMETOOLONG 1
/* */
#define LOG4CPLUS_HAVE_VSNPRINTF 1
/* Define to 1 if you have the `vsnwprintf' function. */
/* #undef LOG4CPLUS_HAVE_VSNWPRINTF */
/* Define to 1 if you have the `_vsnwprintf' function. */
/* #undef LOG4CPLUS_HAVE__VSNWPRINTF */
/* */
/* #undef LOG4CPLUS_HAVE__VSNPRINTF */
/* Define to 1 if you have the `vfprintf_s' function. */
/* #undef LOG4CPLUS_HAVE_VFPRINTF_S */
/* Define to 1 if you have the `vfwprintf_s' function. */
/* #undef LOG4CPLUS_HAVE_VFWPRINTF_S */
/* Define to 1 if you have the `vsprintf_s' function. */
/* #undef LOG4CPLUS_HAVE_VSPRINTF_S */
/* Define to 1 if you have the `vswprintf_s' function. */
/* #undef LOG4CPLUS_HAVE_VSWPRINTF_S */
/* Define to 1 if you have the `_vsnprintf_s' function. */
/* #undef LOG4CPLUS_HAVE__VSNPRINTF_S */
/* Define to 1 if you have the `_vsnwprintf_s' function. */
/* #undef LOG4CPLUS_HAVE__VSNWPRINTF_S */
/* Defined if the compiler supports __FUNCTION__ macro. */
#define LOG4CPLUS_HAVE_FUNCTION_MACRO 1
/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */
#define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO 1
/* Defined if the compiler supports __func__ symbol. */
#define LOG4CPLUS_HAVE_FUNC_SYMBOL 1
/* Define to 1 if you have the `mbstowcs' function. */
#define LOG4CPLUS_HAVE_MBSTOWCS 1
/* Define to 1 if you have the `wcstombs' function. */
#define LOG4CPLUS_HAVE_WCSTOMBS 1
/* Define to 1 if you have Linux style syscall(SYS_gettid). */
#define LOG4CPLUS_HAVE_GETTID 1
/* Define when iconv() is available. */
/* #undef LOG4CPLUS_WITH_ICONV */
/* Define to 1 if you have the `iconv' function. */
/* #undef LOG4CPLUS_HAVE_ICONV */
/* Define to 1 if you have the `iconv_close' function. */
/* #undef LOG4CPLUS_HAVE_ICONV_CLOSE */
/* Define to 1 if you have the `iconv_open' function. */
/* #undef LOG4CPLUS_HAVE_ICONV_OPEN */
/* Define to 1 if you have the `OutputDebugString' function. */
/* #undef LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING */
/* Define to 1 if the system has the `constructor' function attribute
with priority */
#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY 1
/* Define to 1 if the system has the `constructor' function attribute */
#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR 1
/* Define to 1 if the system has the `init_priority' variable attribute */
#define LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY 1
/* Defined to enable unit tests. */
/* #undef LOG4CPLUS_WITH_UNIT_TESTS */
#endif // LOG4CPLUS_CONFIG_DEFINES_HXX

View File

@@ -0,0 +1,247 @@
#ifndef LOG4CPLUS_CONFIG_DEFINES_HXX
#define LOG4CPLUS_CONFIG_DEFINES_HXX
/* */
#undef LOG4CPLUS_HAVE_SYSLOG_H
/* */
#undef LOG4CPLUS_HAVE_ARPA_INET_H
/* */
#undef LOG4CPLUS_HAVE_NETINET_IN_H
/* */
#undef LOG4CPLUS_HAVE_NETINET_TCP_H
/* */
#undef LOG4CPLUS_HAVE_SYS_TIMEB_H
/* */
#undef LOG4CPLUS_HAVE_SYS_TIME_H
/* */
#undef LOG4CPLUS_HAVE_SYS_TYPES_H
/* */
#undef LOG4CPLUS_HAVE_SYS_STAT_H
/* */
#undef LOG4CPLUS_HAVE_SYS_SYSCALL_H
/* */
#undef LOG4CPLUS_HAVE_SYS_FILE_H
/* */
#undef LOG4CPLUS_HAVE_TIME_H
/* */
#undef LOG4CPLUS_HAVE_SYS_SOCKET_H
/* */
#undef LOG4CPLUS_HAVE_NETDB_H
/* */
#undef LOG4CPLUS_HAVE_UNISTD_H
/* */
#undef LOG4CPLUS_HAVE_FCNTL_H
/* */
#undef LOG4CPLUS_HAVE_STDARG_H
/* */
#undef LOG4CPLUS_HAVE_STDIO_H
/* */
#undef LOG4CPLUS_HAVE_STDLIB_H
/* */
#undef LOG4CPLUS_HAVE_ERRNO_H
/* */
#undef LOG4CPLUS_HAVE_WCHAR_H
/* */
#undef LOG4CPLUS_HAVE_ICONV_H
/* */
#undef LOG4CPLUS_HAVE_LIMITS_H
/* */
#undef LOG4CPLUS_HAVE_FTIME
/* */
#undef LOG4CPLUS_HAVE_GETADDRINFO
/* */
#undef LOG4CPLUS_HAVE_GETHOSTBYNAME_R
/* */
#undef LOG4CPLUS_HAVE_GETPID
/* */
#undef LOG4CPLUS_HAVE_GMTIME_R
/* */
#undef LOG4CPLUS_HAVE_HTONL
/* */
#undef LOG4CPLUS_HAVE_HTONS
/* */
#undef LOG4CPLUS_HAVE_LOCALTIME_R
/* */
#undef LOG4CPLUS_HAVE_LSTAT
/* */
#undef LOG4CPLUS_HAVE_FCNTL
/* */
#undef LOG4CPLUS_HAVE_LOCKF
/* */
#undef LOG4CPLUS_HAVE_FLOCK
/* */
#undef LOG4CPLUS_HAVE_NTOHL
/* */
#undef LOG4CPLUS_HAVE_NTOHS
/* Define to 1 if you have the `shutdown' function. */
#undef LOG4CPLUS_HAVE_SHUTDOWN
/* */
#undef LOG4CPLUS_HAVE_PIPE
/* */
#undef LOG4CPLUS_HAVE_PIPE2
/* */
#undef LOG4CPLUS_HAVE_POLL
/* */
#undef LOG4CPLUS_HAVE_POLL_H
/* */
#undef LOG4CPLUS_HAVE_STAT
/* Define if this is a single-threaded library. */
#undef LOG4CPLUS_SINGLE_THREADED
/* */
#undef LOG4CPLUS_USE_PTHREADS
/* Define for compilers/standard libraries that support more than just the "C"
locale. */
#undef LOG4CPLUS_WORKING_LOCALE
/* Define for C99 compilers/standard libraries that support more than just the
"C" locale. */
#undef LOG4CPLUS_WORKING_C_LOCALE
/* Define to int if undefined. */
#undef socklen_t
/* Defined for --enable-debugging builds. */
#undef LOG4CPLUS_DEBUGGING
/* Defined if the compiler understands __declspec(dllexport) or
__attribute__((visibility("default"))) construct. */
#undef LOG4CPLUS_DECLSPEC_EXPORT
/* Defined if the compiler understands __declspec(dllimport) or
__attribute__((visibility("default"))) construct. */
#undef LOG4CPLUS_DECLSPEC_IMPORT
/* Defined if the compiler understands
__attribute__((visibility("hidden"))) construct. */
#undef LOG4CPLUS_DECLSPEC_PRIVATE
/* */
#undef LOG4CPLUS_HAVE_TLS_SUPPORT
/* */
#undef LOG4CPLUS_THREAD_LOCAL_VAR
/* Defined if the host OS provides ENAMETOOLONG errno value. */
#undef LOG4CPLUS_HAVE_ENAMETOOLONG
/* */
#undef LOG4CPLUS_HAVE_VSNPRINTF
/* Define to 1 if you have the `vsnwprintf' function. */
#undef LOG4CPLUS_HAVE_VSNWPRINTF
/* Define to 1 if you have the `_vsnwprintf' function. */
#undef LOG4CPLUS_HAVE__VSNWPRINTF
/* */
#undef LOG4CPLUS_HAVE__VSNPRINTF
/* Define to 1 if you have the `vfprintf_s' function. */
#undef LOG4CPLUS_HAVE_VFPRINTF_S
/* Define to 1 if you have the `vfwprintf_s' function. */
#undef LOG4CPLUS_HAVE_VFWPRINTF_S
/* Define to 1 if you have the `vsprintf_s' function. */
#undef LOG4CPLUS_HAVE_VSPRINTF_S
/* Define to 1 if you have the `vswprintf_s' function. */
#undef LOG4CPLUS_HAVE_VSWPRINTF_S
/* Define to 1 if you have the `_vsnprintf_s' function. */
#undef LOG4CPLUS_HAVE__VSNPRINTF_S
/* Define to 1 if you have the `_vsnwprintf_s' function. */
#undef LOG4CPLUS_HAVE__VSNWPRINTF_S
/* Defined if the compiler supports __FUNCTION__ macro. */
#undef LOG4CPLUS_HAVE_FUNCTION_MACRO
/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */
#undef LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
/* Defined if the compiler supports __func__ symbol. */
#undef LOG4CPLUS_HAVE_FUNC_SYMBOL
/* Define to 1 if you have the `mbstowcs' function. */
#undef LOG4CPLUS_HAVE_MBSTOWCS
/* Define to 1 if you have the `wcstombs' function. */
#undef LOG4CPLUS_HAVE_WCSTOMBS
/* Define to 1 if you have Linux style syscall(SYS_gettid). */
#undef LOG4CPLUS_HAVE_GETTID
/* Define when iconv() is available. */
#undef LOG4CPLUS_WITH_ICONV
/* Define to 1 if you have the `iconv' function. */
#undef LOG4CPLUS_HAVE_ICONV
/* Define to 1 if you have the `iconv_close' function. */
#undef LOG4CPLUS_HAVE_ICONV_CLOSE
/* Define to 1 if you have the `iconv_open' function. */
#undef LOG4CPLUS_HAVE_ICONV_OPEN
/* Define to 1 if you have the `OutputDebugString' function. */
#undef LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING
/* Define to 1 if the system has the `constructor' function attribute
with priority */
#undef LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY
/* Define to 1 if the system has the `constructor' function attribute */
#undef LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR
/* Define to 1 if the system has the `init_priority' variable attribute */
#undef LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY
/* Defined to enable unit tests. */
#undef LOG4CPLUS_WITH_UNIT_TESTS
#endif // LOG4CPLUS_CONFIG_DEFINES_HXX

View File

@@ -0,0 +1,37 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: config-macosx.h
// Created: 7/2003
// Author: Christopher R. Bailey
//
//
// Copyright 2003-2017 Christopher R. Bailey
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_CONFIG_MACOSX_HEADER_
#define LOG4CPLUS_CONFIG_MACOSX_HEADER_
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if (defined(__APPLE__) || (defined(__MWERKS__) && defined(__MACOS__)))
#define LOG4CPLUS_HAVE_GETTIMEOFDAY 1
#define socklen_t int
#endif // MACOSX
#endif // LOG4CPLUS_CONFIG_MACOSX_HEADER_

View File

@@ -0,0 +1 @@
timestamp for include/log4cplus/config/defines.hxx

View File

@@ -0,0 +1,194 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: config-win32.h
// Created: 4/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_CONFIG_WIN32_HEADER_
#define LOG4CPLUS_CONFIG_WIN32_HEADER_
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if defined (__MINGW32__) || defined (__MINGW64__)
# include <_mingw.h>
#endif
#ifdef _WIN32
#if (defined (_MSC_VER) && _MSC_VER > 1400) \
|| (defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 3)
# define LOG4CPLUS_HAVE_INTRIN_H
#endif
// Time related functions and headers.
#define LOG4CPLUS_HAVE_TIME_H
#define LOG4CPLUS_HAVE_SYS_TIMEB_H
#define LOG4CPLUS_HAVE_FTIME
#if defined (_MSC_VER) || defined (__BORLANDC__)
#define LOG4CPLUS_HAVE_GMTIME_S
#endif
// Use Winsock on Windows.
#define LOG4CPLUS_USE_WINSOCK
// Enable Win32DebugAppender
#define LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING
// Enable Win32ConsoleAppender.
#define LOG4CPLUS_HAVE_WIN32_CONSOLE
#define LOG4CPLUS_HAVE_SYS_TYPES_H
#define LOG4CPLUS_HAVE_SYS_LOCKING_H
#define LOG4CPLUS_HAVE_FCNTL_H
#define LOG4CPLUS_HAVE_IO_H
#define LOG4CPLUS_HAVE_STDIO_H
#define LOG4CPLUS_HAVE_WCHAR_H
#define LOG4CPLUS_HAVE_STDARG_H
#define LOG4CPLUS_HAVE_STDLIB_H
#define LOG4CPLUS_HAVE_ERRNO_H
#define LOG4CPLUS_HAVE_SYS_STAT_H
#define LOG4CPLUS_HAVE_TIME_H
#define LOG4CPLUS_HAVE_STDLIB_H
#define LOG4CPLUS_HAVE_DIRECT_H
// MSVC has both and so does MinGW.
#define LOG4CPLUS_HAVE_VSNPRINTF
#define LOG4CPLUS_HAVE__VSNPRINTF
#define LOG4CPLUS_HAVE__VSNWPRINTF
// Limit the use of foo_s() functions to builds using Visual Studio
// 2005 and its run time library. In MinGW land, limit the foo_s()
// functions to MinGw-w64 toolchain and __MSVCRT_VERSION__ >= 0x0900.
#if (defined (_MSC_VER) && _MSC_VER >= 1400) \
|| (defined (__MSVCRT_VERSION__) && __MSVCRT_VERSION__ >= 0x0900 \
&& defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 2)
// MS secure versions of vprintf().
# define LOG4CPLUS_HAVE_VSPRINTF_S
# define LOG4CPLUS_HAVE_VSWPRINTF_S
// MS secure versions of vfprintf().
# define LOG4CPLUS_HAVE_VFPRINTF_S
# define LOG4CPLUS_HAVE_VFWPRINTF_S
// MS secure versions of vsnprintf().
# define LOG4CPLUS_HAVE_VSNPRINTF_S
# define LOG4CPLUS_HAVE__VSNPRINTF_S
# define LOG4CPLUS_HAVE__VSNWPRINTF_S
// MS secure version of _tsopen().
# define LOG4CPLUS_HAVE__TSOPEN_S
#endif
#if defined (_MSC_VER) && _MSC_VER >= 1400
// MS printf-like functions supporting positional parameters.
# define LOG4CPLUS_HAVE__VSPRINTF_P
# define LOG4CPLUS_HAVE__VSWPRINTF_P
#endif
#if defined (_MSC_VER)
# define LOG4CPLUS_HAVE_LOCALTIME_S
#endif
#define LOG4CPLUS_HAVE__TSOPEN
#define LOG4CPLUS_DLLMAIN_HINSTANCE HINSTANCE
#define LOG4CPLUS_HAVE_NT_EVENT_LOG
// log4cplus_EXPORTS is used by the CMake build system. DLL_EXPORT is
// used by the autotools build system.
#if (defined (log4cplus_EXPORTS) || defined (log4cplusU_EXPORTS) \
|| (defined (DLL_EXPORT) && defined (INSIDE_LOG4CPLUS))) \
&& ! defined (LOG4CPLUS_STATIC)
# undef LOG4CPLUS_BUILD_DLL
# define LOG4CPLUS_BUILD_DLL
#endif
#if ! defined (LOG4CPLUS_BUILD_DLL)
# undef LOG4CPLUS_STATIC
# define LOG4CPLUS_STATIC
#endif
#if defined (LOG4CPLUS_STATIC) && defined (LOG4CPLUS_BUILD_DLL)
# error LOG4CPLUS_STATIC and LOG4CPLUS_BUILD_DLL cannot be defined both.
#endif
#if defined (LOG4CPLUS_BUILD_DLL)
# if defined (INSIDE_LOG4CPLUS)
# define LOG4CPLUS_EXPORT __declspec(dllexport)
# else
# define LOG4CPLUS_EXPORT __declspec(dllimport)
# endif
#else
# define LOG4CPLUS_EXPORT
#endif
#ifndef LOG4CPLUS_SINGLE_THREADED
# define LOG4CPLUS_USE_WIN32_THREADS
#endif
#if defined(_MSC_VER)
// Warning about: identifier was truncated to '255' characters in the debug information
# pragma warning( disable : 4786 )
// Warning about: <type1> needs to have dll-interface to be used by clients of class <type2>
# pragma warning( disable : 4251 )
# define LOG4CPLUS_INLINES_ARE_EXPORTED
# if _MSC_VER >= 1400
# define LOG4CPLUS_WORKING_LOCALE
# define LOG4CPLUS_HAVE_FUNCTION_MACRO
# define LOG4CPLUS_HAVE_FUNCSIG_MACRO
# define LOG4CPLUS_ATTRIBUTE_NORETURN __declspec(noreturn)
# endif
#endif
#if defined (__GNUC__)
# undef LOG4CPLUS_INLINES_ARE_EXPORTED
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
# define LOG4CPLUS_HAVE_FUNC_SYMBOL
# endif
// This has worked for some versions of MinGW with GCC 4.7+ but it
// appears to be broken again in 4.8.x. Thus, we disable this for GCC
// completely forever.
//
//# define LOG4CPLUS_INLINES_ARE_EXPORTED
# define LOG4CPLUS_HAVE_FUNCTION_MACRO
# if defined (__MINGW32__)
# define LOG4CPLUS_WORKING_C_LOCALE
# endif
#endif
#if defined (__BORLANDC__) && __BORLANDC__ >= 0x0650
# define LOG4CPLUS_HAVE_FUNCTION_MACRO
#endif // __BORLANDC__
#if ! defined (LOG4CPLUS_DISABLE_DLL_RUNTIME_WARNING)
# if defined (LOG4CPLUS_STATIC) && defined (_MSC_VER) && ! defined (_DLL)
# pragma message("You are not using DLL C run time library. " \
"You must call log4cplus::initialize() once before " \
"you use any other log4cplus API.")
# endif
#endif
#endif // _WIN32
#endif // LOG4CPLUS_CONFIG_WIN32_HEADER_

View File

@@ -0,0 +1,42 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: windowsh-inc.h
// Created: 9/2018
// Author: Vaclav Haisman
//
//
// Copyright (C) 2018, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// NOTE: This file is a fragment intentionally left without include guards.
#if defined (_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#if defined (LOG4CPLUS_HAVE_INTRIN_H)
#include <intrin.h>
#endif
#endif
// NOTE: This file is a fragment intentionally left without include guards.

View File

@@ -0,0 +1,159 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: windowsh-inc.h
// Created: 4/2010
// Author: Vaclav Zeman
//
//
// Copyright (C) 2010-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// NOTE: This file is a fragment intentionally left without include guards.
#if defined (_WIN32)
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#undef NOGDICAPMASKS
#define NOGDICAPMASKS
#undef NOVIRTUALKEYCODES
#define NOVIRTUALKEYCODES
#undef NOWINMESSAGES
#define NOWINMESSAGES
#undef NOWINSTYLES
#define NOWINSTYLES
#undef NOSYSMETRICS
#define NOSYSMETRICS
#undef NOMENUS
#define NOMENUS
#undef NOICONS
#define NOICONS
#undef NOKEYSTATES
#define NOKEYSTATES
#undef NOSYSCOMMANDS
#define NOSYSCOMMANDS
#undef NORASTEROPS
#define NORASTEROPS
#undef NOSHOWWINDOW
#define NOSHOWWINDOW
#undef NOATOM
#define NOATOM
#undef NOCLIPBOARD
#define NOCLIPBOARD
#undef NOCOLOR
#define NOCOLOR
#undef NOCTLMGR
#define NOCTLMGR
#undef NODRAWTEXT
#define NODRAWTEXT
#undef NOGDI
#define NOGDI
#undef NOKERNEL
#define NOKERNEL
#undef NOUSER
#define NOUSER
#undef NONLS
#define NONLS
#undef NOMB
#define NOMB
#undef NOMEMMGR
#define NOMEMMGR
#undef NOMETAFILE
#define NOMETAFILE
#undef NOMINMAX
#define NOMINMAX
#undef NOMSG
#define NOMSG
#undef NOOPENFILE
#define NOOPENFILE
#undef NOSCROLL
#define NOSCROLL
#undef NOSERVICE
#define NOSERVICE
#undef NOSOUND
#define NOSOUND
#undef NOTEXTMETRIC
#define NOTEXTMETRIC
#undef NOWH
#define NOWH
#undef NOWINOFFSETS
#define NOWINOFFSETS
#undef NOCOMM
#define NOCOMM
#undef NOKANJI
#define NOKANJI
#undef NOHELP
#define NOHELP
#undef NOPROFILER
#define NOPROFILER
#undef NODEFERWINDOWPOS
#define NODEFERWINDOWPOS
#undef NOMCX
#define NOMCX
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#if defined (LOG4CPLUS_HAVE_INTRIN_H)
#include <intrin.h>
#endif
#endif
// NOTE: This file is a fragment intentionally left without include guards.

View File

@@ -0,0 +1,389 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: configurator.h
// Created: 3/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_CONFIGURATOR_HEADER_
#define LOG4CPLUS_CONFIGURATOR_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/appender.h>
#include <log4cplus/logger.h>
#include <log4cplus/helpers/pointer.h>
#include <log4cplus/helpers/property.h>
#include <map>
namespace log4cplus
{
class Hierarchy;
/**
* Provides configuration from an external file. See configure() for
* the expected format.
*
* <em>All option values admit variable substitution.</em> For
* example, if <code>userhome</code> environment property is set to
* <code>/home/xyz</code> and the File option is set to the string
* <code>${userhome}/test.log</code>, then File option will be
* interpreted as the string <code>/home/xyz/test.log</code>.
*
* The syntax of variable substitution is similar to that of UNIX
* shells. The string between an opening <b>&quot;${&quot;</b> and
* closing <b>&quot;}&quot;</b> is interpreted as a key. Its value is
* searched in the environment properties. The corresponding value replaces
* the ${variableName} sequence.
*
* Configuration files also recognize <code>include
* <i>file.properties</i></code> directive that allow composing
* configuration from multiple files. There is no cyclic includes
* detection mechanism to stop unbound recursion.
*/
class LOG4CPLUS_EXPORT PropertyConfigurator
{
public:
enum PCFlags
{
fRecursiveExpansion = (1 << 0)
, fShadowEnvironment = (1 << 1)
, fAllowEmptyVars = (1 << 2)
// These encoding related options occupy 2 bits of the flags
// and are mutually exclusive. These flags are synchronized with
// PFlags in Properties.
, fEncodingShift = 3
, fEncodingMask = 0x3
, fUnspecEncoding = (0 << fEncodingShift)
#if defined (LOG4CPLUS_HAVE_CODECVT_UTF8_FACET) && defined (UNICODE)
, fUTF8 = (1 << fEncodingShift)
#endif
#if (defined (LOG4CPLUS_HAVE_CODECVT_UTF16_FACET) || defined (_WIN32)) \
&& defined (UNICODE)
, fUTF16 = (2 << fEncodingShift)
#endif
#if defined (LOG4CPLUS_HAVE_CODECVT_UTF32_FACET) && defined (UNICODE)
, fUTF32 = (3 << fEncodingShift)
#endif
, fThrow = (1 << 5)
};
// ctor and dtor
PropertyConfigurator(const log4cplus::tstring& propertyFile,
Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0);
PropertyConfigurator(const log4cplus::helpers::Properties& props,
Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0);
PropertyConfigurator(log4cplus::tistream& propertyStream,
Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0);
virtual ~PropertyConfigurator();
/**
* This method eliminates the need to create a temporary
* <code>PropertyConfigurator</code> to configure log4cplus.
* It is equivalent to the following:<br>
* <code>
* PropertyConfigurator config("filename");
* config.configure();
* </code>
*/
static void doConfigure(const log4cplus::tstring& configFilename,
Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0);
/**
* Read configuration from a file. <b>The existing configuration is
* not cleared nor reset.</b> If you require a different behavior,
* then call {@link Hierarchy::resetConfiguration
* resetConfiguration} method before calling
* <code>doConfigure</code>.
*
* The configuration file consists of statements in the format
* <code>key=value</code>. The syntax of different configuration
* elements are discussed below.
*
* <h3>Appender configuration</h3>
*
* Appender configuration syntax is:
* <pre>
* # For appender named <i>appenderName</i>, set its class.
* # Note: The appender name can contain dots.
* log4cplus.appender.appenderName=fully.qualified.name.of.appender.class
*
* # Set appender specific options.
* log4cplus.appender.appenderName.option1=value1
* ...
* log4cplus.appender.appenderName.optionN=valueN
* </pre>
*
* For each named appender you can configure its {@link Layout}. The
* syntax for configuring an appender's layout is:
* <pre>
* log4cplus.appender.appenderName.layout=fully.qualified.name.of.layout.class
* log4cplus.appender.appenderName.layout.option1=value1
* ....
* log4cplus.appender.appenderName.layout.optionN=valueN
* </pre>
*
* <h3>Configuring loggers</h3>
*
* The syntax for configuring the root logger is:
* <pre>
* log4cplus.rootLogger=[LogLevel], appenderName, appenderName, ...
* </pre>
*
* This syntax means that an optional <em>LogLevel value</em> can
* be supplied followed by appender names separated by commas.
*
* The LogLevel value can consist of the string values FATAL,
* ERROR, WARN, INFO, DEBUG or a <em>custom LogLevel</em> value.
*
* If a LogLevel value is specified, then the root LogLevel is set
* to the corresponding LogLevel. If no LogLevel value is specified,
* then the root LogLevel remains untouched.
*
* The root logger can be assigned multiple appenders.
*
* Each <i>appenderName</i> (separated by commas) will be added to
* the root logger. The named appender is defined using the
* appender syntax defined above.
*
* For non-root loggers the syntax is almost the same:
* <pre>
* log4cplus.logger.logger_name=[LogLevel|INHERITED], appenderName, appenderName, ...
* </pre>
*
* The meaning of the optional LogLevel value is discussed above
* in relation to the root logger. In addition however, the value
* INHERITED can be specified meaning that the named logger should
* inherit its LogLevel from the logger hierarchy.
*
* By default loggers inherit their LogLevel from the
* hierarchy. However, if you set the LogLevel of a logger and
* later decide that that logger should inherit its LogLevel, then
* you should specify INHERITED as the value for the LogLevel value.
*
* Similar to the root logger syntax, each <i>appenderName</i>
* (separated by commas) will be attached to the named logger.
*
* See the <a href="../../../../manual.html#additivity">appender
* additivity rule</a> in the user manual for the meaning of the
* <code>additivity</code> flag.
*
* The user can override any of the {@link
* Hierarchy#disable} family of methods by setting the a key
* "log4cplus.disableOverride" to <code>true</code> or any value other
* than false. As in <pre>log4cplus.disableOverride=true </pre>
*
* <h3>Global configuration</h3>
*
* <ul>
* <li>Property <pre>log4cplus.threadPoolSize</pre> can be used to adjust
* size of log4cplus' internal thread pool.</li>
* <li>Property <pre>log4cplus.threadPoolBlockOnFull</pre> can be
* used to change behaviour of the thread pool when its queue is full.
* The default value is <pre>true</pre>, to block the thread until
* there is a space in the queue. Setting this property to
* <pre>false</pre> makes the thread pool not to block when it is full.
* The items that could not be inserted are dropped instead.</li>
* <li>Property <pre>log4cplus.threadPoolQueueSizeLimit</pre> can be used to
* set thread pool queue size limit.</li>
* </ul>
*
* <h3>Example</h3>
*
* An example configuration is given below.
*
* <pre>
*
* # Set options for appender named "A1".
* # Appender "A1" will be a SyslogAppender
* log4cplus.appender.A1=log4cplus::SyslogAppender
*
* # The syslog daemon resides on www.abc.net
* log4cplus.appender.A1.SyslogHost=www.abc.net
*
* # A1's layout is a PatternLayout, using the conversion pattern
* # <b>%r %-5p %c{2} %M.%L %x - %m\n</b>. Thus, the log output will
* # include # the relative time since the start of the application in
* # milliseconds, followed by the LogLevel of the log request,
* # followed by the two rightmost components of the logger name,
* # followed by the callers method name, followed by the line number,
* # the nested disgnostic context and finally the message itself.
* # Refer to the documentation of {@link PatternLayout} for further information
* # on the syntax of the ConversionPattern key.
* log4cplus.appender.A1.layout=log4cplus::PatternLayout
* log4cplus.appender.A1.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n
*
* # Set options for appender named "A2"
* # A2 should be a RollingFileAppender, with maximum file size of 10 MB
* # using at most one backup file. A2's layout is TTCC, using the
* # ISO8061 date format with context printing enabled.
* log4cplus.appender.A2=log4cplus::RollingFileAppender
* log4cplus.appender.A2.MaxFileSize=10MB
* log4cplus.appender.A2.MaxBackupIndex=1
* log4cplus.appender.A2.layout=log4cplus::TTCCLayout
* log4cplus.appender.A2.layout.ContextPrinting=true
* log4cplus.appender.A2.layout.DateFormat=ISO8601
*
* # Root logger set to DEBUG using the A2 appender defined above.
* log4cplus.rootLogger=DEBUG, A2
*
* # Logger definitions:
* # The SECURITY logger inherits is LogLevel from root. However, it's output
* # will go to A1 appender defined above. It's additivity is non-cumulative.
* log4cplus.logger.SECURITY=INHERIT, A1
* log4cplus.additivity.SECURITY=false
*
* # Only warnings or above will be logged for the logger "SECURITY.access".
* # Output will go to A1.
* log4cplus.logger.SECURITY.access=WARN
*
*
* # The logger "class.of.the.day" inherits its LogLevel from the
* # logger hierarchy. Output will go to the appender's of the root
* # logger, A2 in this case.
* log4cplus.logger.class.of.the.day=INHERIT
* </pre>
*
* Refer to the <b>setOption</b> method in each Appender and
* Layout for class specific options.
*
* Use the <code>#</code> character at the beginning of a line
* for comments.
*/
virtual void configure();
/**
* \return The return value is reference to Properties
* container of properties with the <code>"log4cplus."</code>
* prefix removed and references to other properties and/or
* environment variables expanded.
*/
log4cplus::helpers::Properties const & getProperties () const;
/**
* \return The return value is a reference to log4cplus::tstring
* containing filename of properties source file. It will be
* string "UNAVAILABLE" if the PropertyConfigurator instance has been
* constructed using one of the other constructors that do not take
* filename as parameter.
*/
log4cplus::tstring const & getPropertyFilename () const;
protected:
// Methods
void init(); // called by the ctor
void reconfigure();
void replaceEnvironVariables();
void configureLoggers();
void configureLogger(log4cplus::Logger logger, const log4cplus::tstring& config);
void configureAppenders();
void configureAdditivity();
virtual Logger getLogger(const log4cplus::tstring& name);
virtual void addAppender(Logger &logger, log4cplus::SharedAppenderPtr& appender);
// Types
typedef std::map<log4cplus::tstring, log4cplus::SharedAppenderPtr> AppenderMap;
// Data
Hierarchy& h;
log4cplus::tstring propertyFilename;
log4cplus::helpers::Properties properties;
AppenderMap appenders;
unsigned flags;
private:
// Disable copy
PropertyConfigurator(const PropertyConfigurator&);
PropertyConfigurator& operator=(PropertyConfigurator&);
};
/**
* Use this class to quickly configure the package. For file based
* configuration see PropertyConfigurator. BasicConfigurator
* automatically attaches ConsoleAppender to
* <code>rootLogger</code>, with output going to standard output,
* using DEBUG LogLevel value. The additional parameter
* logToStdErr may redirect the output to standard error.
*/
class LOG4CPLUS_EXPORT BasicConfigurator : public PropertyConfigurator {
public:
// ctor and dtor
BasicConfigurator(Hierarchy& h = Logger::getDefaultHierarchy(),
bool logToStdErr = false);
virtual ~BasicConfigurator();
/**
* This method eliminates the need to create a temporary
* <code>BasicConfigurator</code> object to configure log4cplus.
* It is equivalent to the following:<br>
* <code><pre>
* BasicConfigurator config;
* config.configure();
* </pre></code>
*/
static void doConfigure(Hierarchy& h = Logger::getDefaultHierarchy(),
bool logToStdErr = false);
//! Property name for disable override.
static log4cplus::tstring const DISABLE_OVERRIDE_KEY;
private:
// Disable copy
BasicConfigurator(const BasicConfigurator&);
BasicConfigurator& operator=(BasicConfigurator&);
};
#if !defined(LOG4CPLUS_SINGLE_THREADED)
// Forward Declarations
class ConfigurationWatchDogThread;
class LOG4CPLUS_EXPORT ConfigureAndWatchThread {
public:
// ctor and dtor
ConfigureAndWatchThread(const log4cplus::tstring& propertyFile,
unsigned int millis = 60 * 1000);
virtual ~ConfigureAndWatchThread();
private:
// Disallow copying of instances of this class
ConfigureAndWatchThread(const ConfigureAndWatchThread&);
ConfigureAndWatchThread& operator=(const ConfigureAndWatchThread&);
// Data
ConfigurationWatchDogThread * watchDogThread;
};
#endif
} // end namespace log4cplus
#endif // LOG4CPLUS_CONFIGURATOR_HEADER_

View File

@@ -0,0 +1,105 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: consoleappender.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_CONSOLE_APPENDER_HEADER_
#define LOG4CPLUS_CONSOLE_APPENDER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/appender.h>
#include <locale>
namespace log4cplus {
/**
* ConsoleAppender appends log events to <code>std::cout</code> or
* <code>std::cerr</code> using a layout specified by the
* user. The default target is <code>std::cout</code>.
*
* <h3>Properties</h3>
* <dl>
* <dt><tt>logToStdErr</tt></dt>
* <dd>When it is set true, the output stream will be
* <code>std::cerr</code> instead of <code>std::cout</code>.</dd>
*
* <dt><tt>ImmediateFlush</tt></dt>
* <dd>When it is set true, output stream will be flushed after
* each appended event.</dd>
*
* <dt><tt>Locale</tt></dt>
* <dd>This property specifies a locale name that will be imbued
* into output stream. Locale can be specified either by system
* specific locale name, e.g., <tt>en_US.UTF-8</tt>, or by one of
* four recognized keywords: <tt>GLOBAL</tt>, <tt>DEFAULT</tt>
* (which is an alias for <tt>GLOBAL</tt>), <tt>USER</tt> and
* <tt>CLASSIC</tt>. When specified locale is not available,
* <tt>GLOBAL</tt> is used instead. It is possible to register
* additional locale keywords by registering an instance of
* <code>spi::LocaleFactory</code> in
* <code>spi::LocaleFactoryRegistry</code>.
* \sa spi::getLocaleFactoryRegistry().
*
* Note: if <tt>Locale</tt> is set, <tt>ImmediateFlush</tt> will
* be set to true automatically.
* </dd>
*
* </dl>
* \sa Appender
*/
class LOG4CPLUS_EXPORT ConsoleAppender : public Appender {
public:
// Ctors
ConsoleAppender(bool logToStdErr = false, bool immediateFlush = false);
ConsoleAppender(const log4cplus::helpers::Properties & properties);
// Dtor
~ConsoleAppender();
// Methods
virtual void close();
//! This mutex is used by ConsoleAppender and helpers::LogLog
//! classes to synchronize output to console.
static log4cplus::thread::Mutex const & getOutputMutex();
protected:
virtual void append(const spi::InternalLoggingEvent& event);
// Data
bool logToStdErr;
/**
* Immediate flush means that the underlying output stream
* will be flushed at the end of each append operation.
*/
bool immediateFlush;
std::unique_ptr<std::locale> locale;
};
} // end namespace log4cplus
#endif // LOG4CPLUS_CONSOLE_APPENDER_HEADER_

View File

@@ -0,0 +1,56 @@
// Copyright (C) 2023, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_EXCEPTION_HXX
#define LOG4CPLUS_EXCEPTION_HXX
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <stdexcept>
namespace log4cplus
{
/**
* \brief Exception class thrown by LogLog.
* \sa helpers::LogLog
*
*/
class LOG4CPLUS_EXPORT exception : public std::runtime_error
{
public:
exception (tstring const &);
exception (exception const &);
exception & operator=(exception const &);
virtual ~exception ();
};
} // namespace log4cplus
#endif // LOG4CPLUS_EXCEPTION_HXX

View File

@@ -0,0 +1,428 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: fileappender.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_FILE_APPENDER_HEADER_
#define LOG4CPLUS_FILE_APPENDER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/appender.h>
#include <log4cplus/fstreams.h>
#include <log4cplus/helpers/timehelper.h>
#include <log4cplus/helpers/lockfile.h>
#include <fstream>
#include <locale>
#include <memory>
namespace log4cplus
{
/**
* Base class for Appenders writing log events to a file.
* It is constructed with uninitialized file object, so all
* classes derived from FileAppenderBase _must_ call init() method.
*
* <h3>Properties</h3>
* <dl>
* <dt><tt>File</tt></dt>
* <dd>This property specifies output file name.</dd>
*
* <dt><tt>ImmediateFlush</tt></dt>
* <dd>When it is set true, output stream will be flushed after
* each appended event.</dd>
*
* <dt><tt>Append</tt></dt>
* <dd>When it is set true, output file will be appended to
* instead of being truncated at opening.</dd>
*
* <dt><tt>ReopenDelay</tt></dt>
* <dd>This property sets a delay after which the appender will try
* to reopen log file again, after last logging failure.
* </dd>
*
* <dt><tt>BufferSize</tt></dt>
* <dd>Non-zero value of this property sets up buffering of output
* stream using a buffer of given size.
* </dd>
*
* <dt><tt>UseLockFile</tt></dt>
* <dd>Set this property to <tt>true</tt> if you want your output
* to go into a log file shared by multiple processes. When this
* property is set to true then log4cplus uses OS specific
* facilities (e.g., <code>lockf()</code>) to provide
* inter-process file locking.
* \sa Appender
* </dd>
*
* <dt><tt>LockFile</tt></dt>
* <dd>This property specifies lock file, file used for
* inter-process synchronization of log file access. When this
* property is not specified, the value is derived from
* <tt>File</tt> property by addition of ".lock" suffix. The
* property is only used when <tt>UseLockFile</tt> is set to true.
* \sa Appender
* </dd>
*
* <dt><tt>Locale</tt></dt>
* <dd>This property specifies a locale name that will be imbued
* into output stream. Locale can be specified either by system
* specific locale name, e.g., <tt>en_US.UTF-8</tt>, or by one of
* four recognized keywords: <tt>GLOBAL</tt>, <tt>DEFAULT</tt>
* (which is an alias for <tt>GLOBAL</tt>), <tt>USER</tt> and
* <tt>CLASSIC</tt>. When specified locale is not available,
* <tt>GLOBAL</tt> is used instead. It is possible to register
* additional locale keywords by registering an instance of
* <code>spi::LocaleFactory</code> in
* <code>spi::LocaleFactoryRegistry</code>.
* \sa spi::getLocaleFactoryRegistry()
* </dd>
*
* <dt><tt>CreateDirs</tt></dt>
* <dd>Set this property to <tt>true</tt> if you want to create
* missing directories in path leading to log file and lock file.
* </dd>
*
* <dt><tt>TextMode</tt></dt>
* <dd>Set this property to <tt>Binary</tt> if the underlying stream should
* not translate EOLs to OS specific character sequence. The default value
* is <tt>Text</tt> and the underlying stream will be opened in text
* mode.</dd>
* </dl>
*/
class LOG4CPLUS_EXPORT FileAppenderBase : public Appender {
public:
// Methods
virtual void close();
//! Redefine default locale for output stream. It may be a good idea to
//! provide UTF-8 locale in case UNICODE macro is defined.
virtual std::locale imbue(std::locale const& loc);
//! \returns Locale imbued in fstream.
virtual std::locale getloc () const;
protected:
// Ctors
FileAppenderBase(const log4cplus::tstring& filename,
std::ios_base::openmode mode = std::ios_base::trunc,
bool immediateFlush = true,
bool createDirs = false);
FileAppenderBase(const log4cplus::helpers::Properties& properties,
std::ios_base::openmode mode = std::ios_base::trunc);
void init();
virtual void append(const spi::InternalLoggingEvent& event);
virtual void open(std::ios_base::openmode mode);
bool reopen();
// Data
/**
* Immediate flush means that the underlying writer or output stream
* will be flushed at the end of each append operation. Immediate
* flush is slower but ensures that each append request is actually
* written. If <code>immediateFlush</code> is set to
* <code>false</code>, then there is a good chance that the last few
* logs events are not actually written to persistent media if and
* when the application crashes.
*
* The <code>immediateFlush</code> variable is set to
* <code>true</code> by default.
*/
bool immediateFlush;
/**
* When this variable is true, FileAppender will try to create
* missing directories in path leading to log file.
*
* The `createDirs` variable is set to `false` by default.
*/
bool createDirs;
/**
* When any append operation fails, <code>reopenDelay</code> says
* for how many seconds the next attempt to re-open the log file and
* resume logging will be delayed. If <code>reopenDelay</code> is zero,
* each failed append operation will cause log file to be re-opened.
* By default, <code>reopenDelay</code> is 1 second.
*/
int reopenDelay;
unsigned long bufferSize;
std::unique_ptr<log4cplus::tchar[]> buffer;
log4cplus::tofstream out;
log4cplus::tstring filename;
log4cplus::tstring localeName;
log4cplus::tstring lockFileName;
std::ios_base::openmode fileOpenMode;
log4cplus::helpers::Time reopen_time;
private:
// Disallow copying of instances of this class
FileAppenderBase(const FileAppenderBase&);
FileAppenderBase& operator=(const FileAppenderBase&);
};
/**
* Appends log events to a file.
*
* <h3>Properties</h3>
* <p>It has no properties additional to {@link FileAppenderBase}.
*/
class LOG4CPLUS_EXPORT FileAppender : public FileAppenderBase {
public:
// Ctors
FileAppender(const log4cplus::tstring& filename,
std::ios_base::openmode mode = std::ios_base::trunc,
bool immediateFlush = true,
bool createDirs = false);
FileAppender(const log4cplus::helpers::Properties& properties,
std::ios_base::openmode mode = std::ios_base::trunc);
// Dtor
virtual ~FileAppender();
protected:
void init();
};
typedef helpers::SharedObjectPtr<FileAppender> SharedFileAppenderPtr;
/**
* RollingFileAppender extends FileAppender to backup the log
* files when they reach a certain size.
*
* <h3>Properties</h3>
* <p>Properties additional to {@link FileAppender}'s properties:
*
* <dl>
* <dt><tt>MaxFileSize</tt></dt>
* <dd>This property specifies maximal size of output file. The
* value is in bytes. It is possible to use <tt>MB</tt> and
* <tt>KB</tt> suffixes to specify the value in megabytes or
* kilobytes instead.</dd>
*
* <dt><tt>MaxBackupIndex</tt></dt>
* <dd>This property limits the number of backup output
* files; e.g. how many <tt>log.1</tt>, <tt>log.2</tt> etc. files
* will be kept.</dd>
* </dl>
*/
class LOG4CPLUS_EXPORT RollingFileAppender : public FileAppender {
public:
// Ctors
RollingFileAppender(const log4cplus::tstring& filename,
long maxFileSize = 10*1024*1024, // 10 MB
int maxBackupIndex = 1,
bool immediateFlush = true,
bool createDirs = false);
RollingFileAppender(const log4cplus::helpers::Properties& properties);
// Dtor
virtual ~RollingFileAppender();
protected:
virtual void append(const spi::InternalLoggingEvent& event);
void rollover(bool alreadyLocked = false);
// Data
long maxFileSize;
int maxBackupIndex;
private:
LOG4CPLUS_PRIVATE void init(long maxFileSize, int maxBackupIndex);
};
typedef helpers::SharedObjectPtr<RollingFileAppender>
SharedRollingFileAppenderPtr;
enum DailyRollingFileSchedule { MONTHLY, WEEKLY, DAILY,
TWICE_DAILY, HOURLY, MINUTELY};
/**
* DailyRollingFileAppender extends {@link FileAppender} so that the
* underlying file is rolled over at a user chosen frequency.
*
* <h3>Properties</h3>
* <p>Properties additional to {@link FileAppender}'s properties:
*
* <dl>
* <dt><tt>Schedule</tt></dt>
* <dd>This property specifies rollover schedule. The possible
* values are <tt>MONTHLY</tt>, <tt>WEEKLY</tt>, <tt>DAILY</tt>,
* <tt>TWICE_DAILY</tt>, <tt>HOURLY</tt> and
* <tt>MINUTELY</tt>.</dd>
*
* <dt><tt>MaxBackupIndex</tt></dt>
* <dd>This property limits how many backup files are kept per
* single logging period; e.g. how many <tt>log.2009-11-07.1</tt>,
* <tt>log.2009-11-07.2</tt> etc. files are kept.</dd>
*
* <dt><tt>RollOnClose</tt></dt>
* <dd>This property specifies whether to rollover log files upon
* shutdown. By default it's set to <code>true</code> to retain compatibility
* with legacy code, however it may lead to undesired behaviour
* as described in the github issue #120.</dd>
*
* <dt><tt>DatePattern</tt></dt>
* <dd>This property specifies filename suffix pattern to use for
* periodical backups of the logfile. The patern should be in
* format supported by {@link log4cplus::helpers::Time::getFormatterTime()}</code>.
* Please notice that the format of the pattern is similar but not identical
* to the one used for this option in the corresponding Log4J class.
* If the property isn't specified a reasonable default for a given
* schedule type is used.</dd>
*
* </dl>
*/
class LOG4CPLUS_EXPORT DailyRollingFileAppender : public FileAppender {
public:
// Ctors
DailyRollingFileAppender(const log4cplus::tstring& filename,
DailyRollingFileSchedule schedule = DAILY,
bool immediateFlush = true,
int maxBackupIndex = 10,
bool createDirs = false,
bool rollOnClose = true,
const log4cplus::tstring& datePattern = log4cplus::tstring());
DailyRollingFileAppender(const log4cplus::helpers::Properties& properties);
// Dtor
virtual ~DailyRollingFileAppender();
// Methods
virtual void close();
protected:
virtual void append(const spi::InternalLoggingEvent& event);
void rollover(bool alreadyLocked = false);
log4cplus::helpers::Time calculateNextRolloverTime(const log4cplus::helpers::Time& t) const;
log4cplus::tstring getFilename(const log4cplus::helpers::Time& t) const;
// Data
DailyRollingFileSchedule schedule;
log4cplus::tstring scheduledFilename;
log4cplus::helpers::Time nextRolloverTime;
int maxBackupIndex;
bool rollOnClose;
log4cplus::tstring datePattern;
private:
LOG4CPLUS_PRIVATE void init(DailyRollingFileSchedule schedule);
};
typedef helpers::SharedObjectPtr<DailyRollingFileAppender>
SharedDailyRollingFileAppenderPtr;
/**
* TimeBasedRollingFileAppender extends {@link FileAppenderBase} so that
* the underlying file is rolled over at a user chosen frequency while also
* keeping in check a total maximum number of produced files.
*
* <h3>Properties</h3>
* <p>Properties additional to {@link FileAppenderBase}'s properties:
*
* <dl>
*
* <dt><tt>FilenamePattern</tt></dt>
* <dd>The mandatory fileNamePattern property defines the name of the
* rolled-over (archived) log files. Its value should consist of the name
* of the file, plus a suitably placed %d conversion specifier. The %d
* conversion specifier may contain a date-and-time pattern as specified by
* the java's SimpleDateFormat. The rollover period is inferred from the
* value of fileNamePattern.</dd>
*
* <dt><tt>MaxHistory</tt></dt>
* <dd>The optional maxHistory property controls the maximum number of
* archive files to keep, deleting older files.</dd>
*
* <dt><tt>CleanHistoryOnStart</tt></dt>
* <dd>If set to true, archive removal will be executed on appender start
* up. By default this property is set to false. </dd>
*
* <dt><tt>RollOnClose</tt></dt>
* <dd>This property specifies whether to rollover log files upon
* shutdown. By default it's set to <code>true</code> to retain compatibility
* with legacy code, however it may lead to undesired behaviour
* as described in the github issue #120.</dd>
*
* </dl>
*/
class LOG4CPLUS_EXPORT TimeBasedRollingFileAppender : public FileAppenderBase {
public:
// Ctors
TimeBasedRollingFileAppender(const tstring& filename = LOG4CPLUS_TEXT(""),
const tstring& filenamePattern = LOG4CPLUS_TEXT("%d.log"),
int maxHistory = 10,
bool cleanHistoryOnStart = false,
bool immediateFlush = true,
bool createDirs = false,
bool rollOnClose = true);
TimeBasedRollingFileAppender(const helpers::Properties& properties);
// Dtor
~TimeBasedRollingFileAppender();
protected:
void append(const spi::InternalLoggingEvent& event);
void open(std::ios_base::openmode mode);
void close();
void rollover(bool alreadyLocked = false);
void clean(helpers::Time time);
helpers::Time::duration getRolloverPeriodDuration() const;
helpers::Time calculateNextRolloverTime(const helpers::Time& t) const;
// Data
tstring filenamePattern;
DailyRollingFileSchedule schedule;
tstring scheduledFilename;
int maxHistory;
bool cleanHistoryOnStart;
log4cplus::helpers::Time lastHeartBeat;
log4cplus::helpers::Time nextRolloverTime;
bool rollOnClose;
private:
LOG4CPLUS_PRIVATE void init();
};
typedef helpers::SharedObjectPtr<TimeBasedRollingFileAppender>
SharedTimeBasedRollingFileAppenderPtr;
} // end namespace log4cplus
#endif // LOG4CPLUS_FILE_APPENDER_HEADER_

View File

@@ -0,0 +1,56 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: fstreams.h
// Created: 4/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_FSTREAMS_HEADER_
#define LOG4CPLUS_FSTREAMS_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tchar.h>
#include <iosfwd>
namespace log4cplus
{
typedef std::basic_ofstream<tchar> tofstream;
typedef std::basic_ifstream<tchar> tifstream;
//! \def LOG4CPLUS_FSTREAM_PREFERED_FILE_NAME(X)
//! \brief Expands into expression that picks the right type for
//! std::fstream file name parameter.
#if defined (LOG4CPLUS_FSTREAM_ACCEPTS_WCHAR_T) && defined (UNICODE)
# define LOG4CPLUS_FSTREAM_PREFERED_FILE_NAME(X) (X)
#else
# define LOG4CPLUS_FSTREAM_PREFERED_FILE_NAME(X) (LOG4CPLUS_TSTRING_TO_STRING(X))
#endif
}
#endif // LOG4CPLUS_FSTREAMS_HEADER_

View File

@@ -0,0 +1,119 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: appenderattachableimpl.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_
#define LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <log4cplus/helpers/pointer.h>
#include <log4cplus/spi/appenderattachable.h>
#include <log4cplus/thread/syncprims.h>
#include <memory>
#include <vector>
namespace log4cplus {
namespace helpers {
/**
* This Interface is for attaching Appenders to objects.
*/
class LOG4CPLUS_EXPORT AppenderAttachableImpl
: public log4cplus::spi::AppenderAttachable
{
public:
// Data
thread::Mutex appender_list_mutex;
// Ctors
AppenderAttachableImpl();
// Dtor
virtual ~AppenderAttachableImpl();
// Methods
/**
* Add an appender. If the appender is already in the list in
* won't be added again.
*/
virtual void addAppender(SharedAppenderPtr newAppender);
/**
* Get all previously added appenders as an vectory.
*/
virtual SharedAppenderPtrList getAllAppenders();
/**
* Look for an attached appender named as <code>name</code>.
*
* Return the appender with that name if in the list. Return null
* otherwise.
*/
virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name);
/**
* Remove all previously added appenders.
*/
virtual void removeAllAppenders();
/**
* Remove the appender passed as parameter from the list of appenders.
*/
virtual void removeAppender(SharedAppenderPtr appender);
/**
* Remove the appender with the name passed as parameter from the
* list of appenders.
*/
virtual void removeAppender(const log4cplus::tstring& name);
/**
* Call the <code>doAppend</code> method on all attached appenders.
*/
int appendLoopOnAppenders(const spi::InternalLoggingEvent& event) const;
protected:
// Types
typedef std::vector<SharedAppenderPtr> ListType;
// Data
/** Array of appenders. */
ListType appenderList;
private:
AppenderAttachableImpl(AppenderAttachableImpl const &);
AppenderAttachableImpl & operator = (AppenderAttachableImpl const &);
}; // end class AppenderAttachableImpl
} // end namespace helpers
} // end namespace log4cplus
#endif // LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_

View File

@@ -0,0 +1,107 @@
// -*- C++ -*-
// Copyright (C) 2013-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_HELPERS_CONNECTORTHREAD_H
#define LOG4CPLUS_HELPERS_CONNECTORTHREAD_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/thread/syncprims.h>
#include <log4cplus/thread/threads.h>
#include <log4cplus/helpers/socket.h>
#if ! defined (LOG4CPLUS_SINGLE_THREADED)
namespace log4cplus { namespace helpers {
class LOG4CPLUS_EXPORT ConnectorThread;
//! Interface implemented by users of ConnectorThread.
class LOG4CPLUS_EXPORT IConnectorThreadClient
{
protected:
virtual ~IConnectorThreadClient ();
//! \return Mutex for synchronization between ConnectorThread and
//! its client object. This is usually SharedObject::access_mutex.
virtual thread::Mutex const & ctcGetAccessMutex () const = 0;
//! \return Socket variable in ConnectorThread client to maintain.
virtual helpers::Socket & ctcGetSocket () = 0;
//! \return ConnectorThread client's function returning connected
//! socket.
virtual helpers::Socket ctcConnect () = 0;
//! Sets connected flag to true in ConnectorThread's client.
virtual void ctcSetConnected () = 0;
friend class LOG4CPLUS_EXPORT ConnectorThread;
};
//! This class is used by SocketAppender and (remote) SysLogAppender
//! to provide asynchronous re-connection.
class LOG4CPLUS_EXPORT ConnectorThread
: public thread::AbstractThread
{
public:
//! \param client reference to ConnectorThread's client object
ConnectorThread (IConnectorThreadClient & client);
virtual ~ConnectorThread ();
virtual void run();
//! Call this function to terminate ConnectorThread. The function
//! sets `exit_flag` and then triggers `trigger_ev` to wake up the
//! ConnectorThread.
void terminate ();
//! This function triggers (`trigger_ev`) connection check and
//! attempt to re-connect a broken connection, when necessary.
void trigger ();
protected:
//! reference to ConnectorThread's client
IConnectorThreadClient & ctc;
//! This event is the re-connection trigger.
thread::ManualResetEvent trigger_ev;
//! When this variable set to true when ConnectorThread is signaled to
bool exit_flag;
};
} } // namespace log4cplus { namespace helpers {
#endif // ! defined (LOG4CPLUS_SINGLE_THREADED)
#endif // LOG4CPLUS_HELPERS_CONNECTORTHREAD_H

View File

@@ -0,0 +1,91 @@
// -*- C++ -*-
//
// Copyright (C) 2024, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_HELPERS_EVENTCOUNTER_H
#define LOG4CPLUS_HELPERS_EVENTCOUNTER_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/thread/syncprims.h>
#include <cstddef>
#include <atomic>
#include <chrono>
namespace log4cplus {
namespace helpers {
class LOG4CPLUS_EXPORT BaseEventCounter
{
public:
BaseEventCounter ();
virtual ~BaseEventCounter ();
virtual std::size_t record_event ();
protected:
std::atomic<std::size_t> event_count {0};
};
class LOG4CPLUS_EXPORT SteadyClockGate
: public BaseEventCounter
{
public:
using Clock = std::chrono::steady_clock;
using Duration = Clock::duration;
using TimePoint = std::chrono::time_point<Clock>;
struct LOG4CPLUS_EXPORT Info
{
~Info ();
std::size_t count;
Duration time_span;
};
SteadyClockGate (SteadyClockGate::Duration pause_duraiton);
virtual ~SteadyClockGate ();
bool latch_open (Info &);
private:
log4cplus::thread::SimpleMutex mtx;
Duration const pause_duration;
TimePoint timeout_point;
TimePoint prev_timeout_point;
};
} // namespace helpers
} // namespace log4cplus
#endif // LOG4CPLUS_HELPERS_EVENTCOUNTER_H

View File

@@ -0,0 +1,59 @@
// -*- C++ -*-
//
// Copyright (C) 2012-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if ! defined (LOG4CPLUS_HELPERS_FILEINFO_H)
#define LOG4CPLUS_HELPERS_FILEINFO_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/helpers/timehelper.h>
#ifdef LOG4CPLUS_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
namespace log4cplus { namespace helpers {
//! FileInfo structure is OS independent abstraction of the
//! <code>stat()</code> function.
struct LOG4CPLUS_EXPORT FileInfo
{
helpers::Time mtime;
bool is_link;
off_t size;
};
//! OS independent abstraction of <code>stat()</code> function.
LOG4CPLUS_EXPORT int getFileInfo (FileInfo * fi, tstring const & name);
} } // namespace log4cplus { namespace helpers {
#endif // LOG4CPLUS_HELPERS_FILEINFO_H

View File

@@ -0,0 +1,69 @@
// -*- C++ -*-
//
// Copyright (C) 2012-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if ! defined (LOG4CPLUS_HELPERS_LOCKFILE_H)
#define LOG4CPLUS_HELPERS_LOCKFILE_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <log4cplus/thread/syncprims.h>
namespace log4cplus { namespace helpers {
class LOG4CPLUS_EXPORT LockFile
{
public:
LockFile (tstring const & lock_file, bool create_dirs = false);
~LockFile ();
void lock () const;
void unlock () const;
private:
void open (int) const;
void close () const;
struct Impl;
tstring lock_file_name;
Impl * data;
bool create_dirs;
};
typedef log4cplus::thread::SyncGuard<LockFile> LockFileGuard;
} } // namespace log4cplus { namespace helpers {
#endif // LOG4CPLUS_HELPERS_LOCKFILE_H

View File

@@ -0,0 +1,145 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: loglog.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_LOGLOG
#define LOG4CPLUS_HELPERS_LOGLOG
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <log4cplus/streams.h>
#include <log4cplus/thread/syncprims.h>
namespace log4cplus {
namespace helpers {
/**
* This class used to output log statements from within the log4cplus package.
*
* Log4cplus components cannot make log4cplus logging calls. However, it is
* sometimes useful for the user to learn about what log4cplus is
* doing. You can enable log4cplus internal logging by defining the
* <b>log4cplus.configDebug</b> variable.
*
* All log4cplus internal debug calls go to <code>cout</code>
* where as internal error messages are sent to
* <code>cerr</code>. All internal messages are prepended with
* the string "log4clus: ".
*/
class LOG4CPLUS_EXPORT LogLog
{
public:
//! Return type of getLogLog().
typedef LogLog * Ptr;
/**
* Returns a reference to the <code>LogLog</code> singleton.
*/
static Ptr getLogLog();
/**
* Allows to enable/disable log4cplus internal logging.
*/
void setInternalDebugging(bool enabled);
/**
* In quite mode no LogLog generates strictly no output, not even
* for errors.
*
* @param quietMode A true for not
*/
void setQuietMode(bool quietMode);
/**
* This method is used to output log4cplus internal debug
* statements. Output goes to <code>std::cout</code>.
*/
void debug(const log4cplus::tstring& msg) const;
void debug(tchar const * msg) const;
/**
* This method is used to output log4cplus internal error
* statements. There is no way to disable error
* statements. Output goes to
* <code>std::cerr</code>. Optionally, this method can
* throw std::runtime_error exception too.
*/
void error(const log4cplus::tstring& msg, bool throw_flag = false) const;
void error(tchar const * msg, bool throw_flag = false) const;
/**
* This method is used to output log4cplus internal warning
* statements. There is no way to disable warning statements.
* Output goes to <code>std::cerr</code>.
*/
void warn(const log4cplus::tstring& msg) const;
void warn(tchar const * msg) const;
// Public ctor and dtor to be used only by internal::DefaultContext.
LogLog();
virtual ~LogLog();
private:
enum TriState
{
TriUndef = -1,
TriFalse,
TriTrue
};
template <typename StringType>
LOG4CPLUS_PRIVATE
void logging_worker (tostream & os,
bool (LogLog:: * cond) () const, tchar const *,
StringType const &, bool throw_flag = false) const;
LOG4CPLUS_PRIVATE static void set_tristate_from_env (TriState *,
tchar const * envvar);
LOG4CPLUS_PRIVATE bool get_quiet_mode () const;
LOG4CPLUS_PRIVATE bool get_not_quiet_mode () const;
LOG4CPLUS_PRIVATE bool get_debug_mode () const;
// Data
mutable TriState debugEnabled;
mutable TriState quietMode;
thread::Mutex mutex;
LOG4CPLUS_PRIVATE LogLog(const LogLog&);
LOG4CPLUS_PRIVATE LogLog & operator = (LogLog const &);
};
LOG4CPLUS_EXPORT LogLog & getLogLog ();
} // end namespace helpers
} // end namespace log4cplus
#endif // LOG4CPLUS_HELPERS_LOGLOG

View File

@@ -0,0 +1,210 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: pointer.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Note: Some of this code uses ideas from "More Effective C++" by Scott
// Myers, Addison Wesley Longmain, Inc., (c) 1996, Chapter 29, pp. 183-213
//
/** @file */
#ifndef LOG4CPLUS_HELPERS_POINTERS_HEADER_
#define LOG4CPLUS_HELPERS_POINTERS_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/thread/syncprims.h>
#include <algorithm>
#include <cassert>
#if ! defined (LOG4CPLUS_SINGLE_THREADED)
#include <atomic>
#endif
namespace log4cplus {
namespace helpers {
/******************************************************************************
* Class SharedObject (from pp. 204-205) *
******************************************************************************/
class LOG4CPLUS_EXPORT SharedObject
{
public:
void addReference() const LOG4CPLUS_NOEXCEPT;
void removeReference() const;
protected:
// Ctor
SharedObject()
: access_mutex()
, count__(0)
{ }
SharedObject(const SharedObject&)
: access_mutex()
, count__(0)
{ }
SharedObject(SharedObject &&)
: access_mutex()
, count__(0)
{ }
// Dtor
virtual ~SharedObject();
// Operators
SharedObject& operator=(const SharedObject&) LOG4CPLUS_NOEXCEPT { return *this; }
SharedObject& operator=(SharedObject &&) LOG4CPLUS_NOEXCEPT { return *this; }
public:
thread::Mutex access_mutex;
private:
#if defined (LOG4CPLUS_SINGLE_THREADED)
typedef unsigned count_type;
#else
typedef std::atomic<unsigned> count_type;
#endif
mutable count_type count__;
};
/******************************************************************************
* Template Class SharedObjectPtr (from pp. 203, 206) *
******************************************************************************/
template<class T>
class SharedObjectPtr
{
public:
// Ctor
explicit
SharedObjectPtr(T* realPtr = 0) LOG4CPLUS_NOEXCEPT
: pointee(realPtr)
{
addref ();
}
SharedObjectPtr(const SharedObjectPtr& rhs) LOG4CPLUS_NOEXCEPT
: pointee(rhs.pointee)
{
addref ();
}
SharedObjectPtr(SharedObjectPtr && rhs) LOG4CPLUS_NOEXCEPT
: pointee (std::move (rhs.pointee))
{
rhs.pointee = 0;
}
SharedObjectPtr & operator = (SharedObjectPtr && rhs) LOG4CPLUS_NOEXCEPT
{
rhs.swap (*this);
return *this;
}
// Dtor
~SharedObjectPtr()
{
if (pointee)
pointee->removeReference();
}
// Operators
bool operator==(const SharedObjectPtr& rhs) const
{ return (pointee == rhs.pointee); }
bool operator!=(const SharedObjectPtr& rhs) const
{ return (pointee != rhs.pointee); }
bool operator==(const T* rhs) const { return (pointee == rhs); }
bool operator!=(const T* rhs) const { return (pointee != rhs); }
T* operator->() const {assert (pointee); return pointee; }
T& operator*() const {assert (pointee); return *pointee; }
SharedObjectPtr& operator=(const SharedObjectPtr& rhs)
{
return this->operator = (rhs.pointee);
}
SharedObjectPtr& operator=(T* rhs)
{
SharedObjectPtr<T> (rhs).swap (*this);
return *this;
}
// Methods
T* get() const { return pointee; }
void swap (SharedObjectPtr & other) LOG4CPLUS_NOEXCEPT
{
std::swap (pointee, other.pointee);
}
typedef T * (SharedObjectPtr:: * unspec_bool_type) () const;
operator unspec_bool_type () const
{
return pointee ? &SharedObjectPtr::get : 0;
}
bool operator ! () const
{
return ! pointee;
}
private:
// Methods
void addref() const LOG4CPLUS_NOEXCEPT
{
if (pointee)
pointee->addReference();
}
// Data
T* pointee;
};
//! Boost `intrusive_ptr` helpers.
//! @{
inline
void
intrusive_ptr_add_ref (SharedObject const * so)
{
so->addReference();
}
inline
void
intrusive_ptr_release (SharedObject const * so)
{
so->removeReference();
}
//! @}
} // end namespace helpers
} // end namespace log4cplus
#endif // LOG4CPLUS_HELPERS_POINTERS_HEADER_

View File

@@ -0,0 +1,172 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: property.h
// Created: 2/2002
// Author: Tad E. Smith
//
//
// Copyright 2002-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_PROPERTY_HEADER_
#define LOG4CPLUS_HELPERS_PROPERTY_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/streams.h>
#include <log4cplus/tstring.h>
#include <map>
#include <vector>
namespace log4cplus {
namespace helpers {
//! \sa log4cplus::PropertyConfigurator
class LOG4CPLUS_EXPORT Properties {
public:
enum PFlags
{
// These encoding related options occupy 2 bits of the flags
// and are mutually exclusive. These flags are synchronized
// with PCFlags in PropertyConfigurator.
fEncodingShift = 3
, fEncodingMask = 0x3
, fUnspecEncoding = (0 << fEncodingShift)
#if defined (LOG4CPLUS_HAVE_CODECVT_UTF8_FACET) && defined (UNICODE)
, fUTF8 = (1 << fEncodingShift)
#endif
#if (defined (LOG4CPLUS_HAVE_CODECVT_UTF16_FACET) || defined (_WIN32)) \
&& defined (UNICODE)
, fUTF16 = (2 << fEncodingShift)
#endif
#if defined (LOG4CPLUS_HAVE_CODECVT_UTF32_FACET) && defined (UNICODE)
, fUTF32 = (3 << fEncodingShift)
#endif
, fThrow = (1 << 5)
};
Properties();
explicit Properties(log4cplus::tistream& input);
explicit Properties(const log4cplus::tstring& inputFile, unsigned flags = 0);
virtual ~Properties();
// constants
static const tchar PROPERTIES_COMMENT_CHAR;
// methods
/**
* Tests to see if <code>key</code> can be found in this map.
*/
bool exists(const log4cplus::tstring& key) const;
bool exists(tchar const * key) const;
/**
* Returns the number of entries in this map.
*/
std::size_t size() const
{
return data.size();
}
/**
* Searches for the property with the specified key in this property
* list. If the key is not found in this property list, the default
* property list, and its defaults, recursively, are then checked.
* The method returns <code>null</code> if the property is not found.
*/
log4cplus::tstring const & getProperty(const log4cplus::tstring& key) const;
log4cplus::tstring const & getProperty(tchar const * key) const;
/**
* Searches for the property with the specified key in this property
* list. If the key is not found in this property list, the default
* property list, and its defaults, recursively, are then checked.
* The method returns the default value argument if the property is
* not found.
*/
log4cplus::tstring getProperty(const log4cplus::tstring& key,
const log4cplus::tstring& defaultVal) const;
/**
* Returns all the keys in this property list.
*/
std::vector<log4cplus::tstring> propertyNames() const;
/**
* Inserts <code>value</code> into this map indexed by <code>key</code>.
*/
void setProperty(const log4cplus::tstring& key, const log4cplus::tstring& value);
/**
* Removed the property index by <code>key</code> from this map.
*/
bool removeProperty(const log4cplus::tstring& key);
/**
* Returns a subset of the "properties" whose keys start with
* "prefix". The returned "properties" have "prefix" trimmed from
* their keys.
*/
Properties getPropertySubset(const log4cplus::tstring& prefix) const;
bool getInt (int & val, log4cplus::tstring const & key) const;
bool getUInt (unsigned & val, log4cplus::tstring const & key) const;
bool getLong (long & val, log4cplus::tstring const & key) const;
bool getULong (unsigned long & val, log4cplus::tstring const & key) const;
bool getBool (bool & val, log4cplus::tstring const & key) const;
bool getString (log4cplus::tstring & val, log4cplus::tstring const & key) const;
protected:
// Types
typedef std::map<log4cplus::tstring, log4cplus::tstring> StringMap;
// Methods
void init(log4cplus::tistream& input);
// Data
StringMap data;
unsigned flags;
private:
template <typename StringType>
log4cplus::tstring const & get_property_worker (
StringType const & key) const;
template <typename ValType>
bool get_type_val_worker (ValType & val,
log4cplus::tstring const & key) const;
};
class LogLog;
bool
substVars (tstring & dest, const tstring & val,
Properties const & props, LogLog& loglog,
unsigned flags);
} // end namespace helpers
}
#endif // LOG4CPLUS_HELPERS_PROPERTY_HEADER_

View File

@@ -0,0 +1,158 @@
// -*- C++ -*-
// Copyright (C) 2009-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_HELPERS_QUEUE_H
#define LOG4CPLUS_HELPERS_QUEUE_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if ! defined (LOG4CPLUS_SINGLE_THREADED)
#include <deque>
#include <log4cplus/spi/loggingevent.h>
#include <log4cplus/thread/threads.h>
#include <log4cplus/thread/syncprims.h>
namespace log4cplus { namespace thread {
//! Single consumer, multiple producers queue.
class LOG4CPLUS_EXPORT Queue
: public virtual helpers::SharedObject
{
public:
//! Type of the state flags field.
typedef unsigned flags_type;
//! Queue storage type.
typedef std::deque<spi::InternalLoggingEvent> queue_storage_type;
explicit Queue (unsigned len = 100);
virtual ~Queue ();
// Producers' methods.
//! Puts event <code>ev</code> into queue, sets QUEUE flag and
//! sets internal event object into signaled state. If the EXIT
//! flags is already set upon entering the function, nothing is
//! inserted into the queue. The function can block on internal
//! semaphore if the queue has reached maximal allowed
//! length. Calling thread is unblocked either by consumer thread
//! removing item from queue or by any other thread calling
//! signal_exit().
//!
//! \param ev spi::InternalLoggingEvent to be put into the queue.
//! \return Flags.
flags_type put_event (spi::InternalLoggingEvent const & ev);
//! Sets EXIT flag and DRAIN flag and sets internal event object
//! into signaled state.
//! \param drain If true, DRAIN flag will be set, otherwise unset.
//! \return Flags, ERROR_BIT can be set upon error.
flags_type signal_exit (bool drain = true);
// Consumer's methods.
//! The get_events() function is used by queue's consumer. It
//! fills <code>buf</code> argument and sets EVENT flag in return
//! value. If EXIT flag is already set in flags member upon
//! entering the function then depending on DRAIN flag it either
//! fills <code>buf</code> argument or does not fill the argument,
//! if the queue is non-empty. The function blocks by waiting for
//! internal event object to be signaled if the queue is empty,
//! unless EXIT flag is set. The calling thread is unblocked when
//! items are added into the queue or when exit is signaled using
//! the signal_exit() function.
//!
//!
//! Upon error, return value has one of the error flags set.
//!
//! \param buf Pointer to storage of spi::InternalLoggingEvent
//! instances to be filled from queue.
//! \return Flags.
flags_type get_events (queue_storage_type * buf);
//! Possible state flags.
enum Flags
{
//! EVENT flag is set in return value of get_event() call if
//! the <code>ev</code> argument is filled with event from the queue.
EVENT = 0x0001,
//! QUEUE flag is set by producers when they put item into the
//! queue.
QUEUE = 0x0002,
//! EXIT flag is set by signal_exit() call, signaling that the
//! queue worker thread should end itself.
EXIT = 0x0004,
//! When DRAIN flag is set together with EXIT flag, the queue
//! worker thread will first drain the queue before exiting.
DRAIN = 0x0008,
//! ERROR_BIT signals error.
ERROR_BIT = 0x0010,
//! ERROR_AFTER signals error that has occurred after queue has
//! already been touched.
ERROR_AFTER = 0x0020
};
protected:
//! Queue storage.
queue_storage_type queue;
//! Mutex protecting queue and flags.
Mutex mutex;
//! Event on which consumer can wait if it finds queue empty.
ManualResetEvent ev_consumer;
//! Semaphore that limits the queue length.
Semaphore sem;
//! State flags.
flags_type flags;
private:
Queue (Queue const &);
Queue & operator = (Queue const &);
};
typedef helpers::SharedObjectPtr<Queue> QueuePtr;
} } // namespace log4cplus { namespace thread {
#endif // LOG4CPLUS_SINGLE_THREADED
#endif // LOG4CPLUS_HELPERS_QUEUE_H

View File

@@ -0,0 +1,62 @@
// -*- C++ -*-
// Copyright (C) 2010-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_HELPERS_SNPRINTF_H
#define LOG4CPLUS_HELPERS_SNPRINTF_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tchar.h>
#include <cstdarg>
#include <vector>
namespace log4cplus { namespace helpers {
class LOG4CPLUS_EXPORT snprintf_buf
{
public:
snprintf_buf ();
tchar const * print (tchar const * fmt, ...)
LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 2, 3);
int print_va_list (tchar const * & str, tchar const * fmt, std::va_list)
LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 0);
private:
std::vector<tchar> buf;
};
} } // namespace log4cplus { namespace helpers
#endif // LOG4CPLUS_HELPERS_SNPRINTF_H

View File

@@ -0,0 +1,163 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: socket.h
// Created: 4/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_SOCKET_HEADER_
#define LOG4CPLUS_HELPERS_SOCKET_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <array>
#include <log4cplus/tstring.h>
#include <log4cplus/helpers/socketbuffer.h>
namespace log4cplus {
namespace helpers {
enum SocketState { ok,
not_opened,
bad_address,
connection_failed,
broken_pipe,
invalid_access_mode,
message_truncated,
accept_interrupted
};
typedef std::ptrdiff_t SOCKET_TYPE;
extern LOG4CPLUS_EXPORT SOCKET_TYPE const INVALID_SOCKET_VALUE;
class LOG4CPLUS_EXPORT AbstractSocket {
public:
AbstractSocket();
AbstractSocket(SOCKET_TYPE sock, SocketState state, int err);
AbstractSocket(AbstractSocket const &) = delete;
AbstractSocket(AbstractSocket &&) LOG4CPLUS_NOEXCEPT;
virtual ~AbstractSocket() = 0;
/// Close socket
virtual void close();
virtual bool isOpen() const;
virtual void shutdown();
AbstractSocket & operator = (AbstractSocket && rhs) LOG4CPLUS_NOEXCEPT;
void swap (AbstractSocket &);
protected:
SOCKET_TYPE sock;
SocketState state;
int err;
};
/**
* This class implements client sockets (also called just "sockets").
* A socket is an endpoint for communication between two machines.
*/
class LOG4CPLUS_EXPORT Socket : public AbstractSocket {
public:
// ctor and dtor
Socket();
Socket(SOCKET_TYPE sock, SocketState state, int err);
Socket(const tstring& address, unsigned short port,
bool udp = false, bool ipv6 = false);
Socket(Socket &&) LOG4CPLUS_NOEXCEPT;
virtual ~Socket();
Socket & operator = (Socket &&) LOG4CPLUS_NOEXCEPT;
// methods
virtual bool read(SocketBuffer& buffer);
virtual bool write(const SocketBuffer& buffer);
virtual bool write(const std::string & buffer);
virtual bool write(std::size_t bufferCount,
SocketBuffer const * const * buffers);
template <typename... Args>
static bool write(Socket & socket, Args &&... args)
{
SocketBuffer const * const buffers[sizeof... (args)] {
(&args)... };
return socket.write (sizeof... (args), buffers);
}
};
/**
* This class implements server sockets. A server socket waits for
* requests to come in over the network. It performs some operation
* based on that request, and then possibly returns a result to the
* requester.
*/
class LOG4CPLUS_EXPORT ServerSocket : public AbstractSocket {
public:
ServerSocket(unsigned short port, bool udp = false,
bool ipv6 = false, tstring const & host = tstring ());
ServerSocket(ServerSocket &&) LOG4CPLUS_NOEXCEPT;
virtual ~ServerSocket();
ServerSocket & operator = (ServerSocket &&) LOG4CPLUS_NOEXCEPT;
Socket accept();
void interruptAccept ();
void swap (ServerSocket &);
protected:
std::array<std::ptrdiff_t, 2> interruptHandles;
};
LOG4CPLUS_EXPORT SOCKET_TYPE openSocket(unsigned short port, bool udp,
bool ipv6, SocketState& state);
LOG4CPLUS_EXPORT SOCKET_TYPE openSocket(tstring const & host,
unsigned short port, bool udp, bool ipv6, SocketState& state);
LOG4CPLUS_EXPORT SOCKET_TYPE connectSocket(const log4cplus::tstring& hostn,
unsigned short port, bool udp, bool ipv6, SocketState& state);
LOG4CPLUS_EXPORT SOCKET_TYPE acceptSocket(SOCKET_TYPE sock, SocketState& state);
LOG4CPLUS_EXPORT int closeSocket(SOCKET_TYPE sock);
LOG4CPLUS_EXPORT int shutdownSocket(SOCKET_TYPE sock);
LOG4CPLUS_EXPORT long read(SOCKET_TYPE sock, SocketBuffer& buffer);
LOG4CPLUS_EXPORT long write(SOCKET_TYPE sock,
const SocketBuffer& buffer);
LOG4CPLUS_EXPORT long write(SOCKET_TYPE sock, std::size_t bufferCount,
SocketBuffer const * const * buffers);
LOG4CPLUS_EXPORT long write(SOCKET_TYPE sock,
const std::string & buffer);
LOG4CPLUS_EXPORT tstring getHostname (bool fqdn);
LOG4CPLUS_EXPORT int setTCPNoDelay (SOCKET_TYPE, bool);
} // end namespace helpers
} // end namespace log4cplus
#endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_

View File

@@ -0,0 +1,79 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: socketbuffer.h
// Created: 5/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
#define LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
namespace log4cplus {
namespace helpers {
/**
*
*/
class LOG4CPLUS_EXPORT SocketBuffer
{
public:
explicit SocketBuffer(std::size_t max);
virtual ~SocketBuffer();
char *getBuffer() const { return buffer; }
std::size_t getMaxSize() const { return maxsize; }
std::size_t getSize() const { return size; }
void setSize(std::size_t s) { size = s; }
std::size_t getPos() const { return pos; }
unsigned char readByte();
unsigned short readShort();
unsigned int readInt();
tstring readString(unsigned char sizeOfChar);
void appendByte(unsigned char val);
void appendShort(unsigned short val);
void appendInt(unsigned int val);
void appendString(const tstring& str);
void appendBuffer(const SocketBuffer& buffer);
private:
// Data
std::size_t maxsize;
std::size_t size;
std::size_t pos;
char *buffer;
SocketBuffer(SocketBuffer const & rhs);
SocketBuffer& operator= (SocketBuffer const& rhs);
};
} // end namespace helpers
} // end namespace log4cplus
#endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_

View File

@@ -0,0 +1,271 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: stringhelper.h
// Created: 3/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_STRINGHELPER_HEADER_
#define LOG4CPLUS_HELPERS_STRINGHELPER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <algorithm>
#include <limits>
namespace log4cplus {
namespace helpers {
/**
* Returns <code>s</code> in upper case.
*/
LOG4CPLUS_EXPORT log4cplus::tstring toUpper(const log4cplus::tstring& s);
LOG4CPLUS_EXPORT tchar toUpper(tchar);
/**
* Returns <code>s</code> in lower case.
*/
LOG4CPLUS_EXPORT log4cplus::tstring toLower(const log4cplus::tstring& s);
LOG4CPLUS_EXPORT tchar toLower(tchar);
/**
* Tokenize <code>s</code> using <code>c</code> as the delimiter and
* put the resulting tokens in <code>_result</code>. If
* <code>collapseTokens</code> is false, multiple adjacent delimiters
* will result in zero length tokens.
*
* <b>Example:</b>
* <pre>
* string s = // Set string with '.' as delimiters
* list<log4cplus::tstring> tokens;
* tokenize(s, '.', back_insert_iterator<list<string> >(tokens));
* </pre>
*/
template <class StringType, class OutputIter>
inline
void
tokenize(const StringType& s, typename StringType::value_type c,
OutputIter result, bool collapseTokens = true)
{
typedef typename StringType::size_type size_type;
size_type const slen = s.length();
size_type first = 0;
size_type i = 0;
for (i=0; i < slen; ++i)
{
if (s[i] == c)
{
*result = StringType (s, first, i - first);
++result;
if (collapseTokens)
while (i+1 < slen && s[i+1] == c)
++i;
first = i + 1;
}
}
if (first != i)
*result = StringType (s, first, i - first);
else if (! collapseTokens && first == i)
*result = StringType ();
}
template <typename intType, typename stringType, bool isSigned>
struct ConvertIntegerToStringHelper;
template <typename intType, typename charType>
struct ConvertIntegerToStringHelper<intType, charType, true>
{
static inline
void
step1 (charType * & it, intType & value)
{
// The sign of the result of the modulo operator is
// implementation defined. That's why we work with
// positive counterpart instead. Also, in twos
// complement arithmetic the smallest negative number
// does not have positive counterpart; the range is
// asymetric. That's why we handle the case of value
// == min() specially here.
if (LOG4CPLUS_UNLIKELY (
value == (std::numeric_limits<intType>::min) ()))
{
intType const r = value / 10;
intType const a = (-r) * 10;
intType const mod = -(a + value);
value = -r;
*(it - 1)
= static_cast<charType>(LOG4CPLUS_TEXT('0') + mod);
--it;
}
else
value = -value;
}
static
bool
is_negative (intType val)
{
return val < 0;
}
};
template <typename intType, typename charType>
struct ConvertIntegerToStringHelper<intType, charType, false>
{
static inline
void
step1 (charType * &, intType &)
{
// This will never be called for unsigned types.
}
static
bool
is_negative (intType)
{
return false;
}
};
template <class stringType, class intType>
inline
void
convertIntegerToString (stringType & str, intType value)
{
typedef std::numeric_limits<intType> intTypeLimits;
typedef typename stringType::value_type charType;
typedef ConvertIntegerToStringHelper<intType, charType,
intTypeLimits::is_signed> HelperType;
charType buffer[intTypeLimits::digits10 + 2];
const std::size_t buffer_size
= sizeof (buffer) / sizeof (charType);
charType * it = &buffer[buffer_size];
charType const * const buf_end = &buffer[buffer_size];
if (LOG4CPLUS_UNLIKELY (value == 0))
{
--it;
*it = LOG4CPLUS_TEXT('0');
}
else
{
bool const negative = HelperType::is_negative (value);
if (negative)
HelperType::step1 (it, value);
for (; value != 0; --it)
{
intType mod = value % 10;
value = value / 10;
*(it - 1) = static_cast<charType>(LOG4CPLUS_TEXT('0')
+ mod);
}
if (negative)
{
--it;
*it = LOG4CPLUS_TEXT('-');
}
}
str.assign (static_cast<charType const *>(it), buf_end);
}
template<class intType>
inline
tstring
convertIntegerToString (intType value)
{
tstring result;
convertIntegerToString (result, value);
return result;
}
template<class intType>
inline
std::string
convertIntegerToNarrowString (intType value)
{
std::string result;
convertIntegerToString (result, value);
return result;
}
//! Join a list of items into a string.
template <typename Iterator, typename Separator>
inline
void
join_worker (tstring & result, Iterator & start, Iterator & last,
Separator const & sep)
{
if (start != last)
result = *start++;
for (; start != last; ++start)
{
result += sep;
result += *start;
}
}
//! Join a list of items into a string.
template <typename Iterator>
inline
void
join (tstring & result, Iterator start, Iterator last,
tstring const & sep)
{
join_worker (result, start, last, sep);
}
//! Join a list of items into a string.
template <typename Iterator>
inline
void
join (tstring & result, Iterator start, Iterator last,
tstring::value_type sep)
{
join_worker (result, start, last, sep);
}
} // namespace helpers
} // namespace log4cplus
#endif // LOG4CPLUS_HELPERS_STRINGHELPER_HEADER_

View File

@@ -0,0 +1,58 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: thread-config.h
// Created: 4/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_
#define LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if defined (LOG4CPLUS_USE_PTHREADS)
# if defined (__APPLE__)
# define LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE
# endif
#elif defined(LOG4CPLUS_USE_WIN32_THREADS)
# define LOG4CPLUS_USE_SRW_LOCK
//# define LOG4CPLUS_POOR_MANS_SHAREDMUTEX
# undef LOG4CPLUS_HAVE_TLS_SUPPORT
# undef LOG4CPLUS_THREAD_LOCAL_VAR
# if defined (_MSC_VER)
// The __declspec(thread) functionality is not compatible with LoadLibrary().
// For more information why see and "Windows and TLS" note in README.
// <http://msdn.microsoft.com/en-us/library/2s9wt68x(v=vs.100).aspx>.
# define LOG4CPLUS_HAVE_TLS_SUPPORT 1
# define LOG4CPLUS_THREAD_LOCAL_VAR __declspec(thread)
# endif
#elif defined(LOG4CPLUS_SINGLE_THREADED)
# undef LOG4CPLUS_HAVE_TLS_SUPPORT
# undef LOG4CPLUS_THREAD_LOCAL_VAR
#else
# error "You Must define a Threading model"
#endif
#endif // LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_

View File

@@ -0,0 +1,169 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: timehelper.h
// Created: 6/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_
#define LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#if defined (LOG4CPLUS_HAVE_TIME_H)
#include <time.h>
#endif
#include <ctime>
#include <chrono>
namespace log4cplus {
namespace helpers {
using std::time_t;
using std::tm;
namespace chrono = std::chrono;
typedef chrono::system_clock Clock;
typedef chrono::duration<long long, std::micro> Duration;
typedef chrono::time_point<Clock, Duration> Time;
template <typename FromDuration>
inline
Time
time_cast (chrono::time_point<Clock, FromDuration> const & tp)
{
return chrono::time_point_cast<Duration, Clock> (tp);
}
inline
Time
now ()
{
return time_cast (Clock::now ());
}
inline
Time
from_time_t (time_t t_time)
{
return time_cast (Clock::from_time_t (t_time));
}
inline
time_t
to_time_t (Time const & the_time)
{
// This is based on <http://stackoverflow.com/a/17395137/341065>. It is
// possible that to_time_t() returns rounded time and we want truncation.
time_t time = Clock::to_time_t (the_time);
auto const rounded_time = from_time_t (time);
if (rounded_time > the_time)
--time;
return time;
}
LOG4CPLUS_EXPORT Time from_struct_tm (tm * t);
inline
Time
truncate_fractions (Time const & the_time)
{
return from_time_t (to_time_t (the_time));
}
inline
long
microseconds_part (Time const & the_time)
{
static_assert ((std::ratio_equal<Duration::period, std::micro>::value),
"microseconds");
// This is based on <http://stackoverflow.com/a/17395137/341065>
return static_cast<long>(
(the_time - from_time_t (to_time_t (the_time))).count ());
}
inline
Time
time_from_parts (time_t tv_sec, long tv_usec)
{
return from_time_t (tv_sec) + chrono::microseconds (tv_usec);
}
/**
* Populates <code>tm</code> using the <code>gmtime()</code>
* function.
*/
LOG4CPLUS_EXPORT
void gmTime (tm* t, Time const &);
/**
* Populates <code>tm</code> using the <code>localtime()</code>
* function.
*/
LOG4CPLUS_EXPORT
void localTime (tm* t, Time const &);
/**
* Returns a string with a "formatted time" specified by
* <code>fmt</code>. It used the <code>strftime()</code>
* function to do this.
*
* Look at your platform's <code>strftime()</code> documentation
* for the formatting options available.
*
* The following additional options are provided:<br>
* <code>%q</code> - 3 character field that provides milliseconds
* <code>%Q</code> - 7 character field that provides fractional
* milliseconds.
*/
LOG4CPLUS_EXPORT
log4cplus::tstring getFormattedTime (log4cplus::tstring const & fmt,
Time const & the_time, bool use_gmtime = false);
} // namespace helpers
} // namespace log4cplus
#endif // LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_

View File

@@ -0,0 +1,324 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: hierarchy.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HIERARCHY_HEADER_
#define LOG4CPLUS_HIERARCHY_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/logger.h>
#include <log4cplus/thread/syncprims.h>
#include <map>
#include <memory>
#include <vector>
namespace log4cplus {
// Forward Declarations
class HierarchyLocker;
/**
* This class is specialized in retrieving loggers by name and
* also maintaining the logger hierarchy.
*
* <em>The casual user should not have to deal with this class
* directly.</em> However, if you are in an environment where
* multiple applications run in the same process, then read on.
*
* The structure of the logger hierarchy is maintained by the
* {@link #getInstance} method. The hierarchy is such that children
* link to their parent but parents do not have any pointers to their
* children. Moreover, loggers can be instantiated in any order, in
* particular descendant before ancestor.
*
* In case a descendant is created before a particular ancestor,
* then it creates a provision node for the ancestor and adds itself
* to the provision node. Other descendants of the same ancestor add
* themselves to the previously created provision node.
*/
class LOG4CPLUS_EXPORT Hierarchy
{
public:
// DISABLE_OFF should be set to a value lower than all possible
// priorities.
static const LogLevel DISABLE_OFF;
static const LogLevel DISABLE_OVERRIDE;
// Ctors
/**
* Create a new Logger hierarchy.
*/
Hierarchy();
// Dtor
virtual ~Hierarchy();
// Methods
/**
* This call will clear all logger definitions from the internal
* hashtable. Invoking this method will irrevocably mess up the
* logger hierarchy.
*
* You should <em>really</em> know what you are doing before
* invoking this method.
*/
virtual void clear();
/**
* Returns <code>true </code>if the named logger exists
* (in the default hierarchy).
*
* @param name The name of the logger to search for.
*/
virtual bool exists(const log4cplus::tstring& name);
/**
* Similar to {@link #disable(LogLevel)} except that the LogLevel
* argument is given as a log4cplus::tstring.
*/
virtual void disable(const log4cplus::tstring& loglevelStr);
/**
* Disable all logging requests of LogLevel <em>equal to or
* below</em> the ll parameter <code>p</code>, for
* <em>all</em> loggers in this hierarchy. Logging requests of
* higher LogLevel then <code>p</code> remain unaffected.
*
* Nevertheless, if the
* BasicConfigurator::DISABLE_OVERRIDE_KEY property is set to
* true, then logging requests are evaluated as usual.
*
* The "disable" family of methods are there for speed. They
* allow printing methods such as debug, info, etc. to return
* immediately after an integer comparison without walking the
* logger hierarchy. In most modern computers an integer
* comparison is measured in nanoseconds where as a logger walk is
* measured in units of microseconds.
*/
virtual void disable(LogLevel ll);
/**
* Disable all logging requests regardless of logger and LogLevel.
* This method is equivalent to calling {@link #disable} with the
* argument FATAL_LOG_LEVEL, the highest possible LogLevel.
*/
virtual void disableAll();
/**
* Disable all Debug logging requests regardless of logger.
* This method is equivalent to calling {@link #disable} with the
* argument DEBUG_LOG_LEVEL.
*/
virtual void disableDebug();
/**
* Disable all Info logging requests regardless of logger.
* This method is equivalent to calling {@link #disable} with the
* argument INFO_LOG_LEVEL.
*/
virtual void disableInfo();
/**
* Undoes the effect of calling any of {@link #disable}, {@link
* #disableAll}, {@link #disableDebug} and {@link #disableInfo}
* methods. More precisely, invoking this method sets the Logger
* class internal variable called <code>disable</code> to its
* default "off" value.
*/
virtual void enableAll();
/**
* Return a new logger instance named as the first parameter using
* the default factory.
*
* If a logger of that name already exists, then it will be
* returned. Otherwise, a new logger will be instantiated and
* then linked with its existing ancestors as well as children.
*
* @param name The name of the logger to retrieve.
*/
virtual Logger getInstance(const log4cplus::tstring& name);
/**
* Return a new logger instance named as the first parameter using
* <code>factory</code>.
*
* If a logger of that name already exists, then it will be
* returned. Otherwise, a new logger will be instantiated by the
* <code>factory</code> parameter and linked with its existing
* ancestors as well as children.
*
* @param name The name of the logger to retrieve.
* @param factory The factory that will make the new logger instance.
*/
virtual Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory);
/**
* Returns all the currently defined loggers in this hierarchy.
*
* The root logger is <em>not</em> included in the returned list.
*/
virtual LoggerList getCurrentLoggers();
/**
* Is the LogLevel specified by <code>level</code> enabled?
*/
virtual bool isDisabled(LogLevel level);
/**
* Get the root of this hierarchy.
*/
virtual Logger getRoot() const;
/**
* Reset all values contained in this hierarchy instance to their
* default. This removes all appenders from all loggers, sets
* the LogLevel of all non-root loggers to <code>NOT_SET_LOG_LEVEL</code>,
* sets their additivity flag to <code>true</code> and sets the LogLevel
* of the root logger to DEBUG_LOG_LEVEL. Moreover, message disabling
* is set its default "off" value.
*
* Existing loggers are not removed. They are just reset.
*
* This method should be used sparingly and with care as it will
* block all logging until it is completed.</p>
*/
virtual void resetConfiguration();
/**
* Set the default LoggerFactory instance.
*/
virtual void setLoggerFactory(std::unique_ptr<spi::LoggerFactory> factory);
/**
* Returns the default LoggerFactory instance.
*/
virtual spi::LoggerFactory* getLoggerFactory();
/**
* Shutting down a hierarchy will <em>safely</em> close and remove
* all appenders in all loggers including the root logger.
*
* Some appenders such as SocketAppender need to be closed before the
* application exits. Otherwise, pending logging events might be
* lost.
*
* The <code>shutdown</code> method is careful to close nested
* appenders before closing regular appenders. This is allows
* configurations where a regular appender is attached to a logger
* and again to a nested appender.
*/
virtual void shutdown();
private:
// Types
typedef std::vector<Logger> ProvisionNode;
typedef std::map<log4cplus::tstring, ProvisionNode> ProvisionNodeMap;
typedef std::map<log4cplus::tstring, Logger> LoggerMap;
// Methods
/**
* This is the implementation of the <code>getInstance()</code> method.
* NOTE: This method does not lock the <code>hashtable_mutex</code>.
*/
LOG4CPLUS_PRIVATE
Logger getInstanceImpl(const log4cplus::tstring& name,
spi::LoggerFactory& factory);
/**
* This is the implementation of the <code>getCurrentLoggers()</code>.
* NOTE: This method does not lock the <code>hashtable_mutex</code>.
*/
LOG4CPLUS_PRIVATE
void initializeLoggerList(LoggerList& list) const;
/**
* This method loops through all the *potential* parents of
* logger'. There 3 possible cases:
*
* 1) No entry for the potential parent of 'logger' exists
*
* We create a ProvisionNode for this potential parent and insert
* 'logger' in that provision node.
*
* 2) There is an entry of type Logger for the potential parent.
*
* The entry is 'logger's nearest existing parent. We update logger's
* parent field with this entry. We also break from the loop
* because updating our parent's parent is our parent's
* responsibility.
*
* 3) There entry is of type ProvisionNode for this potential parent.
*
* We add 'logger' to the list of children for this potential parent.
*/
LOG4CPLUS_PRIVATE void updateParents(Logger const & logger);
/**
* We update the links for all the children that placed themselves
* in the provision node 'pn'. The second argument 'logger' is a
* reference for the newly created Logger, parent of all the
* children in 'pn'
*
* We loop on all the children 'c' in 'pn':
*
* If the child 'c' has been already linked to a child of
* 'logger' then there is no need to update 'c'.
*
* Otherwise, we set logger's parent field to c's parent and set
* c's parent field to logger.
*/
LOG4CPLUS_PRIVATE void updateChildren(ProvisionNode& pn,
Logger const & logger);
// Data
thread::Mutex hashtable_mutex;
std::unique_ptr<spi::LoggerFactory> defaultFactory;
ProvisionNodeMap provisionNodes;
LoggerMap loggerPtrs;
Logger root;
int disableValue;
bool emittedNoAppenderWarning;
// Disallow copying of instances of this class
Hierarchy(const Hierarchy&);
Hierarchy& operator=(const Hierarchy&);
// Friends
friend class log4cplus::spi::LoggerImpl;
friend class log4cplus::HierarchyLocker;
};
LOG4CPLUS_EXPORT Hierarchy & getDefaultHierarchy ();
} // end namespace log4cplus
#endif // LOG4CPLUS_HIERARCHY_HEADER_

View File

@@ -0,0 +1,79 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: hierarchylocker.h
// Created: 8/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_HIERARCHY_LOCKER_HEADER_
#define LOG4CPLUS_HIERARCHY_LOCKER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <log4cplus/appender.h>
#include <log4cplus/logger.h>
namespace log4cplus
{
class Hierarchy;
/**
* This is used to lock a Hierarchy. The dtor unlocks the Hierarchy.
*/
class LOG4CPLUS_EXPORT HierarchyLocker {
public:
// ctor & dtor
HierarchyLocker(Hierarchy& h);
~HierarchyLocker() LOG4CPLUS_NOEXCEPT_FALSE;
/**
* Calls the <code>resetConfiguration()</code> method on the locked Hierarchy.
*/
void resetConfiguration();
/**
* Calls the <code>getInstance()</code> method on the locked Hierarchy.
*/
Logger getInstance(const log4cplus::tstring& name);
/**
* Calls the <code>getInstance()</code> method on the locked Hierarchy.
*/
Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory);
void addAppender(Logger &logger, log4cplus::SharedAppenderPtr& appender);
private:
// Data
Hierarchy& h;
log4cplus::thread::MutexGuard hierarchyLocker;
LoggerList loggerList;
};
} // end namespace log4cplus
#endif // LOG4CPLUS_HIERARCHY_LOCKER_HEADER_

View File

@@ -0,0 +1,62 @@
// Copyright (C) 2015-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_INITIALIZER_HXX
#define LOG4CPLUS_INITIALIZER_HXX
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <memory>
namespace log4cplus
{
/**
This class helps with initialization and shutdown of log4cplus. Its
constructor calls `log4cplus::initialize()` and its destructor calls
`log4cplus::Logger::shutdown()`. Use this class as the first thing in your
`main()`. It will ensure shutdown of log4cplus at the end of
`main()`. This is particularly important on Windows, where shutdown of
standard threads outside `main()` is impossible.
*/
class LOG4CPLUS_EXPORT Initializer
{
public:
Initializer ();
~Initializer ();
Initializer (Initializer const &) = delete;
Initializer (Initializer &&) = delete;
Initializer & operator = (Initializer const &) = delete;
Initializer & operator = (Initializer &&) = delete;
};
} // namespace log4cplus
#endif // LOG4CPLUS_INITIALIZER_HXX

View File

@@ -0,0 +1,151 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: customloglevelmanager.h
// Created: 12/2018
// Author: Jens Rehsack
// Author: Václav Haisman
//
//
// Copyright (C) 2018, Jens Rehsack. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file
* This header contains declaration internal to log4cplus. They must never be
* visible from user accesible headers or exported in DLL/shared library.
*/
#ifndef LOG4CPLUS_INTERNAL_CUSTOMLOGLEVELMANAGER_HEADER_
#define LOG4CPLUS_INTERNAL_CUSTOMLOGLEVELMANAGER_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if ! defined (INSIDE_LOG4CPLUS)
# error "This header must not be be used outside log4cplus' implementation files."
#endif
#include <map>
#include <log4cplus/thread/syncprims.h>
#include <log4cplus/internal/internal.h>
namespace log4cplus {
namespace internal {
/**
* Custom log level manager used by C API.
*/
class CustomLogLevelManager {
protected:
log4cplus::thread::Mutex mtx;
bool pushed_methods;
std::map<LogLevel,tstring> ll2nm;
std::map<tstring,LogLevel> nm2ll;
public:
CustomLogLevelManager()
: pushed_methods (false)
{ }
bool add(LogLevel ll, tstring const &nm)
{
log4cplus::thread::MutexGuard guard (mtx);
if (! pushed_methods)
{
pushed_methods = true;
getLogLevelManager().pushToStringMethod(customToStringMethod);
getLogLevelManager().pushFromStringMethod(customFromStringMethod);
}
auto i = ll2nm.lower_bound(ll);
if( ( i != ll2nm.end() ) && ( i->first == ll ) && ( i->second != nm ) )
return false;
auto j = nm2ll.lower_bound(nm);
if( ( j != nm2ll.end() ) && ( j->first == nm ) && ( j->second != ll ) )
return false;
// there is no else after return
ll2nm.insert( i, std::make_pair(ll, nm) );
nm2ll.insert( j, std::make_pair(nm, ll) );
return true;
}
bool remove(LogLevel ll, tstring const &nm)
{
log4cplus::thread::MutexGuard guard (mtx);
auto i = ll2nm.find(ll);
auto j = nm2ll.find(nm);
if( ( i != ll2nm.end() ) && ( j != nm2ll.end() ) &&
( i->first == j->second ) && ( i->second == j->first ) ) {
ll2nm.erase(i);
nm2ll.erase(j);
return true;
}
// there is no else after return
return false;
}
protected:
tstring const & customToStringMethodWorker(LogLevel ll)
{
log4cplus::thread::MutexGuard guard (mtx);
auto i = ll2nm.find(ll);
if( i != ll2nm.end() )
return i->second;
return internal::empty_str;
}
LogLevel customFromStringMethodWorker(const tstring& nm)
{
log4cplus::thread::MutexGuard guard (mtx);
auto i = nm2ll.find(nm);
if( i != nm2ll.end() )
return i->second;
return NOT_SET_LOG_LEVEL;
}
LOG4CPLUS_PRIVATE static tstring const & customToStringMethod(LogLevel ll);
LOG4CPLUS_PRIVATE static LogLevel customFromStringMethod(const tstring& nm);
};
LOG4CPLUS_PRIVATE CustomLogLevelManager & getCustomLogLevelManager ();
} // namespace internal
} // namespace log4cplus
#endif // LOG4CPLUS_INTERNAL_CUSTOMLOGLEVELMANAGER_HEADER

View File

@@ -0,0 +1,55 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: cygwin-win32.h
// Created: 7/2011
// Author: Vaclav Zeman
//
// Copyright (C) 2011-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if ! defined (LOG4CPLUS_CONFIG_CYGWIN_WIN32_H)
#define LOG4CPLUS_CONFIG_CYGWIN_WIN32_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if defined (__CYGWIN__)
#if ! defined (INSIDE_LOG4CPLUS)
# error "This header must not be be used outside log4cplus' implementation files."
#endif
namespace log4cplus { namespace cygwin {
unsigned long get_current_win32_thread_id ();
void output_debug_stringW (wchar_t const *);
} } // namespace log4cplus { namespace cygwin {
#endif // defined (__CYGWIN__)
#endif // LOG4CPLUS_CONFIG_CYGWIN_WIN32_H

View File

@@ -0,0 +1,102 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: env.h
// Created: 7/2010
// Author: Vaclav Haisman
//
//
// Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_INTERNAL_ENV_H
#define LOG4CPLUS_INTERNAL_ENV_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <vector>
#include <log4cplus/tstring.h>
#include <locale>
#if defined (_WIN32)
#include <log4cplus/config/windowsh-inc.h>
#endif
#ifdef LOG4CPLUS_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef LOG4CPLUS_HAVE_UNISTD_H
#include <unistd.h>
#endif
namespace log4cplus { namespace internal {
//! Get environment variable value.
bool get_env_var (tstring & value, tstring const & name);
//! Get locale.
std::locale get_locale_by_name(tstring const& locale_name);
//! Parse a string as a boolean value.
bool parse_bool (bool & val, tstring const & str);
//! Parse a path into path components.
bool split_path (std::vector<tstring> & components, std::size_t & special,
tstring const & path);
//! Makes directories leading to file.
void make_dirs (tstring const & file_path);
inline
#if defined (_WIN32)
DWORD
get_process_id ()
{
return GetCurrentProcessId ();
}
#elif defined (LOG4CPLUS_HAVE_GETPID)
pid_t
get_process_id ()
{
return getpid ();
}
#else
int
get_process_id ()
{
return 0;
}
#endif
} } // namespace log4cplus { namespace internal {
#endif // LOG4CPLUS_INTERNAL_ENV_H

View File

@@ -0,0 +1,244 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: internal.h
// Created: 1/2009
// Author: Vaclav Haisman
//
//
// Copyright (C) 2009-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file
* This header contains declaration internal to log4cplus. They must never be
* visible from user accesible headers or exported in DLL/shared libray.
*/
#ifndef LOG4CPLUS_INTERNAL_INTERNAL_HEADER_
#define LOG4CPLUS_INTERNAL_INTERNAL_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if ! defined (INSIDE_LOG4CPLUS)
# error "This header must not be be used outside log4cplus' implementation files."
#endif
#include <memory>
#include <vector>
#include <sstream>
#include <cstdio>
#include <log4cplus/tstring.h>
#include <log4cplus/streams.h>
#include <log4cplus/ndc.h>
#include <log4cplus/mdc.h>
#include <log4cplus/spi/loggingevent.h>
#include <log4cplus/thread/impl/tls.h>
#include <log4cplus/helpers/snprintf.h>
namespace log4cplus {
namespace internal {
//! Canonical empty string. It is used when the need to return empty string
//! by reference arises.
extern log4cplus::tstring const empty_str;
struct gft_scratch_pad
{
gft_scratch_pad ();
~gft_scratch_pad ();
void
reset ()
{
uc_q_str_valid = false;
q_str_valid = false;
s_str_valid = false;
ret.clear ();
}
log4cplus::tstring q_str;
log4cplus::tstring uc_q_str;
log4cplus::tstring s_str;
log4cplus::tstring ret;
log4cplus::tstring fmt;
log4cplus::tstring tmp;
std::vector<tchar> buffer;
bool uc_q_str_valid;
bool q_str_valid;
bool s_str_valid;
};
struct appender_sratch_pad
{
appender_sratch_pad ();
~appender_sratch_pad ();
tostringstream oss;
tstring str;
std::string chstr;
};
//! Per thread data.
struct per_thread_data
{
per_thread_data ();
~per_thread_data ();
tstring macros_str;
tostringstream macros_oss;
tostringstream layout_oss;
DiagnosticContextStack ndc_dcs;
MappedDiagnosticContextMap mdc_map;
log4cplus::tstring thread_name;
log4cplus::tstring thread_name2;
gft_scratch_pad gft_sp;
appender_sratch_pad appender_sp;
log4cplus::tstring faa_str;
log4cplus::tstring ll_str;
spi::InternalLoggingEvent forced_log_ev;
std::FILE * fnull;
log4cplus::helpers::snprintf_buf snprintf_buf;
};
per_thread_data * alloc_ptd ();
// TLS key whose value is pointer struct per_thread_data.
extern log4cplus::thread::impl::tls_key_type tls_storage_key;
#if ! defined (LOG4CPLUS_SINGLE_THREADED) \
&& defined (LOG4CPLUS_THREAD_LOCAL_VAR)
extern LOG4CPLUS_THREAD_LOCAL_VAR per_thread_data * ptd;
inline
void
set_ptd (per_thread_data * p)
{
ptd = p;
}
inline
per_thread_data *
get_ptd (bool alloc = true)
{
if (LOG4CPLUS_UNLIKELY (! ptd && alloc))
return alloc_ptd ();
// The assert() does not belong here. get_ptd() might be called by
// cleanup code that can handle the returned NULL pointer.
//assert (ptd);
return ptd;
}
#else // defined (LOG4CPLUS_THREAD_LOCAL_VAR)
inline
void
set_ptd (per_thread_data * p)
{
thread::impl::tls_set_value (tls_storage_key, p);
}
inline
per_thread_data *
get_ptd (bool alloc = true)
{
per_thread_data * ptd
= reinterpret_cast<per_thread_data *>(
thread::impl::tls_get_value (tls_storage_key));
if (LOG4CPLUS_UNLIKELY (! ptd && alloc))
return alloc_ptd ();
return ptd;
}
#endif // defined (LOG4CPLUS_THREAD_LOCAL_VAR)
inline
tstring &
get_thread_name_str ()
{
return get_ptd ()->thread_name;
}
inline
tstring &
get_thread_name2_str ()
{
return get_ptd ()->thread_name2;
}
inline
gft_scratch_pad &
get_gft_scratch_pad ()
{
return get_ptd ()->gft_sp;
}
inline
appender_sratch_pad &
get_appender_sp ()
{
return get_ptd ()->appender_sp;
}
} // namespace internal {
namespace detail
{
LOG4CPLUS_EXPORT void clear_tostringstream (tostringstream &);
} // namespace detail
} // namespace log4cplus {
#endif // LOG4CPLUS_INTERNAL_INTERNAL_HEADER_

View File

@@ -0,0 +1,219 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: socket.h
// Created: 1/2010
// Author: Vaclav Haisman
//
//
// Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file
* This header contains declaration internal to log4cplus. They must never be
* visible from user accesible headers or exported in DLL/shared libray.
*/
#ifndef LOG4CPLUS_INTERNAL_SOCKET_H_
#define LOG4CPLUS_INTERNAL_SOCKET_H_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#if ! defined (INSIDE_LOG4CPLUS)
# error "This header must not be be used outside log4cplus' implementation files."
#endif
#if defined(_WIN32)
#include <log4cplus/config/windowsh-inc.h>
#endif
#include <log4cplus/helpers/socket.h>
#include <cerrno>
#ifdef LOG4CPLUS_HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef LOG4CPLUS_HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined (LOG4CPLUS_HAVE_NETDB_H)
#include <netdb.h>
#endif
namespace log4cplus {
namespace helpers {
#if defined(_WIN32)
typedef SOCKET os_socket_type;
os_socket_type const INVALID_OS_SOCKET_VALUE = INVALID_SOCKET;
struct ADDRINFOT_deleter
{
void
operator () (ADDRINFOA * ptr) const
{
FreeAddrInfoA(ptr);
}
void
operator () (ADDRINFOW * ptr) const
{
FreeAddrInfoW(ptr);
}
};
struct socket_closer
{
void
operator () (SOCKET s)
{
if (s && s != INVALID_OS_SOCKET_VALUE)
{
DWORD const eno = WSAGetLastError();
::closesocket(s);
WSASetLastError(eno);
}
}
};
#else
typedef int os_socket_type;
os_socket_type const INVALID_OS_SOCKET_VALUE = -1;
struct addrinfo_deleter
{
void
operator () (struct addrinfo * ptr) const
{
freeaddrinfo(ptr);
}
};
struct socket_closer
{
void
operator () (os_socket_type s)
{
if (s >= 0)
{
int const eno = errno;
close(s);
errno = eno;
}
}
};
#endif
struct socket_holder
{
os_socket_type sock;
socket_holder()
: sock(INVALID_OS_SOCKET_VALUE)
{ }
socket_holder(os_socket_type s)
: sock(s)
{ }
~socket_holder()
{
socket_closer()(sock);
}
void
reset(os_socket_type s = INVALID_OS_SOCKET_VALUE)
{
if (sock != INVALID_OS_SOCKET_VALUE)
socket_closer()(sock);
sock = s;
}
os_socket_type
detach()
{
os_socket_type s = sock;
sock = INVALID_OS_SOCKET_VALUE;
return s;
}
socket_holder(socket_holder &&) = delete;
socket_holder(socket_holder const &) = delete;
socket_holder operator = (socket_holder &&) = delete;
socket_holder operator = (socket_holder const &) = delete;
};
static inline
os_socket_type
to_os_socket (SOCKET_TYPE const & x)
{
return static_cast<os_socket_type>(x);
}
static inline
SOCKET_TYPE
to_log4cplus_socket (os_socket_type const & x)
{
return static_cast<SOCKET_TYPE>(x);
}
static inline
void
set_last_socket_error (int err)
{
errno = err;
}
static inline
int
get_last_socket_error ()
{
return errno;
}
} // namespace helpers {
} // namespace log4cplus {
#endif // LOG4CPLUS_INTERNAL_SOCKET_H_

View File

@@ -0,0 +1,645 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: Layout.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_LAYOUT_HEADER_
#define LOG4CPLUS_LAYOUT_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/loglevel.h>
#include <log4cplus/streams.h>
#include <log4cplus/tstring.h>
#include <log4cplus/helpers/timehelper.h>
#include <vector>
#include <memory>
namespace log4cplus {
// Forward Declarations
namespace pattern
{
class PatternConverter;
}
namespace helpers
{
class Properties;
}
namespace spi
{
class InternalLoggingEvent;
}
/**
* This class is used to layout strings sent to an {@link
* log4cplus::Appender}.
*/
class LOG4CPLUS_EXPORT Layout
{
public:
Layout();
Layout(const helpers::Properties& properties);
virtual ~Layout() = 0;
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event) = 0;
protected:
LogLevelManager& llmCache;
private:
// Disable copy
Layout(const Layout&);
Layout& operator=(Layout const &);
};
/**
* SimpleLayout consists of the LogLevel of the log statement,
* followed by " - " and then the log message itself. For example,
*
* <pre>
* DEBUG - Hello world
* </pre>
*
* {@link PatternLayout} offers a much more powerful alternative.
*/
class LOG4CPLUS_EXPORT SimpleLayout
: public Layout
{
public:
SimpleLayout();
SimpleLayout(const log4cplus::helpers::Properties& properties);
virtual ~SimpleLayout();
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event);
private:
// Disallow copying of instances of this class
SimpleLayout(const SimpleLayout&);
SimpleLayout& operator=(const SimpleLayout&);
};
/**
* TTCC layout format consists of time, thread, Logger and nested
* diagnostic context information, hence the name.
*
* The time format depends on the <code>DateFormat</code> used. Use the
* <code>Use_gmtime</code> to specify whether messages should be logged
* using <code>localtime</code> or <code>gmtime</code>. There are also
* <code>ThreadPrinting</code>, <code>CategoryPrefixing</code> and
* <code>ContextPrinting</code> properties to turn on and off thread name,
* logger name and NDC context printing respectively.
*
* Here is an example TTCCLayout output:
*
* ~~~~
* 1 [0x60004dca0] WARN test.TestThread <> - Thread-3 TestThread.run()- Starting...
* 1 [0x60004dca0] TRACE SlowObject <Thread-3 loop> - ENTER: SlowObject::doSomething()
* 2 [0x60004b030] INFO SlowObject <Thread-0 loop> - Actually doing something...1, 2, 3, testing...DONE
* 2 [0x60004b130] INFO SlowObject <Thread-1 loop> - Actually doing something...
* 2 [0x60004b030] TRACE SlowObject <Thread-0 loop> - EXIT: SlowObject::doSomething()
* 2 [0x60004b030] TRACE SlowObject <Thread-0 loop> - ENTER: SlowObject::doSomething()
* 3 [0x60004b130] INFO SlowObject <Thread-1 loop> - Actually doing something...1, 2, 3, testing...DONE
* 3 [0x60004cad0] INFO SlowObject <Thread-2 loop> - Actually doing something...
* ~~~~
*
* The first field is the number of milliseconds elapsed since
* the start of the program.
*
* The second field is the thread outputting the log
* statement. (The value is the same as that of the `t` formatter
* for PatternLayout.)
*
* The third field is the LogLevel.
*
* The fourth field is the logger to which the statement belongs.
*
* The fifth field (just before the '-') is the nested
* diagnostic context. Note the nested diagnostic context may be
* empty as in the first two statements. The text after the '-'
* is the message of the statement.
*
* PatternLayout offers a much more flexible alternative.
*/
class LOG4CPLUS_EXPORT TTCCLayout
: public Layout
{
public:
TTCCLayout(bool use_gmtime = false, bool thread_printing = true,
bool category_prefixes = true, bool context_printing = true);
TTCCLayout(const log4cplus::helpers::Properties& properties);
virtual ~TTCCLayout();
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event);
bool getThreadPrinting() const;
void setThreadPrinting(bool);
bool getCategoryPrefixing() const;
void setCategoryPrefixing(bool);
bool getContextPrinting() const;
void setContextPrinting(bool);
protected:
log4cplus::tstring dateFormat;
bool use_gmtime = false;
bool thread_printing = true;
bool category_prefixing = true;
bool context_printing = true;
private:
// Disallow copying of instances of this class
TTCCLayout(const TTCCLayout&);
TTCCLayout& operator=(const TTCCLayout&);
};
LOG4CPLUS_EXPORT helpers::Time const & getTTCCLayoutTimeBase ();
/**
* A flexible layout configurable with pattern string.
*
* The goal of this class is to format a InternalLoggingEvent and return
* the results as a string. The results depend on the <em>conversion
* pattern</em>.
*
* The conversion pattern is closely related to the conversion
* pattern of the printf function in C. A conversion pattern is
* composed of literal text and format control expressions called
* <em>conversion specifiers</em>.
*
* <i>You are free to insert any literal text within the conversion
* pattern.</i>
*
* Each conversion specifier starts with a percent sign (%%) and is
* followed by optional <em>format modifiers</em> and a <em>conversion
* character</em>. The conversion character specifies the type of
* data, e.g. Logger, LogLevel, date, thread name. The format
* modifiers control such things as field width, padding, left and
* right justification. The following is a simple example.
*
* Let the conversion pattern be `"%-5p [%t]: %m%n"` and assume
* that the log4cplus environment was set to use a PatternLayout. Then the
* statements
*
* ~~~~{.c}
* Logger root = Logger.getRoot();
* LOG4CPLUS_DEBUG(root, "Message 1");
* LOG4CPLUS_WARN(root, "Message 2");
* ~~~~
*
* would yield the output
*
* ~~~~
* DEBUG [main]: Message 1
* WARN [main]: Message 2
* ~~~~
*
* Note that there is no explicit separator between text and
* conversion specifiers. The pattern parser knows when it has reached
* the end of a conversion specifier when it reads a conversion
* character. In the example above the conversion specifier
* <b>"%-5p"</b> means the LogLevel of the logging event should be left
* justified to a width of five characters.
*
* The recognized conversion characters are
*
* <table border="1" CELLPADDING="8">
* <tr>
* <td>Conversion Character</td>
* <td>Effect</td>
* </tr>
*
* <tr>
* <td align=center><b>b</b></td>
*
* <td>Used to output file name component of path name.
* E.g. <tt>main.cxx</tt> from path <tt>../../main.cxx</tt>.</td>
* </tr>
*
* <tr>
* <td align=center><b>c</b></td>
*
* <td>Used to output the logger of the logging event. The
* logger conversion specifier can be optionally followed by
* <em>precision specifier</em>, that is a decimal constant in
* brackets.
*
* If a precision specifier is given, then only the corresponding
* number of right most components of the logger name will be
* printed. By default the logger name is printed in full.
*
* For example, for the logger name "a.b.c" the pattern
* <b>%c{2}</b> will output "b.c".
*
* </td>
* </tr>
*
* <tr>
* <td align=center><b>d</b></td>
*
* <td>Used to output the date of the logging event in <b>UTC</b>.
*
* The date conversion specifier may be followed by a <em>date format
* specifier</em> enclosed between braces. For example, <b>%%d{%%H:%%M:%%s}</b>
* or <b>%%d{%%d&nbsp;%%b&nbsp;%%Y&nbsp;%%H:%%M:%%s}</b>. If no date format
* specifier is given then <b>%%d{%%d&nbsp;%%m&nbsp;%%Y&nbsp;%%H:%%M:%%s}</b>
* is assumed.
*
* The Following format options are possible:
* <ul>
* <li>%%a -- Abbreviated weekday name</li>
* <li>%%A -- Full weekday name</li>
* <li>%%b -- Abbreviated month name</li>
* <li>%%B -- Full month name</li>
* <li>%%c -- Standard date and time string</li>
* <li>%%d -- Day of month as a decimal(1-31)</li>
* <li>%%H -- Hour(0-23)</li>
* <li>%%I -- Hour(1-12)</li>
* <li>%%j -- Day of year as a decimal(1-366)</li>
* <li>%%m -- Month as decimal(1-12)</li>
* <li>%%M -- Minute as decimal(0-59)</li>
* <li>%%p -- Locale's equivalent of AM or PM</li>
* <li>%%q -- milliseconds as decimal(0-999) -- <b>Log4CPLUS specific</b>
* <li>%%Q -- fractional milliseconds as decimal(0-999.999) -- <b>Log4CPLUS specific</b>
* <li>%%S -- Second as decimal(0-59)</li>
* <li>%%U -- Week of year, Sunday being first day(0-53)</li>
* <li>%%w -- Weekday as a decimal(0-6, Sunday being 0)</li>
* <li>%%W -- Week of year, Monday being first day(0-53)</li>
* <li>%%x -- Standard date string</li>
* <li>%%X -- Standard time string</li>
* <li>%%y -- Year in decimal without century(0-99)</li>
* <li>%%Y -- Year including century as decimal</li>
* <li>%%Z -- Time zone name</li>
* <li>%% -- The percent sign</li>
* </ul>
*
* Lookup the documentation for the <code>strftime()</code> function
* found in the <code>&lt;ctime&gt;</code> header for more information.
* </td>
* </tr>
*
* <tr>
* <td align=center><b>D</b></td>
*
* <td>Used to output the date of the logging event in <b>local</b> time.
*
* All of the above information applies.
* </td>
* </tr>
*
* <tr>
* <td align=center><b>E</b></td>
*
* <td>Used to output the value of a given environment variable. The
* name of is supplied as an argument in brackets. If the variable does
* exist then empty string will be used.
*
* For example, the pattern <b>%E{HOME}</b> will output the contents
* of the HOME environment variable.
* </td>
* </tr>
*
* <tr>
* <td align=center><b>F</b></td>
*
* <td>Used to output the file name where the logging request was
* issued.
*
* <b>NOTE</b> Unlike log4j, there is no performance penalty for
* calling this method.</td>
* </tr>
*
* <tr>
* <td align=center><b>h</b></td>
*
* <td>Used to output the hostname of this system (as returned
* by gethostname(2)).
*
* <b>NOTE</b> The hostname is only retrieved once at
* initialization.
*
* </td>
* </tr>
*
* <tr>
* <td align=center><b>H</b></td>
*
* <td>Used to output the fully-qualified domain name of this
* system (as returned by gethostbyname(2) for the hostname
* returned by gethostname(2)).
*
* <b>NOTE</b> The hostname is only retrieved once at
* initialization.
*
* </td>
* </tr>
*
* <tr>
* <td align=center><b>l</b></td>
*
* <td>Equivalent to using "%F:%L"
*
* <b>NOTE:</b> Unlike log4j, there is no performance penalty for
* calling this method.
*
* </td>
* </tr>
*
* <tr>
* <td align=center><b>L</b></td>
*
* <td>Used to output the line number from where the logging request
* was issued.
*
* <b>NOTE:</b> Unlike log4j, there is no performance penalty for
* calling this method.
*
* </tr>
*
* <tr>
* <td align=center><b>m</b></td>
* <td>Used to output the application supplied message associated with
* the logging event.</td>
* </tr>
*
* <tr>
* <td align=center><b>M</b></td>
*
* <td>Used to output function name using
* <code>__FUNCTION__</code> or similar macro.
*
* <b>NOTE</b> The <code>__FUNCTION__</code> macro is not
* standard but it is common extension provided by all compilers
* (as of 2010). In case it is missing or in case this feature
* is disabled using the
* <code>LOG4CPLUS_DISABLE_FUNCTION_MACRO</code> macro, %M
* expands to an empty string.</td>
* </tr>
*
* <tr>
* <td align=center><b>n</b></td>
*
* <td>Outputs the platform dependent line separator character or
* characters.
* </tr>
*
* <tr>
* <td align=center><b>p</b></td>
* <td>Used to output the LogLevel of the logging event.</td>
* </tr>
*
* <tr>
* <td align=center><b>r</b></td>
* <td>Used to output miliseconds since program start
* of the logging event.</td>
* </tr>
*
* <tr>
* <td align=center><b>t</b></td>
*
* <td>Used to output the thread ID of the thread that generated
* the logging event. (This is either `pthread_t` value returned
* by `pthread_self()` on POSIX platforms or thread ID returned
* by `GetCurrentThreadId()` on Windows.)</td>
* </tr>
*
* <tr>
* <td align=center><b>T</b></td>
*
* <td>Used to output alternative name of the thread that generated the
* logging event.</td>
* </tr>
*
* <tr>
* <td align=center><b>i</b></td>
*
* <td>Used to output the process ID of the process that generated the
* logging event.</td>
* </tr>
*
* <tr>
* <td align=center><b>x</b></td>
*
* <td>Used to output the NDC (nested diagnostic context) associated
* with the thread that generated the logging event.
* </td>
* </tr>
*
* <tr>
* <td align=center><b>X</b></td>
*
* <td>Used to output the MDC (mapped diagnostic context)
* associated with the thread that generated the logging
* event. It takes optional key parameter. Without the key
* paramter (%%X), it outputs the whole MDC map. With the key
* (%%X{key}), it outputs just the key's value.
* </td>
* </tr>
*
* <tr>
* <td align=center><b>"%%"</b></td>
* <td>The sequence "%%" outputs a single percent sign.
* </td>
* </tr>
*
* </table>
*
* By default the relevant information is output as is. However,
* with the aid of format modifiers it is possible to change the
* minimum field width, the maximum field width and justification.
*
* The optional format modifier is placed between the percent sign
* and the conversion character.
*
* The first optional format modifier is the <em>left justification
* flag</em> which is just the minus (-) character. Then comes the
* optional <em>minimum field width</em> modifier. This is a decimal
* constant that represents the minimum number of characters to
* output. If the data item requires fewer characters, it is padded on
* either the left or the right until the minimum width is
* reached. The default is to pad on the left (right justify) but you
* can specify right padding with the left justification flag. The
* padding character is space. If the data item is larger than the
* minimum field width, the field is expanded to accommodate the
* data. The value is never truncated.
*
* This behavior can be changed using the <em>maximum field
* width</em> modifier which is designated by a period followed by a
* decimal constant. If the data item is longer than the maximum
* field, then the extra characters are removed from the
* <em>beginning</em> of the data item and not from the end. For
* example, it the maximum field width is eight and the data item is
* ten characters long, then the first two characters of the data item
* are dropped. This behavior deviates from the printf function in C
* where truncation is done from the end.
*
* Below are various format modifier examples for the logger
* conversion specifier.
*
*
* <TABLE BORDER=1 CELLPADDING=8>
* <tr>
* <td>Format modifier</td>
* <td>left justify</td>
* <td>minimum width</td>
* <td>maximum width</td>
* <td>comment</td>
* </tr>
*
* <tr>
* <td align=center>%20c</td>
* <td align=center>false</td>
* <td align=center>20</td>
* <td align=center>none</td>
*
* <td>Left pad with spaces if the logger name is less than 20
* characters long.
* </tr>
*
* <tr> <td align=center>%-20c</td> <td align=center>true</td> <td
* align=center>20</td> <td align=center>none</td> <td>Right pad with
* spaces if the logger name is less than 20 characters long.
* </tr>
*
* <tr>
* <td align=center>%.30c</td>
* <td align=center>NA</td>
* <td align=center>none</td>
* <td align=center>30</td>
*
* <td>Truncate from the beginning if the logger name is longer than 30
* characters.
* </tr>
*
* <tr>
* <td align=center>%20.30c</td>
* <td align=center>false</td>
* <td align=center>20</td>
* <td align=center>30</td>
*
* <td>Left pad with spaces if the logger name is shorter than 20
* characters. However, if logger name is longer than 30 characters,
* then truncate from the beginning.
* </tr>
*
* <tr>
* <td align=center>%-20.30c</td>
* <td align=center>true</td>
* <td align=center>20</td>
* <td align=center>30</td>
*
* <td>Right pad with spaces if the logger name is shorter than 20
* characters. However, if logger name is longer than 30 characters,
* then truncate from the beginning.
* </tr>
*
* </table>
*
* Below are some examples of conversion patterns.
*
* <dl>
*
* <dt><b>"%r [%t] %-5p %c %x - %m%n"</b>
* <dd>This is essentially the TTCC layout.
*
* <dt><b>"%-6r [%15.15t] %-5p %30.30c %x - %m%n"</b>
*
* <dd>Similar to the TTCC layout except that the relative time is
* right padded if less than 6 digits, thread name is right padded if
* less than 15 characters and truncated if longer and the logger
* name is left padded if shorter than 30 characters and truncated if
* longer.
*
* </dl>
*
* The above text is largely inspired from Peter A. Darnell and
* Philip E. Margolis' highly recommended book "C -- a Software
* Engineering Approach", ISBN 0-387-97389-3.
*
* <h3>Properties</h3>
*
* <dl>
* <dt><tt>NDCMaxDepth</tt></dt>
* <dd>This property limits how many deepest NDC components will
* be printed by <b>%%x</b> specifier.</dd>
*
* <dt><tt>ConversionPattern</tt></dt>
* <dd>This property specifies conversion pattern.</dd>
* </dl>
*
*/
class LOG4CPLUS_EXPORT PatternLayout
: public Layout
{
public:
// Ctors and dtor
PatternLayout(const log4cplus::tstring& pattern);
PatternLayout(const log4cplus::helpers::Properties& properties);
virtual ~PatternLayout();
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event);
protected:
void init(const log4cplus::tstring& pattern, unsigned ndcMaxDepth = 0);
// Data
log4cplus::tstring pattern;
std::vector<std::unique_ptr<pattern::PatternConverter> > parsedPattern;
private:
// Disallow copying of instances of this class
PatternLayout(const PatternLayout&);
PatternLayout& operator=(const PatternLayout&);
};
} // end namespace log4cplus
#endif // LOG4CPLUS_LAYOUT_HEADER_

View File

@@ -0,0 +1,66 @@
// Copyright (C) 2015-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_LOG4CPLUS_HXX
#define LOG4CPLUS_LOG4CPLUS_HXX
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/version.h>
#include <log4cplus/loglevel.h>
#include <log4cplus/logger.h>
#include <log4cplus/layout.h>
#include <log4cplus/hierarchy.h>
#include <log4cplus/loggingmacros.h>
#include <log4cplus/tracelogger.h>
#include <log4cplus/configurator.h>
#include <log4cplus/appender.h>
#include <log4cplus/mdc.h>
#include <log4cplus/ndc.h>
#include <log4cplus/initializer.h>
#include <log4cplus/helpers/property.h>
#include <log4cplus/spi/factory.h>
#include <log4cplus/spi/filter.h>
#include <log4cplus/spi/loggingevent.h>
#include <log4cplus/asyncappender.h>
#include <log4cplus/consoleappender.h>
#include <log4cplus/fileappender.h>
#include <log4cplus/socketappender.h>
#include <log4cplus/syslogappender.h>
#include <log4cplus/nullappender.h>
#if defined (LOG4CPLUS_WITH_UNIT_TESTS)
namespace log4cplus
{
LOG4CPLUS_EXPORT int unit_tests_main (int argc, char* argv[]);
} // namespace log4cplus
#endif
#endif // LOG4CPLUS_LOG4CPLUS_HXX

View File

@@ -0,0 +1,91 @@
// -*- C++ -*-
// Module: LOG4CPLUS
// File: log4judpappender.h
// Created: 7/2012
// Author: Siva Chandran P
//
//
// Copyright 2012-2017 Siva Chandran P
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file */
#ifndef LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_
#define LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_
#include <log4cplus/config.hxx>
#include <log4cplus/appender.h>
#include <log4cplus/helpers/socket.h>
namespace log4cplus {
/**
* Sends log events as Log4j XML to a remote a log server.
*
* The Log4jUdpAppender has the following properties:
*
* <ul>
* <li>Remote logging is non-intrusive as far as the log event
* is concerned. In other words, the event will be logged with
* the same time stamp, NDC, location info as if it were logged
* locally by the client.</li>
*
* <li>Remote logging uses the UDP protocol.</li>
* </ul>
*
* <h3>Properties</h3>
* <dl>
* <dt><tt>host</tt></dt>
* <dd>Remote host name to connect and send events to.</dd>
*
* <dt><tt>port</tt></dt>
* <dd>Port on remote host to send events to. Default is 5000.</dd>
*
* <dt><tt>IPv6</tt></dt>
* <dd>Boolean value specifying whether to use IPv6 (true) or IPv4
* (false). Default value is false.</dd>
*
* </dl>
*/
class LOG4CPLUS_EXPORT Log4jUdpAppender : public Appender {
public:
// Ctors
Log4jUdpAppender(const log4cplus::tstring& host, int port,
bool ipv6 = false);
Log4jUdpAppender(const log4cplus::helpers::Properties & properties);
// Dtor
~Log4jUdpAppender();
// Methods
virtual void close();
protected:
void openSocket();
virtual void append(const spi::InternalLoggingEvent& event);
// Data
log4cplus::helpers::Socket socket;
log4cplus::tstring host;
int port;
bool ipv6 = false;
private:
// Disallow copying of instances of this class
Log4jUdpAppender(const Log4jUdpAppender&);
Log4jUdpAppender& operator=(const Log4jUdpAppender&);
};
} // end namespace log4cplus
#endif // LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_

View File

@@ -0,0 +1,325 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: logger.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file
* This header defines the Logger class and the logging macros. */
#ifndef LOG4CPLUS_LOGGERHEADER_
#define LOG4CPLUS_LOGGERHEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/loglevel.h>
#include <log4cplus/tstring.h>
#include <log4cplus/spi/appenderattachable.h>
#include <log4cplus/spi/loggerfactory.h>
#include <vector>
namespace log4cplus
{
// Forward declarations
class Appender;
class Hierarchy;
class HierarchyLocker;
class DefaultLoggerFactory;
namespace spi
{
class LoggerImpl;
}
/** \typedef std::vector<Logger> LoggerList
* This is a list of {@link Logger Loggers}. */
typedef std::vector<Logger> LoggerList;
/**
* This is the central class in the log4cplus package. One of the
* distintive features of log4cplus are hierarchical loggers and their
* evaluation.
*/
class LOG4CPLUS_EXPORT Logger
: public log4cplus::spi::AppenderAttachable
{
public:
// Static Methods
/**
* Returns <code>true </code>if the named logger exists
* (in the default hierarchy).
*
* @param name The name of the logger to search for.
*/
static bool exists(const log4cplus::tstring& name);
/*
* Returns all the currently defined loggers in the default
* hierarchy.
*
* The root logger is <em>not</em> included in the returned
* list.
*/
static LoggerList getCurrentLoggers();
/**
* Return the default Hierarchy instance.
*/
static Hierarchy& getDefaultHierarchy();
/**
* Retrieve a logger with name <code>name</code>. If the named
* logger already exists, then the existing instance will be returned.
* Otherwise, a new instance is created.
*
* By default, loggers do not have a set LogLevel but inherit
* it from the hierarchy. This is one of the central features of
* log4cplus.
*
* @param name The name of the logger to retrieve.
*/
static Logger getInstance(const log4cplus::tstring& name);
/**
* Like getInstance() except that the type of logger
* instantiated depends on the type returned by the {@link
* spi::LoggerFactory#makeNewLoggerInstance} method of the
* <code>factory</code> parameter.
*
* This method is intended to be used by sub-classes.
*
* @param name The name of the logger to retrieve.
* @param factory A {@link spi::LoggerFactory} implementation that will
* actually create a new Instance.
*/
static Logger getInstance(const log4cplus::tstring& name,
spi::LoggerFactory& factory);
/**
* Return the root of the default logger hierrachy.
*
* The root logger is always instantiated and available. It's
* name is "root".
*
* Nevertheless, calling {@link #getInstance
* Logger.getInstance("root")} does not retrieve the root logger
* but a logger just under root named "root".
*/
static Logger getRoot();
/**
* Calling this method will <em>safely</em> close and remove all
* appenders in all the loggers including root contained in the
* default hierachy.
*
* Some appenders such as SocketAppender need to be closed before the
* application exits. Otherwise, pending logging events might be
* lost.
*
* The <code>shutdown</code> method is careful to close nested
* appenders before closing regular appenders. This is allows
* configurations where a regular appender is attached to a logger
* and again to a nested appender.
*/
static void shutdown();
// Non-Static Methods
/**
* If <code>assertionVal</code> parameter is <code>false</code>, then
* logs <code>msg</code> with FATAL_LOG_LEVEL log level.
*
* @param assertionVal Truth value of assertion condition.
* @param msg The message to print if <code>assertion</code> is
* false.
*/
void assertion(bool assertionVal, const log4cplus::tstring& msg) const;
/**
* Close all attached appenders implementing the AppenderAttachable
* interface.
*/
void closeNestedAppenders() const;
/**
* Check whether this logger is enabled for a given
* LogLevel passed as parameter.
*
* @return boolean True if this logger is enabled for <code>ll</code>.
*/
bool isEnabledFor(LogLevel ll) const;
/**
* This generic form is intended to be used by wrappers.
*/
void log(LogLevel ll, const log4cplus::tstring& message,
const char* file = LOG4CPLUS_CALLER_FILE (),
int line = LOG4CPLUS_CALLER_LINE (),
const char* function = LOG4CPLUS_CALLER_FUNCTION ()) const;
void log(spi::InternalLoggingEvent const &) const;
/**
* This method creates a new logging event and logs the event
* without further checks.
*/
void forcedLog(LogLevel ll, const log4cplus::tstring& message,
const char* file = LOG4CPLUS_CALLER_FILE (),
int line = LOG4CPLUS_CALLER_LINE (),
const char* function = LOG4CPLUS_CALLER_FUNCTION ()) const;
void forcedLog(spi::InternalLoggingEvent const &) const;
/**
* Call the appenders in the hierrachy starting at
* <code>this</code>. If no appenders could be found, emit a
* warning.
*
* This method calls all the appenders inherited from the
* hierarchy circumventing any evaluation of whether to log or not
* to log the particular log request.
*
* @param event the event to log.
*/
void callAppenders(const spi::InternalLoggingEvent& event) const;
/**
* Starting from this logger, search the logger hierarchy for a
* "set" LogLevel and return it. Otherwise, return the LogLevel of the
* root logger.
*
* The Logger class is designed so that this method executes as
* quickly as possible.
*/
LogLevel getChainedLogLevel() const;
/**
* Returns the assigned LogLevel, if any, for this Logger.
*
* @return LogLevel - the assigned LogLevel, can be <code>NOT_SET_LOG_LEVEL</code>.
*/
LogLevel getLogLevel() const;
/**
* Set the LogLevel of this Logger.
*/
void setLogLevel(LogLevel ll);
/**
* Return the the {@link Hierarchy} where this <code>Logger</code> instance is
* attached.
*/
Hierarchy& getHierarchy() const;
/**
* Return the logger name.
*/
log4cplus::tstring const & getName() const;
/**
* Get the additivity flag for this Logger instance.
*/
bool getAdditivity() const;
/**
* Set the additivity flag for this Logger instance.
*/
void setAdditivity(bool additive);
// AppenderAttachable Methods
virtual void addAppender(SharedAppenderPtr newAppender);
virtual SharedAppenderPtrList getAllAppenders();
virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name);
virtual void removeAllAppenders();
virtual void removeAppender(SharedAppenderPtr appender);
virtual void removeAppender(const log4cplus::tstring& name);
Logger () LOG4CPLUS_NOEXCEPT;
Logger(const Logger& rhs) LOG4CPLUS_NOEXCEPT;
Logger& operator=(const Logger& rhs) LOG4CPLUS_NOEXCEPT;
Logger (Logger && rhs) LOG4CPLUS_NOEXCEPT;
Logger & operator = (Logger && rhs) LOG4CPLUS_NOEXCEPT;
virtual ~Logger();
void swap (Logger &) LOG4CPLUS_NOEXCEPT;
/**
* Used to retrieve the parent of this Logger in the
* Logger tree.
*/
Logger getParent() const;
protected:
// Data
/** This is a pointer to the implementation class. */
spi::LoggerImpl * value = nullptr;
private:
// Ctors
/**
* This constructor created a new <code>Logger</code> instance
* with a pointer to a Logger implementation.
*
* You should not create loggers directly.
*
* @param ptr A pointer to the Logger implementation. This value
* cannot be NULL.
*/
Logger(spi::LoggerImpl * ptr) LOG4CPLUS_NOEXCEPT;
// Friends
friend class log4cplus::spi::LoggerImpl;
friend class log4cplus::Hierarchy;
friend class log4cplus::HierarchyLocker;
friend class log4cplus::DefaultLoggerFactory;
};
/**
* This class is used to create the default implementation of
* the Logger class.
*/
class LOG4CPLUS_EXPORT DefaultLoggerFactory : public spi::LoggerFactory {
public:
Logger makeNewLoggerInstance(const log4cplus::tstring& name, Hierarchy& h);
protected:
virtual spi::LoggerImpl * makeNewLoggerImplInstance(
const log4cplus::tstring& name, Hierarchy& h);
};
} // end namespace log4cplus
#endif // LOG4CPLUS_LOGGERHEADER_

View File

@@ -0,0 +1,427 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: loggingmacros.h
// Created: 8/2003
// Author: Tad E. Smith
//
//
// Copyright 2003-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file
* This header defines the logging macros. */
#ifndef LOG4CPLUS_LOGGING_MACROS_HEADER_
#define LOG4CPLUS_LOGGING_MACROS_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/streams.h>
#include <log4cplus/logger.h>
#include <log4cplus/helpers/snprintf.h>
#include <log4cplus/tracelogger.h>
#include <sstream>
#include <utility>
#if defined(_MSC_VER)
#define LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
__pragma (warning (push)) \
__pragma (warning (disable:4127))
#define LOG4CPLUS_RESTORE_DOWHILE_WARNING() \
__pragma (warning (pop))
#else
#define LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() /* empty */
#define LOG4CPLUS_RESTORE_DOWHILE_WARNING() /* empty */
#endif
#define LOG4CPLUS_DOWHILE_NOTHING() \
LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
do { } while (0) \
LOG4CPLUS_RESTORE_DOWHILE_WARNING()
#if defined(LOG4CPLUS_DISABLE_FATAL) && !defined(LOG4CPLUS_DISABLE_ERROR)
#define LOG4CPLUS_DISABLE_ERROR
#endif
#if defined(LOG4CPLUS_DISABLE_ERROR) && !defined(LOG4CPLUS_DISABLE_WARN)
#define LOG4CPLUS_DISABLE_WARN
#endif
#if defined(LOG4CPLUS_DISABLE_WARN) && !defined(LOG4CPLUS_DISABLE_INFO)
#define LOG4CPLUS_DISABLE_INFO
#endif
#if defined(LOG4CPLUS_DISABLE_INFO) && !defined(LOG4CPLUS_DISABLE_DEBUG)
#define LOG4CPLUS_DISABLE_DEBUG
#endif
#if defined(LOG4CPLUS_DISABLE_DEBUG) && !defined(LOG4CPLUS_DISABLE_TRACE)
#define LOG4CPLUS_DISABLE_TRACE
#endif
namespace log4cplus
{
namespace detail
{
inline
Logger
macros_get_logger (Logger const & logger)
{
return logger;
}
inline
Logger const &
macros_get_logger (Logger & logger)
{
return logger;
}
inline
Logger
macros_get_logger (Logger && logger)
{
return std::move (logger);
}
inline
Logger
macros_get_logger (tstring const & logger)
{
return Logger::getInstance (logger);
}
inline
Logger
macros_get_logger (tchar const * logger)
{
return Logger::getInstance (logger);
}
LOG4CPLUS_EXPORT void clear_tostringstream (tostringstream &);
LOG4CPLUS_EXPORT log4cplus::tostringstream & get_macro_body_oss ();
LOG4CPLUS_EXPORT log4cplus::helpers::snprintf_buf & get_macro_body_snprintf_buf ();
LOG4CPLUS_EXPORT void macro_forced_log (log4cplus::Logger const &,
log4cplus::LogLevel, log4cplus::tstring const &, char const *, int,
char const *);
LOG4CPLUS_EXPORT void macro_forced_log (log4cplus::Logger const &,
log4cplus::LogLevel, log4cplus::tchar const *, char const *, int,
char const *);
} // namespace detail
} // namespace log4cplus
#undef LOG4CPLUS_MACRO_FUNCTION
#define LOG4CPLUS_MACRO_FUNCTION() nullptr
#if ! defined (LOG4CPLUS_DISABLE_FUNCTION_MACRO)
# if defined (LOG4CPLUS_HAVE_FUNCSIG_MACRO)
# undef LOG4CPLUS_MACRO_FUNCTION
# define LOG4CPLUS_MACRO_FUNCTION() __FUNCSIG__
# elif defined (LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO)
# undef LOG4CPLUS_MACRO_FUNCTION
# define LOG4CPLUS_MACRO_FUNCTION() __PRETTY_FUNCTION__
# elif defined (LOG4CPLUS_HAVE_FUNCTION_MACRO)
# undef LOG4CPLUS_MACRO_FUNCTION
# define LOG4CPLUS_MACRO_FUNCTION() __FUNCTION__
# elif defined (LOG4CPLUS_HAVE_FUNC_SYMBOL)
# undef LOG4CPLUS_MACRO_FUNCTION
# define LOG4CPLUS_MACRO_FUNCTION() __func__
# endif
#endif
#undef LOG4CPLUS_MACRO_FILE
#define LOG4CPLUS_MACRO_FILE() nullptr
#if ! defined (LOG4CPLUS_DISABLE_FILE_MACRO)
# undef LOG4CPLUS_MACRO_FILE
# define LOG4CPLUS_MACRO_FILE() __FILE__
#endif
// Make TRACE and DEBUG log level unlikely and INFO, WARN, ERROR and
// FATAL log level likely.
#define LOG4CPLUS_MACRO_TRACE_LOG_LEVEL(pred) \
LOG4CPLUS_UNLIKELY (pred)
#define LOG4CPLUS_MACRO_DEBUG_LOG_LEVEL(pred) \
LOG4CPLUS_UNLIKELY (pred)
#define LOG4CPLUS_MACRO_INFO_LOG_LEVEL(pred) \
LOG4CPLUS_LIKELY (pred)
#define LOG4CPLUS_MACRO_WARN_LOG_LEVEL(pred) \
LOG4CPLUS_LIKELY (pred)
#define LOG4CPLUS_MACRO_ERROR_LOG_LEVEL(pred) \
LOG4CPLUS_LIKELY (pred)
#define LOG4CPLUS_MACRO_FATAL_LOG_LEVEL(pred) \
LOG4CPLUS_LIKELY (pred)
//! Dispatch to LOG4CPLUS_MACRO_LOGLEVEL_* depending on log level.
#define LOG4CPLUS_MACRO_LOGLEVEL_PRED(pred, logLevel) \
LOG4CPLUS_MACRO_ ## logLevel (pred)
// Either use temporary instances of ostringstream
// and snprintf_buf, or use thread-local instances.
#if defined (LOG4CPLUS_MACRO_DISABLE_TLS)
# define LOG4CPLUS_MACRO_INSTANTIATE_OSTRINGSTREAM(var) \
log4cplus::tostringstream var
# define LOG4CPLUS_MACRO_INSTANTIATE_SNPRINTF_BUF(var) \
log4cplus::helpers::snprintf_buf var
#else
# define LOG4CPLUS_MACRO_INSTANTIATE_OSTRINGSTREAM(var) \
log4cplus::tostringstream & var \
= log4cplus::detail::get_macro_body_oss ()
# define LOG4CPLUS_MACRO_INSTANTIATE_SNPRINTF_BUF(var) \
log4cplus::helpers::snprintf_buf & var \
= log4cplus::detail::get_macro_body_snprintf_buf ()
#endif
#define LOG4CPLUS_MACRO_BODY(logger, logEvent, logLevel) \
LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
do { \
log4cplus::Logger const & _l \
= log4cplus::detail::macros_get_logger (logger); \
if (LOG4CPLUS_MACRO_LOGLEVEL_PRED ( \
_l.isEnabledFor (log4cplus::logLevel), logLevel)) { \
LOG4CPLUS_MACRO_INSTANTIATE_OSTRINGSTREAM (_log4cplus_buf); \
_log4cplus_buf << logEvent; \
log4cplus::detail::macro_forced_log (_l, \
log4cplus::logLevel, _log4cplus_buf.str(), \
LOG4CPLUS_MACRO_FILE (), __LINE__, \
LOG4CPLUS_MACRO_FUNCTION ()); \
} \
} while (0) \
LOG4CPLUS_RESTORE_DOWHILE_WARNING()
#define LOG4CPLUS_MACRO_STR_BODY(logger, logEvent, logLevel) \
LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
do { \
log4cplus::Logger const & _l \
= log4cplus::detail::macros_get_logger (logger); \
if (LOG4CPLUS_MACRO_LOGLEVEL_PRED ( \
_l.isEnabledFor (log4cplus::logLevel), logLevel)) { \
log4cplus::detail::macro_forced_log (_l, \
log4cplus::logLevel, logEvent, \
LOG4CPLUS_MACRO_FILE (), __LINE__, \
LOG4CPLUS_MACRO_FUNCTION ()); \
} \
} while(0) \
LOG4CPLUS_RESTORE_DOWHILE_WARNING()
#define LOG4CPLUS_MACRO_FMT_BODY(logger, logLevel, ...) \
LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
do { \
log4cplus::Logger const & _l \
= log4cplus::detail::macros_get_logger (logger); \
if (LOG4CPLUS_MACRO_LOGLEVEL_PRED ( \
_l.isEnabledFor (log4cplus::logLevel), logLevel)) { \
LOG4CPLUS_MACRO_INSTANTIATE_SNPRINTF_BUF (_snpbuf); \
log4cplus::tchar const * _logEvent \
= _snpbuf.print (__VA_ARGS__); \
log4cplus::detail::macro_forced_log (_l, \
log4cplus::logLevel, _logEvent, \
LOG4CPLUS_MACRO_FILE (), __LINE__, \
LOG4CPLUS_MACRO_FUNCTION ()); \
} \
} while(0) \
LOG4CPLUS_RESTORE_DOWHILE_WARNING()
/**
* @def LOG4CPLUS_TRACE(logger, logEvent) This macro creates a
* TraceLogger to log a TRACE_LOG_LEVEL message to <code>logger</code>
* upon entry and exiting of a method.
* <code>logEvent</code> will be streamed into an <code>ostream</code>.
*/
#if !defined(LOG4CPLUS_DISABLE_TRACE)
#define LOG4CPLUS_TRACE_METHOD(logger, logEvent) \
log4cplus::TraceLogger _log4cplus_trace_logger(logger, logEvent, \
LOG4CPLUS_MACRO_FILE (), __LINE__, \
LOG4CPLUS_MACRO_FUNCTION ());
#define LOG4CPLUS_TRACE(logger, logEvent) \
LOG4CPLUS_MACRO_BODY (logger, logEvent, TRACE_LOG_LEVEL)
#define LOG4CPLUS_TRACE_STR(logger, logEvent) \
LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, TRACE_LOG_LEVEL)
#define LOG4CPLUS_TRACE_FMT(logger, ...) \
LOG4CPLUS_MACRO_FMT_BODY (logger, TRACE_LOG_LEVEL, __VA_ARGS__)
#else
#define LOG4CPLUS_TRACE_METHOD(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_TRACE(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_TRACE_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_TRACE_FMT(logger, logFmt, ...) LOG4CPLUS_DOWHILE_NOTHING()
#endif
/**
* @def LOG4CPLUS_DEBUG(logger, logEvent) This macro is used to log a
* DEBUG_LOG_LEVEL message to <code>logger</code>.
* <code>logEvent</code> will be streamed into an <code>ostream</code>.
*/
#if !defined(LOG4CPLUS_DISABLE_DEBUG)
#define LOG4CPLUS_DEBUG(logger, logEvent) \
LOG4CPLUS_MACRO_BODY (logger, logEvent, DEBUG_LOG_LEVEL)
#define LOG4CPLUS_DEBUG_STR(logger, logEvent) \
LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, DEBUG_LOG_LEVEL)
#define LOG4CPLUS_DEBUG_FMT(logger, ...) \
LOG4CPLUS_MACRO_FMT_BODY (logger, DEBUG_LOG_LEVEL, __VA_ARGS__)
#else
#define LOG4CPLUS_DEBUG(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_DEBUG_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_DEBUG_FMT(logger, ...) LOG4CPLUS_DOWHILE_NOTHING()
#endif
/**
* @def LOG4CPLUS_INFO(logger, logEvent) This macro is used to log a
* INFO_LOG_LEVEL message to <code>logger</code>.
* <code>logEvent</code> will be streamed into an <code>ostream</code>.
*/
#if !defined(LOG4CPLUS_DISABLE_INFO)
#define LOG4CPLUS_INFO(logger, logEvent) \
LOG4CPLUS_MACRO_BODY (logger, logEvent, INFO_LOG_LEVEL)
#define LOG4CPLUS_INFO_STR(logger, logEvent) \
LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, INFO_LOG_LEVEL)
#define LOG4CPLUS_INFO_FMT(logger, ...) \
LOG4CPLUS_MACRO_FMT_BODY (logger, INFO_LOG_LEVEL, __VA_ARGS__)
#else
#define LOG4CPLUS_INFO(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_INFO_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_INFO_FMT(logger, ...) LOG4CPLUS_DOWHILE_NOTHING()
#endif
/**
* @def LOG4CPLUS_WARN(logger, logEvent) This macro is used to log a
* WARN_LOG_LEVEL message to <code>logger</code>.
* <code>logEvent</code> will be streamed into an <code>ostream</code>.
*/
#if !defined(LOG4CPLUS_DISABLE_WARN)
#define LOG4CPLUS_WARN(logger, logEvent) \
LOG4CPLUS_MACRO_BODY (logger, logEvent, WARN_LOG_LEVEL)
#define LOG4CPLUS_WARN_STR(logger, logEvent) \
LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, WARN_LOG_LEVEL)
#define LOG4CPLUS_WARN_FMT(logger, ...) \
LOG4CPLUS_MACRO_FMT_BODY (logger, WARN_LOG_LEVEL, __VA_ARGS__)
#else
#define LOG4CPLUS_WARN(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_WARN_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_WARN_FMT(logger, ...) LOG4CPLUS_DOWHILE_NOTHING()
#endif
/**
* @def LOG4CPLUS_ERROR(logger, logEvent) This macro is used to log a
* ERROR_LOG_LEVEL message to <code>logger</code>.
* <code>logEvent</code> will be streamed into an <code>ostream</code>.
*/
#if !defined(LOG4CPLUS_DISABLE_ERROR)
#define LOG4CPLUS_ERROR(logger, logEvent) \
LOG4CPLUS_MACRO_BODY (logger, logEvent, ERROR_LOG_LEVEL)
#define LOG4CPLUS_ERROR_STR(logger, logEvent) \
LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, ERROR_LOG_LEVEL)
#define LOG4CPLUS_ERROR_FMT(logger, ...) \
LOG4CPLUS_MACRO_FMT_BODY (logger, ERROR_LOG_LEVEL, __VA_ARGS__)
#else
#define LOG4CPLUS_ERROR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_ERROR_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_ERROR_FMT(logger, ...) LOG4CPLUS_DOWHILE_NOTHING()
#endif
/**
* @def LOG4CPLUS_FATAL(logger, logEvent) This macro is used to log a
* FATAL_LOG_LEVEL message to <code>logger</code>.
* <code>logEvent</code> will be streamed into an <code>ostream</code>.
*/
#if !defined(LOG4CPLUS_DISABLE_FATAL)
#define LOG4CPLUS_FATAL(logger, logEvent) \
LOG4CPLUS_MACRO_BODY (logger, logEvent, FATAL_LOG_LEVEL)
#define LOG4CPLUS_FATAL_STR(logger, logEvent) \
LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, FATAL_LOG_LEVEL)
#define LOG4CPLUS_FATAL_FMT(logger, ...) \
LOG4CPLUS_MACRO_FMT_BODY (logger, FATAL_LOG_LEVEL, __VA_ARGS__)
#else
#define LOG4CPLUS_FATAL(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_FATAL_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING()
#define LOG4CPLUS_FATAL_FMT(logger, ...) LOG4CPLUS_DOWHILE_NOTHING()
#endif
//! Helper macro for LOG4CPLUS_ASSERT() macro.
#define LOG4CPLUS_ASSERT_STRINGIFY(X) #X
//! If the `condition` evaluates false, this macro logs it using FATAL
//! log level, including the `condition`'s source text.
#define LOG4CPLUS_ASSERT(logger, condition) \
LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
do { \
if (LOG4CPLUS_UNLIKELY(! (condition))) \
LOG4CPLUS_FATAL_STR ((logger), \
LOG4CPLUS_TEXT ("failed condition: ") \
LOG4CPLUS_TEXT (LOG4CPLUS_ASSERT_STRINGIFY (condition))); \
} while (0) \
LOG4CPLUS_RESTORE_DOWHILE_WARNING()
//! If the `condition` evaluates false, this macro logs a message
//! formatted from `printf` format string passed in 3rd and remaining
//! arguments.
#define LOG4CPLUS_ASSERT_FMT(logger, condition, ...) \
LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
do { \
if (! (condition)) [[unlikely]] { \
LOG4CPLUS_FATAL_FMT ((logger), __VA_ARGS__); \
} \
} while (false) \
LOG4CPLUS_RESTORE_DOWHILE_WARNING()
//! If the `condition` evaluates false, this macro logs a message
//! formatted from `std::format` format string passed in 3rd and remaining
//! arguments.
#define LOG4CPLUS_ASSERT_FORMAT(logger, condition, ...) \
LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \
do { \
if (! (condition)) [[unlikely]] { \
LOG4CPLUS_FATAL_FORMAT ((logger), __VA_ARGS__); \
} \
} while (false) \
LOG4CPLUS_RESTORE_DOWHILE_WARNING()
#endif /* LOG4CPLUS_LOGGING_MACROS_HEADER_ */

View File

@@ -0,0 +1,200 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: loglevel.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file
* This header defines the LogLevel type.
*/
#ifndef LOG4CPLUS_LOGLEVEL_HEADER_
#define LOG4CPLUS_LOGLEVEL_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <vector>
#include <log4cplus/tstring.h>
namespace log4cplus {
/**
* \typedef int LogLevel
* Defines the minimum set of priorities recognized by the system,
* that is {@link #FATAL_LOG_LEVEL}, {@link #ERROR_LOG_LEVEL}, {@link
* #WARN_LOG_LEVEL}, {@link #INFO_LOG_LEVEL}, {@link #DEBUG_LOG_LEVEL},
* and {@link #TRACE_LOG_LEVEL}.
*/
typedef int LogLevel;
/** \var const LogLevel OFF_LOG_LEVEL
* The <code>OFF_LOG_LEVEL</code> LogLevel is used during configuration to
* turn off logging. */
const LogLevel OFF_LOG_LEVEL = 60000;
/** \var const LogLevel FATAL_LOG_LEVEL
* The <code>FATAL_LOG_LEVEL</code> LogLevel designates very severe error
* events that will presumably lead the application to abort. */
const LogLevel FATAL_LOG_LEVEL = 50000;
/** \var const LogLevel ERROR_LOG_LEVEL
* The <code>ERROR_LOG_LEVEL</code> LogLevel designates error events that
* might still allow the application to continue running. */
const LogLevel ERROR_LOG_LEVEL = 40000;
/** \var const LogLevel WARN_LOG_LEVEL
* The <code>WARN_LOG_LEVEL</code> LogLevel designates potentially harmful
* situations. */
const LogLevel WARN_LOG_LEVEL = 30000;
/** \var const LogLevel INFO_LOG_LEVEL
* The <code>INFO_LOG_LEVEL</code> LogLevel designates informational
* messages that highlight the progress of the application at
* coarse-grained level. */
const LogLevel INFO_LOG_LEVEL = 20000;
/** \var const LogLevel DEBUG_LOG_LEVEL
* The <code>DEBUG_LOG_LEVEL</code> LogLevel designates fine-grained
* informational events that are most useful to debug an application. */
const LogLevel DEBUG_LOG_LEVEL = 10000;
/** \var const LogLevel TRACE_LOG_LEVEL
* The <code>TRACE_LOG_LEVEL</code> LogLevel is used to "trace" entry
* and exiting of methods. */
const LogLevel TRACE_LOG_LEVEL = 0;
/** \var const LogLevel ALL_LOG_LEVEL
* The <code>ALL_LOG_LEVEL</code> LogLevel is used during configuration to
* turn on all logging. */
const LogLevel ALL_LOG_LEVEL = TRACE_LOG_LEVEL;
/** \var const LogLevel NOT_SET_LOG_LEVEL
* The <code>NOT_SET_LOG_LEVEL</code> LogLevel is used to indicated that
* no particular LogLevel is desired and that the default should be used.
*/
const LogLevel NOT_SET_LOG_LEVEL = -1;
/**
* This method type defined the signature of methods that convert LogLevels
* into strings.
*
* <b>Note:</b> Must return an empty <code>tstring</code> for unrecognized values.
*/
typedef log4cplus::tstring const & (*LogLevelToStringMethod)(LogLevel);
/**
* This method type defined the signature of methods that convert strings
* into LogLevels.
*
* <b>Note:</b> Must return <code>NOT_SET_LOG_LEVEL</code> for unrecognized values.
*/
typedef LogLevel (*StringToLogLevelMethod)(const log4cplus::tstring&);
/**
* This class is used to "manage" LogLevel definitions. This class is also
* how "derived" LogLevels are created. Here are the steps to creating a
* "derived" LogLevel:
* <ol>
* <li>Create a LogLevel constant (greater than 0)</li>
* <li>Define a string to represent that constant</li>
* <li>Implement a LogLevelToStringMethod method.</li>
* <li>Implement a StringToLogLevelMethod method.</li>
* <li>create a "static initializer" that registers those 2 methods
* with the LogLevelManager singleton.</li>
* </ol>
*/
class LOG4CPLUS_EXPORT LogLevelManager {
public:
LogLevelManager();
~LogLevelManager();
/**
* This method is called by all Layout classes to convert a LogLevel
* into a string.
*
* Note: It traverses the list of <code>LogLevelToStringMethod</code>
* to do this, so all "derived" LogLevels are recognized as well.
*/
log4cplus::tstring const & toString(LogLevel ll) const;
/**
* This method is called by all classes internally to log4cplus to
* convert a string into a LogLevel.
*
* Note: It traverses the list of <code>StringToLogLevelMethod</code>
* to do this, so all "derived" LogLevels are recognized as well.
*/
LogLevel fromString(const log4cplus::tstring& arg) const;
/**
* When creating a "derived" LogLevel, a <code>LogLevelToStringMethod</code>
* should be defined and registered with the LogLevelManager by calling
* this method.
*
* @see pushFromStringMethod
*/
void pushToStringMethod(LogLevelToStringMethod newToString);
/**
* When creating a "derived" LogLevel, a <code>StringToLogLevelMethod</code>
* should be defined and registered with the LogLevelManager by calling
* this method.
*
* @see pushToStringMethod
*/
void pushFromStringMethod(StringToLogLevelMethod newFromString);
private:
// Data
struct LogLevelToStringMethodRec
{
LogLevelToStringMethodRec ();
LogLevelToStringMethodRec (LogLevelToStringMethod);
LogLevelToStringMethod func;
};
typedef std::vector<LogLevelToStringMethodRec> LogLevelToStringMethodList;
LogLevelToStringMethodList toStringMethods;
typedef std::vector<StringToLogLevelMethod> StringToLogLevelMethodList;
StringToLogLevelMethodList fromStringMethods;
// Disable Copy
LogLevelManager(const LogLevelManager&);
LogLevelManager& operator=(const LogLevelManager&);
};
/**
* Returns the singleton LogLevelManager.
*/
LOG4CPLUS_EXPORT LogLevelManager& getLogLevelManager();
}
#endif // LOG4CPLUS_LOGLEVEL_HEADER_

View File

@@ -0,0 +1,77 @@
// -*- C++ -*-
// Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef LOG4CPLUS_MDC_H_HEADER
#define LOG4CPLUS_MDC_H_HEADER
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <map>
namespace log4cplus
{
typedef std::map<tstring, tstring> MappedDiagnosticContextMap;
class LOG4CPLUS_EXPORT MDC
{
public:
/**
* Clear any nested diagnostic information if any. This method is
* useful in cases where the same thread can be potentially used
* over and over in different unrelated contexts.
*/
void clear();
void put (tstring const & key, tstring const & value);
bool get (tstring * value, tstring const & key) const;
void remove (tstring const & key);
MappedDiagnosticContextMap const & getContext () const;
// Public ctor and dtor but only to be used by internal::DefaultContext.
MDC ();
virtual ~MDC ();
private:
LOG4CPLUS_PRIVATE static MappedDiagnosticContextMap * getPtr ();
};
LOG4CPLUS_EXPORT MDC & getMDC ();
} // namespace log4cplus
#endif // LOG4CPLUS_MDC_H_HEADER

View File

@@ -0,0 +1,112 @@
// -*- C++ -*-
// Module: Log4cplus
// File: msttsappender.h
// Created: 10/2012
// Author: Vaclav Zeman
//
//
// Copyright (C) 2012-2017, Vaclav Zeman. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modifica-
// tion, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
/** @file */
#ifndef LOG4CPLUS_MSTTSAPPENDER_H
#define LOG4CPLUS_MSTTSAPPENDER_H
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/appender.h>
#if defined (_WIN32)
#if defined (log4cplusqt4debugappender_EXPORTS) \
|| defined (log4cplusqt4debugappenderU_EXPORTS) \
|| (defined (DLL_EXPORT) && defined (INSIDE_LOG4CPLUS_MSTTSAPPENDER))
#undef LOG4CPLUS_MSTTSAPPENDER_BUILD_DLL
#define LOG4CPLUS_MSTTSAPPENDER_BUILD_DLL
#endif
#if defined (LOG4CPLUS_MSTTSAPPENDER_BUILD_DLL)
#if defined (INSIDE_LOG4CPLUS_MSTTSAPPENDER)
#define LOG4CPLUS_MSTTSAPPENDER_EXPORT __declspec(dllexport)
#else
#define LOG4CPLUS_MSTTSAPPENDER_EXPORT __declspec(dllimport)
#endif
#else
#define LOG4CPLUS_MSTTSAPPENDER_EXPORT
#endif
#else
#if defined (INSIDE_LOG4CPLUS_MSTTSAPPENDER)
#define LOG4CPLUS_MSTTSAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_EXPORT
#else
#define LOG4CPLUS_MSTTSAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_IMPORT
#endif // defined (INSIDE_LOG4CPLUS_MSTTSAPPENDER)
#endif // !_WIN32
namespace log4cplus
{
class LOG4CPLUS_MSTTSAPPENDER_EXPORT MSTTSAppender
: public Appender
{
public:
MSTTSAppender ();
explicit MSTTSAppender (helpers::Properties const &);
virtual ~MSTTSAppender ();
virtual void close ();
static void registerAppender ();
protected:
virtual void append (spi::InternalLoggingEvent const &);
struct Data;
Data * data;
private:
LOG4CPLUS_PRIVATE void init (long const * rate = 0,
unsigned long const * volume = 0, bool speak_punc = false,
bool async = false);
MSTTSAppender (MSTTSAppender const &);
MSTTSAppender & operator = (MSTTSAppender const &);
};
typedef helpers::SharedObjectPtr<MSTTSAppender> MSTTSAppenderPtr;
} // namespace log4cplus
#endif // LOG4CPLUS_MSTTSAPPENDER_H

View File

@@ -0,0 +1,329 @@
// -*- C++ -*-
// Module: Log4CPLUS
// File: ndc.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @file
* This header defined the NDC class.
*/
#ifndef _LO4CPLUS_NDC_HEADER_
#define _LO4CPLUS_NDC_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/tstring.h>
#include <map>
#include <deque>
namespace log4cplus {
// Forward declarations
struct DiagnosticContext;
typedef std::deque<DiagnosticContext> DiagnosticContextStack;
/**
* The NDC class implements <i>nested diagnostic contexts</i> as
* defined by Neil Harrison in the article "Patterns for Logging
* Diagnostic Messages" part of the book <i>"Pattern Languages of
* Program Design 3"</i> edited by Martin et al.
*
* A Nested Diagnostic Context, or NDC in short, is an instrument
* to distinguish interleaved log output from different sources. Log
* output is typically interleaved when a server handles multiple
* clients near-simultaneously.
*
* Interleaved log output can still be meaningful if each log entry
* from different contexts had a distinctive stamp. This is where NDCs
* come into play.
*
* <em><b>Note that NDCs are managed on a per thread
* basis</b></em>. NDC operations such as {@link #push}, {@link
* #pop}, {@link #clear}, {@link #getDepth} and {@link #setMaxDepth}
* affect the NDC of the <em>current</em> thread only. NDCs of other
* threads remain unaffected.
*
* For example, a server can build a per client request NDC
* consisting the clients host name and other information contained in
* the the request. <em>Cookies</em> are another source of distinctive
* information. To build an NDC one uses the {@link #push}
* operation. Simply put,
*
* - Contexts can be nested.
* - When entering a context, call `push()`. As a side effect, if
* there is no nested diagnostic context for the current thread,
* this method will create it.
* - When leaving a context, call `pop()`.
* - When exiting a thread make sure to call `remove()`.
*
* There is no penalty for forgetting to match each push()
* operation with a corresponding pop(), except the obvious
* mismatch between the real application context and the context
* set in the NDC. Use of the NDCContextCreator class can
* automate this process and make your code exception-safe.
*
* If configured to do so, {@link log4cplus::PatternLayout} and
* {@link log4cplus::TTCCLayout} instances automatically retrieve
* the nested diagnostic context for the current thread without
* any user intervention. Hence, even if a server is serving
* multiple clients simultaneously, the logs emanating from the
* same code (belonging to the same logger) can still be
* distinguished because each client request will have a different
* NDC tag.
*
* Heavy duty systems should call the {@link #remove} method when
* leaving the run method of a thread. This ensures that the memory
* used by the thread can be freed.
*
* A thread may inherit the nested diagnostic context of another
* (possibly parent) thread using the {@link #inherit inherit}
* method. A thread may obtain a copy of its NDC with the {@link
* #cloneStack cloneStack} method and pass the reference to any other
* thread, in particular to a child.
*/
class LOG4CPLUS_EXPORT NDC
{
public:
/**
* Clear any nested diagnostic information if any. This method is
* useful in cases where the same thread can be potentially used
* over and over in different unrelated contexts.
*
* This method is equivalent to calling the {@link #setMaxDepth}
* method with a zero <code>maxDepth</code> argument.
*/
void clear();
/**
* Clone the diagnostic context for the current thread.
*
* Internally a diagnostic context is represented as a stack. A
* given thread can supply the stack (i.e. diagnostic context) to a
* child thread so that the child can inherit the parent thread's
* diagnostic context.
*
* The child thread uses the {@link #inherit inherit} method to
* inherit the parent's diagnostic context.
*
* @return Stack A clone of the current thread's diagnostic context.
*/
DiagnosticContextStack cloneStack() const;
/**
* Inherit the diagnostic context of another thread.
*
* The parent thread can obtain a reference to its diagnostic
* context using the {@link #cloneStack} method. It should
* communicate this information to its child so that it may inherit
* the parent's diagnostic context.
*
* The parent's diagnostic context is cloned before being
* inherited. In other words, once inherited, the two diagnostic
* contexts can be managed independently.
*
* @param stack The diagnostic context of the parent thread.
*/
void inherit(const DiagnosticContextStack& stack);
/**
* Used when printing the diagnostic context.
*/
log4cplus::tstring const & get() const;
/**
* Get the current nesting depth of this diagnostic context.
*
* @see #setMaxDepth
*/
std::size_t getDepth() const;
/**
* Clients should call this method before leaving a diagnostic
* context.
*
* The returned value is the value that was pushed last. If no
* context is available, then the empty string is returned. If
* each call to `push()` is paired with a call to `pop()`
* (even in presence of thrown exceptions), the last `pop()`
* call frees the memory used by NDC for this
* thread. Otherwise, `remove()` must be called at the end of
* the thread to free the memory used by NDC for the thread.
*
* @return String The innermost diagnostic context.
*
* @see NDCContextCreator, remove(), push()
*/
log4cplus::tstring pop();
/**
* Same as pop() but without the return value.
*/
void pop_void ();
/**
* Looks at the last diagnostic context at the top of this NDC
* without removing it.
*
* The returned value is the value that was pushed last. If no
* context is available, then the empty string is returned.
*
* @return String The innermost diagnostic context.
*/
log4cplus::tstring const & peek() const;
/**
* Push new diagnostic context information for the current thread.
*
* The contents of the <code>message</code> parameter is
* determined solely by the client. Each call to push() should
* be paired with a call to pop().
*
* @param message The new diagnostic context information.
*
* @see NDCContextCreator, pop(), remove()
*/
void push(const log4cplus::tstring& message);
void push(tchar const * message);
/**
* Remove the diagnostic context for this thread.
*
* Each thread that created a diagnostic context by calling
* push() should call this method before exiting. Otherwise,
* the memory used by the thread cannot be reclaimed. It is
* possible to omit this call if and only if each push() call
* is always paired with a pop() call (even in presence of
* thrown exceptions). Then the memory used by NDC will be
* returned by the last pop() call and a call to remove() will
* be no-op.
*/
void remove();
/**
* Set maximum depth of this diagnostic context. If the
* current depth is smaller or equal to `maxDepth`, then no
* action is taken.
*
* This method is a convenient alternative to multiple `pop()`
* calls. Moreover, it is often the case that at the end of
* complex call sequences, the depth of the NDC is
* unpredictable. The `setMaxDepth()` method circumvents this
* problem.
*
* For example, the combination
*
* ~~~~{.c}
* void foo() {
* NDC & ndc = getNDC();
* std::size_t depth = ndc.getDepth();
* //... complex sequence of calls
* ndc.setMaxDepth(depth);
* }
* ~~~~
*
* ensures that between the entry and exit of foo the depth of the
* diagnostic stack is conserved.
*
* \note Use of the NDCContextCreator class will solve this
* particular problem.
*
* \see NDC::getDepth()
*/
void setMaxDepth(std::size_t maxDepth);
// Public ctor but only to be used by internal::DefaultContext.
NDC();
// Dtor
virtual ~NDC();
private:
// Methods
LOG4CPLUS_PRIVATE static DiagnosticContextStack* getPtr();
template <typename StringType>
LOG4CPLUS_PRIVATE
void push_worker (StringType const &);
// Disallow construction (and copying) except by getNDC()
NDC(const NDC&);
NDC& operator=(const NDC&);
};
/**
* Return a reference to the singleton object.
*/
LOG4CPLUS_EXPORT NDC& getNDC();
/**
* This is the internal object that is stored on the NDC stack.
*/
struct LOG4CPLUS_EXPORT DiagnosticContext
{
// Ctors
DiagnosticContext(const log4cplus::tstring& message,
DiagnosticContext const * parent);
DiagnosticContext(tchar const * message,
DiagnosticContext const * parent);
DiagnosticContext(const log4cplus::tstring& message);
DiagnosticContext(tchar const * message);
DiagnosticContext(DiagnosticContext const &);
DiagnosticContext & operator = (DiagnosticContext const &);
DiagnosticContext(DiagnosticContext &&);
DiagnosticContext & operator = (DiagnosticContext &&);
void swap (DiagnosticContext &);
// Data
log4cplus::tstring message; /*!< The message at this context level. */
log4cplus::tstring fullMessage; /*!< The entire message stack. */
};
/**
* This class ensures that a `NDC::push()` call is always matched
* with a `NDC::pop()` call even in the face of exceptions.
*/
class LOG4CPLUS_EXPORT NDCContextCreator {
public:
/** Pushes <code>msg</code> onto the NDC stack. */
explicit NDCContextCreator(const log4cplus::tstring& msg);
explicit NDCContextCreator(tchar const * msg);
NDCContextCreator() = delete;
NDCContextCreator(NDCContextCreator const &) = delete;
NDCContextCreator(NDCContextCreator &&) = delete;
NDCContextCreator & operator= (NDCContextCreator const &) = delete;
NDCContextCreator & operator= (NDCContextCreator &&) = delete;
/** Pops the NDC stack. */
~NDCContextCreator();
};
} // end namespace log4cplus
#endif // _LO4CPLUS_NDC_HEADER_

Some files were not shown because too many files have changed in this diff Show More