Update MediaClient
BIN
IOBox/ANSDAQ_Device.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
IOBox/Backup/iobox_api.zip
Normal file
BIN
IOBox/Backup/v1.0.0/flow_chart.jpg
Normal file
|
After Width: | Height: | Size: 118 KiB |
729
IOBox/Backup/v1.0.0/iobox_api.cpp
Normal file
@@ -0,0 +1,729 @@
|
|||||||
|
#include "iobox_api.h"
|
||||||
|
namespace ANSCENTER {
|
||||||
|
iobox_api::iobox_api(std::string ipmcast, int port_mcast)
|
||||||
|
{
|
||||||
|
this->ip_mcast = ipmcast;
|
||||||
|
this->port_mcast = port_mcast;
|
||||||
|
WSADATA wsaData;
|
||||||
|
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
||||||
|
std::cerr << "WSAStartup failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iobox_api::~iobox_api()
|
||||||
|
{
|
||||||
|
WSACleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isStringExistInVectorString(const std::vector<std::string>& vec, const std::string& str) {
|
||||||
|
for (const auto& item : vec) {
|
||||||
|
if (item == str) {
|
||||||
|
std::cout << "Found duplicate: " << str << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
// return std::find(vec.begin(), vec.end(), str) != vec.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void printBufferAsHex(const char* buffer, size_t length) {
|
||||||
|
for (size_t i = 0; i < length; ++i) {
|
||||||
|
printf("%02X ", static_cast<unsigned char>(buffer[i]));
|
||||||
|
if ((i + 1) % 16 == 0) {
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
void printStringAsHex(const std::string& str) {
|
||||||
|
for (size_t i = 0; i < str.size(); ++i) {
|
||||||
|
printf("%02X ", static_cast<unsigned char>(str[i]));
|
||||||
|
if ((i + 1) % 16 == 0) {
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
iobox_info_t parseIoboxResponse(const std::string& response) {
|
||||||
|
iobox_info_t info;
|
||||||
|
size_t ipPos = response.find("IOBOX_RESPONSE:");
|
||||||
|
size_t modbusPos = response.find("modbus_address:");
|
||||||
|
|
||||||
|
if (ipPos != std::string::npos && modbusPos != std::string::npos) {
|
||||||
|
ipPos += strlen("IOBOX_RESPONSE:");
|
||||||
|
modbusPos += strlen("modbus_address:");
|
||||||
|
|
||||||
|
size_t ipEnd = response.find(',', ipPos);
|
||||||
|
if (ipEnd != std::string::npos) {
|
||||||
|
info.ip_address = response.substr(ipPos, ipEnd - ipPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string modbusStr = response.substr(modbusPos);
|
||||||
|
info.modbus_address = std::stoi(modbusStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
void show_info_iobox(iobox_info_t iobox_info) {
|
||||||
|
std::cout << " IP Address: " << iobox_info.ip_address << std::endl;
|
||||||
|
std::cout << " Modbus Address: " << (int)iobox_info.modbus_address << std::endl;
|
||||||
|
}
|
||||||
|
void iobox_api::show_profile_iobox(std::string ip) {
|
||||||
|
iobox_profile_t* profile = findProfileByIp(ip);
|
||||||
|
if (profile == nullptr) {
|
||||||
|
std::cerr << "IP address not found: " << ip << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
show_profile_iobox(*profile);
|
||||||
|
}
|
||||||
|
void iobox_api::show_profile_iobox(iobox_profile_t profile) {
|
||||||
|
// std::cout << "Profile ioboxs: " << this->iobox_profiles.size() << std::endl;
|
||||||
|
// for (const iobox_profile_t& profile : this->iobox_profiles) {
|
||||||
|
// std::cout << "* Index: " << &profile - &this->iobox_profiles[0] << std::endl;
|
||||||
|
show_info_iobox(profile.iobox_info);
|
||||||
|
std::cout << " Counting get: " << profile.counting_get << std::endl;
|
||||||
|
std::cout << " Is connected: " << profile.is_connected << std::endl;
|
||||||
|
if (profile.counting_get)
|
||||||
|
{
|
||||||
|
std::cout << " Modbus address: " << profile.iobox_data.modbus_address << std::endl;
|
||||||
|
std::cout << " Serial number: " << reinterpret_cast<const char*>(profile.iobox_data.serial_number) << std::endl;
|
||||||
|
uint8_t hw_version = (profile.iobox_data.version >> 8) & 0xFF;
|
||||||
|
uint8_t fw_version = profile.iobox_data.version & 0xFF;
|
||||||
|
std::cout << " HW Version: " << static_cast<int>(hw_version) << std::endl;
|
||||||
|
std::cout << " FW Version: " << static_cast<int>(fw_version) << std::endl;
|
||||||
|
std::cout << " Channel DO: ";
|
||||||
|
std::cout << profile.iobox_data.channel_DO[0] << " ";
|
||||||
|
std::cout << profile.iobox_data.channel_DO[1] << " ";
|
||||||
|
std::cout << profile.iobox_data.channel_DO[2] << " ";
|
||||||
|
std::cout << profile.iobox_data.channel_DO[3] << std::endl;
|
||||||
|
std::cout << " Channel DI: ";
|
||||||
|
std::cout << profile.iobox_data.channel_DI[0] << " ";
|
||||||
|
std::cout << profile.iobox_data.channel_DI[1] << " ";
|
||||||
|
std::cout << profile.iobox_data.channel_DI[2] << " ";
|
||||||
|
std::cout << profile.iobox_data.channel_DI[3] << std::endl;
|
||||||
|
std::cout << " Channel AI: ";
|
||||||
|
std::cout << profile.iobox_data.channel_AI[0] << " ";
|
||||||
|
std::cout << profile.iobox_data.channel_AI[1] << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
void iobox_api::show_profile_ioboxs() {
|
||||||
|
if (this->iobox_profiles.size() == 0) {
|
||||||
|
std::cout << "No iobox profiles" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (const auto& profile : this->iobox_profiles) {
|
||||||
|
std::cout << "* Index: " << &profile - &this->iobox_profiles[0] << std::endl;
|
||||||
|
show_profile_iobox(profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//void iobox_api::save_info_iobox(iobox_info_t iobox_info) {
|
||||||
|
// iobox_profile_t profile = {
|
||||||
|
// .counting_get = 0,
|
||||||
|
// .is_connected = false,
|
||||||
|
// .sock_tcp = INVALID_SOCKET,
|
||||||
|
// };
|
||||||
|
// profile.iobox_info = iobox_info;
|
||||||
|
// this->iobox_profiles.push_back(profile);
|
||||||
|
//}
|
||||||
|
void iobox_api::save_info_iobox(iobox_info_t iobox_info) {
|
||||||
|
iobox_profile_t profile;
|
||||||
|
profile.counting_get = 0;
|
||||||
|
profile.is_connected = false;
|
||||||
|
profile.sock_tcp = INVALID_SOCKET;
|
||||||
|
profile.iobox_info = iobox_info;
|
||||||
|
|
||||||
|
this->iobox_profiles.push_back(profile);
|
||||||
|
}
|
||||||
|
bool iobox_api::sendTcpMessage(const std::string& ip, const char* buffer, size_t length) {
|
||||||
|
for (auto& profile : this->iobox_profiles) {
|
||||||
|
if (profile.iobox_info.ip_address == ip && profile.is_connected && profile.sock_tcp != INVALID_SOCKET) {
|
||||||
|
int result = send(profile.sock_tcp, buffer, length, 0);
|
||||||
|
if (result == SOCKET_ERROR) {
|
||||||
|
std::cerr << "send failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::cout << "Sent " << length << " bytes message to " << ip << std::endl;
|
||||||
|
printBufferAsHex(buffer, length);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cerr << "IP address not found or not connected: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool iobox_api::receiveTcpMessage(const std::string& ip, char* buffer, size_t& length) {
|
||||||
|
for (auto& profile : this->iobox_profiles) {
|
||||||
|
if (profile.iobox_info.ip_address == ip && profile.is_connected && profile.sock_tcp != INVALID_SOCKET) {
|
||||||
|
setSocketTimeout(profile.sock_tcp, 3000);
|
||||||
|
int recvLen = recv(profile.sock_tcp, buffer, length, 0);
|
||||||
|
if (recvLen > 0) {
|
||||||
|
length = recvLen;
|
||||||
|
std::cout << "Received message: " << length << " bytes" << std::endl;
|
||||||
|
printBufferAsHex(buffer, recvLen);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "recv failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cerr << "IP address not found or not connected: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void iobox_api::sendMulticastMessage(const std::string& message) {
|
||||||
|
SOCKET sock = INVALID_SOCKET;
|
||||||
|
struct sockaddr_in multicastAddr;
|
||||||
|
|
||||||
|
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (sock == INVALID_SOCKET) {
|
||||||
|
std::cerr << "socket failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
WSACleanup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&multicastAddr, 0, sizeof(multicastAddr));
|
||||||
|
multicastAddr.sin_family = AF_INET;
|
||||||
|
multicastAddr.sin_addr.s_addr = inet_addr(this->ip_mcast.c_str());
|
||||||
|
multicastAddr.sin_port = htons(this->port_mcast);
|
||||||
|
|
||||||
|
if (sendto(sock, message.c_str(), message.length(), 0, (struct sockaddr*)&multicastAddr, sizeof(multicastAddr)) == SOCKET_ERROR) {
|
||||||
|
std::cerr << "sendto failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cout << "Sent message: " << message << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
closesocket(sock);
|
||||||
|
}
|
||||||
|
void iobox_api::setSocketTimeout(SOCKET sock, int timeout) {
|
||||||
|
struct timeval tv;
|
||||||
|
tv.tv_sec = timeout;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof(tv)) < 0) {
|
||||||
|
std::cerr << "setsockopt failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::vector<std::string> iobox_api::scanNetworkDevicesMulticast(int timeout) {
|
||||||
|
std::vector<std::string> devices;
|
||||||
|
|
||||||
|
for (const auto& item : this->iobox_profiles) {
|
||||||
|
if (item.is_connected || item.sock_tcp != INVALID_SOCKET) {
|
||||||
|
std::cout << "Please close connection to " << item.iobox_info.ip_address << "befor new scan" << std::endl;
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//remove all elements from iobox_profiles before and we start with new scan
|
||||||
|
this->iobox_profiles.clear();
|
||||||
|
|
||||||
|
// WSADATA wsaData;
|
||||||
|
SOCKET sock = INVALID_SOCKET;
|
||||||
|
struct sockaddr_in multicastAddr;
|
||||||
|
struct ip_mreq multicastRequest;
|
||||||
|
char recvBuf[1024];
|
||||||
|
struct sockaddr_in recvAddr;
|
||||||
|
int recvAddrLen = sizeof(recvAddr);
|
||||||
|
std::string message = "IOBOX_DISCOVERY";
|
||||||
|
|
||||||
|
// if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
||||||
|
// std::cerr << "WSAStartup failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
// return devices;
|
||||||
|
// }
|
||||||
|
|
||||||
|
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (sock == INVALID_SOCKET) {
|
||||||
|
std::cerr << "socket failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
// WSACleanup();
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&multicastAddr, 0, sizeof(multicastAddr));
|
||||||
|
multicastAddr.sin_family = AF_INET;
|
||||||
|
multicastAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
|
multicastAddr.sin_port = htons(this->port_mcast);
|
||||||
|
if (bind(sock, (struct sockaddr*)&multicastAddr, sizeof(multicastAddr)) == SOCKET_ERROR) {
|
||||||
|
std::cerr << "bind failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
closesocket(sock);
|
||||||
|
// WSACleanup();
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
multicastRequest.imr_multiaddr.s_addr = inet_addr(this->ip_mcast.c_str());
|
||||||
|
multicastRequest.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
||||||
|
#ifndef TEST_FIX_IP
|
||||||
|
if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&multicastRequest, sizeof(multicastRequest)) < 0) {
|
||||||
|
std::cerr << "setsockopt failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
closesocket(sock);
|
||||||
|
// WSACleanup();
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
setSocketTimeout(sock, 3000);
|
||||||
|
|
||||||
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
// sendMulticastMessage(message);
|
||||||
|
while (std::chrono::steady_clock::now() - start < std::chrono::seconds(timeout)) {
|
||||||
|
int recvLen = recvfrom(sock, recvBuf, sizeof(recvBuf) - 1, 0, (struct sockaddr*)&recvAddr, &recvAddrLen);
|
||||||
|
if (recvLen > 0) {
|
||||||
|
recvBuf[recvLen] = '\0';
|
||||||
|
std::string message_rsp(recvBuf);
|
||||||
|
std::string senderIp = inet_ntoa(recvAddr.sin_addr);
|
||||||
|
std::cout << "Received message: \"" << message_rsp << "\" from " << senderIp << std::endl;
|
||||||
|
|
||||||
|
iobox_info_t info = parseIoboxResponse(message_rsp);
|
||||||
|
if (info.ip_address == senderIp && info.ip_address != "" && !isStringExistInVectorString(devices, senderIp)) {
|
||||||
|
std::string deviceInfo;
|
||||||
|
std::string deviceAlias = "ANSDAQ1";
|
||||||
|
std::string deviceSN = "SN123456";
|
||||||
|
std::string deviceModel = "ANSIOBOX";
|
||||||
|
deviceInfo = deviceAlias + "-"
|
||||||
|
+ deviceModel + "-"
|
||||||
|
+ deviceSN + "-"+ senderIp;
|
||||||
|
devices.push_back(deviceInfo);
|
||||||
|
save_info_iobox(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//std::cerr << "recvfrom failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
sendMulticastMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifndef TEST_FIX_IP
|
||||||
|
setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (char*)&multicastRequest, sizeof(multicastRequest));
|
||||||
|
#endif
|
||||||
|
closesocket(sock);
|
||||||
|
// WSACleanup();
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool iobox_api::connectToIobox(const std::string& ip, int port, const std::string& username, const std::string& password) {
|
||||||
|
// check ip is already in iobox_profiles
|
||||||
|
bool is_exist = false;
|
||||||
|
iobox_profile_t* item = nullptr;
|
||||||
|
|
||||||
|
for (auto& profile : this->iobox_profiles) {
|
||||||
|
if (profile.iobox_info.ip_address == ip) {
|
||||||
|
is_exist = true;
|
||||||
|
item = &profile;
|
||||||
|
if (item->is_connected) {
|
||||||
|
std::cout << "Ip is already connected: " << ip << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_exist == false) {
|
||||||
|
std::cout << "Ip is not exist in list scan" << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WSADATA wsaData;
|
||||||
|
SOCKET sock = INVALID_SOCKET;
|
||||||
|
struct sockaddr_in serverAddr;
|
||||||
|
//char recvBuf[1024];
|
||||||
|
int recvLen = 0;
|
||||||
|
struct timeval tv;
|
||||||
|
tv.tv_sec = 3;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
// Initialize Winsock
|
||||||
|
// int result = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||||
|
// if (result != 0) {
|
||||||
|
// std::cerr << "WSAStartup failed: " << result << std::endl;
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
if (sock == INVALID_SOCKET) {
|
||||||
|
std::cerr << "socket failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
// WSACleanup();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
serverAddr.sin_family = AF_INET;
|
||||||
|
serverAddr.sin_addr.s_addr = inet_addr(ip.c_str());
|
||||||
|
serverAddr.sin_port = htons(port);
|
||||||
|
|
||||||
|
if (connect(sock, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
|
||||||
|
std::cerr << "connect failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
closesocket(sock);
|
||||||
|
// WSACleanup();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof(tv));
|
||||||
|
// recvLen = recv(sock, recvBuf, sizeof(recvBuf) - 1, 0);
|
||||||
|
// if (recvLen > 0) {
|
||||||
|
// recvBuf[recvLen] = '\0';
|
||||||
|
// std::cout << "Received message: " << recvBuf << std::endl;
|
||||||
|
// } else {
|
||||||
|
// std::cerr << "recv failed with error: " << WSAGetLastError() << std::endl;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// closesocket(sock);
|
||||||
|
// WSACleanup();
|
||||||
|
item->sock_tcp = sock;
|
||||||
|
item->is_connected = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool iobox_api::disconnectToIobox(const std::string& ip) {
|
||||||
|
// check ip is already in iobox_profiles
|
||||||
|
bool is_exist = false;
|
||||||
|
iobox_profile_t* item = nullptr;
|
||||||
|
|
||||||
|
for (auto& profile : this->iobox_profiles) {
|
||||||
|
if (profile.iobox_info.ip_address == ip) {
|
||||||
|
item = &profile;
|
||||||
|
is_exist = true;
|
||||||
|
if (item->is_connected) {
|
||||||
|
std::cout << "Ip is already connected: " << ip << std::endl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_exist == false) {
|
||||||
|
std::cout << "Ip is not exist in list scan" << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
item->counting_get = 0;
|
||||||
|
item->is_connected = false;
|
||||||
|
closesocket(item->sock_tcp);
|
||||||
|
item->sock_tcp = INVALID_SOCKET;
|
||||||
|
// WSACleanup();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t calculateCRC(const uint8_t* data, size_t length) {
|
||||||
|
uint16_t crc = 0xFFFF;
|
||||||
|
for (size_t i = 0; i < length; ++i) {
|
||||||
|
crc ^= data[i];
|
||||||
|
for (int j = 0; j < 8; ++j) {
|
||||||
|
if (crc & 0x0001) {
|
||||||
|
crc >>= 1;
|
||||||
|
crc ^= 0xA001;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
crc >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
std::vector<uint8_t> createModbusWriteSingleRegisterRequest(uint8_t slaveAddress, uint16_t address, uint16_t value) {
|
||||||
|
std::vector<uint8_t> request(8);
|
||||||
|
request[0] = slaveAddress; // Slave address
|
||||||
|
request[1] = 0x06; // Function code for Write Single Register
|
||||||
|
request[2] = (address >> 8) & 0xFF; // Register address high byte
|
||||||
|
request[3] = address & 0xFF; // Register address low byte
|
||||||
|
request[4] = (value >> 8) & 0xFF; // Value high byte
|
||||||
|
request[5] = value & 0xFF; // Value low byte
|
||||||
|
|
||||||
|
// Calculate CRC
|
||||||
|
uint16_t crc = calculateCRC(request.data(), 6);
|
||||||
|
request[6] = crc & 0xFF; // CRC low byte
|
||||||
|
request[7] = (crc >> 8) & 0xFF; // CRC high byte
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<uint8_t> createModbusReadHoldingRegistersRequest(uint8_t slaveAddress, uint16_t startAddress, uint16_t quantity) {
|
||||||
|
std::vector<uint8_t> request(8);
|
||||||
|
request[0] = slaveAddress; // Slave address
|
||||||
|
request[1] = 0x03; // Function code for Read Holding Registers
|
||||||
|
request[2] = (startAddress >> 8) & 0xFF; // Starting address high byte
|
||||||
|
request[3] = startAddress & 0xFF; // Starting address low byte
|
||||||
|
request[4] = (quantity >> 8) & 0xFF; // Quantity of registers high byte
|
||||||
|
request[5] = quantity & 0xFF; // Quantity of registers low byte
|
||||||
|
|
||||||
|
// Calculate CRC
|
||||||
|
uint16_t crc = calculateCRC(request.data(), 6);
|
||||||
|
request[6] = crc & 0xFF; // CRC low byte
|
||||||
|
request[7] = (crc >> 8) & 0xFF; // CRC high byte
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
std::vector<uint16_t> parseModbusReadHoldingRegistersResponse(const std::vector<uint8_t>& response) {
|
||||||
|
std::vector<uint16_t> data;
|
||||||
|
if (response.size() < 5) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify CRC
|
||||||
|
uint16_t receivedCrc = (response[response.size() - 1] << 8) | response[response.size() - 2];
|
||||||
|
uint16_t calculatedCrc = calculateCRC(response.data(), response.size() - 2);
|
||||||
|
if (receivedCrc != calculatedCrc) {
|
||||||
|
std::cerr << "CRC check failed" << std::endl;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (response[1] & 0x80) {
|
||||||
|
std::cerr << "Error code received: " << static_cast<int>(response[2]) << std::endl;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
uint8_t byteCount = response[2];
|
||||||
|
if (response.size() < 5 + byteCount) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < byteCount / 2; ++i) {
|
||||||
|
uint16_t value = (response[3 + i * 2] << 8) | response[4 + i * 2];
|
||||||
|
data.push_back(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
iobox_profile_t* iobox_api::findProfileByIp(const std::string& ip) {
|
||||||
|
iobox_profile_t* profile = nullptr;
|
||||||
|
for (auto& item : this->iobox_profiles) {
|
||||||
|
if (item.iobox_info.ip_address == ip) {
|
||||||
|
profile = &item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
bool iobox_api::getAllDataFromIobox(const std::string& ip) {
|
||||||
|
iobox_profile_t* profile = findProfileByIp(ip);
|
||||||
|
if (profile == nullptr) {
|
||||||
|
std::cerr << "IP address not found: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::vector<uint8_t> request = createModbusReadHoldingRegistersRequest(profile->iobox_info.modbus_address, DEVICE_DATA_ADDRESS, DEVICE_DATA_LENGTH);
|
||||||
|
if (!sendTcpMessage(ip, reinterpret_cast<const char*>(request.data()), request.size())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char response[256];
|
||||||
|
size_t responseLength = sizeof(response);
|
||||||
|
if (!receiveTcpMessage(ip, response, responseLength)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<uint8_t> responseVec(response, response + responseLength);
|
||||||
|
std::vector<uint16_t> registers = parseModbusReadHoldingRegistersResponse(responseVec);
|
||||||
|
|
||||||
|
if (registers.empty()) {
|
||||||
|
std::cerr << "Failed to parse Modbus response" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Process the registers as needed
|
||||||
|
// for (size_t i = 0; i < registers.size(); ++i) {
|
||||||
|
// std::cout << "Register " << i << ": " << registers[i] << std::endl;
|
||||||
|
// }
|
||||||
|
if (registers.size() == DEVICE_DATA_LENGTH) {
|
||||||
|
memcpy(&profile->iobox_data, registers.data(), sizeof(profile->iobox_data));
|
||||||
|
}
|
||||||
|
if (profile->iobox_data.modbus_address != (uint16_t)profile->iobox_info.modbus_address) {
|
||||||
|
std::cout << "Modbus address changed to " << profile->iobox_data.modbus_address << std::endl;
|
||||||
|
profile->iobox_info.modbus_address = profile->iobox_data.modbus_address;
|
||||||
|
}
|
||||||
|
profile->counting_get++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool iobox_api::setValueDataToIobox(const std::string& ip, uint16_t address, uint16_t value) {
|
||||||
|
iobox_profile_t* profile = findProfileByIp(ip);
|
||||||
|
if (profile == nullptr) {
|
||||||
|
std::cerr << "IP address not found: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::vector<uint8_t> request = createModbusWriteSingleRegisterRequest(profile->iobox_info.modbus_address, address, value);
|
||||||
|
if (!sendTcpMessage(ip, reinterpret_cast<const char*>(request.data()), request.size())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char response[256];
|
||||||
|
size_t responseLength = sizeof(response);
|
||||||
|
if (!receiveTcpMessage(ip, response, responseLength)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process the response as needed
|
||||||
|
std::vector<uint8_t> responseVec(response, response + responseLength);
|
||||||
|
if (responseVec.size() < 8) {
|
||||||
|
std::cerr << "Invalid response length" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify CRC
|
||||||
|
uint16_t receivedCrc = (responseVec[7] << 8) | responseVec[6];
|
||||||
|
uint16_t calculatedCrc = calculateCRC(responseVec.data(), 6);
|
||||||
|
if (receivedCrc != calculatedCrc) {
|
||||||
|
std::cerr << "CRC check failed" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the response matches the request
|
||||||
|
if (responseVec[0] != request[0] || responseVec[1] != request[1] ||
|
||||||
|
responseVec[2] != request[2] || responseVec[3] != request[3] ||
|
||||||
|
responseVec[4] != request[4] || responseVec[5] != request[5]) {
|
||||||
|
std::cerr << "Response does not match the request" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Write single register succeeded" << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool iobox_api::isValidChannelName(const std::string& channelName) {
|
||||||
|
for (const std::string& name : this->channel_name) {
|
||||||
|
if (name == channelName) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool iobox_api::getAllValueIobox(const std::string& ip)
|
||||||
|
{
|
||||||
|
iobox_profile_t* profile = findProfileByIp(ip);
|
||||||
|
if (profile == nullptr) {
|
||||||
|
std::cerr << "IP address not found: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!getAllDataFromIobox(ip)) {
|
||||||
|
std::cerr << "Failed to get data from IOBox: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
std::string iobox_api::getValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName) {
|
||||||
|
if (!isValidChannelName(channelName)) {
|
||||||
|
std::cerr << "Invalid channel name: " << channelName << std::endl;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (!getAllValueIobox(ip)) {
|
||||||
|
std::cerr << "Failed to get all data from IOBox: " << ip << std::endl;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
int16_t value_int = 0;
|
||||||
|
iobox_profile_t* profile = findProfileByIp(ip);
|
||||||
|
if (profile == nullptr) {
|
||||||
|
std::cerr << "IP address not found: " << ip << std::endl;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (channelName == "DO1") {
|
||||||
|
value_int = profile->iobox_data.channel_DO[0];
|
||||||
|
}
|
||||||
|
else if (channelName == "DO2") {
|
||||||
|
value_int = profile->iobox_data.channel_DO[1];
|
||||||
|
}
|
||||||
|
else if (channelName == "DO3") {
|
||||||
|
value_int = profile->iobox_data.channel_DO[2];
|
||||||
|
}
|
||||||
|
else if (channelName == "DO4") {
|
||||||
|
value_int = profile->iobox_data.channel_DO[3];
|
||||||
|
}
|
||||||
|
else if (channelName == "DI1") {
|
||||||
|
value_int = profile->iobox_data.channel_DI[0];
|
||||||
|
}
|
||||||
|
else if (channelName == "DI2") {
|
||||||
|
value_int = profile->iobox_data.channel_DI[1];
|
||||||
|
}
|
||||||
|
else if (channelName == "DI3") {
|
||||||
|
value_int = profile->iobox_data.channel_DI[2];
|
||||||
|
}
|
||||||
|
else if (channelName == "DI4") {
|
||||||
|
value_int = profile->iobox_data.channel_DI[3];
|
||||||
|
}
|
||||||
|
else if (channelName == "AI1") {
|
||||||
|
value_int = profile->iobox_data.channel_AI[0];
|
||||||
|
}
|
||||||
|
else if (channelName == "AI2") {
|
||||||
|
value_int = profile->iobox_data.channel_AI[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "Invalid channel name: " << channelName << std::endl;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return std::to_string(value_int);
|
||||||
|
}
|
||||||
|
bool iobox_api::setValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName, const std::string& value) {
|
||||||
|
iobox_profile_t* profile = findProfileByIp(ip);
|
||||||
|
if (profile == nullptr) {
|
||||||
|
std::cerr << "IP address not found: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isValidChannelName(channelName)) {
|
||||||
|
std::cerr << "Invalid channel name: " << channelName << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int channelIndex = -1;
|
||||||
|
for (channelIndex = 0; channelIndex < IOBOX_CHANNEL_NUM; channelIndex++) {
|
||||||
|
if (this->channel_name[channelIndex] == channelName) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (channelIndex == -1) {
|
||||||
|
std::cerr << "Invalid channel name: " << channelName << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t value_int = std::stoi(value);
|
||||||
|
if (!setValueDataToIobox(ip, this->iobox_channel_address[channelIndex], value_int)) {
|
||||||
|
std::cerr << "Failed to set data to IOBox: " << ip << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channelName == "DO1") {
|
||||||
|
profile->iobox_data.channel_DO[0] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "DO2") {
|
||||||
|
profile->iobox_data.channel_DO[1] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "DO3") {
|
||||||
|
profile->iobox_data.channel_DO[2] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "DO4") {
|
||||||
|
profile->iobox_data.channel_DO[3] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "DI1") {
|
||||||
|
profile->iobox_data.channel_DI[0] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "DI2") {
|
||||||
|
profile->iobox_data.channel_DI[1] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "DI3") {
|
||||||
|
profile->iobox_data.channel_DI[2] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "DI4") {
|
||||||
|
profile->iobox_data.channel_DI[3] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "AI1") {
|
||||||
|
profile->iobox_data.channel_AI[0] = value_int;
|
||||||
|
}
|
||||||
|
else if (channelName == "AI2") {
|
||||||
|
profile->iobox_data.channel_AI[1] = value_int;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "Invalid channel name: " << channelName << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void testGetAllValueFromChannelName(iobox_api& api, const std::string& ip) {
|
||||||
|
std::vector<std::string> channelNames = { "DO1", "DO2", "DO3", "DO4", "DI1", "DI2", "DI3", "DI4", "AI1", "AI2" };
|
||||||
|
for (const std::string& channelName : channelNames) {
|
||||||
|
std::string value = api.getValueDataStringIoboxFromChannelName(ip, channelName);
|
||||||
|
std::cout << "Channel " << channelName << ": " << value << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool iobox_api::setAuthenticationIobox(const std::string& ip, const std::string& username, const std::string& password) {
|
||||||
|
// Todo
|
||||||
|
// Override default username and password
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> iobox_api::getDeviceChannelNames(const std::string& ip, int timeout) {
|
||||||
|
// To do
|
||||||
|
// Get channel names from IOBox (if available)
|
||||||
|
std::vector<std::string> channelNames = { "DO1", "DO2", "DO3", "DO4", "DI1", "DI2", "DI3", "DI4", "AI1", "AI2" };
|
||||||
|
return channelNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
124
IOBox/Backup/v1.0.0/iobox_api.h
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
#ifndef _IO_BOX_API_H
|
||||||
|
#define _IO_BOX_API_H
|
||||||
|
#define ANSIO_API __declspec(dllexport)
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "extcode.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
#pragma comment(lib,"WS2_32")
|
||||||
|
// #pragma comment(lib, "Ws2_32.lib")
|
||||||
|
// #define TEST_FIX_IP
|
||||||
|
#define DEVICE_TCP_PORT 502
|
||||||
|
#define DEVICE_DATA_ADDRESS 100
|
||||||
|
#define DEVICE_DATA_LENGTH 17
|
||||||
|
|
||||||
|
namespace ANSCENTER {
|
||||||
|
typedef struct {
|
||||||
|
std::string ip_address;
|
||||||
|
uint8_t modbus_address;
|
||||||
|
} iobox_info_t;
|
||||||
|
typedef union {
|
||||||
|
/* data */
|
||||||
|
uint16_t raw_data[DEVICE_DATA_LENGTH];
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint16_t modbus_address;
|
||||||
|
uint8_t serial_number[10];
|
||||||
|
uint16_t version;
|
||||||
|
int16_t channel_DO[4];
|
||||||
|
int16_t channel_DI[4];
|
||||||
|
int16_t channel_AI[2];
|
||||||
|
};
|
||||||
|
} iobox_data_t;
|
||||||
|
typedef enum {
|
||||||
|
IOBOX_CHANNEL_DO1 = 0,
|
||||||
|
IOBOX_CHANNEL_DO2,
|
||||||
|
IOBOX_CHANNEL_DO3,
|
||||||
|
IOBOX_CHANNEL_DO4,
|
||||||
|
IOBOX_CHANNEL_DI1,
|
||||||
|
IOBOX_CHANNEL_DI2,
|
||||||
|
IOBOX_CHANNEL_DI3,
|
||||||
|
IOBOX_CHANNEL_DI4,
|
||||||
|
IOBOX_CHANNEL_AI1,
|
||||||
|
IOBOX_CHANNEL_AI2,
|
||||||
|
IOBOX_CHANNEL_NUM
|
||||||
|
} iobox_channel_t;
|
||||||
|
typedef struct {
|
||||||
|
int counting_get;
|
||||||
|
bool is_connected;
|
||||||
|
SOCKET sock_tcp;
|
||||||
|
iobox_info_t iobox_info;
|
||||||
|
iobox_data_t iobox_data;
|
||||||
|
|
||||||
|
} iobox_profile_t;
|
||||||
|
class ANSIO_API iobox_api
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::string ip_mcast; //ip multicast
|
||||||
|
int port_mcast; //port multicast
|
||||||
|
std::string channel_name[IOBOX_CHANNEL_NUM] = {
|
||||||
|
"DO1", "DO2", "DO3", "DO4",
|
||||||
|
"DI1", "DI2", "DI3", "DI4",
|
||||||
|
"AI1", "AI2"
|
||||||
|
};
|
||||||
|
uint16_t iobox_channel_address[IOBOX_CHANNEL_NUM] = {
|
||||||
|
107, 108, 109, 110, 111, 112, 113, 114, 115, 116
|
||||||
|
};
|
||||||
|
std::vector<iobox_profile_t> iobox_profiles;
|
||||||
|
iobox_profile_t* findProfileByIp(const std::string& ip);
|
||||||
|
void save_info_iobox(iobox_info_t iobox_info);
|
||||||
|
void setSocketTimeout(SOCKET sock, int timeout);
|
||||||
|
void sendMulticastMessage(const std::string& message);
|
||||||
|
bool sendTcpMessage(const std::string& ip, const char* buffer, size_t length);
|
||||||
|
bool receiveTcpMessage(const std::string& ip, char* buffer, size_t& length);
|
||||||
|
bool getAllDataFromIobox(const std::string& ip);
|
||||||
|
bool setValueDataToIobox(const std::string& ip, uint16_t address, uint16_t value);
|
||||||
|
bool isValidChannelName(const std::string& channelName);
|
||||||
|
void show_profile_iobox(iobox_profile_t profile);
|
||||||
|
public:
|
||||||
|
iobox_api(std::string ip_mcast, int port_mcast);
|
||||||
|
~iobox_api();
|
||||||
|
void show_profile_iobox(std::string ip);
|
||||||
|
void show_profile_ioboxs();
|
||||||
|
std::vector<std::string> scanNetworkDevicesMulticast(int timeout);
|
||||||
|
bool setAuthenticationIobox(const std::string& ip, const std::string& username, const std::string& password);
|
||||||
|
bool resetAuthenticationIobox(const std::string& ip, const std::string& token) { return true; }
|
||||||
|
bool resetIobox(const std::string& ip, const std::string& token) { return true; }
|
||||||
|
bool connectToIobox(const std::string& ip, int port, const std::string& username, const std::string& password);
|
||||||
|
bool disconnectToIobox(const std::string& ip);
|
||||||
|
std::vector<std::string> getDeviceChannelNames(const std::string& ip,int timeout);
|
||||||
|
std::string getValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName);
|
||||||
|
bool setValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName, const std::string& value);
|
||||||
|
bool getAllValueIobox(const std::string& ip);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" ANSIO_API int CreateANSIOHandle(ANSCENTER::iobox_api** Handle, const char* multicastIPAddress, int multicastPort);
|
||||||
|
extern "C" ANSIO_API int ScanANSIOHandle(ANSCENTER::iobox_api** Handle, int timeout, LStrHandle ipAddresses);
|
||||||
|
extern "C" ANSIO_API int ConnectANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int ioBoxPort, const char* userName, const char* passWord);
|
||||||
|
extern "C" ANSIO_API int DisconnectANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP);
|
||||||
|
extern "C" ANSIO_API int GetChannelNamesANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP,int timeout, LStrHandle channelNames);
|
||||||
|
extern "C" ANSIO_API int SetValueANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, const char* value);
|
||||||
|
extern "C" ANSIO_API int GetValueANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, LStrHandle lStrValue);
|
||||||
|
extern "C" ANSIO_API int SetAuthenticationANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* userName, const char* passWord);
|
||||||
|
extern "C" ANSIO_API int ReleaseANSIOHandle(ANSCENTER::iobox_api** Handle);
|
||||||
|
extern "C" ANSIO_API int ResetAuthenticationANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* token);
|
||||||
|
extern "C" ANSIO_API int ResetANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* token);
|
||||||
|
|
||||||
|
// C++ interface
|
||||||
|
extern "C" ANSIO_API int ScanANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, int timeout, std::string& ipAddresses);
|
||||||
|
extern "C" ANSIO_API int GetChannelNamesANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int timeout, std::string& channelNames);
|
||||||
|
extern "C" ANSIO_API int GetValueANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, std::string& lStrValue);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
91
IOBox/Backup/v1.0.0/main.cpp
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
|
||||||
|
#include "iobox_api.h"
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
iobox_api ioBoxApp((char*)"239.255.255.250", 12345);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void userInputThread(iobox_api* api) {
|
||||||
|
std::string current_ip;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
std::string input;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << "Enter command followed by Enter: exit, scan, setip, connect, disconnect, show, get, set" << std::endl;
|
||||||
|
// std::cin >> input; // This will only get the first word
|
||||||
|
std::getline(std::cin, input);
|
||||||
|
if (input == "exit") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(input == "scan") {
|
||||||
|
std::vector<std::string> devices = api->scanNetworkDevicesMulticast(5);
|
||||||
|
std::cout << "Found devices: " << devices.size() << std::endl;
|
||||||
|
for (const std::string& device : devices) {
|
||||||
|
std::cout << device << std::endl;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "setip") {
|
||||||
|
std::cout << "Enter IP: ";
|
||||||
|
std::getline(std::cin, current_ip);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "connect") {
|
||||||
|
if(current_ip == "") {
|
||||||
|
std::cout << "Please setip address first" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bool connect = api->connectToIobox(current_ip, DEVICE_TCP_PORT);
|
||||||
|
std::cout << "Connection to " << current_ip << (connect ? " succeeded." : " failed.") << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "disconnect") {
|
||||||
|
bool disconnect = api->disconnectToIobox(current_ip);
|
||||||
|
std::cout << "Disconnect to " << current_ip << (disconnect ? " succeeded." : " failed.") << std::endl;
|
||||||
|
// current_ip = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "show") {
|
||||||
|
api->show_profile_ioboxs();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "get") {
|
||||||
|
std::string channel;
|
||||||
|
std::cout << "Enter channel (\"all\" for get all): ";
|
||||||
|
std::cin >> channel;
|
||||||
|
if(channel == "all") {
|
||||||
|
bool get = api->getAllValueIobox(current_ip);
|
||||||
|
api->show_profile_iobox(current_ip);
|
||||||
|
std::cout << "Get all value from " << current_ip << (get ? " succeeded." : " failed.") << std::endl;
|
||||||
|
} else {
|
||||||
|
std::string value = api->getValueDataStringIoboxFromChannelName(current_ip, channel);
|
||||||
|
std::cout << "Value of " << channel << ": " << value << std::endl;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "set") {
|
||||||
|
std::string value;
|
||||||
|
std::string channel;
|
||||||
|
std::cout << "Enter channel: ";
|
||||||
|
std::cin >> channel;
|
||||||
|
std::cout << "Enter value: ";
|
||||||
|
std::cin >> value;
|
||||||
|
bool set = api->setValueDataStringIoboxFromChannelName(current_ip, channel, value);
|
||||||
|
std::cout << "Set value to " << current_ip << (set ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cout << "Invalid command" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
std::thread userThread(userInputThread, &ioBoxApp);
|
||||||
|
userThread.join();
|
||||||
|
|
||||||
|
std::cout << "Main thread is done" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
54
IOBox/Backup/v1.0.0/readme.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
### IOBOX API USAGE GUIDE
|
||||||
|
This document provides an overview and usage instructions for the APIs available in `iobox_api.h`.
|
||||||
|
#### 1. Api name and features
|
||||||
|
* Scan
|
||||||
|
|
||||||
|
`std::vector<std::string> scanNetworkDevicesMulticast(int timeout);`
|
||||||
|
|
||||||
|
API need to be passed a timeout in second unit. The API will return a list of IPs as a vector string.
|
||||||
|
* Connect
|
||||||
|
|
||||||
|
`bool connectToIobox(const std::string& ip, int port); `
|
||||||
|
|
||||||
|
Connect to a specific IP device from list of IPs above. Default port is 502.
|
||||||
|
|
||||||
|
* Disconnect
|
||||||
|
|
||||||
|
`bool disconnectToIobox(const std::string& ip);`
|
||||||
|
|
||||||
|
Disconnect to a specific IP device that is connected before
|
||||||
|
|
||||||
|
* Get value of channel
|
||||||
|
|
||||||
|
`std::string getValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName);`
|
||||||
|
|
||||||
|
Get value of specific channel name from a IP device that is connected before.
|
||||||
|
List of channel name is included in `channel_name` array.
|
||||||
|
|
||||||
|
* Set value of channel
|
||||||
|
|
||||||
|
`bool setValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName, const std::string& value);`
|
||||||
|
|
||||||
|
Set a value of specific channel name from a IP device that is connected before. List of channel name is included in `channel_name` array.
|
||||||
|
|
||||||
|
#### 2. How to using example test in main.cpp
|
||||||
|
|
||||||
|
You need build this project before run by using g++ compiler
|
||||||
|
|
||||||
|
`g++ .\*.cpp -lws2_32 -o main.exe`
|
||||||
|
|
||||||
|
Then you need only running `main.exe`.
|
||||||
|
|
||||||
|
Start application, it will show
|
||||||
|
|
||||||
|
`Enter command followed by Enter: exit, scan, setip, connect, disconnect, show, get, set`
|
||||||
|
|
||||||
|
* You type `scan`, it will scan all device iobox on local network then it will list them on terminal attach their IP address if they is found.
|
||||||
|
* Then type `setip` to setup IP of iobox you need to connect
|
||||||
|
Then you will be required to input of specific IP address and you need type IP you want.
|
||||||
|
* Next you type `connect` to connect to this IP device
|
||||||
|
* Then you can use `get` or `set` command to continue get or set value to any channel.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
IOBox/Backup/v1.1.0/ANSDAQ_Device.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
2590
IOBox/Backup/v1.1.0/banve.pdf
Normal file
3143
IOBox/Backup/v1.1.0/cJSON.c
Normal file
300
IOBox/Backup/v1.1.0/cJSON.h
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cJSON__h
|
||||||
|
#define cJSON__h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||||
|
#define __WINDOWS__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
|
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||||
|
|
||||||
|
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||||
|
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||||
|
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||||
|
|
||||||
|
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||||
|
|
||||||
|
setting default visibility to hidden by adding
|
||||||
|
-fvisibility=hidden (for gcc)
|
||||||
|
or
|
||||||
|
-xldscope=hidden (for sun cc)
|
||||||
|
to CFLAGS
|
||||||
|
|
||||||
|
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CJSON_CDECL __cdecl
|
||||||
|
#define CJSON_STDCALL __stdcall
|
||||||
|
|
||||||
|
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||||
|
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_EXPORT_SYMBOLS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CJSON_HIDE_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||||
|
#endif
|
||||||
|
#else /* !__WINDOWS__ */
|
||||||
|
#define CJSON_CDECL
|
||||||
|
#define CJSON_STDCALL
|
||||||
|
|
||||||
|
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||||
|
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||||
|
#else
|
||||||
|
#define CJSON_PUBLIC(type) type
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* project version */
|
||||||
|
#define CJSON_VERSION_MAJOR 1
|
||||||
|
#define CJSON_VERSION_MINOR 7
|
||||||
|
#define CJSON_VERSION_PATCH 18
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* cJSON Types: */
|
||||||
|
#define cJSON_Invalid (0)
|
||||||
|
#define cJSON_False (1 << 0)
|
||||||
|
#define cJSON_True (1 << 1)
|
||||||
|
#define cJSON_NULL (1 << 2)
|
||||||
|
#define cJSON_Number (1 << 3)
|
||||||
|
#define cJSON_String (1 << 4)
|
||||||
|
#define cJSON_Array (1 << 5)
|
||||||
|
#define cJSON_Object (1 << 6)
|
||||||
|
#define cJSON_Raw (1 << 7) /* raw json */
|
||||||
|
|
||||||
|
#define cJSON_IsReference 256
|
||||||
|
#define cJSON_StringIsConst 512
|
||||||
|
|
||||||
|
/* The cJSON structure: */
|
||||||
|
typedef struct cJSON
|
||||||
|
{
|
||||||
|
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||||
|
struct cJSON *next;
|
||||||
|
struct cJSON *prev;
|
||||||
|
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||||
|
struct cJSON *child;
|
||||||
|
|
||||||
|
/* The type of the item, as above. */
|
||||||
|
int type;
|
||||||
|
|
||||||
|
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||||
|
char *valuestring;
|
||||||
|
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||||
|
int valueint;
|
||||||
|
/* The item's number, if type==cJSON_Number */
|
||||||
|
double valuedouble;
|
||||||
|
|
||||||
|
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||||
|
char *string;
|
||||||
|
} cJSON;
|
||||||
|
|
||||||
|
typedef struct cJSON_Hooks
|
||||||
|
{
|
||||||
|
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||||
|
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||||
|
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||||
|
} cJSON_Hooks;
|
||||||
|
|
||||||
|
typedef int cJSON_bool;
|
||||||
|
|
||||||
|
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||||
|
* This is to prevent stack overflows. */
|
||||||
|
#ifndef CJSON_NESTING_LIMIT
|
||||||
|
#define CJSON_NESTING_LIMIT 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* returns the version of cJSON as a string */
|
||||||
|
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||||
|
|
||||||
|
/* Supply malloc, realloc and free functions to cJSON */
|
||||||
|
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||||
|
|
||||||
|
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||||
|
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
|
||||||
|
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||||
|
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||||
|
|
||||||
|
/* Render a cJSON entity to text for transfer/storage. */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||||
|
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||||
|
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||||
|
/* Delete a cJSON entity and all subentities. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
|
||||||
|
|
||||||
|
/* Returns the number of items in an array (or object). */
|
||||||
|
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||||
|
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||||
|
/* Get item "string" from object. Case insensitive. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||||
|
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||||
|
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||||
|
|
||||||
|
/* Check item type and return its value */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
|
||||||
|
|
||||||
|
/* These functions check the type of an item */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||||
|
|
||||||
|
/* These calls create a cJSON item of the appropriate type. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
|
||||||
|
/* raw json */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
|
||||||
|
|
||||||
|
/* Create a string where valuestring references a string so
|
||||||
|
* it will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
|
||||||
|
/* Create an object/array that only references it's elements so
|
||||||
|
* they will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
|
||||||
|
|
||||||
|
/* These utilities create an Array of count items.
|
||||||
|
* The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
|
||||||
|
|
||||||
|
/* Append item to the specified array/object. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||||
|
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||||
|
* writing to `item->string` */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
|
||||||
|
/* Remove/Detach items from Arrays/Objects. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
|
||||||
|
/* Update array items. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||||
|
|
||||||
|
/* Duplicate a cJSON item */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||||
|
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||||
|
* need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||||
|
* The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||||
|
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||||
|
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||||
|
|
||||||
|
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
|
||||||
|
* The input pointer json cannot point to a read-only address area, such as a string constant,
|
||||||
|
* but should point to a readable and writable address area. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||||
|
|
||||||
|
/* Helper functions for creating and adding items to an object at the same time.
|
||||||
|
* They return the added item or NULL on failure. */
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
|
||||||
|
|
||||||
|
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||||
|
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||||
|
/* helper for the cJSON_SetNumberValue macro */
|
||||||
|
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||||
|
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||||
|
/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
|
||||||
|
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
|
||||||
|
|
||||||
|
/* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/
|
||||||
|
#define cJSON_SetBoolValue(object, boolValue) ( \
|
||||||
|
(object != NULL && ((object)->type & (cJSON_False|cJSON_True))) ? \
|
||||||
|
(object)->type=((object)->type &(~(cJSON_False|cJSON_True)))|((boolValue)?cJSON_True:cJSON_False) : \
|
||||||
|
cJSON_Invalid\
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Macro for iterating over an array or object */
|
||||||
|
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||||
|
|
||||||
|
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||||
|
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||||
|
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
1481
IOBox/Backup/v1.1.0/cJSON_Utils.c
Normal file
88
IOBox/Backup/v1.1.0/cJSON_Utils.h
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cJSON_Utils__h
|
||||||
|
#define cJSON_Utils__h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cJSON.h"
|
||||||
|
|
||||||
|
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *pointer);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointerCaseSensitive(cJSON * const object, const char *pointer);
|
||||||
|
|
||||||
|
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
|
||||||
|
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to);
|
||||||
|
/* Utility for generating patch array entries. */
|
||||||
|
CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value);
|
||||||
|
/* Returns 0 for success. */
|
||||||
|
CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches);
|
||||||
|
CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use:
|
||||||
|
//int cJSONUtils_AtomicApplyPatches(cJSON **object, cJSON *patches)
|
||||||
|
//{
|
||||||
|
// cJSON *modme = cJSON_Duplicate(*object, 1);
|
||||||
|
// int error = cJSONUtils_ApplyPatches(modme, patches);
|
||||||
|
// if (!error)
|
||||||
|
// {
|
||||||
|
// cJSON_Delete(*object);
|
||||||
|
// *object = modme;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// cJSON_Delete(modme);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return error;
|
||||||
|
//}
|
||||||
|
// Code not added to library since this strategy is a LOT slower.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */
|
||||||
|
/* target will be modified by patch. return value is new ptr for target. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatch(cJSON *target, const cJSON * const patch);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON * const patch);
|
||||||
|
/* generates a patch to move from -> to */
|
||||||
|
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatch(cJSON * const from, cJSON * const to);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON * const from, cJSON * const to);
|
||||||
|
|
||||||
|
/* Given a root object and a target object, construct a pointer from one to the other. */
|
||||||
|
CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target);
|
||||||
|
|
||||||
|
/* Sorts the members of the object into alphabetical order. */
|
||||||
|
CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
|
||||||
|
CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
BIN
IOBox/Backup/v1.1.0/flow_chart.jpg
Normal file
|
After Width: | Height: | Size: 118 KiB |
1304
IOBox/Backup/v1.1.0/iobox_api.cpp
Normal file
101
IOBox/Backup/v1.1.0/iobox_api.h
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
#ifndef _IO_BOX_API_H_
|
||||||
|
#define _IO_BOX_API_H_
|
||||||
|
#define ANSIO_API __declspec(dllexport)
|
||||||
|
#include "extcode.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#include <chrono>
|
||||||
|
#include <mutex>
|
||||||
|
#pragma comment(lib,"WS2_32")
|
||||||
|
// #pragma comment(lib, "Ws2_32.lib")
|
||||||
|
// #define TEST_FIX_IP
|
||||||
|
#define DEVICE_TCP_PORT 502
|
||||||
|
#define DEVICE_DATA_ADDRESS 100
|
||||||
|
#define DEVICE_DATA_LENGTH 17
|
||||||
|
namespace ANSCENTER {
|
||||||
|
typedef struct {
|
||||||
|
std::string model;
|
||||||
|
std::string ip_address;
|
||||||
|
std::string ip_public_address; //public ip
|
||||||
|
std::string mac_address;
|
||||||
|
std::string serial_number;
|
||||||
|
std::string firmware_version;
|
||||||
|
std::string hardware_version;
|
||||||
|
std::vector<std::string> channelNameList;
|
||||||
|
} iobox_info_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int counting_get;
|
||||||
|
bool is_connected;
|
||||||
|
bool is_anthenticated;
|
||||||
|
SOCKET sock_tcp;
|
||||||
|
iobox_info_t iobox_info;
|
||||||
|
} iobox_profile_t;
|
||||||
|
class ANSIO_API iobox_api
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::recursive_mutex _mutex;
|
||||||
|
std::string ip_mcast; //ip multicast
|
||||||
|
int port_mcast; //port multicast
|
||||||
|
std::vector<iobox_profile_t> iobox_profiles;
|
||||||
|
iobox_profile_t* findProfileByIp(const std::string& ip);
|
||||||
|
void save_info_iobox(iobox_info_t iobox_info);
|
||||||
|
void setSocketTimeout(SOCKET sock, int timeout);
|
||||||
|
void sendMulticastMessage(const std::string& message);
|
||||||
|
bool sendTcpMessage(const std::string& ip, const char* buffer, size_t length, bool needCheckAuthen);
|
||||||
|
bool receiveTcpMessage(const std::string& ip, char* buffer, size_t& length);
|
||||||
|
void show_profile_iobox(iobox_profile_t profile);
|
||||||
|
bool connectToIoboxWithoutAuthen(const std::string& ip, int port);
|
||||||
|
void remove_last_info_iobox();
|
||||||
|
uint16_t getIndexIoboxFromIp(const std::string& ip);
|
||||||
|
public:
|
||||||
|
iobox_api(std::string ip_mcast, int port_mcast);
|
||||||
|
~iobox_api();
|
||||||
|
void show_profile_iobox(std::string ip);
|
||||||
|
void show_profile_ioboxs();
|
||||||
|
std::string generateToken(const std::string& ip);
|
||||||
|
std::vector<std::string> scanNetworkDevicesMulticast(int timeout);
|
||||||
|
bool setAuthenticationIobox(const std::string& ip, const std::string& username, const std::string& password);
|
||||||
|
bool resetAuthenticationIobox(const std::string& ip, const std::string& token);
|
||||||
|
bool resetIobox(const std::string& ip, const std::string& token);
|
||||||
|
std::string connectToIobox(const std::string& ip, int port, const std::string& username, const std::string& password);
|
||||||
|
bool disconnectToIobox(const std::string& ip);
|
||||||
|
std::vector<std::string> getDeviceChannelNames(const std::string& ip);
|
||||||
|
std::string getValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName);
|
||||||
|
bool setValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName, const std::string& value);
|
||||||
|
|
||||||
|
// RS232
|
||||||
|
bool openRS232(const std::string& ip, const std::string& port, int baudrate, int databits, int stopbits, int parity);
|
||||||
|
bool closeRS232(const std::string& ip);
|
||||||
|
bool writeRS232(const std::string& ip, std::string dataToSend, int timeout);
|
||||||
|
bool readRS232(const std::string& ip, std::string &receivedData, const std::string& terminateString,int timeout);
|
||||||
|
bool readRS232Bytes(const std::string& ip, std::string& receivedData, int numBytes, int timeout);
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
extern "C" ANSIO_API int CreateANSIOHandle(ANSCENTER::iobox_api** Handle, const char* multicastIPAddress, int multicastPort);
|
||||||
|
extern "C" ANSIO_API int ScanANSIOHandle(ANSCENTER::iobox_api** Handle, int timeout, LStrHandle ipAddresses);
|
||||||
|
extern "C" ANSIO_API int ConnectANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int ioBoxPort, const char* userName, const char* passWord, LStrHandle deviceStr);
|
||||||
|
extern "C" ANSIO_API int DisconnectANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP);
|
||||||
|
extern "C" ANSIO_API int GetChannelNamesANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int timeout, LStrHandle channelNames);
|
||||||
|
extern "C" ANSIO_API int SetValueANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, const char* value);
|
||||||
|
extern "C" ANSIO_API int GetValueANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, LStrHandle lStrValue);
|
||||||
|
extern "C" ANSIO_API int SetAuthenticationANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* userName, const char* passWord);
|
||||||
|
extern "C" ANSIO_API int ReleaseANSIOHandle(ANSCENTER::iobox_api** Handle);
|
||||||
|
extern "C" ANSIO_API int ResetAuthenticationANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* token);
|
||||||
|
extern "C" ANSIO_API int ResetANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* token);
|
||||||
|
extern "C" ANSIO_API int GenerateANSIOTokenHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, LStrHandle tokenStr);
|
||||||
|
|
||||||
|
// C++ interface
|
||||||
|
extern "C" ANSIO_API int ScanANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, int timeout, std::string& ipAddresses);
|
||||||
|
extern "C" ANSIO_API int GetChannelNamesANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int timeout, std::string& channelNames);
|
||||||
|
extern "C" ANSIO_API int GetValueANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, std::string& lStrValue);
|
||||||
|
extern "C" ANSIO_API int GenerateANSIOTokenHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, std::string& tokenStr);
|
||||||
|
extern "C" ANSIO_API int ConnectANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int ioBoxPort, const char* userName, const char* passWord, std::string& deviceStr);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
111
IOBox/Backup/v1.1.0/main.cpp
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
|
||||||
|
#include "iobox_api.h"
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
iobox_api ioBoxApp((char*)"239.255.255.250", 12345);
|
||||||
|
void userInputThread(iobox_api* api) {
|
||||||
|
std::string current_ip;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
std::string input;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << "Enter command followed by Enter: exit, scan, setip, connect, channels, disconnect, show, get, set, restart, setauthen, resetauthen" << std::endl;
|
||||||
|
// std::cin >> input; // This will only get the first word
|
||||||
|
std::getline(std::cin, input);
|
||||||
|
if (input == "exit") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(input == "scan") {
|
||||||
|
std::vector<std::string> devices = api->scanNetworkDevicesMulticast(5);
|
||||||
|
std::cout << "Found devices: " << devices.size() << std::endl;
|
||||||
|
for (const std::string& device : devices) {
|
||||||
|
std::cout << device << std::endl;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "setip") {
|
||||||
|
std::cout << "Enter IP: ";
|
||||||
|
std::getline(std::cin, current_ip);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "connect") {
|
||||||
|
if(current_ip == "") {
|
||||||
|
std::cout << "Please setip address first" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::string username, password;
|
||||||
|
std::cout << "Enter username: ";
|
||||||
|
std::cin >> username;
|
||||||
|
std::cout << "Enter password: ";
|
||||||
|
std::cin >> password;
|
||||||
|
bool connect = api->connectToIobox(current_ip, DEVICE_TCP_PORT, username, password);
|
||||||
|
std::cout << "Connection to " << current_ip << (connect ? " succeeded." : " failed.") << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "disconnect") {
|
||||||
|
bool disconnect = api->disconnectToIobox(current_ip);
|
||||||
|
std::cout << "Disconnect to " << current_ip << (disconnect ? " succeeded." : " failed.") << std::endl;
|
||||||
|
// current_ip = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "show") {
|
||||||
|
api->show_profile_ioboxs();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "get") {
|
||||||
|
std::string channel;
|
||||||
|
std::cout << "Enter channel: ";
|
||||||
|
std::cin >> channel;
|
||||||
|
std::string value = api->getValueDataStringIoboxFromChannelName(current_ip, channel);
|
||||||
|
std::cout << "Value of " << channel << ": " << value << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "set") {
|
||||||
|
std::string value;
|
||||||
|
std::string channel;
|
||||||
|
std::cout << "Enter channel: ";
|
||||||
|
std::cin >> channel;
|
||||||
|
std::cout << "Enter value: ";
|
||||||
|
std::cin >> value;
|
||||||
|
bool set = api->setValueDataStringIoboxFromChannelName(current_ip, channel, value);
|
||||||
|
std::cout << "Set value to " << current_ip << (set ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "restart") {
|
||||||
|
std::string token = api->generateToken(current_ip);
|
||||||
|
bool reset = api->resetIobox(current_ip, token);
|
||||||
|
std::cout << "Restart " << current_ip << (reset ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "setauthen") {
|
||||||
|
std::string username, password;
|
||||||
|
std::cout << "Enter username: ";
|
||||||
|
std::cin >> username;
|
||||||
|
std::cout << "Enter password: ";
|
||||||
|
std::cin >> password;
|
||||||
|
bool set = api->setAuthenticationIobox(current_ip, username, password);
|
||||||
|
std::cout << "Set authentication to " << current_ip << (set ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "resetauthen") {
|
||||||
|
std::string token = api->generateToken(current_ip);
|
||||||
|
bool reset = api->resetAuthenticationIobox(current_ip, token);
|
||||||
|
std::cout << "Reset authentication to " << current_ip << (reset ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "channels") {
|
||||||
|
std::vector<std::string> channels = api->getDeviceChannelNames(current_ip);
|
||||||
|
std::cout << "Channels of " << current_ip << std::endl;
|
||||||
|
for(const std::string& channel : channels) {
|
||||||
|
std::cout << channel << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// std::cout << "Invalid command" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
std::thread userThread(userInputThread, &ioBoxApp);
|
||||||
|
userThread.join();
|
||||||
|
|
||||||
|
std::cout << "Main thread is done" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
68
IOBox/Backup/v1.1.0/readme.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
|
||||||
|
### IOBOX API USAGE GUIDE
|
||||||
|
This document provides an overview and usage instructions for the APIs available in `iobox_api.h`.
|
||||||
|
#### 1. Api name and features
|
||||||
|
* Scan
|
||||||
|
|
||||||
|
`std::vector<std::string> scanNetworkDevicesMulticast(int timeout);`
|
||||||
|
|
||||||
|
API need to be passed a timeout in second unit. The API will return a list of IPs as a vector string.
|
||||||
|
* Connect
|
||||||
|
|
||||||
|
`bool connectToIobox(const std::string& ip, int port, const std::string& username, const std::string& password);`
|
||||||
|
|
||||||
|
Connect to a specific IP device from list of IPs above. Default port is 502
|
||||||
|
Username and password are param to anthenticate device
|
||||||
|
|
||||||
|
* Disconnect
|
||||||
|
|
||||||
|
`bool disconnectToIobox(const std::string& ip);`
|
||||||
|
|
||||||
|
Disconnect to a specific IP device that is connected before
|
||||||
|
|
||||||
|
* Get value of channel
|
||||||
|
|
||||||
|
`std::string getValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName);`
|
||||||
|
|
||||||
|
Get value of specific channel name from a IP device that is connected before.
|
||||||
|
List of channel name is obtained from `getDeviceChannelNames` api
|
||||||
|
|
||||||
|
* Set value of channel
|
||||||
|
|
||||||
|
`bool setValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName, const std::string& value);`
|
||||||
|
|
||||||
|
Set a value of specific channel name from a IP device that is connected before. List of channel name is included in `channel_name` array.
|
||||||
|
* Other api
|
||||||
|
`bool setAuthenticationIobox(const std::string& ip, const std::string& username, const std::string& password);`
|
||||||
|
This api to change username and password, this can be only called after a connection to device
|
||||||
|
|
||||||
|
`bool resetAuthenticationIobox(const std::string& ip, const std::string& token);`
|
||||||
|
This api to reset username and password to default
|
||||||
|
|
||||||
|
`bool resetIobox(const std::string& ip, const std::string& token);`
|
||||||
|
This api to restart device
|
||||||
|
`token` is generated default by using `generateToken` api
|
||||||
|
#### 2. How to using example test in main.cpp
|
||||||
|
|
||||||
|
You need build this project before run by using g++ compiler
|
||||||
|
|
||||||
|
`g++ .\*.cpp .\*.c -lws2_32 -o main.exe`
|
||||||
|
|
||||||
|
Then you need only running `main.exe`.
|
||||||
|
|
||||||
|
Start application, it will show
|
||||||
|
|
||||||
|
`Enter command followed by Enter: exit, scan, setip, connect, channels, disconnect, show, get, set, restart, setauthen, resetauthen`
|
||||||
|
|
||||||
|
* You type `scan`, it will scan all device iobox on local network then it will list them on terminal attach their IP address if they is found.
|
||||||
|
* You type `channels` to get name of all of channels that device supports
|
||||||
|
* Then type `setip` to setup IP of iobox you need to connect
|
||||||
|
Then you will be required to input of specific IP address and you need type IP you want.
|
||||||
|
* Next you type `connect` to connect to this IP device
|
||||||
|
* Then you can use `get` or `set` command to continue get or set value to any channel.
|
||||||
|
* You can use `setauthen` and `resetauthen` to change usename/password to connect device, and reset usename/password to default (now default in device is: admin/1234)
|
||||||
|
* You can use `restart` to restart devcie
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2590
IOBox/banve.pdf
Normal file
3143
IOBox/cJSON.c
Normal file
300
IOBox/cJSON.h
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cJSON__h
|
||||||
|
#define cJSON__h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||||
|
#define __WINDOWS__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
|
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||||
|
|
||||||
|
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||||
|
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||||
|
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||||
|
|
||||||
|
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||||
|
|
||||||
|
setting default visibility to hidden by adding
|
||||||
|
-fvisibility=hidden (for gcc)
|
||||||
|
or
|
||||||
|
-xldscope=hidden (for sun cc)
|
||||||
|
to CFLAGS
|
||||||
|
|
||||||
|
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CJSON_CDECL __cdecl
|
||||||
|
#define CJSON_STDCALL __stdcall
|
||||||
|
|
||||||
|
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||||
|
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_EXPORT_SYMBOLS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CJSON_HIDE_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||||
|
#endif
|
||||||
|
#else /* !__WINDOWS__ */
|
||||||
|
#define CJSON_CDECL
|
||||||
|
#define CJSON_STDCALL
|
||||||
|
|
||||||
|
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||||
|
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||||
|
#else
|
||||||
|
#define CJSON_PUBLIC(type) type
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* project version */
|
||||||
|
#define CJSON_VERSION_MAJOR 1
|
||||||
|
#define CJSON_VERSION_MINOR 7
|
||||||
|
#define CJSON_VERSION_PATCH 18
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* cJSON Types: */
|
||||||
|
#define cJSON_Invalid (0)
|
||||||
|
#define cJSON_False (1 << 0)
|
||||||
|
#define cJSON_True (1 << 1)
|
||||||
|
#define cJSON_NULL (1 << 2)
|
||||||
|
#define cJSON_Number (1 << 3)
|
||||||
|
#define cJSON_String (1 << 4)
|
||||||
|
#define cJSON_Array (1 << 5)
|
||||||
|
#define cJSON_Object (1 << 6)
|
||||||
|
#define cJSON_Raw (1 << 7) /* raw json */
|
||||||
|
|
||||||
|
#define cJSON_IsReference 256
|
||||||
|
#define cJSON_StringIsConst 512
|
||||||
|
|
||||||
|
/* The cJSON structure: */
|
||||||
|
typedef struct cJSON
|
||||||
|
{
|
||||||
|
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||||
|
struct cJSON *next;
|
||||||
|
struct cJSON *prev;
|
||||||
|
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||||
|
struct cJSON *child;
|
||||||
|
|
||||||
|
/* The type of the item, as above. */
|
||||||
|
int type;
|
||||||
|
|
||||||
|
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||||
|
char *valuestring;
|
||||||
|
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||||
|
int valueint;
|
||||||
|
/* The item's number, if type==cJSON_Number */
|
||||||
|
double valuedouble;
|
||||||
|
|
||||||
|
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||||
|
char *string;
|
||||||
|
} cJSON;
|
||||||
|
|
||||||
|
typedef struct cJSON_Hooks
|
||||||
|
{
|
||||||
|
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||||
|
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||||
|
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||||
|
} cJSON_Hooks;
|
||||||
|
|
||||||
|
typedef int cJSON_bool;
|
||||||
|
|
||||||
|
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||||
|
* This is to prevent stack overflows. */
|
||||||
|
#ifndef CJSON_NESTING_LIMIT
|
||||||
|
#define CJSON_NESTING_LIMIT 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* returns the version of cJSON as a string */
|
||||||
|
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||||
|
|
||||||
|
/* Supply malloc, realloc and free functions to cJSON */
|
||||||
|
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||||
|
|
||||||
|
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||||
|
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
|
||||||
|
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||||
|
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||||
|
|
||||||
|
/* Render a cJSON entity to text for transfer/storage. */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||||
|
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||||
|
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||||
|
/* Delete a cJSON entity and all subentities. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
|
||||||
|
|
||||||
|
/* Returns the number of items in an array (or object). */
|
||||||
|
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||||
|
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||||
|
/* Get item "string" from object. Case insensitive. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||||
|
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||||
|
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||||
|
|
||||||
|
/* Check item type and return its value */
|
||||||
|
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
|
||||||
|
|
||||||
|
/* These functions check the type of an item */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||||
|
|
||||||
|
/* These calls create a cJSON item of the appropriate type. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
|
||||||
|
/* raw json */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
|
||||||
|
|
||||||
|
/* Create a string where valuestring references a string so
|
||||||
|
* it will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
|
||||||
|
/* Create an object/array that only references it's elements so
|
||||||
|
* they will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
|
||||||
|
|
||||||
|
/* These utilities create an Array of count items.
|
||||||
|
* The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
|
||||||
|
|
||||||
|
/* Append item to the specified array/object. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||||
|
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||||
|
* writing to `item->string` */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
|
||||||
|
/* Remove/Detach items from Arrays/Objects. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
|
||||||
|
/* Update array items. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||||
|
|
||||||
|
/* Duplicate a cJSON item */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||||
|
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||||
|
* need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||||
|
* The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||||
|
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||||
|
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||||
|
|
||||||
|
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
|
||||||
|
* The input pointer json cannot point to a read-only address area, such as a string constant,
|
||||||
|
* but should point to a readable and writable address area. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||||
|
|
||||||
|
/* Helper functions for creating and adding items to an object at the same time.
|
||||||
|
* They return the added item or NULL on failure. */
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
|
||||||
|
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
|
||||||
|
|
||||||
|
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||||
|
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||||
|
/* helper for the cJSON_SetNumberValue macro */
|
||||||
|
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||||
|
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||||
|
/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
|
||||||
|
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
|
||||||
|
|
||||||
|
/* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/
|
||||||
|
#define cJSON_SetBoolValue(object, boolValue) ( \
|
||||||
|
(object != NULL && ((object)->type & (cJSON_False|cJSON_True))) ? \
|
||||||
|
(object)->type=((object)->type &(~(cJSON_False|cJSON_True)))|((boolValue)?cJSON_True:cJSON_False) : \
|
||||||
|
cJSON_Invalid\
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Macro for iterating over an array or object */
|
||||||
|
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||||
|
|
||||||
|
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||||
|
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||||
|
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
1481
IOBox/cJSON_Utils.c
Normal file
88
IOBox/cJSON_Utils.h
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cJSON_Utils__h
|
||||||
|
#define cJSON_Utils__h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cJSON.h"
|
||||||
|
|
||||||
|
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *pointer);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointerCaseSensitive(cJSON * const object, const char *pointer);
|
||||||
|
|
||||||
|
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
|
||||||
|
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to);
|
||||||
|
/* Utility for generating patch array entries. */
|
||||||
|
CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value);
|
||||||
|
/* Returns 0 for success. */
|
||||||
|
CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches);
|
||||||
|
CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use:
|
||||||
|
//int cJSONUtils_AtomicApplyPatches(cJSON **object, cJSON *patches)
|
||||||
|
//{
|
||||||
|
// cJSON *modme = cJSON_Duplicate(*object, 1);
|
||||||
|
// int error = cJSONUtils_ApplyPatches(modme, patches);
|
||||||
|
// if (!error)
|
||||||
|
// {
|
||||||
|
// cJSON_Delete(*object);
|
||||||
|
// *object = modme;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// cJSON_Delete(modme);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return error;
|
||||||
|
//}
|
||||||
|
// Code not added to library since this strategy is a LOT slower.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */
|
||||||
|
/* target will be modified by patch. return value is new ptr for target. */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatch(cJSON *target, const cJSON * const patch);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON * const patch);
|
||||||
|
/* generates a patch to move from -> to */
|
||||||
|
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatch(cJSON * const from, cJSON * const to);
|
||||||
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON * const from, cJSON * const to);
|
||||||
|
|
||||||
|
/* Given a root object and a target object, construct a pointer from one to the other. */
|
||||||
|
CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target);
|
||||||
|
|
||||||
|
/* Sorts the members of the object into alphabetical order. */
|
||||||
|
CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
|
||||||
|
CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
BIN
IOBox/flow_chart.jpg
Normal file
|
After Width: | Height: | Size: 118 KiB |
3354
IOBox/iobox_api.cpp
Normal file
215
IOBox/iobox_api.h
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
#ifndef _IO_BOX_API_H_
|
||||||
|
#define _IO_BOX_API_H_
|
||||||
|
#define ANSIO_API __declspec(dllexport)
|
||||||
|
#include "LabVIEWHeader/extcode.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <mutex>
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#include <iphlpapi.h> // For PIP_ADAPTER_INFO
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include "ANSLicense.h"
|
||||||
|
#pragma comment(lib,"WS2_32")
|
||||||
|
#pragma comment(lib, "Iphlpapi.lib")
|
||||||
|
|
||||||
|
// #pragma comment(lib, "Ws2_32.lib")
|
||||||
|
// #define TEST_FIX_IP
|
||||||
|
#define DEVICE_TCP_PORT 502
|
||||||
|
#define DEVICE_DATA_ADDRESS 100
|
||||||
|
#define DEVICE_DATA_LENGTH 17
|
||||||
|
#define MESSAGE_CRYPT_ENABLE 0
|
||||||
|
|
||||||
|
// Configuration constants - make these configurable if needed
|
||||||
|
namespace IoboxConfig {
|
||||||
|
constexpr int MAX_RETRIES = 30; // Reduced from 50 for better timeout control
|
||||||
|
constexpr int RETRY_DELAY_MS = 100; // Increased from 50ms for better reliability
|
||||||
|
constexpr int TOTAL_TIMEOUT_MS = 3000; // 3 seconds total timeout
|
||||||
|
}
|
||||||
|
namespace ANSCENTER {
|
||||||
|
typedef struct {
|
||||||
|
std::string model;
|
||||||
|
std::string ip_address; //local ip
|
||||||
|
std::string ip_public_address; //public ip
|
||||||
|
std::string mac_address;
|
||||||
|
std::string serial_number;
|
||||||
|
std::string firmware_version;
|
||||||
|
std::string hardware_version;
|
||||||
|
std::vector<std::string> channelNameList;
|
||||||
|
} iobox_info_t;
|
||||||
|
typedef struct {
|
||||||
|
int counting_get;
|
||||||
|
bool is_connected;
|
||||||
|
bool is_anthenticated;
|
||||||
|
SOCKET sock_tcp;
|
||||||
|
iobox_info_t iobox_info;
|
||||||
|
} iobox_profile_t;
|
||||||
|
typedef struct {
|
||||||
|
std::string adapter_index;
|
||||||
|
std::string adapter_name;
|
||||||
|
std::string adapter_description;
|
||||||
|
std::string adapter_mac;
|
||||||
|
std::string adapter_ip;
|
||||||
|
std::string adapter_subnet;
|
||||||
|
std::string adapter_gateway;
|
||||||
|
} network_adapter_t;
|
||||||
|
class ANSIO_API iobox_api
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Define the map with MAC address as key and IP address as value
|
||||||
|
std::unordered_map<std::string, std::string> macToIpMap;
|
||||||
|
// Define unordered_map to store IP address and device information (std:vector<std::string>)
|
||||||
|
std::unordered_map<std::string, std::vector<std::string>> ipToDeviceMap;
|
||||||
|
std::string ip_mcast; //ip multicast
|
||||||
|
int port_mcast; //port multicast
|
||||||
|
std::string _username; // default username
|
||||||
|
std::string _password; // default password
|
||||||
|
int _port;
|
||||||
|
const char* aes_key = "a1b2c3d4e5f6g7h8";
|
||||||
|
std::recursive_mutex _mutex;
|
||||||
|
std::vector<iobox_profile_t> iobox_profiles;
|
||||||
|
iobox_profile_t* findProfileByIp(const std::string& ip);
|
||||||
|
void save_info_iobox(const iobox_info_t& iobox_info);
|
||||||
|
void setSocketTimeout(SOCKET sock, int timeout);
|
||||||
|
void sendUnicastMessage(SOCKET sock, const char* ip, const std::string& message);
|
||||||
|
void sendMulticastMessage(const std::string& message);
|
||||||
|
bool sendTcpMessage(const std::string& ip, const char* buffer, size_t length, bool needCheckAuthen);
|
||||||
|
bool receiveTcpMessage(const std::string& ip, char* buffer, size_t& length, int timeout = 3000);
|
||||||
|
void show_profile_iobox(const iobox_profile_t& profile);
|
||||||
|
bool connectToIoboxWithoutAuthen(const std::string& remote, int port);
|
||||||
|
void remove_last_info_iobox();
|
||||||
|
uint16_t getIndexIoboxFromIp(const std::string& ip);
|
||||||
|
std::vector<std::string> scanNetworkDevicesManuallyOnNetworkAdapter(network_adapter_t adapter, int timeout);
|
||||||
|
std::vector<network_adapter_t> getNetworkAdapters();
|
||||||
|
bool performSetValue(const std::string& ip, const std::string& channelName, const std::string& value);
|
||||||
|
bool performGetValue(const std::string& ip, const std::string& channelName, std::string& outValue);
|
||||||
|
bool disconnectToIobox(const std::string& remote);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
SPDLogger& _logger = SPDLogger::GetInstance("IOBOX", true);
|
||||||
|
struct ToggleInfo {
|
||||||
|
std::chrono::steady_clock::time_point endTime;
|
||||||
|
std::string originalState;
|
||||||
|
bool revertFlag;
|
||||||
|
std::atomic<bool> active{ true };
|
||||||
|
std::atomic<bool> cancelled{ false };
|
||||||
|
std::mutex mtx;
|
||||||
|
std::condition_variable cv;
|
||||||
|
|
||||||
|
// Constructor for better initialization
|
||||||
|
ToggleInfo(bool revert = false) : revertFlag(revert) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unordered_map<std::string, std::shared_ptr<ToggleInfo>> activeToggles;
|
||||||
|
std::mutex toggleMapMutex;
|
||||||
|
|
||||||
|
bool executeToggleOperation(const std::string& remote, const std::string& channelName,
|
||||||
|
std::shared_ptr<ToggleInfo> toggleInfo, const std::string& key);
|
||||||
|
public:
|
||||||
|
iobox_api(const std::string& ip_mcast, int port_mcast);
|
||||||
|
~iobox_api() noexcept;
|
||||||
|
void show_profile_iobox(const std::string& remote);
|
||||||
|
void show_profile_ioboxs();
|
||||||
|
[[nodiscard]] std::string generateToken(const std::string& remote);
|
||||||
|
[[nodiscard]] std::vector<std::string> scanNetworkDevicesMulticast(int timeout);
|
||||||
|
[[nodiscard]] std::vector<std::string> scanNetworkDevicesManually(int timeout);
|
||||||
|
[[nodiscard]] std::vector<std::string> CreateDeviceChannel(const std::string& multicastInfo);
|
||||||
|
|
||||||
|
bool setAuthenticationIobox(const std::string& remote, const std::string& username, const std::string& password);
|
||||||
|
bool resetAuthenticationIobox(const std::string& remote, const std::string& token);
|
||||||
|
bool resetIobox(const std::string& remote, const std::string& token);
|
||||||
|
[[nodiscard]] std::string connectToIobox(const std::string& remote, int port, const std::string& username, const std::string& password);
|
||||||
|
bool disconnectToIoboxWithResetOutputs(const std::string& remote);
|
||||||
|
|
||||||
|
[[nodiscard]] std::vector<std::string> getDeviceChannelNames(const std::string& remote);
|
||||||
|
bool getValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName, std::string& outValue);
|
||||||
|
bool setValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName, const std::string& value);
|
||||||
|
bool checkTcpConnectStatus(const std::string& remote);
|
||||||
|
bool setValue(const std::string& remote, const std::string& channelName, const std::string& value);// Repeat until success or timeout (3s)
|
||||||
|
bool getValue(const std::string& remote, const std::string& channelName, std::string& outValue);// Repeat until success or timeout (3s)
|
||||||
|
|
||||||
|
//for RS232
|
||||||
|
bool openRs232Port(const std::string& remote, int baudrate, int dataBits, int stopBits, int parityBits);
|
||||||
|
bool closeRs232Port(const std::string& remote);
|
||||||
|
bool writeRs232Port(const std::string& remote, const std::string& data, int timeout_ms);
|
||||||
|
[[nodiscard]] std::string readRs232Port(const std::string& remote, const std::string& terminatorString, int lenExpect, int timeout_ms);
|
||||||
|
|
||||||
|
//for ota: type is "esp" or "mcu"
|
||||||
|
bool otaFirmwareDevice(const std::string& remote, const std::string& filename, const std::string& type);
|
||||||
|
|
||||||
|
// advanced functions (it can connect to ip or mac address and return device channel names)
|
||||||
|
[[nodiscard]] std::vector<std::string> advancedConnectToIobox(const std::string& remote, int port, const std::string& macAddress, const std::string& username, const std::string& password);
|
||||||
|
[[nodiscard]] std::vector<std::string> advancedScan(int timeout);
|
||||||
|
// Add to public section:
|
||||||
|
bool toggleIobox(const std::string& remote, const std::string& channelName, int timeOut,bool revertFlag, bool resetFlag, bool asyncMode = false);
|
||||||
|
bool cancelToggle(const std::string& remote, const std::string& channelName);
|
||||||
|
[[nodiscard]] std::vector<std::string> getActiveToggleChannels();
|
||||||
|
bool getToggleStatus(const std::string& remote, const std::string& channelName,int& remainingTimeMs, std::string& currentPhase);
|
||||||
|
|
||||||
|
// new functions
|
||||||
|
[[nodiscard]] std::vector<std::string> getStaticIpConfig(const std::string& remote);
|
||||||
|
bool setStaticIpConfig(const std::string& remote, bool enable, const std::string& ip, const std::string& gw, const std::string& nm);
|
||||||
|
[[nodiscard]] std::string getValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName);
|
||||||
|
bool toggleDigitalOutput(const std::string& remote, const std::string& channelName, const std::string& milliseconds, bool invert, bool reset);
|
||||||
|
bool setAIBValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName, const std::string& value);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
extern "C" ANSIO_API int CreateANSIOHandle(ANSCENTER::iobox_api** Handle, const char* multicastIPAddress, int multicastPort);
|
||||||
|
extern "C" ANSIO_API int ScanANSIOHandle(ANSCENTER::iobox_api** Handle, int timeout, LStrHandle ipAddresses);
|
||||||
|
extern "C" ANSIO_API int ScanANSIOUnicastHandle(ANSCENTER::iobox_api** Handle, int timeout, LStrHandle ipAddresses);
|
||||||
|
extern "C" ANSIO_API int AdvancedScanANSIOHandle(ANSCENTER::iobox_api** Handle, int timeout, LStrHandle deviceInfos);
|
||||||
|
extern "C" ANSIO_API int AdvancedStaticScanANSIOHandle(int timeout, LStrHandle deviceInfos);
|
||||||
|
|
||||||
|
extern "C" ANSIO_API int ConnectANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int ioBoxPort, const char* userName, const char* passWord, LStrHandle deviceStr);
|
||||||
|
extern "C" ANSIO_API int AdvancedConnectANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int ioBoxPort, const char* ioSN, const char* userName, const char* passWord, LStrHandle deviceStr);
|
||||||
|
|
||||||
|
extern "C" ANSIO_API int DisconnectANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP);
|
||||||
|
extern "C" ANSIO_API int GetChannelNamesANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int timeout, LStrHandle channelNames);
|
||||||
|
extern "C" ANSIO_API int SetValueANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, const char* value);
|
||||||
|
extern "C" ANSIO_API int GetValueANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, LStrHandle lStrValue);
|
||||||
|
extern "C" ANSIO_API int SetAuthenticationANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* userName, const char* passWord);
|
||||||
|
extern "C" ANSIO_API int ReleaseANSIOHandle(ANSCENTER::iobox_api** Handle);
|
||||||
|
extern "C" ANSIO_API int ResetAuthenticationANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* token);
|
||||||
|
extern "C" ANSIO_API int ResetANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* token);
|
||||||
|
extern "C" ANSIO_API int GenerateANSIOTokenHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, LStrHandle tokenStr);
|
||||||
|
extern "C" ANSIO_API int CheckANSIOStatusHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP);
|
||||||
|
|
||||||
|
// RS232
|
||||||
|
extern "C" ANSIO_API int OpenANSAIRS232Port(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int baudrate, int DataBits, int stopBits, int parityBits );
|
||||||
|
extern "C" ANSIO_API int CloseANSAIRS232Port(ANSCENTER::iobox_api** Handle, const char* ioBoxIP);
|
||||||
|
extern "C" ANSIO_API int WriteANSAIRS232Port(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* data, int timeout_ms);
|
||||||
|
extern "C" ANSIO_API int ReadANSAIRS232Port(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* terminatorString, int lenExpect, int timeout_ms, LStrHandle receivedData);
|
||||||
|
|
||||||
|
// OTA
|
||||||
|
extern "C" ANSIO_API int OTAANSIOFirmwareDevice(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* filename, const char* type);
|
||||||
|
|
||||||
|
// C++ interface
|
||||||
|
extern "C" ANSIO_API int ScanANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, int timeout, std::string& ipAddresses);
|
||||||
|
extern "C" ANSIO_API int ScanANSIOUnicastHandle_CPP(ANSCENTER::iobox_api** Handle, int timeout, std::string& ipAddresses);
|
||||||
|
extern "C" ANSIO_API int AdvancedScanANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, int timeout, std::string& deviceInfos);
|
||||||
|
extern "C" ANSIO_API int AdvancedStaticScanANSIOHandle_CPP(int timeout, std::string& deviceInfos);
|
||||||
|
|
||||||
|
extern "C" ANSIO_API int GetChannelNamesANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int timeout, std::string& channelNames);
|
||||||
|
extern "C" ANSIO_API int GetValueANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, std::string& lStrValue);
|
||||||
|
extern "C" ANSIO_API int GenerateANSIOTokenHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, std::string& tokenStr);
|
||||||
|
extern "C" ANSIO_API int ConnectANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int ioBoxPort, const char* userName, const char* passWord, std::string& deviceStr);
|
||||||
|
extern "C" ANSIO_API int AdvancedConnectANSIOHandle_CPP(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int ioBoxPort, const char* ioBoxSN, const char* userName, const char* passWord, std::string& deviceStr);
|
||||||
|
|
||||||
|
// toggle
|
||||||
|
extern "C" ANSIO_API int ToggleIoboxHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, int timeOut, int revertFlag, int resetFlag);
|
||||||
|
extern "C" ANSIO_API int ToggleIoboxHandleAsync(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, int timeOut, int revertFlag, int resetFlag);
|
||||||
|
|
||||||
|
// new functions
|
||||||
|
extern "C" ANSIO_API int GetStaticIpConfigANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, LStrHandle staticIpConfigInfo);
|
||||||
|
extern "C" ANSIO_API int SetStaticIpConfigANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, int enable, const char* ip, const char* gw, const char* nm);
|
||||||
|
extern "C" ANSIO_API int GetValueDataStringIoboxFromChannelNameANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, LStrHandle dataValue);
|
||||||
|
extern "C" ANSIO_API int ToggleDigitalOutputANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, int milliseconds, int invertFlag, int resetFlag);
|
||||||
|
extern "C" ANSIO_API int SetAIBValueDataStringIoboxFromChannelNameANSIOHandle(ANSCENTER::iobox_api** Handle, const char* ioBoxIP, const char* channelName, const char* value);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
111
IOBox/main.cpp
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
|
||||||
|
#include "iobox_api.h"
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
iobox_api ioBoxApp((char*)"239.255.255.250", 12345);
|
||||||
|
void userInputThread(iobox_api* api) {
|
||||||
|
std::string current_ip;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
std::string input;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << "Enter command followed by Enter: exit, scan, setip, connect, channels, disconnect, show, get, set, restart, setauthen, resetauthen" << std::endl;
|
||||||
|
// std::cin >> input; // This will only get the first word
|
||||||
|
std::getline(std::cin, input);
|
||||||
|
if (input == "exit") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(input == "scan") {
|
||||||
|
std::vector<std::string> devices = api->scanNetworkDevicesMulticast(5);
|
||||||
|
std::cout << "Found devices: " << devices.size() << std::endl;
|
||||||
|
for (const std::string& device : devices) {
|
||||||
|
std::cout << device << std::endl;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "setip") {
|
||||||
|
std::cout << "Enter IP: ";
|
||||||
|
std::getline(std::cin, current_ip);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "connect") {
|
||||||
|
if(current_ip == "") {
|
||||||
|
std::cout << "Please setip address first" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::string username, password;
|
||||||
|
std::cout << "Enter username: ";
|
||||||
|
std::cin >> username;
|
||||||
|
std::cout << "Enter password: ";
|
||||||
|
std::cin >> password;
|
||||||
|
bool connect = api->connectToIobox(current_ip, DEVICE_TCP_PORT, username, password);
|
||||||
|
std::cout << "Connection to " << current_ip << (connect ? " succeeded." : " failed.") << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "disconnect") {
|
||||||
|
bool disconnect = api->disconnectToIobox(current_ip);
|
||||||
|
std::cout << "Disconnect to " << current_ip << (disconnect ? " succeeded." : " failed.") << std::endl;
|
||||||
|
// current_ip = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "show") {
|
||||||
|
api->show_profile_ioboxs();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "get") {
|
||||||
|
std::string channel;
|
||||||
|
std::cout << "Enter channel: ";
|
||||||
|
std::cin >> channel;
|
||||||
|
std::string value = api->getValueDataStringIoboxFromChannelName(current_ip, channel);
|
||||||
|
std::cout << "Value of " << channel << ": " << value << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(input == "set") {
|
||||||
|
std::string value;
|
||||||
|
std::string channel;
|
||||||
|
std::cout << "Enter channel: ";
|
||||||
|
std::cin >> channel;
|
||||||
|
std::cout << "Enter value: ";
|
||||||
|
std::cin >> value;
|
||||||
|
bool set = api->setValueDataStringIoboxFromChannelName(current_ip, channel, value);
|
||||||
|
std::cout << "Set value to " << current_ip << (set ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "restart") {
|
||||||
|
std::string token = api->generateToken(current_ip);
|
||||||
|
bool reset = api->resetIobox(current_ip, token);
|
||||||
|
std::cout << "Restart " << current_ip << (reset ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "setauthen") {
|
||||||
|
std::string username, password;
|
||||||
|
std::cout << "Enter username: ";
|
||||||
|
std::cin >> username;
|
||||||
|
std::cout << "Enter password: ";
|
||||||
|
std::cin >> password;
|
||||||
|
bool set = api->setAuthenticationIobox(current_ip, username, password);
|
||||||
|
std::cout << "Set authentication to " << current_ip << (set ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "resetauthen") {
|
||||||
|
std::string token = api->generateToken(current_ip);
|
||||||
|
bool reset = api->resetAuthenticationIobox(current_ip, token);
|
||||||
|
std::cout << "Reset authentication to " << current_ip << (reset ? " succeeded." : " failed.") << std::endl;
|
||||||
|
}
|
||||||
|
else if(input == "channels") {
|
||||||
|
std::vector<std::string> channels = api->getDeviceChannelNames(current_ip);
|
||||||
|
std::cout << "Channels of " << current_ip << std::endl;
|
||||||
|
for(const std::string& channel : channels) {
|
||||||
|
std::cout << channel << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// std::cout << "Invalid command" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
std::thread userThread(userInputThread, &ioBoxApp);
|
||||||
|
userThread.join();
|
||||||
|
|
||||||
|
std::cout << "Main thread is done" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1490
IOBox/mbedtls/aes.c
Normal file
297
IOBox/mbedtls/aes.h
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
/**
|
||||||
|
* \file aes.h
|
||||||
|
*
|
||||||
|
* \brief AES block cipher
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
#ifndef MBEDTLS_AES_H
|
||||||
|
#define MBEDTLS_AES_H
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||||
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include MBEDTLS_CONFIG_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* padlock.c and aesni.c rely on these values! */
|
||||||
|
#define MBEDTLS_AES_ENCRYPT 1
|
||||||
|
#define MBEDTLS_AES_DECRYPT 0
|
||||||
|
|
||||||
|
#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */
|
||||||
|
#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_AES_ALT)
|
||||||
|
// Regular implementation
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief AES context structure
|
||||||
|
*
|
||||||
|
* \note buf is able to hold 32 extra bytes, which can be used:
|
||||||
|
* - for alignment purposes if VIA padlock is used, and/or
|
||||||
|
* - to simplify key expansion in the 256-bit case by
|
||||||
|
* generating an extra round key
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int nr; /*!< number of rounds */
|
||||||
|
uint32_t *rk; /*!< AES round keys */
|
||||||
|
uint32_t buf[68]; /*!< unaligned data */
|
||||||
|
}
|
||||||
|
mbedtls_aes_context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initialize AES context
|
||||||
|
*
|
||||||
|
* \param ctx AES context to be initialized
|
||||||
|
*/
|
||||||
|
void mbedtls_aes_init( mbedtls_aes_context *ctx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Clear AES context
|
||||||
|
*
|
||||||
|
* \param ctx AES context to be cleared
|
||||||
|
*/
|
||||||
|
void mbedtls_aes_free( mbedtls_aes_context *ctx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief AES key schedule (encryption)
|
||||||
|
*
|
||||||
|
* \param ctx AES context to be initialized
|
||||||
|
* \param key encryption key
|
||||||
|
* \param keybits must be 128, 192 or 256
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
|
||||||
|
unsigned int keybits );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief AES key schedule (decryption)
|
||||||
|
*
|
||||||
|
* \param ctx AES context to be initialized
|
||||||
|
* \param key decryption key
|
||||||
|
* \param keybits must be 128, 192 or 256
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
|
||||||
|
unsigned int keybits );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief AES-ECB block encryption/decryption
|
||||||
|
*
|
||||||
|
* \param ctx AES context
|
||||||
|
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||||
|
* \param input 16-byte input block
|
||||||
|
* \param output 16-byte output block
|
||||||
|
*
|
||||||
|
* \return 0 if successful
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
|
||||||
|
int mode,
|
||||||
|
const unsigned char input[16],
|
||||||
|
unsigned char output[16] );
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||||
|
/**
|
||||||
|
* \brief AES-CBC buffer encryption/decryption
|
||||||
|
* Length should be a multiple of the block
|
||||||
|
* size (16 bytes)
|
||||||
|
*
|
||||||
|
* \note Upon exit, the content of the IV is updated so that you can
|
||||||
|
* call the function same function again on the following
|
||||||
|
* block(s) of data and get the same result as if it was
|
||||||
|
* encrypted in one call. This allows a "streaming" usage.
|
||||||
|
* If on the other hand you need to retain the contents of the
|
||||||
|
* IV, you should either save it manually or use the cipher
|
||||||
|
* module instead.
|
||||||
|
*
|
||||||
|
* \param ctx AES context
|
||||||
|
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||||
|
* \param length length of the input data
|
||||||
|
* \param iv initialization vector (updated after use)
|
||||||
|
* \param input buffer holding the input data
|
||||||
|
* \param output buffer holding the output data
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
|
||||||
|
int mode,
|
||||||
|
size_t length,
|
||||||
|
unsigned char iv[16],
|
||||||
|
const unsigned char *input,
|
||||||
|
unsigned char *output );
|
||||||
|
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||||
|
/**
|
||||||
|
* \brief AES-CFB128 buffer encryption/decryption.
|
||||||
|
*
|
||||||
|
* Note: Due to the nature of CFB you should use the same key schedule for
|
||||||
|
* both encryption and decryption. So a context initialized with
|
||||||
|
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
|
||||||
|
*
|
||||||
|
* \note Upon exit, the content of the IV is updated so that you can
|
||||||
|
* call the function same function again on the following
|
||||||
|
* block(s) of data and get the same result as if it was
|
||||||
|
* encrypted in one call. This allows a "streaming" usage.
|
||||||
|
* If on the other hand you need to retain the contents of the
|
||||||
|
* IV, you should either save it manually or use the cipher
|
||||||
|
* module instead.
|
||||||
|
*
|
||||||
|
* \param ctx AES context
|
||||||
|
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||||
|
* \param length length of the input data
|
||||||
|
* \param iv_off offset in IV (updated after use)
|
||||||
|
* \param iv initialization vector (updated after use)
|
||||||
|
* \param input buffer holding the input data
|
||||||
|
* \param output buffer holding the output data
|
||||||
|
*
|
||||||
|
* \return 0 if successful
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
|
||||||
|
int mode,
|
||||||
|
size_t length,
|
||||||
|
size_t *iv_off,
|
||||||
|
unsigned char iv[16],
|
||||||
|
const unsigned char *input,
|
||||||
|
unsigned char *output );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief AES-CFB8 buffer encryption/decryption.
|
||||||
|
*
|
||||||
|
* Note: Due to the nature of CFB you should use the same key schedule for
|
||||||
|
* both encryption and decryption. So a context initialized with
|
||||||
|
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
|
||||||
|
*
|
||||||
|
* \note Upon exit, the content of the IV is updated so that you can
|
||||||
|
* call the function same function again on the following
|
||||||
|
* block(s) of data and get the same result as if it was
|
||||||
|
* encrypted in one call. This allows a "streaming" usage.
|
||||||
|
* If on the other hand you need to retain the contents of the
|
||||||
|
* IV, you should either save it manually or use the cipher
|
||||||
|
* module instead.
|
||||||
|
*
|
||||||
|
* \param ctx AES context
|
||||||
|
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||||
|
* \param length length of the input data
|
||||||
|
* \param iv initialization vector (updated after use)
|
||||||
|
* \param input buffer holding the input data
|
||||||
|
* \param output buffer holding the output data
|
||||||
|
*
|
||||||
|
* \return 0 if successful
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
|
||||||
|
int mode,
|
||||||
|
size_t length,
|
||||||
|
unsigned char iv[16],
|
||||||
|
const unsigned char *input,
|
||||||
|
unsigned char *output );
|
||||||
|
#endif /*MBEDTLS_CIPHER_MODE_CFB */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
||||||
|
/**
|
||||||
|
* \brief AES-CTR buffer encryption/decryption
|
||||||
|
*
|
||||||
|
* Warning: You have to keep the maximum use of your counter in mind!
|
||||||
|
*
|
||||||
|
* Note: Due to the nature of CTR you should use the same key schedule for
|
||||||
|
* both encryption and decryption. So a context initialized with
|
||||||
|
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
|
||||||
|
*
|
||||||
|
* \param ctx AES context
|
||||||
|
* \param length The length of the data
|
||||||
|
* \param nc_off The offset in the current stream_block (for resuming
|
||||||
|
* within current cipher stream). The offset pointer to
|
||||||
|
* should be 0 at the start of a stream.
|
||||||
|
* \param nonce_counter The 128-bit nonce and counter.
|
||||||
|
* \param stream_block The saved stream-block for resuming. Is overwritten
|
||||||
|
* by the function.
|
||||||
|
* \param input The input data stream
|
||||||
|
* \param output The output data stream
|
||||||
|
*
|
||||||
|
* \return 0 if successful
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
|
||||||
|
size_t length,
|
||||||
|
size_t *nc_off,
|
||||||
|
unsigned char nonce_counter[16],
|
||||||
|
unsigned char stream_block[16],
|
||||||
|
const unsigned char *input,
|
||||||
|
unsigned char *output );
|
||||||
|
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Internal AES block encryption function
|
||||||
|
* (Only exposed to allow overriding it,
|
||||||
|
* see MBEDTLS_AES_ENCRYPT_ALT)
|
||||||
|
*
|
||||||
|
* \param ctx AES context
|
||||||
|
* \param input Plaintext block
|
||||||
|
* \param output Output (ciphertext) block
|
||||||
|
*/
|
||||||
|
void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
|
||||||
|
const unsigned char input[16],
|
||||||
|
unsigned char output[16] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Internal AES block decryption function
|
||||||
|
* (Only exposed to allow overriding it,
|
||||||
|
* see MBEDTLS_AES_DECRYPT_ALT)
|
||||||
|
*
|
||||||
|
* \param ctx AES context
|
||||||
|
* \param input Ciphertext block
|
||||||
|
* \param output Output (plaintext) block
|
||||||
|
*/
|
||||||
|
void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
|
||||||
|
const unsigned char input[16],
|
||||||
|
unsigned char output[16] );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* MBEDTLS_AES_ALT */
|
||||||
|
#include "aes_alt.h"
|
||||||
|
#endif /* MBEDTLS_AES_ALT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Checkup routine
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or 1 if the test failed
|
||||||
|
*/
|
||||||
|
int mbedtls_aes_self_test( int verbose );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* aes.h */
|
||||||
289
IOBox/mbedtls/base64.c
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
/*
|
||||||
|
* RFC 1521 base64 encoding/decoding
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||||
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include MBEDTLS_CONFIG_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_BASE64_C)
|
||||||
|
|
||||||
|
#include "base64.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
|
#include <string.h>
|
||||||
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#include "platform.h"
|
||||||
|
#else
|
||||||
|
#include <stdio.h>
|
||||||
|
#define mbedtls_printf printf
|
||||||
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
||||||
|
static const unsigned char base64_enc_map[64] =
|
||||||
|
{
|
||||||
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||||
|
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||||
|
'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
|
||||||
|
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||||
|
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
|
||||||
|
'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
|
'8', '9', '+', '/'
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned char base64_dec_map[128] =
|
||||||
|
{
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
|
||||||
|
127, 127, 127, 62, 127, 127, 127, 63, 52, 53,
|
||||||
|
54, 55, 56, 57, 58, 59, 60, 61, 127, 127,
|
||||||
|
127, 64, 127, 127, 127, 0, 1, 2, 3, 4,
|
||||||
|
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||||
|
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||||
|
25, 127, 127, 127, 127, 127, 127, 26, 27, 28,
|
||||||
|
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
||||||
|
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||||||
|
49, 50, 51, 127, 127, 127, 127, 127
|
||||||
|
};
|
||||||
|
|
||||||
|
#define BASE64_SIZE_T_MAX ( (size_t) -1 ) /* SIZE_T_MAX is not standard */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Encode a buffer into base64 format
|
||||||
|
*/
|
||||||
|
int mbedtls_base64_encode( unsigned char *dst, size_t dlen, size_t *olen,
|
||||||
|
const unsigned char *src, size_t slen )
|
||||||
|
{
|
||||||
|
size_t i, n;
|
||||||
|
int C1, C2, C3;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
|
if( slen == 0 )
|
||||||
|
{
|
||||||
|
*olen = 0;
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
n = slen / 3 + ( slen % 3 != 0 );
|
||||||
|
|
||||||
|
if( n > ( BASE64_SIZE_T_MAX - 1 ) / 4 )
|
||||||
|
{
|
||||||
|
*olen = BASE64_SIZE_T_MAX;
|
||||||
|
return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||||
|
}
|
||||||
|
|
||||||
|
n *= 4;
|
||||||
|
|
||||||
|
if( dlen < n + 1 )
|
||||||
|
{
|
||||||
|
*olen = n + 1;
|
||||||
|
return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||||
|
}
|
||||||
|
|
||||||
|
n = ( slen / 3 ) * 3;
|
||||||
|
|
||||||
|
for( i = 0, p = dst; i < n; i += 3 )
|
||||||
|
{
|
||||||
|
C1 = *src++;
|
||||||
|
C2 = *src++;
|
||||||
|
C3 = *src++;
|
||||||
|
|
||||||
|
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[(((C2 & 15) << 2) + (C3 >> 6)) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[C3 & 0x3F];
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i < slen )
|
||||||
|
{
|
||||||
|
C1 = *src++;
|
||||||
|
C2 = ( ( i + 1 ) < slen ) ? *src++ : 0;
|
||||||
|
|
||||||
|
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
|
||||||
|
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
|
||||||
|
|
||||||
|
if( ( i + 1 ) < slen )
|
||||||
|
*p++ = base64_enc_map[((C2 & 15) << 2) & 0x3F];
|
||||||
|
else *p++ = '=';
|
||||||
|
|
||||||
|
*p++ = '=';
|
||||||
|
}
|
||||||
|
|
||||||
|
*olen = p - dst;
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Decode a base64-formatted buffer
|
||||||
|
*/
|
||||||
|
int mbedtls_base64_decode( unsigned char *dst, size_t dlen, size_t *olen,
|
||||||
|
const unsigned char *src, size_t slen )
|
||||||
|
{
|
||||||
|
size_t i, n;
|
||||||
|
uint32_t j, x;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
|
/* First pass: check for validity and get output length */
|
||||||
|
for( i = n = j = 0; i < slen; i++ )
|
||||||
|
{
|
||||||
|
/* Skip spaces before checking for EOL */
|
||||||
|
x = 0;
|
||||||
|
while( i < slen && src[i] == ' ' )
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
++x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Spaces at end of buffer are OK */
|
||||||
|
if( i == slen )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( ( slen - i ) >= 2 &&
|
||||||
|
src[i] == '\r' && src[i + 1] == '\n' )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( src[i] == '\n' )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Space inside a line is an error */
|
||||||
|
if( x != 0 )
|
||||||
|
return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER );
|
||||||
|
|
||||||
|
if( src[i] == '=' && ++j > 2 )
|
||||||
|
return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER );
|
||||||
|
|
||||||
|
if( src[i] > 127 || base64_dec_map[src[i]] == 127 )
|
||||||
|
return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER );
|
||||||
|
|
||||||
|
if( base64_dec_map[src[i]] < 64 && j != 0 )
|
||||||
|
return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER );
|
||||||
|
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( n == 0 )
|
||||||
|
{
|
||||||
|
*olen = 0;
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
n = ( ( n * 6 ) + 7 ) >> 3;
|
||||||
|
n -= j;
|
||||||
|
|
||||||
|
if( dst == NULL || dlen < n )
|
||||||
|
{
|
||||||
|
*olen = n;
|
||||||
|
return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( j = 3, n = x = 0, p = dst; i > 0; i--, src++ )
|
||||||
|
{
|
||||||
|
if( *src == '\r' || *src == '\n' || *src == ' ' )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
j -= ( base64_dec_map[*src] == 64 );
|
||||||
|
x = ( x << 6 ) | ( base64_dec_map[*src] & 0x3F );
|
||||||
|
|
||||||
|
if( ++n == 4 )
|
||||||
|
{
|
||||||
|
n = 0;
|
||||||
|
if( j > 0 ) *p++ = (unsigned char)( x >> 16 );
|
||||||
|
if( j > 1 ) *p++ = (unsigned char)( x >> 8 );
|
||||||
|
if( j > 2 ) *p++ = (unsigned char)( x );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*olen = p - dst;
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
|
|
||||||
|
static const unsigned char base64_test_dec[64] =
|
||||||
|
{
|
||||||
|
0x24, 0x48, 0x6E, 0x56, 0x87, 0x62, 0x5A, 0xBD,
|
||||||
|
0xBF, 0x17, 0xD9, 0xA2, 0xC4, 0x17, 0x1A, 0x01,
|
||||||
|
0x94, 0xED, 0x8F, 0x1E, 0x11, 0xB3, 0xD7, 0x09,
|
||||||
|
0x0C, 0xB6, 0xE9, 0x10, 0x6F, 0x22, 0xEE, 0x13,
|
||||||
|
0xCA, 0xB3, 0x07, 0x05, 0x76, 0xC9, 0xFA, 0x31,
|
||||||
|
0x6C, 0x08, 0x34, 0xFF, 0x8D, 0xC2, 0x6C, 0x38,
|
||||||
|
0x00, 0x43, 0xE9, 0x54, 0x97, 0xAF, 0x50, 0x4B,
|
||||||
|
0xD1, 0x41, 0xBA, 0x95, 0x31, 0x5A, 0x0B, 0x97
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned char base64_test_enc[] =
|
||||||
|
"JEhuVodiWr2/F9mixBcaAZTtjx4Rs9cJDLbpEG8i7hPK"
|
||||||
|
"swcFdsn6MWwINP+Nwmw4AEPpVJevUEvRQbqVMVoLlw==";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checkup routine
|
||||||
|
*/
|
||||||
|
int mbedtls_base64_self_test( int verbose )
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
const unsigned char *src;
|
||||||
|
unsigned char buffer[128];
|
||||||
|
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( " Base64 encoding test: " );
|
||||||
|
|
||||||
|
src = base64_test_dec;
|
||||||
|
|
||||||
|
if( mbedtls_base64_encode( buffer, sizeof( buffer ), &len, src, 64 ) != 0 ||
|
||||||
|
memcmp( base64_test_enc, buffer, 88 ) != 0 )
|
||||||
|
{
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( "failed\n" );
|
||||||
|
|
||||||
|
return( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( "passed\n Base64 decoding test: " );
|
||||||
|
|
||||||
|
src = base64_test_enc;
|
||||||
|
|
||||||
|
if( mbedtls_base64_decode( buffer, sizeof( buffer ), &len, src, 88 ) != 0 ||
|
||||||
|
memcmp( base64_test_dec, buffer, 64 ) != 0 )
|
||||||
|
{
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( "failed\n" );
|
||||||
|
|
||||||
|
return( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( "passed\n\n" );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_BASE64_C */
|
||||||
88
IOBox/mbedtls/base64.h
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/**
|
||||||
|
* \file base64.h
|
||||||
|
*
|
||||||
|
* \brief RFC 1521 base64 encoding/decoding
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
#ifndef MBEDTLS_BASE64_H
|
||||||
|
#define MBEDTLS_BASE64_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL -0x002A /**< Output buffer too small. */
|
||||||
|
#define MBEDTLS_ERR_BASE64_INVALID_CHARACTER -0x002C /**< Invalid character in input. */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Encode a buffer into base64 format
|
||||||
|
*
|
||||||
|
* \param dst destination buffer
|
||||||
|
* \param dlen size of the destination buffer
|
||||||
|
* \param olen number of bytes written
|
||||||
|
* \param src source buffer
|
||||||
|
* \param slen amount of data to be encoded
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL.
|
||||||
|
* *olen is always updated to reflect the amount
|
||||||
|
* of data that has (or would have) been written.
|
||||||
|
* If that length cannot be represented, then no data is
|
||||||
|
* written to the buffer and *olen is set to the maximum
|
||||||
|
* length representable as a size_t.
|
||||||
|
*
|
||||||
|
* \note Call this function with dlen = 0 to obtain the
|
||||||
|
* required buffer size in *olen
|
||||||
|
*/
|
||||||
|
int mbedtls_base64_encode( unsigned char *dst, size_t dlen, size_t *olen,
|
||||||
|
const unsigned char *src, size_t slen );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Decode a base64-formatted buffer
|
||||||
|
*
|
||||||
|
* \param dst destination buffer (can be NULL for checking size)
|
||||||
|
* \param dlen size of the destination buffer
|
||||||
|
* \param olen number of bytes written
|
||||||
|
* \param src source buffer
|
||||||
|
* \param slen amount of data to be decoded
|
||||||
|
*
|
||||||
|
* \return 0 if successful, MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL, or
|
||||||
|
* MBEDTLS_ERR_BASE64_INVALID_CHARACTER if the input data is
|
||||||
|
* not correct. *olen is always updated to reflect the amount
|
||||||
|
* of data that has (or would have) been written.
|
||||||
|
*
|
||||||
|
* \note Call this function with *dst = NULL or dlen = 0 to obtain
|
||||||
|
* the required buffer size in *olen
|
||||||
|
*/
|
||||||
|
int mbedtls_base64_decode( unsigned char *dst, size_t dlen, size_t *olen,
|
||||||
|
const unsigned char *src, size_t slen );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Checkup routine
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or 1 if the test failed
|
||||||
|
*/
|
||||||
|
int mbedtls_base64_self_test( int verbose );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* base64.h */
|
||||||
540
IOBox/mbedtls/check_config.h
Normal file
@@ -0,0 +1,540 @@
|
|||||||
|
/**
|
||||||
|
* \file check_config.h
|
||||||
|
*
|
||||||
|
* \brief Consistency checks for configuration options
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It is recommended to include this file from your config.h
|
||||||
|
* in order to catch dependency issues early.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MBEDTLS_CHECK_CONFIG_H
|
||||||
|
#define MBEDTLS_CHECK_CONFIG_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We assume CHAR_BIT is 8 in many places. In practice, this is true on our
|
||||||
|
* target platforms, so not an issue, but let's just be extra sure.
|
||||||
|
*/
|
||||||
|
#include <limits.h>
|
||||||
|
#if CHAR_BIT != 8
|
||||||
|
#error "mbed TLS requires a platform with 8-bit chars"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_C is required on Windows"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as
|
||||||
|
* it would confuse config.pl. */
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
|
||||||
|
!defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
|
||||||
|
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
|
||||||
|
#endif
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
#if defined(TARGET_LIKE_MBED) && \
|
||||||
|
( defined(MBEDTLS_NET_C) || defined(MBEDTLS_TIMING_C) )
|
||||||
|
#error "The NET and TIMING modules are not available for mbed OS - please use the network and timing functions provided by mbed OS"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_DEPRECATED_WARNING) && \
|
||||||
|
!defined(__GNUC__) && !defined(__clang__)
|
||||||
|
#error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME)
|
||||||
|
#error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM)
|
||||||
|
#error "MBEDTLS_AESNI_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
|
||||||
|
#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
|
||||||
|
#error "MBEDTLS_DHM_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
|
||||||
|
#error "MBEDTLS_ECDH_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECDSA_C) && \
|
||||||
|
( !defined(MBEDTLS_ECP_C) || \
|
||||||
|
!defined(MBEDTLS_ASN1_PARSE_C) || \
|
||||||
|
!defined(MBEDTLS_ASN1_WRITE_C) )
|
||||||
|
#error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECJPAKE_C) && \
|
||||||
|
( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
|
||||||
|
#error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
|
||||||
|
#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) ) )
|
||||||
|
#error "MBEDTLS_ECP_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
|
||||||
|
!defined(MBEDTLS_SHA256_C))
|
||||||
|
#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
|
||||||
|
defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
|
||||||
|
#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_ENTROPY_C) && \
|
||||||
|
( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
|
||||||
|
&& defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
|
||||||
|
#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_ENTROPY_C) && \
|
||||||
|
defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
|
||||||
|
#error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_GCM_C) && ( \
|
||||||
|
!defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) )
|
||||||
|
#error "MBEDTLS_GCM_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
|
||||||
|
#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
|
||||||
|
#error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
|
||||||
|
!defined(MBEDTLS_ECDH_C)
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
|
||||||
|
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
|
||||||
|
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
|
||||||
|
!defined(MBEDTLS_X509_CRT_PARSE_C) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
|
||||||
|
!defined(MBEDTLS_PKCS1_V15) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
|
||||||
|
!defined(MBEDTLS_PKCS1_V15) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
|
||||||
|
( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
|
||||||
|
#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
|
||||||
|
#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
|
||||||
|
#error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
|
||||||
|
#error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PK_C) && \
|
||||||
|
( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
|
||||||
|
#error "MBEDTLS_PK_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
|
||||||
|
#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
|
||||||
|
#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
|
||||||
|
#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
|
||||||
|
( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
|
||||||
|
defined(MBEDTLS_PLATFORM_EXIT_ALT) )
|
||||||
|
#error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
|
||||||
|
( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
|
||||||
|
defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
|
||||||
|
#error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
|
||||||
|
( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
|
||||||
|
#error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
|
||||||
|
defined(MBEDTLS_PLATFORM_STD_FREE)
|
||||||
|
#error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
|
||||||
|
#error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
|
||||||
|
( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
|
||||||
|
#error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
|
||||||
|
defined(MBEDTLS_PLATFORM_STD_CALLOC)
|
||||||
|
#error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
|
||||||
|
#error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
|
||||||
|
( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
|
||||||
|
defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
|
||||||
|
#error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
|
||||||
|
( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
|
||||||
|
defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
|
||||||
|
#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
|
||||||
|
!defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
|
||||||
|
!defined(MBEDTLS_PLATFORM_EXIT_ALT)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
|
||||||
|
!defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
|
||||||
|
!defined(MBEDTLS_PLATFORM_PRINTF_ALT)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
|
||||||
|
!defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
|
||||||
|
#error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
|
||||||
|
!defined(MBEDTLS_OID_C) )
|
||||||
|
#error "MBEDTLS_RSA_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
|
||||||
|
( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
|
||||||
|
#error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
|
||||||
|
!defined(MBEDTLS_SHA1_C) )
|
||||||
|
#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
|
||||||
|
!defined(MBEDTLS_SHA1_C) )
|
||||||
|
#error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
|
||||||
|
!defined(MBEDTLS_SHA1_C) )
|
||||||
|
#error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
|
||||||
|
!defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
|
||||||
|
#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||||
|
#error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
|
||||||
|
#error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
|
||||||
|
!defined(MBEDTLS_MD_C) )
|
||||||
|
#error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
|
||||||
|
#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_2))
|
||||||
|
#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
|
||||||
|
defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
|
||||||
|
#error "Illegal protocol selection"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
|
||||||
|
defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
|
||||||
|
#error "Illegal protocol selection"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
|
||||||
|
defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_1)))
|
||||||
|
#error "Illegal protocol selection"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||||
|
#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
|
||||||
|
!defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
|
||||||
|
#error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
|
||||||
|
( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
|
||||||
|
#error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
|
||||||
|
( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
|
||||||
|
#error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||||
|
#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||||
|
#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
|
||||||
|
#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
|
||||||
|
!defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
|
||||||
|
#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
|
||||||
|
!defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
|
#error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_THREADING_PTHREAD)
|
||||||
|
#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
|
||||||
|
#error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
#define MBEDTLS_THREADING_IMPL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_THREADING_ALT)
|
||||||
|
#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
|
||||||
|
#error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
#define MBEDTLS_THREADING_IMPL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
|
||||||
|
#error "MBEDTLS_THREADING_C defined, single threading implementation required"
|
||||||
|
#endif
|
||||||
|
#undef MBEDTLS_THREADING_IMPL
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
|
||||||
|
#error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
|
||||||
|
!defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
|
||||||
|
!defined(MBEDTLS_PK_PARSE_C) )
|
||||||
|
#error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
|
||||||
|
!defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
|
||||||
|
!defined(MBEDTLS_PK_WRITE_C) )
|
||||||
|
#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
|
||||||
|
#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
|
||||||
|
#error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
|
||||||
|
#error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
|
||||||
|
#error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
|
||||||
|
#error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Avoid warning from -pedantic. This is a convenient place for this
|
||||||
|
* workaround since this is included by every single file before the
|
||||||
|
* #if defined(MBEDTLS_xxx_C) that results in emtpy translation units.
|
||||||
|
*/
|
||||||
|
typedef int mbedtls_iso_c_forbids_empty_translation_units;
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_CHECK_CONFIG_H */
|
||||||
2511
IOBox/mbedtls/config.h
Normal file
214
IOBox/mbedtls/platform.h
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
/**
|
||||||
|
* \file platform.h
|
||||||
|
*
|
||||||
|
* \brief mbed TLS Platform abstraction layer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
#ifndef MBEDTLS_PLATFORM_H
|
||||||
|
#define MBEDTLS_PLATFORM_H
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||||
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include MBEDTLS_CONFIG_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name SECTION: Module settings
|
||||||
|
*
|
||||||
|
* The configuration options you can set for this module are in this section.
|
||||||
|
* Either change them in config.h or define them on the compiler command line.
|
||||||
|
* \{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define MBEDTLS_PLATFORM_STD_SNPRINTF mbedtls_platform_win32_snprintf /**< Default snprintf to use */
|
||||||
|
#else
|
||||||
|
#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_STD_PRINTF)
|
||||||
|
#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use */
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_STD_FPRINTF)
|
||||||
|
#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use */
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_STD_CALLOC)
|
||||||
|
#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use */
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_STD_FREE)
|
||||||
|
#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use */
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_PLATFORM_STD_EXIT)
|
||||||
|
#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default free to use */
|
||||||
|
#endif
|
||||||
|
#else /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */
|
||||||
|
#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR)
|
||||||
|
#include MBEDTLS_PLATFORM_STD_MEM_HDR
|
||||||
|
#endif
|
||||||
|
#endif /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */
|
||||||
|
|
||||||
|
/* \} name SECTION: Module settings */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The function pointers for calloc and free
|
||||||
|
*/
|
||||||
|
#if defined(MBEDTLS_PLATFORM_MEMORY)
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && \
|
||||||
|
defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
|
||||||
|
#define mbedtls_free MBEDTLS_PLATFORM_FREE_MACRO
|
||||||
|
#define mbedtls_calloc MBEDTLS_PLATFORM_CALLOC_MACRO
|
||||||
|
#else
|
||||||
|
/* For size_t */
|
||||||
|
#include <stddef.h>
|
||||||
|
extern void * (*mbedtls_calloc)( size_t n, size_t size );
|
||||||
|
extern void (*mbedtls_free)( void *ptr );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set your own memory implementation function pointers
|
||||||
|
*
|
||||||
|
* \param calloc_func the calloc function implementation
|
||||||
|
* \param free_func the free function implementation
|
||||||
|
*
|
||||||
|
* \return 0 if successful
|
||||||
|
*/
|
||||||
|
int mbedtls_platform_set_calloc_free( void * (*calloc_func)( size_t, size_t ),
|
||||||
|
void (*free_func)( void * ) );
|
||||||
|
#endif /* MBEDTLS_PLATFORM_FREE_MACRO && MBEDTLS_PLATFORM_CALLOC_MACRO */
|
||||||
|
#else /* !MBEDTLS_PLATFORM_MEMORY */
|
||||||
|
#define mbedtls_free free
|
||||||
|
#define mbedtls_calloc calloc
|
||||||
|
#endif /* MBEDTLS_PLATFORM_MEMORY && !MBEDTLS_PLATFORM_{FREE,CALLOC}_MACRO */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The function pointers for fprintf
|
||||||
|
*/
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
|
||||||
|
/* We need FILE * */
|
||||||
|
#include <stdio.h>
|
||||||
|
extern int (*mbedtls_fprintf)( FILE *stream, const char *format, ... );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set your own fprintf function pointer
|
||||||
|
*
|
||||||
|
* \param fprintf_func the fprintf function implementation
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
*/
|
||||||
|
int mbedtls_platform_set_fprintf( int (*fprintf_func)( FILE *stream, const char *,
|
||||||
|
... ) );
|
||||||
|
#else
|
||||||
|
#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO)
|
||||||
|
#define mbedtls_fprintf MBEDTLS_PLATFORM_FPRINTF_MACRO
|
||||||
|
#else
|
||||||
|
#define mbedtls_fprintf fprintf
|
||||||
|
#endif /* MBEDTLS_PLATFORM_FPRINTF_MACRO */
|
||||||
|
#endif /* MBEDTLS_PLATFORM_FPRINTF_ALT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The function pointers for printf
|
||||||
|
*/
|
||||||
|
#if defined(MBEDTLS_PLATFORM_PRINTF_ALT)
|
||||||
|
extern int (*mbedtls_printf)( const char *format, ... );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set your own printf function pointer
|
||||||
|
*
|
||||||
|
* \param printf_func the printf function implementation
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
*/
|
||||||
|
int mbedtls_platform_set_printf( int (*printf_func)( const char *, ... ) );
|
||||||
|
#else /* !MBEDTLS_PLATFORM_PRINTF_ALT */
|
||||||
|
#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO)
|
||||||
|
#define mbedtls_printf MBEDTLS_PLATFORM_PRINTF_MACRO
|
||||||
|
#else
|
||||||
|
#define mbedtls_printf printf
|
||||||
|
#endif /* MBEDTLS_PLATFORM_PRINTF_MACRO */
|
||||||
|
#endif /* MBEDTLS_PLATFORM_PRINTF_ALT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The function pointers for snprintf
|
||||||
|
*
|
||||||
|
* The snprintf implementation should conform to C99:
|
||||||
|
* - it *must* always correctly zero-terminate the buffer
|
||||||
|
* (except when n == 0, then it must leave the buffer untouched)
|
||||||
|
* - however it is acceptable to return -1 instead of the required length when
|
||||||
|
* the destination buffer is too short.
|
||||||
|
*/
|
||||||
|
#if defined(_WIN32)
|
||||||
|
/* For Windows (inc. MSYS2), we provide our own fixed implementation */
|
||||||
|
int mbedtls_platform_win32_snprintf( char *s, size_t n, const char *fmt, ... );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
|
||||||
|
extern int (*mbedtls_snprintf)( char * s, size_t n, const char * format, ... );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set your own snprintf function pointer
|
||||||
|
*
|
||||||
|
* \param snprintf_func the snprintf function implementation
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
*/
|
||||||
|
int mbedtls_platform_set_snprintf( int (*snprintf_func)( char * s, size_t n,
|
||||||
|
const char * format, ... ) );
|
||||||
|
#else /* MBEDTLS_PLATFORM_SNPRINTF_ALT */
|
||||||
|
#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
|
||||||
|
#define mbedtls_snprintf MBEDTLS_PLATFORM_SNPRINTF_MACRO
|
||||||
|
#else
|
||||||
|
#define mbedtls_snprintf snprintf
|
||||||
|
#endif /* MBEDTLS_PLATFORM_SNPRINTF_MACRO */
|
||||||
|
#endif /* MBEDTLS_PLATFORM_SNPRINTF_ALT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The function pointers for exit
|
||||||
|
*/
|
||||||
|
#if defined(MBEDTLS_PLATFORM_EXIT_ALT)
|
||||||
|
extern void (*mbedtls_exit)( int status );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set your own exit function pointer
|
||||||
|
*
|
||||||
|
* \param exit_func the exit function implementation
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
*/
|
||||||
|
int mbedtls_platform_set_exit( void (*exit_func)( int status ) );
|
||||||
|
#else
|
||||||
|
#if defined(MBEDTLS_PLATFORM_EXIT_MACRO)
|
||||||
|
#define mbedtls_exit MBEDTLS_PLATFORM_EXIT_MACRO
|
||||||
|
#else
|
||||||
|
#define mbedtls_exit exit
|
||||||
|
#endif /* MBEDTLS_PLATFORM_EXIT_MACRO */
|
||||||
|
#endif /* MBEDTLS_PLATFORM_EXIT_ALT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* platform.h */
|
||||||
445
IOBox/mbedtls/sha256.c
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
/*
|
||||||
|
* FIPS-180-2 compliant SHA-256 implementation
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* The SHA-256 Secure Hash Standard was published by NIST in 2002.
|
||||||
|
*
|
||||||
|
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||||
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include MBEDTLS_CONFIG_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SHA256_C)
|
||||||
|
|
||||||
|
#include "sha256.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
|
#include "platform.h"
|
||||||
|
#else
|
||||||
|
#include <stdio.h>
|
||||||
|
#define mbedtls_printf printf
|
||||||
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_SHA256_ALT)
|
||||||
|
|
||||||
|
/* Implementation that should never be optimized out by the compiler */
|
||||||
|
static void mbedtls_zeroize( void *v, size_t n ) {
|
||||||
|
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 32-bit integer manipulation macros (big endian)
|
||||||
|
*/
|
||||||
|
#ifndef GET_UINT32_BE
|
||||||
|
#define GET_UINT32_BE(n,b,i) \
|
||||||
|
do { \
|
||||||
|
(n) = ( (uint32_t) (b)[(i) ] << 24 ) \
|
||||||
|
| ( (uint32_t) (b)[(i) + 1] << 16 ) \
|
||||||
|
| ( (uint32_t) (b)[(i) + 2] << 8 ) \
|
||||||
|
| ( (uint32_t) (b)[(i) + 3] ); \
|
||||||
|
} while( 0 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PUT_UINT32_BE
|
||||||
|
#define PUT_UINT32_BE(n,b,i) \
|
||||||
|
do { \
|
||||||
|
(b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
|
||||||
|
(b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
|
||||||
|
(b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
|
||||||
|
(b)[(i) + 3] = (unsigned char) ( (n) ); \
|
||||||
|
} while( 0 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void mbedtls_sha256_init( mbedtls_sha256_context *ctx )
|
||||||
|
{
|
||||||
|
memset( ctx, 0, sizeof( mbedtls_sha256_context ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void mbedtls_sha256_free( mbedtls_sha256_context *ctx )
|
||||||
|
{
|
||||||
|
if( ctx == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
mbedtls_zeroize( ctx, sizeof( mbedtls_sha256_context ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
||||||
|
const mbedtls_sha256_context *src )
|
||||||
|
{
|
||||||
|
*dst = *src;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHA-256 context setup
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 )
|
||||||
|
{
|
||||||
|
ctx->total[0] = 0;
|
||||||
|
ctx->total[1] = 0;
|
||||||
|
|
||||||
|
if( is224 == 0 )
|
||||||
|
{
|
||||||
|
/* SHA-256 */
|
||||||
|
ctx->state[0] = 0x6A09E667;
|
||||||
|
ctx->state[1] = 0xBB67AE85;
|
||||||
|
ctx->state[2] = 0x3C6EF372;
|
||||||
|
ctx->state[3] = 0xA54FF53A;
|
||||||
|
ctx->state[4] = 0x510E527F;
|
||||||
|
ctx->state[5] = 0x9B05688C;
|
||||||
|
ctx->state[6] = 0x1F83D9AB;
|
||||||
|
ctx->state[7] = 0x5BE0CD19;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* SHA-224 */
|
||||||
|
ctx->state[0] = 0xC1059ED8;
|
||||||
|
ctx->state[1] = 0x367CD507;
|
||||||
|
ctx->state[2] = 0x3070DD17;
|
||||||
|
ctx->state[3] = 0xF70E5939;
|
||||||
|
ctx->state[4] = 0xFFC00B31;
|
||||||
|
ctx->state[5] = 0x68581511;
|
||||||
|
ctx->state[6] = 0x64F98FA7;
|
||||||
|
ctx->state[7] = 0xBEFA4FA4;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->is224 = is224;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_SHA256_PROCESS_ALT)
|
||||||
|
static const uint32_t K[] =
|
||||||
|
{
|
||||||
|
0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
|
||||||
|
0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
|
||||||
|
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
|
||||||
|
0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
|
||||||
|
0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
|
||||||
|
0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
|
||||||
|
0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
|
||||||
|
0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
|
||||||
|
0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
|
||||||
|
0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
|
||||||
|
0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
|
||||||
|
0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
|
||||||
|
0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
|
||||||
|
0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
|
||||||
|
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
|
||||||
|
0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
|
||||||
|
#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
|
||||||
|
|
||||||
|
#define S0(x) (ROTR(x, 7) ^ ROTR(x,18) ^ SHR(x, 3))
|
||||||
|
#define S1(x) (ROTR(x,17) ^ ROTR(x,19) ^ SHR(x,10))
|
||||||
|
|
||||||
|
#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
|
||||||
|
#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
|
||||||
|
|
||||||
|
#define F0(x,y,z) ((x & y) | (z & (x | y)))
|
||||||
|
#define F1(x,y,z) (z ^ (x & (y ^ z)))
|
||||||
|
|
||||||
|
#define R(t) \
|
||||||
|
( \
|
||||||
|
W[t] = S1(W[t - 2]) + W[t - 7] + \
|
||||||
|
S0(W[t - 15]) + W[t - 16] \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define P(a,b,c,d,e,f,g,h,x,K) \
|
||||||
|
{ \
|
||||||
|
temp1 = h + S3(e) + F1(e,f,g) + K + x; \
|
||||||
|
temp2 = S2(a) + F0(a,b,c); \
|
||||||
|
d += temp1; h = temp1 + temp2; \
|
||||||
|
}
|
||||||
|
|
||||||
|
void mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[64] )
|
||||||
|
{
|
||||||
|
uint32_t temp1, temp2, W[64];
|
||||||
|
uint32_t A[8];
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for( i = 0; i < 8; i++ )
|
||||||
|
A[i] = ctx->state[i];
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SHA256_SMALLER)
|
||||||
|
for( i = 0; i < 64; i++ )
|
||||||
|
{
|
||||||
|
if( i < 16 )
|
||||||
|
GET_UINT32_BE( W[i], data, 4 * i );
|
||||||
|
else
|
||||||
|
R( i );
|
||||||
|
|
||||||
|
P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i], K[i] );
|
||||||
|
|
||||||
|
temp1 = A[7]; A[7] = A[6]; A[6] = A[5]; A[5] = A[4]; A[4] = A[3];
|
||||||
|
A[3] = A[2]; A[2] = A[1]; A[1] = A[0]; A[0] = temp1;
|
||||||
|
}
|
||||||
|
#else /* MBEDTLS_SHA256_SMALLER */
|
||||||
|
for( i = 0; i < 16; i++ )
|
||||||
|
GET_UINT32_BE( W[i], data, 4 * i );
|
||||||
|
|
||||||
|
for( i = 0; i < 16; i += 8 )
|
||||||
|
{
|
||||||
|
P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i+0], K[i+0] );
|
||||||
|
P( A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], W[i+1], K[i+1] );
|
||||||
|
P( A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], W[i+2], K[i+2] );
|
||||||
|
P( A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], W[i+3], K[i+3] );
|
||||||
|
P( A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], W[i+4], K[i+4] );
|
||||||
|
P( A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], W[i+5], K[i+5] );
|
||||||
|
P( A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], W[i+6], K[i+6] );
|
||||||
|
P( A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], W[i+7], K[i+7] );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 16; i < 64; i += 8 )
|
||||||
|
{
|
||||||
|
P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], R(i+0), K[i+0] );
|
||||||
|
P( A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], R(i+1), K[i+1] );
|
||||||
|
P( A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], R(i+2), K[i+2] );
|
||||||
|
P( A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], R(i+3), K[i+3] );
|
||||||
|
P( A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], R(i+4), K[i+4] );
|
||||||
|
P( A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], R(i+5), K[i+5] );
|
||||||
|
P( A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], R(i+6), K[i+6] );
|
||||||
|
P( A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], R(i+7), K[i+7] );
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_SHA256_SMALLER */
|
||||||
|
|
||||||
|
for( i = 0; i < 8; i++ )
|
||||||
|
ctx->state[i] += A[i];
|
||||||
|
}
|
||||||
|
#endif /* !MBEDTLS_SHA256_PROCESS_ALT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHA-256 process buffer
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||||
|
size_t ilen )
|
||||||
|
{
|
||||||
|
size_t fill;
|
||||||
|
uint32_t left;
|
||||||
|
|
||||||
|
if( ilen == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
left = ctx->total[0] & 0x3F;
|
||||||
|
fill = 64 - left;
|
||||||
|
|
||||||
|
ctx->total[0] += (uint32_t) ilen;
|
||||||
|
ctx->total[0] &= 0xFFFFFFFF;
|
||||||
|
|
||||||
|
if( ctx->total[0] < (uint32_t) ilen )
|
||||||
|
ctx->total[1]++;
|
||||||
|
|
||||||
|
if( left && ilen >= fill )
|
||||||
|
{
|
||||||
|
memcpy( (void *) (ctx->buffer + left), input, fill );
|
||||||
|
mbedtls_sha256_process( ctx, ctx->buffer );
|
||||||
|
input += fill;
|
||||||
|
ilen -= fill;
|
||||||
|
left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( ilen >= 64 )
|
||||||
|
{
|
||||||
|
mbedtls_sha256_process( ctx, input );
|
||||||
|
input += 64;
|
||||||
|
ilen -= 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ilen > 0 )
|
||||||
|
memcpy( (void *) (ctx->buffer + left), input, ilen );
|
||||||
|
}
|
||||||
|
|
||||||
|
static const unsigned char sha256_padding[64] =
|
||||||
|
{
|
||||||
|
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHA-256 final digest
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] )
|
||||||
|
{
|
||||||
|
uint32_t last, padn;
|
||||||
|
uint32_t high, low;
|
||||||
|
unsigned char msglen[8];
|
||||||
|
|
||||||
|
high = ( ctx->total[0] >> 29 )
|
||||||
|
| ( ctx->total[1] << 3 );
|
||||||
|
low = ( ctx->total[0] << 3 );
|
||||||
|
|
||||||
|
PUT_UINT32_BE( high, msglen, 0 );
|
||||||
|
PUT_UINT32_BE( low, msglen, 4 );
|
||||||
|
|
||||||
|
last = ctx->total[0] & 0x3F;
|
||||||
|
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||||
|
|
||||||
|
mbedtls_sha256_update( ctx, sha256_padding, padn );
|
||||||
|
mbedtls_sha256_update( ctx, msglen, 8 );
|
||||||
|
|
||||||
|
PUT_UINT32_BE( ctx->state[0], output, 0 );
|
||||||
|
PUT_UINT32_BE( ctx->state[1], output, 4 );
|
||||||
|
PUT_UINT32_BE( ctx->state[2], output, 8 );
|
||||||
|
PUT_UINT32_BE( ctx->state[3], output, 12 );
|
||||||
|
PUT_UINT32_BE( ctx->state[4], output, 16 );
|
||||||
|
PUT_UINT32_BE( ctx->state[5], output, 20 );
|
||||||
|
PUT_UINT32_BE( ctx->state[6], output, 24 );
|
||||||
|
|
||||||
|
if( ctx->is224 == 0 )
|
||||||
|
PUT_UINT32_BE( ctx->state[7], output, 28 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !MBEDTLS_SHA256_ALT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* output = SHA-256( input buffer )
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256( const unsigned char *input, size_t ilen,
|
||||||
|
unsigned char output[32], int is224 )
|
||||||
|
{
|
||||||
|
mbedtls_sha256_context ctx;
|
||||||
|
|
||||||
|
mbedtls_sha256_init( &ctx );
|
||||||
|
mbedtls_sha256_starts( &ctx, is224 );
|
||||||
|
mbedtls_sha256_update( &ctx, input, ilen );
|
||||||
|
mbedtls_sha256_finish( &ctx, output );
|
||||||
|
mbedtls_sha256_free( &ctx );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
|
/*
|
||||||
|
* FIPS-180-2 test vectors
|
||||||
|
*/
|
||||||
|
static const unsigned char sha256_test_buf[3][57] =
|
||||||
|
{
|
||||||
|
{ "abc" },
|
||||||
|
{ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" },
|
||||||
|
{ "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int sha256_test_buflen[3] =
|
||||||
|
{
|
||||||
|
3, 56, 1000
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned char sha256_test_sum[6][32] =
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* SHA-224 test vectors
|
||||||
|
*/
|
||||||
|
{ 0x23, 0x09, 0x7D, 0x22, 0x34, 0x05, 0xD8, 0x22,
|
||||||
|
0x86, 0x42, 0xA4, 0x77, 0xBD, 0xA2, 0x55, 0xB3,
|
||||||
|
0x2A, 0xAD, 0xBC, 0xE4, 0xBD, 0xA0, 0xB3, 0xF7,
|
||||||
|
0xE3, 0x6C, 0x9D, 0xA7 },
|
||||||
|
{ 0x75, 0x38, 0x8B, 0x16, 0x51, 0x27, 0x76, 0xCC,
|
||||||
|
0x5D, 0xBA, 0x5D, 0xA1, 0xFD, 0x89, 0x01, 0x50,
|
||||||
|
0xB0, 0xC6, 0x45, 0x5C, 0xB4, 0xF5, 0x8B, 0x19,
|
||||||
|
0x52, 0x52, 0x25, 0x25 },
|
||||||
|
{ 0x20, 0x79, 0x46, 0x55, 0x98, 0x0C, 0x91, 0xD8,
|
||||||
|
0xBB, 0xB4, 0xC1, 0xEA, 0x97, 0x61, 0x8A, 0x4B,
|
||||||
|
0xF0, 0x3F, 0x42, 0x58, 0x19, 0x48, 0xB2, 0xEE,
|
||||||
|
0x4E, 0xE7, 0xAD, 0x67 },
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHA-256 test vectors
|
||||||
|
*/
|
||||||
|
{ 0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA,
|
||||||
|
0x41, 0x41, 0x40, 0xDE, 0x5D, 0xAE, 0x22, 0x23,
|
||||||
|
0xB0, 0x03, 0x61, 0xA3, 0x96, 0x17, 0x7A, 0x9C,
|
||||||
|
0xB4, 0x10, 0xFF, 0x61, 0xF2, 0x00, 0x15, 0xAD },
|
||||||
|
{ 0x24, 0x8D, 0x6A, 0x61, 0xD2, 0x06, 0x38, 0xB8,
|
||||||
|
0xE5, 0xC0, 0x26, 0x93, 0x0C, 0x3E, 0x60, 0x39,
|
||||||
|
0xA3, 0x3C, 0xE4, 0x59, 0x64, 0xFF, 0x21, 0x67,
|
||||||
|
0xF6, 0xEC, 0xED, 0xD4, 0x19, 0xDB, 0x06, 0xC1 },
|
||||||
|
{ 0xCD, 0xC7, 0x6E, 0x5C, 0x99, 0x14, 0xFB, 0x92,
|
||||||
|
0x81, 0xA1, 0xC7, 0xE2, 0x84, 0xD7, 0x3E, 0x67,
|
||||||
|
0xF1, 0x80, 0x9A, 0x48, 0xA4, 0x97, 0x20, 0x0E,
|
||||||
|
0x04, 0x6D, 0x39, 0xCC, 0xC7, 0x11, 0x2C, 0xD0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checkup routine
|
||||||
|
*/
|
||||||
|
int mbedtls_sha256_self_test( int verbose )
|
||||||
|
{
|
||||||
|
int i, j, k, buflen, ret = 0;
|
||||||
|
unsigned char buf[1024];
|
||||||
|
unsigned char sha256sum[32];
|
||||||
|
mbedtls_sha256_context ctx;
|
||||||
|
|
||||||
|
mbedtls_sha256_init( &ctx );
|
||||||
|
|
||||||
|
for( i = 0; i < 6; i++ )
|
||||||
|
{
|
||||||
|
j = i % 3;
|
||||||
|
k = i < 3;
|
||||||
|
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( " SHA-%d test #%d: ", 256 - k * 32, j + 1 );
|
||||||
|
|
||||||
|
mbedtls_sha256_starts( &ctx, k );
|
||||||
|
|
||||||
|
if( j == 2 )
|
||||||
|
{
|
||||||
|
memset( buf, 'a', buflen = 1000 );
|
||||||
|
|
||||||
|
for( j = 0; j < 1000; j++ )
|
||||||
|
mbedtls_sha256_update( &ctx, buf, buflen );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mbedtls_sha256_update( &ctx, sha256_test_buf[j],
|
||||||
|
sha256_test_buflen[j] );
|
||||||
|
|
||||||
|
mbedtls_sha256_finish( &ctx, sha256sum );
|
||||||
|
|
||||||
|
if( memcmp( sha256sum, sha256_test_sum[i], 32 - k * 4 ) != 0 )
|
||||||
|
{
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( "failed\n" );
|
||||||
|
|
||||||
|
ret = 1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( "passed\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( verbose != 0 )
|
||||||
|
mbedtls_printf( "\n" );
|
||||||
|
|
||||||
|
exit:
|
||||||
|
mbedtls_sha256_free( &ctx );
|
||||||
|
|
||||||
|
return( ret );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_SHA256_C */
|
||||||
141
IOBox/mbedtls/sha256.h
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/**
|
||||||
|
* \file sha256.h
|
||||||
|
*
|
||||||
|
* \brief SHA-224 and SHA-256 cryptographic hash function
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
#ifndef MBEDTLS_SHA256_H
|
||||||
|
#define MBEDTLS_SHA256_H
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||||
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include MBEDTLS_CONFIG_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_SHA256_ALT)
|
||||||
|
// Regular implementation
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief SHA-256 context structure
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t total[2]; /*!< number of bytes processed */
|
||||||
|
uint32_t state[8]; /*!< intermediate digest state */
|
||||||
|
unsigned char buffer[64]; /*!< data block being processed */
|
||||||
|
int is224; /*!< 0 => SHA-256, else SHA-224 */
|
||||||
|
}
|
||||||
|
mbedtls_sha256_context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initialize SHA-256 context
|
||||||
|
*
|
||||||
|
* \param ctx SHA-256 context to be initialized
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_init( mbedtls_sha256_context *ctx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Clear SHA-256 context
|
||||||
|
*
|
||||||
|
* \param ctx SHA-256 context to be cleared
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_free( mbedtls_sha256_context *ctx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Clone (the state of) a SHA-256 context
|
||||||
|
*
|
||||||
|
* \param dst The destination context
|
||||||
|
* \param src The context to be cloned
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
||||||
|
const mbedtls_sha256_context *src );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief SHA-256 context setup
|
||||||
|
*
|
||||||
|
* \param ctx context to be initialized
|
||||||
|
* \param is224 0 = use SHA256, 1 = use SHA224
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief SHA-256 process buffer
|
||||||
|
*
|
||||||
|
* \param ctx SHA-256 context
|
||||||
|
* \param input buffer holding the data
|
||||||
|
* \param ilen length of the input data
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||||
|
size_t ilen );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief SHA-256 final digest
|
||||||
|
*
|
||||||
|
* \param ctx SHA-256 context
|
||||||
|
* \param output SHA-224/256 checksum result
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] );
|
||||||
|
|
||||||
|
/* Internal use */
|
||||||
|
void mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[64] );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* MBEDTLS_SHA256_ALT */
|
||||||
|
#include "sha256_alt.h"
|
||||||
|
#endif /* MBEDTLS_SHA256_ALT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Output = SHA-256( input buffer )
|
||||||
|
*
|
||||||
|
* \param input buffer holding the data
|
||||||
|
* \param ilen length of the input data
|
||||||
|
* \param output SHA-224/256 checksum result
|
||||||
|
* \param is224 0 = use SHA256, 1 = use SHA224
|
||||||
|
*/
|
||||||
|
void mbedtls_sha256( const unsigned char *input, size_t ilen,
|
||||||
|
unsigned char output[32], int is224 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Checkup routine
|
||||||
|
*
|
||||||
|
* \return 0 if successful, or 1 if the test failed
|
||||||
|
*/
|
||||||
|
int mbedtls_sha256_self_test( int verbose );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* mbedtls_sha256.h */
|
||||||
68
IOBox/readme.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
|
||||||
|
### IOBOX API USAGE GUIDE
|
||||||
|
This document provides an overview and usage instructions for the APIs available in `iobox_api.h`.
|
||||||
|
#### 1. Api name and features
|
||||||
|
* Scan
|
||||||
|
|
||||||
|
`std::vector<std::string> scanNetworkDevicesMulticast(int timeout);`
|
||||||
|
|
||||||
|
API need to be passed a timeout in second unit. The API will return a list of IPs as a vector string.
|
||||||
|
* Connect
|
||||||
|
|
||||||
|
`bool connectToIobox(const std::string& ip, int port, const std::string& username, const std::string& password);`
|
||||||
|
|
||||||
|
Connect to a specific IP device from list of IPs above. Default port is 502
|
||||||
|
Username and password are param to anthenticate device
|
||||||
|
|
||||||
|
* Disconnect
|
||||||
|
|
||||||
|
`bool disconnectToIobox(const std::string& ip);`
|
||||||
|
|
||||||
|
Disconnect to a specific IP device that is connected before
|
||||||
|
|
||||||
|
* Get value of channel
|
||||||
|
|
||||||
|
`std::string getValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName);`
|
||||||
|
|
||||||
|
Get value of specific channel name from a IP device that is connected before.
|
||||||
|
List of channel name is obtained from `getDeviceChannelNames` api
|
||||||
|
|
||||||
|
* Set value of channel
|
||||||
|
|
||||||
|
`bool setValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName, const std::string& value);`
|
||||||
|
|
||||||
|
Set a value of specific channel name from a IP device that is connected before. List of channel name is included in `channel_name` array.
|
||||||
|
* Other api
|
||||||
|
`bool setAuthenticationIobox(const std::string& ip, const std::string& username, const std::string& password);`
|
||||||
|
This api to change username and password, this can be only called after a connection to device
|
||||||
|
|
||||||
|
`bool resetAuthenticationIobox(const std::string& ip, const std::string& token);`
|
||||||
|
This api to reset username and password to default
|
||||||
|
|
||||||
|
`bool resetIobox(const std::string& ip, const std::string& token);`
|
||||||
|
This api to restart device
|
||||||
|
`token` is generated default by using `generateToken` api
|
||||||
|
#### 2. How to using example test in main.cpp
|
||||||
|
|
||||||
|
You need build this project before run by using g++ compiler
|
||||||
|
|
||||||
|
`g++ .\*.cpp .\*.c -lws2_32 -o main.exe`
|
||||||
|
|
||||||
|
Then you need only running `main.exe`.
|
||||||
|
|
||||||
|
Start application, it will show
|
||||||
|
|
||||||
|
`Enter command followed by Enter: exit, scan, setip, connect, channels, disconnect, show, get, set, restart, setauthen, resetauthen`
|
||||||
|
|
||||||
|
* You type `scan`, it will scan all device iobox on local network then it will list them on terminal attach their IP address if they is found.
|
||||||
|
* You type `channels` to get name of all of channels that device supports
|
||||||
|
* Then type `setip` to setup IP of iobox you need to connect
|
||||||
|
Then you will be required to input of specific IP address and you need type IP you want.
|
||||||
|
* Next you type `connect` to connect to this IP device
|
||||||
|
* Then you can use `get` or `set` command to continue get or set value to any channel.
|
||||||
|
* You can use `setauthen` and `resetauthen` to change usename/password to connect device, and reset usename/password to default (now default in device is: admin/1234)
|
||||||
|
* You can use `restart` to restart devcie
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
335
MediaClient/HttpFlvTest/HttpFlvTest.cpp
Normal file
@@ -0,0 +1,335 @@
|
|||||||
|
/***************************************************************************************
|
||||||
|
*
|
||||||
|
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
*
|
||||||
|
* By downloading, copying, installing or using the software you agree to this license.
|
||||||
|
* If you do not agree to this license, do not download, install,
|
||||||
|
* copy or use the software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in binary forms, with or without modification, are permitted.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "sys_inc.h"
|
||||||
|
#include "http_flv_cln.h"
|
||||||
|
#include "hqueue.h"
|
||||||
|
#include "media_format.h"
|
||||||
|
#include "http_parse.h"
|
||||||
|
|
||||||
|
/**********************************************************/
|
||||||
|
HQUEUE * g_queue;
|
||||||
|
|
||||||
|
int g_flag = 0;
|
||||||
|
pthread_t g_tid = 0;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int event;
|
||||||
|
CHttpFlvClient* httpflv;
|
||||||
|
} EVENT_PARAMS;
|
||||||
|
|
||||||
|
/**********************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc : http-flv notify callback
|
||||||
|
*
|
||||||
|
* @params :
|
||||||
|
* event : event type
|
||||||
|
* puser : user parameter
|
||||||
|
*/
|
||||||
|
int http_flv_notify_callback(int event, void * puser)
|
||||||
|
{
|
||||||
|
printf("%s, event = %d\r\n", __FUNCTION__, event);
|
||||||
|
|
||||||
|
CHttpFlvClient * p_httpflv = (CHttpFlvClient *) puser;
|
||||||
|
|
||||||
|
if (HTTP_FLV_EVE_VIDEOREADY == event)
|
||||||
|
{
|
||||||
|
int vcodec = p_httpflv->video_codec();
|
||||||
|
if (vcodec != VIDEO_CODEC_NONE)
|
||||||
|
{
|
||||||
|
char codec_str[20] = {'\0'};
|
||||||
|
|
||||||
|
switch (vcodec)
|
||||||
|
{
|
||||||
|
case VIDEO_CODEC_H264:
|
||||||
|
strcpy(codec_str, "H264");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIDEO_CODEC_H265:
|
||||||
|
strcpy(codec_str, "H265");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIDEO_CODEC_MP4:
|
||||||
|
strcpy(codec_str, "MP4");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIDEO_CODEC_JPEG:
|
||||||
|
strcpy(codec_str, "JPEG");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("video codec is %s\r\n", codec_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (HTTP_FLV_EVE_AUDIOREADY == event)
|
||||||
|
{
|
||||||
|
int acodec = p_httpflv->audio_codec();
|
||||||
|
if (acodec != AUDIO_CODEC_NONE)
|
||||||
|
{
|
||||||
|
char codec_str[20] = {'\0'};
|
||||||
|
|
||||||
|
switch (acodec)
|
||||||
|
{
|
||||||
|
case AUDIO_CODEC_G711A:
|
||||||
|
strcpy(codec_str, "G711A");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AUDIO_CODEC_G711U:
|
||||||
|
strcpy(codec_str, "G711U");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AUDIO_CODEC_G722:
|
||||||
|
strcpy(codec_str, "G722");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AUDIO_CODEC_G726:
|
||||||
|
strcpy(codec_str, "G726");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AUDIO_CODEC_OPUS:
|
||||||
|
strcpy(codec_str, "OPUS");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AUDIO_CODEC_AAC:
|
||||||
|
strcpy(codec_str, "AAC");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("audio codec is %s\r\n", codec_str);
|
||||||
|
printf("audio sample rate is %d\r\n", p_httpflv->get_audio_samplerate());
|
||||||
|
printf("audio channels is %d\r\n", p_httpflv->get_audio_channels());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EVENT_PARAMS params;
|
||||||
|
|
||||||
|
params.event = event;
|
||||||
|
params.httpflv = p_httpflv;
|
||||||
|
|
||||||
|
if (!hqBufPut(g_queue, (char *) ¶ms))
|
||||||
|
{
|
||||||
|
printf("hqBufPut failed\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc : http-flv audio data callback
|
||||||
|
*
|
||||||
|
* @params :
|
||||||
|
* pdata : audio data buffer
|
||||||
|
* len : audio data buffer length
|
||||||
|
* ts : timestamp
|
||||||
|
* puser : user parameter
|
||||||
|
*/
|
||||||
|
int http_flv_audio_callback(uint8 * pdata, int len, uint32 ts, void * puser)
|
||||||
|
{
|
||||||
|
CHttpFlvClient * p_httpflv = (CHttpFlvClient *) puser;
|
||||||
|
|
||||||
|
printf("%s, len = %d, ts = %u\r\n", __FUNCTION__, len, ts);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc : http-flv video data callback
|
||||||
|
*
|
||||||
|
* @params :
|
||||||
|
* pdata : video data buffer
|
||||||
|
* len : video data buffer length
|
||||||
|
* ts : timestamp
|
||||||
|
* puser : user parameter
|
||||||
|
*/
|
||||||
|
int http_flv_video_callback(uint8 * pdata, int len, uint32 ts, void * puser)
|
||||||
|
{
|
||||||
|
CHttpFlvClient * p_httpflv = (CHttpFlvClient *) puser;
|
||||||
|
|
||||||
|
printf("%s, len = %d, ts = %u\r\n", __FUNCTION__, len, ts);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_flv_setup(CHttpFlvClient * p_httpflv)
|
||||||
|
{
|
||||||
|
p_httpflv->set_notify_cb(http_flv_notify_callback, p_httpflv);
|
||||||
|
p_httpflv->set_audio_cb(http_flv_audio_callback);
|
||||||
|
p_httpflv->set_video_cb(http_flv_video_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_flv_reconn(CHttpFlvClient * p_httpflv)
|
||||||
|
{
|
||||||
|
char url[512], user[64], pass[64];
|
||||||
|
|
||||||
|
strcpy(url, p_httpflv->get_url());
|
||||||
|
strcpy(user, p_httpflv->get_user());
|
||||||
|
strcpy(pass, p_httpflv->get_pass());
|
||||||
|
|
||||||
|
printf("http_flv_reconn, url = %s, user = %s, pass = %s\r\n", url, user, pass);
|
||||||
|
|
||||||
|
p_httpflv->http_flv_close();
|
||||||
|
|
||||||
|
http_flv_setup(p_httpflv);
|
||||||
|
|
||||||
|
p_httpflv->http_flv_start(url, user, pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
void * http_flv_notify_handler(void * argv)
|
||||||
|
{
|
||||||
|
EVENT_PARAMS params;
|
||||||
|
|
||||||
|
while (g_flag)
|
||||||
|
{
|
||||||
|
if (hqBufGet(g_queue, (char *) ¶ms))
|
||||||
|
{
|
||||||
|
if (params.event == -1 || params.httpflv == NULL)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HTTP_FLV_EVE_STOPPED == params.event ||
|
||||||
|
HTTP_FLV_EVE_CONNFAIL == params.event ||
|
||||||
|
HTTP_FLV_EVE_NOSIGNAL == params.event ||
|
||||||
|
HTTP_FLV_EVE_NODATA == params.event)
|
||||||
|
{
|
||||||
|
http_flv_reconn(params.httpflv);
|
||||||
|
|
||||||
|
usleep(100*1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_tid = 0;
|
||||||
|
|
||||||
|
printf("%s exit\r\n", __FUNCTION__);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HTTP_FLV_CLN_NUM 1
|
||||||
|
|
||||||
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
printf("usage: %s url {user} {pass}\r\n", argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_init("httpflvtest.log");
|
||||||
|
log_set_level(HT_LOG_DBG);
|
||||||
|
|
||||||
|
network_init();
|
||||||
|
|
||||||
|
// allocate system BUFFER and http message BUFFER
|
||||||
|
sys_buf_init(HTTP_FLV_CLN_NUM * 4);
|
||||||
|
http_msg_buf_init(HTTP_FLV_CLN_NUM * 4);
|
||||||
|
|
||||||
|
// create event queue
|
||||||
|
g_queue = hqCreate(HTTP_FLV_CLN_NUM * 4, sizeof(EVENT_PARAMS), HQ_GET_WAIT | HQ_PUT_WAIT);
|
||||||
|
if (NULL == g_queue)
|
||||||
|
{
|
||||||
|
printf("create queue failed\r\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create event handler thread
|
||||||
|
g_flag = 1;
|
||||||
|
g_tid = sys_os_create_thread((void *)http_flv_notify_handler, NULL);
|
||||||
|
if (g_tid == 0)
|
||||||
|
{
|
||||||
|
printf("create http flv notify handler thread failed\r\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHttpFlvClient * httpflv = new CHttpFlvClient[HTTP_FLV_CLN_NUM];
|
||||||
|
|
||||||
|
for (int i = 0; i < HTTP_FLV_CLN_NUM; i++)
|
||||||
|
{
|
||||||
|
http_flv_setup(&httpflv[i]);
|
||||||
|
|
||||||
|
char * p_user = NULL;
|
||||||
|
char * p_pass = NULL;
|
||||||
|
|
||||||
|
if (argc >= 3)
|
||||||
|
{
|
||||||
|
p_user = argv[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc >= 4)
|
||||||
|
{
|
||||||
|
p_pass = argv[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL ret = httpflv[i].http_flv_start(argv[1], p_user, p_pass);
|
||||||
|
|
||||||
|
printf("http flv %d start ret = %d\r\n", i, ret);
|
||||||
|
|
||||||
|
usleep(100 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (getchar() == 'q')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(1000*1000); // 1s
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < HTTP_FLV_CLN_NUM; i++)
|
||||||
|
{
|
||||||
|
httpflv[i].http_flv_close();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] httpflv;
|
||||||
|
|
||||||
|
g_flag = 0;
|
||||||
|
|
||||||
|
EVENT_PARAMS params;
|
||||||
|
|
||||||
|
params.event = -1;
|
||||||
|
params.httpflv = NULL;
|
||||||
|
|
||||||
|
hqBufPut(g_queue, (char *) ¶ms);
|
||||||
|
|
||||||
|
// waiting for event handler thread to exit
|
||||||
|
while (g_tid)
|
||||||
|
{
|
||||||
|
usleep(10*1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
hqDelete(g_queue);
|
||||||
|
g_queue = NULL;
|
||||||
|
|
||||||
|
// free memory resources
|
||||||
|
http_msg_buf_deinit();
|
||||||
|
sys_buf_deinit();
|
||||||
|
|
||||||
|
// close log
|
||||||
|
log_close();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
175
MediaClient/HttpFlvTest/HttpFlvTest.vcxproj
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{23D7CA2E-F808-4986-BFB4-F349355222E9}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>RtmpTest</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="HttpFlvTest.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
25
MediaClient/HttpFlvTest/HttpFlvTest.vcxproj.filters
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="HttpFlvTest.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
59
MediaClient/HttpFlvTest/mac.mk
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = httpflvtest
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION += -c -O3 -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -g -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I../MediaClient
|
||||||
|
INCLUDEDIR += -I../MediaClient/bm
|
||||||
|
INCLUDEDIR += -I../MediaClient/librtmp
|
||||||
|
INCLUDEDIR += -I../MediaClient/http
|
||||||
|
INCLUDEDIR += -I../MediaClient/media
|
||||||
|
INCLUDEDIR += -I../MediaClient/rtmp
|
||||||
|
INCLUDEDIR += -I../MediaClient/rtp
|
||||||
|
LIBDIRS += -L../MediaClient
|
||||||
|
LIBDIRS += -L../MediaClient/ffmpeg/lib/linux
|
||||||
|
LIBDIRS += -L../MediaClient/openssl/lib/linux
|
||||||
|
LIBDIRS += -L../MediaClient/zlib/lib/linux
|
||||||
|
OBJS = HttpFlvTest.o
|
||||||
|
SHAREDLIB += -lhttpflvclient
|
||||||
|
SHAREDLIB += -lcrypto
|
||||||
|
SHAREDLIB += -lssl
|
||||||
|
SHAREDLIB += -lz
|
||||||
|
SHAREDLIB += -lpthread
|
||||||
|
SHAREDLIB += -ldl
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
252
MediaClient/HttpMjpegTest/HttpMjpegTest.cpp
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
/***************************************************************************************
|
||||||
|
*
|
||||||
|
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
*
|
||||||
|
* By downloading, copying, installing or using the software you agree to this license.
|
||||||
|
* If you do not agree to this license, do not download, install,
|
||||||
|
* copy or use the software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in binary forms, with or without modification, are permitted.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "sys_inc.h"
|
||||||
|
#include "http_mjpeg_cln.h"
|
||||||
|
#include "hqueue.h"
|
||||||
|
#include "media_format.h"
|
||||||
|
#include "http_parse.h"
|
||||||
|
|
||||||
|
/**********************************************************/
|
||||||
|
HQUEUE * g_queue;
|
||||||
|
|
||||||
|
int g_flag = 0;
|
||||||
|
pthread_t g_tid = 0;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int event;
|
||||||
|
CHttpMjpeg * httpmjpeg;
|
||||||
|
} EVENT_PARAMS;
|
||||||
|
|
||||||
|
/**********************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc : http-mjpeg notify callback
|
||||||
|
*
|
||||||
|
* @params :
|
||||||
|
* event : event type
|
||||||
|
* puser : user parameter
|
||||||
|
*/
|
||||||
|
int http_mjpeg_notify_callback(int event, void * puser)
|
||||||
|
{
|
||||||
|
printf("%s, event = %d\r\n", __FUNCTION__, event);
|
||||||
|
|
||||||
|
CHttpMjpeg * p_httpmjpeg = (CHttpMjpeg *) puser;
|
||||||
|
|
||||||
|
if (MJPEG_EVE_CONNSUCC == event)
|
||||||
|
{
|
||||||
|
printf("video codec is MJPEG\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
EVENT_PARAMS params;
|
||||||
|
|
||||||
|
params.event = event;
|
||||||
|
params.httpmjpeg = p_httpmjpeg;
|
||||||
|
|
||||||
|
if (!hqBufPut(g_queue, (char *) ¶ms))
|
||||||
|
{
|
||||||
|
printf("hqBufPut failed\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc : http-mjpeg video data callback
|
||||||
|
*
|
||||||
|
* @params :
|
||||||
|
* pdata : video data buffer
|
||||||
|
* len : video data buffer length
|
||||||
|
* ts : timestamp
|
||||||
|
* puser : user parameter
|
||||||
|
*/
|
||||||
|
int http_mjpeg_video_callback(uint8 * pdata, int len, void * puser)
|
||||||
|
{
|
||||||
|
CHttpMjpeg * p_httpmjpeg = (CHttpMjpeg *) puser;
|
||||||
|
|
||||||
|
printf("%s, len = %d\r\n", __FUNCTION__, len);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_mjpeg_setup(CHttpMjpeg * p_httpmjpeg)
|
||||||
|
{
|
||||||
|
p_httpmjpeg->set_notify_cb(http_mjpeg_notify_callback, p_httpmjpeg);
|
||||||
|
p_httpmjpeg->set_video_cb(http_mjpeg_video_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_mjpeg_reconn(CHttpMjpeg * p_httpmjpeg)
|
||||||
|
{
|
||||||
|
char url[512], user[64], pass[64];
|
||||||
|
|
||||||
|
strcpy(url, p_httpmjpeg->get_url());
|
||||||
|
strcpy(user, p_httpmjpeg->get_user());
|
||||||
|
strcpy(pass, p_httpmjpeg->get_pass());
|
||||||
|
|
||||||
|
printf("http_mjpeg_reconn, url = %s, user = %s, pass = %s\r\n", url, user, pass);
|
||||||
|
|
||||||
|
p_httpmjpeg->mjpeg_close();
|
||||||
|
|
||||||
|
http_mjpeg_setup(p_httpmjpeg);
|
||||||
|
|
||||||
|
p_httpmjpeg->mjpeg_start(url, user, pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
void * http_mjpeg_notify_handler(void * argv)
|
||||||
|
{
|
||||||
|
EVENT_PARAMS params;
|
||||||
|
|
||||||
|
while (g_flag)
|
||||||
|
{
|
||||||
|
if (hqBufGet(g_queue, (char *) ¶ms))
|
||||||
|
{
|
||||||
|
if (params.event == -1 || params.httpmjpeg == NULL)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MJPEG_EVE_STOPPED == params.event ||
|
||||||
|
MJPEG_EVE_CONNFAIL == params.event ||
|
||||||
|
MJPEG_EVE_NOSIGNAL == params.event ||
|
||||||
|
MJPEG_EVE_NODATA == params.event)
|
||||||
|
{
|
||||||
|
http_mjpeg_reconn(params.httpmjpeg);
|
||||||
|
|
||||||
|
usleep(100*1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_tid = 0;
|
||||||
|
|
||||||
|
printf("%s exit\r\n", __FUNCTION__);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HTTP_MJPEG_CLN_NUM 1
|
||||||
|
|
||||||
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
printf("usage: %s url {user} {pass}\r\n", argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_init("httpmjpegtest.log");
|
||||||
|
log_set_level(HT_LOG_DBG);
|
||||||
|
|
||||||
|
network_init();
|
||||||
|
|
||||||
|
// allocate system BUFFER and http message BUFFER
|
||||||
|
sys_buf_init(HTTP_MJPEG_CLN_NUM * 4);
|
||||||
|
http_msg_buf_init(HTTP_MJPEG_CLN_NUM * 4);
|
||||||
|
|
||||||
|
// create event queue
|
||||||
|
g_queue = hqCreate(HTTP_MJPEG_CLN_NUM * 4, sizeof(EVENT_PARAMS), HQ_GET_WAIT | HQ_PUT_WAIT);
|
||||||
|
if (NULL == g_queue)
|
||||||
|
{
|
||||||
|
printf("create queue failed\r\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create event handler thread
|
||||||
|
g_flag = 1;
|
||||||
|
g_tid = sys_os_create_thread((void *)http_mjpeg_notify_handler, NULL);
|
||||||
|
if (g_tid == 0)
|
||||||
|
{
|
||||||
|
printf("create http mjpeg notify handler thread failed\r\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHttpMjpeg * httpmjpeg = new CHttpMjpeg[HTTP_MJPEG_CLN_NUM];
|
||||||
|
|
||||||
|
for (int i = 0; i < HTTP_MJPEG_CLN_NUM; i++)
|
||||||
|
{
|
||||||
|
http_mjpeg_setup(&httpmjpeg[i]);
|
||||||
|
|
||||||
|
char * p_user = NULL;
|
||||||
|
char * p_pass = NULL;
|
||||||
|
|
||||||
|
if (argc >= 3)
|
||||||
|
{
|
||||||
|
p_user = argv[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc >= 4)
|
||||||
|
{
|
||||||
|
p_pass = argv[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL ret = httpmjpeg[i].mjpeg_start(argv[1], p_user, p_pass);
|
||||||
|
|
||||||
|
printf("http mjpeg %d start ret = %d\r\n", i, ret);
|
||||||
|
|
||||||
|
usleep(100 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (getchar() == 'q')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(1000*1000); // 1s
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < HTTP_MJPEG_CLN_NUM; i++)
|
||||||
|
{
|
||||||
|
httpmjpeg[i].mjpeg_close();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] httpmjpeg;
|
||||||
|
|
||||||
|
g_flag = 0;
|
||||||
|
|
||||||
|
EVENT_PARAMS params;
|
||||||
|
|
||||||
|
params.event = -1;
|
||||||
|
params.httpmjpeg = NULL;
|
||||||
|
|
||||||
|
hqBufPut(g_queue, (char *) ¶ms);
|
||||||
|
|
||||||
|
// waiting for event handler thread to exit
|
||||||
|
while (g_tid)
|
||||||
|
{
|
||||||
|
usleep(10*1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
hqDelete(g_queue);
|
||||||
|
g_queue = NULL;
|
||||||
|
|
||||||
|
// free memory resources
|
||||||
|
http_msg_buf_deinit();
|
||||||
|
sys_buf_deinit();
|
||||||
|
|
||||||
|
// close log
|
||||||
|
log_close();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
175
MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{E0552D9D-040B-4D00-AD37-6DC6E6942693}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>RtmpTest</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="HttpMjpegTest.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
25
MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj.filters
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="HttpMjpegTest.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
55
MediaClient/HttpMjpegTest/mac.mk
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = httpmjpegtest
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION += -c -O3 -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -g -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I../MediaClient
|
||||||
|
INCLUDEDIR += -I../MediaClient/bm
|
||||||
|
INCLUDEDIR += -I../MediaClient/librtmp
|
||||||
|
INCLUDEDIR += -I../MediaClient/http
|
||||||
|
INCLUDEDIR += -I../MediaClient/media
|
||||||
|
INCLUDEDIR += -I../MediaClient/rtmp
|
||||||
|
INCLUDEDIR += -I../MediaClient/rtp
|
||||||
|
LIBDIRS += -L../MediaClient
|
||||||
|
LIBDIRS += -L../MediaClient/ffmpeg/lib/linux
|
||||||
|
LIBDIRS += -L../MediaClient/openssl/lib/linux
|
||||||
|
LIBDIRS += -L../MediaClient/zlib/lib/linux
|
||||||
|
OBJS = HttpMjpegTest.o
|
||||||
|
SHAREDLIB += -lhttpmjpegclient
|
||||||
|
SHAREDLIB += -lpthread
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
144
MediaClient/MediaClient.sln
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.33801.447
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaClient", "MediaClient\MediaClient.vcxproj", "{6814DE1C-B652-4384-B27E-59B9F964B6BF}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtspClientLibrary", "MediaClient\RtspClientLibrary.vcxproj", "{B50838F1-DCE1-4728-927E-EC591EB4A84E}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtspTest", "RtspTest\RtspTest.vcxproj", "{79A3B043-27AD-491F-96D9-A4E0158ED10B}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E} = {B50838F1-DCE1-4728-927E-EC591EB4A84E}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtmpClientLibrary", "MediaClient\RtmpClientLibrary.vcxproj", "{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtmpTest", "RtmpTest\RtmpTest.vcxproj", "{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91} = {4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HttpFlvClientLibrary", "MediaClient\HttpFlvClientLibrary.vcxproj", "{71F6F67D-3FF2-4BA6-A871-E9704753F27D}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HttpFlvTest", "HttpFlvTest\HttpFlvTest.vcxproj", "{23D7CA2E-F808-4986-BFB4-F349355222E9}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D} = {71F6F67D-3FF2-4BA6-A871-E9704753F27D}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SrtClientLibrary", "MediaClient\SrtClientLibrary.vcxproj", "{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SrtTest", "SrtTest\SrtTest.vcxproj", "{A2E369F0-71DD-4F38-B177-F66305199F56}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D} = {E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HttpMjpegClientLibrary", "MediaClient\HttpMjpegClientLibrary.vcxproj", "{A084CA49-A838-491A-8351-7AB117455480}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HttpMjpegTest", "HttpMjpegTest\HttpMjpegTest.vcxproj", "{E0552D9D-040B-4D00-AD37-6DC6E6942693}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480} = {A084CA49-A838-491A-8351-7AB117455480}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{6814DE1C-B652-4384-B27E-59B9F964B6BF}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{6814DE1C-B652-4384-B27E-59B9F964B6BF}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{6814DE1C-B652-4384-B27E-59B9F964B6BF}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{6814DE1C-B652-4384-B27E-59B9F964B6BF}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{6814DE1C-B652-4384-B27E-59B9F964B6BF}.Release|x64.Build.0 = Release|x64
|
||||||
|
{6814DE1C-B652-4384-B27E-59B9F964B6BF}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Release|x64.Build.0 = Release|x64
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{B50838F1-DCE1-4728-927E-EC591EB4A84E}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Release|x64.Build.0 = Release|x64
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{79A3B043-27AD-491F-96D9-A4E0158ED10B}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Release|x64.Build.0 = Release|x64
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Release|x64.Build.0 = Release|x64
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Release|x64.Build.0 = Release|x64
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{71F6F67D-3FF2-4BA6-A871-E9704753F27D}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Release|x64.Build.0 = Release|x64
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{23D7CA2E-F808-4986-BFB4-F349355222E9}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Release|x64.Build.0 = Release|x64
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{E2643523-9ABC-4B3A-8710-BD9EB8E44A5D}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Release|x64.Build.0 = Release|x64
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{A2E369F0-71DD-4F38-B177-F66305199F56}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Release|x64.Build.0 = Release|x64
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{A084CA49-A838-491A-8351-7AB117455480}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Release|x64.Build.0 = Release|x64
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{E0552D9D-040B-4D00-AD37-6DC6E6942693}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {B5AEC723-6691-46AD-B17D-0404AAF7C113}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
84
MediaClient/MediaClient/HttpFlvClientLibrary-android.mk
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpflvclient.so
|
||||||
|
NDK=/home/android-ndk-r25c
|
||||||
|
API=33
|
||||||
|
PLATFORM=armv7a
|
||||||
|
TOOLCHAIN=$(NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin
|
||||||
|
SYSROOT=$(NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot
|
||||||
|
ifneq ($(findstring armv7a, $(PLATFORM)),)
|
||||||
|
TARGET=$(PLATFORM)-linux-androideabi
|
||||||
|
RANLIB=$(TOOLCHAIN)/arm-linux-androideabi-ranlib
|
||||||
|
LINK = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
endif
|
||||||
|
ifneq ($(findstring aarch64, $(PLATFORM)),)
|
||||||
|
TARGET=$(PLATFORM)-linux-android
|
||||||
|
RANLIB=$(TOOLCHAIN)/$(TARGET)-ranlib
|
||||||
|
LINK = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
endif
|
||||||
|
CCOMPILE = $(TOOLCHAIN)/$(TARGET)$(API)-clang
|
||||||
|
CPPCOMPILE = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
COMPILEOPTION += -fPIC -DANDROID --sysroot=$(SYSROOT)
|
||||||
|
COMPILEOPTION += -c -O3 -Wall
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_flv_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
77
MediaClient/MediaClient/HttpFlvClientLibrary-ios.mk
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpflvclient.so
|
||||||
|
ARCH=arm64 #armv7, armv7s arm64
|
||||||
|
IOSVER=9.0
|
||||||
|
BASE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
||||||
|
SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
|
||||||
|
CCOMPILE = $(BASE)/clang
|
||||||
|
CPPCOMPILE = $(BASE)/clang++
|
||||||
|
COMPILEOPTION += -c -pipe -g -arch $(ARCH)
|
||||||
|
COMPILEOPTION += -Xarch_$(ARCH) -miphoneos-version-min=$(IOSVER) -Xarch_$(ARCH) -isysroot$(SYSROOT)
|
||||||
|
COMPILEOPTION += -fobjc-nonfragile-abi -fobjc-legacy-dispatch -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = $(BASE)/ar
|
||||||
|
LINKOPTION += -stdlib=libc++ -arch $(ARCH) -miphoneos-version-min=$(IOSVER) -Xarch_$(ARCH) -Wl,-syslibroot,$(SYSROOT) -Wl,-rpath,@executable_path/../Frameworks
|
||||||
|
LINKOPTION = -r $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_flv_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
70
MediaClient/MediaClient/HttpFlvClientLibrary-mac.mk
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpflvclient.so
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION += -c -O3 -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_flv_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
69
MediaClient/MediaClient/HttpFlvClientLibrary-static.mk
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpflvclient.a
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION = -c -O3 -fPIC -Wall
|
||||||
|
LINK = ar
|
||||||
|
LINKOPTION = cr $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_flv_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
70
MediaClient/MediaClient/HttpFlvClientLibrary.mk
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpflvclient.so
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION = -c -O3 -fPIC -Wall
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_flv_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
./mklinks.sh
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
178
MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{71F6F67D-3FF2-4BA6-A871-E9704753F27D}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>RtmpClientLibrary</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HT_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996;4267;4244;4018</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996;4267;4244;4018</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="bm\base64.cpp" />
|
||||||
|
<ClCompile Include="bm\hqueue.cpp" />
|
||||||
|
<ClCompile Include="bm\linked_list.cpp" />
|
||||||
|
<ClCompile Include="bm\ppstack.cpp" />
|
||||||
|
<ClCompile Include="bm\rfc_md5.cpp" />
|
||||||
|
<ClCompile Include="bm\sha256.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_buf.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_log.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_os.cpp" />
|
||||||
|
<ClCompile Include="bm\util.cpp" />
|
||||||
|
<ClCompile Include="bm\word_analyse.cpp" />
|
||||||
|
<ClCompile Include="http\http_cln.cpp" />
|
||||||
|
<ClCompile Include="http\http_flv_cln.cpp" />
|
||||||
|
<ClCompile Include="http\http_parse.cpp" />
|
||||||
|
<ClCompile Include="librtmp\amf.c" />
|
||||||
|
<ClCompile Include="librtmp\log.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
73
MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj.filters
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="bm">
|
||||||
|
<UniqueIdentifier>{f3e33128-2d95-4289-aa78-ee61da2270c6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="bm\base64.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\hqueue.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\linked_list.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\ppstack.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\rfc_md5.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_buf.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_log.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_os.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\util.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\word_analyse.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_flv_cln.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_parse.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_cln.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="librtmp\amf.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="librtmp\log.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sha256.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
80
MediaClient/MediaClient/HttpMjpegClientLibrary-android.mk
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpmjpegclient.so
|
||||||
|
NDK=/home/android-ndk-r25c
|
||||||
|
API=33
|
||||||
|
PLATFORM=armv7a
|
||||||
|
TOOLCHAIN=$(NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin
|
||||||
|
SYSROOT=$(NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot
|
||||||
|
ifneq ($(findstring armv7a, $(PLATFORM)),)
|
||||||
|
TARGET=$(PLATFORM)-linux-androideabi
|
||||||
|
RANLIB=$(TOOLCHAIN)/arm-linux-androideabi-ranlib
|
||||||
|
LINK = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
endif
|
||||||
|
ifneq ($(findstring aarch64, $(PLATFORM)),)
|
||||||
|
TARGET=$(PLATFORM)-linux-android
|
||||||
|
RANLIB=$(TOOLCHAIN)/$(TARGET)-ranlib
|
||||||
|
LINK = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
endif
|
||||||
|
CCOMPILE = $(TOOLCHAIN)/$(TARGET)$(API)-clang
|
||||||
|
CPPCOMPILE = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
COMPILEOPTION += -fPIC -DANDROID --sysroot=$(SYSROOT)
|
||||||
|
COMPILEOPTION += -c -O3 -Wall
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_mjpeg_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
73
MediaClient/MediaClient/HttpMjpegClientLibrary-ios.mk
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpmjpegclient.so
|
||||||
|
ARCH=arm64 #armv7, armv7s arm64
|
||||||
|
IOSVER=9.0
|
||||||
|
BASE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
||||||
|
SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
|
||||||
|
CCOMPILE = $(BASE)/clang
|
||||||
|
CPPCOMPILE = $(BASE)/clang++
|
||||||
|
COMPILEOPTION += -c -pipe -g -arch $(ARCH)
|
||||||
|
COMPILEOPTION += -Xarch_$(ARCH) -miphoneos-version-min=$(IOSVER) -Xarch_$(ARCH) -isysroot$(SYSROOT)
|
||||||
|
COMPILEOPTION += -fobjc-nonfragile-abi -fobjc-legacy-dispatch -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = $(BASE)/ar
|
||||||
|
LINKOPTION += -stdlib=libc++ -arch $(ARCH) -miphoneos-version-min=$(IOSVER) -Xarch_$(ARCH) -Wl,-syslibroot,$(SYSROOT) -Wl,-rpath,@executable_path/../Frameworks
|
||||||
|
LINKOPTION = -r $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_mjpeg_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
66
MediaClient/MediaClient/HttpMjpegClientLibrary-mac.mk
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpmjpegclient.so
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION += -c -O3 -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_mjpeg_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
65
MediaClient/MediaClient/HttpMjpegClientLibrary-static.mk
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpmjpegclient.a
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION = -c -O3 -fPIC -Wall
|
||||||
|
LINK = ar
|
||||||
|
LINKOPTION = cr $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_mjpeg_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
66
MediaClient/MediaClient/HttpMjpegClientLibrary.mk
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = libhttpmjpegclient.so
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION = -c -O3 -fPIC -Wall
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./http
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/base64.o
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/ppstack.o
|
||||||
|
OBJS += bm/rfc_md5.o
|
||||||
|
OBJS += bm/sha256.o
|
||||||
|
OBJS += bm/sys_buf.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += http/http_cln.o
|
||||||
|
OBJS += http/http_mjpeg_cln.o
|
||||||
|
OBJS += http/http_parse.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
./mklinks.sh
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
176
MediaClient/MediaClient/HttpMjpegClientLibrary.vcxproj
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{A084CA49-A838-491A-8351-7AB117455480}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>RtmpClientLibrary</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HT_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996;4267;4244;4018</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996;4267;4244;4018</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="bm\base64.cpp" />
|
||||||
|
<ClCompile Include="bm\hqueue.cpp" />
|
||||||
|
<ClCompile Include="bm\linked_list.cpp" />
|
||||||
|
<ClCompile Include="bm\ppstack.cpp" />
|
||||||
|
<ClCompile Include="bm\rfc_md5.cpp" />
|
||||||
|
<ClCompile Include="bm\sha256.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_buf.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_log.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_os.cpp" />
|
||||||
|
<ClCompile Include="bm\util.cpp" />
|
||||||
|
<ClCompile Include="bm\word_analyse.cpp" />
|
||||||
|
<ClCompile Include="http\http_cln.cpp" />
|
||||||
|
<ClCompile Include="http\http_mjpeg_cln.cpp" />
|
||||||
|
<ClCompile Include="http\http_parse.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="bm">
|
||||||
|
<UniqueIdentifier>{f3e33128-2d95-4289-aa78-ee61da2270c6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="bm\base64.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\hqueue.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\linked_list.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\ppstack.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\rfc_md5.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_buf.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_log.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_os.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\util.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\word_analyse.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_parse.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_cln.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sha256.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_mjpeg_cln.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
277
MediaClient/MediaClient/MediaClient.css
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
|
||||||
|
QMenuBar
|
||||||
|
{
|
||||||
|
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 lightgray, stop:1 darkgray);
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenuBar::item
|
||||||
|
{
|
||||||
|
spacing: 8px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenuBar::item:selected
|
||||||
|
{
|
||||||
|
background: rgb(40, 101, 168);
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu
|
||||||
|
{
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::item
|
||||||
|
{
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
padding: 4px 24px 4px 4px;
|
||||||
|
border: 0px solid transparent;
|
||||||
|
border-left-width: 24px;
|
||||||
|
background: rgb(80, 80, 80);
|
||||||
|
border-left-color: rgb(100,100,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::icon
|
||||||
|
{
|
||||||
|
left: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::item:selected:!disabled
|
||||||
|
{
|
||||||
|
background: rgb(40, 101, 168);
|
||||||
|
border-left-color: rgb(40, 101, 168);
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::separator
|
||||||
|
{
|
||||||
|
height: 2px;
|
||||||
|
background: lightblue;
|
||||||
|
margin-left: 2px;
|
||||||
|
margin-right: 2px;
|
||||||
|
border-left-width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::indicator
|
||||||
|
{
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
left: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QListView::item
|
||||||
|
{
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QListView::item:selected
|
||||||
|
{
|
||||||
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ABAFE5, stop: 1 #8588B2);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSlider::groove:horizontal
|
||||||
|
{
|
||||||
|
height: 5px;
|
||||||
|
background: rgb(18,46,84);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSlider#sliderPlay::groove:horizontal, QSlider#sliderVolume::groove:horizontal
|
||||||
|
{
|
||||||
|
height: 5px;
|
||||||
|
background: rgb(18,46,84);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSlider#sliderPlay::sub-page:horizontal, QSlider#sliderVolume::sub-page:horizontal
|
||||||
|
{
|
||||||
|
background: rgb(58,92,168);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSlider::handle:horizontal
|
||||||
|
{
|
||||||
|
background: rgb(165,229,254);
|
||||||
|
border: 4px solid #5c5c5c;
|
||||||
|
width: 8px;
|
||||||
|
height: 16px;
|
||||||
|
margin: -2px 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSlider#sliderPlay::handle:horizontal, QSlider#sliderVolume::handle:horizontal
|
||||||
|
{
|
||||||
|
background: rgb(165,229,254);
|
||||||
|
border: 1px solid #5c5c5c;
|
||||||
|
width: 14px;
|
||||||
|
margin: -2px 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabWidget::pane
|
||||||
|
{
|
||||||
|
border-top: 2px solid #C2C7CB;
|
||||||
|
border-bottom: 2px solid #C2C7CB;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabBar::tab
|
||||||
|
{
|
||||||
|
background-color: rgb(192,192,192);
|
||||||
|
border: 2px solid #C4C4C3;
|
||||||
|
border-bottom-color: #C2C7CB;
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
min-width: 10ex;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabBar::tab:selected
|
||||||
|
{
|
||||||
|
background-color: rgb(64,64,64);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabBar::tab:!selected
|
||||||
|
{
|
||||||
|
background-color: rgb(32,32,32);
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabBar::tab:hover
|
||||||
|
{
|
||||||
|
background-color: rgb(100,100,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabBar::tab:disabled
|
||||||
|
{
|
||||||
|
background-color: gray;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
QHeaderView
|
||||||
|
{
|
||||||
|
min-height:25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableView QHeaderView::section
|
||||||
|
{
|
||||||
|
background-color:rgb(64,64,64);
|
||||||
|
border: 2px solid #6c6c6c;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableView QTableCornerButton::section
|
||||||
|
{
|
||||||
|
background: rgb(64,64,64);
|
||||||
|
border: 2px outset rgb(64,64,64);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton
|
||||||
|
{
|
||||||
|
background-color: black;
|
||||||
|
border-color: rgb(100,100,100);
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:hover
|
||||||
|
{
|
||||||
|
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #123456, stop: 1 #f6f7fa);
|
||||||
|
border-style: inset;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton
|
||||||
|
{
|
||||||
|
border: 2px solid #8f8f91;
|
||||||
|
border-radius: 6px;
|
||||||
|
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f6f7fa, stop: 1 #dadbde);
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton[popupMode="1"]
|
||||||
|
{
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton:pressed, QToolButton:hover
|
||||||
|
{
|
||||||
|
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #123456, stop: 1 #f6f7fa);
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton::menu-button
|
||||||
|
{
|
||||||
|
border: 2px solid gray;
|
||||||
|
border-top-right-radius: 6px;
|
||||||
|
border-bottom-right-radius: 6px;
|
||||||
|
width: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton::menu-arrow:open
|
||||||
|
{
|
||||||
|
top: 1px; left: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolTip
|
||||||
|
{
|
||||||
|
border: 2px solid darkkhaki;
|
||||||
|
padding: 1px;
|
||||||
|
border-radius: 3px;
|
||||||
|
opacity: 200;
|
||||||
|
color: white;
|
||||||
|
background-color: #2E3648;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView
|
||||||
|
{
|
||||||
|
show-decoration-selected: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView::item
|
||||||
|
{
|
||||||
|
height: 20;
|
||||||
|
border: 0px solid #d9d9d9;
|
||||||
|
border-top-color: transparent;
|
||||||
|
border-bottom-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView::item:hover
|
||||||
|
{
|
||||||
|
background: rgb(40, 101, 168);
|
||||||
|
border: 1px solid #bfcde4;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView::item:selected
|
||||||
|
{
|
||||||
|
border: 1px solid #567dbc;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView::item:selected:active
|
||||||
|
{
|
||||||
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView::item:selected:!active
|
||||||
|
{
|
||||||
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView QHeaderView::section
|
||||||
|
{
|
||||||
|
background-color:rgb(64,64,64);
|
||||||
|
border: 1px solid #6c6c6c;
|
||||||
|
min-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget
|
||||||
|
{
|
||||||
|
/*background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f6f7fa, stop: 1 #dadbde);*/
|
||||||
|
background-color: rgb(64,64,64);
|
||||||
|
color: white; /* font color */
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit
|
||||||
|
{
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color:rgb(128,128,128);
|
||||||
|
}
|
||||||
|
|
||||||
|
* { gridline-color: gray }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
MediaClient/MediaClient/MediaClient.ico
Normal file
|
After Width: | Height: | Size: 20 KiB |
244
MediaClient/MediaClient/MediaClient.pro
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2021-04-016T09:50:05
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui multimedia widgets
|
||||||
|
|
||||||
|
CONFIG += c++11
|
||||||
|
macx:CONFIG += sdk_no_version_check
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
TARGET = MediaClient
|
||||||
|
|
||||||
|
DEFINES += HTTPS
|
||||||
|
DEFINES += BACKCHANNEL
|
||||||
|
DEFINES += REPLAY
|
||||||
|
DEFINES += OVER_HTTP
|
||||||
|
DEFINES += OVER_WEBSOCKET
|
||||||
|
|
||||||
|
unix {
|
||||||
|
macx {
|
||||||
|
DEFINES += IOS
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DEFINES += EPOLL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# You can make your code fail to compile if it uses deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
INCLUDEPATH += bm
|
||||||
|
INCLUDEPATH += formClass
|
||||||
|
INCLUDEPATH += http
|
||||||
|
INCLUDEPATH += librtmp
|
||||||
|
INCLUDEPATH += media
|
||||||
|
INCLUDEPATH += rtmp
|
||||||
|
INCLUDEPATH += rtp
|
||||||
|
INCLUDEPATH += rtsp
|
||||||
|
INCLUDEPATH += srt
|
||||||
|
INCLUDEPATH += ui
|
||||||
|
|
||||||
|
unix {
|
||||||
|
macx {
|
||||||
|
INCLUDEPATH += /usr/local/include
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
INCLUDEPATH += ffmpeg/include
|
||||||
|
INCLUDEPATH += libsrt/include
|
||||||
|
INCLUDEPATH += openssl/include
|
||||||
|
INCLUDEPATH += sdl/include
|
||||||
|
INCLUDEPATH += zlib/include
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
bm/base64.cpp \
|
||||||
|
bm/hqueue.cpp \
|
||||||
|
bm/linked_list.cpp \
|
||||||
|
bm/ppstack.cpp \
|
||||||
|
bm/rfc_md5.cpp \
|
||||||
|
bm/sha256.cpp \
|
||||||
|
bm/sys_buf.cpp \
|
||||||
|
bm/sys_log.cpp \
|
||||||
|
bm/sys_os.cpp \
|
||||||
|
bm/util.cpp \
|
||||||
|
bm/word_analyse.cpp \
|
||||||
|
formClass/CustomLayoutWidget.cpp \
|
||||||
|
formClass/DialogTitle.cpp \
|
||||||
|
formClass/FloatWidget.cpp \
|
||||||
|
formClass/MediaClient.cpp \
|
||||||
|
formClass/MediaInfo.cpp \
|
||||||
|
formClass/OpenMedia.cpp \
|
||||||
|
formClass/SystemSetting.cpp \
|
||||||
|
formClass/UMSlider.cpp \
|
||||||
|
formClass/VideoSubWidget.cpp \
|
||||||
|
formClass/VideoWidget.cpp \
|
||||||
|
formClass/WidgetManager.cpp \
|
||||||
|
formClass/ZoneConfig.cpp \
|
||||||
|
http/http_cln.cpp \
|
||||||
|
http/http_flv_cln.cpp \
|
||||||
|
http/http_mjpeg_cln.cpp \
|
||||||
|
http/http_parse.cpp \
|
||||||
|
http/http_test.cpp \
|
||||||
|
librtmp/amf.c \
|
||||||
|
librtmp/hashswf.c \
|
||||||
|
librtmp/log.c \
|
||||||
|
librtmp/parseurl.c \
|
||||||
|
librtmp/rtmp.c \
|
||||||
|
media/audio_capture.cpp \
|
||||||
|
media/audio_decoder.cpp \
|
||||||
|
media/audio_encoder.cpp \
|
||||||
|
media/audio_play.cpp \
|
||||||
|
media/avcodec_mutex.cpp \
|
||||||
|
media/avi_write.cpp \
|
||||||
|
media/file_player.cpp \
|
||||||
|
media/http_flv_player.cpp \
|
||||||
|
media/http_mjpeg_player.cpp \
|
||||||
|
media/media_codec.cpp \
|
||||||
|
media/media_parse.cpp \
|
||||||
|
media/media_util.cpp \
|
||||||
|
media/rtmp_player.cpp \
|
||||||
|
media/rtsp_player.cpp \
|
||||||
|
media/srt_player.cpp \
|
||||||
|
media/video_decoder.cpp \
|
||||||
|
media/video_render.cpp \
|
||||||
|
media/video_render_sdl.cpp \
|
||||||
|
rtmp/rtmp_cln.cpp \
|
||||||
|
rtp/aac_rtp_rx.cpp \
|
||||||
|
rtp/h264_rtp_rx.cpp \
|
||||||
|
rtp/h264_util.cpp \
|
||||||
|
rtp/h265_rtp_rx.cpp \
|
||||||
|
rtp/h265_util.cpp \
|
||||||
|
rtp/mjpeg_rtp_rx.cpp \
|
||||||
|
rtp/mjpeg_tables.cpp \
|
||||||
|
rtp/mpeg4.cpp \
|
||||||
|
rtp/mpeg4_rtp_rx.cpp \
|
||||||
|
rtp/pcm_rtp_rx.cpp \
|
||||||
|
rtp/rtp.cpp \
|
||||||
|
rtp/rtp_rx.cpp \
|
||||||
|
rtp/ts_parser.cpp \
|
||||||
|
rtsp/rtsp_backchannel.cpp \
|
||||||
|
rtsp/rtsp_cln.cpp \
|
||||||
|
rtsp/rtsp_parse.cpp \
|
||||||
|
rtsp/rtsp_rcua.cpp \
|
||||||
|
rtsp/rtsp_util.cpp \
|
||||||
|
rtsp/rtsp_ws.cpp \
|
||||||
|
srt/srt_cln.cpp \
|
||||||
|
main.cpp \
|
||||||
|
utils.cpp \
|
||||||
|
|
||||||
|
unix {
|
||||||
|
macx {
|
||||||
|
SOURCES += \
|
||||||
|
media/audio_capture_mac.cpp \
|
||||||
|
media/audio_capture_avf.mm \
|
||||||
|
media/audio_play_mac.cpp \
|
||||||
|
media/audio_play_avf.mm \
|
||||||
|
media/video_player.mm \
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SOURCES += \
|
||||||
|
media/alsa.cpp \
|
||||||
|
media/audio_capture_linux.cpp \
|
||||||
|
media/audio_play_qt.cpp \
|
||||||
|
media/video_player.cpp \
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
formClass/CustomLayoutWidget.h \
|
||||||
|
formClass/DialogTitle.h \
|
||||||
|
formClass/FloatWidget.h \
|
||||||
|
formClass/MediaClient.h \
|
||||||
|
formClass/MediaInfo.h \
|
||||||
|
formClass/OpenMedia.h \
|
||||||
|
formClass/SystemSetting.h \
|
||||||
|
formClass/UMSlider.h \
|
||||||
|
formClass/VideoSubWidget.h \
|
||||||
|
formClass/VideoWidget.h \
|
||||||
|
formClass/WidgetManager.h \
|
||||||
|
formClass/ZoneConfig.h \
|
||||||
|
media/file_player.h \
|
||||||
|
media/http_flv_player.h \
|
||||||
|
media/http_mjpeg_player.h \
|
||||||
|
media/rtmp_player.h \
|
||||||
|
media/rtsp_player.h \
|
||||||
|
media/srt_player.h \
|
||||||
|
media/video_player.h \
|
||||||
|
|
||||||
|
unix {
|
||||||
|
macx {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
HEADERS += \
|
||||||
|
media/audio_play_qt.h \
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
ui/CustomLayoutWidget.ui \
|
||||||
|
ui/FloatWidget.ui \
|
||||||
|
ui/MediaClient.ui \
|
||||||
|
ui/MediaInfo.ui \
|
||||||
|
ui/OpenMedia.ui \
|
||||||
|
ui/SystemSetting.ui \
|
||||||
|
ui/VideoWidget.ui \
|
||||||
|
|
||||||
|
unix {
|
||||||
|
macx {
|
||||||
|
LIBS += -L/usr/local/lib
|
||||||
|
LIBS += -lavformat
|
||||||
|
LIBS += -lswscale
|
||||||
|
LIBS += -lavcodec
|
||||||
|
LIBS += -lswresample
|
||||||
|
LIBS += -lavutil
|
||||||
|
LIBS += -lopus
|
||||||
|
LIBS += -lx264
|
||||||
|
LIBS += -lx265
|
||||||
|
LIBS += -lsrt
|
||||||
|
LIBS += -lcrypto
|
||||||
|
LIBS += -lssl
|
||||||
|
LIBS += -lz
|
||||||
|
LIBS += -lSDL2
|
||||||
|
LIBS += -framework AudioToolbox
|
||||||
|
LIBS += -framework AVFoundation
|
||||||
|
LIBS += -framework CoreAudio
|
||||||
|
LIBS += -framework CoreFoundation
|
||||||
|
LIBS += -framework CoreMedia
|
||||||
|
LIBS += -framework Foundation
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LIBS += -L$$PWD/ffmpeg/lib/linux
|
||||||
|
LIBS += -L$$PWD/libsrt/lib/linux
|
||||||
|
LIBS += -L$$PWD/openssl/lib/linux
|
||||||
|
LIBS += -L$$PWD/zlib/lib/linux
|
||||||
|
LIBS += -L$$PWD/sdl/lib/linux
|
||||||
|
LIBS += -lavformat
|
||||||
|
LIBS += -lswscale
|
||||||
|
LIBS += -lavcodec
|
||||||
|
LIBS += -lswresample
|
||||||
|
LIBS += -lavutil
|
||||||
|
LIBS += -lopus
|
||||||
|
LIBS += -lx264
|
||||||
|
LIBS += -lx265
|
||||||
|
LIBS += -lsrt
|
||||||
|
LIBS += -lcrypto
|
||||||
|
LIBS += -lssl
|
||||||
|
LIBS += -lz
|
||||||
|
LIBS += -lSDL2
|
||||||
|
LIBS += -lasound
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCES += MediaClient.qrc
|
||||||
|
|
||||||
|
TRANSLATIONS += mediaclient_zh.ts
|
||||||
|
|
||||||
|
# Default rules for deployment.
|
||||||
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
31
MediaClient/MediaClient/MediaClient.qrc
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/res">
|
||||||
|
<file>Resources/help.png</file>
|
||||||
|
<file>Resources/1.png</file>
|
||||||
|
<file>Resources/4.png</file>
|
||||||
|
<file>Resources/6.png</file>
|
||||||
|
<file>Resources/9.png</file>
|
||||||
|
<file>Resources/16.png</file>
|
||||||
|
<file>Resources/custom.png</file>
|
||||||
|
<file>Resources/full.png</file>
|
||||||
|
<file>Resources/stopall.png</file>
|
||||||
|
<file>Resources/btn_close.png</file>
|
||||||
|
<file>Resources/btn_max.png</file>
|
||||||
|
<file>Resources/btn_max_hot.png</file>
|
||||||
|
<file>Resources/btn_min.png</file>
|
||||||
|
<file>Resources/main.png</file>
|
||||||
|
<file>Resources/btn_pause.png</file>
|
||||||
|
<file>Resources/btn_play.png</file>
|
||||||
|
<file>Resources/btn_stop.png</file>
|
||||||
|
<file>Resources/mic.png</file>
|
||||||
|
<file>Resources/mute.png</file>
|
||||||
|
<file>Resources/snapshot.png</file>
|
||||||
|
<file>Resources/stop_record.png</file>
|
||||||
|
<file>Resources/video_record.png</file>
|
||||||
|
<file>Resources/volume.png</file>
|
||||||
|
<file>Resources/stopmic.png</file>
|
||||||
|
<file>Resources/config.png</file>
|
||||||
|
<file>Resources/browse_folder.png</file>
|
||||||
|
<file>Resources/open_folder.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
2
MediaClient/MediaClient/MediaClient.rc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
IDI_ICON1 ICON DISCARDABLE "MediaClient.ico"
|
||||||
|
|
||||||
390
MediaClient/MediaClient/MediaClient.vcxproj
Normal file
@@ -0,0 +1,390 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{6814DE1C-B652-4384-B27E-59B9F964B6BF}</ProjectGuid>
|
||||||
|
<Keyword>QtVS_v304</Keyword>
|
||||||
|
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">10.0</WindowsTargetPlatformVersion>
|
||||||
|
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">10.0</WindowsTargetPlatformVersion>
|
||||||
|
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">10.0</WindowsTargetPlatformVersion>
|
||||||
|
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)'=='Release|x64'">10.0</WindowsTargetPlatformVersion>
|
||||||
|
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
|
||||||
|
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings">
|
||||||
|
<QtInstall>msvc2017</QtInstall>
|
||||||
|
<QtModules>core;gui;widgets;winextras</QtModules>
|
||||||
|
<QtBuildConfig>debug</QtBuildConfig>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings">
|
||||||
|
<QtInstall>6.5.1_msvc2019_64</QtInstall>
|
||||||
|
<QtModules>core;gui;widgets</QtModules>
|
||||||
|
<QtBuildConfig>debug</QtBuildConfig>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings">
|
||||||
|
<QtInstall>msvc2017</QtInstall>
|
||||||
|
<QtModules>core;gui;widgets;winextras</QtModules>
|
||||||
|
<QtBuildConfig>release</QtBuildConfig>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings">
|
||||||
|
<QtInstall>6.5.1_msvc2019_64</QtInstall>
|
||||||
|
<QtModules>core;gui;widgets</QtModules>
|
||||||
|
<QtBuildConfig>release</QtBuildConfig>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
||||||
|
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
|
||||||
|
</Target>
|
||||||
|
<ImportGroup Label="ExtensionSettings" />
|
||||||
|
<ImportGroup Label="Shared" />
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(QtMsBuild)\Qt.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(QtMsBuild)\Qt.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(QtMsBuild)\Qt.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(QtMsBuild)\Qt.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Vcpkg">
|
||||||
|
<VcpkgEnabled>false</VcpkgEnabled>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>.\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4819;4005;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
<PreprocessorDefinitions>HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>.\directx\lib\x86;.\ffmpeg\lib\x86;.\openssl\lib\x86;.\zlib\lib\x86;.\libsrt\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;d3d9.lib;d3dx9.lib;libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;srt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
|
</Link>
|
||||||
|
<QtTranslation>
|
||||||
|
<BuildAction>lupdate</BuildAction>
|
||||||
|
</QtTranslation>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>.\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4819;4005;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
<PreprocessorDefinitions>HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>.\directx\lib\x64;.\ffmpeg\lib\x64;.\openssl\lib\x64;.\zlib\lib\x64;.\libsrt\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;d3d9.lib;d3dx9.lib;libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;srt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
|
</Link>
|
||||||
|
<QtTranslation>
|
||||||
|
<BuildAction>lupdate</BuildAction>
|
||||||
|
</QtTranslation>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;d3d9.lib;d3dx9.lib;libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;srt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>.\directx\lib\x86;.\ffmpeg\lib\x86;.\openssl\lib\x86;.\zlib\lib\x86;.\libsrt\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
|
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||||
|
</Link>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>.\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<DisableSpecificWarnings>4819;4005;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<QtTranslation>
|
||||||
|
<BuildAction>false</BuildAction>
|
||||||
|
</QtTranslation>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;d3d9.lib;d3dx9.lib;libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;srt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>.\directx\lib\x64;.\ffmpeg\lib\x64;.\openssl\lib\x64;.\zlib\lib\x64;.\libsrt\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
|
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||||
|
</Link>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>.\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<DisableSpecificWarnings>4819;4005;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<QtTranslation>
|
||||||
|
<BuildAction>lupdate</BuildAction>
|
||||||
|
</QtTranslation>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
|
||||||
|
<ClCompile>
|
||||||
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ClCompile>
|
||||||
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
|
||||||
|
<ClCompile>
|
||||||
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ClCompile>
|
||||||
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="bm\base64.cpp" />
|
||||||
|
<ClCompile Include="bm\hqueue.cpp" />
|
||||||
|
<ClCompile Include="bm\linked_list.cpp" />
|
||||||
|
<ClCompile Include="bm\ppstack.cpp" />
|
||||||
|
<ClCompile Include="bm\rfc_md5.cpp" />
|
||||||
|
<ClCompile Include="bm\sha1.cpp" />
|
||||||
|
<ClCompile Include="bm\sha256.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_buf.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_log.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_os.cpp" />
|
||||||
|
<ClCompile Include="bm\util.cpp" />
|
||||||
|
<ClCompile Include="bm\word_analyse.cpp" />
|
||||||
|
<ClCompile Include="formClass\CustomLayoutWidget.cpp" />
|
||||||
|
<ClCompile Include="formClass\DialogTitle.cpp" />
|
||||||
|
<ClCompile Include="formClass\FloatWidget.cpp" />
|
||||||
|
<ClCompile Include="formClass\MediaInfo.cpp" />
|
||||||
|
<ClCompile Include="formClass\OpenMedia.cpp" />
|
||||||
|
<ClCompile Include="formClass\SystemSetting.cpp" />
|
||||||
|
<ClCompile Include="formClass\UMSlider.cpp" />
|
||||||
|
<ClCompile Include="formClass\VideoSubWidget.cpp" />
|
||||||
|
<ClCompile Include="formClass\VideoWidget.cpp" />
|
||||||
|
<ClCompile Include="formClass\WidgetManager.cpp" />
|
||||||
|
<ClCompile Include="formClass\ZoneConfig.cpp" />
|
||||||
|
<ClCompile Include="http\http_cln.cpp" />
|
||||||
|
<ClCompile Include="http\http_flv_cln.cpp" />
|
||||||
|
<ClCompile Include="http\http_mjpeg_cln.cpp" />
|
||||||
|
<ClCompile Include="http\http_parse.cpp" />
|
||||||
|
<ClCompile Include="http\http_test.cpp" />
|
||||||
|
<ClCompile Include="librtmp\amf.c" />
|
||||||
|
<ClCompile Include="librtmp\hashswf.c" />
|
||||||
|
<ClCompile Include="librtmp\log.c" />
|
||||||
|
<ClCompile Include="librtmp\parseurl.c" />
|
||||||
|
<ClCompile Include="librtmp\rtmp.c" />
|
||||||
|
<ClCompile Include="media\audio_capture.cpp" />
|
||||||
|
<ClCompile Include="media\audio_capture_win.cpp" />
|
||||||
|
<ClCompile Include="media\audio_decoder.cpp" />
|
||||||
|
<ClCompile Include="media\audio_encoder.cpp" />
|
||||||
|
<ClCompile Include="media\audio_play.cpp" />
|
||||||
|
<ClCompile Include="media\audio_play_win.cpp" />
|
||||||
|
<ClCompile Include="media\avcodec_mutex.cpp" />
|
||||||
|
<ClCompile Include="media\avi_write.cpp" />
|
||||||
|
<ClCompile Include="media\file_player.cpp" />
|
||||||
|
<ClCompile Include="media\http_flv_player.cpp" />
|
||||||
|
<ClCompile Include="media\http_mjpeg_player.cpp" />
|
||||||
|
<ClCompile Include="media\media_codec.cpp" />
|
||||||
|
<ClCompile Include="media\media_parse.cpp" />
|
||||||
|
<ClCompile Include="media\media_util.cpp" />
|
||||||
|
<ClCompile Include="media\rtmp_player.cpp" />
|
||||||
|
<ClCompile Include="media\rtsp_player.cpp" />
|
||||||
|
<ClCompile Include="media\srt_player.cpp" />
|
||||||
|
<ClCompile Include="media\video_decoder.cpp" />
|
||||||
|
<ClCompile Include="media\video_player.cpp" />
|
||||||
|
<ClCompile Include="media\video_render.cpp" />
|
||||||
|
<ClCompile Include="media\video_render_d3d.cpp" />
|
||||||
|
<ClCompile Include="media\video_render_gdi.cpp" />
|
||||||
|
<ClCompile Include="rtmp\rtmp_cln.cpp" />
|
||||||
|
<ClCompile Include="rtp\aac_rtp_rx.cpp" />
|
||||||
|
<ClCompile Include="rtp\h264_rtp_rx.cpp" />
|
||||||
|
<ClCompile Include="rtp\h264_util.cpp" />
|
||||||
|
<ClCompile Include="rtp\h265_rtp_rx.cpp" />
|
||||||
|
<ClCompile Include="rtp\h265_util.cpp" />
|
||||||
|
<ClCompile Include="rtp\mjpeg_rtp_rx.cpp" />
|
||||||
|
<ClCompile Include="rtp\mjpeg_tables.cpp" />
|
||||||
|
<ClCompile Include="rtp\mpeg4.cpp" />
|
||||||
|
<ClCompile Include="rtp\mpeg4_rtp_rx.cpp" />
|
||||||
|
<ClCompile Include="rtp\pcm_rtp_rx.cpp" />
|
||||||
|
<ClCompile Include="rtp\rtp.cpp" />
|
||||||
|
<ClCompile Include="rtp\rtp_rx.cpp" />
|
||||||
|
<ClCompile Include="rtp\ts_parser.cpp" />
|
||||||
|
<ClCompile Include="rtsp\rtsp_backchannel.cpp" />
|
||||||
|
<ClCompile Include="rtsp\rtsp_cln.cpp" />
|
||||||
|
<ClCompile Include="rtsp\rtsp_parse.cpp" />
|
||||||
|
<ClCompile Include="rtsp\rtsp_rcua.cpp" />
|
||||||
|
<ClCompile Include="rtsp\rtsp_util.cpp" />
|
||||||
|
<ClCompile Include="rtsp\rtsp_ws.cpp" />
|
||||||
|
<ClCompile Include="srt\srt_cln.cpp" />
|
||||||
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="utils.cpp" />
|
||||||
|
<QtRcc Include="MediaClient.qrc" />
|
||||||
|
<ClCompile Include="formClass\MediaClient.cpp" />
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtMoc Include="formClass\MediaClient.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtUic Include="ui\CustomLayoutWidget.ui" />
|
||||||
|
<QtUic Include="ui\FloatWidget.ui" />
|
||||||
|
<QtUic Include="ui\MediaClient.ui" />
|
||||||
|
<QtUic Include="ui\MediaInfo.ui" />
|
||||||
|
<QtUic Include="ui\OpenMedia.ui" />
|
||||||
|
<QtUic Include="ui\SystemSetting.ui" />
|
||||||
|
<QtUic Include="ui\VideoWidget.ui" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="bm\base64.h" />
|
||||||
|
<ClInclude Include="bm\hqueue.h" />
|
||||||
|
<ClInclude Include="bm\linked_list.h" />
|
||||||
|
<ClInclude Include="bm\ppstack.h" />
|
||||||
|
<ClInclude Include="bm\rfc_md5.h" />
|
||||||
|
<ClInclude Include="bm\sha1.h" />
|
||||||
|
<ClInclude Include="bm\sys_buf.h" />
|
||||||
|
<ClInclude Include="bm\sys_inc.h" />
|
||||||
|
<ClInclude Include="bm\sys_log.h" />
|
||||||
|
<ClInclude Include="bm\util.h" />
|
||||||
|
<ClInclude Include="bm\word_analyse.h" />
|
||||||
|
<QtMoc Include="formClass\OpenMedia.h" />
|
||||||
|
<QtMoc Include="formClass\MediaInfo.h" />
|
||||||
|
<ClInclude Include="http\http.h" />
|
||||||
|
<ClInclude Include="http\http_cln.h" />
|
||||||
|
<ClInclude Include="http\http_parse.h" />
|
||||||
|
<ClInclude Include="librtmp\amf.h" />
|
||||||
|
<ClInclude Include="librtmp\bytes.h" />
|
||||||
|
<ClInclude Include="librtmp\dh.h" />
|
||||||
|
<ClInclude Include="librtmp\dhgroups.h" />
|
||||||
|
<ClInclude Include="librtmp\handshake.h" />
|
||||||
|
<ClInclude Include="librtmp\http.h" />
|
||||||
|
<ClInclude Include="librtmp\log.h" />
|
||||||
|
<ClInclude Include="librtmp\rtmp.h" />
|
||||||
|
<ClInclude Include="librtmp\rtmp_sys.h" />
|
||||||
|
<ClInclude Include="media\audio_capture.h" />
|
||||||
|
<ClInclude Include="media\audio_decoder.h" />
|
||||||
|
<ClInclude Include="media\audio_encoder.h" />
|
||||||
|
<ClInclude Include="media\audio_play.h" />
|
||||||
|
<ClInclude Include="media\avcodec_mutex.h" />
|
||||||
|
<QtMoc Include="media\file_player.h" />
|
||||||
|
<QtMoc Include="media\http_flv_player.h" />
|
||||||
|
<QtMoc Include="media\http_mjpeg_player.h" />
|
||||||
|
<ClInclude Include="media\media_codec.h" />
|
||||||
|
<QtMoc Include="media\rtmp_player.h" />
|
||||||
|
<QtMoc Include="media\srt_player.h" />
|
||||||
|
<ClInclude Include="media\video_decoder.h" />
|
||||||
|
<ClInclude Include="media\video_render.h" />
|
||||||
|
<ClInclude Include="media\video_render_d3d.h" />
|
||||||
|
<ClInclude Include="media\video_render_gdi.h" />
|
||||||
|
<ClInclude Include="rtmp\rtmp_cln.h" />
|
||||||
|
<ClInclude Include="rtsp\rtsp_backchannel.h" />
|
||||||
|
<ClInclude Include="rtsp\rtsp_cln.h" />
|
||||||
|
<ClInclude Include="rtsp\rtsp_parse.h" />
|
||||||
|
<ClInclude Include="rtsp\rtsp_rcua.h" />
|
||||||
|
<ClInclude Include="rtsp\rtsp_util.h" />
|
||||||
|
<QtMoc Include="media\video_player.h" />
|
||||||
|
<ClInclude Include="rtp\aac_rtp_rx.h" />
|
||||||
|
<ClInclude Include="rtp\h265_util.h" />
|
||||||
|
<QtMoc Include="media\rtsp_player.h" />
|
||||||
|
<QtMoc Include="formClass\ZoneConfig.h" />
|
||||||
|
<QtMoc Include="formClass\WidgetManager.h" />
|
||||||
|
<QtMoc Include="formClass\VideoWidget.h" />
|
||||||
|
<QtMoc Include="formClass\VideoSubWidget.h" />
|
||||||
|
<QtMoc Include="formClass\UMSlider.h" />
|
||||||
|
<QtMoc Include="formClass\SystemSetting.h" />
|
||||||
|
<QtMoc Include="formClass\FloatWidget.h" />
|
||||||
|
<QtMoc Include="formClass\DialogTitle.h" />
|
||||||
|
<QtMoc Include="formClass\CustomLayoutWidget.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="MediaClient.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtTranslation Include="mediaclient_zh.ts" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||||
|
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
516
MediaClient/MediaClient/MediaClient.vcxproj.filters
Normal file
@@ -0,0 +1,516 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Form Files">
|
||||||
|
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
||||||
|
<Extensions>ui</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Translation Files">
|
||||||
|
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||||
|
<Extensions>ts</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="formClass">
|
||||||
|
<UniqueIdentifier>{f9efb1b7-44e1-465c-a185-398493b71a75}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="bm">
|
||||||
|
<UniqueIdentifier>{f4059e3a-5bfc-4ed0-9dcc-c48fbf2fe657}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="media">
|
||||||
|
<UniqueIdentifier>{17cf4518-ba24-472b-a927-a12116d8a1c0}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="rtp">
|
||||||
|
<UniqueIdentifier>{99d8fe9c-bb92-40fd-816a-6db62f0bbb29}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="rtsp">
|
||||||
|
<UniqueIdentifier>{8e528862-850e-458a-ac31-84b0f3ff2a9e}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="http">
|
||||||
|
<UniqueIdentifier>{13c7c9b7-c60f-4cbe-89a4-5a4e8ecb67e7}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="rtmp">
|
||||||
|
<UniqueIdentifier>{b8a8f0a1-bd04-4666-960d-d25d257a62a0}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="librtmp">
|
||||||
|
<UniqueIdentifier>{debd2512-967d-4028-a2d9-d02d3debf1de}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="srt">
|
||||||
|
<UniqueIdentifier>{9edf4b63-c6cf-4a94-8814-85d37816af01}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtRcc Include="MediaClient.qrc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</QtRcc>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\MediaClient.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="utils.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\base64.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\hqueue.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\linked_list.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\ppstack.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\rfc_md5.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sha1.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_buf.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_log.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sys_os.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\util.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\word_analyse.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\CustomLayoutWidget.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\DialogTitle.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\FloatWidget.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\SystemSetting.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\UMSlider.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\VideoSubWidget.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\VideoWidget.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\WidgetManager.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\ZoneConfig.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\rtsp_player.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\avi_write.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\media_parse.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\media_util.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\aac_rtp_rx.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\h264_rtp_rx.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\h264_util.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\h265_rtp_rx.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\h265_util.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\mjpeg_rtp_rx.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\mjpeg_tables.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\mpeg4.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\mpeg4_rtp_rx.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\pcm_rtp_rx.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\rtp_rx.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\video_player.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtsp\rtsp_backchannel.cpp">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtsp\rtsp_cln.cpp">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtsp\rtsp_parse.cpp">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtsp\rtsp_rcua.cpp">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtsp\rtsp_util.cpp">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\audio_decoder.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\video_decoder.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\video_render.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\video_render_d3d.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\video_render_gdi.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\media_codec.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\avcodec_mutex.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\audio_play.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_cln.cpp">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_parse.cpp">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\OpenMedia.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="librtmp\amf.c">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="librtmp\hashswf.c">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="librtmp\log.c">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="librtmp\parseurl.c">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="librtmp\rtmp.c">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtmp\rtmp_cln.cpp">
|
||||||
|
<Filter>rtmp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\rtmp_player.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\audio_capture.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\audio_encoder.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\file_player.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\rtp.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_flv_cln.cpp">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\http_flv_player.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_test.cpp">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="formClass\MediaInfo.cpp">
|
||||||
|
<Filter>formClass</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\audio_capture_win.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\audio_play_win.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="srt\srt_cln.cpp">
|
||||||
|
<Filter>srt</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtp\ts_parser.cpp">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\srt_player.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="rtsp\rtsp_ws.cpp">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="bm\sha256.cpp">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="media\http_mjpeg_player.cpp">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="http\http_mjpeg_cln.cpp">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtMoc Include="formClass\MediaClient.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\CustomLayoutWidget.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\DialogTitle.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\FloatWidget.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\SystemSetting.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\UMSlider.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\VideoSubWidget.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\VideoWidget.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\WidgetManager.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\ZoneConfig.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="media\rtsp_player.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="media\video_player.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\OpenMedia.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="media\rtmp_player.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="media\file_player.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="media\http_flv_player.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="formClass\MediaInfo.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="media\srt_player.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="media\http_mjpeg_player.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtUic Include="ui\CustomLayoutWidget.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="ui\FloatWidget.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="ui\SystemSetting.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="ui\VideoWidget.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="ui\MediaClient.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="ui\OpenMedia.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="ui\MediaInfo.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="bm\base64.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\hqueue.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\linked_list.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\ppstack.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\rfc_md5.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\sha1.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\sys_buf.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\sys_inc.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\sys_log.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\util.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="bm\word_analyse.h">
|
||||||
|
<Filter>bm</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtp\aac_rtp_rx.h">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtp\h265_util.h">
|
||||||
|
<Filter>rtp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtsp\rtsp_backchannel.h">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtsp\rtsp_cln.h">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtsp\rtsp_parse.h">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtsp\rtsp_rcua.h">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtsp\rtsp_util.h">
|
||||||
|
<Filter>rtsp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\audio_decoder.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\video_decoder.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\video_render.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\video_render_d3d.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\video_render_gdi.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\media_codec.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\avcodec_mutex.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\audio_play.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="http\http.h">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="http\http_cln.h">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="http\http_parse.h">
|
||||||
|
<Filter>http</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\amf.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\bytes.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\dh.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\dhgroups.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\handshake.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\http.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\log.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\rtmp.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="librtmp\rtmp_sys.h">
|
||||||
|
<Filter>librtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="rtmp\rtmp_cln.h">
|
||||||
|
<Filter>rtmp</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\audio_capture.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="media\audio_encoder.h">
|
||||||
|
<Filter>media</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="MediaClient.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtTranslation Include="mediaclient_zh.ts">
|
||||||
|
<Filter>Translation Files</Filter>
|
||||||
|
</QtTranslation>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
BIN
MediaClient/MediaClient/Resources/1.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
MediaClient/MediaClient/Resources/16.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
MediaClient/MediaClient/Resources/4.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
MediaClient/MediaClient/Resources/6.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
MediaClient/MediaClient/Resources/9.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
MediaClient/MediaClient/Resources/browse_folder.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
MediaClient/MediaClient/Resources/btn_close.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
MediaClient/MediaClient/Resources/btn_max.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
MediaClient/MediaClient/Resources/btn_max_hot.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
MediaClient/MediaClient/Resources/btn_min.png
Normal file
|
After Width: | Height: | Size: 176 B |
BIN
MediaClient/MediaClient/Resources/btn_pause.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
MediaClient/MediaClient/Resources/btn_play.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
MediaClient/MediaClient/Resources/btn_stop.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
MediaClient/MediaClient/Resources/config.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
MediaClient/MediaClient/Resources/custom.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
MediaClient/MediaClient/Resources/full.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
MediaClient/MediaClient/Resources/help.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
MediaClient/MediaClient/Resources/main.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
MediaClient/MediaClient/Resources/mic.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
MediaClient/MediaClient/Resources/mute.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
MediaClient/MediaClient/Resources/open_folder.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
MediaClient/MediaClient/Resources/snapshot.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
MediaClient/MediaClient/Resources/stop_record.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
MediaClient/MediaClient/Resources/stopall.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
MediaClient/MediaClient/Resources/stopmic.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
MediaClient/MediaClient/Resources/video_record.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
MediaClient/MediaClient/Resources/volume.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
79
MediaClient/MediaClient/RtmpClientLibrary-android.mk
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = librtmpclient.so
|
||||||
|
NDK=/home/android-ndk-r25c
|
||||||
|
API=33
|
||||||
|
PLATFORM=armv7a
|
||||||
|
TOOLCHAIN=$(NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin
|
||||||
|
SYSROOT=$(NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot
|
||||||
|
ifneq ($(findstring armv7a, $(PLATFORM)),)
|
||||||
|
TARGET=$(PLATFORM)-linux-androideabi
|
||||||
|
RANLIB=$(TOOLCHAIN)/arm-linux-androideabi-ranlib
|
||||||
|
LINK = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
endif
|
||||||
|
ifneq ($(findstring aarch64, $(PLATFORM)),)
|
||||||
|
TARGET=$(PLATFORM)-linux-android
|
||||||
|
RANLIB=$(TOOLCHAIN)/$(TARGET)-ranlib
|
||||||
|
LINK = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
endif
|
||||||
|
CCOMPILE = $(TOOLCHAIN)/$(TARGET)$(API)-clang
|
||||||
|
CPPCOMPILE = $(TOOLCHAIN)/$(TARGET)$(API)-clang++
|
||||||
|
COMPILEOPTION += -fPIC -DANDROID --sysroot=$(SYSROOT)
|
||||||
|
COMPILEOPTION += -c -O3 -Wall
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/hashswf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += librtmp/parseurl.o
|
||||||
|
OBJS += librtmp/rtmp.o
|
||||||
|
OBJS += rtmp/rtmp_cln.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
72
MediaClient/MediaClient/RtmpClientLibrary-ios.mk
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = librtmpclient.so
|
||||||
|
ARCH=arm64 #armv7, armv7s arm64
|
||||||
|
IOSVER=9.0
|
||||||
|
BASE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
||||||
|
SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
|
||||||
|
CCOMPILE = $(BASE)/clang
|
||||||
|
CPPCOMPILE = $(BASE)/clang++
|
||||||
|
COMPILEOPTION += -c -pipe -g -arch $(ARCH)
|
||||||
|
COMPILEOPTION += -Xarch_$(ARCH) -miphoneos-version-min=$(IOSVER) -Xarch_$(ARCH) -isysroot$(SYSROOT)
|
||||||
|
COMPILEOPTION += -fobjc-nonfragile-abi -fobjc-legacy-dispatch -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = $(BASE)/ar
|
||||||
|
LINKOPTION += -stdlib=libc++ -arch $(ARCH) -miphoneos-version-min=$(IOSVER) -Xarch_$(ARCH) -Wl,-syslibroot,$(SYSROOT) -Wl,-rpath,@executable_path/../Frameworks
|
||||||
|
LINKOPTION = -r $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/hashswf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += librtmp/parseurl.o
|
||||||
|
OBJS += librtmp/rtmp.o
|
||||||
|
OBJS += rtmp/rtmp_cln.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
67
MediaClient/MediaClient/RtmpClientLibrary-mac.mk
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = librtmpclient.so
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION += -c -O3 -fPIC -Wall
|
||||||
|
COMPILEOPTION += -DIOS
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I/usr/local/include
|
||||||
|
LIBDIRS += -L/usr/local/lib
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/hashswf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += librtmp/parseurl.o
|
||||||
|
OBJS += librtmp/rtmp.o
|
||||||
|
OBJS += rtmp/rtmp_cln.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB += -lcrypto
|
||||||
|
SHAREDLIB += -lssl
|
||||||
|
SHAREDLIB += -lz
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
64
MediaClient/MediaClient/RtmpClientLibrary-static.mk
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = librtmpclient.a
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION += -c -O3 -fPIC -Wall
|
||||||
|
LINK = ar
|
||||||
|
LINKOPTION = cr $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/hashswf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += librtmp/parseurl.o
|
||||||
|
OBJS += librtmp/rtmp.o
|
||||||
|
OBJS += rtmp/rtmp_cln.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
65
MediaClient/MediaClient/RtmpClientLibrary.mk
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
################OPTION###################
|
||||||
|
OUTPUT = librtmpclient.so
|
||||||
|
CCOMPILE = gcc
|
||||||
|
CPPCOMPILE = g++
|
||||||
|
COMPILEOPTION += -c -O3 -fPIC -Wall
|
||||||
|
LINK = g++
|
||||||
|
LINKOPTION = -shared -o $(OUTPUT)
|
||||||
|
INCLUDEDIR += -I.
|
||||||
|
INCLUDEDIR += -I./bm
|
||||||
|
INCLUDEDIR += -I./librtmp
|
||||||
|
INCLUDEDIR += -I./media
|
||||||
|
INCLUDEDIR += -I./rtmp
|
||||||
|
INCLUDEDIR += -I./rtp
|
||||||
|
INCLUDEDIR += -I./openssl/include
|
||||||
|
LIBDIRS +=
|
||||||
|
OBJS += bm/hqueue.o
|
||||||
|
OBJS += bm/sys_log.o
|
||||||
|
OBJS += bm/sys_os.o
|
||||||
|
OBJS += bm/util.o
|
||||||
|
OBJS += bm/word_analyse.o
|
||||||
|
OBJS += librtmp/amf.o
|
||||||
|
OBJS += librtmp/hashswf.o
|
||||||
|
OBJS += librtmp/log.o
|
||||||
|
OBJS += librtmp/parseurl.o
|
||||||
|
OBJS += librtmp/rtmp.o
|
||||||
|
OBJS += rtmp/rtmp_cln.o
|
||||||
|
OBJS += rtp/h264_util.o
|
||||||
|
OBJS += rtp/h265_util.o
|
||||||
|
|
||||||
|
SHAREDLIB +=
|
||||||
|
|
||||||
|
APPENDLIB =
|
||||||
|
|
||||||
|
################OPTION END################
|
||||||
|
|
||||||
|
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||||
|
./mklinks.sh
|
||||||
|
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(OUTPUT)
|
||||||
|
all: clean $(OUTPUT)
|
||||||
|
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||||
|
|
||||||
|
.m.o:
|
||||||
|
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||||
|
|
||||||
|
.mm.o:
|
||||||
|
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||||
|
|
||||||
181
MediaClient/MediaClient/RtmpClientLibrary.vcxproj
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{4C15B47A-6C99-4D48-AF7D-5566E0CCDD91}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>RtmpClientLibrary</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996;4267;4244;4018</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level1</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>.;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4996;4267;4244;4018</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="bm\base64.cpp" />
|
||||||
|
<ClCompile Include="bm\hqueue.cpp" />
|
||||||
|
<ClCompile Include="bm\linked_list.cpp" />
|
||||||
|
<ClCompile Include="bm\ppstack.cpp" />
|
||||||
|
<ClCompile Include="bm\rfc_md5.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_buf.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_log.cpp" />
|
||||||
|
<ClCompile Include="bm\sys_os.cpp" />
|
||||||
|
<ClCompile Include="bm\util.cpp" />
|
||||||
|
<ClCompile Include="bm\word_analyse.cpp" />
|
||||||
|
<ClCompile Include="librtmp\amf.c" />
|
||||||
|
<ClCompile Include="librtmp\hashswf.c" />
|
||||||
|
<ClCompile Include="librtmp\log.c" />
|
||||||
|
<ClCompile Include="librtmp\parseurl.c" />
|
||||||
|
<ClCompile Include="librtmp\rtmp.c" />
|
||||||
|
<ClCompile Include="rtmp\rtmp_cln.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="rtmp\rtmp_cln.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||