commit 08b851951c27f1a1454b0ff6843731b980682441
Author: zw <3466561528@qq.com>
Date: Fri Jun 13 11:29:59 2025 +0800
初始化仓库
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4ce6fdd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,340 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- Backup*.rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
\ No newline at end of file
diff --git a/LFtid1056.sln b/LFtid1056.sln
new file mode 100644
index 0000000..5a537af
--- /dev/null
+++ b/LFtid1056.sln
@@ -0,0 +1,51 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30225.117
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Linux_Hello", "Linux_Hello\Linux_Hello.vcxproj", "{633A4A3D-0075-4DA6-8DE8-0E906288D07B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|ARM64 = Debug|ARM64
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|ARM = Release|ARM
+ Release|ARM64 = Release|ARM64
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|ARM.ActiveCfg = Debug|ARM
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|ARM.Build.0 = Debug|ARM
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|ARM.Deploy.0 = Debug|ARM
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|ARM64.Build.0 = Debug|ARM64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|ARM64.Deploy.0 = Debug|ARM64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|x64.ActiveCfg = Debug|x64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|x64.Build.0 = Debug|x64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|x64.Deploy.0 = Debug|x64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|x86.ActiveCfg = Debug|x86
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|x86.Build.0 = Debug|x86
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Debug|x86.Deploy.0 = Debug|x86
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|ARM.ActiveCfg = Release|ARM
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|ARM.Build.0 = Release|ARM
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|ARM.Deploy.0 = Release|ARM
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|ARM64.ActiveCfg = Release|ARM64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|ARM64.Build.0 = Release|ARM64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|ARM64.Deploy.0 = Release|ARM64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|x64.ActiveCfg = Release|x64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|x64.Build.0 = Release|x64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|x64.Deploy.0 = Release|x64
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|x86.ActiveCfg = Release|x86
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|x86.Build.0 = Release|x86
+ {633A4A3D-0075-4DA6-8DE8-0E906288D07B}.Release|x86.Deploy.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {8209AFC2-ED8E-4E51-BBEC-816994D8F703}
+ EndGlobalSection
+EndGlobal
diff --git a/Linux_Hello/Linux_Hello.vcxproj b/Linux_Hello/Linux_Hello.vcxproj
new file mode 100644
index 0000000..df45ba4
--- /dev/null
+++ b/Linux_Hello/Linux_Hello.vcxproj
@@ -0,0 +1,98 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Release
+ ARM
+
+
+ Debug
+ ARM64
+
+
+ Release
+ ARM64
+
+
+ Debug
+ x86
+
+
+ Release
+ x86
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {633a4a3d-0075-4da6-8de8-0e906288d07b}
+ Linux
+ Linux_Hello
+ 15.0
+ Linux
+ 1.0
+ Generic
+ {D51BCBC9-82E9-4017-911E-C93873C4EA2B}
+ LFtid1056
+
+
+
+ true
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %(AdditionalIncludeDirectories)
+
+
+ %(AdditionalLibraryDirectories)
+ uv;pthread;%(LibraryDependencies)
+
+
+
+
+
\ No newline at end of file
diff --git a/Linux_Hello/Linux_Hello.vcxproj.filters b/Linux_Hello/Linux_Hello.vcxproj.filters
new file mode 100644
index 0000000..19017a9
--- /dev/null
+++ b/Linux_Hello/Linux_Hello.vcxproj.filters
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Linux_Hello/PQSMsg.cpp b/Linux_Hello/PQSMsg.cpp
new file mode 100644
index 0000000..33315e1
--- /dev/null
+++ b/Linux_Hello/PQSMsg.cpp
@@ -0,0 +1,136 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "client2.h"
+#include "PQSMsg.h"
+
+// ɴЭͷĶƱ
+std::vector generate_binary_message(
+ uint16_t msg_type,
+ const std::vector& payload)
+{
+ std::vector packet;
+
+ // Эͷ (4ֽ)
+ packet.push_back(0xAA); // ʼ־
+ packet.push_back((msg_type >> 8) & 0xFF); // Ϣֽ
+ packet.push_back(msg_type & 0xFF); // Ϣ͵ֽ
+ uint8_t length = payload.size();
+ packet.push_back(length); // غɳ
+
+ // غ
+ packet.insert(packet.end(), payload.begin(), payload.end());
+
+ // Уλ (1ֽУ)
+ uint8_t checksum = 0;
+ for (auto byte : packet) {
+ checksum ^= byte;
+ }
+ packet.push_back(checksum);
+
+ return packet;
+}
+
+// ʹʾ
+void send_message(client_context_t* ctx) {
+ // غ
+ std::vector payload = {
+ 0x01, 0x02, 0x03, 0x04 // ʾ
+ };
+
+ // (Ϣ0x1001)
+ auto binary_data = generate_binary_message(0x1001, payload);
+
+ // תΪʽ
+ unsigned char* binary_array = binary_data.data();
+ size_t data_size = binary_data.size();
+
+ // ˴ɵ÷ͺ
+ send_binary_data(ctx, binary_array, data_size);
+}
+
+// MACַ䵽
+void GetMAC(const std::string& strMAC, std::vector& packet, size_t startIndex) {
+ // ƳпոͶ̺
+ std::string cleanedMAC = strMAC;
+ cleanedMAC.erase(std::remove(cleanedMAC.begin(), cleanedMAC.end(), ' '), cleanedMAC.end());
+ cleanedMAC.erase(std::remove(cleanedMAC.begin(), cleanedMAC.end(), '-'), cleanedMAC.end());
+
+ // ֤
+ if (cleanedMAC.length() != 12) {
+ throw std::invalid_argument("MACַȱΪ12ַ");
+ }
+
+ try {
+ // ÿַΪʮֽ
+ for (int i = 0; i < 6; i++) {
+ // ȡַӴ
+ std::string byteStr = cleanedMAC.substr(i * 2, 2);
+
+ // תΪʮֽ
+ unsigned char byte = static_cast(
+ std::stoi(byteStr, nullptr, 16)
+ );
+
+ // 䵽ָλ
+ if (startIndex + i < packet.size()) {
+ packet[startIndex + i] = byte;
+ }
+ }
+
+ // ʣಿ0 (ܹҪ64ֽڣMACֻռ6ֽ)
+ for (int i = 6; i < 64; i++) {
+ if (startIndex + i < packet.size()) {
+ packet[startIndex + i] = 0;
+ }
+ }
+ }
+ catch (const std::exception& e) {
+ throw std::invalid_argument("ЧMACַ: " + std::string(e.what()));
+ }
+}
+
+// װƷ¼
+std::vector generate_frontlogin_message(const std::string& strMac)
+{
+ const size_t packetSize = 150; // ܳ150 +֡140
+ std::vector packet(packetSize, 0); // ʼΪȫ0
+
+ // Эͷ
+ packet[0] = 0xEB; // ʼ־1
+ packet[1] = 0x90;
+ packet[2] = 0xEB; // ʼ־2
+ packet[3] = 0x90;
+ packet[4] = 0x8C; // 峤 (140 = 0x008C)
+ packet[5] = 0x00;
+ // [6-7] (Ϊ0)
+ // [8-9] (Ϊ0)
+ // [10-11] ֡ (Ϊ0)
+ // 1
+ packet[12] = 'F';
+ packet[13] = 'T';
+ packet[14] = 'I';
+ packet[15] = 'D';
+ // [16-19] 2 (Ϊ0)
+
+ // MACַ (λ20ʼ64ֽ)
+ GetMAC(strMac, packet, 20);
+
+ // У (ƫ8137)
+ unsigned char checksum = 0;
+ for (size_t i = 8; i < packetSize - 2; i++) {
+ checksum += packet[i];
+ }
+ packet[packetSize - 2] = checksum;
+
+ //
+ packet[packetSize - 1] = 0x16;
+
+ return packet;
+}
+
diff --git a/Linux_Hello/PQSMsg.h b/Linux_Hello/PQSMsg.h
new file mode 100644
index 0000000..4fe87fd
--- /dev/null
+++ b/Linux_Hello/PQSMsg.h
@@ -0,0 +1,16 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+// ɴЭͷĶƱ
+std::vector generate_binary_message(
+ uint16_t msg_type,
+ const std::vector & payload);
+
+// װƷ¼
+std::vector generate_frontlogin_message(const std::string& strMac);
diff --git a/Linux_Hello/client.cpp b/Linux_Hello/client.cpp
new file mode 100644
index 0000000..35e75df
--- /dev/null
+++ b/Linux_Hello/client.cpp
@@ -0,0 +1,127 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define container_of(ptr, type, member) \
+ ((type *)((char *)(ptr) - offsetof(type, member)))
+
+const int MAX_CONNECTIONS = 300;
+const int MAX_MESSAGE_SIZE = 1024 * 1024; // 1MB
+
+struct Client {
+ uv_tcp_t handle;
+ uv_connect_t connect_req;
+ uv_write_t write_req;
+ std::string server_ip;
+ int server_port;
+ bool connected;
+ std::mutex mutex;
+};
+
+std::vector clients;
+uv_loop_t* loop;
+
+void on_write(uv_write_t* req, int status) {
+ Client* client = container_of(req, Client, write_req);
+ if (status < 0) {
+ std::cerr << "Write error: " << uv_strerror(status) << std::endl;
+ uv_close((uv_handle_t*)&client->handle, nullptr);
+ }
+}
+
+void on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) {
+ Client* client = container_of(stream, Client, handle);
+ if (nread < 0) {
+ std::cerr << "Read error: " << uv_strerror(nread) << std::endl;
+ uv_close((uv_handle_t*)&client->handle, nullptr);
+ free(buf->base);
+ return;
+ }
+
+ if (nread > 0) {
+ std::cout << "Received " << nread << " bytes from server" << std::endl;
+ }
+
+ free(buf->base);
+}
+
+void on_connect(uv_connect_t* req, int status) {
+ Client* client = container_of(req, Client, connect_req);
+ if (status < 0) {
+ std::cerr << "Connect error: " << uv_strerror(status) << std::endl;
+ uv_close((uv_handle_t*)&client->handle, nullptr);
+ return;
+ }
+
+ client->connected = true;
+ std::cout << "Connected to server: " << client->server_ip << ":" << client->server_port << std::endl;
+
+ // Get the client's IP and port
+ struct sockaddr_in addr;
+ int addr_len = sizeof(addr);
+ uv_tcp_getpeername(&client->handle, (struct sockaddr*)&addr, &addr_len);
+
+ char client_ip[INET_ADDRSTRLEN];
+ uv_ip4_name((const struct sockaddr_in*)&addr, client_ip, INET_ADDRSTRLEN);
+ int client_port = ntohs(addr.sin_port);
+
+ // Prepare message with client's IP and port
+ std::stringstream ss;
+ ss << "Client IP: " << client_ip << ", Port: " << client_port;
+ std::string message = ss.str();
+
+ // Send the message
+ uv_buf_t buf_list = uv_buf_init(const_cast(message.c_str()), message.size());
+ uv_write(&client->write_req, (uv_stream_t*)&client->handle, &buf_list, 1, on_write);
+
+ uv_read_start((uv_stream_t*)&client->handle, [](uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
+ buf->base = (char*)malloc(suggested_size);
+ buf->len = suggested_size;
+ }, on_read);
+}
+
+void start_client(Client* client) {
+ struct sockaddr_in addr;
+ uv_ip4_addr(client->server_ip.c_str(), client->server_port, &addr);
+
+ uv_tcp_init(loop, &client->handle);
+ uv_tcp_connect(&client->connect_req, &client->handle, (const struct sockaddr*)&addr, on_connect);
+}
+
+void run_client_thread(Client* client) {
+ start_client(client);
+ uv_run(loop, UV_RUN_DEFAULT);
+}
+
+int main2() {
+ loop = uv_default_loop();
+
+ // Create and start 300 clients
+ for (int i = 0; i < MAX_CONNECTIONS; ++i) {
+ Client* client = new Client;
+ client->server_ip = "172.22.128.1"; // Replace with your server IP
+ client->server_port = 8098; // Replace with your server port
+ client->connected = false;
+
+ std::thread client_thread(run_client_thread, client);
+ client_thread.detach();
+
+ clients.push_back(client);
+ }
+
+ // Handle shutdown or other logic here
+ while (true) {
+ // You can add logic to handle client connections, messages, etc.
+ // For example, sending data periodically or handling disconnects.
+ uv_run(loop, UV_RUN_ONCE);
+ }
+
+ return 0;
+}
\ No newline at end of file
diff --git a/Linux_Hello/client2.cpp b/Linux_Hello/client2.cpp
new file mode 100644
index 0000000..87b660a
--- /dev/null
+++ b/Linux_Hello/client2.cpp
@@ -0,0 +1,313 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "PQSMsg.h"
+#include "client2.h"
+
+ // 配置参数
+#define INITIAL_DATA_SIZE 128 // 初始数据0.1KB
+#define CONNECTIONS 2 // 并发连接数 设备连接数
+#define SERVER_IP "101.132.39.45" // 目标服务器IP 阿里云服务器 "101.132.39.45""172.27.208.1"
+#define SERVER_PORT 1056 // 目标服务器端口
+#define BASE_RECONNECT_DELAY 5000 // 基础重连延迟(ms)
+#define MAX_RECONNECT_DELAY 60000 // 最大重连延迟(ms)
+#define MAX_RECONNECT_ATTEMPTS 10 // 最大重连次数
+
+/* 缓冲区分配回调 */
+void alloc_buffer(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
+ void* buffer = malloc(suggested_size);
+ if (!buffer) {
+ fprintf(stderr, "Memory allocation failed\n");
+ *buf = uv_buf_init(NULL, 0);
+ return;
+ }
+ *buf = uv_buf_init((char*)buffer, suggested_size);
+}
+
+/* 数据读取回调 */
+void on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) {
+ client_context_t* ctx = (client_context_t*)stream->data;
+
+ if (nread < 0) {
+ if (nread != UV_EOF) {
+ fprintf(stdout, "[Client %d] RECV ERROR: %s\n",
+ ctx->index, uv_strerror(nread));
+ }
+ else {
+ fprintf(stdout, "[Client %d] Connection closed by server\n", ctx->index);
+ }
+ uv_close((uv_handle_t*)stream, on_close);
+ free(buf->base);
+ }
+ else if (nread > 0) {
+ fprintf(stdout, "[Client %d] RECV %zd bytes data\n", ctx->index, nread);
+ //数据传入客户端缓冲区并尝试取出合法报文格式的数据
+
+ free(buf->base);
+ }
+}
+
+/* 数据写入回调 */
+void on_write(uv_write_t* req, int status) {
+ client_context_t* ctx = (client_context_t*)req->handle->data;
+
+ if (status < 0) {
+ fprintf(stdout, "[Client %d] SEND ERROR: %s\n",
+ ctx->index, uv_strerror(status));
+ }
+ else {
+ fprintf(stdout, "[Client %d] SEND bytes success\n",
+ ctx->index);
+ }
+ free(req->data);
+ free(req);
+}
+
+/* 定时组装二进制报文并发送 */
+void on_timer(uv_timer_t* handle) {
+ client_context_t* ctx = (client_context_t*)handle->data;
+
+ if (ctx->state != STATE_CONNECTED) {
+ fprintf(stdout, "[Client %d] Skip sending: Not connected\n", ctx->index);
+ return;
+ }
+
+ fprintf(stdout, "[Client %d] Preparing periodic data...\n", ctx->index);
+
+ // 生成完整报文 装置云服务登录报文
+ auto binary_data = generate_frontlogin_message("00-B7-8D-A8-00-D6");
+
+ // 转换为数组形式
+ unsigned char* binary_array = binary_data.data();
+ size_t data_size = binary_data.size();
+
+ // 此处可调用发送函数
+ send_binary_data(ctx, binary_array, data_size);
+}
+
+/* 发送初始数据块 - 修复版 */
+void send_initial_data(client_context_t* ctx) {
+ // 添加状态检查
+ if (ctx->state != STATE_CONNECTED) {
+ fprintf(stderr, "[Client %d] Cannot send initial data: not connected\n", ctx->index);
+ return;
+ }
+
+ // 修正为实际数据大小 (1KB)
+ const size_t data_size = INITIAL_DATA_SIZE; // 使用实际值替换 INITIAL_DATA_SIZE
+ char* buffer = (char*)malloc(data_size);
+ if (!buffer) {
+ fprintf(stderr, "[Client %d] Failed to allocate initial data buffer\n", ctx->index);
+ return;
+ }
+ memset(buffer, 'A', data_size);
+ buffer[0] = 0xeb; buffer[1] = 0x90; buffer[2] = 0xff; buffer[15] = 0x16;
+
+ fprintf(stdout, "[Client %d] Sending initial %zu bytes data\n", ctx->index, data_size);
+
+ uv_buf_t buf = uv_buf_init(buffer, data_size);
+ uv_write_t* write_req = (uv_write_t*)malloc(sizeof(uv_write_t));
+ if (!write_req) {
+ free(buffer);
+ fprintf(stderr, "[Client %d] Failed to allocate write request\n", ctx->index);
+ return;
+ }
+ write_req->data = buffer;
+
+ // 检查uv_write返回值
+ int ret = uv_write(write_req, (uv_stream_t*)&ctx->client, &buf, 1, on_write);
+ if (ret < 0) {
+ fprintf(stderr, "[Client %d] uv_write failed: %s\n",
+ ctx->index, uv_strerror(ret));
+ free(buffer);
+ free(write_req);
+ }
+}
+
+/* 发送二进制报文函数 */
+void send_binary_data(client_context_t* ctx, const unsigned char* data, size_t data_size) {
+ if (ctx->state != STATE_CONNECTED) {
+ fprintf(stderr, "[Client %d] Cannot send binary data: not connected\n", ctx->index);
+ return;
+ }
+
+ uv_buf_t buf = uv_buf_init((char*)data, data_size);
+ uv_write_t* write_req = (uv_write_t*)malloc(sizeof(uv_write_t));
+ if (!write_req) {
+ fprintf(stderr, "[Client %d] Failed to allocate write request\n", ctx->index);
+ return;
+ }
+ write_req->data = NULL; // 不需要额外数据,因为data已经传入
+ fprintf(stdout, "[Client %d] Sending initial %zu bytes data\n", ctx->index, data_size);
+
+ int ret = uv_write(write_req, (uv_stream_t*)&ctx->client, &buf, 1, on_write);
+ if (ret < 0) {
+ fprintf(stderr, "[Client %d] uv_write failed: %s\n", ctx->index, uv_strerror(ret));
+ free(write_req);
+ }
+ // 注意:这里不需要释放data,因为data是由调用者管理的
+}
+
+/* 连接关闭回调 */
+void on_close(uv_handle_t* handle) {
+ client_context_t* ctx = (client_context_t*)handle->data;
+ ctx->state = STATE_DISCONNECTED;
+ fprintf(stdout, "[Client %d] Connection closed\n", ctx->index);
+
+ // 停止数据读写定时器和重连定时器
+ uv_timer_stop(&ctx->timer);
+ uv_timer_stop(&ctx->reconnect_timer);
+
+ // 取消读操作(如果有的话)
+ uv_read_stop((uv_stream_t*)&ctx->client);
+
+ // 指数退避算法
+ int delay = BASE_RECONNECT_DELAY * pow(2, ctx->reconnect_attempts);
+ delay = delay > MAX_RECONNECT_DELAY ? MAX_RECONNECT_DELAY : delay;
+
+ fprintf(stdout, "[Client %d] Will reconnect after %dms (attempt %d/%d)\n",
+ ctx->index, delay, ctx->reconnect_attempts + 1, MAX_RECONNECT_ATTEMPTS);
+
+ uv_timer_start(&ctx->reconnect_timer, (uv_timer_cb)try_reconnect, delay, 0);
+ ctx->reconnect_attempts++;
+}
+
+/* 尝试重连函数 */
+void try_reconnect(uv_timer_t* timer) {
+ client_context_t* ctx = (client_context_t*)timer->data;
+
+ if (ctx->state != STATE_DISCONNECTED) {
+ fprintf(stdout, "[Client %d] Reconnect skipped: Invalid state\n", ctx->index);
+ return;
+ }
+
+ fprintf(stdout, "[Client %d] Attempting to reconnect...\n", ctx->index);
+ if (ctx->reconnect_attempts >= MAX_RECONNECT_ATTEMPTS) {
+ fprintf(stderr, "[Client %d] Max reconnect attempts reached\n", ctx->index);
+ return;
+ }
+
+ // 重新初始化TCP句柄(重要!)
+ uv_tcp_init(ctx->loop, &ctx->client);
+ ctx->client.data = ctx;
+
+ ctx->state = STATE_CONNECTING;
+ struct sockaddr_in addr;
+ uv_ip4_addr(SERVER_IP, SERVER_PORT, &addr);
+
+ uv_connect_t* req = (uv_connect_t*)malloc(sizeof(uv_connect_t));
+ req->data = ctx;
+ int ret = uv_tcp_connect(req, &ctx->client, (const struct sockaddr*)&addr, on_connect);
+ if (ret < 0) {
+ fprintf(stderr, "[Client %d] Connect error: %s\n", ctx->index, uv_strerror(ret));
+ ctx->state = STATE_DISCONNECTED;
+ free(req);
+ uv_close((uv_handle_t*)&ctx->client, on_close);
+ }
+}
+
+/* 连接建立回调 */
+void on_connect(uv_connect_t* req, int status) {
+ client_context_t* ctx = (client_context_t*)req->data;
+
+ if (ctx->state != STATE_CONNECTING) {
+ fprintf(stdout, "[Client %d] Connection callback with invalid state\n", ctx->index);
+ free(req);
+ return;
+ }
+
+ if (status < 0) {
+ fprintf(stderr, "[Client %d] Connect failed: %s\n", ctx->index, uv_strerror(status));
+ ctx->state = STATE_DISCONNECTED;
+ free(req);
+ uv_close((uv_handle_t*)&ctx->client, on_close);
+ return;
+ }
+ else {
+ ctx->state = STATE_CONNECTED;
+ ctx->reconnect_attempts = 0;
+ fprintf(stdout, "[Client %d] Connection established\n", ctx->index);
+
+ // 启动数据收发
+ uv_read_start((uv_stream_t*)&ctx->client, alloc_buffer, on_read);
+ //send_initial_data(ctx);
+
+ // 启动定时器
+ uv_timer_start(&ctx->timer, on_timer, 6000, 6000);
+ }
+
+ free(req);
+}
+
+
+/* 客户端线程函数 */
+void* run_client(void* arg) {
+ int index = *(int*)arg;
+ free(arg);
+
+ // 初始化事件循环
+ uv_loop_t* loop = uv_loop_new();
+ client_context_t* ctx = (client_context_t*)malloc(sizeof(client_context_t));
+ memset(ctx, 0, sizeof(client_context_t));
+
+ // 初始化上下文
+ ctx->loop = loop;
+ ctx->index = index;
+ ctx->state = STATE_DISCONNECTED;
+ ctx->reconnect_attempts = 0;
+
+ // 初始化libuv句柄
+ uv_tcp_init(loop, &ctx->client);
+ uv_timer_init(loop, &ctx->timer);
+ uv_timer_init(loop, &ctx->reconnect_timer);
+
+ // 设置关联数据
+ ctx->client.data = ctx;
+ ctx->timer.data = ctx;
+ ctx->reconnect_timer.data = ctx;
+
+ // 首次连接尝试
+ try_reconnect(&ctx->reconnect_timer);
+
+ // 运行事件循环
+ uv_run(loop, UV_RUN_DEFAULT);
+
+ // 资源清理
+ uv_loop_close(loop);
+ free(loop);
+ free(ctx);
+ return NULL;
+}
+
+/* 主函数 */
+int main() {
+ pthread_t threads[CONNECTIONS];
+
+ // 创建客户端线程
+ for (int i = 0; i < CONNECTIONS; i++) {
+ int* index = (int*)malloc(sizeof(int));
+ *index = i;
+
+ if (pthread_create(&threads[i], NULL, run_client, index) != 0) {
+ fprintf(stderr, "Failed to create thread %d\n", i);
+ free(index);
+ }
+ }
+
+ printf("Started %d client connections\n", CONNECTIONS);
+
+ while (1) {
+ printf("sleep 1\n");
+ sleep(10);
+ }
+ // 等待所有线程结束
+ for (int i = 0; i < CONNECTIONS; i++) {
+ pthread_join(threads[i], NULL);
+ }
+
+ return 0;
+}
diff --git a/Linux_Hello/client2.h b/Linux_Hello/client2.h
new file mode 100644
index 0000000..85e6c69
--- /dev/null
+++ b/Linux_Hello/client2.h
@@ -0,0 +1,31 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* ״̬ö */
+typedef enum {
+ STATE_DISCONNECTED, // δ״̬
+ STATE_CONNECTING, // ״̬
+ STATE_CONNECTED // ״̬
+} connection_state_t;
+
+/* ͻĽṹ */
+typedef struct {
+ uv_loop_t* loop; // libuv¼ѭ
+ uv_tcp_t client; // TCPͻ˾
+ int index; // ͻ
+ uv_timer_t timer; // ݷͶʱ
+ uv_timer_t reconnect_timer;// ʱ
+ connection_state_t state; // ǰ״̬
+ int reconnect_attempts; // ǰ
+} client_context_t;
+
+//
+void try_reconnect(uv_timer_t* timer);//ͻص
+void on_connect(uv_connect_t* req, int status);//ͻӻص
+void on_close(uv_handle_t* handle);//ͻ˶Ͽص
+void send_binary_data(client_context_t* ctx, const unsigned char* data, size_t data_size);//װƱIJ ͻӣݣݴС
diff --git a/Linux_Hello/lib/libuv-v1.51.0.tar.gz b/Linux_Hello/lib/libuv-v1.51.0.tar.gz
new file mode 100644
index 0000000..571bd9b
Binary files /dev/null and b/Linux_Hello/lib/libuv-v1.51.0.tar.gz differ
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.gitattributes b/Linux_Hello/lib/libuv-v1.51.0/.gitattributes
new file mode 100644
index 0000000..89297cb
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.gitattributes
@@ -0,0 +1 @@
+test/fixtures/lorem_ipsum.txt text eol=lf
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.github/ISSUE_TEMPLATE.md b/Linux_Hello/lib/libuv-v1.51.0/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..43934de
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,13 @@
+
+* **Version**:
+* **Platform**:
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.github/dependabot.yml b/Linux_Hello/lib/libuv-v1.51.0/.github/dependabot.yml
new file mode 100644
index 0000000..700707c
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.github/dependabot.yml
@@ -0,0 +1,7 @@
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "weekly"
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-docs.yml b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-docs.yml
new file mode 100644
index 0000000..f414448
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-docs.yml
@@ -0,0 +1,25 @@
+name: CI-docs
+
+on:
+ pull_request:
+ paths:
+ - 'docs/**'
+ - '!docs/code/**'
+ - '.github/workflows/CI-docs.yml'
+
+jobs:
+ docs-src:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: '3.9'
+ cache: 'pip' # caching pip dependencies
+ - run: pip install -r docs/requirements.txt
+ - name: html
+ run: |
+ make -C docs html
+ - name: linkcheck
+ run: |
+ make -C docs linkcheck
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-sample.yml b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-sample.yml
new file mode 100644
index 0000000..14ffd4c
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-sample.yml
@@ -0,0 +1,33 @@
+name: ci-sample
+
+on:
+ pull_request:
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!.**'
+ - 'docs/code/**'
+ - '.github/workflows/CI-sample.yml'
+ push:
+ branches:
+ - v[0-9].*
+ - master
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{matrix.os}}
+ steps:
+ - uses: actions/checkout@v4
+ - name: setup
+ run: cmake -E make_directory ${{runner.workspace}}/libuv/docs/code/build
+ - name: configure
+ # you may like use Ninja on unix-like OS, but for windows, the only easy way is to use Visual Studio if you want Ninja
+ run: cmake ..
+ working-directory: ${{runner.workspace}}/libuv/docs/code/build
+ - name: build
+ run: cmake --build .
+ working-directory: ${{runner.workspace}}/libuv/docs/code/build
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-unix.yml b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-unix.yml
new file mode 100644
index 0000000..298dca2
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-unix.yml
@@ -0,0 +1,182 @@
+name: CI-unix
+
+on:
+ pull_request:
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!src/win/**'
+ - '!.**'
+ - '.github/workflows/CI-unix.yml'
+ push:
+ branches:
+ - v[0-9].*
+ - master
+
+jobs:
+ build-linux:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: configure
+ run: |
+ ./autogen.sh
+ mkdir build
+ (cd build && ../configure)
+ - name: distcheck
+ run: |
+ make -C build distcheck
+
+ build-android:
+ runs-on: ubuntu-latest
+ env:
+ ANDROID_AVD_HOME: /root/.android/avd
+ steps:
+ - uses: actions/checkout@v4
+ - name: Envinfo
+ run: npx envinfo
+ - name: Enable KVM
+ run: |
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
+ sudo udevadm control --reload-rules
+ sudo udevadm trigger --name-match=kvm
+ - name: Build and Test
+ uses: reactivecircus/android-emulator-runner@v2
+ with:
+ api-level: 30
+ arch: x86_64
+ target: google_apis
+ ram-size: 2048M
+ emulator-options: -no-audio -no-window -gpu off -no-boot-anim -netdelay none -netspeed full -writable-system -no-snapshot-save -no-snapshot-load -no-snapshot
+ disable-animations: true
+ script: |
+ echo "::group::Configure"
+ cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-30
+ echo "::endgroup::"
+
+ echo "::group::Build"
+ cmake --build build
+
+ ## Correct some ld bugs that cause problems with libuv tests
+ wget "https://github.com/termux/termux-elf-cleaner/releases/download/v2.2.1/termux-elf-cleaner" -P build
+ chmod a+x build/termux-elf-cleaner
+ build/termux-elf-cleaner --api-level 30 ./build/uv_run_tests
+ build/termux-elf-cleaner --api-level 30 ./build/uv_run_tests_a
+
+ adb shell "su 0 setenforce 0" # to allow some syscalls like link, chmod, etc.
+
+ ## Push the build and test fixtures to the device
+ adb push build /data/local/tmp
+ adb shell mkdir /data/local/tmp/build/test
+ adb push test/fixtures /data/local/tmp/build/test
+ echo "::endgroup::"
+
+ ## Run the tests
+ file build/uv_run_tests_a
+ adb shell "cd /data/local/tmp/build && env UV_TEST_TIMEOUT_MULTIPLIER=5 ./uv_run_tests_a"
+
+ build-macos:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-13, macos-14]
+ steps:
+ - uses: actions/checkout@v4
+ - name: Envinfo
+ run: npx envinfo
+ - name: Disable Firewall
+ run: |
+ /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
+ sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0
+ /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
+ - name: Setup
+ run: |
+ brew install ninja automake libtool
+ - name: Configure
+ run: |
+ mkdir build
+ cd build
+ cmake .. -DBUILD_TESTING=ON -G Ninja
+ - name: Build
+ run: |
+ cmake --build build
+ ls -lh
+ - name: platform_output
+ run: |
+ ./build/uv_run_tests platform_output
+ - name: platform_output_a
+ run: |
+ ./build/uv_run_tests_a platform_output
+ - name: Test
+ run: |
+ cd build && ctest -V
+ - name: Autotools configure
+ if: always()
+ run: |
+ ./autogen.sh
+ mkdir build-auto
+ (cd build-auto && ../configure)
+ make -C build-auto -j4
+
+ build-ios:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-13, macos-14]
+ steps:
+ - uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ mkdir build-ios
+ cd build-ios
+ cmake .. -GXcode -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DCMAKE_CONFIGURATION_TYPES:STRING=Release
+ - name: Build
+ run: |
+ cmake --build build-ios
+ ls -lh build-ios
+
+ build-cross-qemu:
+ runs-on: ubuntu-24.04
+ name: build-cross-qemu-${{ matrix.config.target }}
+
+ strategy:
+ fail-fast: false
+ matrix:
+ config:
+ - {target: arm, toolchain: gcc-arm-linux-gnueabi, cc: arm-linux-gnueabi-gcc, qemu: qemu-arm }
+ - {target: armhf, toolchain: gcc-arm-linux-gnueabihf, cc: arm-linux-gnueabihf-gcc, qemu: qemu-arm }
+ - {target: aarch64, toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64 }
+ - {target: riscv64, toolchain: gcc-riscv64-linux-gnu, cc: riscv64-linux-gnu-gcc, qemu: qemu-riscv64 }
+ - {target: ppc, toolchain: gcc-powerpc-linux-gnu, cc: powerpc-linux-gnu-gcc, qemu: qemu-ppc }
+ - {target: ppc64, toolchain: gcc-powerpc64-linux-gnu, cc: powerpc64-linux-gnu-gcc, qemu: qemu-ppc64 }
+ - {target: ppc64le, toolchain: gcc-powerpc64le-linux-gnu, cc: powerpc64le-linux-gnu-gcc, qemu: qemu-ppc64le }
+ - {target: s390x, toolchain: gcc-s390x-linux-gnu, cc: s390x-linux-gnu-gcc, qemu: qemu-s390x }
+ - {target: mips, toolchain: gcc-mips-linux-gnu, cc: mips-linux-gnu-gcc, qemu: qemu-mips }
+ - {target: mips64, toolchain: gcc-mips64-linux-gnuabi64, cc: mips64-linux-gnuabi64-gcc, qemu: qemu-mips64 }
+ - {target: mipsel, toolchain: gcc-mipsel-linux-gnu, cc: mipsel-linux-gnu-gcc, qemu: qemu-mipsel }
+ - {target: mips64el, toolchain: gcc-mips64el-linux-gnuabi64, cc: mips64el-linux-gnuabi64-gcc,qemu: qemu-mips64el }
+ - {target: arm (u64 slots), toolchain: gcc-arm-linux-gnueabi, cc: arm-linux-gnueabi-gcc, qemu: qemu-arm }
+ - {target: aarch64 (u64 slots), toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64 }
+ - {target: ppc (u64 slots), toolchain: gcc-powerpc-linux-gnu, cc: powerpc-linux-gnu-gcc, qemu: qemu-ppc }
+ - {target: ppc64 (u64 slots), toolchain: gcc-powerpc64-linux-gnu, cc: powerpc64-linux-gnu-gcc, qemu: qemu-ppc64 }
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Install qemu and ${{ matrix.config.toolchain }}
+ run: |
+ sudo apt update
+ sudo apt install qemu-user qemu-user-binfmt ${{ matrix.config.toolchain }} -y
+ - name: Configure with ${{ matrix.config.cc }}
+ run: |
+ mkdir build
+ cd build
+ cmake .. -DBUILD_TESTING=ON -DQEMU=ON -DCMAKE_C_COMPILER=${{ matrix.config.cc }}
+ - name: Build
+ run: |
+ cmake --build build
+ ls -lh build
+ - name: Test
+ run: |
+ ${{ matrix.config.qemu }} build/uv_run_tests_a
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-win.yml b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-win.yml
new file mode 100644
index 0000000..d1d6854
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/CI-win.yml
@@ -0,0 +1,128 @@
+name: CI-win
+
+on:
+ pull_request:
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!src/unix/**'
+ - '!.**'
+ - '.github/workflows/CI-win.yml'
+ push:
+ branches:
+ - v[0-9].*
+ - master
+
+jobs:
+ build-windows:
+ runs-on: windows-${{ matrix.config.server }}
+ name: build-${{ join(matrix.config.*, '-') }}
+ strategy:
+ fail-fast: false
+ matrix:
+ config:
+ - {toolchain: Visual Studio 17 2022, arch: Win32, server: 2022}
+ - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022}
+ - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022, config: ASAN}
+ - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022, config: UBSAN}
+ - {toolchain: Visual Studio 17 2022, arch: arm64, server: 2022}
+ - {toolchain: Visual Studio 17 2022, arch: x64, server: 2025}
+ steps:
+ - uses: actions/checkout@v4
+ - name: Build
+ run:
+ cmake -S . -B build -DBUILD_TESTING=ON
+ -G "${{ matrix.config.toolchain }}" -A ${{ matrix.config.arch }}
+ ${{ matrix.config.config == 'ASAN' && '-DASAN=on -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded' || '' }}
+
+ cmake --build build --config RelWithDebInfo
+
+ ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.exe" -Destination "build\\RelWithDebInfo\\"' || '' }}
+
+ ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.dll" -Destination "build\\RelWithDebInfo\\"' || '' }}
+
+ ls -l build
+
+ ls -l build\\RelWithDebInfo
+ - name: platform_output_a
+ if: ${{ matrix.config.arch != 'arm64' }}
+ shell: cmd
+ run:
+ build\\RelWithDebInfo\\uv_run_tests_a.exe platform_output
+ - name: platform_output
+ if: ${{ matrix.config.arch != 'arm64' }}
+ shell: cmd
+ run:
+ build\\RelWithDebInfo\\uv_run_tests.exe platform_output
+ - name: Test
+ # only valid with libuv-master with the fix for
+ # https://github.com/libuv/leps/blob/master/005-windows-handles-not-fd.md
+ if: ${{ matrix.config.config != 'ASAN' && matrix.config.arch != 'arm64' }}
+ shell: cmd
+ run:
+ cd build
+
+ ctest -C RelWithDebInfo -V
+ - name: Test only static
+ if: ${{ matrix.config.config == 'ASAN' && matrix.config.arch != 'arm64' }}
+ shell: cmd
+ run:
+ build\\RelWithDebInfo\\uv_run_tests_a.exe
+
+ build-mingw:
+ runs-on: ubuntu-latest
+ name: build-mingw-${{ matrix.config.arch }}
+ strategy:
+ fail-fast: false
+ matrix:
+ config:
+ - {arch: i686, server: 2022, libgcc: dw2 }
+ - {arch: x86_64, server: 2022, libgcc: seh }
+ steps:
+ - uses: actions/checkout@v4
+ - name: Install mingw32 environment
+ run: |
+ sudo apt update
+ sudo apt install mingw-w64 ninja-build -y
+ - name: Build
+ run: |
+ cmake -S . -B build -G Ninja -DHOST_ARCH=${{ matrix.config.arch }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=cmake-toolchains/cross-mingw32.cmake
+ cmake --build build
+ cmake --install build --prefix "`pwd`/build/usr"
+ mkdir -p build/usr/test build/usr/bin
+ cp -av test/fixtures build/usr/test
+ cp -av build/uv_run_tests_a.exe build/uv_run_tests.exe build/uv_run_tests_a_no_ext build/uv_run_tests_no_ext \
+ `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libgcc_s_${{ matrix.config.libgcc }}-1.dll` \
+ `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libwinpthread-1.dll` \
+ `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libatomic-1.dll` \
+ build/usr/bin
+ - name: Upload build artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: mingw-${{ matrix.config.arch }}
+ path: build/usr/**/*
+ retention-days: 2
+
+ test-mingw:
+ runs-on: windows-${{ matrix.config.server }}
+ name: test-mingw-${{ matrix.config.arch }}
+ needs: build-mingw
+ strategy:
+ fail-fast: false
+ matrix:
+ config:
+ - {arch: i686, server: 2022}
+ - {arch: x86_64, server: 2022}
+ steps:
+ - name: Download build artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: mingw-${{ matrix.config.arch }}
+ - name: Test
+ shell: cmd
+ run: |
+ bin\uv_run_tests_a.exe
+ - name: Test
+ shell: cmd
+ run: |
+ bin\uv_run_tests.exe
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/sanitizer.yml b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/sanitizer.yml
new file mode 100644
index 0000000..5825432
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.github/workflows/sanitizer.yml
@@ -0,0 +1,128 @@
+name: Sanitizer checks
+
+on:
+ pull_request:
+ paths:
+ - '**'
+ - '!docs/**'
+ - '!.**'
+ - '.github/workflows/sanitizer.yml'
+ push:
+ branches:
+ - v[0-9].*
+ - master
+
+jobs:
+ sanitizers-linux:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup
+ run: |
+ sudo apt-get install ninja-build
+ - name: Envinfo
+ run: npx envinfo
+
+ # [AM]SAN fail on newer kernels due to a bigger PIE slide
+ - name: Disable ASLR
+ run: |
+ sudo sysctl -w kernel.randomize_va_space=0
+
+ - name: ASAN Build
+ run: |
+ mkdir build-asan
+ (cd build-asan && cmake .. -G Ninja -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug)
+ cmake --build build-asan
+ - name: ASAN Test
+ run: |
+ ./build-asan/uv_run_tests_a
+
+ - name: MSAN Build
+ run: |
+ mkdir build-msan
+ (cd build-msan && cmake .. -G Ninja -DBUILD_TESTING=ON -DMSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang)
+ cmake --build build-msan
+ - name: MSAN Test
+ run: |
+ ./build-msan/uv_run_tests_a
+
+ - name: TSAN Build
+ run: |
+ mkdir build-tsan
+ (cd build-tsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release)
+ cmake --build build-tsan
+ - name: TSAN Test
+ # Note: path must be absolute because some tests chdir.
+ # TSan exits with an error when it can't find the file.
+ run: |
+ env TSAN_OPTIONS="suppressions=$PWD/tsansupp.txt" ./build-tsan/uv_run_tests_a
+
+ - name: UBSAN Build
+ run: |
+ mkdir build-ubsan
+ (cd build-ubsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang)
+ cmake --build build-ubsan
+ - name: UBSAN Test
+ run: |
+ ./build-ubsan/uv_run_tests_a
+
+ sanitizers-macos:
+ runs-on: macos-13
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Envinfo
+ run: npx envinfo
+
+ - name: ASAN Build
+ run: |
+ mkdir build-asan
+ (cd build-asan && cmake .. -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug)
+ cmake --build build-asan
+ - name: ASAN Test
+ run: |
+ ./build-asan/uv_run_tests_a
+
+ - name: TSAN Build
+ run: |
+ mkdir build-tsan
+ (cd build-tsan && cmake .. -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release)
+ cmake --build build-tsan
+ - name: TSAN Test
+ run: |
+ ./build-tsan/uv_run_tests_a
+
+ - name: UBSAN Build
+ run: |
+ mkdir build-ubsan
+ (cd build-ubsan && cmake .. -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug)
+ cmake --build build-ubsan
+ - name: UBSAN Test
+ run: |
+ ./build-ubsan/uv_run_tests_a
+
+ sanitizers-windows:
+ runs-on: windows-2022
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup
+ run: |
+ choco install ninja
+
+ # Note: clang shipped with VS2022 has an issue where the UBSAN runtime doesn't link.
+ - name: Install LLVM and Clang
+ uses: KyleMayes/install-llvm-action@v2
+ with:
+ version: "17"
+
+ - name: Envinfo
+ run: npx envinfo
+
+ - name: UBSAN Build
+ run: |
+ mkdir build-ubsan
+ cmake -B build-ubsan -G Ninja -DBUILD_TESTING=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang
+ cmake --build build-ubsan
+ - name: UBSAN Test
+ run: |
+ ./build-ubsan/uv_run_tests_a
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.gitignore b/Linux_Hello/lib/libuv-v1.51.0/.gitignore
new file mode 100644
index 0000000..6d396ef
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.gitignore
@@ -0,0 +1,80 @@
+*.swp
+*.[oa]
+*.l[oa]
+*.opensdf
+*.orig
+*.pyc
+*.sdf
+*.suo
+.vs/
+.vscode/
+*.VC.db
+*.VC.opendb
+core
+.cache
+vgcore.*
+.buildstamp
+.dirstamp
+.deps/
+/.libs/
+/aclocal.m4
+/ar-lib
+/autom4te.cache/
+/compile
+/config.guess
+/config.log
+/config.status
+/config.sub
+/configure
+/depcomp
+/install-sh
+/libtool
+/libuv.a
+/libuv.dylib
+/libuv.pc
+/libuv.so
+/ltmain.sh
+/missing
+/test-driver
+Makefile
+Makefile.in
+
+/build/
+
+/test/.libs/
+/test/run-tests
+/test/run-tests.exe
+/test/run-tests.dSYM
+/test/run-benchmarks
+/test/run-benchmarks.exe
+/test/run-benchmarks.dSYM
+test_file_*
+
+*.sln
+*.sln.cache
+*.ncb
+*.vcproj
+*.vcproj*.user
+*.vcxproj
+*.vcxproj.filters
+*.vcxproj.user
+_UpgradeReport_Files/
+UpgradeLog*.XML
+Debug
+Release
+ipch
+
+# sphinx generated files
+/docs/build/
+
+# Clion / IntelliJ project files
+/.idea/
+cmake-build-debug/
+
+*.xcodeproj
+*.xcworkspace
+
+# make dist output
+libuv-*.tar.*
+/dist.libuv.org/
+/libuv-release-tool/
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.mailmap b/Linux_Hello/lib/libuv-v1.51.0/.mailmap
new file mode 100644
index 0000000..f5d5375
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.mailmap
@@ -0,0 +1,71 @@
+A. Hauptmann
+AJ Heller
+Aaron Bieber
+Alan Gutierrez
+Andrius Bentkus
+Andy Fiddaman
+Andy Pan
+Bert Belder
+Bert Belder
+Bert Belder
+Brandon Philips
+Brian White
+Brian White
+Caleb James DeLisle
+Christoph Iserlohn
+Darshan Sen
+Darshan Sen
+David Carlier
+Devchandra Meetei Leishangthem
+Fedor Indutny
+Frank Denis
+Hüseyin Açacak <110401522+huseyinacacak-janea@users.noreply.github.com>
+Imran Iqbal
+Isaac Z. Schlueter
+Jason Williams
+Jesse Gorzinski
+Jesse Gorzinski
+Juan José Arboleda
+Justin Venus
+Keno Fischer
+Keno Fischer
+Leith Bade
+Leonard Hecker
+Lewis Russell
+Maciej Małecki
+Marc Schlaich
+Michael
+Michael Neumann
+Michael Penick
+Nicholas Vavilov
+Nick Logan
+Olivier Valentin
+Rasmus Christian Pedersen
+Rasmus Christian Pedersen
+Richard Lau
+Robert Mustacchi
+Ryan Dahl
+Ryan Emery
+Sakthipriyan Vairamani
+Sam Roberts
+San-Tai Hsu
+Santiago Gimeno
+Saúl Ibarra Corretgé
+Saúl Ibarra Corretgé
+Saúl Ibarra Corretgé
+Shigeki Ohtsu
+Shuowang (Wayne) Zhang
+TK-one
+Timothy J. Fontaine
+Yasuhiro Matsumoto
+Yazhong Liu
+Yuki Okumura
+cjihrig
+gengjiawen
+jBarz
+jBarz
+ptlomholt
+theanarkh <2923878201@qq.com>
+tjarlama <59913901+tjarlama@users.noreply.github.com>
+ywave620 <60539365+ywave620@users.noreply.github.com>
+zlargon
diff --git a/Linux_Hello/lib/libuv-v1.51.0/.readthedocs.yaml b/Linux_Hello/lib/libuv-v1.51.0/.readthedocs.yaml
new file mode 100644
index 0000000..5290ec3
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/.readthedocs.yaml
@@ -0,0 +1,15 @@
+version: 2
+
+sphinx:
+ builder: html
+ configuration: docs/src/conf.py
+ fail_on_warning: false
+
+build:
+ os: "ubuntu-22.04"
+ tools:
+ python: "3.9"
+
+python:
+ install:
+ - requirements: docs/requirements.txt
diff --git a/Linux_Hello/lib/libuv-v1.51.0/AUTHORS b/Linux_Hello/lib/libuv-v1.51.0/AUTHORS
new file mode 100644
index 0000000..89a3d9d
--- /dev/null
+++ b/Linux_Hello/lib/libuv-v1.51.0/AUTHORS
@@ -0,0 +1,606 @@
+# Authors ordered by first contribution.
+Ryan Dahl
+Bert Belder
+Josh Roesslein
+Alan Gutierrez
+Joshua Peek
+Igor Zinkovsky
+San-Tai Hsu
+Ben Noordhuis
+Henry Rawas
+Robert Mustacchi
+Matt Stevens
+Paul Querna
+Shigeki Ohtsu
+Tom Hughes
+Peter Bright
+Jeroen Janssen
+Andrea Lattuada
+Augusto Henrique Hentz
+Clifford Heath
+Jorge Chamorro Bieling
+Luis Lavena
+Matthew Sporleder
+Erick Tryzelaar
+Isaac Z. Schlueter
+Pieter Noordhuis
+Marek Jelen
+Fedor Indutny
+Saúl Ibarra Corretgé
+Felix Geisendörfer
+Yuki Okumura
+Roman Shtylman
+Frank Denis
+Carter Allen
+Tj Holowaychuk
+Shimon Doodkin
+Ryan Emery
+Bruce Mitchener
+Maciej Małecki
+Yasuhiro Matsumoto
+Daisuke Murase
+Paddy Byers
+Dan VerWeire
+Brandon Benvie
+Brandon Philips
+Nathan Rajlich
+Charlie McConnell
+Vladimir Dronnikov
+Aaron Bieber
+Bulat Shakirzyanov
+Brian White
+Erik Dubbelboer
+Keno Fischer
+Ira Cooper
+Andrius Bentkus
+Iñaki Baz Castillo
+Mark Cavage
+George Yohng
+Xidorn Quan
+Roman Neuhauser
+Shuhei Tanuma
+Bryan Cantrill
+Trond Norbye
+Tim Holy
+Prancesco Pertugio
+Leonard Hecker
+Andrew Paprocki
+Luigi Grilli
+Shannen Saez
+Artur Adib
+Hiroaki Nakamura
+Ting-Yu Lin
+Stephen Gallagher
+Shane Holloway
+Andrew Shaffer
+Vlad Tudose
+Ben Leslie
+Tim Bradshaw
+Timothy J. Fontaine
+Marc Schlaich
+Brian Mazza
+Elliot Saba
+Ben Kelly
+Nils Maier
+Nicholas Vavilov
+Miroslav Bajtoš
+Sean Silva
+Wynn Wilkes
+Andrei Sedoi
+Alex Crichton
+Brent Cook
+Brian Kaisner
+Luca Bruno