chore: CRLF to LF
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void easrv_start(unsigned short port, bool maintenance, int backlog, int thread_count);
|
||||
void easrv_shutdown();
|
||||
#pragma once
|
||||
|
||||
void easrv_start(unsigned short port, bool maintenance, int backlog, int thread_count);
|
||||
void easrv_shutdown();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
unsigned char BS_INFO2_COMMON_BIN[] = {
|
||||
0xa0, 0x42, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x08, 0xde, 0xae,
|
||||
0x35, 0xd3, 0x3e, 0x2a, 0x01, 0x05, 0xbb, 0x3a, 0xf4, 0x08, 0x01, 0x0a,
|
||||
0xab, 0xba, 0xb3, 0xe6, 0x5a, 0x39, 0xdf, 0x10, 0xfe, 0xfe, 0xfe, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
unsigned int BS_INFO2_COMMON_BIN_LEN = 40;
|
||||
unsigned char BS_INFO2_COMMON_BIN[] = {
|
||||
0xa0, 0x42, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x08, 0xde, 0xae,
|
||||
0x35, 0xd3, 0x3e, 0x2a, 0x01, 0x05, 0xbb, 0x3a, 0xf4, 0x08, 0x01, 0x0a,
|
||||
0xab, 0xba, 0xb3, 0xe6, 0x5a, 0x39, 0xdf, 0x10, 0xfe, 0xfe, 0xfe, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
unsigned int BS_INFO2_COMMON_BIN_LEN = 40;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
unsigned char BS_PCB2_BOOT_BIN[] = {
|
||||
0xa0, 0x42, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x34, 0x01, 0x08, 0xde, 0xae,
|
||||
0x35, 0xd3, 0x3e, 0x2a, 0x01, 0x05, 0xe2, 0xdd, 0x35, 0x08, 0x01, 0x05,
|
||||
0xe2, 0xec, 0xeb, 0xd0, 0x0b, 0x02, 0xcf, 0x20, 0xfe, 0x34, 0x07, 0xa3,
|
||||
0x19, 0x6a, 0xce, 0x7c, 0x40, 0xfe, 0x03, 0x04, 0xa3, 0x19, 0x6d, 0xfe,
|
||||
0x03, 0x04, 0xa3, 0x19, 0x72, 0xfe, 0xfe, 0xfe, 0xfe, 0xff, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x41, 0x53, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00
|
||||
};
|
||||
unsigned int BS_PCB2_BOOT_BIN_LEN = 76;
|
||||
unsigned char BS_PCB2_BOOT_BIN[] = {
|
||||
0xa0, 0x42, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x34, 0x01, 0x08, 0xde, 0xae,
|
||||
0x35, 0xd3, 0x3e, 0x2a, 0x01, 0x05, 0xe2, 0xdd, 0x35, 0x08, 0x01, 0x05,
|
||||
0xe2, 0xec, 0xeb, 0xd0, 0x0b, 0x02, 0xcf, 0x20, 0xfe, 0x34, 0x07, 0xa3,
|
||||
0x19, 0x6a, 0xce, 0x7c, 0x40, 0xfe, 0x03, 0x04, 0xa3, 0x19, 0x6d, 0xfe,
|
||||
0x03, 0x04, 0xa3, 0x19, 0x72, 0xfe, 0xfe, 0xfe, 0xfe, 0xff, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x41, 0x53, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00
|
||||
};
|
||||
unsigned int BS_PCB2_BOOT_BIN_LEN = 76;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
unsigned char BS_PCB2_ERROR_BIN[] = {
|
||||
0xa0, 0x42, 0xa0, 0x5f, 0x00, 0x00, 0x00, 0x18, 0x01, 0x08, 0xde, 0xae,
|
||||
0x35, 0xd3, 0x3e, 0x2a, 0x01, 0x04, 0xd6, 0x89, 0xc2, 0x2e, 0x06, 0xe3,
|
||||
0x99, 0xb9, 0xeb, 0x80, 0xfe, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08,
|
||||
0x00, 0x00, 0x00, 0x02, 0x30, 0x00, 0x00, 0x00
|
||||
};
|
||||
unsigned int BS_PCB2_ERROR_BIN_LEN = 44;
|
||||
unsigned char BS_PCB2_ERROR_BIN[] = {
|
||||
0xa0, 0x42, 0xa0, 0x5f, 0x00, 0x00, 0x00, 0x18, 0x01, 0x08, 0xde, 0xae,
|
||||
0x35, 0xd3, 0x3e, 0x2a, 0x01, 0x04, 0xd6, 0x89, 0xc2, 0x2e, 0x06, 0xe3,
|
||||
0x99, 0xb9, 0xeb, 0x80, 0xfe, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08,
|
||||
0x00, 0x00, 0x00, 0x02, 0x30, 0x00, 0x00, 0x00
|
||||
};
|
||||
unsigned int BS_PCB2_ERROR_BIN_LEN = 44;
|
||||
|
||||
+6409
-6409
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,13 @@
|
||||
unsigned char PCBTRACKER_ALIVE_BIN[] = {
|
||||
0x17, 0x7e, 0xdc, 0xae, 0x1a, 0x15, 0x41, 0x23, 0xae, 0xd5, 0xa0, 0xf5,
|
||||
0x2c, 0xa1, 0xb9, 0xd2, 0x53, 0xc8, 0xd2, 0x0d, 0x92, 0x04, 0x1d, 0x5d,
|
||||
0x2c, 0x5e, 0x19, 0x95, 0x1f, 0x71, 0x5c, 0x0d, 0x73, 0xad, 0x03, 0xbf,
|
||||
0x08, 0xf6, 0x91, 0x4f, 0xe4, 0xfb, 0x71, 0x0d, 0x87, 0x6c, 0xef, 0xbb,
|
||||
0x93, 0xfb, 0x7f, 0x30, 0x43, 0x64, 0xf5, 0x74, 0x11, 0xb7, 0x9c, 0xef,
|
||||
0x12, 0xd3, 0x2d, 0xc0, 0x52, 0x76, 0x97, 0xad, 0xa5, 0x27, 0x0c, 0x80,
|
||||
0xa7, 0x42, 0x62, 0xe2, 0xe3, 0xa0, 0x25, 0x74, 0x48, 0x8d, 0xd5, 0xae,
|
||||
0x1e, 0xda, 0x88, 0x0f, 0x68, 0x2f, 0x67, 0xb3, 0x72, 0x08, 0x24, 0x1c,
|
||||
0x2a, 0x5d, 0xa9, 0x3d, 0xf6, 0x41, 0x24, 0x27, 0xf4, 0x5b, 0x6c, 0x63,
|
||||
0x5e, 0x7d, 0xf6, 0xd4
|
||||
};
|
||||
unsigned int PCBTRACKER_ALIVE_BIN_LEN = 112;
|
||||
unsigned char PCBTRACKER_ALIVE_BIN[] = {
|
||||
0x17, 0x7e, 0xdc, 0xae, 0x1a, 0x15, 0x41, 0x23, 0xae, 0xd5, 0xa0, 0xf5,
|
||||
0x2c, 0xa1, 0xb9, 0xd2, 0x53, 0xc8, 0xd2, 0x0d, 0x92, 0x04, 0x1d, 0x5d,
|
||||
0x2c, 0x5e, 0x19, 0x95, 0x1f, 0x71, 0x5c, 0x0d, 0x73, 0xad, 0x03, 0xbf,
|
||||
0x08, 0xf6, 0x91, 0x4f, 0xe4, 0xfb, 0x71, 0x0d, 0x87, 0x6c, 0xef, 0xbb,
|
||||
0x93, 0xfb, 0x7f, 0x30, 0x43, 0x64, 0xf5, 0x74, 0x11, 0xb7, 0x9c, 0xef,
|
||||
0x12, 0xd3, 0x2d, 0xc0, 0x52, 0x76, 0x97, 0xad, 0xa5, 0x27, 0x0c, 0x80,
|
||||
0xa7, 0x42, 0x62, 0xe2, 0xe3, 0xa0, 0x25, 0x74, 0x48, 0x8d, 0xd5, 0xae,
|
||||
0x1e, 0xda, 0x88, 0x0f, 0x68, 0x2f, 0x67, 0xb3, 0x72, 0x08, 0x24, 0x1c,
|
||||
0x2a, 0x5d, 0xa9, 0x3d, 0xf6, 0x41, 0x24, 0x27, 0xf4, 0x5b, 0x6c, 0x63,
|
||||
0x5e, 0x7d, 0xf6, 0xd4
|
||||
};
|
||||
unsigned int PCBTRACKER_ALIVE_BIN_LEN = 112;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
cd -P "$( dirname "$(readlink -f "$0")" )"
|
||||
mkdir -p ../responses
|
||||
|
||||
for file in *.bin
|
||||
do
|
||||
xxd -C -i "${file}" > "../responses/$(basename "${file}" .bin).h"
|
||||
done
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
cd -P "$( dirname "$(readlink -f "$0")" )"
|
||||
mkdir -p ../responses
|
||||
|
||||
for file in *.bin
|
||||
do
|
||||
xxd -C -i "${file}" > "../responses/$(basename "${file}" .bin).h"
|
||||
done
|
||||
|
||||
+85
-85
@@ -1,85 +1,85 @@
|
||||
#include "smartea.h"
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include "util/utils.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace smartea {
|
||||
|
||||
bool check_url(std::string url) {
|
||||
|
||||
// WSA startup
|
||||
WSADATA wsa_data;
|
||||
int error;
|
||||
if ((error = WSAStartup(MAKEWORD(2, 2), &wsa_data)) != 0) {
|
||||
log_fatal("smartea", "WSAStartup returned {}", error);
|
||||
}
|
||||
|
||||
// create hints
|
||||
addrinfo hints;
|
||||
ZeroMemory(&hints, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
// get port
|
||||
std::vector<std::string> url_split;
|
||||
strsplit(url, url_split, ':');
|
||||
int port = 80;
|
||||
if (url_split.size() >= 2 && string_begins_with(url_split[0], "http"))
|
||||
url_split.erase(std::begin(url_split));
|
||||
while (url_split.size() >= 1 && url_split[0].length() > 0 && url_split[0][0] == '/')
|
||||
url_split[0] = url_split[0].substr(1);
|
||||
if (url_split.size() >= 2)
|
||||
port = strtol(url_split[1].c_str(), nullptr, 10);
|
||||
|
||||
// remove path from host
|
||||
auto host_slash = url_split[0].find("/");
|
||||
if (host_slash != std::string::npos) {
|
||||
url_split[0] = url_split[0].substr(0, host_slash);
|
||||
}
|
||||
|
||||
// get address info
|
||||
addrinfo *result;
|
||||
if ((error = getaddrinfo(url_split[0].c_str(), to_string(port).c_str(), &hints, &result)) != 0) {
|
||||
log_info("smartea", "could not resolve {}:{}: {}", url_split[0], url_split[1], error);
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
// iterate list
|
||||
bool success = false;
|
||||
for (addrinfo *ptr = result; ptr != nullptr; ptr = ptr->ai_next) {
|
||||
|
||||
// create socket
|
||||
SOCKET sock = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
|
||||
if (sock == INVALID_SOCKET) {
|
||||
log_info("smartea", "could not create socket: {}", WSAGetLastError());
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
// connect to server
|
||||
error = connect(sock, ptr->ai_addr, (int) ptr->ai_addrlen);
|
||||
if (error == SOCKET_ERROR) {
|
||||
closesocket(sock);
|
||||
continue;
|
||||
}
|
||||
|
||||
// success
|
||||
success = true;
|
||||
closesocket(sock);
|
||||
break;
|
||||
}
|
||||
|
||||
// WSA shutdown
|
||||
WSACleanup();
|
||||
|
||||
// success
|
||||
if (success)
|
||||
log_info("smartea", "server seems to be available :)");
|
||||
else
|
||||
log_info("smartea", "server seems to be dead :(");
|
||||
return success;
|
||||
}
|
||||
}
|
||||
#include "smartea.h"
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include "util/utils.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
namespace smartea {
|
||||
|
||||
bool check_url(std::string url) {
|
||||
|
||||
// WSA startup
|
||||
WSADATA wsa_data;
|
||||
int error;
|
||||
if ((error = WSAStartup(MAKEWORD(2, 2), &wsa_data)) != 0) {
|
||||
log_fatal("smartea", "WSAStartup returned {}", error);
|
||||
}
|
||||
|
||||
// create hints
|
||||
addrinfo hints;
|
||||
ZeroMemory(&hints, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
// get port
|
||||
std::vector<std::string> url_split;
|
||||
strsplit(url, url_split, ':');
|
||||
int port = 80;
|
||||
if (url_split.size() >= 2 && string_begins_with(url_split[0], "http"))
|
||||
url_split.erase(std::begin(url_split));
|
||||
while (url_split.size() >= 1 && url_split[0].length() > 0 && url_split[0][0] == '/')
|
||||
url_split[0] = url_split[0].substr(1);
|
||||
if (url_split.size() >= 2)
|
||||
port = strtol(url_split[1].c_str(), nullptr, 10);
|
||||
|
||||
// remove path from host
|
||||
auto host_slash = url_split[0].find("/");
|
||||
if (host_slash != std::string::npos) {
|
||||
url_split[0] = url_split[0].substr(0, host_slash);
|
||||
}
|
||||
|
||||
// get address info
|
||||
addrinfo *result;
|
||||
if ((error = getaddrinfo(url_split[0].c_str(), to_string(port).c_str(), &hints, &result)) != 0) {
|
||||
log_info("smartea", "could not resolve {}:{}: {}", url_split[0], url_split[1], error);
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
// iterate list
|
||||
bool success = false;
|
||||
for (addrinfo *ptr = result; ptr != nullptr; ptr = ptr->ai_next) {
|
||||
|
||||
// create socket
|
||||
SOCKET sock = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
|
||||
if (sock == INVALID_SOCKET) {
|
||||
log_info("smartea", "could not create socket: {}", WSAGetLastError());
|
||||
WSACleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
// connect to server
|
||||
error = connect(sock, ptr->ai_addr, (int) ptr->ai_addrlen);
|
||||
if (error == SOCKET_ERROR) {
|
||||
closesocket(sock);
|
||||
continue;
|
||||
}
|
||||
|
||||
// success
|
||||
success = true;
|
||||
closesocket(sock);
|
||||
break;
|
||||
}
|
||||
|
||||
// WSA shutdown
|
||||
WSACleanup();
|
||||
|
||||
// success
|
||||
if (success)
|
||||
log_info("smartea", "server seems to be available :)");
|
||||
else
|
||||
log_info("smartea", "server seems to be dead :(");
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace smartea {
|
||||
|
||||
bool check_url(std::string url);
|
||||
}
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace smartea {
|
||||
|
||||
bool check_url(std::string url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user